kuzzle 2.16.5 → 2.16.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/lib/api/controllers/adminController.js +4 -3
- package/lib/api/controllers/authController.js +2 -2
- package/lib/api/controllers/collectionController.js +2 -8
- package/lib/api/request/kuzzleRequest.d.ts +11 -11
- package/lib/api/request/kuzzleRequest.js +34 -48
- package/lib/cluster/workers/IDCardRenewer.js +11 -2
- package/lib/config/default.config.d.ts +13 -0
- package/lib/config/default.config.js +363 -362
- package/lib/config/index.js +7 -5
- package/lib/core/backend/backendConfig.d.ts +3 -3
- package/lib/core/backend/backendConfig.js +2 -2
- package/lib/core/plugin/pluginContext.d.ts +10 -1
- package/lib/core/plugin/pluginContext.js +2 -0
- package/lib/core/security/securityLoader.js +1 -1
- package/lib/core/shared/repository.js +1 -1
- package/lib/model/security/profile.js +10 -10
- package/lib/model/security/role.js +3 -3
- package/lib/service/cache/redis.js +33 -0
- package/lib/service/storage/elasticsearch.js +6 -0
- package/lib/types/PasswordPolicy.d.ts +77 -0
- package/lib/types/PasswordPolicy.js +3 -0
- package/lib/types/ProfileDefinition.d.ts +48 -0
- package/lib/types/ProfileDefinition.js +3 -0
- package/lib/types/RoleDefinition.d.ts +27 -0
- package/lib/types/RoleDefinition.js +3 -0
- package/lib/types/config/DumpConfiguration.d.ts +42 -0
- package/lib/types/config/DumpConfiguration.js +3 -0
- package/lib/types/config/HttpConfiguration.d.ts +43 -0
- package/lib/types/config/HttpConfiguration.js +9 -0
- package/lib/types/config/KuzzleConfiguration.d.ts +123 -0
- package/lib/types/config/KuzzleConfiguration.js +3 -0
- package/lib/types/config/LimitsConfiguration.d.ts +111 -0
- package/lib/types/config/LimitsConfiguration.js +3 -0
- package/lib/types/config/PluginsConfiguration.d.ts +177 -0
- package/lib/types/config/PluginsConfiguration.js +3 -0
- package/lib/types/config/SecurityConfiguration.d.ts +182 -0
- package/lib/types/config/SecurityConfiguration.js +3 -0
- package/lib/types/config/ServerConfiguration.d.ts +195 -0
- package/lib/types/config/ServerConfiguration.js +3 -0
- package/lib/types/config/ServicesConfiguration.d.ts +41 -0
- package/lib/types/config/ServicesConfiguration.js +3 -0
- package/lib/types/config/StorageService/StorageServiceElasticsearchConfiguration.d.ts +217 -0
- package/lib/types/config/StorageService/StorageServiceElasticsearchConfiguration.js +3 -0
- package/lib/types/config/internalCache/InternalCacheRedisConfiguration.d.ts +111 -0
- package/lib/types/config/internalCache/InternalCacheRedisConfiguration.js +3 -0
- package/lib/types/config/publicCache/PublicCacheRedisConfiguration.d.ts +31 -0
- package/lib/types/config/publicCache/PublicCacheRedisConfiguration.js +3 -0
- package/lib/types/index.d.ts +17 -0
- package/lib/types/index.js +17 -0
- package/package-lock.json +368 -360
- package/package.json +20 -19
package/README.md
CHANGED
|
@@ -138,3 +138,14 @@ Check our [contributing documentation](./CONTRIBUTING.md) to know about our codi
|
|
|
138
138
|
## License
|
|
139
139
|
|
|
140
140
|
Kuzzle is published under [Apache 2 License](./LICENSE.md).
|
|
141
|
+
|
|
142
|
+
## About Mac M1
|
|
143
|
+
|
|
144
|
+
First of all make sure that you have at least `4GB` of ram allocated to your vm **docker desktop** and that it is running.
|
|
145
|
+
|
|
146
|
+
Run the following command to install all the dependencies in your container:
|
|
147
|
+
```bash
|
|
148
|
+
npm run docker:install
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
finally run the command `docker-compose up` to launch your kuzzle stack.
|
|
@@ -156,7 +156,7 @@ class AdminController extends NativeController {
|
|
|
156
156
|
const fixtures = request.getBody();
|
|
157
157
|
|
|
158
158
|
return this._waitForAction(
|
|
159
|
-
request.getRefresh('
|
|
159
|
+
request.getRefresh('wait_for'),
|
|
160
160
|
global.kuzzle.ask('core:storage:public:document:import', fixtures));
|
|
161
161
|
}
|
|
162
162
|
|
|
@@ -164,7 +164,7 @@ class AdminController extends NativeController {
|
|
|
164
164
|
const mappings = request.getBody();
|
|
165
165
|
|
|
166
166
|
return this._waitForAction(
|
|
167
|
-
request.getRefresh('
|
|
167
|
+
request.getRefresh('wait_for'),
|
|
168
168
|
global.kuzzle.ask(
|
|
169
169
|
'core:storage:public:mappings:import',
|
|
170
170
|
mappings,
|
|
@@ -176,11 +176,12 @@ class AdminController extends NativeController {
|
|
|
176
176
|
const user = request.getUser();
|
|
177
177
|
const onExistingUsers = request.input.args.onExistingUsers;
|
|
178
178
|
const force = request.getBoolean('force');
|
|
179
|
-
const waitForRefresh = request.getRefresh('
|
|
179
|
+
const waitForRefresh = request.getRefresh('wait_for');
|
|
180
180
|
|
|
181
181
|
const promise = this.ask('core:security:load', permissions, {
|
|
182
182
|
force,
|
|
183
183
|
onExistingUsers,
|
|
184
|
+
refresh: waitForRefresh,
|
|
184
185
|
user,
|
|
185
186
|
});
|
|
186
187
|
|
|
@@ -430,11 +430,11 @@ class AuthController extends NativeController {
|
|
|
430
430
|
token = request.input.jwt;
|
|
431
431
|
}
|
|
432
432
|
else {
|
|
433
|
-
token = request.getBodyString('token');
|
|
433
|
+
token = request.getBodyString('token', '') || null;
|
|
434
434
|
}
|
|
435
435
|
|
|
436
436
|
try {
|
|
437
|
-
const { expiresAt, userId } = await this.ask('core:security:token:verify', token);
|
|
437
|
+
const { expiresAt = -1, userId } = await this.ask('core:security:token:verify', token);
|
|
438
438
|
|
|
439
439
|
return { expiresAt, kuid: userId, valid: true };
|
|
440
440
|
}
|
|
@@ -269,7 +269,7 @@ class CollectionController extends NativeController {
|
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
/**
|
|
272
|
-
* Reset a collection by removing all documents
|
|
272
|
+
* Reset a collection by removing all documents while keeping the existing mapping
|
|
273
273
|
*
|
|
274
274
|
* @param {KuzzleRequest} request
|
|
275
275
|
* @returns {Promise.<Object>}
|
|
@@ -277,13 +277,7 @@ class CollectionController extends NativeController {
|
|
|
277
277
|
async truncate (request) {
|
|
278
278
|
const { index, collection } = request.getIndexAndCollection();
|
|
279
279
|
|
|
280
|
-
await this.ask('core:storage:public:collection:
|
|
281
|
-
await this.ask(
|
|
282
|
-
'core:storage:public:document:deleteByQuery',
|
|
283
|
-
index,
|
|
284
|
-
collection,
|
|
285
|
-
{},
|
|
286
|
-
{ fetch: false, refresh: 'wait_for' });
|
|
280
|
+
await this.ask('core:storage:public:collection:truncate', index, collection);
|
|
287
281
|
|
|
288
282
|
return {
|
|
289
283
|
acknowledged: true
|
|
@@ -161,7 +161,7 @@ export declare class KuzzleRequest {
|
|
|
161
161
|
* value provided
|
|
162
162
|
* @throws {api.assert.invalid_type} If the fetched parameter is not a number
|
|
163
163
|
*/
|
|
164
|
-
getBodyNumber(name: string, def?: number |
|
|
164
|
+
getBodyNumber(name: string, def?: number | undefined): number;
|
|
165
165
|
/**
|
|
166
166
|
* Gets a parameter from a request body and checks that it is a integer
|
|
167
167
|
*
|
|
@@ -174,7 +174,7 @@ export declare class KuzzleRequest {
|
|
|
174
174
|
* value provided
|
|
175
175
|
* @throws {api.assert.invalid_type} If the fetched parameter is not an integer
|
|
176
176
|
*/
|
|
177
|
-
getBodyInteger(name: string, def?: number |
|
|
177
|
+
getBodyInteger(name: string, def?: number | undefined): number;
|
|
178
178
|
/**
|
|
179
179
|
* Gets a parameter from a request body and checks that it is a string
|
|
180
180
|
*
|
|
@@ -187,7 +187,7 @@ export declare class KuzzleRequest {
|
|
|
187
187
|
* value provided
|
|
188
188
|
* @throws {api.assert.invalid_type} If the fetched parameter is not a string
|
|
189
189
|
*/
|
|
190
|
-
getBodyString(name: string, def?: string |
|
|
190
|
+
getBodyString(name: string, def?: string | undefined): string;
|
|
191
191
|
/**
|
|
192
192
|
* Gets a parameter from a request body and checks that it is an array
|
|
193
193
|
*
|
|
@@ -200,7 +200,7 @@ export declare class KuzzleRequest {
|
|
|
200
200
|
* value provided
|
|
201
201
|
* @throws {api.assert.invalid_type} If the fetched parameter is not an array
|
|
202
202
|
*/
|
|
203
|
-
getBodyArray(name: string, def?: [] |
|
|
203
|
+
getBodyArray(name: string, def?: [] | undefined): any[];
|
|
204
204
|
/**
|
|
205
205
|
* Gets a parameter from a request body and checks that it is an object
|
|
206
206
|
*
|
|
@@ -213,7 +213,7 @@ export declare class KuzzleRequest {
|
|
|
213
213
|
* value provided
|
|
214
214
|
* @throws {api.assert.invalid_type} If the fetched parameter is not an object
|
|
215
215
|
*/
|
|
216
|
-
getBodyObject(name: string, def?: JSONObject |
|
|
216
|
+
getBodyObject(name: string, def?: JSONObject | undefined): JSONObject;
|
|
217
217
|
/**
|
|
218
218
|
* Gets a parameter from a request arguments and checks that it is a boolean
|
|
219
219
|
* Contrary to other parameter types, an unset boolean does not trigger an
|
|
@@ -232,7 +232,7 @@ export declare class KuzzleRequest {
|
|
|
232
232
|
* value provided
|
|
233
233
|
* @throws {api.assert.invalid_type} If the fetched parameter is not a number
|
|
234
234
|
*/
|
|
235
|
-
getNumber(name: string, def?: number |
|
|
235
|
+
getNumber(name: string, def?: number | undefined): number;
|
|
236
236
|
/**
|
|
237
237
|
* Gets a parameter from a request arguments and checks that it is an integer
|
|
238
238
|
*
|
|
@@ -243,7 +243,7 @@ export declare class KuzzleRequest {
|
|
|
243
243
|
* value provided
|
|
244
244
|
* @throws {api.assert.invalid_type} If the fetched parameter is not an integer
|
|
245
245
|
*/
|
|
246
|
-
getInteger(name: string, def?: number |
|
|
246
|
+
getInteger(name: string, def?: number | undefined): number;
|
|
247
247
|
/**
|
|
248
248
|
* Gets a parameter from a request arguments and checks that it is a string
|
|
249
249
|
*
|
|
@@ -254,7 +254,7 @@ export declare class KuzzleRequest {
|
|
|
254
254
|
* value provided
|
|
255
255
|
* @throws {api.assert.invalid_type} If the fetched parameter is not a string
|
|
256
256
|
*/
|
|
257
|
-
getString(name: string, def?: string |
|
|
257
|
+
getString(name: string, def?: string | undefined): string;
|
|
258
258
|
/**
|
|
259
259
|
* Gets a parameter from a request arguments and checks that it is an array
|
|
260
260
|
*
|
|
@@ -265,7 +265,7 @@ export declare class KuzzleRequest {
|
|
|
265
265
|
* value provided
|
|
266
266
|
* @throws {api.assert.invalid_type} If the fetched parameter is not an array
|
|
267
267
|
*/
|
|
268
|
-
getArray(name: string, def?: [] |
|
|
268
|
+
getArray(name: string, def?: [] | undefined): any[];
|
|
269
269
|
/**
|
|
270
270
|
* Gets a parameter from a request arguments and checks that it is an object
|
|
271
271
|
*
|
|
@@ -276,7 +276,7 @@ export declare class KuzzleRequest {
|
|
|
276
276
|
* value provided
|
|
277
277
|
* @throws {api.assert.invalid_type} If the fetched parameter is not an object
|
|
278
278
|
*/
|
|
279
|
-
getObject(name: string, def?: JSONObject |
|
|
279
|
+
getObject(name: string, def?: JSONObject | undefined): JSONObject;
|
|
280
280
|
/**
|
|
281
281
|
* Returns the index specified in the request
|
|
282
282
|
*/
|
|
@@ -300,7 +300,7 @@ export declare class KuzzleRequest {
|
|
|
300
300
|
* @throws {api.assert.body_required} If the body is not set and if no default
|
|
301
301
|
* value is provided
|
|
302
302
|
*/
|
|
303
|
-
getBody(def?: JSONObject |
|
|
303
|
+
getBody(def?: JSONObject | undefined): JSONObject;
|
|
304
304
|
/**
|
|
305
305
|
* Returns the `_id` specified in the request.
|
|
306
306
|
*
|
|
@@ -52,6 +52,7 @@ const errors_1 = require("../../kerror/errors");
|
|
|
52
52
|
const kerror_1 = __importDefault(require("../../kerror"));
|
|
53
53
|
const assert = __importStar(require("../../util/assertType"));
|
|
54
54
|
const safeObject_1 = require("../../util/safeObject");
|
|
55
|
+
const lodash_1 = require("lodash");
|
|
55
56
|
const assertionError = kerror_1.default.wrap('api', 'assert');
|
|
56
57
|
// private properties
|
|
57
58
|
// \u200b is a zero width space, used to masquerade console.log output
|
|
@@ -349,10 +350,10 @@ class KuzzleRequest {
|
|
|
349
350
|
* value provided
|
|
350
351
|
* @throws {api.assert.invalid_type} If the fetched parameter is not a number
|
|
351
352
|
*/
|
|
352
|
-
getBodyNumber(name, def =
|
|
353
|
+
getBodyNumber(name, def = undefined) {
|
|
353
354
|
const body = this.input.body;
|
|
354
355
|
if (body === null) {
|
|
355
|
-
if (def !==
|
|
356
|
+
if (def !== undefined) {
|
|
356
357
|
return def;
|
|
357
358
|
}
|
|
358
359
|
throw assertionError.get('body_required');
|
|
@@ -371,10 +372,10 @@ class KuzzleRequest {
|
|
|
371
372
|
* value provided
|
|
372
373
|
* @throws {api.assert.invalid_type} If the fetched parameter is not an integer
|
|
373
374
|
*/
|
|
374
|
-
getBodyInteger(name, def =
|
|
375
|
+
getBodyInteger(name, def = undefined) {
|
|
375
376
|
const body = this.input.body;
|
|
376
377
|
if (body === null) {
|
|
377
|
-
if (def !==
|
|
378
|
+
if (def !== undefined) {
|
|
378
379
|
return def;
|
|
379
380
|
}
|
|
380
381
|
throw assertionError.get('body_required');
|
|
@@ -393,10 +394,10 @@ class KuzzleRequest {
|
|
|
393
394
|
* value provided
|
|
394
395
|
* @throws {api.assert.invalid_type} If the fetched parameter is not a string
|
|
395
396
|
*/
|
|
396
|
-
getBodyString(name, def =
|
|
397
|
+
getBodyString(name, def = undefined) {
|
|
397
398
|
const body = this.input.body;
|
|
398
399
|
if (body === null) {
|
|
399
|
-
if (def !==
|
|
400
|
+
if (def !== undefined) {
|
|
400
401
|
return def;
|
|
401
402
|
}
|
|
402
403
|
throw assertionError.get('body_required');
|
|
@@ -415,10 +416,10 @@ class KuzzleRequest {
|
|
|
415
416
|
* value provided
|
|
416
417
|
* @throws {api.assert.invalid_type} If the fetched parameter is not an array
|
|
417
418
|
*/
|
|
418
|
-
getBodyArray(name, def =
|
|
419
|
+
getBodyArray(name, def = undefined) {
|
|
419
420
|
const body = this.input.body;
|
|
420
421
|
if (body === null) {
|
|
421
|
-
if (def !==
|
|
422
|
+
if (def !== undefined) {
|
|
422
423
|
return def;
|
|
423
424
|
}
|
|
424
425
|
throw assertionError.get('body_required');
|
|
@@ -437,10 +438,10 @@ class KuzzleRequest {
|
|
|
437
438
|
* value provided
|
|
438
439
|
* @throws {api.assert.invalid_type} If the fetched parameter is not an object
|
|
439
440
|
*/
|
|
440
|
-
getBodyObject(name, def =
|
|
441
|
+
getBodyObject(name, def = undefined) {
|
|
441
442
|
const body = this.input.body;
|
|
442
443
|
if (body === null) {
|
|
443
|
-
if (def !==
|
|
444
|
+
if (def !== undefined) {
|
|
444
445
|
return def;
|
|
445
446
|
}
|
|
446
447
|
throw assertionError.get('body_required');
|
|
@@ -467,7 +468,7 @@ class KuzzleRequest {
|
|
|
467
468
|
* value provided
|
|
468
469
|
* @throws {api.assert.invalid_type} If the fetched parameter is not a number
|
|
469
470
|
*/
|
|
470
|
-
getNumber(name, def =
|
|
471
|
+
getNumber(name, def = undefined) {
|
|
471
472
|
return this._getNumber(this.input.args, name, name, def);
|
|
472
473
|
}
|
|
473
474
|
/**
|
|
@@ -480,7 +481,7 @@ class KuzzleRequest {
|
|
|
480
481
|
* value provided
|
|
481
482
|
* @throws {api.assert.invalid_type} If the fetched parameter is not an integer
|
|
482
483
|
*/
|
|
483
|
-
getInteger(name, def =
|
|
484
|
+
getInteger(name, def = undefined) {
|
|
484
485
|
return this._getInteger(this.input.args, name, name, def);
|
|
485
486
|
}
|
|
486
487
|
/**
|
|
@@ -493,7 +494,7 @@ class KuzzleRequest {
|
|
|
493
494
|
* value provided
|
|
494
495
|
* @throws {api.assert.invalid_type} If the fetched parameter is not a string
|
|
495
496
|
*/
|
|
496
|
-
getString(name, def =
|
|
497
|
+
getString(name, def = undefined) {
|
|
497
498
|
return this._getString(this.input.args, name, name, def);
|
|
498
499
|
}
|
|
499
500
|
/**
|
|
@@ -506,7 +507,7 @@ class KuzzleRequest {
|
|
|
506
507
|
* value provided
|
|
507
508
|
* @throws {api.assert.invalid_type} If the fetched parameter is not an array
|
|
508
509
|
*/
|
|
509
|
-
getArray(name, def =
|
|
510
|
+
getArray(name, def = undefined) {
|
|
510
511
|
return this._getArray(this.input.args, name, name, def);
|
|
511
512
|
}
|
|
512
513
|
/**
|
|
@@ -519,7 +520,7 @@ class KuzzleRequest {
|
|
|
519
520
|
* value provided
|
|
520
521
|
* @throws {api.assert.invalid_type} If the fetched parameter is not an object
|
|
521
522
|
*/
|
|
522
|
-
getObject(name, def =
|
|
523
|
+
getObject(name, def = undefined) {
|
|
523
524
|
return this._getObject(this.input.args, name, name, def);
|
|
524
525
|
}
|
|
525
526
|
/**
|
|
@@ -565,9 +566,9 @@ class KuzzleRequest {
|
|
|
565
566
|
* @throws {api.assert.body_required} If the body is not set and if no default
|
|
566
567
|
* value is provided
|
|
567
568
|
*/
|
|
568
|
-
getBody(def =
|
|
569
|
+
getBody(def = undefined) {
|
|
569
570
|
if (this.input.body === null) {
|
|
570
|
-
if (def !==
|
|
571
|
+
if (def !== undefined) {
|
|
571
572
|
return def;
|
|
572
573
|
}
|
|
573
574
|
throw assertionError.get('body_required');
|
|
@@ -685,7 +686,7 @@ class KuzzleRequest {
|
|
|
685
686
|
* @param errorName name to use in error messages
|
|
686
687
|
*/
|
|
687
688
|
_getBoolean(obj, name, errorName) {
|
|
688
|
-
let value = (0,
|
|
689
|
+
let value = (0, lodash_1.get)(obj, name);
|
|
689
690
|
// In HTTP, booleans are flags: if it's in the querystring, it's set,
|
|
690
691
|
// whatever its value.
|
|
691
692
|
// If a user needs to unset the option, they need to remove it from the
|
|
@@ -713,12 +714,9 @@ class KuzzleRequest {
|
|
|
713
714
|
* @param errorName - name to use in error messages
|
|
714
715
|
* @param def default value
|
|
715
716
|
*/
|
|
716
|
-
_getNumber(obj, name, errorName, def =
|
|
717
|
-
let value = (0,
|
|
718
|
-
if (value === undefined
|
|
719
|
-
if (def !== null) {
|
|
720
|
-
return def;
|
|
721
|
-
}
|
|
717
|
+
_getNumber(obj, name, errorName, def = undefined) {
|
|
718
|
+
let value = (0, lodash_1.get)(obj, name, def);
|
|
719
|
+
if (value === undefined) {
|
|
722
720
|
throw assertionError.get('missing_argument', errorName);
|
|
723
721
|
}
|
|
724
722
|
value = Number.parseFloat(value);
|
|
@@ -735,12 +733,9 @@ class KuzzleRequest {
|
|
|
735
733
|
* @param errorName name to use in error messages
|
|
736
734
|
* @param def default value
|
|
737
735
|
*/
|
|
738
|
-
_getInteger(obj, name, errorName, def =
|
|
739
|
-
let value = (0,
|
|
740
|
-
if (value === undefined
|
|
741
|
-
if (def !== null) {
|
|
742
|
-
return def;
|
|
743
|
-
}
|
|
736
|
+
_getInteger(obj, name, errorName, def = undefined) {
|
|
737
|
+
let value = (0, lodash_1.get)(obj, name, def);
|
|
738
|
+
if (value === undefined) {
|
|
744
739
|
throw assertionError.get('missing_argument', errorName);
|
|
745
740
|
}
|
|
746
741
|
value = Number.parseFloat(value);
|
|
@@ -757,12 +752,9 @@ class KuzzleRequest {
|
|
|
757
752
|
* @param errorName name to use in error messages
|
|
758
753
|
* @param def default value
|
|
759
754
|
*/
|
|
760
|
-
_getString(obj, name, errorName, def =
|
|
761
|
-
const value = (0,
|
|
762
|
-
if (value === undefined
|
|
763
|
-
if (def !== null) {
|
|
764
|
-
return def;
|
|
765
|
-
}
|
|
755
|
+
_getString(obj, name, errorName, def = undefined) {
|
|
756
|
+
const value = (0, lodash_1.get)(obj, name, def);
|
|
757
|
+
if (value === undefined) {
|
|
766
758
|
throw assertionError.get('missing_argument', errorName);
|
|
767
759
|
}
|
|
768
760
|
if (typeof value !== 'string') {
|
|
@@ -778,12 +770,9 @@ class KuzzleRequest {
|
|
|
778
770
|
* @param errorName name to use in error messages
|
|
779
771
|
* @param def default value
|
|
780
772
|
*/
|
|
781
|
-
_getArray(obj, name, errorName, def =
|
|
782
|
-
const value = (0,
|
|
783
|
-
if (value === undefined
|
|
784
|
-
if (def !== null) {
|
|
785
|
-
return def;
|
|
786
|
-
}
|
|
773
|
+
_getArray(obj, name, errorName, def = undefined) {
|
|
774
|
+
const value = (0, lodash_1.get)(obj, name, def);
|
|
775
|
+
if (value === undefined) {
|
|
787
776
|
throw assertionError.get('missing_argument', errorName);
|
|
788
777
|
}
|
|
789
778
|
if (!Array.isArray(value)) {
|
|
@@ -799,12 +788,9 @@ class KuzzleRequest {
|
|
|
799
788
|
* @param errorName name to use in error messages
|
|
800
789
|
* @param def default value
|
|
801
790
|
*/
|
|
802
|
-
_getObject(obj, name, errorName, def =
|
|
803
|
-
const value = (0,
|
|
804
|
-
if (value === undefined
|
|
805
|
-
if (def !== null) {
|
|
806
|
-
return def;
|
|
807
|
-
}
|
|
791
|
+
_getObject(obj, name, errorName, def = undefined) {
|
|
792
|
+
const value = (0, lodash_1.get)(obj, name, def);
|
|
793
|
+
if (value === undefined) {
|
|
808
794
|
throw assertionError.get('missing_argument', errorName);
|
|
809
795
|
}
|
|
810
796
|
if (!(0, safeObject_1.isPlainObject)(value)) {
|
|
@@ -55,8 +55,9 @@ class IDCardRenewer {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
async initRedis (config, name) {
|
|
58
|
-
|
|
59
|
-
await
|
|
58
|
+
const redis = new Redis(config, name);
|
|
59
|
+
await redis.init();
|
|
60
|
+
this.redis = redis;
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
async renewIDCard () {
|
|
@@ -89,8 +90,16 @@ class IDCardRenewer {
|
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
this.disposed = true;
|
|
93
|
+
|
|
92
94
|
clearInterval(this.refreshTimer);
|
|
93
95
|
this.refreshTimer = null;
|
|
96
|
+
|
|
97
|
+
// If the worker is disposed before it had time to starts, redis service
|
|
98
|
+
// may not have been initialized
|
|
99
|
+
if (! this.redis) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
|
|
94
103
|
try {
|
|
95
104
|
await this.redis.commands.del(this.nodeIdKey);
|
|
96
105
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { KuzzleConfiguration } from '../types/config/KuzzleConfiguration';
|
|
2
|
+
/**
|
|
3
|
+
* /!\ DO NOT MODIFY THIS FILE
|
|
4
|
+
*
|
|
5
|
+
* To customize your Kuzzle installation, create a
|
|
6
|
+
* ".kuzzlerc" file and put your overrides there.
|
|
7
|
+
* Please check the ".kuzzlerc.sample" file to get
|
|
8
|
+
* started.
|
|
9
|
+
*
|
|
10
|
+
* @class KuzzleConfiguration
|
|
11
|
+
*/
|
|
12
|
+
declare const defaultConfig: KuzzleConfiguration;
|
|
13
|
+
export default defaultConfig;
|