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
|
@@ -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 = {
|
|
@@ -2261,8 +2261,6 @@ class ElasticSearch extends Service {
|
|
|
2261
2261
|
reason: "document already exists",
|
|
2262
2262
|
status: 400,
|
|
2263
2263
|
});
|
|
2264
|
-
|
|
2265
|
-
idx++;
|
|
2266
2264
|
} else {
|
|
2267
2265
|
esRequest.body.push({
|
|
2268
2266
|
index: {
|
|
@@ -2274,6 +2272,7 @@ class ElasticSearch extends Service {
|
|
|
2274
2272
|
|
|
2275
2273
|
toImport.push(document);
|
|
2276
2274
|
}
|
|
2275
|
+
idx++;
|
|
2277
2276
|
} else {
|
|
2278
2277
|
esRequest.body.push({ index: { _index: alias } });
|
|
2279
2278
|
esRequest.body.push(document._source);
|
|
@@ -2307,7 +2306,7 @@ class ElasticSearch extends Service {
|
|
|
2307
2306
|
injectKuzzleMeta = true,
|
|
2308
2307
|
limits = true,
|
|
2309
2308
|
source = true,
|
|
2310
|
-
} = {}
|
|
2309
|
+
} = {},
|
|
2311
2310
|
) {
|
|
2312
2311
|
let kuzzleMeta = {};
|
|
2313
2312
|
|
|
@@ -2331,7 +2330,7 @@ class ElasticSearch extends Service {
|
|
|
2331
2330
|
};
|
|
2332
2331
|
const { rejected, extractedDocuments } = this._extractMDocuments(
|
|
2333
2332
|
documents,
|
|
2334
|
-
kuzzleMeta
|
|
2333
|
+
kuzzleMeta,
|
|
2335
2334
|
);
|
|
2336
2335
|
|
|
2337
2336
|
esRequest.body = [];
|
|
@@ -2374,7 +2373,7 @@ class ElasticSearch extends Service {
|
|
|
2374
2373
|
index,
|
|
2375
2374
|
collection,
|
|
2376
2375
|
documents,
|
|
2377
|
-
{ refresh, retryOnConflict = 0, timeout, userId = null } = {}
|
|
2376
|
+
{ refresh, retryOnConflict = 0, timeout, userId = null } = {},
|
|
2378
2377
|
) {
|
|
2379
2378
|
const alias = this._getAlias(index, collection),
|
|
2380
2379
|
toImport = [],
|
|
@@ -2392,7 +2391,7 @@ class ElasticSearch extends Service {
|
|
|
2392
2391
|
},
|
|
2393
2392
|
{ rejected, extractedDocuments } = this._extractMDocuments(
|
|
2394
2393
|
documents,
|
|
2395
|
-
kuzzleMeta
|
|
2394
|
+
kuzzleMeta,
|
|
2396
2395
|
);
|
|
2397
2396
|
|
|
2398
2397
|
/**
|
|
@@ -2465,7 +2464,7 @@ class ElasticSearch extends Service {
|
|
|
2465
2464
|
index,
|
|
2466
2465
|
collection,
|
|
2467
2466
|
documents,
|
|
2468
|
-
{ refresh, retryOnConflict = 0, timeout, userId = null } = {}
|
|
2467
|
+
{ refresh, retryOnConflict = 0, timeout, userId = null } = {},
|
|
2469
2468
|
) {
|
|
2470
2469
|
const alias = this._getAlias(index, collection);
|
|
2471
2470
|
const esRequest = {
|
|
@@ -2497,7 +2496,7 @@ class ElasticSearch extends Service {
|
|
|
2497
2496
|
{
|
|
2498
2497
|
prepareMUpsert: true,
|
|
2499
2498
|
requireId: true,
|
|
2500
|
-
}
|
|
2499
|
+
},
|
|
2501
2500
|
);
|
|
2502
2501
|
|
|
2503
2502
|
/**
|
|
@@ -2519,7 +2518,7 @@ class ElasticSearch extends Service {
|
|
|
2519
2518
|
{
|
|
2520
2519
|
doc: extractedDocuments[i]._source.changes,
|
|
2521
2520
|
upsert: extractedDocuments[i]._source.default,
|
|
2522
|
-
}
|
|
2521
|
+
},
|
|
2523
2522
|
);
|
|
2524
2523
|
// _source: true
|
|
2525
2524
|
// Makes ES return the updated document source in the response.
|
|
@@ -2530,7 +2529,7 @@ class ElasticSearch extends Service {
|
|
|
2530
2529
|
const response = await this._mExecute(
|
|
2531
2530
|
esRequest,
|
|
2532
2531
|
extractedDocuments,
|
|
2533
|
-
rejected
|
|
2532
|
+
rejected,
|
|
2534
2533
|
);
|
|
2535
2534
|
|
|
2536
2535
|
// with _source: true, ES returns the updated document in
|
|
@@ -2564,7 +2563,7 @@ class ElasticSearch extends Service {
|
|
|
2564
2563
|
index,
|
|
2565
2564
|
collection,
|
|
2566
2565
|
documents,
|
|
2567
|
-
{ refresh, timeout, userId = null } = {}
|
|
2566
|
+
{ refresh, timeout, userId = null } = {},
|
|
2568
2567
|
) {
|
|
2569
2568
|
const alias = this._getAlias(index, collection),
|
|
2570
2569
|
kuzzleMeta = {
|
|
@@ -2723,7 +2722,7 @@ class ElasticSearch extends Service {
|
|
|
2723
2722
|
esRequest,
|
|
2724
2723
|
documents,
|
|
2725
2724
|
partialErrors,
|
|
2726
|
-
{ limits = true, source = true } = {}
|
|
2725
|
+
{ limits = true, source = true } = {},
|
|
2727
2726
|
) {
|
|
2728
2727
|
assertWellFormedRefresh(esRequest);
|
|
2729
2728
|
|
|
@@ -2808,7 +2807,7 @@ class ElasticSearch extends Service {
|
|
|
2808
2807
|
_extractMDocuments(
|
|
2809
2808
|
documents,
|
|
2810
2809
|
metadata,
|
|
2811
|
-
{ prepareMGet = false, requireId = false, prepareMUpsert = false } = {}
|
|
2810
|
+
{ prepareMGet = false, requireId = false, prepareMUpsert = false } = {},
|
|
2812
2811
|
) {
|
|
2813
2812
|
const rejected = [];
|
|
2814
2813
|
const extractedDocuments = [];
|
|
@@ -2861,7 +2860,7 @@ class ElasticSearch extends Service {
|
|
|
2861
2860
|
{},
|
|
2862
2861
|
metadata.upsert,
|
|
2863
2862
|
document.changes,
|
|
2864
|
-
document.default
|
|
2863
|
+
document.default,
|
|
2865
2864
|
),
|
|
2866
2865
|
},
|
|
2867
2866
|
};
|
|
@@ -2911,7 +2910,7 @@ class ElasticSearch extends Service {
|
|
|
2911
2910
|
throw kerror.get(
|
|
2912
2911
|
"invalid_mapping",
|
|
2913
2912
|
currentPath,
|
|
2914
|
-
didYouMean(property, mappingProperties)
|
|
2913
|
+
didYouMean(property, mappingProperties),
|
|
2915
2914
|
);
|
|
2916
2915
|
}
|
|
2917
2916
|
|
|
@@ -2971,7 +2970,7 @@ class ElasticSearch extends Service {
|
|
|
2971
2970
|
throw kerror.get(
|
|
2972
2971
|
"multiple_indice_alias",
|
|
2973
2972
|
`"alias" starting with "${ALIAS_PREFIX}"`,
|
|
2974
|
-
'"indices"'
|
|
2973
|
+
'"indices"',
|
|
2975
2974
|
);
|
|
2976
2975
|
}
|
|
2977
2976
|
|
|
@@ -3001,7 +3000,7 @@ class ElasticSearch extends Service {
|
|
|
3001
3000
|
*/
|
|
3002
3001
|
async _getAvailableIndice(index, collection) {
|
|
3003
3002
|
let indice = this._getAlias(index, collection).substr(
|
|
3004
|
-
INDEX_PREFIX_POSITION_IN_ALIAS
|
|
3003
|
+
INDEX_PREFIX_POSITION_IN_ALIAS,
|
|
3005
3004
|
);
|
|
3006
3005
|
|
|
3007
3006
|
if (!(await this._client.indices.exists({ index: indice })).body) {
|
|
@@ -3040,7 +3039,7 @@ class ElasticSearch extends Service {
|
|
|
3040
3039
|
async _getAliasFromIndice(indice) {
|
|
3041
3040
|
const { body } = await this._client.indices.getAlias({ index: indice });
|
|
3042
3041
|
const aliases = Object.keys(body[indice].aliases).filter((alias) =>
|
|
3043
|
-
alias.startsWith(ALIAS_PREFIX)
|
|
3042
|
+
alias.startsWith(ALIAS_PREFIX),
|
|
3044
3043
|
);
|
|
3045
3044
|
|
|
3046
3045
|
if (aliases.length < 1) {
|
|
@@ -3066,7 +3065,7 @@ class ElasticSearch extends Service {
|
|
|
3066
3065
|
const indicesWithoutAlias = indices.filter(
|
|
3067
3066
|
(indice) =>
|
|
3068
3067
|
indice[INDEX_PREFIX_POSITION_IN_INDICE] === this._indexPrefix &&
|
|
3069
|
-
!aliases.some((alias) => alias.indice === indice)
|
|
3068
|
+
!aliases.some((alias) => alias.indice === indice),
|
|
3070
3069
|
);
|
|
3071
3070
|
|
|
3072
3071
|
const esRequest = { body: { actions: [] } };
|
|
@@ -3110,7 +3109,7 @@ class ElasticSearch extends Service {
|
|
|
3110
3109
|
_extractIndex(alias) {
|
|
3111
3110
|
return alias.substr(
|
|
3112
3111
|
INDEX_PREFIX_POSITION_IN_ALIAS + 1,
|
|
3113
|
-
alias.indexOf(NAME_SEPARATOR) - INDEX_PREFIX_POSITION_IN_ALIAS - 1
|
|
3112
|
+
alias.indexOf(NAME_SEPARATOR) - INDEX_PREFIX_POSITION_IN_ALIAS - 1,
|
|
3114
3113
|
);
|
|
3115
3114
|
}
|
|
3116
3115
|
|
|
@@ -3250,7 +3249,7 @@ class ElasticSearch extends Service {
|
|
|
3250
3249
|
hits.hits.map((h) => ({
|
|
3251
3250
|
_id: h._id,
|
|
3252
3251
|
_source: h._source,
|
|
3253
|
-
}))
|
|
3252
|
+
})),
|
|
3254
3253
|
);
|
|
3255
3254
|
}
|
|
3256
3255
|
|
|
@@ -3351,14 +3350,14 @@ class ElasticSearch extends Service {
|
|
|
3351
3350
|
|
|
3352
3351
|
assert(
|
|
3353
3352
|
typeof configValue === "string",
|
|
3354
|
-
`services.storageEngine.${key} must be a string
|
|
3353
|
+
`services.storageEngine.${key} must be a string.`,
|
|
3355
3354
|
);
|
|
3356
3355
|
|
|
3357
3356
|
const parsedValue = ms(configValue);
|
|
3358
3357
|
|
|
3359
3358
|
assert(
|
|
3360
3359
|
typeof parsedValue === "number",
|
|
3361
|
-
`Invalid parsed value from ms() for services.storageEngine.${key} ("${typeof parsedValue}")
|
|
3360
|
+
`Invalid parsed value from ms() for services.storageEngine.${key} ("${typeof parsedValue}").`,
|
|
3362
3361
|
);
|
|
3363
3362
|
|
|
3364
3363
|
return parsedValue;
|
|
@@ -3411,7 +3410,7 @@ class ElasticSearch extends Service {
|
|
|
3411
3410
|
esState = esStateEnum.OK;
|
|
3412
3411
|
} else {
|
|
3413
3412
|
global.kuzzle.log.info(
|
|
3414
|
-
`[ℹ] 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`,
|
|
3415
3414
|
);
|
|
3416
3415
|
await Bluebird.delay(1000);
|
|
3417
3416
|
}
|
|
@@ -3434,7 +3433,7 @@ class ElasticSearch extends Service {
|
|
|
3434
3433
|
throw kerror.get(
|
|
3435
3434
|
"invalid_mapping",
|
|
3436
3435
|
path,
|
|
3437
|
-
"Dynamic property value should be a string."
|
|
3436
|
+
"Dynamic property value should be a string.",
|
|
3438
3437
|
);
|
|
3439
3438
|
}
|
|
3440
3439
|
|
|
@@ -3443,8 +3442,8 @@ class ElasticSearch extends Service {
|
|
|
3443
3442
|
"invalid_mapping",
|
|
3444
3443
|
path,
|
|
3445
3444
|
`Incorrect dynamic property value (${value}). Should be one of "${DYNAMIC_PROPERTY_VALUES.join(
|
|
3446
|
-
'", "'
|
|
3447
|
-
)}"
|
|
3445
|
+
'", "',
|
|
3446
|
+
)}"`,
|
|
3448
3447
|
);
|
|
3449
3448
|
}
|
|
3450
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(".*");
|