kuzzle 2.17.6 → 2.18.0

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 (211) hide show
  1. package/bin/start-kuzzle-server +1 -1
  2. package/lib/api/controllers/adminController.js +1 -1
  3. package/lib/api/controllers/authController.js +7 -2
  4. package/lib/api/controllers/baseController.js +1 -1
  5. package/lib/api/controllers/bulkController.js +1 -1
  6. package/lib/api/controllers/clusterController.js +1 -1
  7. package/lib/api/controllers/collectionController.js +1 -1
  8. package/lib/api/controllers/documentController.js +7 -2
  9. package/lib/api/controllers/index.js +1 -1
  10. package/lib/api/controllers/indexController.js +11 -7
  11. package/lib/api/controllers/memoryStorageController.js +1 -1
  12. package/lib/api/controllers/realtimeController.js +1 -1
  13. package/lib/api/controllers/securityController.js +55 -23
  14. package/lib/api/controllers/serverController.js +1 -1
  15. package/lib/api/documentExtractor.js +1 -1
  16. package/lib/api/funnel.js +1 -1
  17. package/lib/api/httpRoutes.js +7 -5
  18. package/lib/api/openapi/OpenApiManager.js +5 -1
  19. package/lib/api/openapi/components/document/get.yaml +1 -1
  20. package/lib/api/openapi/components/document/index.d.ts +2 -0
  21. package/lib/api/openapi/components/document/index.js +6 -1
  22. package/lib/api/openapi/components/document/mCreateOrReplace.yaml +93 -0
  23. package/lib/api/openapi/components/document/update.yaml +1 -1
  24. package/lib/api/openapi/components/index.d.ts +1 -0
  25. package/lib/api/openapi/components/index.js +1 -0
  26. package/lib/api/openapi/components/security/index.d.ts +2 -0
  27. package/lib/api/openapi/components/security/index.js +10 -0
  28. package/lib/api/openapi/components/security/upsertUser.yaml +59 -0
  29. package/lib/api/openapi/openApiGenerator.js +1 -1
  30. package/lib/api/rateLimiter.js +1 -1
  31. package/lib/api/request/kuzzleRequest.d.ts +21 -0
  32. package/lib/api/request/kuzzleRequest.js +49 -3
  33. package/lib/api/request/requestContext.js +1 -1
  34. package/lib/api/request/requestInput.js +1 -1
  35. package/lib/api/request/requestResponse.js +1 -1
  36. package/lib/cluster/command.js +1 -1
  37. package/lib/cluster/idCardHandler.js +1 -1
  38. package/lib/cluster/index.js +1 -1
  39. package/lib/cluster/node.js +8 -8
  40. package/lib/cluster/publisher.js +1 -1
  41. package/lib/cluster/state.js +1 -1
  42. package/lib/cluster/subscriber.js +4 -1
  43. package/lib/config/documentEventAliases.js +1 -1
  44. package/lib/config/index.js +1 -1
  45. package/lib/core/auth/formatProcessing.js +1 -1
  46. package/lib/core/auth/passportResponse.js +1 -1
  47. package/lib/core/auth/passportWrapper.js +1 -1
  48. package/lib/core/auth/tokenManager.js +1 -1
  49. package/lib/core/backend/applicationManager.js +1 -1
  50. package/lib/core/backend/backend.js +1 -1
  51. package/lib/core/backend/backendCluster.js +1 -1
  52. package/lib/core/backend/backendConfig.js +1 -1
  53. package/lib/core/backend/backendController.js +1 -1
  54. package/lib/core/backend/backendErrors.js +1 -1
  55. package/lib/core/backend/backendHook.js +1 -1
  56. package/lib/core/backend/backendImport.js +1 -1
  57. package/lib/core/backend/backendOpenApi.js +1 -1
  58. package/lib/core/backend/backendPipe.js +1 -1
  59. package/lib/core/backend/backendPlugin.js +1 -1
  60. package/lib/core/backend/backendStorage.js +1 -1
  61. package/lib/core/backend/backendVault.js +1 -1
  62. package/lib/core/backend/internalLogger.js +1 -1
  63. package/lib/core/cache/cacheDbEnum.js +1 -1
  64. package/lib/core/cache/cacheEngine.js +1 -1
  65. package/lib/core/network/accessLogger.js +12 -7
  66. package/lib/core/network/clientConnection.js +1 -1
  67. package/lib/core/network/context.js +1 -1
  68. package/lib/core/network/entryPoint.js +6 -6
  69. package/lib/core/network/httpRouter/index.js +1 -1
  70. package/lib/core/network/httpRouter/routeHandler.js +1 -1
  71. package/lib/core/network/httpRouter/routePart.js +1 -1
  72. package/lib/core/network/protocolManifest.js +1 -1
  73. package/lib/core/network/protocols/httpMessage.js +1 -1
  74. package/lib/core/network/protocols/httpwsProtocol.js +5 -10
  75. package/lib/core/network/protocols/internalProtocol.js +1 -1
  76. package/lib/core/network/protocols/mqttProtocol.js +4 -3
  77. package/lib/core/network/protocols/protocol.js +1 -1
  78. package/lib/core/network/router.js +11 -2
  79. package/lib/core/plugin/plugin.js +1 -1
  80. package/lib/core/plugin/pluginContext.js +1 -1
  81. package/lib/core/plugin/pluginManifest.js +1 -1
  82. package/lib/core/plugin/pluginRepository.js +1 -1
  83. package/lib/core/plugin/pluginsManager.js +1 -1
  84. package/lib/core/plugin/privilegedContext.js +1 -1
  85. package/lib/core/realtime/actionEnum.js +1 -1
  86. package/lib/core/realtime/channel.js +1 -1
  87. package/lib/core/realtime/connectionRooms.js +1 -1
  88. package/lib/core/realtime/hotelClerk.js +66 -24
  89. package/lib/core/realtime/index.js +1 -1
  90. package/lib/core/realtime/notification/document.js +1 -1
  91. package/lib/core/realtime/notification/index.js +1 -1
  92. package/lib/core/realtime/notification/server.js +1 -1
  93. package/lib/core/realtime/notification/user.js +1 -1
  94. package/lib/core/realtime/notifier.js +1 -1
  95. package/lib/core/realtime/room.js +1 -1
  96. package/lib/core/realtime/subscription.js +1 -1
  97. package/lib/core/security/index.js +1 -1
  98. package/lib/core/security/profileRepository.js +1 -1
  99. package/lib/core/security/roleRepository.js +1 -1
  100. package/lib/core/security/securityLoader.js +1 -1
  101. package/lib/core/security/tokenRepository.js +1 -1
  102. package/lib/core/security/userRepository.js +1 -1
  103. package/lib/core/shared/KoncordeWrapper.js +1 -1
  104. package/lib/core/shared/abstractManifest.js +1 -1
  105. package/lib/core/shared/repository.js +1 -1
  106. package/lib/core/shared/sdk/embeddedSdk.d.ts +2 -2
  107. package/lib/core/shared/sdk/embeddedSdk.js +4 -3
  108. package/lib/core/shared/sdk/funnelProtocol.d.ts +13 -0
  109. package/lib/core/shared/sdk/funnelProtocol.js +76 -81
  110. package/lib/core/shared/sdk/impersonatedSdk.js +1 -1
  111. package/lib/core/shared/store.js +1 -1
  112. package/lib/core/statistics/index.js +1 -1
  113. package/lib/core/statistics/statistics.js +1 -1
  114. package/lib/core/storage/clientAdapter.js +1 -1
  115. package/lib/core/storage/indexCache.js +1 -1
  116. package/lib/core/storage/storageEngine.js +1 -1
  117. package/lib/core/storage/storeScopeEnum.js +1 -1
  118. package/lib/core/validation/baseType.js +1 -1
  119. package/lib/core/validation/index.js +1 -1
  120. package/lib/core/validation/types/anything.js +1 -1
  121. package/lib/core/validation/types/boolean.js +1 -1
  122. package/lib/core/validation/types/date.js +1 -1
  123. package/lib/core/validation/types/email.js +1 -1
  124. package/lib/core/validation/types/enum.js +1 -1
  125. package/lib/core/validation/types/geoPoint.js +1 -1
  126. package/lib/core/validation/types/geoShape.js +1 -1
  127. package/lib/core/validation/types/integer.js +1 -1
  128. package/lib/core/validation/types/ipAddress.js +1 -1
  129. package/lib/core/validation/types/numeric.js +1 -1
  130. package/lib/core/validation/types/object.js +1 -1
  131. package/lib/core/validation/types/string.js +1 -1
  132. package/lib/core/validation/types/url.js +1 -1
  133. package/lib/core/validation/validation.js +1 -1
  134. package/lib/kerror/codes/1-services.json +1 -1
  135. package/lib/kerror/codes/index.js +1 -1
  136. package/lib/kerror/errors/badRequestError.js +1 -1
  137. package/lib/kerror/errors/externalServiceError.js +1 -1
  138. package/lib/kerror/errors/forbiddenError.js +1 -1
  139. package/lib/kerror/errors/gatewayTimeoutError.js +1 -1
  140. package/lib/kerror/errors/index.js +1 -1
  141. package/lib/kerror/errors/internalError.js +1 -1
  142. package/lib/kerror/errors/kuzzleError.d.ts +1 -1
  143. package/lib/kerror/errors/kuzzleError.js +1 -1
  144. package/lib/kerror/errors/multipleErrorsError.js +1 -1
  145. package/lib/kerror/errors/notFoundError.js +1 -1
  146. package/lib/kerror/errors/partialError.js +1 -1
  147. package/lib/kerror/errors/pluginImplementationError.js +1 -1
  148. package/lib/kerror/errors/preconditionError.js +1 -1
  149. package/lib/kerror/errors/serviceUnavailableError.js +1 -1
  150. package/lib/kerror/errors/sizeLimitError.js +1 -1
  151. package/lib/kerror/errors/tooManyRequestsError.js +1 -1
  152. package/lib/kerror/errors/unauthorizedError.js +1 -1
  153. package/lib/kerror/index.js +2 -4
  154. package/lib/kuzzle/dumpGenerator.js +1 -1
  155. package/lib/kuzzle/event/kuzzleEventEmitter.js +39 -1
  156. package/lib/kuzzle/event/pipeRunner.js +1 -1
  157. package/lib/kuzzle/event/waterfall.js +1 -1
  158. package/lib/kuzzle/index.js +1 -1
  159. package/lib/kuzzle/internalIndexHandler.js +1 -1
  160. package/lib/kuzzle/kuzzle.js +1 -1
  161. package/lib/kuzzle/kuzzleStateEnum.js +1 -1
  162. package/lib/kuzzle/log.js +1 -1
  163. package/lib/kuzzle/vault.js +1 -1
  164. package/lib/model/security/profile.js +1 -1
  165. package/lib/model/security/rights.js +1 -1
  166. package/lib/model/security/role.js +1 -1
  167. package/lib/model/security/token.js +1 -1
  168. package/lib/model/security/user.js +6 -7
  169. package/lib/model/storage/apiKey.js +1 -1
  170. package/lib/model/storage/baseModel.js +1 -1
  171. package/lib/service/cache/redis.js +1 -1
  172. package/lib/service/service.js +1 -1
  173. package/lib/service/storage/elasticsearch.js +108 -39
  174. package/lib/service/storage/esWrapper.js +1 -1
  175. package/lib/service/storage/queryTranslator.js +1 -1
  176. package/lib/types/Controller.js +1 -1
  177. package/lib/types/ControllerDefinition.js +1 -1
  178. package/lib/types/Deprecation.js +1 -1
  179. package/lib/types/EventHandler.js +1 -1
  180. package/lib/types/KuzzleDocument.d.ts +3 -0
  181. package/lib/types/Plugin.js +1 -1
  182. package/lib/types/PluginManifest.js +1 -1
  183. package/lib/types/RequestPayload.js +1 -1
  184. package/lib/types/ResponsePayload.js +1 -1
  185. package/lib/types/StrategyDefinition.js +1 -1
  186. package/lib/types/Token.js +1 -1
  187. package/lib/types/User.js +1 -1
  188. package/lib/types/index.d.ts +0 -1
  189. package/lib/types/index.js +1 -2
  190. package/lib/util/array.js +1 -1
  191. package/lib/util/assertType.js +1 -1
  192. package/lib/util/asyncStore.js +1 -1
  193. package/lib/util/debug.js +1 -1
  194. package/lib/util/deprecate.js +1 -1
  195. package/lib/util/didYouMean.js +1 -1
  196. package/lib/util/dump-collection.d.ts +35 -0
  197. package/lib/util/dump-collection.js +11 -8
  198. package/lib/util/extractFields.js +1 -1
  199. package/lib/util/inflector.js +1 -1
  200. package/lib/util/koncordeCompat.js +1 -1
  201. package/lib/util/memoize.js +1 -1
  202. package/lib/util/mutex.js +1 -1
  203. package/lib/util/name-generator.js +1 -1
  204. package/lib/util/promback.js +1 -1
  205. package/lib/util/requestAssertions.js +1 -1
  206. package/lib/util/safeObject.js +1 -1
  207. package/lib/util/stackTrace.js +56 -17
  208. package/lib/util/wildcard.js +1 -1
  209. package/package-lock.json +102 -83
  210. package/package.json +18 -17
  211. package/lib/core/network/removeErrorStack.js +0 -56
