kuzzle 2.27.0 → 2.27.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/README.md +12 -6
  2. package/lib/api/controllers/adminController.js +9 -9
  3. package/lib/api/controllers/bulkController.js +9 -9
  4. package/lib/api/controllers/collectionController.js +17 -17
  5. package/lib/api/controllers/documentController.js +51 -51
  6. package/lib/api/controllers/indexController.js +4 -4
  7. package/lib/api/controllers/memoryStorageController.js +11 -11
  8. package/lib/api/controllers/realtimeController.js +1 -1
  9. package/lib/api/controllers/securityController.js +67 -70
  10. package/lib/api/controllers/serverController.js +5 -5
  11. package/lib/api/documentExtractor.js +3 -3
  12. package/lib/api/funnel.js +43 -43
  13. package/lib/api/rateLimiter.js +1 -1
  14. package/lib/cluster/command.js +4 -4
  15. package/lib/cluster/idCardHandler.js +1 -1
  16. package/lib/cluster/node.js +55 -55
  17. package/lib/cluster/subscriber.js +33 -33
  18. package/lib/cluster/workers/IDCardRenewer.js +4 -4
  19. package/lib/config/index.js +24 -24
  20. package/lib/core/auth/passportWrapper.js +6 -6
  21. package/lib/core/cache/cacheEngine.js +20 -20
  22. package/lib/core/network/accessLogger.js +15 -15
  23. package/lib/core/network/entryPoint.js +12 -12
  24. package/lib/core/network/httpRouter/index.js +4 -4
  25. package/lib/core/network/httpRouter/routePart.js +2 -2
  26. package/lib/core/network/protocols/httpwsProtocol.js +60 -53
  27. package/lib/core/network/protocols/internalProtocol.js +2 -2
  28. package/lib/core/network/protocols/mqttProtocol.js +9 -9
  29. package/lib/core/network/protocols/protocol.js +3 -3
  30. package/lib/core/network/router.js +7 -7
  31. package/lib/core/plugin/plugin.js +23 -23
  32. package/lib/core/plugin/pluginManifest.js +1 -1
  33. package/lib/core/plugin/pluginsManager.js +62 -62
  34. package/lib/core/realtime/notifier.js +14 -14
  35. package/lib/core/security/README.md +223 -0
  36. package/lib/core/security/roleRepository.js +18 -18
  37. package/lib/core/security/securityLoader.js +7 -7
  38. package/lib/core/security/userRepository.js +16 -16
  39. package/lib/core/shared/README.md +3 -0
  40. package/lib/core/shared/abstractManifest.js +1 -1
  41. package/lib/core/shared/sdk/impersonatedSdk.js +1 -1
  42. package/lib/core/shared/store.js +11 -11
  43. package/lib/core/statistics/statistics.js +15 -15
  44. package/lib/core/storage/clientAdapter.js +61 -61
  45. package/lib/core/validation/baseType.js +1 -1
  46. package/lib/core/validation/types/date.js +1 -1
  47. package/lib/core/validation/types/enum.js +5 -5
  48. package/lib/core/validation/types/geoShape.js +13 -13
  49. package/lib/core/validation/types/numeric.js +2 -2
  50. package/lib/core/validation/types/string.js +2 -2
  51. package/lib/core/validation/validation.js +71 -71
  52. package/lib/kerror/codes/index.js +23 -23
  53. package/lib/kuzzle/dumpGenerator.js +17 -17
  54. package/lib/kuzzle/event/kuzzleEventEmitter.js +9 -9
  55. package/lib/kuzzle/event/pipeRunner.js +2 -2
  56. package/lib/kuzzle/internalIndexHandler.js +8 -8
  57. package/lib/kuzzle/log.js +2 -2
  58. package/lib/kuzzle/vault.js +4 -4
  59. package/lib/model/security/role.js +3 -1
  60. package/lib/model/security/user.js +3 -1
  61. package/lib/model/storage/apiKey.js +3 -3
  62. package/lib/model/storage/baseModel.js +7 -7
  63. package/lib/service/cache/redis.js +3 -3
  64. package/lib/service/storage/elasticsearch.js +53 -54
  65. package/lib/service/storage/esWrapper.js +3 -3
  66. package/lib/service/storage/queryTranslator.js +2 -2
  67. package/lib/util/assertType.js +1 -1
  68. package/lib/util/deprecate.js +3 -3
  69. package/lib/util/extractFields.js +2 -2
  70. package/lib/util/wildcard.js +1 -1
  71. package/package.json +68 -81
