kuzzle 2.59.0 → 2.60.0-beta.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 (174) hide show
  1. package/dist/bin/copy-binaries.js +17 -7
  2. package/dist/bin/start-kuzzle-server +17 -7
  3. package/dist/index.d.ts +2 -1
  4. package/dist/index.js +6 -2
  5. package/dist/lib/api/controllers/adminController.d.ts +9 -3
  6. package/dist/lib/api/controllers/adminController.js +42 -26
  7. package/dist/lib/api/controllers/authController.d.ts +15 -5
  8. package/dist/lib/api/controllers/authController.js +35 -20
  9. package/dist/lib/api/controllers/baseController.js +17 -7
  10. package/dist/lib/api/controllers/bulkController.js +17 -7
  11. package/dist/lib/api/controllers/collectionController.js +17 -7
  12. package/dist/lib/api/controllers/debugController.js +17 -7
  13. package/dist/lib/api/controllers/documentController.js +17 -7
  14. package/dist/lib/api/controllers/indexController.d.ts +1 -1
  15. package/dist/lib/api/controllers/memoryStorageController.js +17 -7
  16. package/dist/lib/api/controllers/securityController.d.ts +30 -28
  17. package/dist/lib/api/controllers/securityController.js +18 -8
  18. package/dist/lib/api/controllers/serverController.d.ts +0 -1
  19. package/dist/lib/api/controllers/serverController.js +17 -7
  20. package/dist/lib/api/documentExtractor.js +17 -7
  21. package/dist/lib/api/funnel.js +19 -9
  22. package/dist/lib/api/httpRoutes.d.ts +2 -1
  23. package/dist/lib/api/openapi/OpenApiManager.d.ts +2 -1
  24. package/dist/lib/api/openapi/openApiGenerator.js +1 -2
  25. package/dist/lib/api/request/kuzzleRequest.d.ts +9 -2
  26. package/dist/lib/api/request/kuzzleRequest.js +21 -7
  27. package/dist/lib/api/request/requestContext.d.ts +7 -2
  28. package/dist/lib/api/request/requestContext.js +17 -7
  29. package/dist/lib/api/request/requestInput.d.ts +1 -1
  30. package/dist/lib/api/request/requestInput.js +17 -7
  31. package/dist/lib/api/request/requestResponse.d.ts +2 -2
  32. package/dist/lib/api/request/requestResponse.js +21 -10
  33. package/dist/lib/cluster/command.d.ts +0 -2
  34. package/dist/lib/cluster/command.js +17 -7
  35. package/dist/lib/cluster/idCardHandler.d.ts +3 -2
  36. package/dist/lib/cluster/idCardHandler.js +1 -1
  37. package/dist/lib/cluster/node.js +69 -64
  38. package/dist/lib/cluster/protobuf/command.proto +23 -22
  39. package/dist/lib/cluster/protobuf/sync.proto +91 -85
  40. package/dist/lib/cluster/publisher.js +17 -7
  41. package/dist/lib/cluster/state.js +17 -7
  42. package/dist/lib/cluster/subscriber.d.ts +0 -2
  43. package/dist/lib/cluster/subscriber.js +17 -7
  44. package/dist/lib/cluster/workers/IDCardRenewer.d.ts +0 -1
  45. package/dist/lib/config/index.js +20 -14
  46. package/dist/lib/core/auth/formatProcessing.d.ts +1 -1
  47. package/dist/lib/core/auth/formatProcessing.js +3 -3
  48. package/dist/lib/core/auth/passportResponse.d.ts +0 -1
  49. package/dist/lib/core/auth/passportWrapper.js +22 -8
  50. package/dist/lib/core/backend/backend.js +17 -7
  51. package/dist/lib/core/backend/backendConfig.d.ts +1 -1
  52. package/dist/lib/core/backend/backendConfig.js +17 -7
  53. package/dist/lib/core/backend/backendController.js +17 -7
  54. package/dist/lib/core/backend/backendErrors.js +17 -7
  55. package/dist/lib/core/backend/backendHook.js +17 -7
  56. package/dist/lib/core/backend/backendImport.js +17 -7
  57. package/dist/lib/core/backend/backendPipe.d.ts +4 -1
  58. package/dist/lib/core/backend/backendPipe.js +17 -7
  59. package/dist/lib/core/backend/backendPlugin.js +17 -7
  60. package/dist/lib/core/backend/backendStorage.js +8 -8
  61. package/dist/lib/core/backend/backendSubscription.js +17 -7
  62. package/dist/lib/core/backend/backendVault.js +17 -7
  63. package/dist/lib/core/backend/internalLogger.d.ts +7 -7
  64. package/dist/lib/core/debug/kuzzleDebugger.js +17 -7
  65. package/dist/lib/core/network/accessLogger.d.ts +0 -1
  66. package/dist/lib/core/network/accessLogger.js +17 -7
  67. package/dist/lib/core/network/clientConnection.js +17 -7
  68. package/dist/lib/core/network/context.d.ts +0 -1
  69. package/dist/lib/core/network/entryPoint.js +17 -7
  70. package/dist/lib/core/network/httpRouter/routePart.js +17 -7
  71. package/dist/lib/core/network/protocols/httpMessage.d.ts +0 -2
  72. package/dist/lib/core/network/protocols/httpwsProtocol.d.ts +0 -3
  73. package/dist/lib/core/network/protocols/httpwsProtocol.js +29 -12
  74. package/dist/lib/core/network/protocols/mqttProtocol.d.ts +1 -2
  75. package/dist/lib/core/network/protocols/mqttProtocol.js +31 -10
  76. package/dist/lib/core/network/router.js +17 -7
  77. package/dist/lib/core/plugin/plugin.js +17 -7
  78. package/dist/lib/core/plugin/pluginContext.d.ts +20 -9
  79. package/dist/lib/core/plugin/pluginContext.js +39 -24
  80. package/dist/lib/core/plugin/pluginsManager.js +17 -7
  81. package/dist/lib/core/realtime/channel.js +17 -7
  82. package/dist/lib/core/realtime/hotelClerk.d.ts +3 -2
  83. package/dist/lib/core/realtime/hotelClerk.js +17 -7
  84. package/dist/lib/core/realtime/notifier.js +17 -7
  85. package/dist/lib/core/security/profileRepository.js +17 -7
  86. package/dist/lib/core/security/roleRepository.js +17 -7
  87. package/dist/lib/core/security/securityLoader.js +17 -7
  88. package/dist/lib/core/security/tokenRepository.js +18 -8
  89. package/dist/lib/core/security/userRepository.js +17 -7
  90. package/dist/lib/core/shared/ObjectRepository.js +20 -7
  91. package/dist/lib/core/shared/abstractManifest.js +17 -7
  92. package/dist/lib/core/shared/sdk/embeddedSdk.js +20 -8
  93. package/dist/lib/core/shared/sdk/funnelProtocol.js +17 -7
  94. package/dist/lib/core/shared/store.d.ts +11 -1
  95. package/dist/lib/core/shared/store.js +26 -30
  96. package/dist/lib/core/statistics/statistics.d.ts +0 -1
  97. package/dist/lib/core/statistics/statistics.js +17 -7
  98. package/dist/lib/core/storage/clientAdapter.d.ts +4 -6
  99. package/dist/lib/core/storage/clientAdapter.js +24 -18
  100. package/dist/lib/core/storage/indexCache.js +17 -7
  101. package/dist/lib/core/validation/specification.js +1 -2
  102. package/dist/lib/core/validation/types/date.js +17 -7
  103. package/dist/lib/core/validation/types/enum.js +17 -7
  104. package/dist/lib/core/validation/types/geoShape.js +17 -7
  105. package/dist/lib/core/validation/types/geoShapeUtils.js +6 -7
  106. package/dist/lib/core/validation/validation.js +17 -7
  107. package/dist/lib/core/validation/validationUtils.js +24 -15
  108. package/dist/lib/kerror/codes/index.js +20 -10
  109. package/dist/lib/kerror/errors/kuzzleError.js +18 -8
  110. package/dist/lib/kerror/index.js +31 -18
  111. package/dist/lib/kuzzle/Logger.js +4 -3
  112. package/dist/lib/kuzzle/dumpGenerator.js +17 -7
  113. package/dist/lib/kuzzle/event/KuzzleEventEmitter.d.ts +3 -3
  114. package/dist/lib/kuzzle/event/KuzzleEventEmitter.js +17 -7
  115. package/dist/lib/kuzzle/event/pipeRunner.js +17 -7
  116. package/dist/lib/kuzzle/internalIndexHandler.js +37 -32
  117. package/dist/lib/kuzzle/kuzzle.d.ts +13 -8
  118. package/dist/lib/kuzzle/kuzzle.js +103 -128
  119. package/dist/lib/model/security/profile.js +17 -7
  120. package/dist/lib/model/security/role.js +17 -7
  121. package/dist/lib/model/security/user.js +17 -7
  122. package/dist/lib/model/storage/apiKey.d.ts +1 -1
  123. package/dist/lib/model/storage/apiKey.js +17 -7
  124. package/dist/lib/service/cache/redis.js +40 -9
  125. package/dist/lib/service/service.js +17 -7
  126. package/dist/lib/service/storage/7/elasticsearch.d.ts +36 -25
  127. package/dist/lib/service/storage/7/elasticsearch.js +73 -55
  128. package/dist/lib/service/storage/8/elasticsearch.d.ts +47 -36
  129. package/dist/lib/service/storage/8/elasticsearch.js +73 -55
  130. package/dist/lib/service/storage/Elasticsearch.d.ts +10 -4
  131. package/dist/lib/types/HttpStream.d.ts +0 -1
  132. package/dist/lib/types/Plugin.js +17 -7
  133. package/dist/lib/types/config/SecurityConfiguration.d.ts +0 -2
  134. package/dist/lib/types/config/storageEngine/StorageEngineElasticsearchConfiguration.d.ts +5 -0
  135. package/dist/lib/types/controllers/GetCurrentUserResponse.d.ts +5 -0
  136. package/dist/lib/types/controllers/GetCurrentUserResponse.js +3 -0
  137. package/dist/lib/types/controllers/ResetSecurityResult.d.ts +5 -0
  138. package/dist/lib/types/controllers/ResetSecurityResult.js +3 -0
  139. package/dist/lib/types/controllers/adminController.type.d.ts +7 -5
  140. package/dist/lib/types/controllers/authController.type.d.ts +7 -5
  141. package/dist/lib/types/core/auth/Serialized.d.ts +14 -0
  142. package/dist/lib/types/core/auth/Serialized.js +3 -0
  143. package/dist/lib/types/core/auth/formatProcessing.type.d.ts +5 -11
  144. package/dist/lib/types/events/EventProtocol.d.ts +0 -2
  145. package/dist/lib/types/index.d.ts +1 -0
  146. package/dist/lib/types/index.js +1 -0
  147. package/dist/lib/types/storage/8/Elasticsearch.d.ts +4 -3
  148. package/dist/lib/util/array.d.ts +1 -1
  149. package/dist/lib/util/array.js +7 -6
  150. package/dist/lib/util/assertType.js +5 -6
  151. package/dist/lib/util/async.js +1 -2
  152. package/dist/lib/util/asyncStore.d.ts +0 -1
  153. package/dist/lib/util/bufferedPassThrough.d.ts +0 -3
  154. package/dist/lib/util/crypto.js +1 -2
  155. package/dist/lib/util/debug.d.ts +0 -1
  156. package/dist/lib/util/debug.js +17 -7
  157. package/dist/lib/util/distributedLock.d.ts +27 -4
  158. package/dist/lib/util/distributedLock.js +69 -16
  159. package/dist/lib/util/dump-collection.d.ts +2 -2
  160. package/dist/lib/util/dump-collection.js +22 -13
  161. package/dist/lib/util/esRequest.js +1 -2
  162. package/dist/lib/util/extractFields.d.ts +16 -7
  163. package/dist/lib/util/extractFields.js +1 -10
  164. package/dist/lib/util/koncordeCompat.js +22 -13
  165. package/dist/lib/util/mutex.d.ts +4 -4
  166. package/dist/lib/util/mutex.js +21 -11
  167. package/dist/lib/util/name-generator.js +2 -2
  168. package/dist/lib/util/requestAssertions.js +27 -18
  169. package/dist/lib/util/safeObject.js +3 -4
  170. package/dist/lib/util/stackTrace.js +2 -3
  171. package/dist/lib/util/thrown.js +1 -2
  172. package/dist/lib/util/time.js +1 -2
  173. package/dist/package.json +22 -15
  174. package/package.json +22 -15