@@ -3,7 +3,7 @@
3
3
  * Kuzzle, a backend software, self-hostable and ready to use
4
4
  * to power modern apps
5
5
  *
6
- * Copyright 2015-2020 Kuzzle
6
+ * Copyright 2015-2022 Kuzzle
7
7
  * mailto: support AT kuzzle.io
8
8
  * website: http://kuzzle.io
9
9
  *
@@ -2,7 +2,7 @@
2
2
  * Kuzzle, a backend software, self-hostable and ready to use
3
3
  * to power modern apps
4
4
  *
5
- * Copyright 2015-2020 Kuzzle
5
+ * Copyright 2015-2022 Kuzzle
6
6
  * mailto: support AT kuzzle.io
7
7
  * website: http://kuzzle.io
8
8
  *
@@ -277,6 +277,27 @@ export declare class KuzzleRequest {
277
277
  * @throws {api.assert.invalid_type} If the fetched parameter is not an object
278
278
  */
279
279
  getObject(name: string, def?: JSONObject | undefined): JSONObject;
280
+ /**
281
+ * Gets a parameter from a request arguments and check with moment.js if the date is an ISO8601 format date
282
+ * or is valid regarding a given custom format (example : YYYY-MM-DD).
283
+ *
284
+ * @param name parameter name.
285
+ * @param format optional parameter to check if the date is valid regarding a format. If not set, the format checked
286
+ * is ISO8601.
287
+ * @throws {api.assert.missing_argument} If parameter not found and no default
288
+ * value provided
289
+ * @throws {api.assert.invalid_type} If parameter value is not a valid date.
290
+ */
291
+ getDate(name: string, format?: string): string;
292
+ /**
293
+ * Gets a parameter from a request arguments and returns it to timestamp format.
294
+ *
295
+ * @param name parameter name.
296
+ * @throws {api.assert.missing_argument} If parameter not found and no default
297
+ * value provided
298
+ * @throws {api.assert.invalid_type} If parameter value is not a valid date.
299
+ */
300
+ getTimestamp(name: string): number;
280
301
  /**
281
302
  * Returns the index specified in the request
282
303
  */
@@ -3,7 +3,7 @@
3
3
  * Kuzzle, a backend software, self-hostable and ready to use
4
4
  * to power modern apps
5
5
  *
6
- * Copyright 2015-2020 Kuzzle
6
+ * Copyright 2015-2022 Kuzzle
7
7
  * mailto: support AT kuzzle.io
8
8
  * website: http://kuzzle.io
9
9
  *
@@ -42,8 +42,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
42
42
  __setModuleDefault(result, mod);
43
43
  return result;
44
44
  };
