@tstdl/base 0.81.35 → 0.82.1

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 (419) hide show
  1. package/api/client/client.d.ts +3 -3
  2. package/api/default-error-handlers.d.ts +1 -1
  3. package/api/response.d.ts +8 -8
  4. package/api/server/api-controller.d.ts +1 -1
  5. package/api/server/gateway.d.ts +9 -9
  6. package/api/server/middlewares/cors.middleware.d.ts +1 -1
  7. package/api/server/module.d.ts +1 -1
  8. package/api/types.d.ts +30 -30
  9. package/api/utils.d.ts +1 -1
  10. package/api/utils.js +3 -1
  11. package/api/utils.js.map +1 -1
  12. package/authentication/authentication-credentials.service.d.ts +6 -0
  13. package/authentication/authentication-credentials.service.js +17 -0
  14. package/authentication/authentication-credentials.service.js.map +1 -0
  15. package/authentication/authentication-session.repository.d.ts +6 -0
  16. package/authentication/authentication-session.repository.js +18 -0
  17. package/authentication/authentication-session.repository.js.map +1 -0
  18. package/authentication/authentication-token-payload.provider.d.ts +3 -0
  19. package/authentication/authentication-token-payload.provider.js +17 -0
  20. package/authentication/authentication-token-payload.provider.js.map +1 -0
  21. package/authentication/authentication.service.d.ts +42 -0
  22. package/authentication/authentication.service.js +133 -0
  23. package/authentication/authentication.service.js.map +1 -0
  24. package/authentication/models/authentication-credentials.model.d.ts +11 -0
  25. package/authentication/models/authentication-credentials.model.js +44 -0
  26. package/authentication/models/authentication-credentials.model.js.map +1 -0
  27. package/authentication/models/authentication-session.model.d.ts +14 -0
  28. package/authentication/models/authentication-session.model.js +59 -0
  29. package/authentication/models/authentication-session.model.js.map +1 -0
  30. package/authentication/models/index.d.ts +2 -0
  31. package/authentication/models/index.js +19 -0
  32. package/authentication/models/index.js.map +1 -0
  33. package/authentication/tokens.d.ts +2 -0
  34. package/authentication/tokens.js +6 -0
  35. package/authentication/tokens.js.map +1 -0
  36. package/collections/keyed-set.d.ts +1 -1
  37. package/collections/observable/observable-collection.d.ts +1 -1
  38. package/collections/observable/observable-list.d.ts +2 -2
  39. package/container/container.d.ts +3 -3
  40. package/container/container.js +3 -3
  41. package/container/container.js.map +1 -1
  42. package/container/decorators.d.ts +3 -3
  43. package/container/decorators.js +0 -1
  44. package/container/decorators.js.map +1 -1
  45. package/container/interfaces.d.ts +1 -1
  46. package/container/provider.d.ts +6 -6
  47. package/container/resolve-chain.d.ts +2 -2
  48. package/container/resolve-chain.js +1 -1
  49. package/container/resolve-chain.js.map +1 -1
  50. package/container/token.d.ts +3 -3
  51. package/container/type-info.d.ts +1 -1
  52. package/container/types.d.ts +4 -4
  53. package/core.d.ts +1 -1
  54. package/data-structures/linked-list.d.ts +1 -1
  55. package/data-structures/multi-key-map.d.ts +2 -2
  56. package/data-structures/sorted-array-list.d.ts +1 -1
  57. package/database/entity-repository.d.ts +2 -2
  58. package/database/entity.d.ts +3 -3
  59. package/database/module.d.ts +1 -1
  60. package/database/mongo/classes.d.ts +3 -3
  61. package/database/mongo/model/document.d.ts +3 -3
  62. package/database/mongo/module.d.ts +1 -1
  63. package/database/mongo/mongo-base.repository.d.ts +11 -11
  64. package/database/mongo/mongo-bulk.d.ts +1 -1
  65. package/database/mongo/mongo-entity-repository.d.ts +7 -7
  66. package/database/mongo/types.d.ts +16 -16
  67. package/database/query.d.ts +38 -38
  68. package/disposable/async-disposer.d.ts +3 -3
  69. package/distributed-loop/distributed-loop.d.ts +2 -2
  70. package/error/custom.error.d.ts +1 -1
  71. package/http/client/adapters/undici-http-client.adapter.d.ts +1 -1
  72. package/http/client/http-client-request.d.ts +5 -5
  73. package/http/client/http-client-response.d.ts +2 -2
  74. package/http/client/http-client.d.ts +5 -5
  75. package/http/http-body.d.ts +3 -1
  76. package/http/http-body.js +18 -12
  77. package/http/http-body.js.map +1 -1
  78. package/http/http-form.d.ts +2 -2
  79. package/http/http-headers.d.ts +3 -3
  80. package/http/http-query.d.ts +2 -2
  81. package/http/http-url-parameters.d.ts +2 -2
  82. package/http/http-value-map.d.ts +1 -1
  83. package/http/server/http-server-request.d.ts +1 -1
  84. package/http/server/http-server-response.d.ts +1 -1
  85. package/http/server/http-server.d.ts +1 -1
  86. package/http/server/node/node-http-server.d.ts +1 -1
  87. package/http/types.d.ts +5 -5
  88. package/http/utils.d.ts +3 -3
  89. package/image-service/imgproxy/imgproxy-image-service.d.ts +1 -1
  90. package/json-path/json-path.d.ts +4 -4
  91. package/key-value-store/key-value.store.d.ts +1 -1
  92. package/key-value-store/mongo/module.d.ts +1 -1
  93. package/key-value-store/mongo/mongo-key-value.model.d.ts +1 -1
  94. package/lock/lock.d.ts +4 -4
  95. package/lock/mongo/model.d.ts +1 -1
  96. package/lock/mongo/module.d.ts +1 -1
  97. package/lock/provider.d.ts +1 -1
  98. package/logger/logger.d.ts +6 -6
  99. package/mail/mail.client.d.ts +1 -1
  100. package/mail/mail.service.d.ts +3 -1
  101. package/mail/mail.service.js +11 -6
  102. package/mail/mail.service.js.map +1 -1
  103. package/mail/models/mail-address.model.d.ts +1 -1
  104. package/mail/models/mail-content.model.d.ts +1 -1
  105. package/mail/models/mail-data.model.d.ts +2 -1
  106. package/mail/models/mail-log.model.d.ts +2 -2
  107. package/mail/models/mail-send-result.model.d.ts +1 -1
  108. package/mail/models/mail-template.model.d.ts +1 -1
  109. package/mail/module.d.ts +4 -2
  110. package/mail/module.js +6 -2
  111. package/mail/module.js.map +1 -1
  112. package/mail/repositories/mongo-mail-log.repository.d.ts +2 -2
  113. package/mail/tokens.d.ts +1 -0
  114. package/mail/tokens.js +2 -1
  115. package/mail/tokens.js.map +1 -1
  116. package/message-bus/local/types.d.ts +1 -1
  117. package/message-bus/message-bus.d.ts +1 -1
  118. package/migration/migration-state.d.ts +2 -2
  119. package/migration/migrator.d.ts +4 -4
  120. package/migration/mongo/module.d.ts +1 -1
  121. package/module/module-metric-reporter.d.ts +2 -2
  122. package/module/module.d.ts +1 -1
  123. package/module/modules/function.module.d.ts +1 -1
  124. package/module/modules/web-server.module.d.ts +1 -1
  125. package/notification/api.d.ts +3 -6
  126. package/notification/api.js +2 -5
  127. package/notification/api.js.map +1 -1
  128. package/notification/models/index.d.ts +2 -0
  129. package/notification/models/index.js +19 -0
  130. package/notification/models/index.js.map +1 -0
  131. package/notification/models/notification-channel-job.model.d.ts +3 -0
  132. package/notification/models/notification-channel-job.model.js +3 -0
  133. package/notification/models/notification-channel-job.model.js.map +1 -0
  134. package/notification/models/notification.model.d.ts +27 -0
  135. package/notification/{model.js → models/notification.model.js} +28 -16
  136. package/notification/models/notification.model.js.map +1 -0
  137. package/notification/module.d.ts +1 -1
  138. package/notification/notification-channel.service.d.ts +5 -0
  139. package/notification/notification-channel.service.js +7 -0
  140. package/notification/notification-channel.service.js.map +1 -0
  141. package/notification/notification.service.d.ts +8 -0
  142. package/notification/notification.service.js +40 -0
  143. package/notification/notification.service.js.map +1 -0
  144. package/object-storage/object-storage.d.ts +2 -2
  145. package/object-storage/object.d.ts +1 -1
  146. package/object-storage/s3/s3.object-storage-provider.d.ts +1 -1
  147. package/openid-connect/mongo-oidc-state.repository.d.ts +1 -1
  148. package/openid-connect/oidc-configuration.service.d.ts +1 -1
  149. package/openid-connect/oidc-state.model.d.ts +2 -2
  150. package/openid-connect/oidc.service-model.d.ts +8 -8
  151. package/orm/decorators.d.ts +26 -0
  152. package/orm/decorators.js +170 -0
  153. package/orm/decorators.js.map +1 -1
  154. package/orm/entity-definition.model.d.ts +51 -0
  155. package/orm/entity-definition.model.js +27 -0
  156. package/orm/entity-definition.model.js.map +1 -0
  157. package/orm/index.d.ts +1 -0
  158. package/orm/index.js +18 -0
  159. package/orm/index.js.map +1 -0
  160. package/orm/models/entity.d.ts +22 -0
  161. package/orm/models/entity.js +87 -0
  162. package/orm/models/entity.js.map +1 -0
  163. package/orm/models/index.d.ts +1 -0
  164. package/orm/models/index.js +18 -0
  165. package/orm/models/index.js.map +1 -0
  166. package/orm/repository/mongo/classes.d.ts +25 -0
  167. package/orm/repository/mongo/classes.js +33 -0
  168. package/orm/repository/mongo/classes.js.map +1 -0
  169. package/orm/repository/mongo/module.d.ts +8 -0
  170. package/orm/repository/mongo/module.js +88 -0
  171. package/orm/repository/mongo/module.js.map +1 -0
  172. package/orm/repository/mongo/mongo-repository.d.ts +11 -0
  173. package/orm/repository/mongo/mongo-repository.js +55 -0
  174. package/orm/repository/mongo/mongo-repository.js.map +1 -0
  175. package/orm/repository/mongo/mongo-transaction.d.ts +10 -0
  176. package/orm/repository/mongo/mongo-transaction.js +28 -0
  177. package/orm/repository/mongo/mongo-transaction.js.map +1 -0
  178. package/orm/repository/repository.d.ts +75 -0
  179. package/orm/repository/repository.js +182 -0
  180. package/orm/repository/repository.js.map +1 -0
  181. package/orm/repository/transaction.d.ts +26 -0
  182. package/orm/repository/transaction.js +65 -0
  183. package/orm/repository/transaction.js.map +1 -0
  184. package/orm/{types.d.ts → types/definition.d.ts} +5 -5
  185. package/orm/{types.js → types/definition.js} +8 -8
  186. package/orm/types/definition.js.map +1 -0
  187. package/orm/types/index.d.ts +3 -0
  188. package/orm/types/index.js +20 -0
  189. package/orm/types/index.js.map +1 -0
  190. package/orm/types/options.d.ts +36 -0
  191. package/orm/types/options.js +5 -0
  192. package/orm/types/options.js.map +1 -0
  193. package/orm/types/query.d.ts +110 -0
  194. package/orm/types/query.js +10 -0
  195. package/orm/types/query.js.map +1 -0
  196. package/package.json +5 -5
  197. package/pdf/pdf.service.d.ts +3 -3
  198. package/pool/pool.d.ts +4 -4
  199. package/promise/cancelable-promise.d.ts +1 -1
  200. package/promise/lazy-promise.d.ts +1 -1
  201. package/queue/mongo/job.d.ts +2 -2
  202. package/queue/mongo/queue.js +2 -2
  203. package/queue/mongo/queue.js.map +1 -1
  204. package/queue/queue.d.ts +11 -6
  205. package/queue/queue.js +2 -1
  206. package/queue/queue.js.map +1 -1
  207. package/reflection/decorator-data.js +2 -1
  208. package/reflection/decorator-data.js.map +1 -1
  209. package/reflection/registry.d.ts +18 -17
  210. package/reflection/registry.js +25 -10
  211. package/reflection/registry.js.map +1 -1
  212. package/reflection/types.d.ts +34 -34
  213. package/reflection/utils.d.ts +8 -8
  214. package/reflection/utils.js +6 -6
  215. package/reflection/utils.js.map +1 -1
  216. package/rpc/endpoints/message-port.rpc-endpoint.d.ts +3 -3
  217. package/rpc/model.d.ts +22 -22
  218. package/rpc/rpc.d.ts +1 -1
  219. package/rxjs/intersection-observer.d.ts +1 -1
  220. package/rxjs/mutation-observer.d.ts +1 -1
  221. package/rxjs/performance-observer.d.ts +1 -1
  222. package/rxjs/resize-observer.d.ts +1 -1
  223. package/rxjs/slow-array.d.ts +1 -1
  224. package/rxjs/touch.d.ts +1 -1
  225. package/schema/array-constraints/maximum-length.d.ts +2 -2
  226. package/schema/array-constraints/maximum-length.js +2 -2
  227. package/schema/array-constraints/maximum-length.js.map +1 -1
  228. package/schema/array-constraints/minimum-length.d.ts +2 -2
  229. package/schema/array-constraints/minimum-length.js +2 -2
  230. package/schema/array-constraints/minimum-length.js.map +1 -1
  231. package/schema/constraints/enumeration.d.ts +4 -4
  232. package/schema/constraints/enumeration.js +5 -5
  233. package/schema/constraints/enumeration.js.map +1 -1
  234. package/schema/constraints/generic.d.ts +4 -4
  235. package/schema/constraints/generic.js +2 -2
  236. package/schema/constraints/generic.js.map +1 -1
  237. package/schema/constraints/integer.d.ts +2 -2
  238. package/schema/constraints/integer.js +3 -2
  239. package/schema/constraints/integer.js.map +1 -1
  240. package/schema/constraints/length.d.ts +1 -1
  241. package/schema/constraints/literal.d.ts +2 -2
  242. package/schema/constraints/literal.js +2 -2
  243. package/schema/constraints/literal.js.map +1 -1
  244. package/schema/constraints/maximum-date.d.ts +2 -2
  245. package/schema/constraints/maximum-date.js +3 -2
  246. package/schema/constraints/maximum-date.js.map +1 -1
  247. package/schema/constraints/maximum-length.d.ts +2 -2
  248. package/schema/constraints/maximum-length.js +2 -2
  249. package/schema/constraints/maximum-length.js.map +1 -1
  250. package/schema/constraints/maximum.d.ts +2 -2
  251. package/schema/constraints/maximum.js +3 -2
  252. package/schema/constraints/maximum.js.map +1 -1
  253. package/schema/constraints/minimum-date.d.ts +2 -2
  254. package/schema/constraints/minimum-date.js +3 -2
  255. package/schema/constraints/minimum-date.js.map +1 -1
  256. package/schema/constraints/minimum-length.d.ts +2 -2
  257. package/schema/constraints/minimum-length.js +2 -2
  258. package/schema/constraints/minimum-length.js.map +1 -1
  259. package/schema/constraints/minimum.d.ts +2 -2
  260. package/schema/constraints/minimum.js +3 -2
  261. package/schema/constraints/minimum.js.map +1 -1
  262. package/schema/constraints/pattern.d.ts +2 -2
  263. package/schema/constraints/pattern.js +3 -2
  264. package/schema/constraints/pattern.js.map +1 -1
  265. package/schema/decorators/types.d.ts +3 -3
  266. package/schema/decorators/utils.d.ts +4 -1
  267. package/schema/decorators/utils.js +1 -1
  268. package/schema/decorators/utils.js.map +1 -1
  269. package/schema/schema.d.ts +4 -4
  270. package/schema/schema.error.d.ts +1 -1
  271. package/schema/schema.js +10 -13
  272. package/schema/schema.js.map +1 -1
  273. package/schema/schemas/any.d.ts +1 -1
  274. package/schema/schemas/array.d.ts +2 -2
  275. package/schema/schemas/array.js +2 -2
  276. package/schema/schemas/array.js.map +1 -1
  277. package/schema/schemas/boolean.d.ts +1 -1
  278. package/schema/schemas/date.d.ts +2 -2
  279. package/schema/schemas/date.js +2 -2
  280. package/schema/schemas/date.js.map +1 -1
  281. package/schema/schemas/enumeration.d.ts +2 -2
  282. package/schema/schemas/enumeration.js +2 -2
  283. package/schema/schemas/enumeration.js.map +1 -1
  284. package/schema/schemas/instance.d.ts +1 -1
  285. package/schema/schemas/literal.d.ts +2 -2
  286. package/schema/schemas/literal.js +2 -2
  287. package/schema/schemas/literal.js.map +1 -1
  288. package/schema/schemas/nullable.d.ts +1 -1
  289. package/schema/schemas/number.d.ts +2 -2
  290. package/schema/schemas/number.js +2 -2
  291. package/schema/schemas/number.js.map +1 -1
  292. package/schema/schemas/object.d.ts +1 -1
  293. package/schema/schemas/omit.d.ts +2 -2
  294. package/schema/schemas/omit.js.map +1 -1
  295. package/schema/schemas/one-or-many.d.ts +2 -2
  296. package/schema/schemas/optional.d.ts +1 -1
  297. package/schema/schemas/readable-stream.d.ts +1 -1
  298. package/schema/schemas/record.d.ts +1 -1
  299. package/schema/schemas/regexp.d.ts +1 -1
  300. package/schema/schemas/string.d.ts +2 -2
  301. package/schema/schemas/string.js +3 -3
  302. package/schema/schemas/string.js.map +1 -1
  303. package/schema/schemas/uint8-array.d.ts +2 -2
  304. package/schema/schemas/uint8-array.js +3 -3
  305. package/schema/schemas/uint8-array.js.map +1 -1
  306. package/schema/schemas/union.d.ts +1 -1
  307. package/schema/schemas/unknown.d.ts +1 -1
  308. package/schema/transformers/generic.d.ts +1 -1
  309. package/schema/types/index.d.ts +5 -0
  310. package/schema/types/index.js +22 -0
  311. package/schema/types/index.js.map +1 -0
  312. package/schema/types/schema-array-constraint.d.ts +5 -0
  313. package/schema/types/schema-array-constraint.js +7 -0
  314. package/schema/types/schema-array-constraint.js.map +1 -0
  315. package/schema/types/schema-value-coercer.d.ts +8 -0
  316. package/schema/types/schema-value-coercer.js +7 -0
  317. package/schema/types/schema-value-coercer.js.map +1 -0
  318. package/schema/types/schema-value-constraint.d.ts +8 -0
  319. package/schema/types/schema-value-constraint.js +7 -0
  320. package/schema/types/schema-value-constraint.js.map +1 -0
  321. package/schema/types/schema-value-transformer.d.ts +7 -0
  322. package/schema/types/schema-value-transformer.js +7 -0
  323. package/schema/types/schema-value-transformer.js.map +1 -0
  324. package/schema/{types.d.ts → types/types.d.ts} +47 -57
  325. package/schema/types/types.js +174 -0
  326. package/schema/types/types.js.map +1 -0
  327. package/schema/utils/schema.js +1 -1
  328. package/schema/utils/schema.js.map +1 -1
  329. package/schema/utils/value-type.d.ts +1 -1
  330. package/schema/utils/value-type.js +1 -1
  331. package/schema/utils/value-type.js.map +1 -1
  332. package/search-index/elastic/config.d.ts +1 -1
  333. package/search-index/elastic/model/elastic-query.d.ts +15 -15
  334. package/search-index/elastic/model/index-mapping.d.ts +14 -14
  335. package/search-index/elastic/model/sort.d.ts +3 -3
  336. package/search-index/elastic/module.d.ts +1 -1
  337. package/search-index/search-index.d.ts +1 -1
  338. package/search-index/search-result.d.ts +2 -2
  339. package/serializer/handlers/error.d.ts +1 -1
  340. package/serializer/handlers/map.d.ts +1 -1
  341. package/serializer/handlers/regex.d.ts +1 -1
  342. package/serializer/handlers/set.d.ts +1 -1
  343. package/serializer/serializable.d.ts +6 -6
  344. package/serializer/serializer.d.ts +1 -1
  345. package/serializer/types.d.ts +15 -15
  346. package/sse/server-sent-events.d.ts +3 -3
  347. package/tailwind/theme-adapter.d.ts +1 -1
  348. package/templates/module.d.ts +1 -1
  349. package/templates/providers/file.provider-template.d.ts +2 -2
  350. package/templates/providers/file.provider-template.js +2 -1
  351. package/templates/providers/file.provider-template.js.map +1 -1
  352. package/templates/renderers/handlebars.template-renderer.d.ts +9 -9
  353. package/templates/renderers/mjml.template-renderer.d.ts +3 -3
  354. package/templates/renderers/string.template-renderer.d.ts +1 -1
  355. package/templates/resolvers/file.template-resolver.d.ts +2 -2
  356. package/templates/template.model.d.ts +1 -1
  357. package/templates/template.renderer.d.ts +4 -4
  358. package/templates/template.service.d.ts +1 -1
  359. package/text/dynamic-text.model.d.ts +1 -1
  360. package/text/localizable-text.model.d.ts +1 -1
  361. package/text/localization.service.d.ts +11 -11
  362. package/theme/theme-service.d.ts +6 -6
  363. package/threading/thread-pool.d.ts +1 -1
  364. package/threading/thread-worker.d.ts +1 -1
  365. package/types/geo-json.d.ts +12 -12
  366. package/types.d.ts +91 -91
  367. package/utils/any-iterable-iterator.d.ts +3 -3
  368. package/utils/array/array.d.ts +14 -1
  369. package/utils/array/array.js +16 -2
  370. package/utils/array/array.js.map +1 -1
  371. package/utils/async-iterable-helpers/parallel/types.d.ts +2 -2
  372. package/utils/async-iterable-helpers/types.d.ts +7 -7
  373. package/utils/backoff.d.ts +5 -5
  374. package/utils/benchmark.d.ts +1 -1
  375. package/utils/binary-search.d.ts +1 -1
  376. package/utils/binary.js.map +1 -1
  377. package/utils/cancellation-token.d.ts +1 -1
  378. package/utils/compression.d.ts +1 -1
  379. package/utils/cryptography.d.ts +11 -11
  380. package/utils/date-time.d.ts +8 -7
  381. package/utils/date-time.js +6 -2
  382. package/utils/date-time.js.map +1 -1
  383. package/utils/equals.d.ts +3 -3
  384. package/utils/factory-map.d.ts +1 -1
  385. package/utils/format-error.d.ts +1 -1
  386. package/utils/function/memoize.d.ts +1 -1
  387. package/utils/helpers.d.ts +1 -1
  388. package/utils/iterable-helpers/types.d.ts +6 -6
  389. package/utils/jwt.d.ts +4 -4
  390. package/utils/math.d.ts +1 -1
  391. package/utils/merge.d.ts +1 -1
  392. package/utils/middleware.d.ts +9 -9
  393. package/utils/moving-metric.d.ts +1 -1
  394. package/utils/object/decycle.d.ts +1 -1
  395. package/utils/object/dereference.d.ts +1 -1
  396. package/utils/object/forward-ref.d.ts +2 -2
  397. package/utils/object/lazy-property.d.ts +5 -5
  398. package/utils/object/merge.d.ts +1 -1
  399. package/utils/object/object.js +1 -2
  400. package/utils/object/object.js.map +1 -1
  401. package/utils/object/property-name.d.ts +5 -5
  402. package/utils/patch-worker.d.ts +1 -1
  403. package/utils/periodic-sampler.d.ts +1 -1
  404. package/utils/provider-function-iterable.d.ts +2 -2
  405. package/utils/proxy.d.ts +1 -1
  406. package/utils/singleton.d.ts +2 -2
  407. package/utils/sort.d.ts +2 -2
  408. package/utils/stream/stream-helper-types.d.ts +5 -5
  409. package/utils/type-guards.d.ts +3 -3
  410. package/utils/url-builder.d.ts +4 -4
  411. package/web-types.d.ts +4 -4
  412. package/notification/model.d.ts +0 -18
  413. package/notification/model.js.map +0 -1
  414. package/orm/mongo/mongo-repository.d.ts +0 -2
  415. package/orm/mongo/mongo-repository.js +0 -7
  416. package/orm/mongo/mongo-repository.js.map +0 -1
  417. package/orm/types.js.map +0 -1
  418. package/schema/types.js +0 -102
  419. package/schema/types.js.map +0 -1
