Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

kuzzle-sdk

Package Overview
Dependencies
Maintainers
1
Versions
178
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kuzzle-sdk - npm Package Compare versions

Comparing version 1.0.0-alpha.5 to 1.0.0-alpha.6

test/kuzzle/constructor.test.js

21

package.json
{
"name": "kuzzle-sdk",
"version": "1.0.0-alpha.5",
"description": "A connector for the Kuzzle API",
"version": "1.0.0-alpha.6",
"description": "Official Javascript SDK for Kuzzle",
"author": "The Kuzzle Team <support@kuzzle.io>",

@@ -14,6 +14,10 @@ "repository": {

"baas",
"real-time",
"advanced-search",
"backend",
"realtime",
"advanced search",
"bulk"
],
"scripts": {
"test": "istanbul cover _mocha -- --recursive "
},
"browser": "src/kuzzle.js",

@@ -24,3 +28,3 @@ "main": "index.js",

"bluebird": "3.0.5",
"node-uuid": "1.4.3",
"node-uuid": "1.4.7",
"socket.io-client": "1.3.7"

@@ -33,5 +37,10 @@ },

"grunt-contrib-jshint": "^0.11.3",
"grunt-contrib-uglify": "0.10.1",
"gruntify-eslint": "^1.0.1",
"grunt-contrib-uglify": "0.9.1"
"istanbul": "0.4.0",
"istanbul-middleware": "0.2.1",
"mocha": "2.3.3",
"rewire": "^2.5.0",
"should": "7.1.1"
}
}

@@ -30,2 +30,4 @@ var

module.exports = Kuzzle = function (url, options, cb) {
var self = this;
if (!(this instanceof Kuzzle)) {

@@ -90,7 +92,7 @@ return new Kuzzle(url, options, cb);

autoReconnect: {
value: (options && options.autoReconnect) ? options.autoReconnect : true,
value: (options && typeof options.autoReconnect === 'boolean') ? options.autoReconnect : true,
enumerable: true
},
reconnectionDelay: {
value: (options && options.reconnectionDelay) ? options.reconnectionDelay : 1000,
value: (options && typeof options.reconnectionDelay === 'number') ? options.reconnectionDelay : 1000,
enumerable: true

@@ -163,4 +165,4 @@ },

Object.keys(options).forEach(function (opt) {
if (this.hasOwnProperty(opt) && Object.getOwnPropertyDescriptor(this, opt).writable) {
this[opt] = options[opt];
if (self.hasOwnProperty(opt) && Object.getOwnPropertyDescriptor(self, opt).writable) {
self[opt] = options[opt];
}

@@ -175,2 +177,3 @@ });

// Helper function ensuring that this Kuzzle object is still valid before performing a query
// istanbul ignore next
Object.defineProperty(this, 'isValid', {

@@ -185,2 +188,3 @@ value: function () {

// Helper function copying headers to the query data
// istanbul ignore next
Object.defineProperty(this, 'addHeaders', {

@@ -202,2 +206,3 @@ value: function (query, headers) {

*/
// istanbul ignore next
Object.defineProperty(this, 'callbackRequired', {

@@ -214,3 +219,10 @@ value: function (errorMessagePrefix, callback) {

if (this.bluebird) {
return this.bluebird.promisifyAll(this, {suffix: 'Promise'});
return this.bluebird.promisifyAll(this, {
suffix: 'Promise',
filter: function (name, func, target, passes) {
var whitelist = ['getAllStatistics', 'getStatistics', 'listCollections', 'now', 'query'];
return passes && whitelist.indexOf(name) !== -1;
}
});
}

@@ -235,3 +247,7 @@

self.socket = io(url, {reconnection: this.autoReconnect, reconnectionDelay: this.reconnectionDelay});
self.socket = io(url, {
reconnection: this.autoReconnect,
reconnectionDelay: this.reconnectionDelay,
'force new connection': true
});

@@ -246,3 +262,3 @@ self.socket.once('connect', function () {

self.socket.once('error', function (error) {
self.socket.once('connect_error', function (error) {
self.state = 'error';

@@ -288,4 +304,4 @@ self.logout();

if (self.autoReplay) {
cleanQueue.call(this);
dequeue.call(this);
cleanQueue.call(self);
dequeue.call(self);
}

@@ -420,4 +436,2 @@

Kuzzle.prototype.getAllStatistics = function (options, cb) {
this.isValid();
if (!cb && typeof options === 'function') {

@@ -477,3 +491,2 @@ cb = options;

this.isValid();
this.callbackRequired('Kuzzle.getStatistics', cb);

@@ -557,4 +570,2 @@

Kuzzle.prototype.listCollections = function (options, cb) {
this.isValid();
if (!cb && typeof options === 'function') {

@@ -602,4 +613,2 @@ cb = options;

Kuzzle.prototype.now = function (options, cb) {
this.isValid();
if (!cb && typeof options === 'function') {

@@ -717,4 +726,2 @@ cb = options;

this.isValid();
if (event) {

@@ -744,4 +751,2 @@ if (knownEvents.indexOf(event) === -1) {

this.isValid();
if (knownEvents.indexOf(event) === -1) {

@@ -748,0 +753,0 @@ throw new Error('[' + event + '] is not a known event. Known events: ' + knownEvents.toString());

@@ -41,3 +41,10 @@ var

if (this.kuzzle.bluebird) {
return this.kuzzle.bluebird.promisifyAll(this, {suffix: 'Promise'});
return this.kuzzle.bluebird.promisifyAll(this, {
suffix: 'Promise',
filter: function (name, func, target, passes) {
var blacklist = ['publish', 'setHeaders', 'subscribe'];
return passes && blacklist.indexOf(name) === -1;
}
});
}

@@ -44,0 +51,0 @@

@@ -46,3 +46,10 @@ /**

if (this.kuzzle.bluebird) {
return this.kuzzle.bluebird.promisifyAll(this, {suffix: 'Promise'});
return this.kuzzle.bluebird.promisifyAll(this, {
suffix: 'Promise',
filter: function (name, func, target, passes) {
var blacklist = ['set', 'setHeaders'];
return passes && blacklist.indexOf(name) === -1;
}
});
}

@@ -49,0 +56,0 @@

@@ -97,3 +97,10 @@ /**

if (this.kuzzle.bluebird) {
return this.kuzzle.bluebird.promisifyAll(this, {suffix: 'Promise'});
return this.kuzzle.bluebird.promisifyAll(this, {
suffix: 'Promise',
filter: function (name, func, target, passes) {
var whitelist = ['delete', 'refresh', 'save'];
return passes && whitelist.indexOf(name) !== -1;
}
});
}

@@ -100,0 +107,0 @@

@@ -99,3 +99,10 @@ var uuid = require('node-uuid');

if (this.kuzzle.bluebird) {
return this.kuzzle.bluebird.promisifyAll(this, {suffix: 'Promise'});
return this.kuzzle.bluebird.promisifyAll(this, {
suffix: 'Promise',
filter: function (name, func, target, passes) {
var whitelist = ['count'];
return passes && whitelist.indexOf(name) !== -1;
}
});
}

@@ -102,0 +109,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc