Skip to content

Commit ab135fa

Browse files
author
Travis CI
committed
Travis CI - [ci skip] - automatic dist folder
1 parent 6fd522d commit ab135fa

File tree

3 files changed

+82
-29
lines changed

3 files changed

+82
-29
lines changed

dist/kuzzle.js

Lines changed: 78 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -961,6 +961,40 @@ Kuzzle.prototype.whoAmI = function (callback) {
961961
return self;
962962
};
963963

964+
965+
/**
966+
* Update current user in Kuzzle.
967+
*
968+
* @param {object} content - a plain javascript object representing the user's modification
969+
* @param {object} [options] - (optional) arguments
970+
* @param {responseCallback} [cb] - (optional) Handles the query response
971+
*/
972+
Kuzzle.prototype.updateSelf = function (content, options, cb) {
973+
var
974+
self = this,
975+
data = {},
976+
queryArgs = {controller: 'auth', action: 'updateSelf'};
977+
978+
if (!cb && typeof options === 'function') {
979+
cb = options;
980+
options = null;
981+
}
982+
983+
data.body = content;
984+
985+
if (cb) {
986+
self.query(queryArgs, data, options, function (err, res) {
987+
if (err) {
988+
return cb(err);
989+
}
990+
991+
cb(null, res.result);
992+
});
993+
} else {
994+
self.query(queryArgs, data, options);
995+
}
996+
};
997+
964998
/**
965999
* Clean up the queue, ensuring the queryTTL and queryMaxSize properties are respected
9661000
*/
@@ -1873,27 +1907,6 @@ KuzzleDataCollection.prototype.createDocument = function (id, document, options,
18731907
return this;
18741908
};
18751909

1876-
/**
1877-
* Delete this data collection and all documents in it.
1878-
*
1879-
* @param {object} [options] - Optional parameters
1880-
* @param {responseCallback} [cb] - returns Kuzzle's response
1881-
* @returns {*} this
1882-
*/
1883-
KuzzleDataCollection.prototype.delete = function (options, cb) {
1884-
var data = {};
1885-
1886-
if (!cb && typeof options === 'function') {
1887-
cb = options;
1888-
options = null;
1889-
}
1890-
1891-
data = this.kuzzle.addHeaders(data, this.headers);
1892-
this.kuzzle.query(this.buildQueryArgs('admin', 'deleteCollection'), data, options, cb);
1893-
1894-
return this;
1895-
};
1896-
18971910
/**
18981911
* Delete persistent documents.
18991912
*
@@ -2730,6 +2743,36 @@ KuzzleDocument.prototype.setHeaders = function (content, replace) {
27302743
module.exports = KuzzleDocument;
27312744

27322745
},{}],7:[function(require,module,exports){
2746+
/**
2747+
* This is a global callback pattern, called by all asynchronous functions of the Kuzzle object.
2748+
*
2749+
* @callback responseCallback
2750+
* @param {Object} err - Error object, NULL if the query is successful
2751+
* @param {Object} data - The content of the query response
2752+
*/
2753+
2754+
2755+
/**
2756+
* Kuzzle's memory storage is a separate data store from the database layer.
2757+
* It is internaly based on Redis. You can access most of Redis functions (all
2758+
* lowercased), excepting:
2759+
* * all cluster based functions
2760+
* * all script based functions
2761+
* * all cursors functions
2762+
*
2763+
* For instance:
2764+
* kuzzle.memoryStorage
2765+
* .set('myKey', 'myValue')
2766+
* .get('myKey', function (err, response) {
2767+
* console.log(response.result);
2768+
*
2769+
* // { _id: 'foo', body: { value: 'myValue' }}
2770+
* });
2771+
*
2772+
*
2773+
* @param {object} kuzzle - Kuzzle instance to inherit from
2774+
* @constructor
2775+
*/
27332776
function KuzzleMemoryStorage(kuzzle) {
27342777
Object.defineProperties(this, {
27352778
// read-only properties
@@ -2762,6 +2805,9 @@ function KuzzleMemoryStorage(kuzzle) {
27622805
}
27632806

27642807

2808+
/**
2809+
* constructs the memoryStorage functions.
2810+
*/
27652811
(function() {
27662812

27672813
var
@@ -3064,7 +3110,7 @@ KuzzleRoom.prototype.count = function (cb) {
30643110

30653111
data = this.kuzzle.addHeaders({body: {roomId: this.roomId}}, this.headers);
30663112

3067-
if (this.subscribing) {
3113+
if (!isReady.call(this)) {
30683114
this.queue.push({action: 'count', args: [cb]});
30693115
return this;
30703116
}
@@ -3185,7 +3231,7 @@ KuzzleRoom.prototype.unsubscribe = function () {
31853231
room = self.roomId,
31863232
interval;
31873233

3188-
if (self.subscribing) {
3234+
if (!isReady.call(this)) {
31893235
self.queue.push({action: 'unsubscribe', args: []});
31903236
return self;
31913237
}
@@ -3273,6 +3319,13 @@ function dequeue () {
32733319
}
32743320
}
32753321

3322+
function isReady() {
3323+
if (this.kuzzle.state !== 'connected' || this.subscribing) {
3324+
return false;
3325+
}
3326+
return true;
3327+
}
3328+
32763329
module.exports = KuzzleRoom;
32773330

32783331
},{"node-uuid":2}],9:[function(require,module,exports){
@@ -4218,10 +4271,10 @@ KuzzleSecurity.prototype.updateUser = function (id, content, options, cb) {
42184271
return cb(err);
42194272
}
42204273

4221-
cb(null, res.result._id);
4274+
cb(null, new KuzzleUser(self, res.result._id, res.result._source));
42224275
});
42234276
} else {
4224-
self.kuzzle.query(this.buildQueryArgs(action), data);
4277+
self.kuzzle.query(this.buildQueryArgs(action), data, options);
42254278
}
42264279
};
42274280

0 commit comments

Comments
 (0)