@@ -15,7 +15,7 @@ interface LoadMappingsOptions extends WriteScopeOptions {
15
15
  }
16
16
  /** `{ index: { collection: payload } }`, as the fixtures and mappings
17
17
  * import payloads are shaped. */
18
- type ImportPayload = Record<string, Record<string, JSONObject>>;
18
+ type ImportPayload = Record<string, Record<string, JSONObject[]>>;
19
19
  /**
20
20
  * Storage client adapter to perform validation on index/collection existence
21
21
  * and to maintain the index/collection cache.
@@ -23,10 +23,8 @@ type ImportPayload = Record<string, Record<string, JSONObject>>;
23
23
  declare class ClientAdapter {
24
24
  es: Elasticsearch;
25
25
  /**
26
- * The version-specific ES service (ES7 or ES8). Its type is whatever
27
- * `Elasticsearch` exposes — which is `any` today, and is tracked there as
28
- * TD-13; referencing it rather than re-writing `any` keeps that one hole
29
- * counted once, at its source.
26
+ * The version-specific ES service: `ES7 | ES8`, as `Elasticsearch` declares
27
+ * it. Each call below type-checks against both.
30
28
  */
31
29
  client: Elasticsearch["client"];
32
30
  scope: storeScopeEnum;
@@ -93,7 +91,7 @@ declare class ClientAdapter {
93
91
  * @returns {Promise}
94
92
  */
95
93
  loadFixtures(fixtures?: ImportPayload, { refresh }?: {
96
- refresh?: string;
94
+ refresh?: boolean | "wait_for";
97
95
  }): Promise<void>;
98
96
  /**
99
97
  * Load database mappings into Kuzzle
@@ -35,18 +35,28 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
35
35
  }) : function(o, v) {
36
36
  o["default"] = v;
37
37
  });
38
- var __importStar = (this && this.__importStar) || function (mod) {
39
- if (mod && mod.__esModule) return mod;
40
- var result = {};
41
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
42
- __setModuleDefault(result, mod);
43
- return result;
44
- };
38
+ var __importStar = (this && this.__importStar) || (function () {
39
+ var ownKeys = function(o) {
40
+ ownKeys = Object.getOwnPropertyNames || function (o) {
41
+ var ar = [];
42
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
43
+ return ar;
44
+ };
45
+ return ownKeys(o);
46
+ };
47
+ return function (mod) {
48
+ if (mod && mod.__esModule) return mod;
49
+ var result = {};
50
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
51
+ __setModuleDefault(result, mod);
52
+ return result;
53
+ };
54
+ })();
45
55
  const Elasticsearch_1 = require("../../service/storage/Elasticsearch");
46
56
  const indexCache_1 = require("./indexCache");
47
57
  const safeObject_1 = require("../../util/safeObject");
48
58
  const kerror = __importStar(require("../../kerror"));
49
- const mutex_1 = require("../../util/mutex"); // NOSONAR: see loadMappings
59
+ const distributedLock_1 = require("../../util/distributedLock");
50
60
  require("../../types/Global");
51
61
  const servicesError = kerror.wrap("services", "storage");
52
62
  /**
@@ -904,12 +914,11 @@ class ClientAdapter {
904
914
  if (!(0, safeObject_1.isPlainObject)(fixtures)) {
905
915
  throw kerror.get("api", "assert", "invalid_argument", fixtures, "object");
906
916
  }
907
- // NOSONAR: `Mutex` is deprecated in favour of `withLock`, but the two use
908
- // incompatible acquisition/TTL formats and must not contend on the same
909
- // key — swapping it is a behaviour change, deferred to #2894.
910
- const mutex = new mutex_1.Mutex("loadMappings", { timeout: -1, ttl: 60000 }); // NOSONAR
911
- await mutex.lock();
912
- try {
917
+ // Mapping loads run one at a time across the cluster, with no retry
918
+ // limit (the `Mutex` it replaces waited forever too). The lock is
919
+ // refreshed while the mappings load; if it is lost, `loadMappings`
920
+ // rejects with `MutexLockLostError`.
921
+ await (0, distributedLock_1.withLock)("loadMappings", async () => {
913
922
  for (const [index, collections] of Object.entries(fixtures)) {
914
923
  if (!(0, safeObject_1.isPlainObject)(collections)) {
915
924
  throw kerror.get("api", "assert", "invalid_argument", collections, "object");
@@ -918,10 +927,7 @@ class ClientAdapter {
918
927
  await this._loadCollectionMappings(index, collection, mappings, options);
919
928
  }
920
929
  }
921
- }
922
- finally {
923
- await mutex.unlock();
924
- }
930
+ }, { retryAttempts: Number.POSITIVE_INFINITY, ttl: 60000 });
925
931
  }
926
932
  /**
927
933
  * Creates one index/collection pair from an import payload. Extracted from
@@ -35,13 +35,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
35
35
  }) : function(o, v) {
36
36
  o["default"] = v;
37
37
  });
38
- var __importStar = (this && this.__importStar) || function (mod) {
39
- if (mod && mod.__esModule) return mod;
40
- var result = {};
41
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
42
- __setModuleDefault(result, mod);
43
- return result;
44
- };
38
+ var __importStar = (this && this.__importStar) || (function () {
39
+ var ownKeys = function(o) {
40
+ ownKeys = Object.getOwnPropertyNames || function (o) {
41
+ var ar = [];
42
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
43
+ return ar;
44
+ };
45
+ return ownKeys(o);
46
+ };
47
+ return function (mod) {
48
+ if (mod && mod.__esModule) return mod;
49
+ var result = {};
50
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
51
+ __setModuleDefault(result, mod);
52
+ return result;
53
+ };
54
+ })();
45
55
  Object.defineProperty(exports, "__esModule", { value: true });
46
56
  exports.IndexCache = void 0;
47
57
  const kerror = __importStar(require("../../kerror"));
@@ -20,7 +20,7 @@
20
20
  * limitations under the License.
21
21
  */
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.configuredSpecifications = void 0;
23
+ exports.configuredSpecifications = configuredSpecifications;
24
24
  /**
25
25
  * The configuration's startup specifications (`validation`), read as what
26
26
  * they are. The configuration's type declares them `Record<string, unknown>`
@@ -30,5 +30,4 @@ exports.configuredSpecifications = void 0;
30
30
  function configuredSpecifications() {
31
31
  return global.kuzzle.config.validation;
32
32
  }
33
- exports.configuredSpecifications = configuredSpecifications;
34
33
  //# sourceMappingURL=specification.js.map
@@ -35,13 +35,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
35
35
  }) : function(o, v) {
36
36
  o["default"] = v;
37
37
  });
38
- var __importStar = (this && this.__importStar) || function (mod) {
39
- if (mod && mod.__esModule) return mod;
40
- var result = {};
41
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
42
- __setModuleDefault(result, mod);
43
- return result;
44
- };
38
+ var __importStar = (this && this.__importStar) || (function () {
39
+ var ownKeys = function(o) {
40
+ ownKeys = Object.getOwnPropertyNames || function (o) {
41
+ var ar = [];
42
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
43
+ return ar;
44
+ };
45
+ return ownKeys(o);
46
+ };
47
+ return function (mod) {
48
+ if (mod && mod.__esModule) return mod;
49
+ var result = {};
50
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
51
+ __setModuleDefault(result, mod);
52
+ return result;
53
+ };
54
+ })();
45
55
  var __importDefault = (this && this.__importDefault) || function (mod) {
46
56
  return (mod && mod.__esModule) ? mod : { "default": mod };
47
57
  };
@@ -35,13 +35,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
35
35
  }) : function(o, v) {
36
36
  o["default"] = v;
37
37
  });
38
- var __importStar = (this && this.__importStar) || function (mod) {
39
- if (mod && mod.__esModule) return mod;
40
- var result = {};
41
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
42
- __setModuleDefault(result, mod);
43
- return result;
44
- };
38
+ var __importStar = (this && this.__importStar) || (function () {
39
+ var ownKeys = function(o) {
40
+ ownKeys = Object.getOwnPropertyNames || function (o) {
41
+ var ar = [];
42
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
43
+ return ar;
44
+ };
45
+ return ownKeys(o);
46
+ };
47
+ return function (mod) {
48
+ if (mod && mod.__esModule) return mod;
49
+ var result = {};
50
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
51
+ __setModuleDefault(result, mod);
52
+ return result;
53
+ };
54
+ })();
45
55
  var __importDefault = (this && this.__importDefault) || function (mod) {
46
56
  return (mod && mod.__esModule) ? mod : { "default": mod };
47
57
  };
@@ -35,13 +35,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
35
35
  }) : function(o, v) {
36
36
  o["default"] = v;
37
37
  });
38
- var __importStar = (this && this.__importStar) || function (mod) {
39
- if (mod && mod.__esModule) return mod;
40
- var result = {};
41
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
42
- __setModuleDefault(result, mod);
43
- return result;
44
- };
38
+ var __importStar = (this && this.__importStar) || (function () {
39
+ var ownKeys = function(o) {
40
+ ownKeys = Object.getOwnPropertyNames || function (o) {
41
+ var ar = [];
42
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
43
+ return ar;
44
+ };
45
+ return ownKeys(o);
46
+ };
47
+ return function (mod) {
48
+ if (mod && mod.__esModule) return mod;
49
+ var result = {};
50
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
51
+ __setModuleDefault(result, mod);
52
+ return result;
53
+ };
54
+ })();
45
55
  var __importDefault = (this && this.__importDefault) || function (mod) {
46
56
  return (mod && mod.__esModule) ? mod : { "default": mod };
47
57
  };
@@ -20,7 +20,12 @@
20
20
  * limitations under the License.
21
21
  */
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.isEnvelope = exports.isPolygon = exports.isPolygonPart = exports.isLine = exports.isPointEqual = exports.isPoint = void 0;
23
+ exports.isPoint = isPoint;
24
+ exports.isPointEqual = isPointEqual;
25
+ exports.isLine = isLine;
26
+ exports.isPolygonPart = isPolygonPart;
27
+ exports.isPolygon = isPolygon;
28
+ exports.isEnvelope = isEnvelope;
24
29
  /**
25
30
  * The coordinate predicates a GeoJSON-like shape is checked against.
26
31
  *
@@ -39,37 +44,31 @@ function isPoint(point) {
39
44
  point[1] < -90 ||
40
45
  point[1] > 90);
41
46
  }
42
- exports.isPoint = isPoint;
43
47
  function isPointEqual(pointA, pointB) {
44
48
  return pointA[0] === pointB[0] && pointA[1] === pointB[1];
45
49
  }
46
- exports.isPointEqual = isPointEqual;
47
50
  function isLine(line) {
48
51
  if (!Array.isArray(line) || line.length < 2) {
49
52
  return false;
50
53
  }
51
54
  return line.every((point) => isPoint(point));
52
55
  }
53
- exports.isLine = isLine;
54
56
  function isPolygonPart(polygonPart) {
55
57
  return (Array.isArray(polygonPart) &&
56
58
  polygonPart.length >= 4 &&
57
59
  isLine(polygonPart) &&
58
60
  isPointEqual(polygonPart[0], polygonPart.at(-1)));
59
61
  }
60
- exports.isPolygonPart = isPolygonPart;
61
62
  function isPolygon(polygon) {
62
63
  if (!Array.isArray(polygon)) {
63
64
  return false;
64
65
  }
65
66
  return polygon.every((polygonPart) => isPolygonPart(polygonPart));
66
67
  }
67
- exports.isPolygon = isPolygon;
68
68
  function isEnvelope(envelope) {
69
69
  if (!Array.isArray(envelope) || envelope.length !== 2) {
70
70
  return false;
71
71
  }
72
72
  return isPoint(envelope[0]) && isPoint(envelope[1]);
73
73
  }
74
- exports.isEnvelope = isEnvelope;
75
74
  //# sourceMappingURL=geoShapeUtils.js.map
@@ -35,13 +35,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
35
35
  }) : function(o, v) {
36
36
  o["default"] = v;
37
37
  });
38
- var __importStar = (this && this.__importStar) || function (mod) {
39
- if (mod && mod.__esModule) return mod;
40
- var result = {};
41
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
42
- __setModuleDefault(result, mod);
43
- return result;
44
- };
38
+ var __importStar = (this && this.__importStar) || (function () {
39
+ var ownKeys = function(o) {
40
+ ownKeys = Object.getOwnPropertyNames || function (o) {
41
+ var ar = [];
42
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
43
+ return ar;
44
+ };
45
+ return ownKeys(o);
46
+ };
47
+ return function (mod) {
48
+ if (mod && mod.__esModule) return mod;
49
+ var result = {};
50
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
51
+ __setModuleDefault(result, mod);
52
+ return result;
53
+ };
54
+ })();
45
55
  var __importDefault = (this && this.__importDefault) || function (mod) {
46
56
  return (mod && mod.__esModule) ? mod : { "default": mod };
47
57
  };
@@ -35,15 +35,31 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
35
35
  }) : function(o, v) {
36
36
  o["default"] = v;
37
37
  });
38
- var __importStar = (this && this.__importStar) || function (mod) {
39
- if (mod && mod.__esModule) return mod;
40
- var result = {};
41
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
42
- __setModuleDefault(result, mod);
43
- return result;
44
- };
38
+ var __importStar = (this && this.__importStar) || (function () {
39
+ var ownKeys = function(o) {
40
+ ownKeys = Object.getOwnPropertyNames || function (o) {
41
+ var ar = [];
42
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
43
+ return ar;
44
+ };
45
+ return ownKeys(o);
46
+ };
47
+ return function (mod) {
48
+ if (mod && mod.__esModule) return mod;
49
+ var result = {};
50
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
51
+ __setModuleDefault(result, mod);
52
+ return result;
53
+ };
54
+ })();
45
55
  Object.defineProperty(exports, "__esModule", { value: true });
46
- exports.getValidationConfiguration = exports.manageErrorMessage = exports.throwErrorMessage = exports.storeErrorMessage = exports.getParent = exports.curateStructuredFields = exports.checkAllowedProperties = void 0;
56
+ exports.checkAllowedProperties = checkAllowedProperties;
57
+ exports.curateStructuredFields = curateStructuredFields;
58
+ exports.getParent = getParent;
59
+ exports.storeErrorMessage = storeErrorMessage;
60
+ exports.throwErrorMessage = throwErrorMessage;
61
+ exports.manageErrorMessage = manageErrorMessage;
62
+ exports.getValidationConfiguration = getValidationConfiguration;
47
63
  const kerror = __importStar(require("../../kerror"));
48
64
  const safeObject_1 = require("../../util/safeObject");
49
65
  const specification_1 = require("./specification");
@@ -57,7 +73,6 @@ function checkAllowedProperties(object, allowedProperties) {
57
73
  }
58
74
  return !Object.keys(object).some((propertyName) => !allowedProperties.includes(propertyName));
59
75
  }
60
- exports.checkAllowedProperties = checkAllowedProperties;
61
76
  /**
62
77
  * Assembles curated fields, grouped by depth, into the tree the validator
63
78
  * walks. Depth counting starts at 1.
@@ -88,7 +103,6 @@ function curateStructuredFields(typeAllowsChildren, fields, maxDepth) {
88
103
  }
89
104
  return structuredFields;
90
105
  }
91
- exports.curateStructuredFields = curateStructuredFields;
92
106
  /**
93
107
  * Walks a field's path down the tree and answers the node that must hold it.
94
108
  *
@@ -108,7 +122,6 @@ function getParent(structuredFields, fieldPath) {
108
122
  }
109
123
  return pointer;
110
124
  }
111
- exports.getParent = getParent;
112
125
  /**
113
126
  * Files a validation message, or throws it.
114
127
  *
@@ -132,7 +145,6 @@ function storeErrorMessage(errorContext, errorHolder, message) {
132
145
  const messages = (pointer.messages ?? (pointer.messages = []));
133
146
  messages.push(message);
134
147
  }
135
- exports.storeErrorMessage = storeErrorMessage;
136
148
  function throwErrorMessage(errorContext, message) {
137
149
  if (errorContext === "document") {
138
150
  throw kerror.get("validation", "check", "failed_document", message);
@@ -140,7 +152,6 @@ function throwErrorMessage(errorContext, message) {
140
152
  // Everything that is not the "document" literal is a field path.
141
153
  throw kerror.get("validation", "check", "failed_field", Array.isArray(errorContext) ? errorContext.join(".") : errorContext, message);
142
154
  }
143
- exports.throwErrorMessage = throwErrorMessage;
144
155
  function manageErrorMessage(errorContext, errorHolder, message, structured) {
145
156
  if (!structured) {
146
157
  throwErrorMessage(errorContext, message);
@@ -153,7 +164,6 @@ function manageErrorMessage(errorContext, errorHolder, message, structured) {
153
164
  }
154
165
  storeErrorMessage(errorContext, errorHolder, message);
155
166
  }
156
- exports.manageErrorMessage = manageErrorMessage;
157
167
  /**
158
168
  * Reads every stored specification, falling back to the one in the
159
169
  * configuration when the internal index holds none — the database is not
@@ -186,5 +196,4 @@ function getValidationConfiguration() {
186
196
  return validation;
187
197
  });
188
198
  }
189
- exports.getValidationConfiguration = getValidationConfiguration;
190
199
  //# sourceMappingURL=validationUtils.js.map
@@ -35,18 +35,30 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
35
35
  }) : function(o, v) {
36
36
  o["default"] = v;
37
37
  });
38
- var __importStar = (this && this.__importStar) || function (mod) {
39
- if (mod && mod.__esModule) return mod;
40
- var result = {};
41
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
42
- __setModuleDefault(result, mod);
43
- return result;
44
- };
38
+ var __importStar = (this && this.__importStar) || (function () {
39
+ var ownKeys = function(o) {
40
+ ownKeys = Object.getOwnPropertyNames || function (o) {
41
+ var ar = [];
42
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
43
+ return ar;
44
+ };
45
+ return ownKeys(o);
46
+ };
47
+ return function (mod) {
48
+ if (mod && mod.__esModule) return mod;
49
+ var result = {};
50
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
51
+ __setModuleDefault(result, mod);
52
+ return result;
53
+ };
54
+ })();
45
55
  var __importDefault = (this && this.__importDefault) || function (mod) {
46
56
  return (mod && mod.__esModule) ? mod : { "default": mod };
47
57
  };
48
58
  Object.defineProperty(exports, "__esModule", { value: true });
49
- exports.loadPluginsErrors = exports.domains = exports.checkDomains = void 0;
59
+ exports.domains = void 0;
60
+ exports.checkDomains = checkDomains;
61
+ exports.loadPluginsErrors = loadPluginsErrors;
50
62
  const assert_1 = __importDefault(require("assert"));
51
63
  const errors = __importStar(require("../errors"));
52
64
  const safeObject_1 = require("../../util/safeObject");
@@ -128,7 +140,6 @@ function checkDomains(errorCodesFiles, options = { plugin: false }) {
128
140
  checkSubdomains(domain, options);
129
141
  }
130
142
  }
131
- exports.checkDomains = checkDomains;
132
143
  function loadPluginsErrors(pluginManifest, pluginCode) {
133
144
  domains.plugin.subDomains[pluginManifest.name] = {
134
145
  code: pluginCode,
@@ -136,6 +147,5 @@ function loadPluginsErrors(pluginManifest, pluginCode) {
136
147
  };
137
148
  checkDomains({ plugin: domains.plugin }, { plugin: true });
138
149
  }
139
- exports.loadPluginsErrors = loadPluginsErrors;
140
150
  checkDomains(domains);
141
151
  //# sourceMappingURL=index.js.map
@@ -35,13 +35,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
35
35
  }) : function(o, v) {
36
36
  o["default"] = v;
37
37
  });
38
- var __importStar = (this && this.__importStar) || function (mod) {
39
- if (mod && mod.__esModule) return mod;
40
- var result = {};
41
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
42
- __setModuleDefault(result, mod);
43
- return result;
44
- };
38
+ var __importStar = (this && this.__importStar) || (function () {
39
+ var ownKeys = function(o) {
40
+ ownKeys = Object.getOwnPropertyNames || function (o) {
41
+ var ar = [];
42
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
43
+ return ar;
44
+ };
45
+ return ownKeys(o);
46
+ };
47
+ return function (mod) {
48
+ if (mod && mod.__esModule) return mod;
49
+ var result = {};
50
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
51
+ __setModuleDefault(result, mod);
52
+ return result;
53
+ };
54
+ })();
45
55
  Object.defineProperty(exports, "__esModule", { value: true });
46
56
  exports.KuzzleError = void 0;
47
57
  const util = __importStar(require("util"));
@@ -50,7 +60,7 @@ const util = __importStar(require("util"));
50
60
  * for an error built in another realm, which `instanceof` does not, and false
51
61
  * for an object that merely has `Error.prototype`. Node deprecates it in
52
62
  * favour of `Error.isError`, which needs Node 24 while this package supports
53
- * `>=20` — hence the NOSONAR. Revisit when the floor moves.
63
+ * `>=22.12` — hence the NOSONAR. Revisit when the floor reaches Node 24.
54
64
  */
55
65
  function isError(value) {
56
66
  return util.types.isNativeError(value); // NOSONAR
@@ -35,15 +35,32 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
35
35
  }) : function(o, v) {
36
36
  o["default"] = v;
37
37
  });
