kuzzle 2.16.11 → 2.17.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/lib/api/controllers/adminController.js +3 -3
- package/lib/api/controllers/authController.js +12 -12
- package/lib/api/controllers/baseController.js +60 -3
- package/lib/api/controllers/clusterController.js +1 -1
- package/lib/api/controllers/collectionController.js +7 -5
- package/lib/api/controllers/documentController.js +130 -17
- package/lib/api/controllers/indexController.js +1 -1
- package/lib/api/controllers/memoryStorageController.js +39 -38
- package/lib/api/controllers/realtimeController.js +1 -1
- package/lib/api/controllers/securityController.js +50 -50
- package/lib/api/controllers/serverController.js +73 -27
- package/lib/api/documentExtractor.js +3 -3
- package/lib/api/funnel.js +44 -21
- package/lib/api/httpRoutes.js +9 -4
- package/lib/api/openapi/OpenApiManager.d.ts +11 -0
- package/lib/api/openapi/OpenApiManager.js +96 -0
- package/lib/api/openapi/{document → components/document}/count.yaml +2 -2
- package/lib/api/openapi/{document → components/document}/create.yaml +2 -2
- package/lib/api/openapi/{document → components/document}/createOrReplace.yaml +2 -2
- package/lib/api/openapi/{document → components/document}/delete.yaml +1 -1
- package/lib/api/openapi/{document → components/document}/deleteByQuery.yaml +2 -2
- package/lib/api/openapi/{document → components/document}/exists.yaml +1 -1
- package/lib/api/openapi/{document → components/document}/get.yaml +1 -1
- package/lib/api/openapi/{document → components/document}/index.d.ts +2 -0
- package/lib/api/openapi/{document → components/document}/index.js +7 -2
- package/lib/api/openapi/{document → components/document}/replace.yaml +2 -2
- package/lib/api/openapi/{document → components/document}/scroll.yaml +1 -1
- package/lib/api/openapi/{document → components/document}/update.yaml +2 -2
- package/lib/api/openapi/components/document/validate.yaml +42 -0
- package/lib/api/openapi/components/index.d.ts +2 -0
- package/lib/api/openapi/components/index.js +18 -0
- package/lib/api/openapi/{payloads.yaml → components/payloads.yaml} +0 -0
- package/lib/api/openapi/index.d.ts +1 -2
- package/lib/api/openapi/index.js +1 -5
- package/lib/api/openapi/openApiGenerator.d.ts +7 -0
- package/lib/api/openapi/openApiGenerator.js +133 -0
- package/lib/api/request/kuzzleRequest.js +8 -6
- package/lib/cluster/node.js +9 -9
- package/lib/cluster/publisher.js +1 -1
- package/lib/cluster/state.js +20 -4
- package/lib/cluster/subscriber.js +1 -1
- package/lib/cluster/workers/IDCardRenewer.js +2 -2
- package/lib/config/default.config.js +1 -0
- package/lib/config/index.js +6 -6
- package/lib/core/auth/passportResponse.js +6 -6
- package/lib/core/auth/passportWrapper.js +5 -5
- package/lib/core/backend/backend.d.ts +11 -3
- package/lib/core/backend/backend.js +22 -17
- package/lib/core/backend/backendConfig.d.ts +5 -1
- package/lib/core/backend/backendConfig.js +25 -2
- package/lib/core/backend/backendController.js +21 -5
- package/lib/core/backend/backendErrors.d.ts +58 -0
- package/lib/core/backend/backendErrors.js +121 -0
- package/lib/core/backend/backendHook.js +21 -5
- package/lib/core/backend/backendImport.js +21 -5
- package/lib/core/backend/backendOpenApi.d.ts +9 -0
- package/lib/core/backend/backendOpenApi.js +69 -0
- package/lib/core/backend/backendPipe.js +21 -5
- package/lib/core/backend/backendPlugin.js +22 -3
- package/lib/core/backend/backendVault.js +21 -2
- package/lib/core/backend/index.d.ts +2 -0
- package/lib/core/backend/index.js +2 -0
- package/lib/core/network/accessLogger.js +6 -6
- package/lib/core/network/clientConnection.js +1 -1
- package/lib/core/network/entryPoint.js +5 -5
- package/lib/core/network/httpRouter/index.js +5 -5
- package/lib/core/network/httpRouter/routeHandler.js +3 -3
- package/lib/core/network/httpRouter/routePart.js +5 -5
- package/lib/core/network/protocolManifest.js +1 -1
- package/lib/core/network/protocols/httpMessage.js +2 -2
- package/lib/core/network/protocols/httpwsProtocol.js +228 -50
- package/lib/core/network/protocols/mqttProtocol.js +3 -3
- package/lib/core/network/protocols/protocol.js +3 -3
- package/lib/core/network/router.js +7 -6
- package/lib/core/plugin/plugin.js +38 -64
- package/lib/core/plugin/pluginContext.js +22 -3
- package/lib/core/plugin/pluginManifest.js +3 -3
- package/lib/core/plugin/pluginRepository.js +5 -5
- package/lib/core/plugin/pluginsManager.js +29 -28
- package/lib/core/realtime/channel.js +20 -4
- package/lib/core/realtime/hotelClerk.js +24 -5
- package/lib/core/realtime/notification/server.js +1 -1
- package/lib/core/realtime/notification/user.js +1 -1
- package/lib/core/realtime/notifier.js +5 -5
- package/lib/core/security/index.js +1 -1
- package/lib/core/security/profileRepository.d.ts +176 -0
- package/lib/core/security/profileRepository.js +445 -443
- package/lib/core/security/roleRepository.js +16 -16
- package/lib/core/security/securityLoader.js +2 -2
- package/lib/core/security/tokenRepository.js +11 -11
- package/lib/core/security/userRepository.js +8 -8
- package/lib/core/shared/abstractManifest.js +4 -4
- package/lib/core/shared/repository.js +5 -5
- package/lib/core/shared/sdk/embeddedSdk.js +21 -2
- package/lib/core/shared/sdk/funnelProtocol.js +1 -1
- package/lib/core/shared/sdk/impersonatedSdk.js +1 -1
- package/lib/core/shared/store.js +30 -23
- package/lib/core/statistics/statistics.js +17 -17
- package/lib/core/storage/clientAdapter.js +45 -10
- package/lib/core/storage/indexCache.js +20 -4
- package/lib/core/validation/baseType.js +5 -5
- package/lib/core/validation/types/anything.js +1 -1
- package/lib/core/validation/types/boolean.js +2 -2
- package/lib/core/validation/types/date.js +9 -9
- package/lib/core/validation/types/email.js +5 -5
- package/lib/core/validation/types/enum.js +6 -6
- package/lib/core/validation/types/geoPoint.js +2 -2
- package/lib/core/validation/types/geoShape.js +28 -25
- package/lib/core/validation/types/integer.js +4 -4
- package/lib/core/validation/types/ipAddress.js +7 -6
- package/lib/core/validation/types/numeric.js +4 -4
- package/lib/core/validation/types/object.js +5 -5
- package/lib/core/validation/types/string.js +5 -5
- package/lib/core/validation/types/url.js +7 -6
- package/lib/core/validation/validation.js +95 -84
- package/lib/kerror/codes/1-services.json +12 -0
- package/lib/kerror/codes/2-api.json +12 -0
- package/lib/kerror/codes/3-network.json +12 -0
- package/lib/kerror/codes/4-plugin.json +6 -0
- package/lib/kerror/codes/index.js +11 -11
- package/lib/kerror/errors/multipleErrorsError.d.ts +1 -1
- package/lib/kerror/errors/multipleErrorsError.js +3 -3
- package/lib/kerror/index.d.ts +82 -0
- package/lib/kerror/index.js +176 -143
- package/lib/kuzzle/dumpGenerator.js +3 -3
- package/lib/kuzzle/event/kuzzleEventEmitter.js +4 -4
- package/lib/kuzzle/event/pipeRunner.js +1 -1
- package/lib/kuzzle/event/waterfall.js +6 -6
- package/lib/kuzzle/kuzzle.js +59 -9
- package/lib/kuzzle/log.js +3 -3
- package/lib/kuzzle/vault.js +3 -3
- package/lib/model/security/profile.d.ts +54 -0
- package/lib/model/security/profile.js +192 -232
- package/lib/model/security/rights.js +1 -1
- package/lib/model/security/role.d.ts +40 -0
- package/lib/model/security/role.js +174 -190
- package/lib/model/security/user.d.ts +29 -0
- package/lib/model/security/user.js +103 -52
- package/lib/model/storage/apiKey.js +2 -2
- package/lib/model/storage/baseModel.js +3 -3
- package/lib/service/cache/redis.js +7 -7
- package/lib/service/storage/elasticsearch.js +152 -90
- package/lib/service/storage/esWrapper.js +2 -3
- package/lib/types/ControllerDefinition.d.ts +3 -3
- package/lib/types/ControllerRights.d.ts +22 -0
- package/lib/types/ControllerRights.js +23 -0
- package/lib/types/HttpStream.d.ts +32 -0
- package/lib/types/HttpStream.js +70 -0
- package/lib/types/OpenApiDefinition.d.ts +43 -0
- package/lib/types/{config/StorageService/StorageServiceElasticsearchConfiguration.js → OpenApiDefinition.js} +1 -1
- package/lib/types/Plugin.js +20 -4
- package/lib/types/Policy.d.ts +25 -0
- package/lib/types/{InternalLogger.js → Policy.js} +2 -2
- package/lib/types/PolicyRestrictions.d.ts +21 -0
- package/lib/types/PolicyRestrictions.js +23 -0
- package/lib/types/Target.d.ts +15 -0
- package/lib/types/Target.js +23 -0
- package/lib/types/config/KuzzleConfiguration.d.ts +4 -0
- package/lib/types/config/ServicesConfiguration.d.ts +2 -2
- package/lib/types/config/{StorageService/StorageServiceElasticsearchConfiguration.d.ts → storageEngine/StorageEngineElasticsearchConfiguration.d.ts} +10 -3
- package/lib/types/config/storageEngine/StorageEngineElasticsearchConfiguration.js +3 -0
- package/lib/types/errors/ErrorDefinition.d.ts +27 -0
- package/lib/types/errors/ErrorDefinition.js +3 -0
- package/lib/types/errors/ErrorDomains.d.ts +17 -0
- package/lib/types/errors/ErrorDomains.js +3 -0
- package/lib/types/index.d.ts +9 -1
- package/lib/types/index.js +9 -1
- package/lib/util/array.d.ts +11 -0
- package/lib/util/array.js +57 -0
- package/lib/util/assertType.js +6 -6
- package/lib/util/bufferedPassThrough.d.ts +76 -0
- package/lib/util/bufferedPassThrough.js +161 -0
- package/lib/util/deprecate.js +7 -5
- package/lib/util/didYouMean.js +1 -1
- package/lib/util/dump-collection.d.ts +3 -0
- package/lib/util/dump-collection.js +284 -0
- package/lib/util/extractFields.js +2 -2
- package/lib/util/inflector.d.ts +8 -0
- package/lib/util/inflector.js +16 -0
- package/lib/util/mutex.js +21 -2
- package/lib/util/requestAssertions.js +7 -7
- package/lib/util/wildcard.js +55 -0
- package/package-lock.json +535 -75
- package/package.json +5 -3
- package/lib/api/openApiGenerator.d.ts +0 -7
- package/lib/api/openApiGenerator.js +0 -197
- package/lib/types/InternalLogger.d.ts +0 -25
|
@@ -36,7 +36,7 @@ let mapping;
|
|
|
36
36
|
* @class MemoryStorageController
|
|
37
37
|
*/
|
|
38
38
|
class MemoryStorageController extends NativeController {
|
|
39
|
-
constructor() {
|
|
39
|
+
constructor () {
|
|
40
40
|
super();
|
|
41
41
|
|
|
42
42
|
initMapping();
|
|
@@ -117,8 +117,8 @@ function initMapping () {
|
|
|
117
117
|
},
|
|
118
118
|
bitcount: {
|
|
119
119
|
key: ['resource', '_id'],
|
|
120
|
-
start: {skip: true, path: ['args', 'start']},
|
|
121
|
-
end: {skip: true, path: ['args', 'end']}
|
|
120
|
+
start: { skip: true, path: ['args', 'start'] },
|
|
121
|
+
end: { skip: true, path: ['args', 'end'] }
|
|
122
122
|
},
|
|
123
123
|
bitop: {
|
|
124
124
|
operation: ['body', 'operation'],
|
|
@@ -128,8 +128,8 @@ function initMapping () {
|
|
|
128
128
|
bitpos: {
|
|
129
129
|
key: ['resource', '_id'],
|
|
130
130
|
bit: ['args', 'bit'],
|
|
131
|
-
start: {skip: true, path
|
|
132
|
-
end: {skip: true, path: ['args', 'end']}
|
|
131
|
+
start: { skip: true, path: ['args', 'start'] },
|
|
132
|
+
end: { skip: true, path: ['args', 'end'] }
|
|
133
133
|
},
|
|
134
134
|
dbsize: null,
|
|
135
135
|
decrby: {
|
|
@@ -149,7 +149,7 @@ function initMapping () {
|
|
|
149
149
|
},
|
|
150
150
|
flushdb: null,
|
|
151
151
|
geoadd: {
|
|
152
|
-
key: {path: ['resource', '_id']},
|
|
152
|
+
key: { path: ['resource', '_id'] },
|
|
153
153
|
points: {
|
|
154
154
|
map: (val, request) => {
|
|
155
155
|
const result = [];
|
|
@@ -162,7 +162,7 @@ function initMapping () {
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
val.forEach(v => {
|
|
165
|
-
if (typeof v !== 'object' || !v.lon || !v.lat || !v.name) {
|
|
165
|
+
if (typeof v !== 'object' || ! v.lon || ! v.lat || ! v.name) {
|
|
166
166
|
throw kerror.get('invalid_argument', 'points', '<array of geopoints>');
|
|
167
167
|
}
|
|
168
168
|
|
|
@@ -182,7 +182,7 @@ function initMapping () {
|
|
|
182
182
|
key: ['resource', '_id'],
|
|
183
183
|
member1: ['args', 'member1'],
|
|
184
184
|
member2: ['args', 'member2'],
|
|
185
|
-
unit: {skip: true, path: ['args', 'unit']}
|
|
185
|
+
unit: { skip: true, path: ['args', 'unit'] }
|
|
186
186
|
},
|
|
187
187
|
geohash: {
|
|
188
188
|
key: ['resource', '_id'],
|
|
@@ -228,7 +228,7 @@ function initMapping () {
|
|
|
228
228
|
},
|
|
229
229
|
hdel: {
|
|
230
230
|
key: ['resource', '_id'],
|
|
231
|
-
fields: {skip: true, merge: true, path: ['body', 'fields']}
|
|
231
|
+
fields: { skip: true, merge: true, path: ['body', 'fields'] }
|
|
232
232
|
},
|
|
233
233
|
hmget: {
|
|
234
234
|
key: ['resource', '_id'],
|
|
@@ -257,7 +257,7 @@ function initMapping () {
|
|
|
257
257
|
kassert.assertBodyAttributeType(request, 'entries', 'array');
|
|
258
258
|
|
|
259
259
|
val.forEach(v => {
|
|
260
|
-
if (typeof v !== 'object' || !v.field || !v.value) {
|
|
260
|
+
if (typeof v !== 'object' || ! v.field || ! v.value) {
|
|
261
261
|
throw kerror.get('invalid_argument', 'entries', '<array of object>');
|
|
262
262
|
}
|
|
263
263
|
|
|
@@ -294,7 +294,7 @@ function initMapping () {
|
|
|
294
294
|
},
|
|
295
295
|
lpush: {
|
|
296
296
|
key: ['resource', '_id'],
|
|
297
|
-
values: {skip: true, merge: true, path: ['body', 'values']}
|
|
297
|
+
values: { skip: true, merge: true, path: ['body', 'values'] }
|
|
298
298
|
},
|
|
299
299
|
lrange: {
|
|
300
300
|
key: ['resource', '_id'],
|
|
@@ -334,7 +334,7 @@ function initMapping () {
|
|
|
334
334
|
kassert.assertBodyHasAttribute(request, 'entries');
|
|
335
335
|
kassert.assertBodyAttributeType(request, 'entries', 'array');
|
|
336
336
|
val.forEach(entry => {
|
|
337
|
-
if (typeof entry !== 'object' || !entry.key || !entry.value) {
|
|
337
|
+
if (typeof entry !== 'object' || ! entry.key || ! entry.value) {
|
|
338
338
|
throw kerror.get('invalid_argument', 'entries', '<array of objects>');
|
|
339
339
|
}
|
|
340
340
|
|
|
@@ -361,11 +361,11 @@ function initMapping () {
|
|
|
361
361
|
},
|
|
362
362
|
pfadd: {
|
|
363
363
|
key: ['resource', '_id'],
|
|
364
|
-
elements: {skip: true, merge: true, path: ['body', 'elements']}
|
|
364
|
+
elements: { skip: true, merge: true, path: ['body', 'elements'] }
|
|
365
365
|
},
|
|
366
366
|
pfmerge: {
|
|
367
367
|
key: ['resource', '_id'],
|
|
368
|
-
sources: {skip: true, merge: true, path: ['body', 'sources']}
|
|
368
|
+
sources: { skip: true, merge: true, path: ['body', 'sources'] }
|
|
369
369
|
},
|
|
370
370
|
ping: null,
|
|
371
371
|
psetex: {
|
|
@@ -388,7 +388,7 @@ function initMapping () {
|
|
|
388
388
|
},
|
|
389
389
|
sadd: {
|
|
390
390
|
key: ['resource', '_id'],
|
|
391
|
-
members: {skip: true, merge: true, path: ['body', 'members']}
|
|
391
|
+
members: { skip: true, merge: true, path: ['body', 'members'] }
|
|
392
392
|
},
|
|
393
393
|
scan: {
|
|
394
394
|
cursor: ['args', 'cursor'],
|
|
@@ -406,7 +406,7 @@ function initMapping () {
|
|
|
406
406
|
sdiffstore: {
|
|
407
407
|
destination: ['body', 'destination'],
|
|
408
408
|
key: ['resource', '_id'],
|
|
409
|
-
keys: {merge: true, path: ['body', 'keys']}
|
|
409
|
+
keys: { merge: true, path: ['body', 'keys'] }
|
|
410
410
|
},
|
|
411
411
|
set: null, // handled by extractArgumentsFromRequestForSet
|
|
412
412
|
setex: {
|
|
@@ -420,7 +420,7 @@ function initMapping () {
|
|
|
420
420
|
},
|
|
421
421
|
sinterstore: {
|
|
422
422
|
destination: ['body', 'destination'],
|
|
423
|
-
keys: {merge: true, path: ['body', 'keys']}
|
|
423
|
+
keys: { merge: true, path: ['body', 'keys'] }
|
|
424
424
|
},
|
|
425
425
|
sismember: {
|
|
426
426
|
key: ['resource', '_id'],
|
|
@@ -434,15 +434,15 @@ function initMapping () {
|
|
|
434
434
|
sort: null, // handled by extractArgumentsFromRequestForSort
|
|
435
435
|
spop: {
|
|
436
436
|
key: ['resource', '_id'],
|
|
437
|
-
count: {skip: true, path: ['body', 'count']}
|
|
437
|
+
count: { skip: true, path: ['body', 'count'] }
|
|
438
438
|
},
|
|
439
439
|
srandmember: {
|
|
440
440
|
key: ['resource', '_id'],
|
|
441
|
-
count: {skip: true, path: ['args', 'count']}
|
|
441
|
+
count: { skip: true, path: ['args', 'count'] }
|
|
442
442
|
},
|
|
443
443
|
srem: {
|
|
444
444
|
key: ['resource', '_id'],
|
|
445
|
-
members: {skip: true, merge: true, path: ['body', 'members']}
|
|
445
|
+
members: { skip: true, merge: true, path: ['body', 'members'] }
|
|
446
446
|
},
|
|
447
447
|
sscan: {
|
|
448
448
|
key: ['resource', '_id'],
|
|
@@ -459,11 +459,11 @@ function initMapping () {
|
|
|
459
459
|
},
|
|
460
460
|
sunionstore: {
|
|
461
461
|
destination: ['body', 'destination'],
|
|
462
|
-
keys: {merge: true, path: ['body', 'keys']}
|
|
462
|
+
keys: { merge: true, path: ['body', 'keys'] }
|
|
463
463
|
},
|
|
464
464
|
time: null,
|
|
465
465
|
touch: {
|
|
466
|
-
keys: {merge: true, path: ['body', 'keys']}
|
|
466
|
+
keys: { merge: true, path: ['body', 'keys'] }
|
|
467
467
|
},
|
|
468
468
|
zadd: null, // handled by extractArgumentsFromRequestForZAdd
|
|
469
469
|
zcount: {
|
|
@@ -490,7 +490,7 @@ function initMapping () {
|
|
|
490
490
|
skip: true,
|
|
491
491
|
merge: true,
|
|
492
492
|
map: val => sanitizeArrayArgument(val),
|
|
493
|
-
path: ['args', 'options']}
|
|
493
|
+
path: ['args', 'options'] }
|
|
494
494
|
},
|
|
495
495
|
zrangebylex: {
|
|
496
496
|
key: ['resource', '_id'],
|
|
@@ -512,7 +512,7 @@ function initMapping () {
|
|
|
512
512
|
},
|
|
513
513
|
zrem: {
|
|
514
514
|
key: ['resource', '_id'],
|
|
515
|
-
members: {merge: true, path: ['body', 'members']}
|
|
515
|
+
members: { merge: true, path: ['body', 'members'] }
|
|
516
516
|
},
|
|
517
517
|
zremrangebylex: {
|
|
518
518
|
key: ['resource', '_id'],
|
|
@@ -610,20 +610,20 @@ function extractArgumentsFromRequest (command, request) {
|
|
|
610
610
|
return extractArgumentsFromRequestForMExecute(request);
|
|
611
611
|
}
|
|
612
612
|
|
|
613
|
-
if (!mapping[command]) {
|
|
613
|
+
if (! mapping[command]) {
|
|
614
614
|
return [];
|
|
615
615
|
}
|
|
616
616
|
|
|
617
|
-
if (!request.input.body) {
|
|
617
|
+
if (! request.input.body) {
|
|
618
618
|
request.input.body = {};
|
|
619
619
|
}
|
|
620
620
|
|
|
621
621
|
Object.keys(mapping[command]).forEach(key => {
|
|
622
622
|
const data = mapping[command][key];
|
|
623
623
|
const path = Array.isArray(data) ? data : data.path;
|
|
624
|
-
const toMerge = !Array.isArray(data) && data.merge === true;
|
|
625
|
-
const map = !Array.isArray(data) && data.map;
|
|
626
|
-
const skip = !Array.isArray(data) && data.skip === true;
|
|
624
|
+
const toMerge = ! Array.isArray(data) && data.merge === true;
|
|
625
|
+
const map = ! Array.isArray(data) && data.map;
|
|
626
|
+
const skip = ! Array.isArray(data) && data.skip === true;
|
|
627
627
|
|
|
628
628
|
let value = path.reduce(
|
|
629
629
|
(previousValue, currentValue, currentIndex, array) => {
|
|
@@ -649,7 +649,8 @@ function extractArgumentsFromRequest (command, request) {
|
|
|
649
649
|
if (value !== undefined) {
|
|
650
650
|
if (toMerge && Array.isArray(value)) {
|
|
651
651
|
args = args.concat(value);
|
|
652
|
-
}
|
|
652
|
+
}
|
|
653
|
+
else {
|
|
653
654
|
args.push(value);
|
|
654
655
|
}
|
|
655
656
|
}
|
|
@@ -769,19 +770,19 @@ function extractArgumentsFromRequestForMExecute (request) {
|
|
|
769
770
|
const actions = request.input.body.actions;
|
|
770
771
|
|
|
771
772
|
return actions.map(command => {
|
|
772
|
-
if (!has(command, 'action')) {
|
|
773
|
+
if (! has(command, 'action')) {
|
|
773
774
|
throw kerror.get('missing_argument', 'action');
|
|
774
775
|
}
|
|
775
|
-
if (!has(command, 'args')) {
|
|
776
|
+
if (! has(command, 'args')) {
|
|
776
777
|
throw kerror.get('missing_argument', 'args');
|
|
777
778
|
}
|
|
778
|
-
if (!isPlainObject(command.args)) {
|
|
779
|
+
if (! isPlainObject(command.args)) {
|
|
779
780
|
throw kerror.get('invalid_type', 'args', 'object');
|
|
780
781
|
}
|
|
781
782
|
if (command.action === 'mexecute') {
|
|
782
783
|
throw kerror.get('forbidden_argument', 'mexecute');
|
|
783
784
|
}
|
|
784
|
-
if (!has(mapping, command.action)) {
|
|
785
|
+
if (! has(mapping, command.action)) {
|
|
785
786
|
throw kerror.get('forbidden_argument', command.action);
|
|
786
787
|
}
|
|
787
788
|
const subRequest = new Request(command.args);
|
|
@@ -832,11 +833,11 @@ function extractArgumentsFromRequestForZAdd (request) {
|
|
|
832
833
|
}
|
|
833
834
|
|
|
834
835
|
request.input.body.elements.forEach((element, index) => {
|
|
835
|
-
if (!isPlainObject(element)) {
|
|
836
|
+
if (! isPlainObject(element)) {
|
|
836
837
|
throw kerror.get('invalid_argument', 'elements', '<array of objects>');
|
|
837
838
|
}
|
|
838
839
|
|
|
839
|
-
if (!element.member) {
|
|
840
|
+
if (! element.member) {
|
|
840
841
|
throw kerror.get('missing_argument', `elements[${index}].member`);
|
|
841
842
|
}
|
|
842
843
|
|
|
@@ -901,7 +902,7 @@ function extractArgumentsFromRequestForZInterstore (request) {
|
|
|
901
902
|
* @param {*} value of the tested parameter
|
|
902
903
|
* @throws
|
|
903
904
|
*/
|
|
904
|
-
function assertFloat(request, name, value) {
|
|
905
|
+
function assertFloat (request, name, value) {
|
|
905
906
|
// Number.parseXxx computes the 1st member of an array if one is provided
|
|
906
907
|
if (Array.isArray(value) || Number.isNaN(Number.parseFloat(value))) {
|
|
907
908
|
throw kerror.get('invalid_type', name, 'number');
|
|
@@ -917,7 +918,7 @@ function assertFloat(request, name, value) {
|
|
|
917
918
|
* @param {*} value of the tested parameter
|
|
918
919
|
* @throws
|
|
919
920
|
*/
|
|
920
|
-
function assertInt(request, name, value) {
|
|
921
|
+
function assertInt (request, name, value) {
|
|
921
922
|
// Number.parseXxx computes the 1st member of an array if one is provided
|
|
922
923
|
if (Array.isArray(value) || Number.isNaN(Number.parseInt(value))) {
|
|
923
924
|
throw kerror.get('invalid_type', name, 'integer');
|