Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kuzzle-sdk",
"version": "6.0.0-beta-1",
"version": "6.0.0-beta-2",
"description": "Official Javascript SDK for Kuzzle",
"author": "The Kuzzle Team <[email protected]>",
"repository": {
Expand Down
24 changes: 2 additions & 22 deletions src/Kuzzle.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,8 @@ class Kuzzle extends KuzzleEventEmitter {
* a developer simply wish to verify his token
*/
if (this.jwt !== undefined
&& request.controller !== 'auth'
&& request.action !== 'checkToken'
&& !(request.controller === 'auth'
&& request.action === 'checkToken')
) {
request.jwt = this.jwt;
}
Expand Down Expand Up @@ -391,24 +391,4 @@ class Kuzzle extends KuzzleEventEmitter {
}
}


for (const prop of [
'autoQueue',
'autoReconnect',
'autoReplay',
'jwt',
'host',
'offlineQueue',
'offlineQueueLoader',
'port',
'queueFilter',
'queueMaxSize',
'queueTTL',
'reconnectionDelay',
'replayInterval',
'sslConnection'
]) {
Object.defineProperty(Kuzzle.prototype, prop, {enumerable: true});
}

module.exports = Kuzzle;
8 changes: 4 additions & 4 deletions src/controllers/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ class CollectionController {
.then(response => response.result);
}

deleteSpecification (index, collection, options = {}) {
deleteSpecifications (index, collection, options = {}) {
if (!index) {
throw new Error('Kuzzle.collection.deleteSpecification: index is required');
throw new Error('Kuzzle.collection.deleteSpecifications: index is required');
}
if (!collection) {
throw new Error('Kuzzle.collection.deleteSpecification: collection is required');
throw new Error('Kuzzle.collection.deleteSpecifications: collection is required');
}

return this.kuzzle.query({
index,
collection,
controller: 'collection',
action: 'deleteSpecification'
action: 'deleteSpecifications'
}, options)
.then(response => response.result);
}
Expand Down
17 changes: 0 additions & 17 deletions src/networkWrapper/protocols/abstract/common.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
'use strict';

const
uuidv4 = require('../../../uuidv4'),
KuzzleEventEmitter = require('../../../eventEmitter');

const
_id = uuidv4();
// read-only properties
let
_host,
Expand Down Expand Up @@ -39,10 +36,6 @@ class AbstractWrapper extends KuzzleEventEmitter {
});
}

get id () {
return _id;
}

get host () {
return _host;
}
Expand Down Expand Up @@ -262,14 +255,4 @@ Discarded request: ${JSON.stringify(request)}`));
}
}

// make public getters enumerable
for (const prop of [
'host',
'id',
'port',
'ssl'
]) {
Object.defineProperty(AbstractWrapper.prototype, prop, {enumerable: true});
}

module.exports = AbstractWrapper;
8 changes: 0 additions & 8 deletions src/networkWrapper/protocols/abstract/realtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,4 @@ class RTWrapper extends AbstractWrapper {
}
}

// make public properties enumerable
for (const prop of [
'autoReconnect',
'reconnectionDelay'
]) {
Object.defineProperty(RTWrapper.prototype, prop, {enumerable: true});
}

module.exports = RTWrapper;
6 changes: 0 additions & 6 deletions src/networkWrapper/protocols/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,4 @@ class HttpWrapper extends AbtractWrapper {

}

for (const prop of [
'protocol'
]) {
Object.defineProperty(HttpWrapper.prototype, prop, {enumerable: true});
}

module.exports = HttpWrapper;
16 changes: 8 additions & 8 deletions test/controllers/collection.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,29 +67,29 @@ describe('Collection Controller', () => {
});
});

describe('deleteSpecifications', () => {
describe('deleteSpecificationss', () => {
it('should throw an error if the "index" argument is not provided', () => {
should(function () {
kuzzle.collection.deleteSpecification(undefined, 'collection', options);
}).throw('Kuzzle.collection.deleteSpecification: index is required');
kuzzle.collection.deleteSpecifications(undefined, 'collection', options);
}).throw('Kuzzle.collection.deleteSpecifications: index is required');
});

it('should throw an error if the "collection" argument is not provided', () => {
should(function () {
kuzzle.collection.deleteSpecification('index', undefined, options);
}).throw('Kuzzle.collection.deleteSpecification: collection is required');
kuzzle.collection.deleteSpecifications('index', undefined, options);
}).throw('Kuzzle.collection.deleteSpecifications: collection is required');
});

it('should call collection/deleteSpecification query and return a Promise which resolves an acknowledgement', () => {
it('should call collection/deleteSpecifications query and return a Promise which resolves an acknowledgement', () => {
kuzzle.query.resolves({result: {acknowledged: true}});

return kuzzle.collection.deleteSpecification('index', 'collection', options)
return kuzzle.collection.deleteSpecifications('index', 'collection', options)
.then(res => {
should(kuzzle.query)
.be.calledOnce()
.be.calledWith({
controller: 'collection',
action: 'deleteSpecification',
action: 'deleteSpecifications',
index: 'index',
collection: 'collection'
}, options);
Expand Down