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.
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 +41 -41
  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 +52 -52
  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 +69 -81
@@ -66,10 +66,10 @@ const JSON_ENDER = '"}';
66
66
  // Pre-computed messages & errors
67
67
  const WS_FORCED_TERMINATION_CODE = 1011;
68
68
  const WS_BACKPRESSURE_MESSAGE = Buffer.from(
69
- "too much backpressure: client is too slow"
69
+ "too much backpressure: client is too slow",
70
70
  );
71
71
  const WS_GENERIC_CLOSE_MESSAGE = Buffer.from(
72
- "Connection closed by remote host"
72
+ "Connection closed by remote host",
73
73
  );
74
74
  const WS_RATE_LIMIT_EXCEEDED_ERROR = kerrorWS.get("ratelimit_exceeded");
75
75
  const HTTP_REQUEST_TOO_LARGE_ERROR = kerrorHTTP.get("request_too_large");
@@ -84,7 +84,7 @@ const HTTP_ALLOWED_CONTENT_TYPES = [
84
84
  const HTTP_SKIPPED_HEADERS = ["content-length", "set-cookie"];
85
85
  const HTTP_HEADER_CONNECTION = Buffer.from("Connection");
86
86
  const HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN = Buffer.from(
87
- "Access-Control-Allow-Origin"
87
+ "Access-Control-Allow-Origin",
88
88
  );
89
89
  const HTTP_HEADER_SET_COOKIE = Buffer.from("Set-Cookie");
90
90
  const HTTP_HEADER_VARY = Buffer.from("Vary");
@@ -148,7 +148,7 @@ class HttpWsProtocol extends Protocol {
148
148
  this.server.listen(entrypoint.config.port, (socket) => {
149
149
  if (!socket) {
150
150
  throw new Error(
151
- `[http/websocket] fatal: unable to listen to port ${entrypoint.config.port}`
151
+ `[http/websocket] fatal: unable to listen to port ${entrypoint.config.port}`,
152
152
  );
153
153
  }
154
154
  });
@@ -204,7 +204,7 @@ class HttpWsProtocol extends Protocol {
204
204
  debugWS(
205
205
  'Publishing to channel "realtime/%s": %s',
206
206
  channel,
207
- payloadSafeCopy
207
+ payloadSafeCopy,
208
208
  );
209
209
  this.server.publish(`realtime/${channel}`, payloadSafeCopy, false);
210
210
  }
@@ -236,7 +236,7 @@ class HttpWsProtocol extends Protocol {
236
236
  debugWS(
237
237
  'Subscribing connection ID "%s" to channel "realtime/%s"',
238
238
  connectionId,
239
- channel
239
+ channel,
240
240
  );
241
241
  socket.subscribe(`realtime/${channel}`);
242
242
  }
@@ -251,7 +251,7 @@ class HttpWsProtocol extends Protocol {
251
251
  debugWS(
252
252
  'Removing connection ID "%s" from channel "realtime/%s"',
253
253
  connectionId,
254
- channel
254
+ channel,
255
255
  );
256
256
 
257
257
  socket.unsubscribe(`realtime/${channel}`);
@@ -268,7 +268,7 @@ class HttpWsProtocol extends Protocol {
268
268
 
269
269
  socket.end(
270
270
  WS_FORCED_TERMINATION_CODE,
271
- message ? Buffer.from(message) : WS_GENERIC_CLOSE_MESSAGE
271
+ message ? Buffer.from(message) : WS_GENERIC_CLOSE_MESSAGE,
272
272
  );
273
273
  }
274
274
 
@@ -287,7 +287,7 @@ class HttpWsProtocol extends Protocol {
287
287
  req.getHeader("sec-websocket-key"),
288
288
  req.getHeader("sec-websocket-protocol"),
289
289
  req.getHeader("sec-websocket-extensions"),
290
- context
290
+ context,
291
291
  );
292
292
  }
293
293
 
@@ -297,7 +297,7 @@ class HttpWsProtocol extends Protocol {
297
297
  this.name,
298
298
  [ip],
299
299
  socket.headers,
300
- socket.internal
300
+ socket.internal,
301
301
  );
302
302
 
303
303
  this.entryPoint.newConnection(connection);
@@ -318,7 +318,7 @@ class HttpWsProtocol extends Protocol {
318
318
  "[%s] received a `close` event (CODE: %d, REASON: %s)",
319
319
  connection.id,
320
320
  code,
321
- Buffer.from(message || "").toString()
321
+ Buffer.from(message || "").toString(),
322
322
  );
323
323
  }
324
324
  this.entryPoint.removeConnection(connection.id);
@@ -356,13 +356,13 @@ class HttpWsProtocol extends Protocol {
356
356
 
357
357
  ({ payload: message } = await global.kuzzle.pipe(
358
358
  "protocol:websocket:beforeParsingPayload",
359
- { connection, payload: message }
359
+ { connection, payload: message },
360
360
  ));
361
361
 
362
362
  try {
363
363
  ({ payload: parsed } = await global.kuzzle.pipe(
364
364
  "protocol:websocket:afterParsingPayload",
365
- { connection, payload: JSON.parse(message) }
365
+ { connection, payload: JSON.parse(message) },
366
366
  ));
367
367
  } catch (e) {
368
368
  /*
@@ -375,7 +375,7 @@ class HttpWsProtocol extends Protocol {
375
375
  this.wsSendError(
376
376
  socket,
377
377
  connection,
378
- kerrorWS.getFrom(e, "unexpected_error", e.message)
378
+ kerrorWS.getFrom(e, "unexpected_error", e.message),
379
379
  );
380
380
  return;
381
381
  }
@@ -487,7 +487,7 @@ class HttpWsProtocol extends Protocol {
487
487
  const connection = new ClientConnection(
488
488
  "HTTP/1.1",
489
489
  getHttpIps(response, request),
490
- request.headers
490
+ request.headers,
491
491
  );
492
492
  const message = new HttpMessage(connection, request);
493
493
 
@@ -509,13 +509,13 @@ class HttpWsProtocol extends Protocol {
509
509
 
510
510
  if (
511
511
  !this.httpConfig.opts.allowedContentTypes.some(
512
- (allowed) => contentType === allowed
512
+ (allowed) => contentType === allowed,
513
513
  )
514
514
  ) {
515
515
  this.httpSendError(
516
516
  message,
517
517
  response,
518
- kerrorHTTP.get("unsupported_content", contentType)
518
+ kerrorHTTP.get("unsupported_content", contentType),
519
519
  );
520
520
  return;
521
521
  }
@@ -527,7 +527,7 @@ class HttpWsProtocol extends Protocol {
527
527
  this.httpSendError(
528
528
  message,
529
529
  response,
530
- kerrorHTTP.get("unsupported_charset", encoding[1].toLowerCase())
530
+ kerrorHTTP.get("unsupported_charset", encoding[1].toLowerCase()),
531
531
  );
532
532
  return;
533
533
  }
@@ -591,7 +591,7 @@ class HttpWsProtocol extends Protocol {
591
591
 
592
592
  const { payload: newPayload } = await global.kuzzle.pipe(
593
593
  "protocol:http:beforeParsingPayload",
594
- { message, payload: inflated }
594
+ { message, payload: inflated },
595
595
  );
596
596
  await this.httpParseContent(message, newPayload, cb);
597
597
  resolve();
@@ -641,12 +641,12 @@ class HttpWsProtocol extends Protocol {
641
641
  try {
642
642
  const { payload } = await global.kuzzle.pipe(
643
643
  "protocol:http:afterParsingPayload",
644
- { message, payload: JSON.parse(content.toString()) }
644
+ { message, payload: JSON.parse(content.toString()) },
645
645
  );
646
646
  message.content = payload;
647
647
  } catch (e) {
648
648
  cb(
649
- kerrorHTTP.get("body_parse_failed", content.toString().slice(0, 50))
649
+ kerrorHTTP.get("body_parse_failed", content.toString().slice(0, 50)),
650
650
  );
651
651
  return;
652
652
  }
@@ -693,7 +693,7 @@ class HttpWsProtocol extends Protocol {
693
693
 
694
694
  const [success] = response.tryEnd(
695
695
  result.compressed,
696
- result.compressed.length
696
+ result.compressed.length,
697
697
  );
698
698
 
699
699
  if (!success) {
@@ -701,7 +701,7 @@ class HttpWsProtocol extends Protocol {
701
701
  const retryData = result.compressed.subarray(offset);
702
702
  const [retrySuccess] = response.tryEnd(
703
703
  retryData,
704
- retryData.length
704
+ retryData.length,
705
705
  );
706
706
 
707
707
  return retrySuccess;
@@ -739,7 +739,7 @@ class HttpWsProtocol extends Protocol {
739
739
  ) {
740
740
  response.writeHeader(
741
741
  HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN,
742
- Buffer.from(message.headers.origin)
742
+ Buffer.from(message.headers.origin),
743
743
  );
744
744
 
745
745
  response.writeHeader(HTTP_HEADER_VARY, ORIGIN);
@@ -780,8 +780,8 @@ class HttpWsProtocol extends Protocol {
780
780
  "network",
781
781
  "http",
782
782
  "stream_errored",
783
- httpStream.error.message
784
- )
783
+ httpStream.error.message,
784
+ ),
785
785
  );
786
786
  return;
787
787
  }
@@ -790,7 +790,7 @@ class HttpWsProtocol extends Protocol {
790
790
  this.httpSendError(
791
791
  message,
792
792
  response,
793
- kerror.get("network", "http", "stream_closed")
793
+ kerror.get("network", "http", "stream_closed"),
794
794
  );
795
795
  return;
796
796
  }
@@ -807,7 +807,7 @@ class HttpWsProtocol extends Protocol {
807
807
  // Make a copy of the array buffer
808
808
  const arrayBuffer = chunk.buffer.slice(
809
809
  chunk.byteOffset,
810
- chunk.byteOffset + chunk.byteLength
810
+ chunk.byteOffset + chunk.byteLength,
811
811
  );
812
812
 
813
813
  const arrayBufferOffset = response.getWriteOffset();
@@ -822,7 +822,7 @@ class HttpWsProtocol extends Protocol {
822
822
  if (streamSizeFixed) {
823
823
  const [success, done] = response.tryEnd(
824
824
  arrayBuffer,
825
- httpStream.totalBytes
825
+ httpStream.totalBytes,
826
826
  );
827
827
  backpressure = !success;
828
828
 
@@ -854,13 +854,13 @@ class HttpWsProtocol extends Protocol {
854
854
 
855
855
  let retryBackpressure = false;
856
856
  const remainingChunkData = response.arrayBuffer.slice(
857
- offset - response.arrayBufferOffset
857
+ offset - response.arrayBufferOffset,
858
858
  );
859
859
 
860
860
  if (streamSizeFixed) {
861
861
  const [success] = response.tryEnd(
862
862
  remainingChunkData,
863
- httpStream.totalBytes
863
+ httpStream.totalBytes,
864
864
  );
865
865
 
866
866
  retryBackpressure = !success;
@@ -899,7 +899,7 @@ class HttpWsProtocol extends Protocol {
899
899
  debugHTTP(
900
900
  "[%s] httpSendStream: %s",
901
901
  httpStream.connection.id,
902
- err.message
902
+ err.message,
903
903
  );
904
904
  });
905
905
 
@@ -931,7 +931,7 @@ class HttpWsProtocol extends Protocol {
931
931
  connectionId: message.connection.id,
932
932
  error: kerr,
933
933
  }),
934
- message
934
+ message,
935
935
  );
936
936
  this.entryPoint.removeConnection(message.connection.id);
937
937
 
@@ -951,12 +951,12 @@ class HttpWsProtocol extends Protocol {
951
951
  if (global.kuzzle.config.internal.allowAllOrigins) {
952
952
  response.writeHeader(
953
953
  HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN,
954
- WILDCARD
954
+ WILDCARD,
955
955
  );
956
956
  } else {
957
957
  response.writeHeader(
958
958
  HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN,
959
- Buffer.from(message.headers.origin)
959
+ Buffer.from(message.headers.origin),
960
960
  );
961
961
  response.writeHeader(HTTP_HEADER_VARY, ORIGIN);
962
962
  }
@@ -1064,7 +1064,7 @@ class HttpWsProtocol extends Protocol {
1064
1064
  callback({
1065
1065
  compressed: !err ? compressed : data,
1066
1066
  encoding: !err ? "gzip" : "identity",
1067
- })
1067
+ }),
1068
1068
  );
1069
1069
  return;
1070
1070
  } else if (algorithm === "deflate") {
@@ -1072,7 +1072,7 @@ class HttpWsProtocol extends Protocol {
1072
1072
  callback({
1073
1073
  compressed: !err ? compressed : data,
1074
1074
  encoding: !err ? "deflate" : "identity",
1075
- })
1075
+ }),
1076
1076
  );
1077
1077
  return;
1078
1078
  }
@@ -1137,7 +1137,7 @@ class HttpWsProtocol extends Protocol {
1137
1137
 
1138
1138
  if (cfg === undefined) {
1139
1139
  global.kuzzle.log.warn(
1140
- "[websocket] no configuration found for websocket: disabling it"
1140
+ "[websocket] no configuration found for websocket: disabling it",
1141
1141
  );
1142
1142
  return { enabled: false };
1143
1143
  }
@@ -1148,7 +1148,7 @@ class HttpWsProtocol extends Protocol {
1148
1148
  if (idleTimeout === 0 || idleTimeout < 1000) {
1149
1149
  idleTimeout = DEFAULT_IDLE_TIMEOUT;
1150
1150
  global.kuzzle.log.warn(
1151
- `[websocket] The "idleTimeout" parameter can neither be deactivated or be set with a value lower than 1000. Defaulted to ${DEFAULT_IDLE_TIMEOUT}.`
1151
+ `[websocket] The "idleTimeout" parameter can neither be deactivated or be set with a value lower than 1000. Defaulted to ${DEFAULT_IDLE_TIMEOUT}.`,
1152
1152
  );
1153
1153
  }
1154
1154
 
@@ -1159,7 +1159,7 @@ class HttpWsProtocol extends Protocol {
1159
1159
  */
1160
1160
  if (cfg.heartbeat) {
1161
1161
  global.kuzzle.log.warn(
1162
- '[websocket] The "heartbeat" parameter has been deprecated and is now ignored. The "idleTimeout" parameter should now be configured instead.'
1162
+ '[websocket] The "heartbeat" parameter has been deprecated and is now ignored. The "idleTimeout" parameter should now be configured instead.',
1163
1163
  );
1164
1164
  }
1165
1165
 
@@ -1181,7 +1181,7 @@ class HttpWsProtocol extends Protocol {
1181
1181
 
1182
1182
  if (cfg === undefined) {
1183
1183
  global.kuzzle.log.warn(
1184
- "[http] no configuration found for http: disabling it"
1184
+ "[http] no configuration found for http: disabling it",
1185
1185
  );
1186
1186
  return { enabled: false };
1187
1187
  }
@@ -25,7 +25,7 @@ const Protocol = require("./protocol");
25
25
  const ClientConnection = require("../clientConnection");
26
26
 
27
27
  const debug = require("../../../util/debug")(
28
- "kuzzle:network:protocols:internal"
28
+ "kuzzle:network:protocols:internal",
29
29
  );
30
30
 
31
31
  /**
@@ -63,7 +63,7 @@ class InternalProtocol extends Protocol {
63
63
  */
64
64
  global.kuzzle.onAsk(
65
65
  "core:network:internal:connectionId:get",
66
- () => this.connection.id
66
+ () => this.connection.id,
67
67
  );
68
68
  }
69
69
 
@@ -73,7 +73,7 @@ class MqttProtocol extends Protocol {
73
73
  port: 1883,
74
74
  },
75
75
  },
76
- this.config
76
+ this.config,
77
77
  );
78
78
 
79
79
  /*
@@ -93,7 +93,7 @@ class MqttProtocol extends Protocol {
93
93
  this.aedes.on("publish", this.onMessage.bind(this));
94
94
 
95
95
  await new Promise((res) =>
96
- this.server.listen(this.config.server.port, res)
96
+ this.server.listen(this.config.server.port, res),
97
97
  );
98
98
 
99
99
  return true;
@@ -152,7 +152,7 @@ class MqttProtocol extends Protocol {
152
152
  const connection = new ClientConnection(
153
153
  this.name,
154
154
  [client.conn.remoteAddress],
155
- {}
155
+ {},
156
156
  );
157
157
  this.entryPoint.newConnection(connection);
158
158
 
@@ -198,10 +198,10 @@ class MqttProtocol extends Protocol {
198
198
  debug(
199
199
  "no connection id for client id %s - packet: %o",
200
200
  client.id,
201
- packet
201
+ packet,
202
202
  );
203
203
  global.kuzzle.log.error(
204
- `[MQTT] Received a packet from an unregistered client: ${client.id}`
204
+ `[MQTT] Received a packet from an unregistered client: ${client.id}`,
205
205
  );
206
206
  return;
207
207
  }
@@ -214,7 +214,7 @@ class MqttProtocol extends Protocol {
214
214
  const request = new Request(payload, { connection });
215
215
 
216
216
  this.entryPoint.execute(connection, request, (response) =>
217
- this._respond(client, response)
217
+ this._respond(client, response),
218
218
  );
219
219
  } catch (error) {
220
220
  this._respondError(client, error);
@@ -238,7 +238,7 @@ class MqttProtocol extends Protocol {
238
238
  payload: Buffer.from(JSON.stringify(response.content)),
239
239
  topic: this.config.responseTopic,
240
240
  },
241
- this.publishCallback
241
+ this.publishCallback,
242
242
  );
243
243
  }
244
244
 
@@ -250,7 +250,7 @@ class MqttProtocol extends Protocol {
250
250
  {
251
251
  connection,
252
252
  error: kerror.getFrom(error, "unexpected_error", error.message),
253
- }
253
+ },
254
254
  );
255
255
  this._respond(client, removeStacktrace(errReq.response.toJSON()));
256
256
  }
@@ -270,7 +270,7 @@ class MqttProtocol extends Protocol {
270
270
  callback(
271
271
  topic === this.config.requestTopic
272
272
  ? null
273
- : new Error("Cannot publish on this topic: unauthorized")
273
+ : new Error("Cannot publish on this topic: unauthorized"),
274
274
  );
275
275
  }
276
276
  }
@@ -52,7 +52,7 @@ class Protocol {
52
52
  // name should be passed in the constructor
53
53
  assert(
54
54
  this.name && !name,
55
- "A name has been given in the constructor and init method. Passing the name in the init method is deprecated."
55
+ "A name has been given in the constructor and init method. Passing the name in the init method is deprecated.",
56
56
  );
57
57
 
58
58
  if (!this.name) {
@@ -63,7 +63,7 @@ class Protocol {
63
63
 
64
64
  assert(
65
65
  typeof this.name === "string" && this.name.length > 0,
66
- 'Invalid "name" parameter value: expected a non empty string value'
66
+ 'Invalid "name" parameter value: expected a non empty string value',
67
67
  );
68
68
 
69
69
  if (entryPoint.config.protocols && entryPoint.config.protocols[this.name]) {
@@ -72,7 +72,7 @@ class Protocol {
72
72
 
73
73
  assert(
74
74
  Number.isInteger(this.maxRequestSize),
75
- 'Invalid "maxRequestSize" parameter value: expected a numeric value'
75
+ 'Invalid "maxRequestSize" parameter value: expected a numeric value',
76
76
  );
77
77
 
78
78
  this.initCalled = true;
@@ -49,8 +49,8 @@ class Router {
49
49
  "protocol",
50
50
  "runtime",
51
51
  "invalid_connection",
52
- JSON.stringify(requestContext)
53
- )
52
+ JSON.stringify(requestContext),
53
+ ),
54
54
  );
55
55
  } else {
56
56
  this.connections.set(requestContext.connection.id, requestContext);
@@ -72,8 +72,8 @@ class Router {
72
72
  "protocol",
73
73
  "runtime",
74
74
  "invalid_connection",
75
- JSON.stringify(requestContext.context)
76
- )
75
+ JSON.stringify(requestContext.context),
76
+ ),
77
77
  );
78
78
  return;
79
79
  }
@@ -84,8 +84,8 @@ class Router {
84
84
  "protocol",
85
85
  "runtime",
86
86
  "unknown_connection",
87
- JSON.stringify(connId)
88
- )
87
+ JSON.stringify(connId),
88
+ ),
89
89
  );
90
90
  return;
91
91
  }
@@ -130,7 +130,7 @@ class Router {
130
130
 
131
131
  const apiRequest = new Request(
132
132
  requestPayload,
133
- request.serialize().options
133
+ request.serialize().options,
134
134
  );
135
135
 
136
136
  this._executeFromHttp("post", apiRequest, cb);
@@ -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;