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
|
@@ -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
|
}
|
|
@@ -56,7 +56,7 @@ class StringType extends BaseType {
|
|
|
56
56
|
fieldValue.length < typeOptions.length.min
|
|
57
57
|
) {
|
|
58
58
|
errorMessages.push(
|
|
59
|
-
`Invalid string length. Expected min: ${typeOptions.length.min}. Received: ${fieldValue.length} ("${fieldValue}")
|
|
59
|
+
`Invalid string length. Expected min: ${typeOptions.length.min}. Received: ${fieldValue.length} ("${fieldValue}")`,
|
|
60
60
|
);
|
|
61
61
|
return false;
|
|
62
62
|
}
|
|
@@ -66,7 +66,7 @@ class StringType extends BaseType {
|
|
|
66
66
|
fieldValue.length > typeOptions.length.max
|
|
67
67
|
) {
|
|
68
68
|
errorMessages.push(
|
|
69
|
-
`Invalid string length. Expected max: ${typeOptions.length.max}. Received: ${fieldValue.length} ("${fieldValue}")
|
|
69
|
+
`Invalid string length. Expected max: ${typeOptions.length.max}. Received: ${fieldValue.length} ("${fieldValue}")`,
|
|
70
70
|
);
|
|
71
71
|
return false;
|
|
72
72
|
}
|
|
@@ -104,7 +104,7 @@ class Validation {
|
|
|
104
104
|
"core:storage:public:document:get",
|
|
105
105
|
index,
|
|
106
106
|
collection,
|
|
107
|
-
_id
|
|
107
|
+
_id,
|
|
108
108
|
);
|
|
109
109
|
|
|
110
110
|
// Avoid side effects on the request during the update validation
|
|
@@ -123,7 +123,7 @@ class Validation {
|
|
|
123
123
|
collectionSpec.fields.children,
|
|
124
124
|
collectionSpec.strict,
|
|
125
125
|
errorMessages,
|
|
126
|
-
verbose
|
|
126
|
+
verbose,
|
|
127
127
|
);
|
|
128
128
|
} catch (error) {
|
|
129
129
|
// The strictness message can be received here only if it happens at
|
|
@@ -137,7 +137,7 @@ class Validation {
|
|
|
137
137
|
"document",
|
|
138
138
|
errorMessages,
|
|
139
139
|
`The document validation is strict. Cannot add unspecified sub-field "${error.details.field}"`,
|
|
140
|
-
verbose
|
|
140
|
+
verbose,
|
|
141
141
|
);
|
|
142
142
|
}
|
|
143
143
|
}
|
|
@@ -148,7 +148,7 @@ class Validation {
|
|
|
148
148
|
index,
|
|
149
149
|
collection,
|
|
150
150
|
body,
|
|
151
|
-
_id
|
|
151
|
+
_id,
|
|
152
152
|
);
|
|
153
153
|
|
|
154
154
|
if (filters.length === 0 || filters[0] !== collectionSpec.validators) {
|
|
@@ -157,7 +157,7 @@ class Validation {
|
|
|
157
157
|
"document",
|
|
158
158
|
errorMessages,
|
|
159
159
|
"The document does not match validation filters.",
|
|
160
|
-
verbose
|
|
160
|
+
verbose,
|
|
161
161
|
);
|
|
162
162
|
}
|
|
163
163
|
}
|
|
@@ -169,7 +169,7 @@ class Validation {
|
|
|
169
169
|
request.input.body = this.recurseApplyDefault(
|
|
170
170
|
isUpdate,
|
|
171
171
|
request.input.body,
|
|
172
|
-
collectionSpec.fields.children
|
|
172
|
+
collectionSpec.fields.children,
|
|
173
173
|
);
|
|
174
174
|
}
|
|
175
175
|
|
|
@@ -199,14 +199,14 @@ class Validation {
|
|
|
199
199
|
field[i] = this.recurseApplyDefault(
|
|
200
200
|
isUpdate,
|
|
201
201
|
field[i],
|
|
202
|
-
specSubset.children
|
|
202
|
+
specSubset.children,
|
|
203
203
|
);
|
|
204
204
|
}
|
|
205
205
|
} else {
|
|
206
206
|
documentSubset[fieldName] = this.recurseApplyDefault(
|
|
207
207
|
isUpdate,
|
|
208
208
|
field,
|
|
209
|
-
specSubset.children
|
|
209
|
+
specSubset.children,
|
|
210
210
|
);
|
|
211
211
|
}
|
|
212
212
|
} else if (
|
|
@@ -232,7 +232,7 @@ class Validation {
|
|
|
232
232
|
collectionSpecSubset,
|
|
233
233
|
strictness,
|
|
234
234
|
errorMessages,
|
|
235
|
-
verbose
|
|
235
|
+
verbose,
|
|
236
236
|
) {
|
|
237
237
|
if (strictness) {
|
|
238
238
|
for (const field of Object.keys(documentSubset)) {
|
|
@@ -253,8 +253,8 @@ class Validation {
|
|
|
253
253
|
collectionSpecSubset,
|
|
254
254
|
strictness,
|
|
255
255
|
errorMessages,
|
|
256
|
-
verbose
|
|
257
|
-
)
|
|
256
|
+
verbose,
|
|
257
|
+
),
|
|
258
258
|
);
|
|
259
259
|
}
|
|
260
260
|
|
|
@@ -267,9 +267,9 @@ class Validation {
|
|
|
267
267
|
collectionSpecSubset,
|
|
268
268
|
strictness,
|
|
269
269
|
errorMessages,
|
|
270
|
-
verbose
|
|
270
|
+
verbose,
|
|
271
271
|
) && reductionResult,
|
|
272
|
-
true
|
|
272
|
+
true,
|
|
273
273
|
);
|
|
274
274
|
}
|
|
275
275
|
|
|
@@ -288,7 +288,7 @@ class Validation {
|
|
|
288
288
|
collectionSpecSubset,
|
|
289
289
|
strictness,
|
|
290
290
|
errorMessages,
|
|
291
|
-
verbose
|
|
291
|
+
verbose,
|
|
292
292
|
) {
|
|
293
293
|
/** @type StructuredFieldSpecification */
|
|
294
294
|
const field = collectionSpecSubset[fieldName];
|
|
@@ -303,7 +303,7 @@ class Validation {
|
|
|
303
303
|
field.path,
|
|
304
304
|
errorMessages,
|
|
305
305
|
"The field is mandatory.",
|
|
306
|
-
verbose
|
|
306
|
+
verbose,
|
|
307
307
|
);
|
|
308
308
|
return false;
|
|
309
309
|
}
|
|
@@ -318,7 +318,7 @@ class Validation {
|
|
|
318
318
|
field.path,
|
|
319
319
|
errorMessages,
|
|
320
320
|
"The field must be multivalued, unary value provided.",
|
|
321
|
-
verbose
|
|
321
|
+
verbose,
|
|
322
322
|
);
|
|
323
323
|
return false;
|
|
324
324
|
}
|
|
@@ -331,7 +331,7 @@ class Validation {
|
|
|
331
331
|
field.path,
|
|
332
332
|
errorMessages,
|
|
333
333
|
`Not enough elements. Minimum count is set to ${field.multivalued.minCount}.`,
|
|
334
|
-
verbose
|
|
334
|
+
verbose,
|
|
335
335
|
);
|
|
336
336
|
return false;
|
|
337
337
|
}
|
|
@@ -344,7 +344,7 @@ class Validation {
|
|
|
344
344
|
field.path,
|
|
345
345
|
errorMessages,
|
|
346
346
|
`Too many elements. Maximum count is set to ${field.multivalued.maxCount}.`,
|
|
347
|
-
verbose
|
|
347
|
+
verbose,
|
|
348
348
|
);
|
|
349
349
|
return false;
|
|
350
350
|
}
|
|
@@ -356,7 +356,7 @@ class Validation {
|
|
|
356
356
|
field.path,
|
|
357
357
|
errorMessages,
|
|
358
358
|
"The field is not a multivalued field; Multiple values provided.",
|
|
359
|
-
verbose
|
|
359
|
+
verbose,
|
|
360
360
|
);
|
|
361
361
|
return false;
|
|
362
362
|
}
|
|
@@ -367,7 +367,7 @@ class Validation {
|
|
|
367
367
|
if (this.types[field.type].allowChildren) {
|
|
368
368
|
nestedStrictness = this.types[field.type].getStrictness(
|
|
369
369
|
field.typeOptions,
|
|
370
|
-
strictness
|
|
370
|
+
strictness,
|
|
371
371
|
);
|
|
372
372
|
}
|
|
373
373
|
|
|
@@ -383,11 +383,11 @@ class Validation {
|
|
|
383
383
|
field.path,
|
|
384
384
|
errorMessages,
|
|
385
385
|
"An error has occurred during validation.",
|
|
386
|
-
verbose
|
|
386
|
+
verbose,
|
|
387
387
|
);
|
|
388
388
|
} else {
|
|
389
389
|
fieldErrors.forEach((message) =>
|
|
390
|
-
manageErrorMessage(field.path, errorMessages, message, verbose)
|
|
390
|
+
manageErrorMessage(field.path, errorMessages, message, verbose),
|
|
391
391
|
);
|
|
392
392
|
}
|
|
393
393
|
return false;
|
|
@@ -401,7 +401,7 @@ class Validation {
|
|
|
401
401
|
field.children,
|
|
402
402
|
nestedStrictness,
|
|
403
403
|
errorMessages,
|
|
404
|
-
verbose
|
|
404
|
+
verbose,
|
|
405
405
|
)
|
|
406
406
|
) {
|
|
407
407
|
result = false;
|
|
@@ -412,14 +412,14 @@ class Validation {
|
|
|
412
412
|
field.path,
|
|
413
413
|
errorMessages,
|
|
414
414
|
`The field is set to "strict"; cannot add unspecified sub-field "${error.details.field}".`,
|
|
415
|
-
verbose
|
|
415
|
+
verbose,
|
|
416
416
|
);
|
|
417
417
|
} else if (verbose) {
|
|
418
418
|
manageErrorMessage(
|
|
419
419
|
field.path,
|
|
420
420
|
errorMessages,
|
|
421
421
|
error.message,
|
|
422
|
-
verbose
|
|
422
|
+
verbose,
|
|
423
423
|
);
|
|
424
424
|
} else {
|
|
425
425
|
throw error;
|
|
@@ -445,12 +445,12 @@ class Validation {
|
|
|
445
445
|
|
|
446
446
|
for (const indexName of Object.keys(this.rawConfiguration)) {
|
|
447
447
|
for (const collectionName of Object.keys(
|
|
448
|
-
this.rawConfiguration[indexName]
|
|
448
|
+
this.rawConfiguration[indexName],
|
|
449
449
|
)) {
|
|
450
450
|
const promise = this.curateCollectionSpecification(
|
|
451
451
|
indexName,
|
|
452
452
|
collectionName,
|
|
453
|
-
this.rawConfiguration[indexName][collectionName]
|
|
453
|
+
this.rawConfiguration[indexName][collectionName],
|
|
454
454
|
)
|
|
455
455
|
.then((curatedSpec) => {
|
|
456
456
|
if (!has(specification, indexName)) {
|
|
@@ -463,7 +463,7 @@ class Validation {
|
|
|
463
463
|
})
|
|
464
464
|
.catch((error) => {
|
|
465
465
|
global.kuzzle.log.error(
|
|
466
|
-
`Specification for the collection ${collectionName} triggered an error
|
|
466
|
+
`Specification for the collection ${collectionName} triggered an error`,
|
|
467
467
|
);
|
|
468
468
|
global.kuzzle.log.error(`Error: ${error.message}`);
|
|
469
469
|
|
|
@@ -490,7 +490,7 @@ class Validation {
|
|
|
490
490
|
indexName,
|
|
491
491
|
collectionName,
|
|
492
492
|
collectionSpec,
|
|
493
|
-
verboseErrors = false
|
|
493
|
+
verboseErrors = false,
|
|
494
494
|
) {
|
|
495
495
|
// We make a deep clone to avoid side effects
|
|
496
496
|
const specification = _.cloneDeep(collectionSpec);
|
|
@@ -501,7 +501,7 @@ class Validation {
|
|
|
501
501
|
collectionName,
|
|
502
502
|
specification,
|
|
503
503
|
true,
|
|
504
|
-
verboseErrors
|
|
504
|
+
verboseErrors,
|
|
505
505
|
)
|
|
506
506
|
.then((result) => {
|
|
507
507
|
if (verboseErrors && result.isValid === false) {
|
|
@@ -529,7 +529,7 @@ class Validation {
|
|
|
529
529
|
collection,
|
|
530
530
|
spec,
|
|
531
531
|
dryRun = false,
|
|
532
|
-
verbose = false
|
|
532
|
+
verbose = false,
|
|
533
533
|
) {
|
|
534
534
|
let error = "";
|
|
535
535
|
const processed = {
|
|
@@ -543,7 +543,7 @@ class Validation {
|
|
|
543
543
|
error = assertionError.get(
|
|
544
544
|
"unexpected_properties",
|
|
545
545
|
`${index}.${collection}`,
|
|
546
|
-
allowed.join(", ")
|
|
546
|
+
allowed.join(", "),
|
|
547
547
|
);
|
|
548
548
|
|
|
549
549
|
if (verbose) {
|
|
@@ -558,7 +558,7 @@ class Validation {
|
|
|
558
558
|
spec,
|
|
559
559
|
index,
|
|
560
560
|
collection,
|
|
561
|
-
verbose
|
|
561
|
+
verbose,
|
|
562
562
|
);
|
|
563
563
|
|
|
564
564
|
if (result.isValid === false) {
|
|
@@ -569,7 +569,7 @@ class Validation {
|
|
|
569
569
|
|
|
570
570
|
throw assertionError.get(
|
|
571
571
|
"invalid_specifications",
|
|
572
|
-
result.errors.join("\n\t- ")
|
|
572
|
+
result.errors.join("\n\t- "),
|
|
573
573
|
);
|
|
574
574
|
}
|
|
575
575
|
processed.fields = result;
|
|
@@ -581,7 +581,7 @@ class Validation {
|
|
|
581
581
|
index,
|
|
582
582
|
collection,
|
|
583
583
|
spec.validators,
|
|
584
|
-
dryRun
|
|
584
|
+
dryRun,
|
|
585
585
|
);
|
|
586
586
|
|
|
587
587
|
processed.validators = filterId;
|
|
@@ -598,7 +598,7 @@ class Validation {
|
|
|
598
598
|
collectionSpec,
|
|
599
599
|
indexName,
|
|
600
600
|
collectionName,
|
|
601
|
-
verboseErrors = false
|
|
601
|
+
verboseErrors = false,
|
|
602
602
|
) {
|
|
603
603
|
const fields = {};
|
|
604
604
|
let errors = [],
|
|
@@ -614,7 +614,7 @@ class Validation {
|
|
|
614
614
|
indexName,
|
|
615
615
|
collectionName,
|
|
616
616
|
fieldName,
|
|
617
|
-
verboseErrors
|
|
617
|
+
verboseErrors,
|
|
618
618
|
);
|
|
619
619
|
|
|
620
620
|
if (result.isValid === false) {
|
|
@@ -666,7 +666,7 @@ class Validation {
|
|
|
666
666
|
indexName,
|
|
667
667
|
collectionName,
|
|
668
668
|
fieldName,
|
|
669
|
-
verboseErrors = false
|
|
669
|
+
verboseErrors = false,
|
|
670
670
|
) {
|
|
671
671
|
const errors = [];
|
|
672
672
|
|
|
@@ -675,7 +675,7 @@ class Validation {
|
|
|
675
675
|
indexName,
|
|
676
676
|
collectionName,
|
|
677
677
|
fieldName,
|
|
678
|
-
verboseErrors
|
|
678
|
+
verboseErrors,
|
|
679
679
|
);
|
|
680
680
|
|
|
681
681
|
if (result.isValid === false) {
|
|
@@ -700,10 +700,10 @@ class Validation {
|
|
|
700
700
|
assertionError.get(
|
|
701
701
|
"unexpected_properties",
|
|
702
702
|
`${indexName}.${collectionName}.${fieldName}`,
|
|
703
|
-
allowed.join(", ")
|
|
703
|
+
allowed.join(", "),
|
|
704
704
|
),
|
|
705
705
|
verboseErrors,
|
|
706
|
-
errors
|
|
706
|
+
errors,
|
|
707
707
|
);
|
|
708
708
|
}
|
|
709
709
|
|
|
@@ -721,7 +721,7 @@ class Validation {
|
|
|
721
721
|
"plugin",
|
|
722
722
|
"runtime",
|
|
723
723
|
"unexpected_error",
|
|
724
|
-
e.message
|
|
724
|
+
e.message,
|
|
725
725
|
);
|
|
726
726
|
}
|
|
727
727
|
|
|
@@ -737,7 +737,7 @@ class Validation {
|
|
|
737
737
|
indexName,
|
|
738
738
|
collectionName,
|
|
739
739
|
fieldName,
|
|
740
|
-
fieldSpec
|
|
740
|
+
fieldSpec,
|
|
741
741
|
);
|
|
742
742
|
|
|
743
743
|
return { fieldSpec, isValid: true };
|
|
@@ -757,7 +757,7 @@ class Validation {
|
|
|
757
757
|
indexName,
|
|
758
758
|
collectionName,
|
|
759
759
|
fieldName,
|
|
760
|
-
verboseErrors = false
|
|
760
|
+
verboseErrors = false,
|
|
761
761
|
) {
|
|
762
762
|
const errors = [];
|
|
763
763
|
|
|
@@ -775,10 +775,10 @@ class Validation {
|
|
|
775
775
|
assertionError.get(
|
|
776
776
|
"unexpected_properties",
|
|
777
777
|
`${indexName}.${collectionName}.${fieldName}`,
|
|
778
|
-
props.join(", ")
|
|
778
|
+
props.join(", "),
|
|
779
779
|
),
|
|
780
780
|
verboseErrors,
|
|
781
|
-
errors
|
|
781
|
+
errors,
|
|
782
782
|
);
|
|
783
783
|
}
|
|
784
784
|
|
|
@@ -786,10 +786,10 @@ class Validation {
|
|
|
786
786
|
throwOrStoreError(
|
|
787
787
|
assertionError.get(
|
|
788
788
|
"missing_type",
|
|
789
|
-
`${indexName}.${collectionName}.${fieldName}
|
|
789
|
+
`${indexName}.${collectionName}.${fieldName}`,
|
|
790
790
|
),
|
|
791
791
|
verboseErrors,
|
|
792
|
-
errors
|
|
792
|
+
errors,
|
|
793
793
|
);
|
|
794
794
|
}
|
|
795
795
|
|
|
@@ -798,10 +798,10 @@ class Validation {
|
|
|
798
798
|
assertionError.get(
|
|
799
799
|
"unknown_type",
|
|
800
800
|
`${indexName}.${collectionName}.${fieldName}`,
|
|
801
|
-
fieldSpec.type
|
|
801
|
+
fieldSpec.type,
|
|
802
802
|
),
|
|
803
803
|
verboseErrors,
|
|
804
|
-
errors
|
|
804
|
+
errors,
|
|
805
805
|
);
|
|
806
806
|
}
|
|
807
807
|
|
|
@@ -812,10 +812,10 @@ class Validation {
|
|
|
812
812
|
assertionError.get(
|
|
813
813
|
"unexpected_properties",
|
|
814
814
|
`${indexName}.${collectionName}.${fieldName}.multivalued`,
|
|
815
|
-
multivaluedProps.join(", ")
|
|
815
|
+
multivaluedProps.join(", "),
|
|
816
816
|
),
|
|
817
817
|
verboseErrors,
|
|
818
|
-
errors
|
|
818
|
+
errors,
|
|
819
819
|
);
|
|
820
820
|
}
|
|
821
821
|
|
|
@@ -823,10 +823,10 @@ class Validation {
|
|
|
823
823
|
throwOrStoreError(
|
|
824
824
|
assertionError.get(
|
|
825
825
|
"missing_value",
|
|
826
|
-
`${indexName}.${collectionName}.${fieldName}.multivalued
|
|
826
|
+
`${indexName}.${collectionName}.${fieldName}.multivalued`,
|
|
827
827
|
),
|
|
828
828
|
verboseErrors,
|
|
829
|
-
errors
|
|
829
|
+
errors,
|
|
830
830
|
);
|
|
831
831
|
}
|
|
832
832
|
|
|
@@ -835,10 +835,10 @@ class Validation {
|
|
|
835
835
|
assertionError.get(
|
|
836
836
|
"invalid_type",
|
|
837
837
|
`${indexName}.${collectionName}.${fieldName}.multivalued.value`,
|
|
838
|
-
"boolean"
|
|
838
|
+
"boolean",
|
|
839
839
|
),
|
|
840
840
|
verboseErrors,
|
|
841
|
-
errors
|
|
841
|
+
errors,
|
|
842
842
|
);
|
|
843
843
|
}
|
|
844
844
|
|
|
@@ -851,10 +851,10 @@ class Validation {
|
|
|
851
851
|
assertionError.get(
|
|
852
852
|
"not_multivalued",
|
|
853
853
|
`${indexName}.${collectionName}.${fieldName}`,
|
|
854
|
-
unexpected
|
|
854
|
+
unexpected,
|
|
855
855
|
),
|
|
856
856
|
verboseErrors,
|
|
857
|
-
errors
|
|
857
|
+
errors,
|
|
858
858
|
);
|
|
859
859
|
}
|
|
860
860
|
}
|
|
@@ -869,10 +869,10 @@ class Validation {
|
|
|
869
869
|
"invalid_range",
|
|
870
870
|
`${indexName}.${collectionName}.${fieldName}`,
|
|
871
871
|
"minCount",
|
|
872
|
-
"maxCount"
|
|
872
|
+
"maxCount",
|
|
873
873
|
),
|
|
874
874
|
verboseErrors,
|
|
875
|
-
errors
|
|
875
|
+
errors,
|
|
876
876
|
);
|
|
877
877
|
}
|
|
878
878
|
}
|
|
@@ -905,12 +905,12 @@ class Validation {
|
|
|
905
905
|
"Registering filter validator %s/%s: %O",
|
|
906
906
|
indexName,
|
|
907
907
|
collectionName,
|
|
908
|
-
query
|
|
908
|
+
query,
|
|
909
909
|
);
|
|
910
910
|
|
|
911
911
|
return this.koncorde.register(
|
|
912
912
|
query,
|
|
913
|
-
toKoncordeIndex(indexName, collectionName)
|
|
913
|
+
toKoncordeIndex(indexName, collectionName),
|
|
914
914
|
);
|
|
915
915
|
}
|
|
916
916
|
|
|
@@ -935,7 +935,7 @@ class Validation {
|
|
|
935
935
|
"types",
|
|
936
936
|
"missing_function",
|
|
937
937
|
validationType.typeName,
|
|
938
|
-
"validate"
|
|
938
|
+
"validate",
|
|
939
939
|
);
|
|
940
940
|
}
|
|
941
941
|
|
|
@@ -948,7 +948,7 @@ class Validation {
|
|
|
948
948
|
"types",
|
|
949
949
|
"missing_function",
|
|
950
950
|
validationType.typeName,
|
|
951
|
-
"validateFieldSpecification"
|
|
951
|
+
"validateFieldSpecification",
|
|
952
952
|
);
|
|
953
953
|
}
|
|
954
954
|
|
|
@@ -962,7 +962,7 @@ class Validation {
|
|
|
962
962
|
"types",
|
|
963
963
|
"missing_function",
|
|
964
964
|
validationType.typeName,
|
|
965
|
-
"getStrictness"
|
|
965
|
+
"getStrictness",
|
|
966
966
|
);
|
|
967
967
|
}
|
|
968
968
|
|
|
@@ -974,7 +974,7 @@ class Validation {
|
|
|
974
974
|
"validation",
|
|
975
975
|
"types",
|
|
976
976
|
"already_exists",
|
|
977
|
-
validationType.typeName
|
|
977
|
+
validationType.typeName,
|
|
978
978
|
);
|
|
979
979
|
}
|
|
980
980
|
|
|
@@ -993,7 +993,7 @@ function checkAllowedProperties(object, allowedProperties) {
|
|
|
993
993
|
}
|
|
994
994
|
|
|
995
995
|
return !Object.keys(object).some(
|
|
996
|
-
(propertyName) => !allowedProperties.includes(propertyName)
|
|
996
|
+
(propertyName) => !allowedProperties.includes(propertyName),
|
|
997
997
|
);
|
|
998
998
|
}
|
|
999
999
|
|
|
@@ -1116,7 +1116,7 @@ function manageErrorMessage(errorContext, errorHolder, message, structured) {
|
|
|
1116
1116
|
"check",
|
|
1117
1117
|
"failed_field",
|
|
1118
1118
|
errorContext.join("."),
|
|
1119
|
-
message
|
|
1119
|
+
message,
|
|
1120
1120
|
);
|
|
1121
1121
|
}
|
|
1122
1122
|
}
|
|
@@ -1141,7 +1141,7 @@ function getValidationConfiguration() {
|
|
|
1141
1141
|
throw assertionError.get(
|
|
1142
1142
|
"incorrect_validation_format",
|
|
1143
1143
|
collectionName,
|
|
1144
|
-
"index"
|
|
1144
|
+
"index",
|
|
1145
1145
|
);
|
|
1146
1146
|
}
|
|
1147
1147
|
|
|
@@ -1149,7 +1149,7 @@ function getValidationConfiguration() {
|
|
|
1149
1149
|
throw assertionError.get(
|
|
1150
1150
|
"incorrect_validation_format",
|
|
1151
1151
|
collectionName,
|
|
1152
|
-
"collection"
|
|
1152
|
+
"collection",
|
|
1153
1153
|
);
|
|
1154
1154
|
}
|
|
1155
1155
|
|
|
@@ -1157,7 +1157,7 @@ function getValidationConfiguration() {
|
|
|
1157
1157
|
throw assertionError.get(
|
|
1158
1158
|
"incorrect_validation_format",
|
|
1159
1159
|
collectionName,
|
|
1160
|
-
"validation"
|
|
1160
|
+
"validation",
|
|
1161
1161
|
);
|
|
1162
1162
|
}
|
|
1163
1163
|
|