@@ -2,8 +2,8 @@ import type { Injectable } from "../../container";
2
2
  import type { HttpClientOptions } from "../../http/client";
3
3
  import { HttpClient } from "../../http/client";
4
4
  import type { ApiClientImplementation, ApiDefinition, ApiEndpointDefinition } from '../types';
5
- export declare type ApiClient<T extends ApiDefinition> = new (httpClient: HttpClient) => ApiClientImplementation<T> & Injectable<HttpClientOptions>;
6
- export declare type ClientOptions = {
5
+ export type ApiClient<T extends ApiDefinition> = new (httpClient: HttpClient) => ApiClientImplementation<T> & Injectable<HttpClientOptions>;
6
+ export type ClientOptions = {
7
7
  /**
8
8
  * url prefix
9
9
  * @default `api/`
@@ -11,7 +11,7 @@ export declare type ClientOptions = {
11
11
  prefix?: string;
12
12
  defaultHttpClientOptions?: HttpClientOptions;
13
13
  };
14
- export declare type ApiClientHttpRequestContext = {
14
+ export type ApiClientHttpRequestContext = {
15
15
  endpoint: ApiEndpointDefinition;
16
16
  };
17
17
  export declare const httpClientSymbol: unique symbol;
@@ -1,5 +1,5 @@
1
1
  import { SchemaError } from "../schema";
2
- export declare type SerializedSchemaError = {
2
+ export type SerializedSchemaError = {
3
3
  message: string;
4
4
  details?: any;
5
5
  path: string;
package/api/response.d.ts CHANGED
@@ -1,21 +1,21 @@
1
1
  import type { CustomError, CustomErrorStatic } from '../error';
2
2
  import type { UndefinableJson } from '../types';
3
- export declare type ErrorHandlerData = undefined | UndefinableJson;
4
- export declare type ErrorSerializer<T extends CustomError, TData extends ErrorHandlerData> = (error: T) => TData;
5
- export declare type ErrorDeserializer<T extends CustomError, TData extends ErrorHandlerData> = (data: TData, responseError: ResponseError) => T;
6
- export declare type ErrorHandler<T extends CustomError = CustomError, TData extends ErrorHandlerData = undefined> = {
3
+ export type ErrorHandlerData = undefined | UndefinableJson;
4
+ export type ErrorSerializer<T extends CustomError, TData extends ErrorHandlerData> = (error: T) => TData;
5
+ export type ErrorDeserializer<T extends CustomError, TData extends ErrorHandlerData> = (data: TData, responseError: ResponseError) => T;
6
+ export type ErrorHandler<T extends CustomError = CustomError, TData extends ErrorHandlerData = undefined> = {
7
7
  statusCode: number;
8
8
  serializer: ErrorSerializer<T, TData>;
9
9
  deserializer: ErrorDeserializer<T, TData>;
10
10
  };
11
- export declare type ResultResponse<T> = {
11
+ export type ResultResponse<T> = {
12
12
  result: T;
13
13
  };
14
- export declare type ErrorResponse = {
14
+ export type ErrorResponse = {
15
15
  error: ResponseError;
16
16
  };
17
- export declare type Response<T> = ResultResponse<T> | ErrorResponse;
18
- export declare type ResponseError = {
17
+ export type Response<T> = ResultResponse<T> | ErrorResponse;
18
+ export type ResponseError = {
19
19
  name: string;
20
20
  message: string;
21
21
  details?: any;
@@ -1,7 +1,7 @@
1
1
  import type { InjectableOptionsWithoutLifecycle } from "../../container";
2
2
  import type { Constructor, Type } from "../../types";
3
3
  import type { ApiController, ApiDefinition } from '../types';
4
- declare type ApiDefinitionProvider = () => ApiDefinition;
4
+ type ApiDefinitionProvider = () => ApiDefinition;
5
5
  export declare const apiControllerDefinition: unique symbol;
6
6
  export declare function getApiControllerDefinition(controller: Type): ApiDefinition;
7
7
  export declare function isApiController(controller: Type): boolean;
@@ -9,15 +9,15 @@ import type { AsyncMiddleware, AsyncMiddlewareNext } from "../../utils/middlewar
9
9
  import 'urlpattern-polyfill';
10
10
  import type { ApiController, ApiDefinition, ApiEndpointDefinition, ApiEndpointMethod, ApiEndpointServerImplementation } from '../types';
11
11
  import type { CorsMiddlewareOptions } from './middlewares';
12
- export declare type ApiGatewayMiddlewareContext = {
12
+ export type ApiGatewayMiddlewareContext = {
13
13
  api: ApiItem;
14
14
  /** can be undefined if used before allowedMethods middleware */
15
15
  endpoint: GatewayEndpoint;
16
16
  resourcePatternResult: URLPatternResult;
17
17
  };
18
- export declare type ApiGatewayMiddlewareNext = AsyncMiddlewareNext<HttpServerRequest, HttpServerResponse>;
19
- export declare type ApiGatewayMiddleware = AsyncMiddleware<HttpServerRequest, HttpServerResponse, ApiGatewayMiddlewareContext>;
20
- export declare type ApiGatewayOptions = {
18
+ export type ApiGatewayMiddlewareNext = AsyncMiddlewareNext<HttpServerRequest, HttpServerResponse>;
19
+ export type ApiGatewayMiddleware = AsyncMiddleware<HttpServerRequest, HttpServerResponse, ApiGatewayMiddlewareContext>;
20
+ export type ApiGatewayOptions = {
21
21
  /**
22
22
  * Api prefix. Pass `null` to disable prefix.
23
23
  * @default api
@@ -35,18 +35,18 @@ export declare type ApiGatewayOptions = {
35
35
  */
36
36
  defaultMaxBytes?: number;
37
37
  };
38
- export declare type GatewayEndpoint = {
38
+ export type GatewayEndpoint = {
39
39
  definition: ApiEndpointDefinition;
40
40
  implementation: ApiEndpointServerImplementation;
41
41
  };
42
- export declare type ApiItem = {
42
+ export type ApiItem = {
43
43
  resource: string;
44
44
  pattern: URLPattern;
45
45
  endpoints: Map<ApiEndpointMethod, GatewayEndpoint>;
46
46
  };
47
- export declare type EndpointMetadataBodyType = 'none' | 'text' | 'json' | 'buffer' | 'stream';
48
- export declare type ApiGatewayArgument = ApiGatewayOptions;
49
- export declare type ApiMetadata = {
47
+ export type EndpointMetadataBodyType = 'none' | 'text' | 'json' | 'buffer' | 'stream';
48
+ export type ApiGatewayArgument = ApiGatewayOptions;
49
+ export type ApiMetadata = {
50
50
  api: ApiItem;
51
51
  patternResult: URLPatternResult;
52
52
  };
@@ -1,6 +1,6 @@
1
1
  import type { ApiEndpointDefinitionCors } from "../../types";
2
2
  import type { ApiGatewayMiddleware } from '../gateway';
3
- export declare type CorsMiddlewareOptions = {
3
+ export type CorsMiddlewareOptions = {
4
4
  default?: ApiEndpointDefinitionCors;
5
5
  };
6
6
  export declare function corsMiddleware(options?: CorsMiddlewareOptions): ApiGatewayMiddleware;
@@ -1,6 +1,6 @@
1
1
  import type { Type } from "../../types";
2
2
  import type { ApiGatewayOptions } from './gateway';
3
- export declare type ApiModuleOptions = {
3
+ export type ApiModuleOptions = {
4
4
  controllers: Type[];
5
5
  gatewayOptions?: ApiGatewayOptions;
6
6
  };
package/api/types.d.ts CHANGED
@@ -3,26 +3,26 @@ import type { HttpMethod } from "../http/types";
3
3
  import type { SchemaOutput, SchemaTestable } from "../schema";
4
4
  import type { NonUndefinable, OneOrMany, Record, ReturnTypeOrT } from "../types";
5
5
  import type { ApiGatewayMiddlewareContext } from './server';
6
- export declare type ApiRegistrationOptions = {
6
+ export type ApiRegistrationOptions = {
7
7
  name?: string;
8
8
  prefix?: string;
9
9
  };
10
- export declare type ApiRegistration = {
10
+ export type ApiRegistration = {
11
11
  target: object;
12
12
  name: string;
13
13
  path: string;
14
14
  prefix: string;
15
15
  };
16
- export declare type EndpointRegistrationOptions = {
16
+ export type EndpointRegistrationOptions = {
17
17
  path?: string;
18
18
  description?: string;
19
19
  };
20
- export declare type ApiEndpointMethod = HttpMethod;
21
- export declare type ApiEndpointDefinitionParameters = SchemaTestable;
22
- export declare type ApiEndpointDefinitionBody = SchemaTestable | typeof String | typeof Uint8Array | typeof Blob | typeof ReadableStream;
23
- export declare type ApiEndpointDefinitionResult = SchemaTestable | typeof String | typeof Uint8Array | typeof Blob | typeof ReadableStream;
24
- export declare type ApiEndpointDataProvider<T> = T | ((request: HttpServerRequest, context: ApiGatewayMiddlewareContext) => T | Promise<T>);
25
- export declare type ApiEndpointDefinitionCors = {
20
+ export type ApiEndpointMethod = HttpMethod;
21
+ export type ApiEndpointDefinitionParameters = SchemaTestable;
22
+ export type ApiEndpointDefinitionBody = SchemaTestable | typeof String | typeof Uint8Array | typeof Blob | typeof ReadableStream;
23
+ export type ApiEndpointDefinitionResult = SchemaTestable | typeof String | typeof Uint8Array | typeof Blob | typeof ReadableStream;
24
+ export type ApiEndpointDataProvider<T> = T | ((request: HttpServerRequest, context: ApiGatewayMiddlewareContext) => T | Promise<T>);
25
+ export type ApiEndpointDefinitionCors = {
26
26
  accessControlAllowCredentials?: ApiEndpointDataProvider<boolean | undefined>;
27
27
  accessControlAllowHeaders?: ApiEndpointDataProvider<OneOrMany<string> | undefined>;
28
28
  accessControlAllowMethods?: ApiEndpointDataProvider<OneOrMany<HttpMethod> | undefined>;
@@ -31,7 +31,7 @@ export declare type ApiEndpointDefinitionCors = {
31
31
  accessControlExposeHeaders?: ApiEndpointDataProvider<OneOrMany<string> | undefined>;
32
32
  accessControlMaxAge?: ApiEndpointDataProvider<number | undefined>;
33
33
  };
34
- export declare type ApiEndpointDefinition = {
34
+ export type ApiEndpointDefinition = {
35
35
  /**
36
36
  * Http Method
37
37
  * @default GET
@@ -67,7 +67,7 @@ export declare type ApiEndpointDefinition = {
67
67
  data?: any;
68
68
  cors?: ApiEndpointDefinitionCors;
69
69
  };
70
- export declare type ApiDefinition = {
70
+ export type ApiDefinition = {
71
71
  /**
72
72
  * Default root resource for endpoints.
73
73
  */
@@ -78,33 +78,33 @@ export declare type ApiDefinition = {
78
78
  prefix?: string | null;
79
79
  endpoints: Record<string, ApiEndpointDefinition | (() => ApiEndpointDefinition)>;
80
80
  };
81
- export declare type ApiEndpointKeys<T extends ApiDefinition> = keyof T['endpoints'];
82
- export declare type NormalizedApiEndpoints<T extends ApiDefinition['endpoints']> = {
81
+ export type ApiEndpointKeys<T extends ApiDefinition> = keyof T['endpoints'];
82
+ export type NormalizedApiEndpoints<T extends ApiDefinition['endpoints']> = {
83
83
  [P in keyof T]: ReturnTypeOrT<T[P]>;
84
84
  };
85
- export declare type ApiEndpoint<T extends ApiDefinition, K extends ApiEndpointKeys<T>> = NormalizedApiEndpoints<T['endpoints']>[K];
86
- export declare type ApiEndpointParametersSchema<T extends ApiDefinition, K extends ApiEndpointKeys<T>> = NonUndefinable<ApiEndpoint<T, K>['parameters']>;
87
- export declare type ApiEndpointBodySchema<T extends ApiDefinition, K extends ApiEndpointKeys<T>> = NonUndefinable<ApiEndpoint<T, K>['body']>;
88
- export declare type ApiEndpointResultSchema<T extends ApiDefinition, K extends ApiEndpointKeys<T>> = NonUndefinable<ApiEndpoint<T, K>['result']>;
89
- export declare type ApiBinaryType = typeof Uint8Array | typeof Blob | typeof ReadableStream;
90
- export declare type ApiInputType<T extends SchemaTestable> = T extends ApiBinaryType ? (Uint8Array | Blob | ReadableStream<Uint8Array>) : T extends SchemaTestable ? SchemaOutput<T> : never;
91
- export declare type ApiOutputType<T extends SchemaTestable> = T extends typeof ReadableStream ? ReadableStream<Uint8Array> : T extends SchemaTestable ? SchemaOutput<T> : never;
92
- export declare type ApiParameters<T extends ApiDefinition, K extends ApiEndpointKeys<T>> = ApiInputType<ApiEndpointParametersSchema<T, K>>;
93
- export declare type ApiClientBody<T extends ApiDefinition, K extends ApiEndpointKeys<T>> = ApiInputType<ApiEndpointBodySchema<T, K>>;
94
- export declare type ApiServerBody<T extends ApiDefinition, K extends ApiEndpointKeys<T>> = ApiOutputType<ApiEndpointBodySchema<T, K>>;
95
- export declare type ApiServerResult<T extends ApiDefinition, K extends ApiEndpointKeys<T>> = ApiInputType<ApiEndpointResultSchema<T, K>> | HttpServerResponse;
96
- export declare type ApiClientResult<T extends ApiDefinition, K extends ApiEndpointKeys<T>> = ApiOutputType<ApiEndpointResultSchema<T, K>>;
97
- export declare type ApiRequestData<T extends ApiDefinition = ApiDefinition, K extends ApiEndpointKeys<T> = ApiEndpointKeys<T>> = {
85
+ export type ApiEndpoint<T extends ApiDefinition, K extends ApiEndpointKeys<T>> = NormalizedApiEndpoints<T['endpoints']>[K];
86
+ export type ApiEndpointParametersSchema<T extends ApiDefinition, K extends ApiEndpointKeys<T>> = NonUndefinable<ApiEndpoint<T, K>['parameters']>;
87
+ export type ApiEndpointBodySchema<T extends ApiDefinition, K extends ApiEndpointKeys<T>> = NonUndefinable<ApiEndpoint<T, K>['body']>;
88
+ export type ApiEndpointResultSchema<T extends ApiDefinition, K extends ApiEndpointKeys<T>> = NonUndefinable<ApiEndpoint<T, K>['result']>;
89
+ export type ApiBinaryType = typeof Uint8Array | typeof Blob | typeof ReadableStream;
90
+ export type ApiInputType<T extends SchemaTestable> = T extends ApiBinaryType ? (Uint8Array | Blob | ReadableStream<Uint8Array>) : T extends SchemaTestable ? SchemaOutput<T> : never;
91
+ export type ApiOutputType<T extends SchemaTestable> = T extends typeof ReadableStream ? ReadableStream<Uint8Array> : T extends SchemaTestable ? SchemaOutput<T> : never;
92
+ export type ApiParameters<T extends ApiDefinition, K extends ApiEndpointKeys<T>> = ApiInputType<ApiEndpointParametersSchema<T, K>>;
93
+ export type ApiClientBody<T extends ApiDefinition, K extends ApiEndpointKeys<T>> = ApiInputType<ApiEndpointBodySchema<T, K>>;
94
+ export type ApiServerBody<T extends ApiDefinition, K extends ApiEndpointKeys<T>> = ApiOutputType<ApiEndpointBodySchema<T, K>>;
95
+ export type ApiServerResult<T extends ApiDefinition, K extends ApiEndpointKeys<T>> = ApiInputType<ApiEndpointResultSchema<T, K>> | HttpServerResponse;
96
+ export type ApiClientResult<T extends ApiDefinition, K extends ApiEndpointKeys<T>> = ApiOutputType<ApiEndpointResultSchema<T, K>>;
97
+ export type ApiRequestData<T extends ApiDefinition = ApiDefinition, K extends ApiEndpointKeys<T> = ApiEndpointKeys<T>> = {
98
98
  parameters: ApiParameters<T, K>;
99
99
  body: ApiServerBody<T, K>;
100
100
  request: HttpServerRequest;
101
101
  };
102
- export declare type ApiEndpointServerImplementation<T extends ApiDefinition = ApiDefinition, K extends ApiEndpointKeys<T> = ApiEndpointKeys<T>> = (requestData: ApiRequestData<T, K>) => ApiServerResult<T, K> | Promise<ApiServerResult<T, K>>;
103
- export declare type ApiEndpointClientImplementation<T extends ApiDefinition = ApiDefinition, K extends ApiEndpointKeys<T> = ApiEndpointKeys<T>> = ApiClientBody<T, K> extends never ? ApiParameters<T, K> extends never ? () => Promise<ApiClientResult<T, K>> : (parameters: ApiParameters<T, K>) => Promise<ApiClientResult<T, K>> : (parameters: ApiParameters<T, K> extends never ? undefined | Record<never, never> : ApiParameters<T, K>, body: ApiClientBody<T, K>) => Promise<ApiClientResult<T, K>>;
104
- export declare type ApiController<T extends ApiDefinition = any> = {
102
+ export type ApiEndpointServerImplementation<T extends ApiDefinition = ApiDefinition, K extends ApiEndpointKeys<T> = ApiEndpointKeys<T>> = (requestData: ApiRequestData<T, K>) => ApiServerResult<T, K> | Promise<ApiServerResult<T, K>>;
103
+ export type ApiEndpointClientImplementation<T extends ApiDefinition = ApiDefinition, K extends ApiEndpointKeys<T> = ApiEndpointKeys<T>> = ApiClientBody<T, K> extends never ? ApiParameters<T, K> extends never ? () => Promise<ApiClientResult<T, K>> : (parameters: ApiParameters<T, K>) => Promise<ApiClientResult<T, K>> : (parameters: ApiParameters<T, K> extends never ? undefined | Record<never, never> : ApiParameters<T, K>, body: ApiClientBody<T, K>) => Promise<ApiClientResult<T, K>>;
104
+ export type ApiController<T extends ApiDefinition = any> = {
105
105
  [P in ApiEndpointKeys<T>]: ApiEndpointServerImplementation<T, P>;
106
106
  };
107
- export declare type ApiClientImplementation<T extends ApiDefinition = any> = {
107
+ export type ApiClientImplementation<T extends ApiDefinition = any> = {
108
108
  [P in ApiEndpointKeys<T>]: ApiEndpointClientImplementation<T, P>;
109
109
  };
110
110
  export declare function defineApi<T extends ApiDefinition>(definition: T): T;
package/api/utils.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { ApiDefinition, ApiEndpointDefinition } from './types';
2
- declare type GetApiEndpointUrlData = {
2
+ type GetApiEndpointUrlData = {
3
3
  api: ApiDefinition;
4
4
  endpoint: ApiEndpointDefinition;
5
5
  defaultPrefix: string | undefined | null;
package/api/utils.js CHANGED
@@ -3,9 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getFullApiEndpointResource = void 0;
4
4
  const array_1 = require("../utils/array/array");
5
5
  const comparison_1 = require("../utils/comparison");
6
+ const iterable_helpers_1 = require("../utils/iterable-helpers");
6
7
  const type_guards_1 = require("../utils/type-guards");
7
8
  function getFullApiEndpointResource({ api, endpoint, defaultPrefix, explicitVersion }) {
8
- const version = (0, array_1.toArray)((0, type_guards_1.isDefined)(explicitVersion) ? explicitVersion : endpoint.version).sort(comparison_1.compareByValueDescending)[0];
9
+ const versionArray = (0, array_1.toArray)((0, type_guards_1.isDefined)(explicitVersion) ? explicitVersion : endpoint.version);
10
+ const version = (0, iterable_helpers_1.sort)(versionArray, comparison_1.compareByValueDescending)[0];
9
11
  const versionPrefix = (0, type_guards_1.isNull)(version) ? undefined : `v${version ?? 1}`;
10
12
  const rootResource = ((0, type_guards_1.isNull)(endpoint.rootResource) ? '' : endpoint.rootResource) ?? api.resource;
11
13
  const prefix = ((0, type_guards_1.isNull)(endpoint.prefix) ? '' : endpoint.prefix) ?? ((0, type_guards_1.isNull)(api.prefix) ? '' : api.prefix) ?? ((0, type_guards_1.isNull)(defaultPrefix) ? undefined : (defaultPrefix ?? 'api'));
package/api/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../source/api/utils.ts"],"names":[],"mappings":";;;AAAA,gDAA8C;AAC9C,oDAA8D;AAC9D,sDAAwD;AAUxD,SAAgB,0BAA0B,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,aAAa,EAAE,eAAe,EAAyB;IACjH,MAAM,OAAO,GAAG,IAAA,eAAO,EAAC,IAAA,uBAAS,EAAC,eAAe,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,qCAAwB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3H,MAAM,aAAa,GAAG,IAAA,oBAAM,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,OAAO,IAAI,CAAC,EAAE,CAAC;IACvE,MAAM,YAAY,GAAG,CAAC,IAAA,oBAAM,EAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC;IAClG,MAAM,MAAM,GAAG,CAAC,IAAA,oBAAM,EAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,C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M,EAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC;IAClG,MAAM,MAAM,GAAG,CAAC,IAAA,oBAAM,EAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,IAAA,oBAAM,EAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAA,oBAAM,EAAC,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,aAAa,IAAI,KAAK,CAAC,CAAC,CAAC;IAE5K,MAAM,KAAK,GAAG,CAAC,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACvE,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,uBAAS,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEjF,OAAO,IAAI,IAAI,EAAE,CAAC;AACpB,CAAC;AAXD,gEAWC"}
@@ -0,0 +1,6 @@
1
+ import type { AuthenticationCredentials, NewAuthenticationCredentials } from './models';
2
+ export declare abstract class AuthenticationCredentialsService {
3
+ abstract has(subject: string): Promise<boolean>;
4
+ abstract tryGet(subject: string): Promise<AuthenticationCredentials | undefined>;
5
+ abstract save(credentials: NewAuthenticationCredentials | AuthenticationCredentials): Promise<void>;
6
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.AuthenticationCredentialsService = void 0;
10
+ const reflection_1 = require("../reflection");
11
+ let AuthenticationCredentialsService = class AuthenticationCredentialsService {
12
+ };
13
+ AuthenticationCredentialsService = __decorate([
14
+ (0, reflection_1.Class)()
15
+ ], AuthenticationCredentialsService);
16
+ exports.AuthenticationCredentialsService = AuthenticationCredentialsService;
17
+ //# sourceMappingURL=authentication-credentials.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication-credentials.service.js","sourceRoot":"","sources":["../../source/authentication/authentication-credentials.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,8CAAqC;AAI9B,IAAe,gCAAgC,GAA/C,MAAe,gCAAgC;CAIrD,CAAA;AAJqB,gCAAgC;IADrD,IAAA,kBAAK,GAAE;GACc,gCAAgC,CAIrD;AAJqB,4EAAgC"}
@@ -0,0 +1,6 @@
1
+ import { Repository } from "../orm/repository/repository";
2
+ import type { AuthenticationSession } from './models';
3
+ export declare abstract class AuthenticationSessionRepository extends Repository<AuthenticationSession> {
4
+ abstract hasBySubject(subject: string): Promise<boolean>;
5
+ abstract tryLoadBySubject(subject: string, tokenId: string): Promise<AuthenticationSession | undefined>;
6
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.AuthenticationSessionRepository = void 0;
10
+ const repository_1 = require("../orm/repository/repository");
11
+ const reflection_1 = require("../reflection");
12
+ let AuthenticationSessionRepository = class AuthenticationSessionRepository extends repository_1.Repository {
13
+ };
14
+ AuthenticationSessionRepository = __decorate([
15
+ (0, reflection_1.Class)()
16
+ ], AuthenticationSessionRepository);
17
+ exports.AuthenticationSessionRepository = AuthenticationSessionRepository;
18
+ //# sourceMappingURL=authentication-session.repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication-session.repository.js","sourceRoot":"","sources":["../../source/authentication/authentication-session.repository.ts"],"names":[],"mappings":";;;;;;;;;AAAA,6DAAyD;AACzD,8CAAqC;AAI9B,IAAe,+BAA+B,GAA9C,MAAe,+BAAgC,SAAQ,uBAAiC;CAG9F,CAAA;AAHqB,+BAA+B;IADpD,IAAA,kBAAK,GAAE;GACc,+BAA+B,CAGpD;AAHqB,0EAA+B"}
@@ -0,0 +1,3 @@
1
+ export declare abstract class AuthenticationTokenPayloadProvider<TokenPayload, AdditionalAuthenticationData> {
2
+ abstract getTokenPayload(subject: string, additionalAuthenticationData: AdditionalAuthenticationData): Promise<TokenPayload>;
3
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.AuthenticationTokenPayloadProvider = void 0;
10
+ const reflection_1 = require("../reflection");
11
+ let AuthenticationTokenPayloadProvider = class AuthenticationTokenPayloadProvider {
12
+ };
13
+ AuthenticationTokenPayloadProvider = __decorate([
14
+ (0, reflection_1.Class)()
15
+ ], AuthenticationTokenPayloadProvider);
16
+ exports.AuthenticationTokenPayloadProvider = AuthenticationTokenPayloadProvider;
17
+ //# sourceMappingURL=authentication-token-payload.provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication-token-payload.provider.js","sourceRoot":"","sources":["../../source/authentication/authentication-token-payload.provider.ts"],"names":[],"mappings":";;;;;;;;;AAAA,8CAAqC;AAG9B,IAAe,kCAAkC,GAAjD,MAAe,kCAAkC;CAEvD,CAAA;AAFqB,kCAAkC;IADvD,IAAA,kBAAK,GAAE;GACc,kCAAkC,CAEvD;AAFqB,gFAAkC"}
@@ -0,0 +1,42 @@
1
+ import type { JwtToken, JwtTokenHeader } from "../utils/jwt";
2
+ import { AuthenticationCredentialsService } from './authentication-credentials.service';
3
+ import { AuthenticationSessionRepository } from './authentication-session.repository';
4
+ import { AuthenticationTokenPayloadProvider } from './authentication-token-payload.provider';
5
+ export type Token<TokenPayload> = JwtToken<TokenPayload & {
6
+ jti: string;
7
+ iat: number;
8
+ exp: number;
9
+ }, JwtTokenHeader<TokenHeader>>;
10
+ export type TokenHeader = {
11
+ v: number;
12
+ };
13
+ export type AuthenticationServiceOptions = {
14
+ /** Secret used for signing tokens */
15
+ secret: string;
16
+ /** Token version, forces refresh on mismatch (useful if payload changes) */
17
+ version?: number;
18
+ /** How long a token is valid */
19
+ tokenTimeToLive?: number;
20
+ /** How long a session is valid after a refreshed. Cannot be refreshed (new token issued) after it timed out. */
21
+ sessionTimeToLive?: number;
22
+ };
23
+ export type AuthenticationResult = {
24
+ token: string;
25
+ refreshToken: string;
26
+ };
27
+ export declare class AuthenticationService<TokenPayload, AdditionalAuthenticationData> {
28
+ private readonly credentialsService;
29
+ private readonly authenticationSessionRepository;
30
+ private readonly tokenPayloadProviderService;
31
+ private readonly secret;
32
+ private readonly tokenVersion;
33
+ private readonly tokenTimeToLive;
34
+ private readonly sessionTimeToLive;
35
+ constructor(credentialsService: AuthenticationCredentialsService, authenticationSessionRepository: AuthenticationSessionRepository, tokenPayloadProviderService: AuthenticationTokenPayloadProvider<TokenPayload, AdditionalAuthenticationData>, options: AuthenticationServiceOptions);
36
+ updateCredentials(subject: string, secret: string): Promise<void>;
37
+ authenticate(subject: string, secret: string, additionalAuthenticationData: AdditionalAuthenticationData): Promise<AuthenticationResult>;
38
+ validate(token: string): Promise<Token<TokenPayload>>;
39
+ private createToken;
40
+ private createRefreshToken;
41
+ private getHash;
42
+ }
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.AuthenticationService = void 0;
16
+ const container_1 = require("../container");
17
+ const error_1 = require("../error");
18
+ const invalid_token_error_1 = require("../error/invalid-token.error");
19
+ const alphabet_1 = require("../utils/alphabet");
20
+ const cryptography_1 = require("../utils/cryptography");
21
+ const date_time_1 = require("../utils/date-time");
22
+ const equals_1 = require("../utils/equals");
23
+ const jwt_1 = require("../utils/jwt");
24
+ const random_1 = require("../utils/random");
25
+ const type_guards_1 = require("../utils/type-guards");
26
+ const units_1 = require("../utils/units");
27
+ const authentication_credentials_service_1 = require("./authentication-credentials.service");
28
+ const authentication_session_repository_1 = require("./authentication-session.repository");
29
+ const authentication_token_payload_provider_1 = require("./authentication-token-payload.provider");
30
+ const tokens_1 = require("./tokens");
31
+ let AuthenticationService = class AuthenticationService {
32
+ credentialsService;
33
+ authenticationSessionRepository;
34
+ tokenPayloadProviderService;
35
+ secret;
36
+ tokenVersion;
37
+ tokenTimeToLive;
38
+ sessionTimeToLive;
39
+ constructor(credentialsService, authenticationSessionRepository, tokenPayloadProviderService, options) {
40
+ this.credentialsService = credentialsService;
41
+ this.authenticationSessionRepository = authenticationSessionRepository;
42
+ this.tokenPayloadProviderService = tokenPayloadProviderService;
43
+ this.secret = options.secret;
44
+ this.tokenVersion = options.version ?? 1;
45
+ this.tokenTimeToLive = options.tokenTimeToLive ?? (5 * units_1.millisecondsPerMinute);
46
+ this.sessionTimeToLive = options.sessionTimeToLive ?? (5 * units_1.millisecondsPerDay);
47
+ }
48
+ async updateCredentials(subject, secret) {
49
+ const salt = (0, random_1.getRandomBytes)(32);
50
+ const hash = await this.getHash(secret, salt);
51
+ const credentials = {
52
+ subject,
53
+ hashVersion: 1,
54
+ salt,
55
+ hash
56
+ };
57
+ await this.credentialsService.save(credentials);
58
+ }
59
+ async authenticate(subject, secret, additionalAuthenticationData) {
60
+ const credentials = await this.credentialsService.tryGet(subject);
61
+ if ((0, type_guards_1.isUndefined)(credentials)) {
62
+ throw new error_1.UnauthorizedError('Invalid credentials.');
63
+ }
64
+ const hash = await this.getHash(secret, credentials.salt);
65
+ if (!(0, equals_1.binaryEquals)(hash, credentials.hash)) {
66
+ throw new error_1.UnauthorizedError('Invalid credentials.');
67
+ }
68
+ const now = (0, date_time_1.currentTimestamp)();
69
+ const tokenPayload = await this.tokenPayloadProviderService.getTokenPayload(subject, additionalAuthenticationData);
70
+ const { token, payload } = await this.createToken(tokenPayload, now);
71
+ const refreshToken = await this.createRefreshToken();
72
+ await this.authenticationSessionRepository.saveAndLoad({
73
+ subject,
74
+ begin: now,
75
+ end: now + this.sessionTimeToLive,
76
+ tokenId: payload.jti,
77
+ hashVersion: 1,
78
+ refreshTokenSalt: refreshToken.salt,
79
+ refreshTokenHash: refreshToken.hash
80
+ });
81
+ return { token, refreshToken: refreshToken.token };
82
+ }
83
+ /*
84
+ async refresh(subject: string, tokenId: string, refreshToken: string): Promise<string> {
85
+ const session = await this.AuthenticationSessionRepository.tryGet(subject, tokenId);
86
+ }
87
+ */
88
+ async validate(token) {
89
+ const validatedToken = await (0, jwt_1.parseAndValidateJwtTokenString)(token, 'HS256', this.secret);
90
+ if (validatedToken.header.v != this.tokenVersion) {
91
+ throw new invalid_token_error_1.InvalidTokenError('Invalid token version.');
92
+ }
93
+ return validatedToken;
94
+ }
95
+ async createToken(tokenPayload, timestamp = (0, date_time_1.currentTimestamp)()) {
96
+ const header = {
97
+ v: this.tokenVersion,
98
+ alg: 'HS256',
99
+ typ: 'JWT'
100
+ };
101
+ const payload = {
102
+ jti: (0, random_1.getRandomString)(24, alphabet_1.Alphabet.LowerUpperCaseNumbers),
103
+ iat: (0, date_time_1.timestampToTimestampSeconds)(timestamp),
104
+ exp: (0, date_time_1.timestampToTimestampSeconds)(timestamp + this.tokenTimeToLive),
105
+ ...tokenPayload
106
+ };
107
+ const token = await (0, jwt_1.createJwtTokenString)({
108
+ header,
109
+ payload
110
+ }, this.secret);
111
+ return { header, payload, token };
112
+ }
113
+ async createRefreshToken() {
114
+ const token = (0, random_1.getRandomString)(64, alphabet_1.Alphabet.LowerUpperCaseNumbers);
115
+ const salt = (0, random_1.getRandomBytes)(32);
116
+ const hash = await this.getHash(token, salt);
117
+ return { token, salt, hash: new Uint8Array(hash) };
118
+ }
119
+ async getHash(password, salt) {
120
+ const key = await (0, cryptography_1.importPbkdf2Key)(password);
121
+ const hash = await (0, cryptography_1.deriveBits)({ name: 'PBKDF2', hash: 'SHA-512', iterations: 250000, salt }, key, 384);
122
+ return new Uint8Array(hash);
123
+ }
124
+ };
125
+ AuthenticationService = __decorate([
126
+ (0, container_1.singleton)(),
127
+ __param(3, (0, container_1.inject)(tokens_1.AUTHENTICATION_SERVICE_OPTIONS)),
128
+ __metadata("design:paramtypes", [authentication_credentials_service_1.AuthenticationCredentialsService,
129
+ authentication_session_repository_1.AuthenticationSessionRepository,
130
+ authentication_token_payload_provider_1.AuthenticationTokenPayloadProvider, Object])
131
+ ], AuthenticationService);
132
+ exports.AuthenticationService = AuthenticationService;
133
+ //# sourceMappingURL=authentication.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication.service.js","sourceRoot":"","sources":["../../source/authentication/authentication.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAgD;AAChD,oCAA4C;AAC5C,sEAAgE;AAChE,gDAA4C;AAC5C,wDAAmE;AACnE,kDAAkF;AAClF,4CAA8C;AAE9C,sCAAmF;AACnF,4CAAiE;AACjE,sDAAkD;AAClD,0CAA0E;AAC1E,6FAAwF;AACxF,2FAAsF;AACtF,mGAA6F;AAE7F,qCAA0D;AAwCnD,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IACf,kBAAkB,CAAmC;IACrD,+BAA+B,CAAkC;IACjE,2BAA2B,CAAiF;IAE5G,MAAM,CAAS;IACf,YAAY,CAAS;IACrB,eAAe,CAAS;IACxB,iBAAiB,CAAS;IAE3C,YACE,kBAAoD,EACpD,+BAAgE,EAChE,2BAA2G,EACnE,OAAqC;QAE7E,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;QAC7C,IAAI,CAAC,+BAA+B,GAAG,+BAA+B,CAAC;QACvE,IAAI,CAAC,2BAA2B,GAAG,2BAA2B,CAAC;QAE/D,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CA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AAqB,CA4HjC;AA5HY,sDAAqB"}
@@ -0,0 +1,11 @@
1
+ import { Entity } from "../../orm/models";
2
+ export declare class AuthenticationCredentials extends Entity {
3
+ subject: string;
4
+ hashVersion: number;
5
+ salt: Uint8Array;
6
+ hash: Uint8Array;
7
+ }
8
+ declare const NewAuthenticationCredentials_base: import("../../types").Type<import("../../types").PartialProperty<AuthenticationCredentials, "id">, any>;
9
+ export declare class NewAuthenticationCredentials extends NewAuthenticationCredentials_base {
10
+ }
11
+ export {};
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.NewAuthenticationCredentials = exports.AuthenticationCredentials = void 0;
13
+ const models_1 = require("../../orm/models");
14
+ const schema_1 = require("../../schema");
15
+ class AuthenticationCredentials extends models_1.Entity {
16
+ subject;
17
+ hashVersion;
18
+ salt;
19
+ hash;
20
+ }
21
+ __decorate([
22
+ (0, schema_1.Property)(),
23
+ __metadata("design:type", String)
24
+ ], AuthenticationCredentials.prototype, "subject", void 0);
25
+ __decorate([
26
+ (0, schema_1.Property)(),
27
+ __metadata("design:type", Number)
28
+ ], AuthenticationCredentials.prototype, "hashVersion", void 0);
29
+ __decorate([
30
+ (0, schema_1.Property)(),
31
+ __metadata("design:type", Uint8Array)
32
+ ], AuthenticationCredentials.prototype, "salt", void 0);
33
+ __decorate([
34
+ (0, schema_1.Property)(),
35
+ __metadata("design:type", Uint8Array)
36
+ ], AuthenticationCredentials.prototype, "hash", void 0);
37
+ exports.AuthenticationCredentials = AuthenticationCredentials;
38
+ let NewAuthenticationCredentials = class NewAuthenticationCredentials extends (0, models_1.newEntity)(AuthenticationCredentials) {
39
+ };
40
+ NewAuthenticationCredentials = __decorate([
41
+ (0, schema_1.Class)()
42
+ ], NewAuthenticationCredentials);
43
+ exports.NewAuthenticationCredentials = NewAuthenticationCredentials;
44
+ //# sourceMappingURL=authentication-credentials.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication-credentials.model.js","sourceRoot":"","sources":["../../../source/authentication/models/authentication-credentials.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAiD;AACjD,yCAA2C;AAE3C,MAAa,yBAA0B,SAAQ,eAAM;IAEnD,OAAO,CAAS;IAGhB,WAAW,CAAS;IAGpB,IAAI,CAAa;IAGjB,IAAI,CAAa;CAClB;AAXC;IAAC,IAAA,iBAAQ,GAAE;;0DACK;AAEhB;IAAC,IAAA,iBAAQ,GAAE;;8DACS;AAEpB;IAAC,IAAA,iBAAQ,GAAE;8BACL,UAAU;uDAAC;AAEjB;IAAC,IAAA,iBAAQ,GAAE;8BACL,UAAU;uDAAC;AAXnB,8DAYC;AAGM,IAAM,4BAA4B,GAAlC,MAAM,4BAA6B,SAAQ,IAAA,kBAAS,EAAC,yBAAyB,CAAC;CAAI,CAAA;AAA7E,4BAA4B;IADxC,IAAA,cAAK,GAAE;GACK,4BAA4B,CAAiD;AAA7E,oEAA4B"}