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
|
@@ -67,10 +67,10 @@ class PluginsManager {
|
|
|
67
67
|
this.routes = [];
|
|
68
68
|
|
|
69
69
|
this.pluginsEnabledDir = path.resolve(
|
|
70
|
-
path.join(global.kuzzle.rootPath, "plugins", "enabled")
|
|
70
|
+
path.join(global.kuzzle.rootPath, "plugins", "enabled"),
|
|
71
71
|
);
|
|
72
72
|
this.pluginsAvailableDir = path.resolve(
|
|
73
|
-
path.join(global.kuzzle.rootPath, "plugins", "available")
|
|
73
|
+
path.join(global.kuzzle.rootPath, "plugins", "available"),
|
|
74
74
|
);
|
|
75
75
|
|
|
76
76
|
/**
|
|
@@ -96,7 +96,7 @@ class PluginsManager {
|
|
|
96
96
|
// @deprecated - Warn about the pipeTimeout configuration being obsolete
|
|
97
97
|
if (this.config.common.pipeTimeout) {
|
|
98
98
|
global.kuzzle.log.warn(
|
|
99
|
-
'The configuration "plugins.common.pipeTimeout" has been deprecated and is now unused. It can be safely removed from configuration files'
|
|
99
|
+
'The configuration "plugins.common.pipeTimeout" has been deprecated and is now unused. It can be safely removed from configuration files',
|
|
100
100
|
);
|
|
101
101
|
}
|
|
102
102
|
|
|
@@ -106,11 +106,11 @@ class PluginsManager {
|
|
|
106
106
|
set application(plugin) {
|
|
107
107
|
assert(
|
|
108
108
|
this._plugins.size === 0,
|
|
109
|
-
"The application plugin can only be set before every other plugins are loaded"
|
|
109
|
+
"The application plugin can only be set before every other plugins are loaded",
|
|
110
110
|
);
|
|
111
111
|
assert(
|
|
112
112
|
plugin.application,
|
|
113
|
-
'The application plugin must have the "application" property equals to true'
|
|
113
|
+
'The application plugin must have the "application" property equals to true',
|
|
114
114
|
);
|
|
115
115
|
|
|
116
116
|
this._plugins.set(plugin.name, plugin);
|
|
@@ -118,13 +118,13 @@ class PluginsManager {
|
|
|
118
118
|
|
|
119
119
|
get plugins() {
|
|
120
120
|
return Array.from(this._plugins.values()).filter(
|
|
121
|
-
(plugin) => !plugin.application
|
|
121
|
+
(plugin) => !plugin.application,
|
|
122
122
|
);
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
get application() {
|
|
126
126
|
return Array.from(this._plugins.values()).find(
|
|
127
|
-
(plugin) => plugin.application
|
|
127
|
+
(plugin) => plugin.application,
|
|
128
128
|
);
|
|
129
129
|
}
|
|
130
130
|
|
|
@@ -193,7 +193,7 @@ class PluginsManager {
|
|
|
193
193
|
debug(
|
|
194
194
|
"[%s] reading plugin configuration: %a",
|
|
195
195
|
plugin,
|
|
196
|
-
pluginsDescription[plugin.name]
|
|
196
|
+
pluginsDescription[plugin.name],
|
|
197
197
|
);
|
|
198
198
|
}
|
|
199
199
|
|
|
@@ -212,13 +212,13 @@ class PluginsManager {
|
|
|
212
212
|
|
|
213
213
|
global.kuzzle.on("plugin:hook:loop-error", ({ error, pluginName }) => {
|
|
214
214
|
global.kuzzle.log.error(
|
|
215
|
-
`[${pluginName}] Infinite loop detected on event "hook:onError": ${error}
|
|
215
|
+
`[${pluginName}] Infinite loop detected on event "hook:onError": ${error}`,
|
|
216
216
|
);
|
|
217
217
|
});
|
|
218
218
|
|
|
219
219
|
global.kuzzle.on("hook:onError", ({ error, event, pluginName }) => {
|
|
220
220
|
global.kuzzle.log.error(
|
|
221
|
-
`[${pluginName}] Error executing hook on "${event}": ${error}${error.stack}
|
|
221
|
+
`[${pluginName}] Error executing hook on "${event}": ${error}${error.stack}`,
|
|
222
222
|
);
|
|
223
223
|
});
|
|
224
224
|
|
|
@@ -232,7 +232,7 @@ class PluginsManager {
|
|
|
232
232
|
!CORE_PLUGINS.includes(plugin.name)
|
|
233
233
|
) {
|
|
234
234
|
global.kuzzle.log.info(
|
|
235
|
-
`Failsafe mode activated, skipping plugin "${plugin.name}"
|
|
235
|
+
`Failsafe mode activated, skipping plugin "${plugin.name}"`,
|
|
236
236
|
);
|
|
237
237
|
continue;
|
|
238
238
|
}
|
|
@@ -246,7 +246,7 @@ class PluginsManager {
|
|
|
246
246
|
debug(
|
|
247
247
|
'[%s] starting plugin in "%s" mode',
|
|
248
248
|
plugin.name,
|
|
249
|
-
plugin.config.privileged ? "privileged" : "standard"
|
|
249
|
+
plugin.config.privileged ? "privileged" : "standard",
|
|
250
250
|
);
|
|
251
251
|
|
|
252
252
|
const promise = Bluebird.resolve(
|
|
@@ -256,11 +256,11 @@ class PluginsManager {
|
|
|
256
256
|
} catch (error) {
|
|
257
257
|
throw runtimeError.get("failed_init", plugin.name, error);
|
|
258
258
|
}
|
|
259
|
-
})()
|
|
259
|
+
})(),
|
|
260
260
|
)
|
|
261
261
|
.timeout(
|
|
262
262
|
initTimeout,
|
|
263
|
-
`${plugin.logPrefix} Initialization timed out after ${initTimeout}ms. Try to increase the configuration "plugins.common.initTimeout"
|
|
263
|
+
`${plugin.logPrefix} Initialization timed out after ${initTimeout}ms. Try to increase the configuration "plugins.common.initTimeout".`,
|
|
264
264
|
)
|
|
265
265
|
.then(async () => {
|
|
266
266
|
plugin.initCalled = true;
|
|
@@ -381,7 +381,7 @@ class PluginsManager {
|
|
|
381
381
|
"invalid_method_type",
|
|
382
382
|
errorPrefix,
|
|
383
383
|
methodName,
|
|
384
|
-
strategy.methods[methodName]
|
|
384
|
+
strategy.methods[methodName],
|
|
385
385
|
);
|
|
386
386
|
}
|
|
387
387
|
|
|
@@ -389,10 +389,10 @@ class PluginsManager {
|
|
|
389
389
|
throw strategyError.get(
|
|
390
390
|
"missing_method_function",
|
|
391
391
|
errorPrefix,
|
|
392
|
-
strategy.methods[methodName]
|
|
392
|
+
strategy.methods[methodName],
|
|
393
393
|
);
|
|
394
394
|
}
|
|
395
|
-
}
|
|
395
|
+
},
|
|
396
396
|
);
|
|
397
397
|
|
|
398
398
|
// optional methods check
|
|
@@ -405,7 +405,7 @@ class PluginsManager {
|
|
|
405
405
|
"invalid_method_type",
|
|
406
406
|
errorPrefix,
|
|
407
407
|
name,
|
|
408
|
-
optionalMethodName
|
|
408
|
+
optionalMethodName,
|
|
409
409
|
);
|
|
410
410
|
}
|
|
411
411
|
|
|
@@ -413,7 +413,7 @@ class PluginsManager {
|
|
|
413
413
|
throw strategyError.get(
|
|
414
414
|
"missing_method_function",
|
|
415
415
|
errorPrefix,
|
|
416
|
-
optionalMethodName
|
|
416
|
+
optionalMethodName,
|
|
417
417
|
);
|
|
418
418
|
}
|
|
419
419
|
}
|
|
@@ -427,7 +427,7 @@ class PluginsManager {
|
|
|
427
427
|
throw strategyError.get(
|
|
428
428
|
"invalid_authenticator",
|
|
429
429
|
errorPrefix,
|
|
430
|
-
strategy.config.authenticator
|
|
430
|
+
strategy.config.authenticator,
|
|
431
431
|
);
|
|
432
432
|
} else if (
|
|
433
433
|
!this.authenticators[pluginName] ||
|
|
@@ -436,7 +436,7 @@ class PluginsManager {
|
|
|
436
436
|
throw strategyError.get(
|
|
437
437
|
"unknown_authenticator",
|
|
438
438
|
errorPrefix,
|
|
439
|
-
strategy.config.authenticator
|
|
439
|
+
strategy.config.authenticator,
|
|
440
440
|
);
|
|
441
441
|
}
|
|
442
442
|
|
|
@@ -448,7 +448,7 @@ class PluginsManager {
|
|
|
448
448
|
"invalid_option",
|
|
449
449
|
errorPrefix,
|
|
450
450
|
optionName,
|
|
451
|
-
options
|
|
451
|
+
options,
|
|
452
452
|
);
|
|
453
453
|
}
|
|
454
454
|
}
|
|
@@ -460,7 +460,7 @@ class PluginsManager {
|
|
|
460
460
|
throw strategyError.get(
|
|
461
461
|
"invalid_fields",
|
|
462
462
|
errorPrefix,
|
|
463
|
-
strategy.config.fields
|
|
463
|
+
strategy.config.fields,
|
|
464
464
|
);
|
|
465
465
|
}
|
|
466
466
|
}
|
|
@@ -493,7 +493,7 @@ class PluginsManager {
|
|
|
493
493
|
|
|
494
494
|
if (elapsed > warnDelay) {
|
|
495
495
|
global.kuzzle.log.warn(
|
|
496
|
-
`${plugin.logPrefix} pipe for event '${event}' is slow (${elapsed}ms)
|
|
496
|
+
`${plugin.logPrefix} pipe for event '${event}' is slow (${elapsed}ms)`,
|
|
497
497
|
);
|
|
498
498
|
}
|
|
499
499
|
}
|
|
@@ -522,7 +522,7 @@ class PluginsManager {
|
|
|
522
522
|
cb(
|
|
523
523
|
error instanceof KuzzleError
|
|
524
524
|
? error
|
|
525
|
-
: runtimeError.getFrom(error, "unexpected_error", error.message)
|
|
525
|
+
: runtimeError.getFrom(error, "unexpected_error", error.message),
|
|
526
526
|
);
|
|
527
527
|
}
|
|
528
528
|
};
|
|
@@ -570,7 +570,7 @@ class PluginsManager {
|
|
|
570
570
|
// convert uncaught exception into PluginImplementationError
|
|
571
571
|
// promise rejections
|
|
572
572
|
for (const methodName of Object.keys(strategy.methods).filter(
|
|
573
|
-
(name) => name !== "verify"
|
|
573
|
+
(name) => name !== "verify",
|
|
574
574
|
)) {
|
|
575
575
|
methods[methodName] = async (...args) => {
|
|
576
576
|
try {
|
|
@@ -597,7 +597,7 @@ class PluginsManager {
|
|
|
597
597
|
const verifyAdapter = this.wrapStrategyVerify(
|
|
598
598
|
plugin.logPrefix,
|
|
599
599
|
strategyName,
|
|
600
|
-
plugin.instance[strategy.methods.verify].bind(plugin.instance)
|
|
600
|
+
plugin.instance[strategy.methods.verify].bind(plugin.instance),
|
|
601
601
|
);
|
|
602
602
|
|
|
603
603
|
try {
|
|
@@ -609,7 +609,7 @@ class PluginsManager {
|
|
|
609
609
|
global.kuzzle.passport.use(
|
|
610
610
|
strategyName,
|
|
611
611
|
instance,
|
|
612
|
-
strategy.config.authenticateOptions
|
|
612
|
+
strategy.config.authenticateOptions,
|
|
613
613
|
);
|
|
614
614
|
|
|
615
615
|
if (methods.afterRegister) {
|
|
@@ -620,7 +620,7 @@ class PluginsManager {
|
|
|
620
620
|
e,
|
|
621
621
|
"failed_registration",
|
|
622
622
|
strategyName,
|
|
623
|
-
e.message
|
|
623
|
+
e.message,
|
|
624
624
|
);
|
|
625
625
|
}
|
|
626
626
|
}
|
|
@@ -673,7 +673,7 @@ class PluginsManager {
|
|
|
673
673
|
if (typeof target === "string") {
|
|
674
674
|
// @deprecated - warn about using a string representing an instance method
|
|
675
675
|
plugin.printDeprecation(
|
|
676
|
-
"Defining pipe handler using a string is deprecated. Pass a function instead."
|
|
676
|
+
"Defining pipe handler using a string is deprecated. Pass a function instead.",
|
|
677
677
|
);
|
|
678
678
|
|
|
679
679
|
handler = plugin.instance[target].bind(plugin.instance);
|
|
@@ -717,7 +717,7 @@ class PluginsManager {
|
|
|
717
717
|
// @deprecated - warn about using a string representing an instance method
|
|
718
718
|
if (typeof target === "string") {
|
|
719
719
|
plugin.printDeprecation(
|
|
720
|
-
"Defining hook handler using a string is deprecated. Pass a function instead."
|
|
720
|
+
"Defining hook handler using a string is deprecated. Pass a function instead.",
|
|
721
721
|
);
|
|
722
722
|
|
|
723
723
|
handler = plugin.instance[target].bind(plugin.instance);
|
|
@@ -736,31 +736,31 @@ class PluginsManager {
|
|
|
736
736
|
|
|
737
737
|
async _initApi(plugin) {
|
|
738
738
|
for (const [controller, definition] of Object.entries(
|
|
739
|
-
plugin.instance.api
|
|
739
|
+
plugin.instance.api,
|
|
740
740
|
)) {
|
|
741
741
|
debug(
|
|
742
742
|
"[%s][%s] starting api controller registration",
|
|
743
743
|
plugin.name,
|
|
744
|
-
controller
|
|
744
|
+
controller,
|
|
745
745
|
);
|
|
746
746
|
|
|
747
747
|
if (
|
|
748
748
|
await global.kuzzle.ask(
|
|
749
749
|
"kuzzle:api:funnel:controller:isNative",
|
|
750
|
-
controller
|
|
750
|
+
controller,
|
|
751
751
|
)
|
|
752
752
|
) {
|
|
753
753
|
throw assertionError.get(
|
|
754
754
|
"invalid_controller_definition",
|
|
755
755
|
controller,
|
|
756
|
-
"Native controllers cannot be overriden"
|
|
756
|
+
"Native controllers cannot be overriden",
|
|
757
757
|
);
|
|
758
758
|
}
|
|
759
759
|
|
|
760
760
|
Plugin.checkControllerDefinition(controller, definition);
|
|
761
761
|
|
|
762
762
|
for (const [action, actionDefinition] of Object.entries(
|
|
763
|
-
definition.actions
|
|
763
|
+
definition.actions,
|
|
764
764
|
)) {
|
|
765
765
|
let apiController = this.controllers.get(controller);
|
|
766
766
|
|
|
@@ -788,7 +788,7 @@ class PluginsManager {
|
|
|
788
788
|
if (httpRoutes.length === 0) {
|
|
789
789
|
httpRoutes.push({
|
|
790
790
|
path: `${Inflector.kebabCase(controller)}/${Inflector.kebabCase(
|
|
791
|
-
action
|
|
791
|
+
action,
|
|
792
792
|
)}`,
|
|
793
793
|
verb: "get",
|
|
794
794
|
});
|
|
@@ -799,7 +799,7 @@ class PluginsManager {
|
|
|
799
799
|
'[%s] binding HTTP route "%s" to controller "%s"',
|
|
800
800
|
plugin.name,
|
|
801
801
|
httpRoute.path,
|
|
802
|
-
controller
|
|
802
|
+
controller,
|
|
803
803
|
);
|
|
804
804
|
|
|
805
805
|
const routePath =
|
|
@@ -829,7 +829,7 @@ class PluginsManager {
|
|
|
829
829
|
// @deprecated - warn about using the obsolete "controllers" object
|
|
830
830
|
if (!_.isEmpty(plugin.instance.controllers)) {
|
|
831
831
|
plugin.printDeprecation(
|
|
832
|
-
'Defining controllers using the "controllers" object is deprecated. You should use the "api" object instead.'
|
|
832
|
+
'Defining controllers using the "controllers" object is deprecated. You should use the "api" object instead.',
|
|
833
833
|
);
|
|
834
834
|
}
|
|
835
835
|
|
|
@@ -837,7 +837,7 @@ class PluginsManager {
|
|
|
837
837
|
debug(
|
|
838
838
|
"[%s][%s] starting controller registration",
|
|
839
839
|
plugin.name,
|
|
840
|
-
controller
|
|
840
|
+
controller,
|
|
841
841
|
);
|
|
842
842
|
|
|
843
843
|
const methodsList = getMethods(plugin.instance);
|
|
@@ -850,7 +850,7 @@ class PluginsManager {
|
|
|
850
850
|
throw controllerError.get(
|
|
851
851
|
"invalid_description",
|
|
852
852
|
errorControllerPrefix,
|
|
853
|
-
typeof definition
|
|
853
|
+
typeof definition,
|
|
854
854
|
);
|
|
855
855
|
}
|
|
856
856
|
|
|
@@ -859,7 +859,7 @@ class PluginsManager {
|
|
|
859
859
|
"[%s][%s][%s] starting action controller registration",
|
|
860
860
|
plugin.name,
|
|
861
861
|
controller,
|
|
862
|
-
action
|
|
862
|
+
action,
|
|
863
863
|
);
|
|
864
864
|
|
|
865
865
|
if (
|
|
@@ -876,7 +876,7 @@ class PluginsManager {
|
|
|
876
876
|
errorControllerPrefix,
|
|
877
877
|
controller,
|
|
878
878
|
action,
|
|
879
|
-
suggestion
|
|
879
|
+
suggestion,
|
|
880
880
|
);
|
|
881
881
|
}
|
|
882
882
|
|
|
@@ -892,7 +892,7 @@ class PluginsManager {
|
|
|
892
892
|
} else {
|
|
893
893
|
apiController._addAction(
|
|
894
894
|
action,
|
|
895
|
-
plugin.instance[definition[action]].bind(plugin.instance)
|
|
895
|
+
plugin.instance[definition[action]].bind(plugin.instance),
|
|
896
896
|
);
|
|
897
897
|
}
|
|
898
898
|
}
|
|
@@ -913,14 +913,14 @@ class PluginsManager {
|
|
|
913
913
|
// @deprecated - warn about using the obsolete "routes" object
|
|
914
914
|
if (!_.isEmpty(plugin.instance.routes)) {
|
|
915
915
|
plugin.printDeprecation(
|
|
916
|
-
'Defining routes using the "routes" object is deprecated. You should use the "api" object instead.'
|
|
916
|
+
'Defining routes using the "routes" object is deprecated. You should use the "api" object instead.',
|
|
917
917
|
);
|
|
918
918
|
}
|
|
919
919
|
|
|
920
920
|
for (const route of plugin.instance.routes || []) {
|
|
921
921
|
const controller = `${plugin.name}/${route.controller}`;
|
|
922
922
|
const errorRoutePrefix = `Unable to inject API route "${JSON.stringify(
|
|
923
|
-
route
|
|
923
|
+
route,
|
|
924
924
|
)}" from plugin "${plugin.name}":`;
|
|
925
925
|
|
|
926
926
|
for (const key of Object.keys(route)) {
|
|
@@ -929,7 +929,7 @@ class PluginsManager {
|
|
|
929
929
|
"unexpected_route_property",
|
|
930
930
|
errorRoutePrefix,
|
|
931
931
|
key,
|
|
932
|
-
didYouMean(key, routeProperties)
|
|
932
|
+
didYouMean(key, routeProperties),
|
|
933
933
|
);
|
|
934
934
|
}
|
|
935
935
|
|
|
@@ -940,7 +940,7 @@ class PluginsManager {
|
|
|
940
940
|
throw controllerError.get(
|
|
941
941
|
"invalid_route_property",
|
|
942
942
|
errorRoutePrefix,
|
|
943
|
-
key
|
|
943
|
+
key,
|
|
944
944
|
);
|
|
945
945
|
}
|
|
946
946
|
}
|
|
@@ -952,7 +952,7 @@ class PluginsManager {
|
|
|
952
952
|
"undefined_controller",
|
|
953
953
|
errorRoutePrefix,
|
|
954
954
|
route.controller,
|
|
955
|
-
didYouMean(route.controller, controllerNames)
|
|
955
|
+
didYouMean(route.controller, controllerNames),
|
|
956
956
|
);
|
|
957
957
|
}
|
|
958
958
|
|
|
@@ -962,7 +962,7 @@ class PluginsManager {
|
|
|
962
962
|
"undefined_action",
|
|
963
963
|
errorRoutePrefix,
|
|
964
964
|
route.action,
|
|
965
|
-
didYouMean(route.action, actionNames)
|
|
965
|
+
didYouMean(route.action, actionNames),
|
|
966
966
|
);
|
|
967
967
|
}
|
|
968
968
|
|
|
@@ -971,14 +971,14 @@ class PluginsManager {
|
|
|
971
971
|
"unsupported_verb",
|
|
972
972
|
errorRoutePrefix,
|
|
973
973
|
httpVerbs.join(", "),
|
|
974
|
-
didYouMean(route.verb, httpVerbs)
|
|
974
|
+
didYouMean(route.verb, httpVerbs),
|
|
975
975
|
);
|
|
976
976
|
}
|
|
977
977
|
|
|
978
978
|
// @deprecated route.url is deprecated
|
|
979
979
|
if (route.url) {
|
|
980
980
|
plugin.printDeprecation(
|
|
981
|
-
'Usage of "url" property for routes is deprecated. Use "path" instead.'
|
|
981
|
+
'Usage of "url" property for routes is deprecated. Use "path" instead.',
|
|
982
982
|
);
|
|
983
983
|
}
|
|
984
984
|
route.path = route.path || route.url;
|
|
@@ -987,7 +987,7 @@ class PluginsManager {
|
|
|
987
987
|
'[%s] binding HTTP route "%s" to controller "%s"',
|
|
988
988
|
plugin.name,
|
|
989
989
|
route.path,
|
|
990
|
-
route.controller
|
|
990
|
+
route.controller,
|
|
991
991
|
);
|
|
992
992
|
|
|
993
993
|
// @deprecated "/_plugin" prefix is deprecated for plugin routes
|
|
@@ -1028,7 +1028,7 @@ class PluginsManager {
|
|
|
1028
1028
|
this.registerStrategy(
|
|
1029
1029
|
plugin.name,
|
|
1030
1030
|
name,
|
|
1031
|
-
plugin.instance.strategies[name]
|
|
1031
|
+
plugin.instance.strategies[name],
|
|
1032
1032
|
);
|
|
1033
1033
|
}
|
|
1034
1034
|
}
|
|
@@ -1043,7 +1043,7 @@ class PluginsManager {
|
|
|
1043
1043
|
"plugin",
|
|
1044
1044
|
"authenticators",
|
|
1045
1045
|
"not_an_object",
|
|
1046
|
-
plugin.logPrefix
|
|
1046
|
+
plugin.logPrefix,
|
|
1047
1047
|
);
|
|
1048
1048
|
}
|
|
1049
1049
|
|
|
@@ -1054,14 +1054,14 @@ class PluginsManager {
|
|
|
1054
1054
|
"authenticators",
|
|
1055
1055
|
"invalid_authenticator",
|
|
1056
1056
|
plugin.logPrefix,
|
|
1057
|
-
authenticator
|
|
1057
|
+
authenticator,
|
|
1058
1058
|
);
|
|
1059
1059
|
}
|
|
1060
1060
|
}
|
|
1061
1061
|
|
|
1062
1062
|
this.authenticators[plugin.name] = Object.assign(
|
|
1063
1063
|
{},
|
|
1064
|
-
plugin.instance.authenticators
|
|
1064
|
+
plugin.instance.authenticators,
|
|
1065
1065
|
);
|
|
1066
1066
|
}
|
|
1067
1067
|
|
|
@@ -1075,7 +1075,7 @@ class PluginsManager {
|
|
|
1075
1075
|
|
|
1076
1076
|
// first load plugins from Backend.plugin.use
|
|
1077
1077
|
for (const [name, { plugin: instance, options }] of Object.entries(
|
|
1078
|
-
plugins
|
|
1078
|
+
plugins,
|
|
1079
1079
|
)) {
|
|
1080
1080
|
const plugin = new Plugin(instance, { name, ...options });
|
|
1081
1081
|
|
|
@@ -1108,7 +1108,7 @@ class PluginsManager {
|
|
|
1108
1108
|
throw assertionError.get(
|
|
1109
1109
|
"invalid_plugins_dir",
|
|
1110
1110
|
this.pluginsEnabledDir,
|
|
1111
|
-
e.message
|
|
1111
|
+
e.message,
|
|
1112
1112
|
);
|
|
1113
1113
|
}
|
|
1114
1114
|
|
|
@@ -1175,7 +1175,7 @@ class PluginsManager {
|
|
|
1175
1175
|
try {
|
|
1176
1176
|
const user = await global.kuzzle.ask(
|
|
1177
1177
|
"core:security:user:get",
|
|
1178
|
-
result.kuid
|
|
1178
|
+
result.kuid,
|
|
1179
1179
|
);
|
|
1180
1180
|
|
|
1181
1181
|
callback(null, user);
|
|
@@ -1226,11 +1226,11 @@ function getMethods(object) {
|
|
|
1226
1226
|
const prototype = Object.getPrototypeOf(object);
|
|
1227
1227
|
|
|
1228
1228
|
const instanceMethods = Object.getOwnPropertyNames(prototype).filter(
|
|
1229
|
-
(method) => ["init", "constructor"].indexOf(method) === -1
|
|
1229
|
+
(method) => ["init", "constructor"].indexOf(method) === -1,
|
|
1230
1230
|
);
|
|
1231
1231
|
|
|
1232
1232
|
const objectMethods = Object.getOwnPropertyNames(object).filter(
|
|
1233
|
-
(key) => typeof object[key] === "function"
|
|
1233
|
+
(key) => typeof object[key] === "function",
|
|
1234
1234
|
);
|
|
1235
1235
|
|
|
1236
1236
|
return [...instanceMethods, ...objectMethods];
|
|
@@ -70,7 +70,7 @@ class NotifierController {
|
|
|
70
70
|
"core:realtime:document:dispatch",
|
|
71
71
|
(rooms, notification, opts) => {
|
|
72
72
|
return this._notifyDocument(rooms, notification, opts);
|
|
73
|
-
}
|
|
73
|
+
},
|
|
74
74
|
);
|
|
75
75
|
|
|
76
76
|
/**
|
|
@@ -84,7 +84,7 @@ class NotifierController {
|
|
|
84
84
|
"core:realtime:user:sendMessage",
|
|
85
85
|
(room, notification, opts) => {
|
|
86
86
|
return this._notifyUser(room, notification, opts);
|
|
87
|
-
}
|
|
87
|
+
},
|
|
88
88
|
);
|
|
89
89
|
|
|
90
90
|
/**
|
|
@@ -95,7 +95,7 @@ class NotifierController {
|
|
|
95
95
|
*/
|
|
96
96
|
global.kuzzle.onAsk(
|
|
97
97
|
"core:realtime:document:mNotify",
|
|
98
|
-
(request, action, docs) => this.notifyDocuments(request, action, docs)
|
|
98
|
+
(request, action, docs) => this.notifyDocuments(request, action, docs),
|
|
99
99
|
);
|
|
100
100
|
|
|
101
101
|
/**
|
|
@@ -106,7 +106,7 @@ class NotifierController {
|
|
|
106
106
|
*/
|
|
107
107
|
global.kuzzle.onAsk(
|
|
108
108
|
"core:realtime:document:notify",
|
|
109
|
-
(request, action, doc) => this.notifyDocuments(request, action, [doc])
|
|
109
|
+
(request, action, doc) => this.notifyDocuments(request, action, [doc]),
|
|
110
110
|
);
|
|
111
111
|
|
|
112
112
|
/**
|
|
@@ -114,7 +114,7 @@ class NotifierController {
|
|
|
114
114
|
* @param {string} connectionId
|
|
115
115
|
*/
|
|
116
116
|
global.kuzzle.onAsk("core:realtime:tokenExpired:notify", (connectionId) =>
|
|
117
|
-
this.notifyTokenExpired(connectionId)
|
|
117
|
+
this.notifyTokenExpired(connectionId),
|
|
118
118
|
);
|
|
119
119
|
|
|
120
120
|
/**
|
|
@@ -122,7 +122,7 @@ class NotifierController {
|
|
|
122
122
|
* @param {Request} request
|
|
123
123
|
*/
|
|
124
124
|
global.kuzzle.onAsk("core:realtime:publish", (request) =>
|
|
125
|
-
this.publish(request)
|
|
125
|
+
this.publish(request),
|
|
126
126
|
);
|
|
127
127
|
}
|
|
128
128
|
|
|
@@ -146,7 +146,7 @@ class NotifierController {
|
|
|
146
146
|
request,
|
|
147
147
|
scope,
|
|
148
148
|
action,
|
|
149
|
-
content
|
|
149
|
+
content,
|
|
150
150
|
);
|
|
151
151
|
|
|
152
152
|
global.kuzzle.emit("core:notify:document", {
|
|
@@ -194,7 +194,7 @@ class NotifierController {
|
|
|
194
194
|
"notify:server",
|
|
195
195
|
[KUZZLE_NOTIFICATION_CHANNEL], // Sending notification on Kuzzle notification channel
|
|
196
196
|
new ServerNotification("TokenExpired", "Authentication Token Expired"),
|
|
197
|
-
connectionId
|
|
197
|
+
connectionId,
|
|
198
198
|
);
|
|
199
199
|
|
|
200
200
|
await this.module.hotelClerk.removeConnection(connectionId);
|
|
@@ -259,7 +259,7 @@ class NotifierController {
|
|
|
259
259
|
request,
|
|
260
260
|
"out",
|
|
261
261
|
"replace",
|
|
262
|
-
document
|
|
262
|
+
document,
|
|
263
263
|
);
|
|
264
264
|
}
|
|
265
265
|
|
|
@@ -321,7 +321,7 @@ class NotifierController {
|
|
|
321
321
|
"core",
|
|
322
322
|
"fatal",
|
|
323
323
|
"assertion_failed",
|
|
324
|
-
`unknown notify action "${doc.action}"
|
|
324
|
+
`unknown notify action "${doc.action}"`,
|
|
325
325
|
);
|
|
326
326
|
}
|
|
327
327
|
});
|
|
@@ -334,7 +334,7 @@ class NotifierController {
|
|
|
334
334
|
"core:cache:internal:store",
|
|
335
335
|
cacheIds[index],
|
|
336
336
|
JSON.stringify(rooms),
|
|
337
|
-
{ ttl: this.ttl }
|
|
337
|
+
{ ttl: this.ttl },
|
|
338
338
|
);
|
|
339
339
|
}
|
|
340
340
|
|
|
@@ -369,7 +369,7 @@ class NotifierController {
|
|
|
369
369
|
request,
|
|
370
370
|
"out",
|
|
371
371
|
"update",
|
|
372
|
-
document
|
|
372
|
+
document,
|
|
373
373
|
);
|
|
374
374
|
}
|
|
375
375
|
|
|
@@ -419,7 +419,7 @@ class NotifierController {
|
|
|
419
419
|
channels: channels,
|
|
420
420
|
connectionId: connectionId,
|
|
421
421
|
notification: updated,
|
|
422
|
-
}
|
|
422
|
+
},
|
|
423
423
|
);
|
|
424
424
|
|
|
425
425
|
const action = updatedInfo.connectionId ? "notify" : "broadcast";
|
|
@@ -526,7 +526,7 @@ class NotifierController {
|
|
|
526
526
|
request.input.args.index,
|
|
527
527
|
request.input.args.collection,
|
|
528
528
|
source || request.input.body || {},
|
|
529
|
-
id || request.input.args._id
|
|
529
|
+
id || request.input.args._id,
|
|
530
530
|
);
|
|
531
531
|
}
|
|
532
532
|
}
|