kuzzle 2.56.0 → 2.57.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 (408) hide show
  1. package/dist/bin/copy-binaries.js +71 -4
  2. package/dist/bin/start-kuzzle-server +191 -97
  3. package/dist/index.d.ts +31 -1
  4. package/dist/index.js +45 -2
  5. package/dist/lib/api/controllers/adminController.d.ts +4 -3
  6. package/dist/lib/api/controllers/adminController.js +1 -2
  7. package/dist/lib/api/controllers/authController.d.ts +37 -16
  8. package/dist/lib/api/controllers/authController.js +88 -39
  9. package/dist/lib/api/controllers/baseController.d.ts +10 -5
  10. package/dist/lib/api/controllers/baseController.js +36 -15
  11. package/dist/lib/api/controllers/bulkController.d.ts +11 -7
  12. package/dist/lib/api/controllers/bulkController.js +28 -5
  13. package/dist/lib/api/controllers/clusterController.d.ts +2 -2
  14. package/dist/lib/api/controllers/clusterController.js +3 -3
  15. package/dist/lib/api/controllers/collectionController.d.ts +57 -21
  16. package/dist/lib/api/controllers/collectionController.js +40 -11
  17. package/dist/lib/api/controllers/debugController.d.ts +1 -1
  18. package/dist/lib/api/controllers/documentController.d.ts +137 -28
  19. package/dist/lib/api/controllers/documentController.js +156 -125
  20. package/dist/lib/api/controllers/index.d.ts +27 -12
  21. package/dist/lib/api/controllers/index.js +28 -13
  22. package/dist/lib/api/controllers/indexController.d.ts +17 -10
  23. package/dist/lib/api/controllers/indexController.js +13 -11
  24. package/dist/lib/api/controllers/memoryStorageController.d.ts +2 -5
  25. package/dist/lib/api/controllers/memoryStorageController.js +199 -127
  26. package/dist/lib/api/controllers/realtimeController.d.ts +19 -9
  27. package/dist/lib/api/controllers/realtimeController.js +8 -4
  28. package/dist/lib/api/controllers/securityController.d.ts +42 -29
  29. package/dist/lib/api/controllers/securityController.js +35 -19
  30. package/dist/lib/api/controllers/serverController.d.ts +114 -19
  31. package/dist/lib/api/controllers/serverController.js +69 -29
  32. package/dist/lib/api/documentExtractor.d.ts +9 -7
  33. package/dist/lib/api/documentExtractor.js +105 -41
  34. package/dist/lib/api/funnel.d.ts +131 -29
  35. package/dist/lib/api/funnel.js +436 -225
  36. package/dist/lib/api/httpRoutes.d.ts +16 -11
  37. package/dist/lib/api/httpRoutes.js +272 -2
  38. package/dist/lib/api/openapi/OpenApiManager.d.ts +1 -1
  39. package/dist/lib/api/openapi/openApiGenerator.d.ts +1 -1
  40. package/dist/lib/api/rateLimiter.d.ts +15 -5
  41. package/dist/lib/api/rateLimiter.js +42 -14
  42. package/dist/lib/api/request/kuzzleRequest.d.ts +83 -12
  43. package/dist/lib/api/request/kuzzleRequest.js +88 -23
  44. package/dist/lib/api/request/requestContext.d.ts +20 -5
  45. package/dist/lib/api/request/requestContext.js +14 -4
  46. package/dist/lib/api/request/requestInput.d.ts +37 -6
  47. package/dist/lib/api/request/requestInput.js +22 -9
  48. package/dist/lib/api/request/requestResponse.d.ts +45 -9
  49. package/dist/lib/api/request/requestResponse.js +34 -3
  50. package/dist/lib/cluster/command.d.ts +131 -37
  51. package/dist/lib/cluster/command.js +243 -71
  52. package/dist/lib/cluster/idCardHandler.d.ts +18 -5
  53. package/dist/lib/cluster/idCardHandler.js +52 -19
  54. package/dist/lib/cluster/index.d.ts +8 -2
  55. package/dist/lib/cluster/index.js +6 -2
  56. package/dist/lib/cluster/node.d.ts +127 -49
  57. package/dist/lib/cluster/node.js +412 -179
  58. package/dist/lib/cluster/protobuf/command.proto +18 -0
  59. package/dist/lib/cluster/protobuf/commandMessages.d.ts +104 -0
  60. package/dist/lib/cluster/protobuf/commandMessages.js +30 -0
  61. package/dist/lib/cluster/protobuf/syncMessages.d.ts +184 -0
  62. package/dist/lib/cluster/protobuf/syncMessages.js +23 -0
  63. package/dist/lib/cluster/publisher.d.ts +118 -78
  64. package/dist/lib/cluster/publisher.js +174 -72
  65. package/dist/lib/cluster/state.d.ts +15 -9
  66. package/dist/lib/cluster/state.js +12 -8
  67. package/dist/lib/cluster/subscriber.d.ts +185 -131
  68. package/dist/lib/cluster/subscriber.js +357 -95
  69. package/dist/lib/cluster/workers/IDCardRenewer.d.ts +39 -8
  70. package/dist/lib/cluster/workers/IDCardRenewer.js +88 -23
  71. package/dist/lib/config/default.config.d.ts +2 -2
  72. package/dist/lib/config/default.config.js +10 -3
  73. package/dist/lib/config/documentEventAliases.d.ts +1 -1
  74. package/dist/lib/config/index.d.ts +2 -5
  75. package/dist/lib/config/index.js +30 -17
  76. package/dist/lib/core/auth/formatProcessing.d.ts +3 -3
  77. package/dist/lib/core/auth/passportResponse.d.ts +1 -1
  78. package/dist/lib/core/auth/passportWrapper.d.ts +1 -1
  79. package/dist/lib/core/auth/passportWrapper.js +14 -13
  80. package/dist/lib/core/auth/tokenManager.d.ts +24 -3
  81. package/dist/lib/core/auth/tokenManager.js +47 -19
  82. package/dist/lib/core/backend/applicationManager.d.ts +2 -2
  83. package/dist/lib/core/backend/backend.d.ts +16 -5
  84. package/dist/lib/core/backend/backend.js +14 -6
  85. package/dist/lib/core/backend/backendCluster.d.ts +1 -1
  86. package/dist/lib/core/backend/backendConfig.d.ts +17 -5
  87. package/dist/lib/core/backend/backendConfig.js +1 -0
  88. package/dist/lib/core/backend/backendController.d.ts +1 -1
  89. package/dist/lib/core/backend/backendController.js +8 -1
  90. package/dist/lib/core/backend/backendErrors.d.ts +15 -8
  91. package/dist/lib/core/backend/backendErrors.js +5 -0
  92. package/dist/lib/core/backend/backendHook.d.ts +1 -1
  93. package/dist/lib/core/backend/backendImport.d.ts +1 -1
  94. package/dist/lib/core/backend/backendOpenApi.d.ts +3 -2
  95. package/dist/lib/core/backend/backendPipe.d.ts +1 -1
  96. package/dist/lib/core/backend/backendPipe.js +9 -1
  97. package/dist/lib/core/backend/backendPlugin.d.ts +2 -2
  98. package/dist/lib/core/backend/backendSubscription.d.ts +2 -2
  99. package/dist/lib/core/backend/backendVault.d.ts +1 -1
  100. package/dist/lib/core/backend/backendVault.js +8 -1
  101. package/dist/lib/core/cache/cacheEngine.d.ts +7 -4
  102. package/dist/lib/core/cache/cacheEngine.js +25 -8
  103. package/dist/lib/core/debug/kuzzleDebugger.d.ts +2 -1
  104. package/dist/lib/core/debug/kuzzleDebugger.js +31 -17
  105. package/dist/lib/core/network/accessLogger.d.ts +33 -18
  106. package/dist/lib/core/network/accessLogger.js +135 -73
  107. package/dist/lib/core/network/clientConnection.d.ts +13 -11
  108. package/dist/lib/core/network/clientConnection.js +33 -9
  109. package/dist/lib/core/network/context.d.ts +17 -22
  110. package/dist/lib/core/network/context.js +43 -26
  111. package/dist/lib/core/network/entryPoint.d.ts +38 -16
  112. package/dist/lib/core/network/entryPoint.js +119 -48
  113. package/dist/lib/core/network/httpRouter/index.d.ts +20 -50
  114. package/dist/lib/core/network/httpRouter/index.js +61 -75
  115. package/dist/lib/core/network/httpRouter/routeHandler.d.ts +17 -32
  116. package/dist/lib/core/network/httpRouter/routeHandler.js +26 -36
  117. package/dist/lib/core/network/httpRouter/routePart.d.ts +9 -18
  118. package/dist/lib/core/network/httpRouter/routePart.js +61 -43
  119. package/dist/lib/core/network/httpRouter/routeTypes.d.ts +3 -0
  120. package/dist/lib/core/network/httpRouter/routeTypes.js +23 -0
  121. package/dist/lib/core/network/networkEntryPoint.d.ts +20 -0
  122. package/dist/lib/core/network/networkEntryPoint.js +23 -0
  123. package/dist/lib/core/network/protocolManifest.d.ts +5 -4
  124. package/dist/lib/core/network/protocolManifest.js +6 -3
  125. package/dist/lib/core/network/protocols/httpMessage.d.ts +25 -18
  126. package/dist/lib/core/network/protocols/httpMessage.js +14 -11
  127. package/dist/lib/core/network/protocols/httpwsProtocol.d.ts +84 -93
  128. package/dist/lib/core/network/protocols/httpwsProtocol.js +284 -129
  129. package/dist/lib/core/network/protocols/internalProtocol.d.ts +26 -15
  130. package/dist/lib/core/network/protocols/internalProtocol.js +17 -16
  131. package/dist/lib/core/network/protocols/mqttProtocol.d.ts +56 -32
  132. package/dist/lib/core/network/protocols/mqttProtocol.js +91 -44
  133. package/dist/lib/core/network/protocols/protocol.d.ts +85 -21
  134. package/dist/lib/core/network/protocols/protocol.js +83 -27
  135. package/dist/lib/core/network/router.d.ts +13 -22
  136. package/dist/lib/core/network/router.js +59 -46
  137. package/dist/lib/core/plugin/plugin.d.ts +57 -51
  138. package/dist/lib/core/plugin/plugin.js +218 -103
  139. package/dist/lib/core/plugin/pluginContext.d.ts +54 -11
  140. package/dist/lib/core/plugin/pluginContext.js +99 -58
  141. package/dist/lib/core/plugin/pluginManifest.d.ts +6 -2
  142. package/dist/lib/core/plugin/pluginManifest.js +18 -11
  143. package/dist/lib/core/plugin/pluginRepository.d.ts +35 -44
  144. package/dist/lib/core/plugin/pluginRepository.js +35 -50
  145. package/dist/lib/core/plugin/pluginsManager.d.ts +128 -46
  146. package/dist/lib/core/plugin/pluginsManager.js +468 -231
  147. package/dist/lib/core/plugin/privilegedContext.d.ts +4 -9
  148. package/dist/lib/core/plugin/privilegedContext.js +5 -10
  149. package/dist/lib/core/realtime/actionEnum.d.ts +12 -21
  150. package/dist/lib/core/realtime/actionEnum.js +6 -7
  151. package/dist/lib/core/realtime/channel.d.ts +11 -5
  152. package/dist/lib/core/realtime/channel.js +17 -2
  153. package/dist/lib/core/realtime/connectionRooms.d.ts +2 -2
  154. package/dist/lib/core/realtime/hotelClerk.d.ts +12 -6
  155. package/dist/lib/core/realtime/hotelClerk.js +29 -11
  156. package/dist/lib/core/realtime/index.d.ts +8 -3
  157. package/dist/lib/core/realtime/index.js +12 -5
  158. package/dist/lib/core/realtime/notification/document.d.ts +54 -25
  159. package/dist/lib/core/realtime/notification/document.js +10 -13
  160. package/dist/lib/core/realtime/notification/index.d.ts +9 -3
  161. package/dist/lib/core/realtime/notification/index.js +10 -4
  162. package/dist/lib/core/realtime/notification/server.d.ts +7 -10
  163. package/dist/lib/core/realtime/notification/server.js +4 -7
  164. package/dist/lib/core/realtime/notification/user.d.ts +45 -21
  165. package/dist/lib/core/realtime/notification/user.js +8 -9
  166. package/dist/lib/core/realtime/notifier.d.ts +52 -40
  167. package/dist/lib/core/realtime/notifier.js +60 -25
  168. package/dist/lib/core/realtime/room.d.ts +1 -1
  169. package/dist/lib/core/realtime/subscription.d.ts +11 -6
  170. package/dist/lib/core/realtime/subscription.js +5 -1
  171. package/dist/lib/core/security/index.d.ts +14 -6
  172. package/dist/lib/core/security/index.js +27 -13
  173. package/dist/lib/core/security/profileRepository.d.ts +24 -19
  174. package/dist/lib/core/security/profileRepository.js +23 -10
  175. package/dist/lib/core/security/roleRepository.d.ts +60 -23
  176. package/dist/lib/core/security/roleRepository.js +122 -53
  177. package/dist/lib/core/security/securityLoader.d.ts +33 -18
  178. package/dist/lib/core/security/securityLoader.js +43 -16
  179. package/dist/lib/core/security/tokenRepository.d.ts +21 -7
  180. package/dist/lib/core/security/tokenRepository.js +50 -23
  181. package/dist/lib/core/security/userRepository.d.ts +44 -21
  182. package/dist/lib/core/security/userRepository.js +59 -19
  183. package/dist/lib/core/shared/KoncordeWrapper.d.ts +1 -1
  184. package/dist/lib/core/shared/ObjectRepository.d.ts +80 -18
  185. package/dist/lib/core/shared/ObjectRepository.js +57 -29
  186. package/dist/lib/core/shared/abstractManifest.d.ts +21 -8
  187. package/dist/lib/core/shared/abstractManifest.js +57 -17
  188. package/dist/lib/core/shared/sdk/embeddedSdk.d.ts +3 -1
  189. package/dist/lib/core/shared/sdk/embeddedSdk.js +8 -7
  190. package/dist/lib/core/shared/sdk/funnelProtocol.d.ts +2 -1
  191. package/dist/lib/core/shared/sdk/funnelProtocol.js +12 -3
  192. package/dist/lib/core/shared/sdk/impersonatedSdk.d.ts +11 -5
  193. package/dist/lib/core/shared/sdk/impersonatedSdk.js +22 -9
  194. package/dist/lib/core/shared/store.d.ts +45 -29
  195. package/dist/lib/core/shared/store.js +48 -27
  196. package/dist/lib/core/statistics/statistics.d.ts +1 -1
  197. package/dist/lib/core/storage/clientAdapter.d.ts +39 -21
  198. package/dist/lib/core/storage/clientAdapter.js +88 -48
  199. package/dist/lib/core/storage/indexCache.d.ts +8 -0
  200. package/dist/lib/core/storage/indexCache.js +16 -7
  201. package/dist/lib/core/storage/storageEngine.d.ts +7 -6
  202. package/dist/lib/core/storage/storageEngine.js +11 -8
  203. package/dist/lib/core/validation/baseType.d.ts +22 -22
  204. package/dist/lib/core/validation/baseType.js +11 -26
  205. package/dist/lib/core/validation/specification.d.ts +148 -0
  206. package/dist/lib/core/validation/specification.js +34 -0
  207. package/dist/lib/core/validation/typeOptions.d.ts +62 -0
  208. package/dist/lib/core/validation/typeOptions.js +23 -0
  209. package/dist/lib/core/validation/types/anything.d.ts +3 -6
  210. package/dist/lib/core/validation/types/anything.js +7 -7
  211. package/dist/lib/core/validation/types/boolean.d.ts +5 -12
  212. package/dist/lib/core/validation/types/boolean.js +7 -12
  213. package/dist/lib/core/validation/types/date.d.ts +19 -11
  214. package/dist/lib/core/validation/types/date.js +212 -161
  215. package/dist/lib/core/validation/types/email.d.ts +7 -11
  216. package/dist/lib/core/validation/types/email.js +13 -17
  217. package/dist/lib/core/validation/types/enum.d.ts +7 -11
  218. package/dist/lib/core/validation/types/enum.js +39 -20
  219. package/dist/lib/core/validation/types/geoPoint.d.ts +5 -13
  220. package/dist/lib/core/validation/types/geoPoint.js +10 -15
  221. package/dist/lib/core/validation/types/geoShape.d.ts +22 -21
  222. package/dist/lib/core/validation/types/geoShape.js +113 -129
  223. package/dist/lib/core/validation/types/geoShapeUtils.d.ts +15 -0
  224. package/dist/lib/core/validation/types/geoShapeUtils.js +75 -0
  225. package/dist/lib/core/validation/types/integer.d.ts +7 -5
  226. package/dist/lib/core/validation/types/integer.js +7 -13
  227. package/dist/lib/core/validation/types/ipAddress.d.ts +7 -11
  228. package/dist/lib/core/validation/types/ipAddress.js +13 -17
  229. package/dist/lib/core/validation/types/numeric.d.ts +7 -11
  230. package/dist/lib/core/validation/types/numeric.js +22 -29
  231. package/dist/lib/core/validation/types/object.d.ts +8 -15
  232. package/dist/lib/core/validation/types/object.js +12 -21
  233. package/dist/lib/core/validation/types/string.d.ts +7 -11
  234. package/dist/lib/core/validation/types/string.js +22 -29
  235. package/dist/lib/core/validation/types/url.d.ts +7 -11
  236. package/dist/lib/core/validation/types/url.js +14 -18
  237. package/dist/lib/core/validation/validation.d.ts +119 -80
  238. package/dist/lib/core/validation/validation.js +470 -412
  239. package/dist/lib/core/validation/validationUtils.d.ts +31 -0
  240. package/dist/lib/core/validation/validationUtils.js +190 -0
  241. package/dist/lib/kerror/codes/4-plugin.json +0 -12
  242. package/dist/lib/kerror/codes/index.d.ts +12 -2
  243. package/dist/lib/kerror/codes/index.js +5 -4
  244. package/dist/lib/kerror/errors/badRequestError.d.ts +1 -1
  245. package/dist/lib/kerror/errors/badRequestError.js +1 -1
  246. package/dist/lib/kerror/errors/externalServiceError.d.ts +1 -1
  247. package/dist/lib/kerror/errors/externalServiceError.js +1 -1
  248. package/dist/lib/kerror/errors/forbiddenError.d.ts +1 -1
  249. package/dist/lib/kerror/errors/forbiddenError.js +1 -1
  250. package/dist/lib/kerror/errors/gatewayTimeoutError.d.ts +1 -1
  251. package/dist/lib/kerror/errors/gatewayTimeoutError.js +1 -1
  252. package/dist/lib/kerror/errors/internalError.d.ts +1 -1
  253. package/dist/lib/kerror/errors/internalError.js +1 -1
  254. package/dist/lib/kerror/errors/kuzzleError.d.ts +32 -3
  255. package/dist/lib/kerror/errors/kuzzleError.js +21 -7
  256. package/dist/lib/kerror/errors/multipleErrorsError.d.ts +2 -2
  257. package/dist/lib/kerror/errors/multipleErrorsError.js +2 -2
  258. package/dist/lib/kerror/errors/notFoundError.d.ts +1 -1
  259. package/dist/lib/kerror/errors/notFoundError.js +1 -1
  260. package/dist/lib/kerror/errors/partialError.d.ts +8 -2
  261. package/dist/lib/kerror/errors/partialError.js +22 -9
  262. package/dist/lib/kerror/errors/pluginImplementationError.d.ts +9 -1
  263. package/dist/lib/kerror/errors/pluginImplementationError.js +9 -3
  264. package/dist/lib/kerror/errors/preconditionError.d.ts +1 -1
  265. package/dist/lib/kerror/errors/preconditionError.js +1 -1
  266. package/dist/lib/kerror/errors/serviceUnavailableError.d.ts +1 -1
  267. package/dist/lib/kerror/errors/serviceUnavailableError.js +1 -1
  268. package/dist/lib/kerror/errors/sizeLimitError.d.ts +1 -1
  269. package/dist/lib/kerror/errors/sizeLimitError.js +1 -1
  270. package/dist/lib/kerror/errors/tooManyRequestsError.d.ts +1 -1
  271. package/dist/lib/kerror/errors/tooManyRequestsError.js +1 -1
  272. package/dist/lib/kerror/errors/unauthorizedError.d.ts +1 -1
  273. package/dist/lib/kerror/errors/unauthorizedError.js +1 -1
  274. package/dist/lib/kerror/index.d.ts +19 -13
  275. package/dist/lib/kerror/index.js +60 -19
  276. package/dist/lib/kuzzle/Logger.d.ts +2 -2
  277. package/dist/lib/kuzzle/dumpGenerator.d.ts +12 -8
  278. package/dist/lib/kuzzle/dumpGenerator.js +130 -62
  279. package/dist/lib/kuzzle/event/KuzzleEventEmitter.d.ts +18 -9
  280. package/dist/lib/kuzzle/event/KuzzleEventEmitter.js +45 -18
  281. package/dist/lib/kuzzle/event/pipeRunner.d.ts +37 -16
  282. package/dist/lib/kuzzle/event/pipeRunner.js +73 -26
  283. package/dist/lib/kuzzle/event/waterfall.d.ts +11 -1
  284. package/dist/lib/kuzzle/event/waterfall.js +38 -13
  285. package/dist/lib/kuzzle/internalIndexHandler.d.ts +11 -174
  286. package/dist/lib/kuzzle/internalIndexHandler.js +58 -29
  287. package/dist/lib/kuzzle/kuzzle.d.ts +25 -10
  288. package/dist/lib/kuzzle/kuzzle.js +74 -17
  289. package/dist/lib/kuzzle/kuzzleStateEnum.d.ts +16 -12
  290. package/dist/lib/kuzzle/kuzzleStateEnum.js +5 -7
  291. package/dist/lib/kuzzle/vault.d.ts +5 -1
  292. package/dist/lib/kuzzle/vault.js +29 -17
  293. package/dist/lib/model/security/profile.d.ts +34 -5
  294. package/dist/lib/model/security/profile.js +6 -5
  295. package/dist/lib/model/security/rights.d.ts +12 -4
  296. package/dist/lib/model/security/rights.js +7 -6
  297. package/dist/lib/model/security/role.d.ts +8 -4
  298. package/dist/lib/model/security/role.js +12 -6
  299. package/dist/lib/model/security/token.d.ts +8 -0
  300. package/dist/lib/model/security/user.d.ts +8 -2
  301. package/dist/lib/model/security/user.js +7 -4
  302. package/dist/lib/model/storage/apiKey.d.ts +55 -26
  303. package/dist/lib/model/storage/apiKey.js +97 -24
  304. package/dist/lib/model/storage/baseModel.d.ts +77 -66
  305. package/dist/lib/model/storage/baseModel.js +21 -34
  306. package/dist/lib/service/cache/redis.d.ts +53 -36
  307. package/dist/lib/service/cache/redis.js +148 -71
  308. package/dist/lib/service/service.d.ts +14 -19
  309. package/dist/lib/service/service.js +41 -22
  310. package/dist/lib/service/storage/7/elasticsearch.d.ts +136 -93
  311. package/dist/lib/service/storage/7/elasticsearch.js +218 -165
  312. package/dist/lib/service/storage/7/esWrapper.d.ts +30 -13
  313. package/dist/lib/service/storage/7/esWrapper.js +58 -37
  314. package/dist/lib/service/storage/8/elasticsearch.d.ts +153 -119
  315. package/dist/lib/service/storage/8/elasticsearch.js +286 -213
  316. package/dist/lib/service/storage/8/esWrapper.d.ts +30 -13
  317. package/dist/lib/service/storage/8/esWrapper.js +59 -38
  318. package/dist/lib/service/storage/commons/queryTranslator.d.ts +3 -3
  319. package/dist/lib/service/storage/commons/queryTranslator.js +71 -35
  320. package/dist/lib/types/ApiRoute.d.ts +12 -0
  321. package/dist/lib/types/ApiRoute.js +23 -0
  322. package/dist/lib/types/ClientConnection.d.ts +1 -1
  323. package/dist/lib/types/EventHandler.d.ts +10 -0
  324. package/dist/lib/types/Global.d.ts +8 -3
  325. package/dist/lib/types/HttpMessage.d.ts +2 -2
  326. package/dist/lib/types/HttpStream.d.ts +1 -1
  327. package/dist/lib/types/HttpStream.js +3 -1
  328. package/dist/lib/types/JSONObject.d.ts +9 -0
  329. package/dist/lib/types/JSONObject.js +23 -0
  330. package/dist/lib/types/Kuzzle.d.ts +5 -3
  331. package/dist/lib/types/KuzzleDocument.d.ts +1 -1
  332. package/dist/lib/types/KuzzleWebSocket.d.ts +24 -0
  333. package/dist/lib/types/KuzzleWebSocket.js +23 -0
  334. package/dist/lib/types/OpenApiDefinition.d.ts +1 -1
  335. package/dist/lib/types/Plugin.d.ts +33 -8
  336. package/dist/lib/types/PluginInstance.d.ts +67 -0
  337. package/dist/lib/types/PluginInstance.js +23 -0
  338. package/dist/lib/types/Policy.d.ts +1 -1
  339. package/dist/lib/types/Target.d.ts +8 -0
  340. package/dist/lib/types/Token.d.ts +14 -2
  341. package/dist/lib/types/config/HttpConfiguration.d.ts +5 -0
  342. package/dist/lib/types/config/KuzzleConfiguration.d.ts +102 -1
  343. package/dist/lib/types/config/PluginsConfiguration.d.ts +3 -2
  344. package/dist/lib/types/config/SecurityConfiguration.d.ts +6 -2
  345. package/dist/lib/types/config/ServerConfiguration.d.ts +2 -2
  346. package/dist/lib/types/config/ServicesConfiguration.d.ts +1 -1
  347. package/dist/lib/types/config/cache/BaseCacheRedisConfiguration.d.ts +131 -0
  348. package/dist/lib/types/config/cache/BaseCacheRedisConfiguration.js +3 -0
  349. package/dist/lib/types/config/internalCache/InternalCacheRedisConfiguration.d.ts +2 -106
  350. package/dist/lib/types/config/publicCache/PublicCacheRedisConfiguration.d.ts +2 -26
  351. package/dist/lib/types/config/storageEngine/StorageEngineElasticsearchConfiguration.d.ts +3 -0
  352. package/dist/lib/types/controllers/Controller.d.ts +12 -3
  353. package/dist/lib/types/controllers/ControllerDefinition.d.ts +2 -2
  354. package/dist/lib/types/controllers/{adminControlller.type.js → adminController.type.js} +1 -1
  355. package/dist/lib/types/controllers/authController.type.d.ts +2 -2
  356. package/dist/lib/types/core/auth/formatProcessing.type.d.ts +7 -1
  357. package/dist/lib/types/errors/ErrorDomains.d.ts +1 -1
  358. package/dist/lib/types/events/EventGenericDocument.d.ts +10 -9
  359. package/dist/lib/types/events/EventProtocol.d.ts +4 -4
  360. package/dist/lib/types/index.d.ts +7 -0
  361. package/dist/lib/types/index.js +7 -0
  362. package/dist/lib/types/shared/StoreCollectionsDefinition.d.ts +1 -1
  363. package/dist/lib/types/storage/7/Elasticsearch.d.ts +62 -13
  364. package/dist/lib/types/storage/8/Elasticsearch.d.ts +62 -13
  365. package/dist/lib/util/Inflector.d.ts +4 -1
  366. package/dist/lib/util/Inflector.js +0 -3
  367. package/dist/lib/util/assertType.d.ts +24 -27
  368. package/dist/lib/util/assertType.js +28 -39
  369. package/dist/lib/util/async.js +19 -6
  370. package/dist/lib/util/asyncStore.js +1 -1
  371. package/dist/lib/util/bufferedPassThrough.d.ts +9 -0
  372. package/dist/lib/util/bufferedPassThrough.js +27 -13
  373. package/dist/lib/util/bytes.d.ts +1 -1
  374. package/dist/lib/util/bytes.js +6 -2
  375. package/dist/lib/util/debug.d.ts +3 -1
  376. package/dist/lib/util/debug.js +42 -10
  377. package/dist/lib/util/deprecate.d.ts +9 -1
  378. package/dist/lib/util/deprecate.js +10 -6
  379. package/dist/lib/util/didYouMean.d.ts +2 -1
  380. package/dist/lib/util/didYouMean.js +8 -4
  381. package/dist/lib/util/distributedLock.d.ts +56 -0
  382. package/dist/lib/util/distributedLock.js +166 -0
  383. package/dist/lib/util/dump-collection.d.ts +1 -1
  384. package/dist/lib/util/dump-collection.js +4 -5
  385. package/dist/lib/util/extractFields.d.ts +15 -11
  386. package/dist/lib/util/extractFields.js +8 -9
  387. package/dist/lib/util/koncordeCompat.d.ts +2 -2
  388. package/dist/lib/util/koncordeCompat.js +33 -0
  389. package/dist/lib/util/memoize.d.ts +7 -6
  390. package/dist/lib/util/memoize.js +3 -3
  391. package/dist/lib/util/mutex.d.ts +22 -2
  392. package/dist/lib/util/mutex.js +39 -1
  393. package/dist/lib/util/name-generator.js +14 -2
  394. package/dist/lib/util/promback.d.ts +20 -11
  395. package/dist/lib/util/promback.js +14 -7
  396. package/dist/lib/util/requestAssertions.d.ts +30 -10
  397. package/dist/lib/util/requestAssertions.js +125 -121
  398. package/dist/lib/util/safeObject.d.ts +3 -3
  399. package/dist/lib/util/safeObject.js +7 -3
  400. package/dist/lib/util/stackTrace.d.ts +13 -5
  401. package/dist/lib/util/stackTrace.js +17 -12
  402. package/dist/lib/util/thrown.d.ts +13 -0
  403. package/dist/lib/util/thrown.js +46 -0
  404. package/dist/package.json +26 -19
  405. package/package.json +26 -19
  406. package/dist/lib/util/wildcard.d.ts +0 -1
  407. package/dist/lib/util/wildcard.js +0 -46
  408. /package/dist/lib/types/controllers/{adminControlller.type.d.ts → adminController.type.d.ts} +0 -0
