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
|
@@ -70,7 +70,7 @@ class Statistics {
|
|
|
70
70
|
} else {
|
|
71
71
|
this.currentStats.ongoingRequests.set(
|
|
72
72
|
protocol,
|
|
73
|
-
this.currentStats.ongoingRequests.get(protocol) + 1
|
|
73
|
+
this.currentStats.ongoingRequests.get(protocol) + 1,
|
|
74
74
|
);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
@@ -93,7 +93,7 @@ class Statistics {
|
|
|
93
93
|
|
|
94
94
|
this.currentStats.ongoingRequests.set(
|
|
95
95
|
protocol,
|
|
96
|
-
this.currentStats.ongoingRequests.get(protocol) - 1
|
|
96
|
+
this.currentStats.ongoingRequests.get(protocol) - 1,
|
|
97
97
|
);
|
|
98
98
|
|
|
99
99
|
if (!this.currentStats.completedRequests.has(protocol)) {
|
|
@@ -101,7 +101,7 @@ class Statistics {
|
|
|
101
101
|
} else {
|
|
102
102
|
this.currentStats.completedRequests.set(
|
|
103
103
|
protocol,
|
|
104
|
-
this.currentStats.completedRequests.get(protocol) + 1
|
|
104
|
+
this.currentStats.completedRequests.get(protocol) + 1,
|
|
105
105
|
);
|
|
106
106
|
}
|
|
107
107
|
}
|
|
@@ -124,7 +124,7 @@ class Statistics {
|
|
|
124
124
|
|
|
125
125
|
this.currentStats.ongoingRequests.set(
|
|
126
126
|
protocol,
|
|
127
|
-
this.currentStats.ongoingRequests.get(protocol) - 1
|
|
127
|
+
this.currentStats.ongoingRequests.get(protocol) - 1,
|
|
128
128
|
);
|
|
129
129
|
|
|
130
130
|
if (!this.currentStats.failedRequests.has(protocol)) {
|
|
@@ -132,7 +132,7 @@ class Statistics {
|
|
|
132
132
|
} else {
|
|
133
133
|
this.currentStats.failedRequests.set(
|
|
134
134
|
protocol,
|
|
135
|
-
this.currentStats.failedRequests.get(protocol) + 1
|
|
135
|
+
this.currentStats.failedRequests.get(protocol) + 1,
|
|
136
136
|
);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
@@ -159,7 +159,7 @@ class Statistics {
|
|
|
159
159
|
this.currentStats.connections.set(
|
|
160
160
|
requestContext.connection.protocol,
|
|
161
161
|
this.currentStats.connections.get(requestContext.connection.protocol) +
|
|
162
|
-
1
|
|
162
|
+
1,
|
|
163
163
|
);
|
|
164
164
|
}
|
|
165
165
|
}
|
|
@@ -187,7 +187,7 @@ class Statistics {
|
|
|
187
187
|
this.currentStats.connections.set(
|
|
188
188
|
requestContext.connection.protocol,
|
|
189
189
|
this.currentStats.connections.get(requestContext.connection.protocol) -
|
|
190
|
-
1
|
|
190
|
+
1,
|
|
191
191
|
);
|
|
192
192
|
}
|
|
193
193
|
}
|
|
@@ -204,7 +204,7 @@ class Statistics {
|
|
|
204
204
|
|
|
205
205
|
const frame = Object.assign(
|
|
206
206
|
{ timestamp: new Date().getTime() },
|
|
207
|
-
this.currentStats
|
|
207
|
+
this.currentStats,
|
|
208
208
|
);
|
|
209
209
|
|
|
210
210
|
if (!this.lastFrame) {
|
|
@@ -213,7 +213,7 @@ class Statistics {
|
|
|
213
213
|
|
|
214
214
|
const last = await global.kuzzle.ask(
|
|
215
215
|
"core:cache:internal:get",
|
|
216
|
-
this.cacheKeyPrefix + this.lastFrame
|
|
216
|
+
this.cacheKeyPrefix + this.lastFrame,
|
|
217
217
|
);
|
|
218
218
|
|
|
219
219
|
return Object.assign(frame, JSON.parse(last));
|
|
@@ -265,7 +265,7 @@ class Statistics {
|
|
|
265
265
|
|
|
266
266
|
const stats = {
|
|
267
267
|
completedRequests: Object.fromEntries(
|
|
268
|
-
this.currentStats.completedRequests
|
|
268
|
+
this.currentStats.completedRequests,
|
|
269
269
|
),
|
|
270
270
|
connections: Object.fromEntries(this.currentStats.connections),
|
|
271
271
|
failedRequests: Object.fromEntries(this.currentStats.failedRequests),
|
|
@@ -275,7 +275,7 @@ class Statistics {
|
|
|
275
275
|
if (!this.lastFrame) {
|
|
276
276
|
if (!stopTime || stopTime >= currentDate) {
|
|
277
277
|
response.hits.push(
|
|
278
|
-
Object.assign({ timestamp: new Date(currentDate).getTime() }, stats)
|
|
278
|
+
Object.assign({ timestamp: new Date(currentDate).getTime() }, stats),
|
|
279
279
|
);
|
|
280
280
|
}
|
|
281
281
|
|
|
@@ -286,14 +286,14 @@ class Statistics {
|
|
|
286
286
|
|
|
287
287
|
const frames = await global.kuzzle.ask(
|
|
288
288
|
"core:cache:internal:searchKeys",
|
|
289
|
-
`${this.cacheKeyPrefix}
|
|
289
|
+
`${this.cacheKeyPrefix}*`,
|
|
290
290
|
);
|
|
291
291
|
|
|
292
292
|
// Statistics keys are timestamp.
|
|
293
293
|
// Ordering them guarantees stats frames to be returned in the right order
|
|
294
294
|
const values = await global.kuzzle.ask(
|
|
295
295
|
"core:cache:internal:mget",
|
|
296
|
-
frames.sort()
|
|
296
|
+
frames.sort(),
|
|
297
297
|
);
|
|
298
298
|
|
|
299
299
|
values.forEach((v, idx) => {
|
|
@@ -308,7 +308,7 @@ class Statistics {
|
|
|
308
308
|
response.hits.push(
|
|
309
309
|
Object.assign(JSON.parse(v), {
|
|
310
310
|
timestamp: new Date(frameDateTime).getTime(),
|
|
311
|
-
})
|
|
311
|
+
}),
|
|
312
312
|
);
|
|
313
313
|
}
|
|
314
314
|
});
|
|
@@ -363,7 +363,7 @@ class Statistics {
|
|
|
363
363
|
"core:cache:internal:store",
|
|
364
364
|
this.cacheKeyPrefix + this.lastFrame,
|
|
365
365
|
stats,
|
|
366
|
-
{ ttl: this.ttl }
|
|
366
|
+
{ ttl: this.ttl },
|
|
367
367
|
);
|
|
368
368
|
}
|
|
369
369
|
}
|
|
@@ -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
|
|