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
@@ -170,7 +170,7 @@ class ClusterNode {
170
170
  debug("Found IP address: %s with config %o", this.ip, this.config);
171
171
  assert(
172
172
  this.ip !== null,
173
- `[CLUSTER] No suitable IP address found with the provided configuration (family: ${family}, interface: ${this.config.interface}, ip: ${this.config.ip})`
173
+ `[CLUSTER] No suitable IP address found with the provided configuration (family: ${family}, interface: ${this.config.interface}, ip: ${this.config.ip})`,
174
174
  );
175
175
 
176
176
  this.nodeId = null;
@@ -220,7 +220,7 @@ class ClusterNode {
220
220
 
221
221
  if (this.countActiveNodes() < this.config.minimumNodes) {
222
222
  global.kuzzle.log.info(
223
- "[CLUSTER] Not enough nodes active. Waiting for other nodes to join the cluster..."
223
+ "[CLUSTER] Not enough nodes active. Waiting for other nodes to join the cluster...",
224
224
  );
225
225
 
226
226
  while (this.countActiveNodes() < this.config.minimumNodes) {
@@ -295,7 +295,7 @@ class ClusterNode {
295
295
  ) {
296
296
  global.kuzzle.state = kuzzleStateEnum.RUNNING;
297
297
  global.kuzzle.log.warn(
298
- `[CLUSTER] Minimum number of nodes reached (${this.countActiveNodes()}). This node is now accepting requests again.`
298
+ `[CLUSTER] Minimum number of nodes reached (${this.countActiveNodes()}). This node is now accepting requests again.`,
299
299
  );
300
300
  }
301
301
 
@@ -336,13 +336,13 @@ class ClusterNode {
336
336
  }
337
337
 
338
338
  global.kuzzle.log.warn(
339
- `[CLUSTER] Node "${nodeId}" evicted. Reason: ${reason}`
339
+ `[CLUSTER] Node "${nodeId}" evicted. Reason: ${reason}`,
340
340
  );
341
341
  this.trackActivity(
342
342
  nodeId,
343
343
  subscriber.remoteNodeIP,
344
344
  nodeActivityEnum.EVICTED,
345
- reason
345
+ reason,
346
346
  );
347
347
 
348
348
  await this.idCardHandler.removeNode(nodeId);
@@ -359,7 +359,7 @@ class ClusterNode {
359
359
  global.kuzzle.log.warn(
360
360
  `[CLUSTER] Not enough nodes active (expected: ${
361
361
  this.config.minimumNodes
362
- }, active: ${this.countActiveNodes()}). Deactivating node until new ones are added.`
362
+ }, active: ${this.countActiveNodes()}). Deactivating node until new ones are added.`,
363
363
  );
364
364
  }
365
365
 
@@ -423,12 +423,12 @@ class ClusterNode {
423
423
 
424
424
  // First remove every non existing node from topologies
425
425
  splits = splits.map((topology) =>
426
- topology.filter((nodeId) => idCards.find((card) => card.id === nodeId))
426
+ topology.filter((nodeId) => idCards.find((card) => card.id === nodeId)),
427
427
  );
428
428
 
429
429
  splits = splits.sort((a, b) => a.length - b.length);
430
430
  const eligibleSplits = splits.filter(
431
- (split) => split.length === splits[0].length
431
+ (split) => split.length === splits[0].length,
432
432
  );
433
433
 
434
434
  let candidates;
@@ -472,7 +472,7 @@ class ClusterNode {
472
472
 
473
473
  if (candidates.includes(this.nodeId)) {
474
474
  global.kuzzle.log.error(
475
- "[CLUSTER] Network split detected. This node is outside the cluster: shutting down."
475
+ "[CLUSTER] Network split detected. This node is outside the cluster: shutting down.",
476
476
  );
477
477
  this.shutdownNode();
478
478
  return;
@@ -482,7 +482,7 @@ class ClusterNode {
482
482
  await this.enforceClusterConsistency();
483
483
  } catch (err) {
484
484
  global.kuzzle.log.error(
485
- "[CLUSTER] Unexpected exception caught during a cluster consistency check. Shutting down..."
485
+ "[CLUSTER] Unexpected exception caught during a cluster consistency check. Shutting down...",
486
486
  );
487
487
  global.kuzzle.log.error(err.stack);
488
488
  this.shutdownNode();
@@ -499,7 +499,7 @@ class ClusterNode {
499
499
  async handshake() {
500
500
  const handshakeTimeout = setTimeout(() => {
501
501
  global.kuzzle.log.error(
502
- `[CLUSTER] Failed to join the cluster: timed out (joinTimeout: ${this.config.joinTimeout}ms)`
502
+ `[CLUSTER] Failed to join the cluster: timed out (joinTimeout: ${this.config.joinTimeout}ms)`,
503
503
  );
504
504
  this.shutdownNode();
505
505
  }, this.config.joinTimeout);
@@ -542,7 +542,7 @@ class ClusterNode {
542
542
 
543
543
  if (duplicate.length > 0) {
544
544
  global.kuzzle.log.error(
545
- `[CLUSTER] Another node share the same IP address as this one (${this.ip}): ${duplicate[0].id}. Shutting down.`
545
+ `[CLUSTER] Another node share the same IP address as this one (${this.ip}): ${duplicate[0].id}. Shutting down.`,
546
546
  );
547
547
  this.shutdownNode();
548
548
  return;
@@ -566,7 +566,7 @@ class ClusterNode {
566
566
  if (fullState === null) {
567
567
  if (retried) {
568
568
  global.kuzzle.log.error(
569
- "[CLUSTER] Could not connect to discovered cluster nodes (network split detected). Shutting down."
569
+ "[CLUSTER] Could not connect to discovered cluster nodes (network split detected). Shutting down.",
570
570
  );
571
571
  this.shutdownNode();
572
572
  return;
@@ -582,7 +582,7 @@ class ClusterNode {
582
582
  retried = true;
583
583
  const retryDelay = this.heartbeatDelay * 1.5;
584
584
  global.kuzzle.log.warn(
585
- `[CLUSTER] Unable to connect to discovered cluster nodes. Retrying in ${retryDelay}ms...`
585
+ `[CLUSTER] Unable to connect to discovered cluster nodes. Retrying in ${retryDelay}ms...`,
586
586
  );
587
587
  await Bluebird.delay(retryDelay);
588
588
  }
@@ -601,7 +601,7 @@ class ClusterNode {
601
601
  // Update subscribers: start synchronizing, or unsubscribes from nodes who
602
602
  // didn't respond
603
603
  for (const [nodeId, handshakeData] of Object.entries(
604
- handshakeResponses
604
+ handshakeResponses,
605
605
  )) {
606
606
  const subscriber = this.remoteNodes.get(nodeId);
607
607
  if (handshakeData === null) {
@@ -612,10 +612,10 @@ class ClusterNode {
612
612
  const nodesStates = fullState.nodesState || [];
613
613
  const nodeStatus = nodesStates.find((node) => node.id === nodeId);
614
614
  subscriber.sync(
615
- nodeStatus ? nodeStatus.lastMessageId : handshakeData.lastMessageId
615
+ nodeStatus ? nodeStatus.lastMessageId : handshakeData.lastMessageId,
616
616
  );
617
617
  global.kuzzle.log.info(
618
- `[CLUSTER] Successfully completed the handshake with node ${nodeId}`
618
+ `[CLUSTER] Successfully completed the handshake with node ${nodeId}`,
619
619
  );
620
620
  }
621
621
  }
@@ -708,7 +708,7 @@ class ClusterNode {
708
708
  * @return {void}
709
709
  */
710
710
  global.kuzzle.onAsk("cluster:realtime:room:remove", (roomId) =>
711
- this.removeRealtimeRoom(roomId)
711
+ this.removeRealtimeRoom(roomId),
712
712
  );
713
713
 
714
714
  /**
@@ -719,7 +719,7 @@ class ClusterNode {
719
719
  * @returns {Number}
720
720
  */
721
721
  global.kuzzle.onAsk("cluster:realtime:room:count", (roomId) =>
722
- this.countRealtimeSubscribers(roomId)
722
+ this.countRealtimeSubscribers(roomId),
723
723
  );
724
724
 
725
725
  /**
@@ -728,7 +728,7 @@ class ClusterNode {
728
728
  * @returns {Object}
729
729
  */
730
730
  global.kuzzle.onAsk("cluster:realtime:room:list", () =>
731
- this.fullState.listRealtimeRooms()
731
+ this.fullState.listRealtimeRooms(),
732
732
  );
733
733
 
734
734
  /**
@@ -739,7 +739,7 @@ class ClusterNode {
739
739
  * @returns {NormalizedFilter}
740
740
  */
741
741
  global.kuzzle.onAsk("cluster:realtime:filters:get", (roomId) =>
742
- this.fullState.getNormalizedFilters(roomId)
742
+ this.fullState.getNormalizedFilters(roomId),
743
743
  );
744
744
 
745
745
  /**
@@ -749,7 +749,7 @@ class ClusterNode {
749
749
  * @param {Object} payload - event payload
750
750
  */
751
751
  global.kuzzle.onAsk("cluster:event:broadcast", (event, payload) =>
752
- this.broadcast(event, payload)
752
+ this.broadcast(event, payload),
753
753
  );
754
754
 
755
755
  /**
@@ -759,7 +759,7 @@ class ClusterNode {
759
759
  * @param {Function} fn - event listener
760
760
  */
761
761
  global.kuzzle.onAsk("cluster:event:on", (event, fn) =>
762
- this.eventEmitter.on(event, fn)
762
+ this.eventEmitter.on(event, fn),
763
763
  );
764
764
 
765
765
  /**
@@ -769,7 +769,7 @@ class ClusterNode {
769
769
  * @param {Function} fn - event listener
770
770
  */
771
771
  global.kuzzle.onAsk("cluster:event:once", (event, fn) =>
772
- this.eventEmitter.once(event, fn)
772
+ this.eventEmitter.once(event, fn),
773
773
  );
774
774
 
775
775
  /**
@@ -779,7 +779,7 @@ class ClusterNode {
779
779
  * @param {Function} fn - event listener
780
780
  */
781
781
  global.kuzzle.onAsk("cluster:event:off", (event, fn) =>
782
- this.eventEmitter.removeListener(event, fn)
782
+ this.eventEmitter.removeListener(event, fn),
783
783
  );
784
784
 
785
785
  /**
@@ -788,7 +788,7 @@ class ClusterNode {
788
788
  * @param {string} event name
789
789
  */
790
790
  global.kuzzle.onAsk("cluster:event:removeAllListeners", (event) =>
791
- this.eventEmitter.removeAllListeners(event)
791
+ this.eventEmitter.removeAllListeners(event),
792
792
  );
793
793
 
794
794
  /**
@@ -804,19 +804,19 @@ class ClusterNode {
804
804
  */
805
805
  registerEvents() {
806
806
  global.kuzzle.on("admin:afterRefreshIndexCache", () =>
807
- this.onIndexCacheRefreshed()
807
+ this.onIndexCacheRefreshed(),
808
808
  );
809
809
 
810
810
  global.kuzzle.onCall("core:realtime:room:create:after", (payload) =>
811
- this.onNewRealtimeRoom(payload)
811
+ this.onNewRealtimeRoom(payload),
812
812
  );
813
813
 
814
814
  global.kuzzle.onCall("core:realtime:subscribe:after", (roomId) =>
815
- this.onNewSubscription(roomId)
815
+ this.onNewSubscription(roomId),
816
816
  );
817
817
 
818
818
  global.kuzzle.onCall("core:realtime:unsubscribe:after", (roomId) =>
819
- this.onUnsubscription(roomId)
819
+ this.onUnsubscription(roomId),
820
820
  );
821
821
 
822
822
  global.kuzzle.on("core:notify:document", ({ notification, rooms }) => {
@@ -824,18 +824,18 @@ class ClusterNode {
824
824
  });
825
825
 
826
826
  global.kuzzle.on("core:notify:user", ({ notification, room }) =>
827
- this.onUserNotification(room, notification)
827
+ this.onUserNotification(room, notification),
828
828
  );
829
829
 
830
830
  global.kuzzle.on(
831
831
  "core:auth:strategyAdded",
832
832
  ({ name, pluginName, strategy }) => {
833
833
  this.onAuthStrategyAdded(name, pluginName, strategy);
834
- }
834
+ },
835
835
  );
836
836
 
837
837
  global.kuzzle.on("core:auth:strategyRemoved", ({ name, pluginName }) =>
838
- this.onAuthStrategyRemoved(name, pluginName)
838
+ this.onAuthStrategyRemoved(name, pluginName),
839
839
  );
840
840
 
841
841
  global.kuzzle.on("admin:afterDump", (request) => {
@@ -849,74 +849,74 @@ class ClusterNode {
849
849
  global.kuzzle.on("admin:afterShutdown", () => this.onShutdown());
850
850
 
851
851
  global.kuzzle.on("collection:afterDeleteSpecifications", () =>
852
- this.onValidatorsChanged()
852
+ this.onValidatorsChanged(),
853
853
  );
854
854
 
855
855
  global.kuzzle.on("collection:afterUpdateSpecifications", () =>
856
- this.onValidatorsChanged()
856
+ this.onValidatorsChanged(),
857
857
  );
858
858
 
859
859
  // Profile change events
860
860
  global.kuzzle.on("core:security:profile:create", ({ args: [profileId] }) =>
861
- this.onProfileChanged(profileId)
861
+ this.onProfileChanged(profileId),
862
862
  );
863
863
 
864
864
  global.kuzzle.on(
865
865
  "core:security:profile:createOrReplace",
866
- ({ args: [profileId] }) => this.onProfileChanged(profileId)
866
+ ({ args: [profileId] }) => this.onProfileChanged(profileId),
867
867
  );
868
868
 
869
869
  global.kuzzle.on("core:security:profile:update", ({ args: [profileId] }) =>
870
- this.onProfileChanged(profileId)
870
+ this.onProfileChanged(profileId),
871
871
  );
872
872
 
873
873
  global.kuzzle.on("core:security:profile:delete", ({ args: [profileId] }) =>
874
- this.onProfileChanged(profileId)
874
+ this.onProfileChanged(profileId),
875
875
  );
876
876
 
877
877
  // Role change events
878
878
  global.kuzzle.on("core:security:role:create", ({ args: [roleId] }) =>
879
- this.onRoleChanged(roleId)
879
+ this.onRoleChanged(roleId),
880
880
  );
881
881
 
882
882
  global.kuzzle.on(
883
883
  "core:security:role:createOrReplace",
884
- ({ args: [roleId] }) => this.onRoleChanged(roleId)
884
+ ({ args: [roleId] }) => this.onRoleChanged(roleId),
885
885
  );
886
886
 
887
887
  global.kuzzle.on("core:security:role:update", ({ args: [roleId] }) =>
888
- this.onRoleChanged(roleId)
888
+ this.onRoleChanged(roleId),
889
889
  );
890
890
 
891
891
  global.kuzzle.on("core:security:role:delete", ({ args: [roleId] }) =>
892
- this.onRoleChanged(roleId)
892
+ this.onRoleChanged(roleId),
893
893
  );
894
894
 
895
895
  // Index cache change events
896
896
  global.kuzzle.on("core:storage:index:create:after", ({ index, scope }) =>
897
- this.onIndexAdded(scope, index)
897
+ this.onIndexAdded(scope, index),
898
898
  );
899
899
 
900
900
  global.kuzzle.on("core:storage:index:delete:after", ({ index, scope }) =>
901
- this.onIndexesRemoved(scope, [index])
901
+ this.onIndexesRemoved(scope, [index]),
902
902
  );
903
903
 
904
904
  global.kuzzle.on("core:storage:index:mDelete:after", ({ indexes, scope }) =>
905
- this.onIndexesRemoved(scope, indexes)
905
+ this.onIndexesRemoved(scope, indexes),
906
906
  );
907
907
 
908
908
  global.kuzzle.on(
909
909
  "core:storage:collection:create:after",
910
910
  ({ collection, index, scope }) => {
911
911
  this.onCollectionAdded(scope, index, collection);
912
- }
912
+ },
913
913
  );
914
914
 
915
915
  global.kuzzle.on(
916
916
  "core:storage:collection:delete:after",
917
917
  ({ collection, index, scope }) => {
918
918
  this.onCollectionRemoved(scope, index, collection);
919
- }
919
+ },
920
920
  );
921
921
  }
922
922
 
@@ -933,7 +933,7 @@ class ClusterNode {
933
933
  "[%s] Broadcasting new realtime room %s (message: %d)",
934
934
  this.nodeId,
935
935
  payload.id,
936
- roomMessageId
936
+ roomMessageId,
937
937
  );
938
938
 
939
939
  const icpair = fromKoncordeIndex(payload.index);
@@ -947,7 +947,7 @@ class ClusterNode {
947
947
  messageId: roomMessageId,
948
948
  nodeId: this.nodeId,
949
949
  subscribers: 0,
950
- }
950
+ },
951
951
  );
952
952
  }
953
953
 
@@ -964,7 +964,7 @@ class ClusterNode {
964
964
  "[%s] Broadcasting new realtime subscription on room %s (message: %d)",
965
965
  this.nodeId,
966
966
  roomId,
967
- subMessageId
967
+ subMessageId,
968
968
  );
969
969
 
970
970
  this.fullState.addRealtimeSubscription(roomId, this.nodeId, subMessageId);
@@ -983,7 +983,7 @@ class ClusterNode {
983
983
  "[%s] Broadcasted the removal of room %s (message: %d)",
984
984
  this.nodeId,
985
985
  roomId,
986
- messageId
986
+ messageId,
987
987
  );
988
988
 
989
989
  this.fullState.removeRealtimeRoom(roomId, this.nodeId);
@@ -1002,7 +1002,7 @@ class ClusterNode {
1002
1002
  '[%s] Emitted cluster-wide event "%s" (message: %d)',
1003
1003
  this.nodeId,
1004
1004
  event,
1005
- messageId
1005
+ messageId,
1006
1006
  );
1007
1007
  }
1008
1008
 
@@ -1019,7 +1019,7 @@ class ClusterNode {
1019
1019
  "[%s] Broadcasting realtime unsubscription on room %s (message: %d)",
1020
1020
  this.nodeId,
1021
1021
  roomId,
1022
- messageId
1022
+ messageId,
1023
1023
  );
1024
1024
 
1025
1025
  this.fullState.removeRealtimeSubscription(roomId, this.nodeId, messageId);
@@ -1059,7 +1059,7 @@ class ClusterNode {
1059
1059
  this.publisher.sendNewAuthStrategy(
1060
1060
  strategyName,
1061
1061
  pluginName,
1062
- strategyObject
1062
+ strategyObject,
1063
1063
  );
1064
1064
 
1065
1065
  this.fullState.addAuthStrategy({
@@ -116,7 +116,7 @@ class ClusterSubscriber {
116
116
  this.socket.subscribe();
117
117
  this.heartbeatTimer = setInterval(
118
118
  () => this.checkHeartbeat(),
119
- this.heartbeatDelay
119
+ this.heartbeatDelay,
120
120
  );
121
121
 
122
122
  this.listen();
@@ -225,9 +225,9 @@ class ClusterSubscriber {
225
225
  } catch (e) {
226
226
  this.localNode.evictSelf(
227
227
  `Unable to process sync message (topic: ${topic}, message: ${JSON.stringify(
228
- message
228
+ message,
229
229
  )}`,
230
- e
230
+ e,
231
231
  );
232
232
  }
233
233
  }
@@ -254,7 +254,7 @@ class ClusterSubscriber {
254
254
  async handleNodeEviction(message) {
255
255
  if (message.nodeId === this.localNode.nodeId) {
256
256
  global.kuzzle.log.error(
257
- `[CLUSTER] Node evicted by ${message.evictor}. Reason: ${message.reason}`
257
+ `[CLUSTER] Node evicted by ${message.evictor}. Reason: ${message.reason}`,
258
258
  );
259
259
  global.kuzzle.shutdown();
260
260
  return;
@@ -295,7 +295,7 @@ class ClusterSubscriber {
295
295
  messageId,
296
296
  id,
297
297
  icpair.index,
298
- icpair.collection
298
+ icpair.collection,
299
299
  );
300
300
 
301
301
  this.localNode.fullState.addRealtimeRoom(
@@ -307,7 +307,7 @@ class ClusterSubscriber {
307
307
  messageId,
308
308
  nodeId: this.remoteNodeId,
309
309
  subscribers: 0,
310
- }
310
+ },
311
311
  );
312
312
  }
313
313
 
@@ -322,13 +322,13 @@ class ClusterSubscriber {
322
322
  "New realtime subscription received from node %s (message: %d, room: %s)",
323
323
  this.remoteNodeId,
324
324
  message.messageId,
325
- message.roomId
325
+ message.roomId,
326
326
  );
327
327
 
328
328
  this.localNode.fullState.addRealtimeSubscription(
329
329
  message.roomId,
330
330
  this.remoteNodeId,
331
- message.messageId
331
+ message.messageId,
332
332
  );
333
333
  }
334
334
 
@@ -343,12 +343,12 @@ class ClusterSubscriber {
343
343
  "Realtime room removal received from node %s (message: %d, room: %s)",
344
344
  this.remoteNodeId,
345
345
  message.messageId,
346
- message.roomId
346
+ message.roomId,
347
347
  );
348
348
 
349
349
  this.localNode.fullState.removeRealtimeRoom(
350
350
  message.roomId,
351
- this.remoteNodeId
351
+ this.remoteNodeId,
352
352
  );
353
353
  }
354
354
 
@@ -363,13 +363,13 @@ class ClusterSubscriber {
363
363
  "Realtime unsubscription received from node %s (message: %d, room: %s)",
364
364
  this.remoteNodeId,
365
365
  message.messageId,
366
- message.roomId
366
+ message.roomId,
367
367
  );
368
368
 
369
369
  this.localNode.fullState.removeRealtimeSubscription(
370
370
  message.roomId,
371
371
  this.remoteNodeId,
372
- message.messageId
372
+ message.messageId,
373
373
  );
374
374
  }
375
375
 
@@ -410,7 +410,7 @@ class ClusterSubscriber {
410
410
  return global.kuzzle.ask(
411
411
  "core:realtime:document:dispatch",
412
412
  message.rooms,
413
- notification
413
+ notification,
414
414
  );
415
415
  }
416
416
 
@@ -438,7 +438,7 @@ class ClusterSubscriber {
438
438
  return global.kuzzle.ask(
439
439
  "core:realtime:user:sendMessage",
440
440
  message.room,
441
- notification
441
+ notification,
442
442
  );
443
443
  }
444
444
 
@@ -455,7 +455,7 @@ class ClusterSubscriber {
455
455
  "New authentication strategy added by node %s (plugin: %s, strategy: %s)",
456
456
  this.remoteNodeId,
457
457
  pluginName,
458
- strategyName
458
+ strategyName,
459
459
  );
460
460
 
461
461
  this.localNode.fullState.addAuthStrategy(message);
@@ -463,7 +463,7 @@ class ClusterSubscriber {
463
463
  global.kuzzle.pluginsManager.registerStrategy(
464
464
  pluginName,
465
465
  strategyName,
466
- strategy
466
+ strategy,
467
467
  );
468
468
  }
469
469
 
@@ -480,7 +480,7 @@ class ClusterSubscriber {
480
480
  "Authentication strategy removed by node %s (plugin: %s, strategy: %s)",
481
481
  this.remoteNodeId,
482
482
  pluginName,
483
- strategyName
483
+ strategyName,
484
484
  );
485
485
 
486
486
  global.kuzzle.pluginsManager.unregisterStrategy(pluginName, strategyName);
@@ -516,10 +516,10 @@ class ClusterSubscriber {
516
516
  handleShutdown() {
517
517
  debug(
518
518
  "Cluster-wide shutdown request received from node %s",
519
- this.remoteNodeId
519
+ this.remoteNodeId,
520
520
  );
521
521
  global.kuzzle.log.error(
522
- `[CLUSTER] Cluster wide shutdown from ${this.remoteNodeId}`
522
+ `[CLUSTER] Cluster wide shutdown from ${this.remoteNodeId}`,
523
523
  );
524
524
  global.kuzzle.shutdown();
525
525
  }
@@ -532,7 +532,7 @@ class ClusterSubscriber {
532
532
  async handleRefreshValidators() {
533
533
  debug(
534
534
  "Validators changed notification received from node %s",
535
- this.remoteNodeId
535
+ this.remoteNodeId,
536
536
  );
537
537
  await global.kuzzle.validation.curateSpecification();
538
538
  }
@@ -543,7 +543,7 @@ class ClusterSubscriber {
543
543
  async handleRefreshIndexCache() {
544
544
  debug(
545
545
  "Index cache manually refresh received from node %s",
546
- this.remoteNodeId
546
+ this.remoteNodeId,
547
547
  );
548
548
  await global.kuzzle.ask("core:storage:public:cache:refresh", {
549
549
  from: "cluster",
@@ -560,12 +560,12 @@ class ClusterSubscriber {
560
560
  debug(
561
561
  "Profile invalidation request received from node %s (profile: %s)",
562
562
  this.remoteNodeId,
563
- message.profileId
563
+ message.profileId,
564
564
  );
565
565
 
566
566
  await global.kuzzle.ask(
567
567
  "core:security:profile:invalidate",
568
- message.profileId
568
+ message.profileId,
569
569
  );
570
570
  }
571
571
 
@@ -579,7 +579,7 @@ class ClusterSubscriber {
579
579
  debug(
580
580
  "Role invalidation request received from node %s (role: %s)",
581
581
  this.remoteNodeId,
582
- message.roleId
582
+ message.roleId,
583
583
  );
584
584
 
585
585
  await global.kuzzle.ask("core:security:role:invalidate", message.roleId);
@@ -598,7 +598,7 @@ class ClusterSubscriber {
598
598
  "New index added by node %s (scope: %s, index: %s)",
599
599
  this.remoteNodeId,
600
600
  scope,
601
- index
601
+ index,
602
602
  );
603
603
 
604
604
  await global.kuzzle.ask(`core:storage:${scope}:cache:addIndex`, index);
@@ -617,12 +617,12 @@ class ClusterSubscriber {
617
617
  "Indexes removed by node %s (scope: %s, indexes: %s)",
618
618
  this.remoteNodeId,
619
619
  scope,
620
- indexes
620
+ indexes,
621
621
  );
622
622
 
623
623
  await global.kuzzle.ask(
624
624
  `core:storage:${scope}:cache:removeIndexes`,
625
- indexes
625
+ indexes,
626
626
  );
627
627
  }
628
628
 
@@ -640,13 +640,13 @@ class ClusterSubscriber {
640
640
  this.remoteNodeId,
641
641
  scope,
642
642
  index,
643
- collection
643
+ collection,
644
644
  );
645
645
 
646
646
  await global.kuzzle.ask(
647
647
  `core:storage:${scope}:cache:addCollection`,
648
648
  index,
649
- collection
649
+ collection,
650
650
  );
651
651
  }
652
652
 
@@ -664,13 +664,13 @@ class ClusterSubscriber {
664
664
  this.remoteNodeId,
665
665
  scope,
666
666
  index,
667
- collection
667
+ collection,
668
668
  );
669
669
 
670
670
  await global.kuzzle.ask(
671
671
  `core:storage:${scope}:cache:removeCollection`,
672
672
  index,
673
- collection
673
+ collection,
674
674
  );
675
675
  }
676
676
 
@@ -730,7 +730,7 @@ class ClusterSubscriber {
730
730
  async validateMessage(message) {
731
731
  if (!has(message, "messageId")) {
732
732
  global.kuzzle.log.warn(
733
- `Invalid message received from node ${this.remoteNodeId}. Evicting it.`
733
+ `Invalid message received from node ${this.remoteNodeId}. Evicting it.`,
734
734
  );
735
735
 
736
736
  await this.evictNode({
@@ -754,7 +754,7 @@ class ClusterSubscriber {
754
754
  await this.localNode.evictSelf(
755
755
  `Node out-of-sync: ${
756
756
  message.messageId - this.lastMessageId - 1
757
- } messages lost from node ${this.remoteNodeId}`
757
+ } messages lost from node ${this.remoteNodeId}`,
758
758
  );
759
759
  return false;
760
760
  }