38
- var __importStar = (this && this.__importStar) || function (mod) {
39
- if (mod && mod.__esModule) return mod;
40
- var result = {};
41
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
42
- __setModuleDefault(result, mod);
43
- return result;
44
- };
38
+ var __importStar = (this && this.__importStar) || (function () {
39
+ var ownKeys = function(o) {
40
+ ownKeys = Object.getOwnPropertyNames || function (o) {
41
+ var ar = [];
42
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
43
+ return ar;
44
+ };
45
+ return ownKeys(o);
46
+ };
47
+ return function (mod) {
48
+ if (mod && mod.__esModule) return mod;
49
+ var result = {};
50
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
51
+ __setModuleDefault(result, mod);
52
+ return result;
53
+ };
54
+ })();
45
55
  Object.defineProperty(exports, "__esModule", { value: true });
46
- exports.wrap = exports.getFrom = exports.reject = exports.get = exports.rawWrap = exports.rawGetFrom = exports.rawReject = exports.rawGet = void 0;
56
+ exports.rawGet = rawGet;
57
+ exports.rawReject = rawReject;
58
+ exports.rawGetFrom = rawGetFrom;
59
+ exports.rawWrap = rawWrap;
60
+ exports.get = get;
61
+ exports.reject = reject;
62
+ exports.getFrom = getFrom;
63
+ exports.wrap = wrap;
47
64
  const util_1 = require("util");