@@ -41,7 +41,7 @@ const HTTP_VERBS = ["get", "head", "post", "put", "delete", "patch", "options"];
41
41
  class Plugin {
42
42
  constructor(
43
43
  instance,
44
- { name, application = false, deprecationWarning = true } = {}
44
+ { name, application = false, deprecationWarning = true } = {},
45
45
  ) {
46
46
  this._instance = instance;
47
47
 
@@ -65,7 +65,7 @@ class Plugin {
65
65
 
66
66
  if (global.kuzzle.config.plugins[this.name]) {
67
67
  this.config = JSON.parse(
68
- JSON.stringify(global.kuzzle.config.plugins[this.name])
68
+ JSON.stringify(global.kuzzle.config.plugins[this.name]),
69
69
  );
70
70
  }
71
71
 
@@ -83,7 +83,7 @@ class Plugin {
83
83
  if (
84
84
  !semver.satisfies(
85
85
  global.kuzzle.config.version,
86
- this.manifest.kuzzleVersion
86
+ this.manifest.kuzzleVersion,
87
87
  )
88
88
  ) {
89
89
  throw kerror.get(
@@ -92,7 +92,7 @@ class Plugin {
92
92
  "version_mismatch",
93
93
  this.name,
94
94
  global.kuzzle.config.version,
95
- this.manifest.kuzzleVersion
95
+ this.manifest.kuzzleVersion,
96
96
  );
97
97
  }
98
98
  }
@@ -141,7 +141,7 @@ class Plugin {
141
141
 
142
142
  if (has(this.instance, "controllers")) {
143
143
  description.controllers = Object.keys(this.instance.controllers).map(
144
- (controller) => `${this.name}/${controller}`
144
+ (controller) => `${this.name}/${controller}`,
145
145
  );
146
146
  }
147
147
 
@@ -207,7 +207,7 @@ class Plugin {
207
207
  set name(name) {
208
208
  if (!this.constructor.checkName(name)) {
209
209
  this.printDeprecation(
210
- "Plugin names should be in kebab-case. This behavior will be enforced in futur versions of Kuzzle."
210
+ "Plugin names should be in kebab-case. This behavior will be enforced in futur versions of Kuzzle.",
211
211
  );
212
212
  }
213
213
 
@@ -268,7 +268,7 @@ class Plugin {
268
268
  errorCodes.loadPluginsErrors(plugin.manifest.raw, pluginCode);
269
269
 
270
270
  global.kuzzle.log.info(
271
- `${plugin.logPrefix} Custom errors successfully loaded.`
271
+ `${plugin.logPrefix} Custom errors successfully loaded.`,
272
272
  );
273
273
  } catch (err) {
274
274
  if (
@@ -281,7 +281,7 @@ class Plugin {
281
281
  "manifest",
282
282
  "invalid_errors",
283
283
  plugin.manifest.name,
284
- err.message
284
+ err.message,
285
285
  );
286
286
  }
287
287
 
@@ -304,12 +304,12 @@ class Plugin {
304
304
  static checkControllerDefinition(
305
305
  name,
306
306
  definition,
307
- { application = false } = {}
307
+ { application = false } = {},
308
308
  ) {
309
309
  if (typeof name !== "string") {
310
310
  throw assertionError.get(
311
311
  "invalid_controller_definition",
312
- "Controller name must be a string"
312
+ "Controller name must be a string",
313
313
  );
314
314
  }
315
315
 
@@ -317,7 +317,7 @@ class Plugin {
317
317
  throw assertionError.get(
318
318
  "invalid_controller_definition",
319
319
  name,
320
- "Controller definition must be an object"
320
+ "Controller definition must be an object",
321
321
  );
322
322
  }
323
323
 
@@ -325,12 +325,12 @@ class Plugin {
325
325
  throw assertionError.get(
326
326
  "invalid_controller_definition",
327
327
  name,
328
- 'Controller definition "actions" property must be an object'
328
+ 'Controller definition "actions" property must be an object',
329
329
  );
330
330
  }
331
331
 
332
332
  for (const [action, actionDefinition] of Object.entries(
333
- definition.actions
333
+ definition.actions,
334
334
  )) {
335
335
  const actionProperties = Object.keys(actionDefinition);
336
336
 
@@ -342,8 +342,8 @@ class Plugin {
342
342
  "invalid_controller_definition",
343
343
  name,
344
344
  `action "${action}" has invalid properties: ${actionProperties.join(
345
- ", "
346
- )}`
345
+ ", ",
346
+ )}`,
347
347
  );
348
348
  }
349
349
 
@@ -351,7 +351,7 @@ class Plugin {
351
351
  throw assertionError.get(
352
352
  "invalid_controller_definition",
353
353
  name,
354
- "action names must be strings"
354
+ "action names must be strings",
355
355
  );
356
356
  }
357
357
 
@@ -359,7 +359,7 @@ class Plugin {
359
359
  throw assertionError.get(
360
360
  "invalid_controller_definition",
361
361
  name,
362
- `action "${action}" handler must be a function`
362
+ `action "${action}" handler must be a function`,
363
363
  );
364
364
  }
365
365
 
@@ -368,7 +368,7 @@ class Plugin {
368
368
  throw assertionError.get(
369
369
  "invalid_controller_definition",
370
370
  name,
371
- `action "${action}" http definition must be an array`
371
+ `action "${action}" http definition must be an array`,
372
372
  );
373
373
  }
374
374
 
@@ -377,7 +377,7 @@ class Plugin {
377
377
  throw assertionError.get(
378
378
  "invalid_controller_definition",
379
379
  name,
380
- `action "${action}" http "verb" property must be a non-empty string`
380
+ `action "${action}" http "verb" property must be a non-empty string`,
381
381
  );
382
382
  }
383
383
 
@@ -385,7 +385,7 @@ class Plugin {
385
385
  throw assertionError.get(
386
386
  "invalid_controller_definition",
387
387
  name,
388
- `action "${action}" http verb "${route.verb}" is not a valid http verb`
388
+ `action "${action}" http verb "${route.verb}" is not a valid http verb`,
389
389
  );
390
390
  }
391
391
 
@@ -402,8 +402,8 @@ class Plugin {
402
402
  "invalid_controller_definition",
403
403
  name,
404
404
  `action "${action}" has invalid http properties: ${routeProperties.join(
405
- ", "
406
- )}`
405
+ ", ",
406
+ )}`,
407
407
  );
408
408
  }
409
409
  }
@@ -421,7 +421,7 @@ function checkHttpRouteProperties(route, action, name, application) {
421
421
  throw assertionError.get(
422
422
  "invalid_controller_definition",
423
423
  name,
424
- `action "${action}" http "path" property must be a non-empty string`
424
+ `action "${action}" http "path" property must be a non-empty string`,
425
425
  );
426
426
  }
427
427
  }
@@ -45,7 +45,7 @@ class PluginManifest extends AbstractManifest {
45
45
  throw kerror.get(
46
46
  "invalid_privileged",
47
47
  this.path,
48
- typeof this.raw.privileged
48
+ typeof this.raw.privileged,
49
49
  );
50
50
  }
51
51
  this.privileged = this.raw.privileged;
@@ -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];