45
+ var __importDefault = (this && this.__importDefault) || function (mod) {
46
+ return (mod && mod.__esModule) ? mod : { "default": mod };
47
+ };
45
48
  Object.defineProperty(exports, "__esModule", { value: true });
46
49
  exports.Request = exports.KuzzleRequest = void 0;
50
+ const safeObject_1 = require("../../util/safeObject");
51
+ const lodash_1 = require("lodash");
52
+ const moment_1 = __importDefault(require("moment"));
47
53
  const uuid = __importStar(require("uuid"));
48
54
  const nanoid_1 = require("nanoid");
49
55
  const requestInput_1 = require("./requestInput");
@@ -53,8 +59,6 @@ const errors_1 = require("../../kerror/errors");
53
59
  const kerror = __importStar(require("../../kerror"));
54
60
  const types_1 = require("../../types");
55
61
  const assert = __importStar(require("../../util/assertType"));
56
- const safeObject_1 = require("../../util/safeObject");
57
- const lodash_1 = require("lodash");
58
62
  const assertionError = kerror.wrap('api', 'assert');
59
63
  // private properties
60
64
  // \u200b is a zero width space, used to masquerade console.log output
@@ -528,6 +532,48 @@ class KuzzleRequest {
528
532
  getObject(name, def = undefined) {
529
533
  return this._getObject(this.input.args, name, name, def);
530
534
  }
535
+ /**
536
+ * Gets a parameter from a request arguments and check with moment.js if the date is an ISO8601 format date
537
+ * or is valid regarding a given custom format (example : YYYY-MM-DD).
538
+ *
539
+ * @param name parameter name.
540
+ * @param format optional parameter to check if the date is valid regarding a format. If not set, the format checked
541
+ * is ISO8601.
542
+ * @throws {api.assert.missing_argument} If parameter not found and no default
543
+ * value provided
544
+ * @throws {api.assert.invalid_type} If parameter value is not a valid date.
545
+ */
546
+ getDate(name, format) {
547
+ const args = this.input.args;
548
+ if (args[name] === undefined) {
549
+ throw assertionError.get('missing_argument', name);
550
+ }
551
+ if (format && !(0, moment_1.default)(args[name], format, true).isValid()) {
552
+ throw assertionError.get('invalid_type', name, 'date');
553
+ }
554
+ if (!(0, moment_1.default)(args[name], moment_1.default.ISO_8601).isValid()) {
555
+ throw assertionError.get('invalid_type', name, 'date');
556
+ }
557
+ return this.getString(name);
558
+ }
559
+ /**
560
+ * Gets a parameter from a request arguments and returns it to timestamp format.
561
+ *
562
+ * @param name parameter name.
563
+ * @throws {api.assert.missing_argument} If parameter not found and no default
564
+ * value provided
565
+ * @throws {api.assert.invalid_type} If parameter value is not a valid date.
566
+ */
567
+ getTimestamp(name) {
568
+ const args = this.input.args;
569
+ if (args[name] === undefined) {
570
+ throw assertionError.get('missing_argument', name);
571
+ }
572
+ if ((0, moment_1.default)(args[name], true).isValid() === false) {
573
+ throw assertionError.get('invalid_type', name, 'date');
574
+ }
575
+ return this.getInteger(name);
576
+ }
531
577
  /**
532
578
  * Returns the index specified in the request
533
579
  */
@@ -3,7 +3,7 @@
3
3
  * Kuzzle, a backend software, self-hostable and ready to use
4
4
  * to power modern apps
5
5
  *
6
- * Copyright 2015-2020 Kuzzle
6
+ * Copyright 2015-2022 Kuzzle
7
7
  * mailto: support AT kuzzle.io
8
8
  * website: http://kuzzle.io
9
9
  *
@@ -3,7 +3,7 @@
3
3
  * Kuzzle, a backend software, self-hostable and ready to use
4
4
  * to power modern apps
5
5
  *
6
- * Copyright 2015-2020 Kuzzle
6
+ * Copyright 2015-2022 Kuzzle
7
7
  * mailto: support AT kuzzle.io
8
8
  * website: http://kuzzle.io
9
9
  *
@@ -3,7 +3,7 @@
3
3
  * Kuzzle, a backend software, self-hostable and ready to use
4
4
  * to power modern apps
5
5
  *
6
- * Copyright 2015-2020 Kuzzle
6
+ * Copyright 2015-2022 Kuzzle
7
7
  * mailto: support AT kuzzle.io
8
8
  * website: http://kuzzle.io
9
9
  *
@@ -2,7 +2,7 @@
2
2
  * Kuzzle, a backend software, self-hostable and ready to use
3
3
  * to power modern apps
4
4
  *
5
- * Copyright 2015-2020 Kuzzle
5
+ * Copyright 2015-2022 Kuzzle
6
6
  * mailto: support AT kuzzle.io
7
7
  * website: http://kuzzle.io
8
8
  *
@@ -3,7 +3,7 @@
3
3
  * Kuzzle, a backend software, self-hostable and ready to use
4
4
  * to power modern apps
5
5
  *
6
- * Copyright 2015-2020 Kuzzle
6
+ * Copyright 2015-2022 Kuzzle
7
7
  * mailto: support AT kuzzle.io
8
8
  * website: http://kuzzle.io
9
9
  *
@@ -2,7 +2,7 @@
2
2
  * Kuzzle, a backend software, self-hostable and ready to use
3
3
  * to power modern apps
4
4
  *
5
- * Copyright 2015-2020 Kuzzle
5
+ * Copyright 2015-2022 Kuzzle
6
6
  * mailto: support AT kuzzle.io
7
7
  * website: http://kuzzle.io
8
8
  *
@@ -2,7 +2,7 @@
2
2
  * Kuzzle, a backend software, self-hostable and ready to use
3
3
  * to power modern apps
4
4
  *
5
- * Copyright 2015-2020 Kuzzle
5
+ * Copyright 2015-2022 Kuzzle
6
6
  * mailto: support AT kuzzle.io
7
7
  * website: http://kuzzle.io
8
8
  *
@@ -757,15 +757,15 @@ class ClusterNode {
757
757
  'admin:afterRefreshIndexCache',
758
758
  () => this.onIndexCacheRefreshed());
759
759
 
760
- global.kuzzle.on(
760
+ global.kuzzle.onCall(
761
761
  'core:realtime:room:create:after',
762
762
  payload => this.onNewRealtimeRoom(payload));
763
763
 
764
- global.kuzzle.on(
764
+ global.kuzzle.onCall(
765
765
  'core:realtime:subscribe:after',
766
766
  roomId => this.onNewSubscription(roomId));
767
767
 
768
- global.kuzzle.on(
768
+ global.kuzzle.onCall(
769
769
  'core:realtime:unsubscribe:after',
770
770
  roomId => this.onUnsubscription(roomId));
771
771
 
@@ -922,15 +922,15 @@ class ClusterNode {
922
922
  * @param {string} roomId
923
923
  * @return {void}
924
924
  */
925
- async removeRealtimeRoom (roomId) {
926
- const messageId = await this.publisher.sendRemoveRealtimeRoom(roomId);
927
-
925
+ removeRealtimeRoom (roomId) {
926
+ const messageId = this.publisher.sendRemoveRealtimeRoom(roomId);
927
+
928
928
  debug(
929
929
  '[%s] Broadcasted the removal of room %s (message: %d)',
930
930
  this.nodeId,
931
931
  roomId,
932
932
  messageId);
933
-
933
+
934
934
  this.fullState.removeRealtimeRoom(roomId, this.nodeId);
935
935
  }
936
936
 
@@ -2,7 +2,7 @@
2
2
  * Kuzzle, a backend software, self-hostable and ready to use
3
3
  * to power modern apps
4
4
  *
5
- * Copyright 2015-2020 Kuzzle
5
+ * Copyright 2015-2022 Kuzzle
6
6
  * mailto: support AT kuzzle.io
7
7
  * website: http://kuzzle.io
8
8
  *
@@ -3,7 +3,7 @@
3
3
  * Kuzzle, a backend software, self-hostable and ready to use
4
4
  * to power modern apps
5
5
  *
6
- * Copyright 2015-2020 Kuzzle
6
+ * Copyright 2015-2022 Kuzzle
7
7
  * mailto: support AT kuzzle.io
8
8
  * website: http://kuzzle.io
9
9
  *
@@ -2,7 +2,7 @@
2
2
  * Kuzzle, a backend software, self-hostable and ready to use
3
3
  * to power modern apps
4
4
  *
5
- * Copyright 2015-2020 Kuzzle
5
+ * Copyright 2015-2022 Kuzzle
6
6
  * mailto: support AT kuzzle.io
7
7
  * website: http://kuzzle.io
8
8
  *
@@ -216,6 +216,9 @@ class ClusterSubscriber {
216
216
  }
217
217
 
218
218
  try {
219
+ // If we are receiving messages from a node,
220
+ // it means the node is alive so it should counts as an heartbeat
221
+ this.handleHeartbeat();
219
222
  await this.handlers[topic].call(this, message);
220
223
  }
221
224
  catch (e) {
@@ -2,7 +2,7 @@
2
2
  * Kuzzle, a backend software, self-hostable and ready to use
3
3
  * to power modern apps
4
4
  *
5
- * Copyright 2015-2020 Kuzzle
5
+ * Copyright 2015-2022 Kuzzle
6
6
  * mailto: support AT kuzzle.io
7
7
  * website: http://kuzzle.io
8
8
  *
@@ -2,7 +2,7 @@
2
2
  * Kuzzle, a backend software, self-hostable and ready to use
3
3
  * to power modern apps
4
4
  *
5
- * Copyright 2015-2020 Kuzzle
5
+ * Copyright 2015-2022 Kuzzle
6
6
  * mailto: support AT kuzzle.io
7
7
  * website: http://kuzzle.io
8
8
  *
@@ -2,7 +2,7 @@
2
2
  * Kuzzle, a backend software, self-hostable and ready to use
3
3
  * to power modern apps
4
4
  *
5
- * Copyright 2015-2020 Kuzzle
5
+ * Copyright 2015-2022 Kuzzle
6
6
  * mailto: support AT kuzzle.io
7
7
  * website: http://kuzzle.io
8
8
  *
@@ -2,7 +2,7 @@
2
2
  * Kuzzle, a backend software, self-hostable and ready to use
3
3
  * to power modern apps
4
4
  *
5
- * Copyright 2015-2020 Kuzzle
5
+ * Copyright 2015-2022 Kuzzle
6
6
  * mailto: support AT kuzzle.io
7
7
  * website: http://kuzzle.io
8
8
  *
@@ -2,7 +2,7 @@
2
2
  * Kuzzle, a backend software, self-hostable and ready to use
3
3
  * to power modern apps
4
4
  *
5
- * Copyright 2015-2020 Kuzzle
5
+ * Copyright 2015-2022 Kuzzle
6
6
  * mailto: support AT kuzzle.io
7
7
  * website: http://kuzzle.io
8
8
  *
@@ -3,7 +3,7 @@
3
3
  * Kuzzle, a backend software, self-hostable and ready to use
4
4
  * to power modern apps
5
5
  *
6
- * Copyright 2015-2020 Kuzzle
6
+ * Copyright 2015-2022 Kuzzle
7
7
  * mailto: support AT kuzzle.io
8
8
  * website: http://kuzzle.io
9
9
  *
@@ -3,7 +3,7 @@
3
3
  * Kuzzle, a backend software, self-hostable and ready to use
4
4
  * to power modern apps
5
5
  *
6
- * Copyright 2015-2020 Kuzzle
6
+ * Copyright 2015-2022 Kuzzle
7
7
  * mailto: support AT kuzzle.io
8
8
  * website: http://kuzzle.io
9
9
  *
@@ -3,7 +3,7 @@
3
3
  * Kuzzle, a backend software, self-hostable and ready to use
4
4
  * to power modern apps
5
5
  *
6
- * Copyright 2015-2020 Kuzzle
6
+ * Copyright 2015-2022 Kuzzle
7
7
  * mailto: support AT kuzzle.io
8
8
  * website: http://kuzzle.io
9
9
  *
@@ -3,7 +3,7 @@
3
3
  * Kuzzle, a backend software, self-hostable and ready to use
4
4
  * to power modern apps
5
5
  *
6
- * Copyright 2015-2020 Kuzzle
6
+ * Copyright 2015-2022 Kuzzle
7
7
  * mailto: support AT kuzzle.io
8
8
  * website: http://kuzzle.io
9
9
  *
@@ -3,7 +3,7 @@
3
3
  * Kuzzle, a backend software, self-hostable and ready to use
4
4
  * to power modern apps
5
5
  *
6
- * Copyright 2015-2020 Kuzzle
6
+ * Copyright 2015-2022 Kuzzle
7
7
  * mailto: support AT kuzzle.io
8
8
  * website: http://kuzzle.io
9
9
  *
@@ -3,7 +3,7 @@
3
3
  * Kuzzle, a backend software, self-hostable and ready to use
4
4
  * to power modern apps
5
5
  *
6
- * Copyright 2015-2020 Kuzzle
6
+ * Copyright 2015-2022 Kuzzle
7
7
  * mailto: support AT kuzzle.io
8
8
  * website: http://kuzzle.io
9
9
  *
@@ -3,7 +3,7 @@
3
3
  * Kuzzle, a backend software, self-hostable and ready to use
4
4
  * to power modern apps
5
5
  *
6
- * Copyright 2015-2020 Kuzzle
6
+ * Copyright 2015-2022 Kuzzle
7
7
  * mailto: support AT kuzzle.io
8
8
  * website: http://kuzzle.io
9
9
  *
@@ -3,7 +3,7 @@
3
3
  * Kuzzle, a backend software, self-hostable and ready to use
4
4
  * to power modern apps
5
5
  *
6
- * Copyright 2015-2020 Kuzzle
6
+ * Copyright 2015-2022 Kuzzle
7
7
  * mailto: support AT kuzzle.io
8
8
  * website: http://kuzzle.io
9
9
  *
@@ -3,7 +3,7 @@
3
3
  * Kuzzle, a backend software, self-hostable and ready to use
4
4
  * to power modern apps
5
5
  *
6
- * Copyright 2015-2020 Kuzzle
6
+ * Copyright 2015-2022 Kuzzle
7
7
  * mailto: support AT kuzzle.io
8
8
  * website: http://kuzzle.io
9
9
  *
@@ -3,7 +3,7 @@
3
3
  * Kuzzle, a backend software, self-hostable and ready to use
4
4
  * to power modern apps
5
5
  *
6
- * Copyright 2015-2020 Kuzzle
6
+ * Copyright 2015-2022 Kuzzle
7
7
  * mailto: support AT kuzzle.io
8
8
  * website: http://kuzzle.io
9
9
  *
@@ -3,7 +3,7 @@
3
3
  * Kuzzle, a backend software, self-hostable and ready to use
4
4
  * to power modern apps
5
5
  *
6
- * Copyright 2015-2020 Kuzzle
6
+ * Copyright 2015-2022 Kuzzle
7
7
  * mailto: support AT kuzzle.io
8
8
  * website: http://kuzzle.io
9
9
  *
@@ -3,7 +3,7 @@
3
3
  * Kuzzle, a backend software, self-hostable and ready to use
4
4
  * to power modern apps
5
5
  *
6
- * Copyright 2015-2020 Kuzzle
6
+ * Copyright 2015-2022 Kuzzle
7
7
  * mailto: support AT kuzzle.io
8
8
  * website: http://kuzzle.io
9
9
  *
@@ -3,7 +3,7 @@
3
3
  * Kuzzle, a backend software, self-hostable and ready to use
4
4
  * to power modern apps
5
5
  *
6
- * Copyright 2015-2020 Kuzzle
6
+ * Copyright 2015-2022 Kuzzle
7
7
  * mailto: support AT kuzzle.io
8
8
  * website: http://kuzzle.io
9
9
  *
@@ -3,7 +3,7 @@
3
3
  * Kuzzle, a backend software, self-hostable and ready to use
4
4
  * to power modern apps
5
5
  *
6
- * Copyright 2015-2020 Kuzzle
6
+ * Copyright 2015-2022 Kuzzle
7
7
  * mailto: support AT kuzzle.io
8
8
  * website: http://kuzzle.io
9
9
  *
@@ -3,7 +3,7 @@
3
3
  * Kuzzle, a backend software, self-hostable and ready to use
4
4
  * to power modern apps
5
5
  *
6
- * Copyright 2015-2020 Kuzzle
6
+ * Copyright 2015-2022 Kuzzle
7
7
  * mailto: support AT kuzzle.io
8
8
  * website: http://kuzzle.io
9
9
  *
@@ -2,7 +2,7 @@
2
2
  * Kuzzle, a backend software, self-hostable and ready to use
3
3
  * to power modern apps
4
4
  *
5
- * Copyright 2015-2020 Kuzzle
5
+ * Copyright 2015-2022 Kuzzle
6
6
  * mailto: support AT kuzzle.io
7
7
  * website: http://kuzzle.io
8
8
  *
@@ -2,7 +2,7 @@
2
2
  * Kuzzle, a backend software, self-hostable and ready to use
3
3
  * to power modern apps
4
4
  *
5
- * Copyright 2015-2020 Kuzzle
5
+ * Copyright 2015-2022 Kuzzle
6
6
  * mailto: support AT kuzzle.io
7
7
  * website: http://kuzzle.io
8
8
  *
@@ -2,7 +2,7 @@
2
2
  * Kuzzle, a backend software, self-hostable and ready to use
3
3
  * to power modern apps
4
4
  *
5
- * Copyright 2015-2020 Kuzzle
5
+ * Copyright 2015-2022 Kuzzle
6
6
  * mailto: support AT kuzzle.io
7
7
  * website: http://kuzzle.io
8
8
  *
@@ -96,12 +96,17 @@ class AccessLogger {
96
96
  ? Buffer.byteLength(JSON.stringify(request.response)).toString()
97
97
  : '-';
98
98
 
99
- this.worker.postMessage({
100
- connection,
101
- extra,
102
- request: serialized,
103
- size,
104
- });
99
+ try {
100
+ this.worker.postMessage({
101
+ connection,
102
+ extra,
103
+ request: serialized,
104
+ size,
105
+ });
106
+ }
107
+ catch (error) {
108
+ global.kuzzle.log.error(`Failed to write access log for request "${request.id}": ${error.message}`);
109
+ }
105
110
  }
106
111
  }
107
112
 
@@ -2,7 +2,7 @@
2
2
  * Kuzzle, a backend software, self-hostable and ready to use
3
3
  * to power modern apps
4
4
  *
5
- * Copyright 2015-2020 Kuzzle
5
+ * Copyright 2015-2022 Kuzzle
6
6
  * mailto: support AT kuzzle.io
7
7
  * website: http://kuzzle.io
8
8
  *
@@ -2,7 +2,7 @@
2
2
  * Kuzzle, a backend software, self-hostable and ready to use
3
3
  * to power modern apps
4
4
  *
5
- * Copyright 2015-2020 Kuzzle
5
+ * Copyright 2015-2022 Kuzzle
6
6
  * mailto: support AT kuzzle.io
7
7
  * website: http://kuzzle.io
8
8
  *
@@ -2,7 +2,7 @@
2
2
  * Kuzzle, a backend software, self-hostable and ready to use
3
3
  * to power modern apps
4
4
  *
5
- * Copyright 2015-2020 Kuzzle
5
+ * Copyright 2015-2022 Kuzzle
6
6
  * mailto: support AT kuzzle.io
7
7
  * website: http://kuzzle.io
8
8
  *
@@ -33,7 +33,7 @@ const MqttProtocol = require('./protocols/mqttProtocol');
33
33
  const InternalProtocol = require('./protocols/internalProtocol');
34
34
  const HttpWsProtocol = require('./protocols/httpwsProtocol');
35
35
  const Manifest = require('./protocolManifest');
36
- const removeErrorStack = require('./removeErrorStack');
36
+ const { removeStacktrace } = require('../../util/stackTrace');
37
37
  const kerror = require('../../kerror');
38
38
  const { AccessLogger } = require('./accessLogger');
39
39
 
@@ -256,7 +256,7 @@ class EntryPoint {
256
256
 
257
257
  const response = _res.response.toJSON();
258
258
 
259
- cb(removeErrorStack(response));
259
+ cb(removeStacktrace(response));
260
260
  });
261
261
  }
262
262
 
@@ -298,7 +298,7 @@ class EntryPoint {
298
298
  // --------------------------------------------------------------------
299
299
 
300
300
  _broadcast (data) {
301
- const sanitized = removeErrorStack(data);
301
+ const sanitized = removeStacktrace(data);
302
302
 
303
303
  debug('[server] broadcasting data through all protocols: %a', sanitized);
304
304
 
@@ -316,7 +316,7 @@ class EntryPoint {
316
316
  request.setError(networkError.get('shutting_down'));
317
317
  this.logAccess(connection, request);
318
318
 
319
- cb(removeErrorStack(request.response.toJSON()));
319
+ cb(removeStacktrace(request.response.toJSON()));
320
320
  }
321
321
 
322
322
  _notify (data) {
@@ -332,7 +332,7 @@ class EntryPoint {
332
332
  }
333
333
 
334
334
  try {
335
- this.protocols.get(client.protocol).notify(removeErrorStack(data));
335
+ this.protocols.get(client.protocol).notify(removeStacktrace(data));
336
336
  }
337
337
  catch (e) {
338
338
  global.kuzzle.log.error(`[notify] protocol ${client.protocol} failed: ${e.message}`);
@@ -2,7 +2,7 @@
2
2
  * Kuzzle, a backend software, self-hostable and ready to use
3
3
  * to power modern apps
4
4
  *
5
- * Copyright 2015-2020 Kuzzle
5
+ * Copyright 2015-2022 Kuzzle
6
6
  * mailto: support AT kuzzle.io
7
7
  * website: http://kuzzle.io
8
8
  *
@@ -2,7 +2,7 @@
2
2
  * Kuzzle, a backend software, self-hostable and ready to use
3
3
  * to power modern apps
4
4
  *
5
- * Copyright 2015-2020 Kuzzle
5
+ * Copyright 2015-2022 Kuzzle
6
6
  * mailto: support AT kuzzle.io
7
7
  * website: http://kuzzle.io
8
8
  *
@@ -2,7 +2,7 @@
2
2
  * Kuzzle, a backend software, self-hostable and ready to use
3
3
  * to power modern apps
4
4
  *
5
- * Copyright 2015-2020 Kuzzle
5
+ * Copyright 2015-2022 Kuzzle
6
6
  * mailto: support AT kuzzle.io
7
7
  * website: http://kuzzle.io
8
8
  *
@@ -2,7 +2,7 @@
2
2
  * Kuzzle, a backend software, self-hostable and ready to use
3
3
  * to power modern apps
4
4
  *
5
- * Copyright 2015-2020 Kuzzle
5
+ * Copyright 2015-2022 Kuzzle
6
6
  * mailto: support AT kuzzle.io
7
7
  * website: http://kuzzle.io
8
8
  *
@@ -2,7 +2,7 @@
2
2
  * Kuzzle, a backend software, self-hostable and ready to use
3
3
  * to power modern apps
4
4
  *
5
- * Copyright 2015-2020 Kuzzle
5
+ * Copyright 2015-2022 Kuzzle
6
6
  * mailto: support AT kuzzle.io
7
7
  * website: http://kuzzle.io
8
8
  *