48
65
  const codes_1 = require("./codes");
49
66
  const errors = __importStar(require("./errors"));
@@ -139,7 +156,6 @@ function rawGet(domains, domain, subdomain, error, ...placeholders) {
139
156
  }
140
157
  return kerror;
141
158
  }
142
- exports.rawGet = rawGet;
143
159
  /**
144
160
  * Removes the first lines of the stacktrace because they are related
145
161
  * to internal mechanisms.
@@ -185,10 +201,11 @@ function cleanStackTrace(error) {
185
201
  * @param error - Error name: (eg: 'index_not_found')
186
202
  * @param placeholders - Placeholders value to inject in error message
187
203
  */
188
- function rawReject(domains, domain, subdomain, error, ...placeholders) {
204
+ function rawReject(domains, domain, subdomain, error, ...placeholders
205
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- kept for v2 compatibility, see docs/v3-breaking-changes.md
206
+ ) {
189
207
  return Promise.reject(rawGet(domains, domain, subdomain, error, ...placeholders));
190
208
  }
191
- exports.rawReject = rawReject;
192
209
  /**
193
210
  * Construct and return the corresponding error, with its stack
194
211
  * trace derivated from a provided source error
@@ -220,7 +237,6 @@ source, domain, subdomain, error, ...placeholders) {
220
237
  }
221
238
  return derivedError;
222
239
  }
223
- exports.rawGetFrom = rawGetFrom;
224
240
  /**
225
241
  * Wrap error functions with the provided domain and subdomain.
226
242
  */
@@ -231,7 +247,6 @@ function rawWrap(domains, domain, subdomain) {
231
247
  reject: (error, ...placeholders) => rawReject(domains, domain, subdomain, error, ...placeholders),
232
248
  };
233
249
  }