@@ -1,111 +1,7 @@
1
- export type InternalCacheConfiguration = {
2
- /**
3
- * The cache service relies on Redis sample settings for Redis service (see also https://github.com/luin/ioredis)
4
- *
5
- * 1. using a single Redis database:
6
- * * node:
7
- * * host:
8
- * The host on which Redis can be reached.
9
- * Can take an IP address, an URI or a hostname
10
- * * port:
11
- * The port on which Redis is running its database:
12
- * * (optional, deprecated) database:
13
- * ID of the redis database (default: 0)
14
- * NOTE: this option is deprecated and will be removed in Kuzzle v3.
15
- * Use 'options.db' instead. If both options are set, then
16
- * "options.db" will take precedence.
17
- * * (optional) options:
18
- * Redis specific options compatible with IORedis.
19
- * See Redis client constructor available options:
20
- * https://github.com/luin/ioredis/blob/master/API.md#new-redisport-host-options
21
- *
22
- * 2. using a master/slaves Redis instance with Redis sentinels
23
- * (cf. http://redis.io/topics/sentinel):
24
- * * node:
25
- * * sentinels:
26
- * array of sentinels instances:
27
- * * host:
28
- * Host name/address of the sentinel server
29
- * Can be an IP address, an URI or a hostname
30
- * * port:
31
- * Network port opened by Redis on the sentinel server
32
- * * name:
33
- * Group of Redis instances composed of a master and one
34
- * or more slaves
35
- * * (optional, deprecated) database:
36
- * ID of the redis database (default: 0)
37
- * NOTE: this option is deprecated and will be removed in Kuzzle v3.
38
- * Use 'options.db' instead. If both options are set, then
39
- * "options.db" will take precedence.
40
- * * (optional) options:
41
- * Redis specific options compatible with IORedis.
42
- * See Redis client constructor available options:
43
- * https://github.com/luin/ioredis/blob/master/API.md#redis--eventemitter
44
- *
45
- * 3. using a redis cluster (cf. http://redis.io/topics/cluster-spec):
46
- * * nodes: array of master nodes of the cluster
47
- * * host:
48
- * Host name/address of a redis cluster node
49
- * Can be an IP address, an URI or a hostname
50
- * * port:
51
- * Network port opened by the redis cluster node
52
- * * (optional, deprecated) database:
53
- * ID of the redis database (default: 0)
54
- * NOTE: this option is deprecated and will be removed in Kuzzle v3.
55
- * Use 'options.db' instead. If both options are set, then
56
- * "options.db" will take precedence.
57
- * * (optional) options:
58
- * Redis specific options compatible with IORedis.
59
- * See Redis client constructor available options:
60
- * https://github.com/luin/ioredis/blob/master/API.md#new-redisport-host-options
61
- * * (optional) clusterOptions:
62
- * Redis Cluster specific options compatible with IORedis.
63
- * See Redis Cluster client constructor available options:
64
- * https://github.com/luin/ioredis/blob/master/API.md#new-clusterstartupnodes-options
65
- * * (optional) overrideDnsLookup:
66
- * Only available when using a Redis Cluster config.
67
- * Use with caution: if set to true, it makes Kuzzle skip DNS validation for TLS certificates
68
- * This is the only way to connect to an AWS Elasticache Cluster with TLS encryption.
69
- * See: https://github.com/luin/ioredis#special-note-aws-elasticache-clusters-with-tls
70
- */
71
- /**
72
- * @default 'redis'
73
- */
74
- backend: "redis";
75
- clusterOptions: {
76
- /**
77
- * @default true
78
- */
79
- enableReadyCheck: boolean;
80
- };
1
+ import type { BaseCacheRedisConfiguration } from "../cache/BaseCacheRedisConfiguration";
2
+ export type InternalCacheConfiguration = BaseCacheRedisConfiguration & {
81
3
  /**
82
4
  * @default 0
83
5
  */
84
6
  database: number;
85
- node: {
86
- /**
87
- * @default "localhost"
88
- */
89
- host: string;
90
- /**
91
- * @default 6379
92
- */
93
- port: number;
94
- };
95
- /**
96
- * * (optional) options:
97
- * Redis specific options compatible with IORedis.
98
- * See Redis client constructor available options:
99
- * https://github.com/luin/ioredis/blob/master/API.md#new-redisport-host-options
100
- *
101
- */
102
- options?: Record<string, unknown>;
103
- /**
104
- * Only available when using a Redis Cluster config.
105
- * Use with caution: if set to true, it makes Kuzzle skip DNS validation for TLS certificates
106
- * This is the only way to connect to an AWS Elasticache Cluster with TLS encryption.
107
- * See: https://github.com/luin/ioredis#special-note-aws-elasticache-clusters-with-tls
108
- * @default false
109
- */
110
- overrideDnsLookup: boolean;
111
7
  };
@@ -1,31 +1,7 @@
1
- export type PublicCacheRedisConfiguration = {
2
- /**
3
- * @default 'redis'
4
- */
5
- backend: "redis";
6
- clusterOptions: {
7
- /**
8
- * @default true
9
- */
10
- enableReadyCheck: boolean;
11
- };
1
+ import type { BaseCacheRedisConfiguration } from "../cache/BaseCacheRedisConfiguration";
2
+ export type PublicCacheRedisConfiguration = BaseCacheRedisConfiguration & {
12
3
  /**
13
4
  * @default 5
14
5
  */
15
6
  database: number;
16
- node: {
17
- /**
18
- * @default 'localhost'
19
- */
20
- host: string;
21
- /**
22
- * @default 6379
23
- */
24
- port: number;
25
- };
26
- options?: Record<string, unknown>;
27
- /**
28
- * @default false
29
- */
30
- overrideDnsLookup: boolean;
31
7
  };
@@ -279,6 +279,9 @@ export type StorageEngineElasticsearch = {
279
279
  hash: {
280
280
  type: "keyword";
281
281
  };
282
+ fingerprint: {
283
+ type: "keyword";
284
+ };
282
285
  description: {
283
286
  type: "text";
284
287
  };
@@ -1,6 +1,6 @@
1
- import { Backend } from "../../core/backend";
2
- import { ControllerDefinition } from "./ControllerDefinition";
3
- import { EmbeddedSDK } from "../../core/shared/sdk/embeddedSdk";
1
+ import type { Backend } from "../../core/backend";
2
+ import type { ControllerDefinition } from "./ControllerDefinition";
3
+ import type { EmbeddedSDK } from "../../core/shared/sdk/embeddedSdk";
4
4
  /**
5
5
  * Base class to declare a controller class
6
6
  */
@@ -11,6 +11,11 @@ export declare abstract class Controller {
11
11
  protected app: Backend;
12
12
  /**
13
13
  * Controller name
14
+ *
15
+ * May be left unset: `app.controller.use()` derives it from the class name
16
+ * when the author has not set one. Declared as always present (`!`)
17
+ * because it is from `use()` on, and because v2.56.0 declared it so — an
18
+ * optional field broke `this.name` read as a `string` under `strict`.
14
19
  */
15
20
  name: string;
16
21
  /**
@@ -26,6 +31,10 @@ export declare abstract class Controller {
26
31
  * }
27
32
  * }
28
33
  *
34
+ * The documented pattern is to assign it in the subclass constructor, and
35
+ * `app.controller.use()` rejects a controller without one — see
36
+ * Plugin.checkControllerDefinition. Declared as always present (`!`) for
37
+ * that reason, as v2.56.0 declared it.
29
38
  */
30
39
  definition: ControllerDefinition;
31
40
  /**
@@ -1,5 +1,5 @@
1
- import { JSONObject } from "kuzzle-sdk";
2
- import { KuzzleRequest } from "../../api/request";
1
+ import type { JSONObject } from "../JSONObject";
2
+ import type { KuzzleRequest } from "../../api/request";
3
3
  /**
4
4
  * API controller definition.
5
5
  *
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=adminControlller.type.js.map
3
+ //# sourceMappingURL=adminController.type.js.map
@@ -1,5 +1,5 @@
1
- import { User } from "../../model/security/user";
2
- import { Serialized } from "../core/auth/formatProcessing.type";
1
+ import type { User } from "../../model/security/user";
2
+ import type { Serialized } from "../core/auth/formatProcessing.type";
3
3
  export type GetCurrentUserResponse = Serialized<User> & {
4
4
  strategies: any;
5
5
  };
@@ -1,5 +1,11 @@
1
+ /**
2
+ * What `formatProcessing` can serialize: anything carrying an id. The id is
3
+ * nullable because the security models are — they carry `null` until they have
4
+ * been stored (ADR-0001, TD-62) — and `Serialized` echoes back whichever it
5
+ * has rather than widening it for everyone.
6
+ */
1
7
  export type Serializable = {
2
- _id: string;
8
+ _id: string | null;
3
9
  };
4
10
  export type Serialized<T extends Serializable> = {
5
11
  _id: T["_id"];
@@ -1,4 +1,4 @@
1
- import { ErrorDefinition } from "./ErrorDefinition";
1
+ import type { ErrorDefinition } from "./ErrorDefinition";
2
2
  /**
3
3
  * Represents the domains, subDomains and error names with associated definitions
4
4
  */
@@ -1,5 +1,6 @@
1
- import { KDocument, JSONObject } from "kuzzle-sdk";
2
- import { KuzzleRequest, PipeEventHandler } from "../../../index";
1
+ import type { KDocument, KDocumentContent } from "kuzzle-sdk";
2
+ import type { JSONObject } from "../JSONObject";
3
+ import type { KuzzleRequest, PipeEventHandler } from "../../../index";
3
4
  /**
4
5
  * Events with documents only having the `_id`
5
6
  */
@@ -15,15 +16,15 @@ export type EventGenericDocumentBeforeGet = EventGenericDocumentPartial<"beforeG
15
16
  /**
16
17
  * Events having entire documents
17
18
  */
18
- type EventGenericDocument<name extends string, KDocumentContent> = {
19
+ type EventGenericDocument<name extends string, TContent> = {
19
20
  name: `generic:document:${name}`;
20
- args: [KDocument<KDocumentContent>[], KuzzleRequest];
21
+ args: [KDocument<TContent & KDocumentContent>[], KuzzleRequest];
21
22
  };
22
- export type EventGenericDocumentBeforeWrite<KDocumentContent = JSONObject> = EventGenericDocument<"beforeWrite", KDocumentContent>;
23
- export type EventGenericDocumentAfterWrite<KDocumentContent = JSONObject> = EventGenericDocument<"afterWrite", KDocumentContent>;
24
- export type EventGenericDocumentBeforeUpdate<KDocumentContent = JSONObject> = EventGenericDocument<"beforeUpdate", KDocumentContent>;
25
- export type EventGenericDocumentAfterUpdate<KDocumentContent = JSONObject> = EventGenericDocument<"afterUpdate", KDocumentContent>;
26
- export type EventGenericDocumentAfterGet<KDocumentContent = JSONObject> = EventGenericDocument<"afterGet", KDocumentContent>;
23
+ export type EventGenericDocumentBeforeWrite<TContent = JSONObject> = EventGenericDocument<"beforeWrite", TContent>;
24
+ export type EventGenericDocumentAfterWrite<TContent = JSONObject> = EventGenericDocument<"afterWrite", TContent>;
25
+ export type EventGenericDocumentBeforeUpdate<TContent = JSONObject> = EventGenericDocument<"beforeUpdate", TContent>;
26
+ export type EventGenericDocumentAfterUpdate<TContent = JSONObject> = EventGenericDocument<"afterUpdate", TContent>;
27
+ export type EventGenericDocumentAfterGet<TContent = JSONObject> = EventGenericDocument<"afterGet", TContent>;
27
28
  export type EventGenericDocumentInjectMetadata = {
28
29
  name: `generic:document:injectMetadata`;
29
30
  args: [
@@ -1,9 +1,9 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
- import { JSONObject } from "kuzzle-sdk";
4
- import { PipeEventHandler } from "../../../index";
5
- import { ClientConnection } from "../ClientConnection";
6
- import { HttpMessage } from "../HttpMessage";
3
+ import type { JSONObject } from "../JSONObject";
4
+ import type { PipeEventHandler } from "../../../index";
5
+ import type { ClientConnection } from "../ClientConnection";
6
+ import type { HttpMessage } from "../HttpMessage";
7
7
  export type EventHTTPBeforeParsingPayload = {
8
8
  name: `protocol:http:beforeParsingPayload`;
9
9
  args: [{
@@ -1,18 +1,24 @@
1
1
  export * from "./controllers/Controller";
2
+ export * from "./ApiRoute";
2
3
  export * from "./controllers/ControllerDefinition";
3
4
  export * from "./controllers/ControllerRights";
5
+ export * from "./ClientConnection";
4
6
  export * from "./Deprecation";
5
7
  export * from "./EventHandler";
6
8
  export * from "./Global";
9
+ export * from "./HttpMessage";
7
10
  export * from "./HttpStream";
11
+ export * from "./JSONObject";
8
12
  export * from "./KuzzleDocument";
9
13
  export * from "./OpenApiDefinition";
10
14
  export * from "./PasswordPolicy";
11
15
  export * from "./Plugin";
16
+ export * from "./PluginManifest";
12
17
  export * from "./Policy";
13
18
  export * from "./PolicyRestrictions";
14
19
  export * from "./ProfileDefinition";
15
20
  export * from "./RoleDefinition";
21
+ export * from "./StrategyDefinition";
16
22
  export * from "./Target";
17
23
  export * from "./Token";
18
24
  export * from "./config/DumpConfiguration";
@@ -23,6 +29,7 @@ export * from "./config/PluginsConfiguration";
23
29
  export * from "./config/SecurityConfiguration";
24
30
  export * from "./config/ServerConfiguration";
25
31
  export * from "./config/ServicesConfiguration";
32
+ export * from "./config/cache/BaseCacheRedisConfiguration";
26
33
  export * from "./config/internalCache/InternalCacheRedisConfiguration";
27
34
  export * from "./config/publicCache/PublicCacheRedisConfiguration";
28
35
  export * from "./config/storageEngine/StorageEngineElasticsearchConfiguration";
@@ -35,20 +35,26 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
35
35
  };
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
37
  __exportStar(require("./controllers/Controller"), exports);
38
+ __exportStar(require("./ApiRoute"), exports);
38
39
  __exportStar(require("./controllers/ControllerDefinition"), exports);
39
40
  __exportStar(require("./controllers/ControllerRights"), exports);
41
+ __exportStar(require("./ClientConnection"), exports);
40
42
  __exportStar(require("./Deprecation"), exports);
41
43
  __exportStar(require("./EventHandler"), exports);
42
44
  __exportStar(require("./Global"), exports);
45
+ __exportStar(require("./HttpMessage"), exports);
43
46
  __exportStar(require("./HttpStream"), exports);
47
+ __exportStar(require("./JSONObject"), exports);
44
48
  __exportStar(require("./KuzzleDocument"), exports);
45
49
  __exportStar(require("./OpenApiDefinition"), exports);
46
50
  __exportStar(require("./PasswordPolicy"), exports);
47
51
  __exportStar(require("./Plugin"), exports);
52
+ __exportStar(require("./PluginManifest"), exports);
48
53
  __exportStar(require("./Policy"), exports);
49
54
  __exportStar(require("./PolicyRestrictions"), exports);
50
55
  __exportStar(require("./ProfileDefinition"), exports);
51
56
  __exportStar(require("./RoleDefinition"), exports);
57
+ __exportStar(require("./StrategyDefinition"), exports);
52
58
  __exportStar(require("./Target"), exports);
53
59
  __exportStar(require("./Token"), exports);
54
60
  __exportStar(require("./config/DumpConfiguration"), exports);
@@ -59,6 +65,7 @@ __exportStar(require("./config/PluginsConfiguration"), exports);
59
65
  __exportStar(require("./config/SecurityConfiguration"), exports);
60
66
  __exportStar(require("./config/ServerConfiguration"), exports);
61
67
  __exportStar(require("./config/ServicesConfiguration"), exports);
68
+ __exportStar(require("./config/cache/BaseCacheRedisConfiguration"), exports);
62
69
  __exportStar(require("./config/internalCache/InternalCacheRedisConfiguration"), exports);
63
70
  __exportStar(require("./config/publicCache/PublicCacheRedisConfiguration"), exports);
64
71
  __exportStar(require("./config/storageEngine/StorageEngineElasticsearchConfiguration"), exports);
@@ -1,4 +1,4 @@
1
- import { JSONObject } from "kuzzle-sdk";
1
+ import type { JSONObject } from "../JSONObject";
2
2
  export interface StoreCollectionDefinition {
3
3
  /**
4
4
  * Collection mappings
@@ -1,4 +1,5 @@
1
- import { ByteSize, ClusterNodesStats } from "sdk-es7/api/types";
1
+ import type { ByteSize, ClusterNodesStats } from "sdk-es7/api/types";
2
+ import type { JSONObject } from "../../JSONObject";
2
3
  export type InfoResult = {
3
4
  type: string;
4
5
  version: string;
@@ -7,20 +8,31 @@ export type InfoResult = {
7
8
  spaceUsed?: ByteSize;
8
9
  nodes?: ClusterNodesStats;
9
10
  };
11
+ /**
12
+ * Kuzzle's own metadata, stored alongside every document it writes.
13
+ *
14
+ * `author` and `updater` are kuids, and `getKuid` answers `null` for an
15
+ * anonymous write — so both are nullable, as is `updatedAt` on a document that
16
+ * has only ever been created.
17
+ */
18
+ export type KuzzleInfo = {
19
+ author: string | null;
20
+ createdAt: number;
21
+ updatedAt: number | null;
22
+ updater: string | null;
23
+ };
24
+ /**
25
+ * `_kuzzle_info` is `Partial` because a partial update writes only the two
26
+ * fields it owns (`updatedAt`, `updater`) and leaves the creation pair to the
27
+ * document already in the index.
28
+ */
10
29
  export type KRequestBody<T> = T & {
11
- _kuzzle_info?: {
12
- author: string;
13
- createdAt: number;
14
- updatedAt: number | null;
15
- updater: string | null;
16
- };
30
+ _kuzzle_info?: Partial<KuzzleInfo>;
17
31
  };
18
- export interface JSONObject {
19
- [key: string]: any;
20
- }
32
+ export type { JSONObject } from "../../JSONObject";
21
33
  export type KImportError = {
22
- _id: string;
23
- status: string;
34
+ _id?: string | null;
35
+ status: number;
24
36
  _source?: JSONObject;
25
37
  error?: {
26
38
  reason: string;
@@ -30,8 +42,45 @@ export type KImportError = {
30
42
  export type KRequestParams = {
31
43
  refresh?: boolean | "wait_for";
32
44
  timeout?: string;
33
- userId?: string;
45
+ userId?: string | null;
34
46
  injectKuzzleMeta?: boolean;
35
47
  limits?: boolean;
36
48
  source?: boolean;
37
49
  };
50
+ /**
51
+ * Maps an ES alias to the index/collection pair a multi-target search resolved
52
+ * it from — see `Elasticsearch._mapTargetsToAlias`.
53
+ */
54
+ export type AliasToTargets = {
55
+ [alias: string]: {
56
+ collection: string;
57
+ index: string;
58
+ };
59
+ };
60
+ /**
61
+ * The standardised answer `_mExecute` builds for every m* write: the documents
62
+ * Elasticsearch accepted, and the ones it (or Kuzzle) rejected.
63
+ */
64
+ export type KMExecuteResult = {
65
+ errors: JSONObject[];
66
+ items: JSONObject[];
67
+ };
68
+ /**
69
+ * The answer `import` builds from a bulk response: one entry per action, keyed
70
+ * by the action name Elasticsearch echoed back.
71
+ */
72
+ export type KImportResult = {
73
+ errors: Array<Record<string, KImportError>>;
74
+ items: Array<Record<string, {
75
+ _id?: string | null;
76
+ status?: number;
77
+ }>>;
78
+ };
79
+ /**
80
+ * One row of a `cat.aliases` answer, once the two fields Elasticsearch always
81
+ * fills have been narrowed — see `Elasticsearch._catAliases`.
82
+ */
83
+ export type CatAliasRecord = {
84
+ alias: string;
85
+ index: string;
86
+ };
@@ -1,4 +1,5 @@
1
- import { estypes } from "sdk-es8";
1
+ import type { estypes } from "sdk-es8";
2
+ import type { JSONObject } from "../../JSONObject";
2
3
  export type InfoResult = {
3
4
  type: string;
4
5
  version: string;
@@ -29,20 +30,31 @@ export type KStats = {
29
30
  indexes: KStatsIndex[];
30
31
  size: estypes.ByteSize;
31
32
  };
33
+ /**
34
+ * Kuzzle's own metadata, stored alongside every document it writes.
35
+ *
36
+ * `author` and `updater` are kuids, and `getKuid` answers `null` for an
37
+ * anonymous write — so both are nullable, as is `updatedAt` on a document that
38
+ * has only ever been created.
39
+ */
40
+ export type KuzzleInfo = {
41
+ author: string | null;
42
+ createdAt: number;
43
+ updatedAt: number | null;
44
+ updater: string | null;
45
+ };
46
+ /**
47
+ * `_kuzzle_info` is `Partial` because a partial update writes only the two
48
+ * fields it owns (`updatedAt`, `updater`) and leaves the creation pair to the
49
+ * document already in the index.
50
+ */
32
51
  export type KRequestBody<T> = T & {
33
- _kuzzle_info?: {
34
- author: string;
35
- createdAt: number;
36
- updatedAt: number | null;
37
- updater: string | null;
38
- };
52
+ _kuzzle_info?: Partial<KuzzleInfo>;
39
53
  };
40
- export interface JSONObject {
41
- [key: string]: any;
42
- }
54
+ export type { JSONObject } from "../../JSONObject";
43
55
  export type KImportError = {
44
- _id: string;
45
- status: string;
56
+ _id?: string | null;
57
+ status: number;
46
58
  _source?: JSONObject;
47
59
  error?: {
48
60
  reason: string;
@@ -52,8 +64,45 @@ export type KImportError = {
52
64
  export type KRequestParams = {
53
65
  refresh?: boolean | "wait_for";
54
66
  timeout?: string;
55
- userId?: string;
67
+ userId?: string | null;
56
68
  injectKuzzleMeta?: boolean;
57
69
  limits?: boolean;
58
70
  source?: boolean;
59
71
  };
72
+ /**
73
+ * Maps an ES alias to the index/collection pair a multi-target search resolved
74
+ * it from — see `Elasticsearch._mapTargetsToAlias`.
75
+ */
76
+ export type AliasToTargets = {
77
+ [alias: string]: {
78
+ collection: string;
79
+ index: string;
80
+ };
81
+ };
82
+ /**
83
+ * One row of a `cat.aliases` answer, once the two fields Elasticsearch always
84
+ * fills have been narrowed — see `Elasticsearch._catAliases`.
85
+ */
86
+ export type CatAliasRecord = {
87
+ alias: string;
88
+ index: string;
89
+ };
90
+ /**
91
+ * The standardised answer `_mExecute` builds for every m* write: the documents
92
+ * Elasticsearch accepted, and the ones it (or Kuzzle) rejected.
93
+ */
94
+ export type KMExecuteResult = {
95
+ errors: JSONObject[];
96
+ items: JSONObject[];
97
+ };
98
+ /**
99
+ * The answer `import` builds from a bulk response: one entry per action, keyed
100
+ * by the action name Elasticsearch echoed back.
101
+ */
102
+ export type KImportResult = {
103
+ errors: Array<Record<string, KImportError>>;
104
+ items: Array<Record<string, {
105
+ _id?: string | null;
106
+ status?: number;
107
+ }>>;
108
+ };
@@ -20,8 +20,11 @@ export declare class Inflector {
20
20
  static pascalCase(string: string): string;
21
21
  /**
22
22
  * Converts a string to camelCase
23
+ *
24
+ * Declared `unknown`, as v2.56.0's `any` accepted anything: lodash
25
+ * stringifies it.
23
26
  */
24
- static camelCase(string: any): string;
27
+ static camelCase(string: unknown): string;
25
28
  /**
26
29
  * Converts a string to snake_case
27
30
  * https://stackoverflow.com/a/52964182
@@ -56,9 +56,6 @@ class Inflector {
56
56
  static pascalCase(string) {
57
57
  return lodash_1.default.startCase(string).replace(/ /g, "");
58
58
  }
59
- /**
60
- * Converts a string to camelCase
61
- */
62
59
  static camelCase(string) {
63
60
  return lodash_1.default.camelCase(string);
64
61
  }
@@ -1,51 +1,48 @@
1
1
  /**
2
- * Throws if the provided data is not an array containing exclusively
3
- * values of the specified "type"
4
- * Returns a clone of the provided array if valid
2
+ * Throws if the provided data is not an object.
3
+ * Returns the unmodified data if validated
5
4
  *
6
5
  * @throws
7
- * @param {string} attr - tested attribute name
8
- * @param {*} data
9
- * @return {array}
6
+ * @param attr - tested attribute name
7
+ * @param data
10
8
  */
11
- export function assertArray(attr: string, data: any, type: any): any[];
9
+ export declare function assertObject<T extends object>(attr: string, data: T | null | undefined): T | null;
10
+ export declare function assertObject(attr: string, data: unknown): Record<string, unknown> | null;
12
11
  /**
13
12
  * Throws if the provided data is not an object or an array.
14
13
  * Returns the unmodified data if validated
15
14
  *
16
15
  * @throws
17
- * @param {string} attr - tested attribute name
18
- * @param {*} data
19
- * @return {object|array}
16
+ * @param attr - tested attribute name
17
+ * @param data
20
18
  */
21
- export function assertArrayOrObject(attr: string, data: any): object | any[];
19
+ export declare function assertArrayOrObject(attr: string, data: unknown): object | null;
22
20
  /**
23
- * Throws if the provided data is not an integer
24
- * Returns the unmodified data if validated
21
+ * Throws if the provided data is not an array containing exclusively
22
+ * values of the specified "type"
23
+ * Returns a clone of the provided array if valid
25
24
  *
26
25
  * @throws
27
- * @param {string} attr - tested attribute name
28
- * @param {*} data
29
- * @return {number}
26
+ * @param attr - tested attribute name
27
+ * @param data
30
28
  */
31
- export function assertInteger(attr: string, data: any): number;
29
+ export declare function assertArray(attr: string, data: unknown, type: "string"): string[];
30
+ export declare function assertArray(attr: string, data: unknown, type: string): unknown[];
32
31
  /**
33
- * Throws if the provided data is not an object.
32
+ * Throws if the provided data is not a string
34
33
  * Returns the unmodified data if validated
35
34
  *
36
35
  * @throws
37
- * @param {string} attr - tested attribute name
38
- * @param {*} data
39
- * @return {object}
36
+ * @param attr - tested attribute name
37
+ * @param data
40
38
  */
41
- export function assertObject(attr: string, data: any): object;
39
+ export declare function assertString(attr: string, data: unknown): string | null;
42
40
  /**
43
- * Throws if the provided data is not a string
41
+ * Throws if the provided data is not an integer
44
42
  * Returns the unmodified data if validated
45
43
  *
46
44
  * @throws
47
- * @param {string} attr - tested attribute name
48
- * @param {*} data
49
- * @return {null|string}
45
+ * @param attr - tested attribute name
46
+ * @param data
50
47
  */
51
- export function assertString(attr: string, data: any): null | string;
48
+ export declare function assertInteger(attr: string, data: unknown): number;