kuzzle 2.27.1 → 2.27.3
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 +41 -41
- 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 +52 -52
- 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 +69 -81
|
@@ -168,7 +168,7 @@ class ElasticSearch extends Service {
|
|
|
168
168
|
"Your dynamic mapping policy is set to 'true' for new fields.",
|
|
169
169
|
"Elasticsearch will try to automatically infer mapping for new fields, and those cannot be changed afterward.",
|
|
170
170
|
'See the "services.storageEngine.commonMapping.dynamic" option in the kuzzlerc configuration file to change this value.',
|
|
171
|
-
].join("\n")
|
|
171
|
+
].join("\n"),
|
|
172
172
|
);
|
|
173
173
|
}
|
|
174
174
|
|
|
@@ -325,7 +325,7 @@ class ElasticSearch extends Service {
|
|
|
325
325
|
|
|
326
326
|
const stringifiedScrollInfo = await global.kuzzle.ask(
|
|
327
327
|
"core:cache:internal:get",
|
|
328
|
-
cacheKey
|
|
328
|
+
cacheKey,
|
|
329
329
|
);
|
|
330
330
|
|
|
331
331
|
if (!stringifiedScrollInfo) {
|
|
@@ -350,7 +350,7 @@ class ElasticSearch extends Service {
|
|
|
350
350
|
JSON.stringify(scrollInfo),
|
|
351
351
|
{
|
|
352
352
|
ttl: ms(_scrollTTL) || this.scrollTTL,
|
|
353
|
-
}
|
|
353
|
+
},
|
|
354
354
|
);
|
|
355
355
|
}
|
|
356
356
|
|
|
@@ -374,7 +374,7 @@ class ElasticSearch extends Service {
|
|
|
374
374
|
*/
|
|
375
375
|
async search(
|
|
376
376
|
{ index, collection, searchBody, targets } = {},
|
|
377
|
-
{ from, size, scroll } = {}
|
|
377
|
+
{ from, size, scroll } = {},
|
|
378
378
|
) {
|
|
379
379
|
let esIndexes;
|
|
380
380
|
|
|
@@ -429,7 +429,7 @@ class ElasticSearch extends Service {
|
|
|
429
429
|
index,
|
|
430
430
|
targets,
|
|
431
431
|
}),
|
|
432
|
-
{ ttl }
|
|
432
|
+
{ ttl },
|
|
433
433
|
);
|
|
434
434
|
|
|
435
435
|
body.remaining = body.hits.total.value - body.hits.hits.length;
|
|
@@ -529,7 +529,7 @@ class ElasticSearch extends Service {
|
|
|
529
529
|
for (const [name, innerHit] of Object.entries(innerHits)) {
|
|
530
530
|
formattedInnerHits[name] = await Bluebird.map(
|
|
531
531
|
innerHit.hits.hits,
|
|
532
|
-
formatHit
|
|
532
|
+
formatHit,
|
|
533
533
|
);
|
|
534
534
|
}
|
|
535
535
|
return formattedInnerHits;
|
|
@@ -682,7 +682,7 @@ class ElasticSearch extends Service {
|
|
|
682
682
|
index,
|
|
683
683
|
collection,
|
|
684
684
|
content,
|
|
685
|
-
{ id, refresh, userId = null, injectKuzzleMeta = true } = {}
|
|
685
|
+
{ id, refresh, userId = null, injectKuzzleMeta = true } = {},
|
|
686
686
|
) {
|
|
687
687
|
assertIsObject(content);
|
|
688
688
|
|
|
@@ -738,7 +738,7 @@ class ElasticSearch extends Service {
|
|
|
738
738
|
collection,
|
|
739
739
|
id,
|
|
740
740
|
content,
|
|
741
|
-
{ refresh, userId = null, injectKuzzleMeta = true } = {}
|
|
741
|
+
{ refresh, userId = null, injectKuzzleMeta = true } = {},
|
|
742
742
|
) {
|
|
743
743
|
const esRequest = {
|
|
744
744
|
body: content,
|
|
@@ -792,7 +792,7 @@ class ElasticSearch extends Service {
|
|
|
792
792
|
collection,
|
|
793
793
|
id,
|
|
794
794
|
content,
|
|
795
|
-
{ refresh, userId = null, retryOnConflict, injectKuzzleMeta = true } = {}
|
|
795
|
+
{ refresh, userId = null, retryOnConflict, injectKuzzleMeta = true } = {},
|
|
796
796
|
) {
|
|
797
797
|
const esRequest = {
|
|
798
798
|
_source: true,
|
|
@@ -852,7 +852,7 @@ class ElasticSearch extends Service {
|
|
|
852
852
|
userId = null,
|
|
853
853
|
retryOnConflict,
|
|
854
854
|
injectKuzzleMeta = true,
|
|
855
|
-
} = {}
|
|
855
|
+
} = {},
|
|
856
856
|
) {
|
|
857
857
|
const esRequest = {
|
|
858
858
|
_source: true,
|
|
@@ -917,7 +917,7 @@ class ElasticSearch extends Service {
|
|
|
917
917
|
collection,
|
|
918
918
|
id,
|
|
919
919
|
content,
|
|
920
|
-
{ refresh, userId = null, injectKuzzleMeta = true } = {}
|
|
920
|
+
{ refresh, userId = null, injectKuzzleMeta = true } = {},
|
|
921
921
|
) {
|
|
922
922
|
const alias = this._getAlias(index, collection);
|
|
923
923
|
const esRequest = {
|
|
@@ -1010,7 +1010,7 @@ class ElasticSearch extends Service {
|
|
|
1010
1010
|
index,
|
|
1011
1011
|
collection,
|
|
1012
1012
|
query,
|
|
1013
|
-
{ refresh, size = 1000, fetch = true } = {}
|
|
1013
|
+
{ refresh, size = 1000, fetch = true } = {},
|
|
1014
1014
|
) {
|
|
1015
1015
|
const esRequest = {
|
|
1016
1016
|
body: this._sanitizeSearchBody({ query }),
|
|
@@ -1066,7 +1066,7 @@ class ElasticSearch extends Service {
|
|
|
1066
1066
|
collection,
|
|
1067
1067
|
id,
|
|
1068
1068
|
fields,
|
|
1069
|
-
{ refresh, userId = null } = {}
|
|
1069
|
+
{ refresh, userId = null } = {},
|
|
1070
1070
|
) {
|
|
1071
1071
|
const alias = this._getAlias(index, collection);
|
|
1072
1072
|
const esRequest = {
|
|
@@ -1128,7 +1128,7 @@ class ElasticSearch extends Service {
|
|
|
1128
1128
|
collection,
|
|
1129
1129
|
query,
|
|
1130
1130
|
changes,
|
|
1131
|
-
{ refresh, size = 1000, userId = null } = {}
|
|
1131
|
+
{ refresh, size = 1000, userId = null } = {},
|
|
1132
1132
|
) {
|
|
1133
1133
|
try {
|
|
1134
1134
|
const esRequest = {
|
|
@@ -1153,7 +1153,7 @@ class ElasticSearch extends Service {
|
|
|
1153
1153
|
index,
|
|
1154
1154
|
collection,
|
|
1155
1155
|
documents,
|
|
1156
|
-
{ refresh, userId }
|
|
1156
|
+
{ refresh, userId },
|
|
1157
1157
|
);
|
|
1158
1158
|
|
|
1159
1159
|
return {
|
|
@@ -1181,7 +1181,7 @@ class ElasticSearch extends Service {
|
|
|
1181
1181
|
collection,
|
|
1182
1182
|
query,
|
|
1183
1183
|
changes,
|
|
1184
|
-
{ refresh = "false" } = {}
|
|
1184
|
+
{ refresh = "false" } = {},
|
|
1185
1185
|
) {
|
|
1186
1186
|
const script = {
|
|
1187
1187
|
params: {},
|
|
@@ -1244,7 +1244,7 @@ class ElasticSearch extends Service {
|
|
|
1244
1244
|
collection,
|
|
1245
1245
|
query,
|
|
1246
1246
|
callback,
|
|
1247
|
-
{ size = 10, scrollTTl = "5s" } = {}
|
|
1247
|
+
{ size = 10, scrollTTl = "5s" } = {},
|
|
1248
1248
|
) {
|
|
1249
1249
|
const esRequest = {
|
|
1250
1250
|
body: this._sanitizeSearchBody({ query }),
|
|
@@ -1270,7 +1270,7 @@ class ElasticSearch extends Service {
|
|
|
1270
1270
|
esRequest,
|
|
1271
1271
|
async function getMoreUntilDone(
|
|
1272
1272
|
error,
|
|
1273
|
-
{ body: { hits, _scroll_id } }
|
|
1273
|
+
{ body: { hits, _scroll_id } },
|
|
1274
1274
|
) {
|
|
1275
1275
|
if (error) {
|
|
1276
1276
|
reject(error);
|
|
@@ -1290,12 +1290,12 @@ class ElasticSearch extends Service {
|
|
|
1290
1290
|
scroll: esRequest.scroll,
|
|
1291
1291
|
scrollId: _scroll_id,
|
|
1292
1292
|
},
|
|
1293
|
-
getMoreUntilDone
|
|
1293
|
+
getMoreUntilDone,
|
|
1294
1294
|
);
|
|
1295
1295
|
} else {
|
|
1296
1296
|
resolve(results);
|
|
1297
1297
|
}
|
|
1298
|
-
}
|
|
1298
|
+
},
|
|
1299
1299
|
);
|
|
1300
1300
|
});
|
|
1301
1301
|
} finally {
|
|
@@ -1360,7 +1360,7 @@ class ElasticSearch extends Service {
|
|
|
1360
1360
|
async createCollection(
|
|
1361
1361
|
index,
|
|
1362
1362
|
collection,
|
|
1363
|
-
{ mappings = {}, settings = {} } = {}
|
|
1363
|
+
{ mappings = {}, settings = {} } = {},
|
|
1364
1364
|
) {
|
|
1365
1365
|
this._assertValidIndexAndCollection(index, collection);
|
|
1366
1366
|
|
|
@@ -1407,7 +1407,7 @@ class ElasticSearch extends Service {
|
|
|
1407
1407
|
dynamic: mappings.dynamic || this._config.commonMapping.dynamic,
|
|
1408
1408
|
properties: _.merge(
|
|
1409
1409
|
mappings.properties,
|
|
1410
|
-
this._config.commonMapping.properties
|
|
1410
|
+
this._config.commonMapping.properties,
|
|
1411
1411
|
),
|
|
1412
1412
|
};
|
|
1413
1413
|
|
|
@@ -1508,7 +1508,7 @@ class ElasticSearch extends Service {
|
|
|
1508
1508
|
async updateCollection(
|
|
1509
1509
|
index,
|
|
1510
1510
|
collection,
|
|
1511
|
-
{ mappings = {}, settings = {} } = {}
|
|
1511
|
+
{ mappings = {}, settings = {} } = {},
|
|
1512
1512
|
) {
|
|
1513
1513
|
const esRequest = {
|
|
1514
1514
|
index: await this._getIndice(index, collection),
|
|
@@ -1635,7 +1635,7 @@ class ElasticSearch extends Service {
|
|
|
1635
1635
|
|
|
1636
1636
|
const fullProperties = _.merge(
|
|
1637
1637
|
collectionMappings.properties,
|
|
1638
|
-
mappings.properties
|
|
1638
|
+
mappings.properties,
|
|
1639
1639
|
);
|
|
1640
1640
|
|
|
1641
1641
|
return {
|
|
@@ -1731,7 +1731,7 @@ class ElasticSearch extends Service {
|
|
|
1731
1731
|
index,
|
|
1732
1732
|
collection,
|
|
1733
1733
|
documents,
|
|
1734
|
-
{ refresh, timeout, userId = null } = {}
|
|
1734
|
+
{ refresh, timeout, userId = null } = {},
|
|
1735
1735
|
) {
|
|
1736
1736
|
const alias = this._getAlias(index, collection);
|
|
1737
1737
|
const actionNames = ["index", "create", "update", "delete"];
|
|
@@ -2018,7 +2018,7 @@ class ElasticSearch extends Service {
|
|
|
2018
2018
|
|
|
2019
2019
|
return request;
|
|
2020
2020
|
},
|
|
2021
|
-
{ index: [] }
|
|
2021
|
+
{ index: [] },
|
|
2022
2022
|
);
|
|
2023
2023
|
|
|
2024
2024
|
if (esRequest.index.length === 0) {
|
|
@@ -2208,7 +2208,7 @@ class ElasticSearch extends Service {
|
|
|
2208
2208
|
index,
|
|
2209
2209
|
collection,
|
|
2210
2210
|
documents,
|
|
2211
|
-
{ refresh, timeout, userId = null } = {}
|
|
2211
|
+
{ refresh, timeout, userId = null } = {},
|
|
2212
2212
|
) {
|
|
2213
2213
|
const alias = this._getAlias(index, collection),
|
|
2214
2214
|
kuzzleMeta = {
|
|
@@ -2306,7 +2306,7 @@ class ElasticSearch extends Service {
|
|
|
2306
2306
|
injectKuzzleMeta = true,
|
|
2307
2307
|
limits = true,
|
|
2308
2308
|
source = true,
|
|
2309
|
-
} = {}
|
|
2309
|
+
} = {},
|
|
2310
2310
|
) {
|
|
2311
2311
|
let kuzzleMeta = {};
|
|
2312
2312
|
|
|
@@ -2330,7 +2330,7 @@ class ElasticSearch extends Service {
|
|
|
2330
2330
|
};
|
|
2331
2331
|
const { rejected, extractedDocuments } = this._extractMDocuments(
|
|
2332
2332
|
documents,
|
|
2333
|
-
kuzzleMeta
|
|
2333
|
+
kuzzleMeta,
|
|
2334
2334
|
);
|
|
2335
2335
|
|
|
2336
2336
|
esRequest.body = [];
|
|
@@ -2373,7 +2373,7 @@ class ElasticSearch extends Service {
|
|
|
2373
2373
|
index,
|
|
2374
2374
|
collection,
|
|
2375
2375
|
documents,
|
|
2376
|
-
{ refresh, retryOnConflict = 0, timeout, userId = null } = {}
|
|
2376
|
+
{ refresh, retryOnConflict = 0, timeout, userId = null } = {},
|
|
2377
2377
|
) {
|
|
2378
2378
|
const alias = this._getAlias(index, collection),
|
|
2379
2379
|
toImport = [],
|
|
@@ -2391,7 +2391,7 @@ class ElasticSearch extends Service {
|
|
|
2391
2391
|
},
|
|
2392
2392
|
{ rejected, extractedDocuments } = this._extractMDocuments(
|
|
2393
2393
|
documents,
|
|
2394
|
-
kuzzleMeta
|
|
2394
|
+
kuzzleMeta,
|
|
2395
2395
|
);
|
|
2396
2396
|
|
|
2397
2397
|
/**
|
|
@@ -2464,7 +2464,7 @@ class ElasticSearch extends Service {
|
|
|
2464
2464
|
index,
|
|
2465
2465
|
collection,
|
|
2466
2466
|
documents,
|
|
2467
|
-
{ refresh, retryOnConflict = 0, timeout, userId = null } = {}
|
|
2467
|
+
{ refresh, retryOnConflict = 0, timeout, userId = null } = {},
|
|
2468
2468
|
) {
|
|
2469
2469
|
const alias = this._getAlias(index, collection);
|
|
2470
2470
|
const esRequest = {
|
|
@@ -2496,7 +2496,7 @@ class ElasticSearch extends Service {
|
|
|
2496
2496
|
{
|
|
2497
2497
|
prepareMUpsert: true,
|
|
2498
2498
|
requireId: true,
|
|
2499
|
-
}
|
|
2499
|
+
},
|
|
2500
2500
|
);
|
|
2501
2501
|
|
|
2502
2502
|
/**
|
|
@@ -2518,7 +2518,7 @@ class ElasticSearch extends Service {
|
|
|
2518
2518
|
{
|
|
2519
2519
|
doc: extractedDocuments[i]._source.changes,
|
|
2520
2520
|
upsert: extractedDocuments[i]._source.default,
|
|
2521
|
-
}
|
|
2521
|
+
},
|
|
2522
2522
|
);
|
|
2523
2523
|
// _source: true
|
|
2524
2524
|
// Makes ES return the updated document source in the response.
|
|
@@ -2529,7 +2529,7 @@ class ElasticSearch extends Service {
|
|
|
2529
2529
|
const response = await this._mExecute(
|
|
2530
2530
|
esRequest,
|
|
2531
2531
|
extractedDocuments,
|
|
2532
|
-
rejected
|
|
2532
|
+
rejected,
|
|
2533
2533
|
);
|
|
2534
2534
|
|
|
2535
2535
|
// with _source: true, ES returns the updated document in
|
|
@@ -2563,7 +2563,7 @@ class ElasticSearch extends Service {
|
|
|
2563
2563
|
index,
|
|
2564
2564
|
collection,
|
|
2565
2565
|
documents,
|
|
2566
|
-
{ refresh, timeout, userId = null } = {}
|
|
2566
|
+
{ refresh, timeout, userId = null } = {},
|
|
2567
2567
|
) {
|
|
2568
2568
|
const alias = this._getAlias(index, collection),
|
|
2569
2569
|
kuzzleMeta = {
|
|
@@ -2722,7 +2722,7 @@ class ElasticSearch extends Service {
|
|
|
2722
2722
|
esRequest,
|
|
2723
2723
|
documents,
|
|
2724
2724
|
partialErrors,
|
|
2725
|
-
{ limits = true, source = true } = {}
|
|
2725
|
+
{ limits = true, source = true } = {},
|
|
2726
2726
|
) {
|
|
2727
2727
|
assertWellFormedRefresh(esRequest);
|
|
2728
2728
|
|
|
@@ -2807,7 +2807,7 @@ class ElasticSearch extends Service {
|
|
|
2807
2807
|
_extractMDocuments(
|
|
2808
2808
|
documents,
|
|
2809
2809
|
metadata,
|
|
2810
|
-
{ prepareMGet = false, requireId = false, prepareMUpsert = false } = {}
|
|
2810
|
+
{ prepareMGet = false, requireId = false, prepareMUpsert = false } = {},
|
|
2811
2811
|
) {
|
|
2812
2812
|
const rejected = [];
|
|
2813
2813
|
const extractedDocuments = [];
|
|
@@ -2860,7 +2860,7 @@ class ElasticSearch extends Service {
|
|
|
2860
2860
|
{},
|
|
2861
2861
|
metadata.upsert,
|
|
2862
2862
|
document.changes,
|
|
2863
|
-
document.default
|
|
2863
|
+
document.default,
|
|
2864
2864
|
),
|
|
2865
2865
|
},
|
|
2866
2866
|
};
|
|
@@ -2910,7 +2910,7 @@ class ElasticSearch extends Service {
|
|
|
2910
2910
|
throw kerror.get(
|
|
2911
2911
|
"invalid_mapping",
|
|
2912
2912
|
currentPath,
|
|
2913
|
-
didYouMean(property, mappingProperties)
|
|
2913
|
+
didYouMean(property, mappingProperties),
|
|
2914
2914
|
);
|
|
2915
2915
|
}
|
|
2916
2916
|
|
|
@@ -2970,7 +2970,7 @@ class ElasticSearch extends Service {
|
|
|
2970
2970
|
throw kerror.get(
|
|
2971
2971
|
"multiple_indice_alias",
|
|
2972
2972
|
`"alias" starting with "${ALIAS_PREFIX}"`,
|
|
2973
|
-
'"indices"'
|
|
2973
|
+
'"indices"',
|
|
2974
2974
|
);
|
|
2975
2975
|
}
|
|
2976
2976
|
|
|
@@ -3000,7 +3000,7 @@ class ElasticSearch extends Service {
|
|
|
3000
3000
|
*/
|
|
3001
3001
|
async _getAvailableIndice(index, collection) {
|
|
3002
3002
|
let indice = this._getAlias(index, collection).substr(
|
|
3003
|
-
INDEX_PREFIX_POSITION_IN_ALIAS
|
|
3003
|
+
INDEX_PREFIX_POSITION_IN_ALIAS,
|
|
3004
3004
|
);
|
|
3005
3005
|
|
|
3006
3006
|
if (!(await this._client.indices.exists({ index: indice })).body) {
|
|
@@ -3039,7 +3039,7 @@ class ElasticSearch extends Service {
|
|
|
3039
3039
|
async _getAliasFromIndice(indice) {
|
|
3040
3040
|
const { body } = await this._client.indices.getAlias({ index: indice });
|
|
3041
3041
|
const aliases = Object.keys(body[indice].aliases).filter((alias) =>
|
|
3042
|
-
alias.startsWith(ALIAS_PREFIX)
|
|
3042
|
+
alias.startsWith(ALIAS_PREFIX),
|
|
3043
3043
|
);
|
|
3044
3044
|
|
|
3045
3045
|
if (aliases.length < 1) {
|
|
@@ -3065,7 +3065,7 @@ class ElasticSearch extends Service {
|
|
|
3065
3065
|
const indicesWithoutAlias = indices.filter(
|
|
3066
3066
|
(indice) =>
|
|
3067
3067
|
indice[INDEX_PREFIX_POSITION_IN_INDICE] === this._indexPrefix &&
|
|
3068
|
-
!aliases.some((alias) => alias.indice === indice)
|
|
3068
|
+
!aliases.some((alias) => alias.indice === indice),
|
|
3069
3069
|
);
|
|
3070
3070
|
|
|
3071
3071
|
const esRequest = { body: { actions: [] } };
|
|
@@ -3109,7 +3109,7 @@ class ElasticSearch extends Service {
|
|
|
3109
3109
|
_extractIndex(alias) {
|
|
3110
3110
|
return alias.substr(
|
|
3111
3111
|
INDEX_PREFIX_POSITION_IN_ALIAS + 1,
|
|
3112
|
-
alias.indexOf(NAME_SEPARATOR) - INDEX_PREFIX_POSITION_IN_ALIAS - 1
|
|
3112
|
+
alias.indexOf(NAME_SEPARATOR) - INDEX_PREFIX_POSITION_IN_ALIAS - 1,
|
|
3113
3113
|
);
|
|
3114
3114
|
}
|
|
3115
3115
|
|
|
@@ -3249,7 +3249,7 @@ class ElasticSearch extends Service {
|
|
|
3249
3249
|
hits.hits.map((h) => ({
|
|
3250
3250
|
_id: h._id,
|
|
3251
3251
|
_source: h._source,
|
|
3252
|
-
}))
|
|
3252
|
+
})),
|
|
3253
3253
|
);
|
|
3254
3254
|
}
|
|
3255
3255
|
|
|
@@ -3350,14 +3350,14 @@ class ElasticSearch extends Service {
|
|
|
3350
3350
|
|
|
3351
3351
|
assert(
|
|
3352
3352
|
typeof configValue === "string",
|
|
3353
|
-
`services.storageEngine.${key} must be a string
|
|
3353
|
+
`services.storageEngine.${key} must be a string.`,
|
|
3354
3354
|
);
|
|
3355
3355
|
|
|
3356
3356
|
const parsedValue = ms(configValue);
|
|
3357
3357
|
|
|
3358
3358
|
assert(
|
|
3359
3359
|
typeof parsedValue === "number",
|
|
3360
|
-
`Invalid parsed value from ms() for services.storageEngine.${key} ("${typeof parsedValue}")
|
|
3360
|
+
`Invalid parsed value from ms() for services.storageEngine.${key} ("${typeof parsedValue}").`,
|
|
3361
3361
|
);
|
|
3362
3362
|
|
|
3363
3363
|
return parsedValue;
|
|
@@ -3410,7 +3410,7 @@ class ElasticSearch extends Service {
|
|
|
3410
3410
|
esState = esStateEnum.OK;
|
|
3411
3411
|
} else {
|
|
3412
3412
|
global.kuzzle.log.info(
|
|
3413
|
-
`[ℹ] Still waiting for Elasticsearch: ${health.body.number_of_pending_tasks} cluster tasks remaining
|
|
3413
|
+
`[ℹ] Still waiting for Elasticsearch: ${health.body.number_of_pending_tasks} cluster tasks remaining`,
|
|
3414
3414
|
);
|
|
3415
3415
|
await Bluebird.delay(1000);
|
|
3416
3416
|
}
|
|
@@ -3433,7 +3433,7 @@ class ElasticSearch extends Service {
|
|
|
3433
3433
|
throw kerror.get(
|
|
3434
3434
|
"invalid_mapping",
|
|
3435
3435
|
path,
|
|
3436
|
-
"Dynamic property value should be a string."
|
|
3436
|
+
"Dynamic property value should be a string.",
|
|
3437
3437
|
);
|
|
3438
3438
|
}
|
|
3439
3439
|
|
|
@@ -3442,8 +3442,8 @@ class ElasticSearch extends Service {
|
|
|
3442
3442
|
"invalid_mapping",
|
|
3443
3443
|
path,
|
|
3444
3444
|
`Incorrect dynamic property value (${value}). Should be one of "${DYNAMIC_PROPERTY_VALUES.join(
|
|
3445
|
-
'", "'
|
|
3446
|
-
)}"
|
|
3445
|
+
'", "',
|
|
3446
|
+
)}"`,
|
|
3447
3447
|
);
|
|
3448
3448
|
}
|
|
3449
3449
|
}
|
|
@@ -197,7 +197,7 @@ class ESWrapper {
|
|
|
197
197
|
if (matches) {
|
|
198
198
|
return kerror.get(
|
|
199
199
|
betterError.subcode,
|
|
200
|
-
...betterError.getPlaceholders(error, matches)
|
|
200
|
+
...betterError.getPlaceholders(error, matches),
|
|
201
201
|
);
|
|
202
202
|
}
|
|
203
203
|
}
|
|
@@ -281,7 +281,7 @@ class ESWrapper {
|
|
|
281
281
|
|
|
282
282
|
debug(
|
|
283
283
|
'unhandled "BadRequest" elasticsearch error: %a',
|
|
284
|
-
_.get(error, "meta.body.error.reason", error.message)
|
|
284
|
+
_.get(error, "meta.body.error.reason", error.message),
|
|
285
285
|
);
|
|
286
286
|
|
|
287
287
|
return kerror.get("unexpected_bad_request", errorMessage);
|
|
@@ -291,7 +291,7 @@ class ESWrapper {
|
|
|
291
291
|
debug(
|
|
292
292
|
"unhandled elasticsearch error (unhandled type: %s): %o",
|
|
293
293
|
_.get(error, "error.meta.statusCode", "<no status code>"),
|
|
294
|
-
error
|
|
294
|
+
error,
|
|
295
295
|
);
|
|
296
296
|
|
|
297
297
|
return kerror.get("unexpected_error", message);
|
|
@@ -26,7 +26,7 @@ const kerror = require("../../kerror");
|
|
|
26
26
|
class KeywordError extends Error {
|
|
27
27
|
constructor(type, name) {
|
|
28
28
|
super(
|
|
29
|
-
`The ${type} "${name}" of Koncorde DSL is not supported for search queries
|
|
29
|
+
`The ${type} "${name}" of Koncorde DSL is not supported for search queries.`,
|
|
30
30
|
);
|
|
31
31
|
|
|
32
32
|
this.keyword = { name, type };
|
|
@@ -58,7 +58,7 @@ function parseKoncordePath(path) {
|
|
|
58
58
|
"services",
|
|
59
59
|
"koncorde",
|
|
60
60
|
"elastic_translation_error",
|
|
61
|
-
`Invalid exists path "${path}": missing closing bracket
|
|
61
|
+
`Invalid exists path "${path}": missing closing bracket`,
|
|
62
62
|
);
|
|
63
63
|
}
|
|
64
64
|
|
package/lib/util/assertType.js
CHANGED
|
@@ -69,7 +69,7 @@ function assertArray(attr, data, type) {
|
|
|
69
69
|
if (d !== undefined && d !== null) {
|
|
70
70
|
if (typeof d !== type) {
|
|
71
71
|
throw new BadRequestError(
|
|
72
|
-
`Attribute ${attr} must contain only values of type "${type}"
|
|
72
|
+
`Attribute ${attr} must contain only values of type "${type}"`,
|
|
73
73
|
);
|
|
74
74
|
}
|
|
75
75
|
|
package/lib/util/deprecate.js
CHANGED
|
@@ -30,7 +30,7 @@ const deprecationWarning = (logger, ...args) => {
|
|
|
30
30
|
|
|
31
31
|
const warnIfDeprecated = (logger, deprecations, member) => {
|
|
32
32
|
const deprecatedProperty = Object.keys(deprecations).find(
|
|
33
|
-
(deprecated) => deprecated === member
|
|
33
|
+
(deprecated) => deprecated === member,
|
|
34
34
|
),
|
|
35
35
|
alternative = deprecations[deprecatedProperty];
|
|
36
36
|
|
|
@@ -43,12 +43,12 @@ const warnIfDeprecated = (logger, deprecations, member) => {
|
|
|
43
43
|
} else if (typeof alternative === "string") {
|
|
44
44
|
deprecationWarning(
|
|
45
45
|
logger,
|
|
46
|
-
`Use of '${deprecatedProperty}' property is deprecated. Please, use '${alternative}' instead
|
|
46
|
+
`Use of '${deprecatedProperty}' property is deprecated. Please, use '${alternative}' instead.`,
|
|
47
47
|
);
|
|
48
48
|
} else {
|
|
49
49
|
deprecationWarning(
|
|
50
50
|
logger,
|
|
51
|
-
`Use of '${deprecatedProperty}' property is deprecated
|
|
51
|
+
`Use of '${deprecatedProperty}' property is deprecated.`,
|
|
52
52
|
);
|
|
53
53
|
}
|
|
54
54
|
};
|
|
@@ -35,7 +35,7 @@ const { isPlainObject } = require("./safeObject");
|
|
|
35
35
|
function extractFields(
|
|
36
36
|
document,
|
|
37
37
|
{ fieldsToIgnore = [], alsoExtractValues = false } = {},
|
|
38
|
-
{ path = null, extractedFields = [] } = {}
|
|
38
|
+
{ path = null, extractedFields = [] } = {},
|
|
39
39
|
) {
|
|
40
40
|
for (const [key, value] of Object.entries(document)) {
|
|
41
41
|
if (
|
|
@@ -51,7 +51,7 @@ function extractFields(
|
|
|
51
51
|
extractFields(
|
|
52
52
|
value,
|
|
53
53
|
{ alsoExtractValues, fieldsToIgnore },
|
|
54
|
-
{ extractedFields, path: currentPath }
|
|
54
|
+
{ extractedFields, path: currentPath },
|
|
55
55
|
);
|
|
56
56
|
} else if (alsoExtractValues) {
|
|
57
57
|
extractedFields.push({ key: currentPath, value });
|
package/lib/util/wildcard.js
CHANGED
|
@@ -36,7 +36,7 @@ function match(pattern, list) {
|
|
|
36
36
|
.split("*")
|
|
37
37
|
.filter(
|
|
38
38
|
(patternPart, index, array) =>
|
|
39
|
-
patternPart !== "" || index === 0 || index === array.length - 1
|
|
39
|
+
patternPart !== "" || index === 0 || index === array.length - 1,
|
|
40
40
|
)
|
|
41
41
|
.map((patternPart) => _.escapeRegExp(patternPart)) // escape special regex characters
|
|
42
42
|
.join(".*");
|