kuzzle 2.27.0 → 2.27.2
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 +12 -6
- package/lib/api/controllers/adminController.js +9 -9
- package/lib/api/controllers/bulkController.js +9 -9
- package/lib/api/controllers/collectionController.js +17 -17
- package/lib/api/controllers/documentController.js +51 -51
- package/lib/api/controllers/indexController.js +4 -4
- package/lib/api/controllers/memoryStorageController.js +11 -11
- package/lib/api/controllers/realtimeController.js +1 -1
- package/lib/api/controllers/securityController.js +67 -70
- package/lib/api/controllers/serverController.js +5 -5
- package/lib/api/documentExtractor.js +3 -3
- package/lib/api/funnel.js +43 -43
- package/lib/api/rateLimiter.js +1 -1
- package/lib/cluster/command.js +4 -4
- package/lib/cluster/idCardHandler.js +1 -1
- package/lib/cluster/node.js +55 -55
- package/lib/cluster/subscriber.js +33 -33
- package/lib/cluster/workers/IDCardRenewer.js +4 -4
- package/lib/config/index.js +24 -24
- package/lib/core/auth/passportWrapper.js +6 -6
- package/lib/core/cache/cacheEngine.js +20 -20
- package/lib/core/network/accessLogger.js +15 -15
- package/lib/core/network/entryPoint.js +12 -12
- package/lib/core/network/httpRouter/index.js +4 -4
- package/lib/core/network/httpRouter/routePart.js +2 -2
- package/lib/core/network/protocols/httpwsProtocol.js +60 -53
- package/lib/core/network/protocols/internalProtocol.js +2 -2
- package/lib/core/network/protocols/mqttProtocol.js +9 -9
- package/lib/core/network/protocols/protocol.js +3 -3
- package/lib/core/network/router.js +7 -7
- package/lib/core/plugin/plugin.js +23 -23
- package/lib/core/plugin/pluginManifest.js +1 -1
- package/lib/core/plugin/pluginsManager.js +62 -62
- package/lib/core/realtime/notifier.js +14 -14
- package/lib/core/security/README.md +223 -0
- package/lib/core/security/roleRepository.js +18 -18
- package/lib/core/security/securityLoader.js +7 -7
- package/lib/core/security/userRepository.js +16 -16
- package/lib/core/shared/README.md +3 -0
- package/lib/core/shared/abstractManifest.js +1 -1
- package/lib/core/shared/sdk/impersonatedSdk.js +1 -1
- package/lib/core/shared/store.js +11 -11
- package/lib/core/statistics/statistics.js +15 -15
- package/lib/core/storage/clientAdapter.js +61 -61
- package/lib/core/validation/baseType.js +1 -1
- package/lib/core/validation/types/date.js +1 -1
- package/lib/core/validation/types/enum.js +5 -5
- package/lib/core/validation/types/geoShape.js +13 -13
- package/lib/core/validation/types/numeric.js +2 -2
- package/lib/core/validation/types/string.js +2 -2
- package/lib/core/validation/validation.js +71 -71
- package/lib/kerror/codes/index.js +23 -23
- package/lib/kuzzle/dumpGenerator.js +17 -17
- package/lib/kuzzle/event/kuzzleEventEmitter.js +9 -9
- package/lib/kuzzle/event/pipeRunner.js +2 -2
- package/lib/kuzzle/internalIndexHandler.js +8 -8
- package/lib/kuzzle/log.js +2 -2
- package/lib/kuzzle/vault.js +4 -4
- package/lib/model/security/role.js +3 -1
- package/lib/model/security/user.js +3 -1
- package/lib/model/storage/apiKey.js +3 -3
- package/lib/model/storage/baseModel.js +7 -7
- package/lib/service/cache/redis.js +3 -3
- package/lib/service/storage/elasticsearch.js +53 -54
- package/lib/service/storage/esWrapper.js +3 -3
- package/lib/service/storage/queryTranslator.js +2 -2
- package/lib/util/assertType.js +1 -1
- package/lib/util/deprecate.js +3 -3
- package/lib/util/extractFields.js +2 -2
- package/lib/util/wildcard.js +1 -1
- package/package.json +68 -81
|
@@ -40,7 +40,7 @@ class ClientAdapter {
|
|
|
40
40
|
constructor(scope) {
|
|
41
41
|
this.client = new Elasticsearch(
|
|
42
42
|
global.kuzzle.config.services.storageEngine,
|
|
43
|
-
scope
|
|
43
|
+
scope,
|
|
44
44
|
);
|
|
45
45
|
this.scope = scope;
|
|
46
46
|
this.cache = new IndexCache();
|
|
@@ -62,7 +62,7 @@ class ClientAdapter {
|
|
|
62
62
|
* Manually refresh the index cache (e.g. after alias creation)
|
|
63
63
|
*/
|
|
64
64
|
global.kuzzle.onAsk(`core:storage:${this.scope}:cache:refresh`, () =>
|
|
65
|
-
this.populateCache()
|
|
65
|
+
this.populateCache(),
|
|
66
66
|
);
|
|
67
67
|
|
|
68
68
|
/**
|
|
@@ -70,7 +70,7 @@ class ClientAdapter {
|
|
|
70
70
|
* @returns {Promise.<Object>}
|
|
71
71
|
*/
|
|
72
72
|
global.kuzzle.onAsk(`core:storage:${this.scope}:info:get`, () =>
|
|
73
|
-
this.client.info()
|
|
73
|
+
this.client.info(),
|
|
74
74
|
);
|
|
75
75
|
|
|
76
76
|
/**
|
|
@@ -80,7 +80,7 @@ class ClientAdapter {
|
|
|
80
80
|
* @returns {Object} Equivalent Elasticsearch query
|
|
81
81
|
*/
|
|
82
82
|
global.kuzzle.onAsk(`core:storage:${this.scope}:translate`, (filters) =>
|
|
83
|
-
this.client.translateKoncordeFilters(filters)
|
|
83
|
+
this.client.translateKoncordeFilters(filters),
|
|
84
84
|
);
|
|
85
85
|
}
|
|
86
86
|
|
|
@@ -107,7 +107,7 @@ class ClientAdapter {
|
|
|
107
107
|
index,
|
|
108
108
|
collection,
|
|
109
109
|
opts,
|
|
110
|
-
{ indexCacheOnly = false, propagate = true } = {}
|
|
110
|
+
{ indexCacheOnly = false, propagate = true } = {},
|
|
111
111
|
) {
|
|
112
112
|
if (!indexCacheOnly) {
|
|
113
113
|
await this.client.createCollection(index, collection, opts);
|
|
@@ -205,7 +205,7 @@ class ClientAdapter {
|
|
|
205
205
|
global.kuzzle.onAsk(
|
|
206
206
|
`core:storage:${this.scope}:collection:create`,
|
|
207
207
|
(index, collection, opts, creationOptions) =>
|
|
208
|
-
this.createCollection(index, collection, opts, creationOptions)
|
|
208
|
+
this.createCollection(index, collection, opts, creationOptions),
|
|
209
209
|
);
|
|
210
210
|
|
|
211
211
|
/**
|
|
@@ -217,7 +217,7 @@ class ClientAdapter {
|
|
|
217
217
|
*/
|
|
218
218
|
global.kuzzle.onAsk(
|
|
219
219
|
`core:storage:${this.scope}:collection:delete`,
|
|
220
|
-
(index, collection) => this.deleteCollection(index, collection)
|
|
220
|
+
(index, collection) => this.deleteCollection(index, collection),
|
|
221
221
|
);
|
|
222
222
|
|
|
223
223
|
/**
|
|
@@ -230,7 +230,7 @@ class ClientAdapter {
|
|
|
230
230
|
(index, collection) => {
|
|
231
231
|
this.cache.assertCollectionExists(index, collection);
|
|
232
232
|
return this.client.getSettings(index, collection);
|
|
233
|
-
}
|
|
233
|
+
},
|
|
234
234
|
);
|
|
235
235
|
|
|
236
236
|
/**
|
|
@@ -240,7 +240,7 @@ class ClientAdapter {
|
|
|
240
240
|
*/
|
|
241
241
|
global.kuzzle.onAsk(
|
|
242
242
|
`core:storage:${this.scope}:collection:exist`,
|
|
243
|
-
(index, collection) => this.cache.hasCollection(index, collection)
|
|
243
|
+
(index, collection) => this.cache.hasCollection(index, collection),
|
|
244
244
|
);
|
|
245
245
|
|
|
246
246
|
/**
|
|
@@ -249,7 +249,7 @@ class ClientAdapter {
|
|
|
249
249
|
* @returns {Promise.<string[]>}
|
|
250
250
|
*/
|
|
251
251
|
global.kuzzle.onAsk(`core:storage:${this.scope}:collection:list`, (index) =>
|
|
252
|
-
this.cache.listCollections(index)
|
|
252
|
+
this.cache.listCollections(index),
|
|
253
253
|
);
|
|
254
254
|
|
|
255
255
|
/**
|
|
@@ -263,7 +263,7 @@ class ClientAdapter {
|
|
|
263
263
|
(index, collection) => {
|
|
264
264
|
this.cache.assertCollectionExists(index, collection);
|
|
265
265
|
return this.client.refreshCollection(index, collection);
|
|
266
|
-
}
|
|
266
|
+
},
|
|
267
267
|
);
|
|
268
268
|
|
|
269
269
|
/**
|
|
@@ -277,7 +277,7 @@ class ClientAdapter {
|
|
|
277
277
|
(index, collection) => {
|
|
278
278
|
this.cache.assertCollectionExists(index, collection);
|
|
279
279
|
return this.client.truncateCollection(index, collection);
|
|
280
|
-
}
|
|
280
|
+
},
|
|
281
281
|
);
|
|
282
282
|
|
|
283
283
|
/**
|
|
@@ -292,7 +292,7 @@ class ClientAdapter {
|
|
|
292
292
|
(index, collection, changes) => {
|
|
293
293
|
this.cache.assertCollectionExists(index, collection);
|
|
294
294
|
return this.client.updateCollection(index, collection, changes);
|
|
295
|
-
}
|
|
295
|
+
},
|
|
296
296
|
);
|
|
297
297
|
}
|
|
298
298
|
|
|
@@ -306,7 +306,7 @@ class ClientAdapter {
|
|
|
306
306
|
*/
|
|
307
307
|
global.kuzzle.onAsk(
|
|
308
308
|
`core:storage:${this.scope}:index:create`,
|
|
309
|
-
(index, options) => this.createIndex(index, options)
|
|
309
|
+
(index, options) => this.createIndex(index, options),
|
|
310
310
|
);
|
|
311
311
|
|
|
312
312
|
/**
|
|
@@ -316,7 +316,7 @@ class ClientAdapter {
|
|
|
316
316
|
* @throws If the index does not exist
|
|
317
317
|
*/
|
|
318
318
|
global.kuzzle.onAsk(`core:storage:${this.scope}:index:delete`, (index) =>
|
|
319
|
-
this.deleteIndex(index)
|
|
319
|
+
this.deleteIndex(index),
|
|
320
320
|
);
|
|
321
321
|
|
|
322
322
|
/**
|
|
@@ -325,7 +325,7 @@ class ClientAdapter {
|
|
|
325
325
|
* @return {Promise.<boolean>}
|
|
326
326
|
*/
|
|
327
327
|
global.kuzzle.onAsk(`core:storage:${this.scope}:index:exist`, (index) =>
|
|
328
|
-
this.cache.hasIndex(index)
|
|
328
|
+
this.cache.hasIndex(index),
|
|
329
329
|
);
|
|
330
330
|
|
|
331
331
|
/**
|
|
@@ -333,7 +333,7 @@ class ClientAdapter {
|
|
|
333
333
|
* @returns {string[]}
|
|
334
334
|
*/
|
|
335
335
|
global.kuzzle.onAsk(`core:storage:${this.scope}:index:list`, () =>
|
|
336
|
-
this.cache.listIndexes()
|
|
336
|
+
this.cache.listIndexes(),
|
|
337
337
|
);
|
|
338
338
|
|
|
339
339
|
/**
|
|
@@ -343,7 +343,7 @@ class ClientAdapter {
|
|
|
343
343
|
* @throws If at least one index does not exist
|
|
344
344
|
*/
|
|
345
345
|
global.kuzzle.onAsk(`core:storage:${this.scope}:index:mDelete`, (indexes) =>
|
|
346
|
-
this.deleteIndexes(indexes)
|
|
346
|
+
this.deleteIndexes(indexes),
|
|
347
347
|
);
|
|
348
348
|
|
|
349
349
|
/**
|
|
@@ -351,7 +351,7 @@ class ClientAdapter {
|
|
|
351
351
|
* @returns {Promise.<Object>}
|
|
352
352
|
*/
|
|
353
353
|
global.kuzzle.onAsk(`core:storage:${this.scope}:index:stats`, () =>
|
|
354
|
-
this.client.stats()
|
|
354
|
+
this.client.stats(),
|
|
355
355
|
);
|
|
356
356
|
}
|
|
357
357
|
|
|
@@ -370,7 +370,7 @@ class ClientAdapter {
|
|
|
370
370
|
(index, collection, bulk, opts) => {
|
|
371
371
|
this.cache.assertCollectionExists(index, collection);
|
|
372
372
|
return this.client.import(index, collection, bulk, opts);
|
|
373
|
-
}
|
|
373
|
+
},
|
|
374
374
|
);
|
|
375
375
|
|
|
376
376
|
/**
|
|
@@ -386,7 +386,7 @@ class ClientAdapter {
|
|
|
386
386
|
(index, collection, query) => {
|
|
387
387
|
this.cache.assertCollectionExists(index, collection);
|
|
388
388
|
return this.client.count(index, collection, query);
|
|
389
|
-
}
|
|
389
|
+
},
|
|
390
390
|
);
|
|
391
391
|
|
|
392
392
|
/**
|
|
@@ -403,7 +403,7 @@ class ClientAdapter {
|
|
|
403
403
|
(index, collection, content, opts) => {
|
|
404
404
|
this.cache.assertCollectionExists(index, collection);
|
|
405
405
|
return this.client.create(index, collection, content, opts);
|
|
406
|
-
}
|
|
406
|
+
},
|
|
407
407
|
);
|
|
408
408
|
|
|
409
409
|
/**
|
|
@@ -425,9 +425,9 @@ class ClientAdapter {
|
|
|
425
425
|
collection,
|
|
426
426
|
id,
|
|
427
427
|
content,
|
|
428
|
-
opts
|
|
428
|
+
opts,
|
|
429
429
|
);
|
|
430
|
-
}
|
|
430
|
+
},
|
|
431
431
|
);
|
|
432
432
|
|
|
433
433
|
/**
|
|
@@ -444,7 +444,7 @@ class ClientAdapter {
|
|
|
444
444
|
(index, collection, id, opts) => {
|
|
445
445
|
this.cache.assertCollectionExists(index, collection);
|
|
446
446
|
return this.client.delete(index, collection, id, opts);
|
|
447
|
-
}
|
|
447
|
+
},
|
|
448
448
|
);
|
|
449
449
|
|
|
450
450
|
/**
|
|
@@ -461,7 +461,7 @@ class ClientAdapter {
|
|
|
461
461
|
(index, collection, query, opts) => {
|
|
462
462
|
this.cache.assertCollectionExists(index, collection);
|
|
463
463
|
return this.client.deleteByQuery(index, collection, query, opts);
|
|
464
|
-
}
|
|
464
|
+
},
|
|
465
465
|
);
|
|
466
466
|
|
|
467
467
|
/**
|
|
@@ -479,7 +479,7 @@ class ClientAdapter {
|
|
|
479
479
|
(index, collection, id, fields, opts) => {
|
|
480
480
|
this.cache.assertCollectionExists(index, collection);
|
|
481
481
|
return this.client.deleteFields(index, collection, id, fields, opts);
|
|
482
|
-
}
|
|
482
|
+
},
|
|
483
483
|
);
|
|
484
484
|
|
|
485
485
|
/**
|
|
@@ -495,7 +495,7 @@ class ClientAdapter {
|
|
|
495
495
|
(index, collection, id) => {
|
|
496
496
|
this.cache.assertCollectionExists(index, collection);
|
|
497
497
|
return this.client.exists(index, collection, id);
|
|
498
|
-
}
|
|
498
|
+
},
|
|
499
499
|
);
|
|
500
500
|
|
|
501
501
|
/**
|
|
@@ -511,7 +511,7 @@ class ClientAdapter {
|
|
|
511
511
|
(index, collection, ids) => {
|
|
512
512
|
this.cache.assertCollectionExists(index, collection);
|
|
513
513
|
return this.client.mExists(index, collection, ids);
|
|
514
|
-
}
|
|
514
|
+
},
|
|
515
515
|
);
|
|
516
516
|
|
|
517
517
|
/**
|
|
@@ -527,7 +527,7 @@ class ClientAdapter {
|
|
|
527
527
|
(index, collection, id) => {
|
|
528
528
|
this.cache.assertCollectionExists(index, collection);
|
|
529
529
|
return this.client.get(index, collection, id);
|
|
530
|
-
}
|
|
530
|
+
},
|
|
531
531
|
);
|
|
532
532
|
|
|
533
533
|
/**
|
|
@@ -537,7 +537,7 @@ class ClientAdapter {
|
|
|
537
537
|
*/
|
|
538
538
|
global.kuzzle.onAsk(
|
|
539
539
|
`core:storage:${this.scope}:document:import`,
|
|
540
|
-
(fixtures, options) => this.loadFixtures(fixtures, options)
|
|
540
|
+
(fixtures, options) => this.loadFixtures(fixtures, options),
|
|
541
541
|
);
|
|
542
542
|
|
|
543
543
|
/**
|
|
@@ -554,7 +554,7 @@ class ClientAdapter {
|
|
|
554
554
|
(index, collection, documents, opts) => {
|
|
555
555
|
this.cache.assertCollectionExists(index, collection);
|
|
556
556
|
return this.client.mCreate(index, collection, documents, opts);
|
|
557
|
-
}
|
|
557
|
+
},
|
|
558
558
|
);
|
|
559
559
|
|
|
560
560
|
/**
|
|
@@ -571,7 +571,7 @@ class ClientAdapter {
|
|
|
571
571
|
(index, collection, documents, opts) => {
|
|
572
572
|
this.cache.assertCollectionExists(index, collection);
|
|
573
573
|
return this.client.mCreateOrReplace(index, collection, documents, opts);
|
|
574
|
-
}
|
|
574
|
+
},
|
|
575
575
|
);
|
|
576
576
|
|
|
577
577
|
/**
|
|
@@ -588,7 +588,7 @@ class ClientAdapter {
|
|
|
588
588
|
(index, collection, ids, opts) => {
|
|
589
589
|
this.cache.assertCollectionExists(index, collection);
|
|
590
590
|
return this.client.mDelete(index, collection, ids, opts);
|
|
591
|
-
}
|
|
591
|
+
},
|
|
592
592
|
);
|
|
593
593
|
|
|
594
594
|
/**
|
|
@@ -605,7 +605,7 @@ class ClientAdapter {
|
|
|
605
605
|
(index, collection, documents, opts) => {
|
|
606
606
|
this.cache.assertCollectionExists(index, collection);
|
|
607
607
|
return this.client.mReplace(index, collection, documents, opts);
|
|
608
|
-
}
|
|
608
|
+
},
|
|
609
609
|
);
|
|
610
610
|
|
|
611
611
|
/**
|
|
@@ -622,7 +622,7 @@ class ClientAdapter {
|
|
|
622
622
|
(index, collection, documents, opts) => {
|
|
623
623
|
this.cache.assertCollectionExists(index, collection);
|
|
624
624
|
return this.client.mUpdate(index, collection, documents, opts);
|
|
625
|
-
}
|
|
625
|
+
},
|
|
626
626
|
);
|
|
627
627
|
|
|
628
628
|
/**
|
|
@@ -640,7 +640,7 @@ class ClientAdapter {
|
|
|
640
640
|
(index, collection, documents, opts) => {
|
|
641
641
|
this.cache.assertCollectionExists(index, collection);
|
|
642
642
|
return this.client.mUpsert(index, collection, documents, opts);
|
|
643
|
-
}
|
|
643
|
+
},
|
|
644
644
|
);
|
|
645
645
|
|
|
646
646
|
/**
|
|
@@ -658,7 +658,7 @@ class ClientAdapter {
|
|
|
658
658
|
(index, collection, query, callback, opts) => {
|
|
659
659
|
this.cache.assertCollectionExists(index, collection);
|
|
660
660
|
return this.client.mExecute(index, collection, query, callback, opts);
|
|
661
|
-
}
|
|
661
|
+
},
|
|
662
662
|
);
|
|
663
663
|
|
|
664
664
|
/**
|
|
@@ -674,7 +674,7 @@ class ClientAdapter {
|
|
|
674
674
|
(index, collection, ids) => {
|
|
675
675
|
this.cache.assertCollectionExists(index, collection);
|
|
676
676
|
return this.client.mGet(index, collection, ids);
|
|
677
|
-
}
|
|
677
|
+
},
|
|
678
678
|
);
|
|
679
679
|
|
|
680
680
|
/**
|
|
@@ -692,7 +692,7 @@ class ClientAdapter {
|
|
|
692
692
|
(index, collection, id, content, opts) => {
|
|
693
693
|
this.cache.assertCollectionExists(index, collection);
|
|
694
694
|
return this.client.replace(index, collection, id, content, opts);
|
|
695
|
-
}
|
|
695
|
+
},
|
|
696
696
|
);
|
|
697
697
|
|
|
698
698
|
/**
|
|
@@ -704,7 +704,7 @@ class ClientAdapter {
|
|
|
704
704
|
*/
|
|
705
705
|
global.kuzzle.onAsk(
|
|
706
706
|
`core:storage:${this.scope}:document:scroll`,
|
|
707
|
-
(scrollId, opts) => this.client.scroll(scrollId, opts)
|
|
707
|
+
(scrollId, opts) => this.client.scroll(scrollId, opts),
|
|
708
708
|
);
|
|
709
709
|
|
|
710
710
|
/**
|
|
@@ -721,7 +721,7 @@ class ClientAdapter {
|
|
|
721
721
|
(index, collection, searchBody, opts) => {
|
|
722
722
|
this.cache.assertCollectionExists(index, collection);
|
|
723
723
|
return this.client.search({ collection, index, searchBody }, opts);
|
|
724
|
-
}
|
|
724
|
+
},
|
|
725
725
|
);
|
|
726
726
|
|
|
727
727
|
/**
|
|
@@ -742,7 +742,7 @@ class ClientAdapter {
|
|
|
742
742
|
}
|
|
743
743
|
|
|
744
744
|
return this.client.search({ searchBody, targets }, opts);
|
|
745
|
-
}
|
|
745
|
+
},
|
|
746
746
|
);
|
|
747
747
|
|
|
748
748
|
/**
|
|
@@ -760,7 +760,7 @@ class ClientAdapter {
|
|
|
760
760
|
(index, collection, id, content, opts) => {
|
|
761
761
|
this.cache.assertCollectionExists(index, collection);
|
|
762
762
|
return this.client.update(index, collection, id, content, opts);
|
|
763
|
-
}
|
|
763
|
+
},
|
|
764
764
|
);
|
|
765
765
|
|
|
766
766
|
/**
|
|
@@ -783,9 +783,9 @@ class ClientAdapter {
|
|
|
783
783
|
collection,
|
|
784
784
|
query,
|
|
785
785
|
changes,
|
|
786
|
-
opts
|
|
786
|
+
opts,
|
|
787
787
|
);
|
|
788
|
-
}
|
|
788
|
+
},
|
|
789
789
|
);
|
|
790
790
|
|
|
791
791
|
/**
|
|
@@ -808,9 +808,9 @@ class ClientAdapter {
|
|
|
808
808
|
collection,
|
|
809
809
|
query,
|
|
810
810
|
changes,
|
|
811
|
-
opts
|
|
811
|
+
opts,
|
|
812
812
|
);
|
|
813
|
-
}
|
|
813
|
+
},
|
|
814
814
|
);
|
|
815
815
|
|
|
816
816
|
/**
|
|
@@ -829,7 +829,7 @@ class ClientAdapter {
|
|
|
829
829
|
(index, collection, id, content, opts) => {
|
|
830
830
|
this.cache.assertCollectionExists(index, collection);
|
|
831
831
|
return this.client.upsert(index, collection, id, content, opts);
|
|
832
|
-
}
|
|
832
|
+
},
|
|
833
833
|
);
|
|
834
834
|
}
|
|
835
835
|
|
|
@@ -848,7 +848,7 @@ class ClientAdapter {
|
|
|
848
848
|
(index, collection, opts) => {
|
|
849
849
|
this.cache.assertCollectionExists(index, collection);
|
|
850
850
|
return this.client.getMapping(index, collection, opts);
|
|
851
|
-
}
|
|
851
|
+
},
|
|
852
852
|
);
|
|
853
853
|
|
|
854
854
|
/**
|
|
@@ -861,7 +861,7 @@ class ClientAdapter {
|
|
|
861
861
|
*/
|
|
862
862
|
global.kuzzle.onAsk(
|
|
863
863
|
`core:storage:${this.scope}:mappings:import`,
|
|
864
|
-
(fixtures, options) => this.loadMappings(fixtures, options)
|
|
864
|
+
(fixtures, options) => this.loadMappings(fixtures, options),
|
|
865
865
|
);
|
|
866
866
|
|
|
867
867
|
/**
|
|
@@ -877,7 +877,7 @@ class ClientAdapter {
|
|
|
877
877
|
(index, collection, mappings) => {
|
|
878
878
|
this.cache.assertCollectionExists(index, collection);
|
|
879
879
|
return this.client.updateMapping(index, collection, mappings);
|
|
880
|
-
}
|
|
880
|
+
},
|
|
881
881
|
);
|
|
882
882
|
}
|
|
883
883
|
|
|
@@ -891,7 +891,7 @@ class ClientAdapter {
|
|
|
891
891
|
* @param {string} index
|
|
892
892
|
*/
|
|
893
893
|
global.kuzzle.onAsk(`core:storage:${this.scope}:cache:addIndex`, (index) =>
|
|
894
|
-
this.cache.addIndex(index)
|
|
894
|
+
this.cache.addIndex(index),
|
|
895
895
|
);
|
|
896
896
|
|
|
897
897
|
/**
|
|
@@ -901,7 +901,7 @@ class ClientAdapter {
|
|
|
901
901
|
*/
|
|
902
902
|
global.kuzzle.onAsk(
|
|
903
903
|
`core:storage:${this.scope}:cache:addCollection`,
|
|
904
|
-
(index, collection) => this.cache.addCollection(index, collection)
|
|
904
|
+
(index, collection) => this.cache.addCollection(index, collection),
|
|
905
905
|
);
|
|
906
906
|
|
|
907
907
|
/**
|
|
@@ -914,7 +914,7 @@ class ClientAdapter {
|
|
|
914
914
|
for (const index of indexes) {
|
|
915
915
|
this.cache.removeIndex(index);
|
|
916
916
|
}
|
|
917
|
-
}
|
|
917
|
+
},
|
|
918
918
|
);
|
|
919
919
|
|
|
920
920
|
/**
|
|
@@ -924,7 +924,7 @@ class ClientAdapter {
|
|
|
924
924
|
*/
|
|
925
925
|
global.kuzzle.onAsk(
|
|
926
926
|
`core:storage:${this.scope}:cache:removeCollection`,
|
|
927
|
-
(index, collection) => this.cache.removeCollection(index, collection)
|
|
927
|
+
(index, collection) => this.cache.removeCollection(index, collection),
|
|
928
928
|
);
|
|
929
929
|
}
|
|
930
930
|
|
|
@@ -946,7 +946,7 @@ class ClientAdapter {
|
|
|
946
946
|
"assert",
|
|
947
947
|
"invalid_argument",
|
|
948
948
|
fixtures[index],
|
|
949
|
-
"object"
|
|
949
|
+
"object",
|
|
950
950
|
);
|
|
951
951
|
}
|
|
952
952
|
|
|
@@ -957,7 +957,7 @@ class ClientAdapter {
|
|
|
957
957
|
index,
|
|
958
958
|
collection,
|
|
959
959
|
payload,
|
|
960
|
-
{ refresh }
|
|
960
|
+
{ refresh },
|
|
961
961
|
);
|
|
962
962
|
|
|
963
963
|
if (errors.length > 0) {
|
|
@@ -983,7 +983,7 @@ class ClientAdapter {
|
|
|
983
983
|
propagate: true,
|
|
984
984
|
rawMappings: false,
|
|
985
985
|
refresh: false,
|
|
986
|
-
}
|
|
986
|
+
},
|
|
987
987
|
) {
|
|
988
988
|
if (!isPlainObject(fixtures)) {
|
|
989
989
|
throw kerror.get("api", "assert", "invalid_argument", fixtures, "object");
|
|
@@ -1001,7 +1001,7 @@ class ClientAdapter {
|
|
|
1001
1001
|
"assert",
|
|
1002
1002
|
"invalid_argument",
|
|
1003
1003
|
fixtures[index],
|
|
1004
|
-
"object"
|
|
1004
|
+
"object",
|
|
1005
1005
|
);
|
|
1006
1006
|
}
|
|
1007
1007
|
|
|
@@ -1026,7 +1026,7 @@ class ClientAdapter {
|
|
|
1026
1026
|
{
|
|
1027
1027
|
indexCacheOnly: options.indexCacheOnly,
|
|
1028
1028
|
propagate: options.propagate,
|
|
1029
|
-
}
|
|
1029
|
+
},
|
|
1030
1030
|
);
|
|
1031
1031
|
|
|
1032
1032
|
if (options.refresh && !options.indexCacheOnly) {
|
|
@@ -50,8 +50,8 @@ class EnumType extends BaseType {
|
|
|
50
50
|
if (!typeOptions.values.includes(fieldValue)) {
|
|
51
51
|
errorMessages.push(
|
|
52
52
|
`The field only accepts following values: "${typeOptions.values.join(
|
|
53
|
-
", "
|
|
54
|
-
)}"
|
|
53
|
+
", ",
|
|
54
|
+
)}".`,
|
|
55
55
|
);
|
|
56
56
|
return false;
|
|
57
57
|
}
|
|
@@ -75,12 +75,12 @@ class EnumType extends BaseType {
|
|
|
75
75
|
"assert",
|
|
76
76
|
"invalid_type",
|
|
77
77
|
"values",
|
|
78
|
-
"string[]"
|
|
78
|
+
"string[]",
|
|
79
79
|
);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
const nonString = typeOptions.values.filter(
|
|
83
|
-
(value) => typeof value !== "string"
|
|
83
|
+
(value) => typeof value !== "string",
|
|
84
84
|
);
|
|
85
85
|
|
|
86
86
|
if (nonString.length > 0) {
|
|
@@ -89,7 +89,7 @@ class EnumType extends BaseType {
|
|
|
89
89
|
"assert",
|
|
90
90
|
"invalid_type",
|
|
91
91
|
"values",
|
|
92
|
-
"string[]"
|
|
92
|
+
"string[]",
|
|
93
93
|
);
|
|
94
94
|
}
|
|
95
95
|
|
|
@@ -75,7 +75,7 @@ class GeoShapeType extends BaseType {
|
|
|
75
75
|
return this.recursiveShapeValidation(
|
|
76
76
|
typeOptions.shapeTypes,
|
|
77
77
|
fieldValue,
|
|
78
|
-
errorMessages
|
|
78
|
+
errorMessages,
|
|
79
79
|
);
|
|
80
80
|
}
|
|
81
81
|
|
|
@@ -122,7 +122,7 @@ class GeoShapeType extends BaseType {
|
|
|
122
122
|
!this.recursiveShapeValidation(
|
|
123
123
|
allowedShapes,
|
|
124
124
|
shape.geometries[i],
|
|
125
|
-
errorMessages
|
|
125
|
+
errorMessages,
|
|
126
126
|
)
|
|
127
127
|
) {
|
|
128
128
|
result = false;
|
|
@@ -159,11 +159,11 @@ class GeoShapeType extends BaseType {
|
|
|
159
159
|
if (isMulti) {
|
|
160
160
|
if (
|
|
161
161
|
shape.coordinates.some(
|
|
162
|
-
(coordinate) => !coordinateValidation(coordinate)
|
|
162
|
+
(coordinate) => !coordinateValidation(coordinate),
|
|
163
163
|
)
|
|
164
164
|
) {
|
|
165
165
|
errorMessages.push(
|
|
166
|
-
`One of the shapes in the shape type "${shape.type}" has bad coordinates
|
|
166
|
+
`One of the shapes in the shape type "${shape.type}" has bad coordinates.`,
|
|
167
167
|
);
|
|
168
168
|
result = false;
|
|
169
169
|
}
|
|
@@ -201,7 +201,7 @@ class GeoShapeType extends BaseType {
|
|
|
201
201
|
|
|
202
202
|
if (shape.type === "geometrycollection" && shape.coordinates) {
|
|
203
203
|
errorMessages.push(
|
|
204
|
-
'The coordinates property must not be provided for the "geometrycollection" shape type.'
|
|
204
|
+
'The coordinates property must not be provided for the "geometrycollection" shape type.',
|
|
205
205
|
);
|
|
206
206
|
result = false;
|
|
207
207
|
}
|
|
@@ -211,21 +211,21 @@ class GeoShapeType extends BaseType {
|
|
|
211
211
|
(!shape.coordinates || !Array.isArray(shape.coordinates))
|
|
212
212
|
) {
|
|
213
213
|
errorMessages.push(
|
|
214
|
-
`The coordinates property must be provided for the "${shape.type}" shape type
|
|
214
|
+
`The coordinates property must be provided for the "${shape.type}" shape type.`,
|
|
215
215
|
);
|
|
216
216
|
result = false;
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
if (shape.type === "circle" && !shape.radius) {
|
|
220
220
|
errorMessages.push(
|
|
221
|
-
'The radius property is mandatory for the "circle" shape type.'
|
|
221
|
+
'The radius property is mandatory for the "circle" shape type.',
|
|
222
222
|
);
|
|
223
223
|
result = false;
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
if (shape.type !== "circle" && shape.radius) {
|
|
227
227
|
errorMessages.push(
|
|
228
|
-
`The radius property must not be provided for the "${shape.type}" shape type
|
|
228
|
+
`The radius property must not be provided for the "${shape.type}" shape type.`,
|
|
229
229
|
);
|
|
230
230
|
result = false;
|
|
231
231
|
}
|
|
@@ -236,14 +236,14 @@ class GeoShapeType extends BaseType {
|
|
|
236
236
|
shape.orientation
|
|
237
237
|
) {
|
|
238
238
|
errorMessages.push(
|
|
239
|
-
`The orientation property must not be provided for the "${shape.type}" shape type
|
|
239
|
+
`The orientation property must not be provided for the "${shape.type}" shape type.`,
|
|
240
240
|
);
|
|
241
241
|
result = false;
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
if (shape.type !== "geometrycollection" && shape.geometries) {
|
|
245
245
|
errorMessages.push(
|
|
246
|
-
`The geometries property must not be provided for the "${shape.type}" shape type
|
|
246
|
+
`The geometries property must not be provided for the "${shape.type}" shape type.`,
|
|
247
247
|
);
|
|
248
248
|
result = false;
|
|
249
249
|
}
|
|
@@ -253,7 +253,7 @@ class GeoShapeType extends BaseType {
|
|
|
253
253
|
(!shape.geometries || !Array.isArray(shape.geometries))
|
|
254
254
|
) {
|
|
255
255
|
errorMessages.push(
|
|
256
|
-
'The geometries property must be provided for the "geometrycollection" shape type.'
|
|
256
|
+
'The geometries property must be provided for the "geometrycollection" shape type.',
|
|
257
257
|
);
|
|
258
258
|
result = false;
|
|
259
259
|
}
|
|
@@ -277,12 +277,12 @@ class GeoShapeType extends BaseType {
|
|
|
277
277
|
"assert",
|
|
278
278
|
"invalid_type",
|
|
279
279
|
"shapeTypes",
|
|
280
|
-
"string[]"
|
|
280
|
+
"string[]",
|
|
281
281
|
);
|
|
282
282
|
}
|
|
283
283
|
|
|
284
284
|
const invalid = typeOptions.shapeTypes.filter(
|
|
285
|
-
(shape) => !allowedShapeTypes.includes(shape)
|
|
285
|
+
(shape) => !allowedShapeTypes.includes(shape),
|
|
286
286
|
);
|
|
287
287
|
|
|
288
288
|
if (invalid.length > 0) {
|
|
@@ -53,7 +53,7 @@ class NumericType extends BaseType {
|
|
|
53
53
|
fieldValue < typeOptions.range.min
|
|
54
54
|
) {
|
|
55
55
|
errorMessages.push(
|
|
56
|
-
`Value ${fieldValue} is lesser than the allowed minimum (${typeOptions.range.min})
|
|
56
|
+
`Value ${fieldValue} is lesser than the allowed minimum (${typeOptions.range.min})`,
|
|
57
57
|
);
|
|
58
58
|
return false;
|
|
59
59
|
}
|
|
@@ -63,7 +63,7 @@ class NumericType extends BaseType {
|
|
|
63
63
|
fieldValue > typeOptions.range.max
|
|
64
64
|
) {
|
|
65
65
|
errorMessages.push(
|
|
66
|
-
`Value ${fieldValue} is greater than the allowed maximum (${typeOptions.range.max})
|
|
66
|
+
`Value ${fieldValue} is greater than the allowed maximum (${typeOptions.range.max})`,
|
|
67
67
|
);
|
|
68
68
|
return false;
|
|
69
69
|
}
|