/**
 * Utilities for accessing CouchDB.
 */
define([
    "jquery",
    "settings"
], function($, appSettings) {
    var couchUtils = {

        /**
         * Determine if current session is active.
         * @return Promise
         **/
        isLoggedIn: function() {
            var dfrd = $.Deferred();

            $.ajax({
                url: appSettings.get("urlPrefix") + "/_session",
                dataType: "json"
            }).done(function(data) {
                // Payload must have userCtx.name !== null.
                if (_.has(data, "userCtx") && (!_.isNull(data.userCtx.name))) {
                    dfrd.resolve();
                } else {
                    dfrd.reject();
                }
            }).fail(function() {
                dfrd.reject();
            })

            return dfrd;
        },

        /**
         * Login to CouchDB
         * @return Promise
         */
        login: function(userName, password) {
            // $.Deferred callbacks: done, fail, always
            return $.ajax({
                type: "POST",
                url: appSettings.get("urlPrefix") + "/_session",
                dataType: "json",
                data: {
                    name: userName,
                    password: password
                }
            });
        },

        logout: function() {
            return $.ajax({
                type: "DELETE",
                url: appSettings.get("urlPrefix") + "/_session"
            });
        }

    };

    return couchUtils;
});

@@ -127,16 +127,529 @@
 tils = %7B
+%0A        /**%0A         * Get UUIDs directly from CouchDB.%0A         **/%0A        getUUIDs: function() %7B%0A            // Returns list of UUIDs (defaults to 1 item).%0A            var dfrd = $.Deferred();%0A            $.ajax(%7B%0A                url: %22/_uuids%22,%0A                dataType: %22json%22%0A            %7D).done(function(data) %7B%0A                var uuids = data.uuids;%0A                dfrd.resolve(uuids);%0A            %7D).fail(function() %7B%0A                dfrd.reject();%0A            %7D);%0A%0A            return dfrd;%0A        %7D,
 %0A%0A      

Add getUUIDs helper