234
- exports.rawWrap = rawWrap;
235
250
  /**
236
251
  * Construct and return the corresponding error
237
252
  *
@@ -244,7 +259,6 @@ exports.rawWrap = rawWrap;
244
259
  function get(domain, subdomain, error, ...placeholders) {
245
260
  return rawGet(codes_1.domains, domain, subdomain, error, ...placeholders);
246
261
  }
247
- exports.get = get;
248
262
  /**
249
263
  * Returns a promise rejected with the corresponding error
250
264
  *
@@ -253,10 +267,11 @@ exports.get = get;
253
267
  * @param error - Error name: (eg: 'index_not_found')
254
268
  * @param placeholders - Placeholders value to inject in error message
255
269
  */
256
- function reject(domain, subdomain, error, ...placeholders) {
270
+ function reject(domain, subdomain, error, ...placeholders
271
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- kept for v2 compatibility, see docs/v3-breaking-changes.md
272
+ ) {
257
273
  return rawReject(codes_1.domains, domain, subdomain, error, ...placeholders);
258
274
  }
259
- exports.reject = reject;
260
275
  /**
261
276
  * Construct and return the corresponding error, with its stack
262
277
  * trace derivated from a provided source error
@@ -270,7 +285,6 @@ exports.reject = reject;
270
285
  function getFrom(source, domain, subdomain, error, ...placeholders) {
271
286
  return rawGetFrom(codes_1.domains, source, domain, subdomain, error, ...placeholders);
272
287
  }
273
- exports.getFrom = getFrom;
274
288
  /**
275
289
  * Wrap error functions with the provided domain and subdomain.
276
290
  */
@@ -281,5 +295,4 @@ function wrap(domain, subdomain) {
281
295
  reject: (error, ...placeholders) => reject(domain, subdomain, error, ...placeholders),
282
296
  };
283
297
  }
284
- exports.wrap = wrap;
285
298
  //# sourceMappingURL=index.js.map
@@ -46,7 +46,8 @@ class Logger extends kuzzle_logger_1.KuzzleLogger {
46
46
  }
47
47
  return mergingObject;
48
48
  };
49
- const hasSharedPino = Logger.basePino !== undefined;
49
+ const sharedPino = Logger.basePino;
50
+ const hasSharedPino = sharedPino !== undefined;
50
51
  let loggerConfig;
51
52
  if (hasSharedPino) {
52
53
  loggerConfig = { getMergingObject, skipPinoInstance: true };
@@ -83,10 +84,10 @@ class Logger extends kuzzle_logger_1.KuzzleLogger {
83
84
  super(loggerConfig);
84
85
  this.warnedForSillyDeprecation = false;
85
86
  this.warnedForVerboseDeprecation = false;
86
- if (hasSharedPino) {
87
+ if (sharedPino !== undefined) {
87
88
  // Reuse the shared pino instance to avoid stacking process exit listeners
88
89
  // added by pino.transport when spawning its worker thread.
89
- this.pino = Logger.basePino.child({});
90
+ this.pino = sharedPino.child({});
90
91
  }
91
92
  else {
92
93
  Logger.basePino = this.pino;