Skip to content

Commit

Permalink
Travis CI - [ci skip] - automatic dist folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis CI committed Jan 15, 2016
1 parent 92e9047 commit 1a79928
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 11 deletions.
90 changes: 82 additions & 8 deletions dist/kuzzle.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ module.exports = Kuzzle = function (url, options, cb) {
return this.bluebird.promisifyAll(this, {
suffix: 'Promise',
filter: function (name, func, target, passes) {
var whitelist = ['getAllStatistics', 'getStatistics', 'listCollections', 'now', 'query'];
var whitelist = ['getAllStatistics', 'getServerInfo', 'getStatistics', 'listCollections', 'listIndexes', 'now', 'query'];

return passes && whitelist.indexOf(name) !== -1;
}
Expand Down Expand Up @@ -961,16 +961,39 @@ Kuzzle.prototype.flushQueue = function () {
/**
* Returns the list of known persisted data collections.
*
* @param {string} [index] - Index containing collections to be listed
* @param {object} [options] - Optional parameters
* @param {responseCallback} cb - Handles the query response
* @returns {object} this
*/
Kuzzle.prototype.listCollections = function (options, cb) {
var collectionType = 'all';
Kuzzle.prototype.listCollections = function () {
var
collectionType = 'all',
index,
options,
cb,
args = Array.prototype.slice.call(arguments);

args.forEach(function(arg) {
switch (typeof arg) {
case 'string':
index = arg;
break;
case 'object':
options = arg;
break;
case 'function':
cb = arg;
break;
}
});

if (!cb && typeof options === 'function') {
cb = options;
options = null;
if (!index) {
if (!this.defaultIndex) {
throw new Error('Kuzzle.listCollections: index required');
}

index = this.defaultIndex;
}

this.callbackRequired('Kuzzle.listCollections', cb);
Expand All @@ -979,7 +1002,7 @@ Kuzzle.prototype.listCollections = function (options, cb) {
collectionType = options.type;
}

this.query({controller: 'read', action: 'listCollections'}, {body: {type: collectionType}}, options, function (err, res) {
this.query({index: index, controller: 'read', action: 'listCollections'}, {body: {type: collectionType}}, options, function (err, res) {
if (err) {
return cb(err);
}
Expand All @@ -990,6 +1013,32 @@ Kuzzle.prototype.listCollections = function (options, cb) {
return this;
};

/**
* Returns the list of existing indexes in Kuzzle
*
* @param {object} [options] - Optional arguments
* @param {responseCallback} cb - Handles the query response
* @returns {object} this
*/
Kuzzle.prototype.listIndexes = function (options, cb) {
if (!cb && typeof options === 'function') {
cb = options;
options = null;
}

this.callbackRequired('Kuzzle.listIndexes', cb);

this.query({controller: 'read', action: 'listIndexes'}, {}, options, function (err, res) {
if (err) {
return cb(err);
}

return cb(null, res.result.indexes);
});

return this;
};

/**
* Disconnects from Kuzzle and invalidate this instance.
*/
Expand All @@ -1009,6 +1058,32 @@ Kuzzle.prototype.disconnect = function () {
}
};

/**
* Returns the server informations
*
* @param {object} [options] - Optional arguments
* @param {responseCallback} cb - Handles the query response
* @returns {object} this
*/
Kuzzle.prototype.getServerInfo = function (options, cb) {
if (!cb && typeof options === 'function') {
cb = options;
options = null;
}

this.callbackRequired('Kuzzle.getServerInfo', cb);

this.query({controller: 'read', action: 'serverInfo'}, {}, options, function (err, res) {
if (err) {
return cb(err);
}

cb(null, res.result.serverInfo);
});

return this;
};

/**
* Return the current Kuzzle's UTC Epoch time, in milliseconds
* @param {object} [options] - Optional parameters
Expand Down Expand Up @@ -1182,7 +1257,6 @@ Kuzzle.prototype.replayQueue = function () {
return this;
};


/**
* Sets the default Kuzzle index
*
Expand Down
Loading

0 comments on commit 1a79928

Please sign in to comment.