Skip to content

Commit de07e2d

Browse files
authored
Merge pull request #500 from kuzzleio/fix-base-controller
Allow to use custom controller in another package
2 parents 8b7ee47 + b58e059 commit de07e2d

File tree

13 files changed

+19
-36
lines changed

13 files changed

+19
-36
lines changed

doc/7/controllers/collection/search-specifications/snippets/search-specifications.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ try {
1010
const options = {
1111
size: 50,
1212
offset: 0,
13-
scroll: '10m'
13+
scroll: '10s'
1414
};
1515

1616
const searchResult = await kuzzle.collection.searchSpecifications(body, options);

doc/7/core-classes/search-result/next/snippets/scroll.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ try {
1313
'nyc-open-data',
1414
'yellow-taxi',
1515
{ query: { match: { category: 'suv' } } },
16-
{ scroll: '1m', size: 10 });
16+
{ scroll: '10s', size: 10 });
1717

1818
// Fetch the matched items by advancing through the result pages
1919
const matched = [];

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "kuzzle-sdk",
3-
"version": "7.1.2",
3+
"version": "7.1.3",
44
"description": "Official Javascript SDK for Kuzzle",
55
"author": "The Kuzzle Team <[email protected]>",
66
"repository": {

src/Kuzzle.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const
99
ServerController = require('./controllers/server'),
1010
SecurityController = require('./controllers/security'),
1111
MemoryStorageController = require('./controllers/memoryStorage'),
12-
BaseController = require('./controllers/base'),
1312
uuidv4 = require('./uuidv4'),
1413
proxify = require('./proxify');
1514

@@ -517,10 +516,6 @@ Discarded request: ${JSON.stringify(request)}`));
517516
* @returns {Kuzzle}
518517
*/
519518
useController (ControllerClass, accessor) {
520-
if (!(ControllerClass.prototype instanceof BaseController)) {
521-
throw new Error('Controllers must inherits from the BaseController class.');
522-
}
523-
524519
if (!(accessor && accessor.length > 0)) {
525520
throw new Error('You must provide a valid accessor.');
526521
}

test/controllers/document.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ describe('Document Controller', () => {
412412
};
413413
kuzzle.query.resolves({result});
414414

415-
return kuzzle.document.search('index', 'collection', {foo: 'bar'}, {from: 1, size: 2, scroll: '1m'})
415+
return kuzzle.document.search('index', 'collection', {foo: 'bar'}, {from: 1, size: 2, scroll: '10s'})
416416
.then(res => {
417417
should(kuzzle.query)
418418
.be.calledOnce()
@@ -424,7 +424,7 @@ describe('Document Controller', () => {
424424
body: {foo: 'bar'},
425425
from: 1,
426426
size: 2,
427-
scroll: '1m'
427+
scroll: '10s'
428428
}, {});
429429

430430
should(res).be.an.instanceOf(DocumentSearchResult);

test/controllers/searchResult/document.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ describe('DocumentSearchResult', () => {
106106
};
107107

108108
beforeEach(() => {
109-
request.scroll = '1m';
109+
request.scroll = '10s';
110110

111111
response = {
112112
scrollId: 'scroll-id',
@@ -130,7 +130,7 @@ describe('DocumentSearchResult', () => {
130130
.be.calledWith({
131131
controller: 'document',
132132
action: 'scroll',
133-
scroll: '1m',
133+
scroll: '10s',
134134
scrollId: 'scroll-id'
135135
}, options);
136136
should(nextSearchResult).not.be.equal(searchResult);

test/controllers/searchResult/profile.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ describe('ProfileSearchResult', () => {
110110
};
111111

112112
beforeEach(() => {
113-
request.scroll = '1m';
113+
request.scroll = '10s';
114114

115115
response = {
116116
scrollId: 'scroll-id',
@@ -133,7 +133,7 @@ describe('ProfileSearchResult', () => {
133133
.be.calledWith({
134134
controller: 'security',
135135
action: 'scrollProfiles',
136-
scroll: '1m',
136+
scroll: '10s',
137137
scrollId: 'scroll-id'
138138
}, options);
139139
should(nextSearchResult).not.be.equal(searchResult);

test/controllers/searchResult/role.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ describe('RoleSearchResult', () => {
8484

8585

8686
it('should throw an error if scrollId parameters is set', () => {
87-
request.scroll = '1m';
87+
request.scroll = '10s';
8888
searchResult = new RoleSearchResult(kuzzle, request, options, response);
8989

9090
should(function () {

test/controllers/searchResult/specifications.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ describe('SpecificationsSearchResult', () => {
100100
};
101101

102102
beforeEach(() => {
103-
request.scroll = '1m';
103+
request.scroll = '10s';
104104

105105
response = {
106106
scrollId: 'scroll-id',
@@ -123,7 +123,7 @@ describe('SpecificationsSearchResult', () => {
123123
.be.calledWith({
124124
controller: 'collection',
125125
action: 'scrollSpecifications',
126-
scroll: '1m',
126+
scroll: '10s',
127127
scrollId: 'scroll-id'
128128
}, options);
129129
should(nextSearchResult).not.be.equal(searchResult);

0 commit comments

Comments
 (0)