@venizia/ignis 0.4.8-0 → 0.4.8-10

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 (275) hide show
  1. package/README.md +7 -14
  2. package/dist/esm/base/applications/base.d.ts +19 -0
  3. package/dist/esm/base/applications/base.js +19 -0
  4. package/dist/esm/base/applications/base.js.map +1 -1
  5. package/dist/esm/base/applications/boot-steps.d.ts +1 -0
  6. package/dist/esm/base/applications/boot-steps.js.map +1 -1
  7. package/dist/esm/base/applications/common/types.d.ts +21 -4
  8. package/dist/esm/base/applications/common/types.js.map +1 -1
  9. package/dist/esm/base/applications/server.d.ts +12 -0
  10. package/dist/esm/base/applications/server.js +11 -0
  11. package/dist/esm/base/applications/server.js.map +1 -1
  12. package/dist/esm/base/metadata/request-context.d.ts +1 -0
  13. package/dist/esm/base/metadata/request-context.js +1 -0
  14. package/dist/esm/base/metadata/request-context.js.map +1 -1
  15. package/dist/esm/base/middlewares/request-spy/request-spy.middleware.d.ts +1 -0
  16. package/dist/esm/base/middlewares/request-spy/request-spy.middleware.js +9 -2
  17. package/dist/esm/base/middlewares/request-spy/request-spy.middleware.js.map +1 -1
  18. package/dist/esm/components/api-reference/common/constants.d.ts +1 -0
  19. package/dist/esm/components/api-reference/common/constants.js +1 -0
  20. package/dist/esm/components/api-reference/common/constants.js.map +1 -1
  21. package/dist/esm/components/api-reference/common/keys.d.ts +1 -0
  22. package/dist/esm/components/api-reference/common/keys.js +1 -0
  23. package/dist/esm/components/api-reference/common/keys.js.map +1 -1
  24. package/dist/esm/components/api-reference/common/types.d.ts +18 -1
  25. package/dist/esm/components/api-reference/common/types.js.map +1 -1
  26. package/dist/esm/components/api-reference/component.d.ts +14 -0
  27. package/dist/esm/components/api-reference/component.js +14 -0
  28. package/dist/esm/components/api-reference/component.js.map +1 -1
  29. package/dist/esm/components/api-reference/ui/factory.d.ts +1 -0
  30. package/dist/esm/components/api-reference/ui/factory.js +1 -0
  31. package/dist/esm/components/api-reference/ui/factory.js.map +1 -1
  32. package/dist/esm/components/api-reference/ui/scalar.d.ts +1 -0
  33. package/dist/esm/components/api-reference/ui/scalar.js +1 -0
  34. package/dist/esm/components/api-reference/ui/scalar.js.map +1 -1
  35. package/dist/esm/components/api-reference/ui/swagger.d.ts +1 -0
  36. package/dist/esm/components/api-reference/ui/swagger.js +1 -0
  37. package/dist/esm/components/api-reference/ui/swagger.js.map +1 -1
  38. package/dist/esm/components/auth/authenticate/component.d.ts +1 -0
  39. package/dist/esm/components/auth/authenticate/component.js +38 -1
  40. package/dist/esm/components/auth/authenticate/component.js.map +1 -1
  41. package/dist/esm/components/auth/authenticate/controllers/factory.d.ts +2 -0
  42. package/dist/esm/components/auth/authenticate/controllers/factory.js +1 -0
  43. package/dist/esm/components/auth/authenticate/controllers/factory.js.map +1 -1
  44. package/dist/esm/components/auth/authenticate/controllers/jwks/controller.d.ts +1 -0
  45. package/dist/esm/components/auth/authenticate/controllers/jwks/controller.js +1 -0
  46. package/dist/esm/components/auth/authenticate/controllers/jwks/controller.js.map +1 -1
  47. package/dist/esm/components/auth/authenticate/services/bearer/abstract.service.d.ts +56 -5
  48. package/dist/esm/components/auth/authenticate/services/bearer/abstract.service.js +115 -11
  49. package/dist/esm/components/auth/authenticate/services/bearer/abstract.service.js.map +1 -1
  50. package/dist/esm/components/auth/authenticate/services/bearer/jwks/issuer.service.d.ts +1 -0
  51. package/dist/esm/components/auth/authenticate/services/bearer/jwks/issuer.service.js +3 -2
  52. package/dist/esm/components/auth/authenticate/services/bearer/jwks/issuer.service.js.map +1 -1
  53. package/dist/esm/components/auth/authenticate/services/bearer/jwks/verifier.service.d.ts +1 -0
  54. package/dist/esm/components/auth/authenticate/services/bearer/jwks/verifier.service.js +11 -3
  55. package/dist/esm/components/auth/authenticate/services/bearer/jwks/verifier.service.js.map +1 -1
  56. package/dist/esm/components/auth/authenticate/services/bearer/jws.service.d.ts +11 -0
  57. package/dist/esm/components/auth/authenticate/services/bearer/jws.service.js +25 -3
  58. package/dist/esm/components/auth/authenticate/services/bearer/jws.service.js.map +1 -1
  59. package/dist/esm/components/auth/authenticate/services/index.d.ts +1 -0
  60. package/dist/esm/components/auth/authenticate/services/index.js +1 -0
  61. package/dist/esm/components/auth/authenticate/services/index.js.map +1 -1
  62. package/dist/esm/components/auth/authenticate/services/jwks-url-policy.d.ts +42 -0
  63. package/dist/esm/components/auth/authenticate/services/jwks-url-policy.js +162 -0
  64. package/dist/esm/components/auth/authenticate/services/jwks-url-policy.js.map +1 -0
  65. package/dist/esm/components/auth/authenticate/services/service/verifier.service.js +7 -1
  66. package/dist/esm/components/auth/authenticate/services/service/verifier.service.js.map +1 -1
  67. package/dist/esm/components/auth/authenticate/strategies/jwks/issuer.d.ts +1 -0
  68. package/dist/esm/components/auth/authenticate/strategies/jwks/issuer.js +1 -0
  69. package/dist/esm/components/auth/authenticate/strategies/jwks/issuer.js.map +1 -1
  70. package/dist/esm/components/auth/authenticate/strategies/jwks/verifier.d.ts +1 -0
  71. package/dist/esm/components/auth/authenticate/strategies/jwks/verifier.js +1 -0
  72. package/dist/esm/components/auth/authenticate/strategies/jwks/verifier.js.map +1 -1
  73. package/dist/esm/components/auth/authenticate/strategies/jws.strategy.d.ts +1 -0
  74. package/dist/esm/components/auth/authenticate/strategies/jws.strategy.js +1 -0
  75. package/dist/esm/components/auth/authenticate/strategies/jws.strategy.js.map +1 -1
  76. package/dist/esm/components/auth/authenticate/strategies/service.strategy.js +2 -4
  77. package/dist/esm/components/auth/authenticate/strategies/service.strategy.js.map +1 -1
  78. package/dist/esm/components/auth/authorize/adapters/base-filtered.d.ts +1 -1
  79. package/dist/esm/components/auth/authorize/adapters/base-filtered.js +3 -2
  80. package/dist/esm/components/auth/authorize/adapters/base-filtered.js.map +1 -1
  81. package/dist/esm/components/auth/authorize/adapters/common/types.d.ts +2 -0
  82. package/dist/esm/components/auth/authorize/adapters/common/types.js.map +1 -1
  83. package/dist/esm/components/auth/authorize/adapters/connector.d.ts +2 -2
  84. package/dist/esm/components/auth/authorize/adapters/connector.js +3 -2
  85. package/dist/esm/components/auth/authorize/adapters/connector.js.map +1 -1
  86. package/dist/esm/components/auth/authorize/adapters/custom-grant-expander.js +1 -1
  87. package/dist/esm/components/auth/authorize/adapters/custom-grant-expander.js.map +1 -1
  88. package/dist/esm/components/auth/authorize/adapters/scoped-casbin/common/types.d.ts +2 -0
  89. package/dist/esm/components/auth/authorize/adapters/scoped-casbin/common/types.js.map +1 -1
  90. package/dist/esm/components/auth/authorize/adapters/scoped-casbin/policy-edges.d.ts +1 -0
  91. package/dist/esm/components/auth/authorize/adapters/scoped-casbin/policy-edges.js +1 -0
  92. package/dist/esm/components/auth/authorize/adapters/scoped-casbin/policy-edges.js.map +1 -1
  93. package/dist/esm/components/auth/authorize/component.d.ts +1 -0
  94. package/dist/esm/components/auth/authorize/component.js +1 -0
  95. package/dist/esm/components/auth/authorize/component.js.map +1 -1
  96. package/dist/esm/components/auth/authorize/enforcers/casbin.enforcer.d.ts +1 -0
  97. package/dist/esm/components/auth/authorize/enforcers/casbin.enforcer.js +1 -0
  98. package/dist/esm/components/auth/authorize/enforcers/casbin.enforcer.js.map +1 -1
  99. package/dist/esm/components/auth/models/entities/columns.d.ts +1 -0
  100. package/dist/esm/components/auth/models/entities/columns.js.map +1 -1
  101. package/dist/esm/components/auth/models/entities/permission.model.d.ts +2 -0
  102. package/dist/esm/components/auth/models/entities/permission.model.js.map +1 -1
  103. package/dist/esm/components/auth/models/entities/policy-definition.model.d.ts +1 -0
  104. package/dist/esm/components/auth/models/entities/policy-definition.model.js.map +1 -1
  105. package/dist/esm/components/controller/grpc/common/types.d.ts +2 -0
  106. package/dist/esm/components/controller/grpc/common/types.js +1 -0
  107. package/dist/esm/components/controller/grpc/common/types.js.map +1 -1
  108. package/dist/esm/components/controller/grpc/grpc.component.d.ts +1 -0
  109. package/dist/esm/components/controller/grpc/grpc.component.js +1 -0
  110. package/dist/esm/components/controller/grpc/grpc.component.js.map +1 -1
  111. package/dist/esm/components/health-check/common/constants.d.ts +1 -0
  112. package/dist/esm/components/health-check/common/constants.js +1 -0
  113. package/dist/esm/components/health-check/common/constants.js.map +1 -1
  114. package/dist/esm/components/health-check/common/keys.d.ts +1 -0
  115. package/dist/esm/components/health-check/common/keys.js +1 -0
  116. package/dist/esm/components/health-check/common/keys.js.map +1 -1
  117. package/dist/esm/components/health-check/common/rest-paths.d.ts +1 -0
  118. package/dist/esm/components/health-check/common/rest-paths.js +1 -0
  119. package/dist/esm/components/health-check/common/rest-paths.js.map +1 -1
  120. package/dist/esm/components/health-check/common/types.d.ts +24 -3
  121. package/dist/esm/components/health-check/common/types.js.map +1 -1
  122. package/dist/esm/components/health-check/component.d.ts +15 -0
  123. package/dist/esm/components/health-check/component.js +15 -0
  124. package/dist/esm/components/health-check/component.js.map +1 -1
  125. package/dist/esm/components/health-check/controller.d.ts +1 -0
  126. package/dist/esm/components/health-check/controller.js +1 -0
  127. package/dist/esm/components/health-check/controller.js.map +1 -1
  128. package/dist/esm/components/health-check/reporter.js +2 -2
  129. package/dist/esm/components/health-check/reporter.js.map +1 -1
  130. package/dist/esm/components/index.d.ts +1 -0
  131. package/dist/esm/components/index.js +1 -0
  132. package/dist/esm/components/index.js.map +1 -1
  133. package/dist/esm/components/mail/common/constants.d.ts +6 -0
  134. package/dist/esm/components/mail/common/constants.js +5 -0
  135. package/dist/esm/components/mail/common/constants.js.map +1 -1
  136. package/dist/esm/components/mail/common/keys.d.ts +1 -0
  137. package/dist/esm/components/mail/common/keys.js +1 -0
  138. package/dist/esm/components/mail/common/keys.js.map +1 -1
  139. package/dist/esm/components/mail/common/types/message.d.ts +10 -0
  140. package/dist/esm/components/mail/common/types/message.js.map +1 -1
  141. package/dist/esm/components/mail/common/types/options.d.ts +22 -1
  142. package/dist/esm/components/mail/common/types/options.js.map +1 -1
  143. package/dist/esm/components/mail/common/types/queue.d.ts +7 -0
  144. package/dist/esm/components/mail/common/types/queue.js.map +1 -1
  145. package/dist/esm/components/mail/common/types/template.d.ts +2 -0
  146. package/dist/esm/components/mail/common/types/template.js.map +1 -1
  147. package/dist/esm/components/mail/common/types/verification.d.ts +6 -0
  148. package/dist/esm/components/mail/common/types/verification.js.map +1 -1
  149. package/dist/esm/components/mail/component.d.ts +1 -0
  150. package/dist/esm/components/mail/component.js +1 -0
  151. package/dist/esm/components/mail/component.js.map +1 -1
  152. package/dist/esm/components/mail/helpers/executors/bull-mq-executor.helper.d.ts +1 -0
  153. package/dist/esm/components/mail/helpers/executors/bull-mq-executor.helper.js +1 -0
  154. package/dist/esm/components/mail/helpers/executors/bull-mq-executor.helper.js.map +1 -1
  155. package/dist/esm/components/mail/helpers/executors/direct-executor.helper.d.ts +1 -0
  156. package/dist/esm/components/mail/helpers/executors/direct-executor.helper.js +1 -0
  157. package/dist/esm/components/mail/helpers/executors/direct-executor.helper.js.map +1 -1
  158. package/dist/esm/components/mail/helpers/executors/internal-queue-executor.helper.d.ts +1 -0
  159. package/dist/esm/components/mail/helpers/executors/internal-queue-executor.helper.js +1 -0
  160. package/dist/esm/components/mail/helpers/executors/internal-queue-executor.helper.js.map +1 -1
  161. package/dist/esm/components/mail/helpers/transporters/amazon-ses-transporter.helper.d.ts +1 -0
  162. package/dist/esm/components/mail/helpers/transporters/amazon-ses-transporter.helper.js +1 -0
  163. package/dist/esm/components/mail/helpers/transporters/amazon-ses-transporter.helper.js.map +1 -1
  164. package/dist/esm/components/mail/helpers/transporters/mailgun-transporter.helper.d.ts +1 -0
  165. package/dist/esm/components/mail/helpers/transporters/mailgun-transporter.helper.js +1 -0
  166. package/dist/esm/components/mail/helpers/transporters/mailgun-transporter.helper.js.map +1 -1
  167. package/dist/esm/components/mail/helpers/transporters/nodemail-transporter.helper.d.ts +1 -0
  168. package/dist/esm/components/mail/helpers/transporters/nodemail-transporter.helper.js +1 -0
  169. package/dist/esm/components/mail/helpers/transporters/nodemail-transporter.helper.js.map +1 -1
  170. package/dist/esm/components/mail/providers/mail-queue-executor.provider.d.ts +2 -0
  171. package/dist/esm/components/mail/providers/mail-queue-executor.provider.js +1 -0
  172. package/dist/esm/components/mail/providers/mail-queue-executor.provider.js.map +1 -1
  173. package/dist/esm/components/mail/providers/mail-transporter.provider.d.ts +2 -0
  174. package/dist/esm/components/mail/providers/mail-transporter.provider.js +1 -0
  175. package/dist/esm/components/mail/providers/mail-transporter.provider.js.map +1 -1
  176. package/dist/esm/components/mail/services/generators/numeric-code.d.ts +1 -5
  177. package/dist/esm/components/mail/services/generators/numeric-code.js +3 -30
  178. package/dist/esm/components/mail/services/generators/numeric-code.js.map +1 -1
  179. package/dist/esm/components/mail/services/generators/random-token.d.ts +4 -0
  180. package/dist/esm/components/mail/services/generators/random-token.js +9 -5
  181. package/dist/esm/components/mail/services/generators/random-token.js.map +1 -1
  182. package/dist/esm/components/mail/services/generators/verification-data.d.ts +1 -0
  183. package/dist/esm/components/mail/services/generators/verification-data.js +1 -0
  184. package/dist/esm/components/mail/services/generators/verification-data.js.map +1 -1
  185. package/dist/esm/components/mail/services/mail.service.d.ts +1 -0
  186. package/dist/esm/components/mail/services/mail.service.js +1 -0
  187. package/dist/esm/components/mail/services/mail.service.js.map +1 -1
  188. package/dist/esm/components/mail/services/template.service.d.ts +1 -0
  189. package/dist/esm/components/mail/services/template.service.js +1 -0
  190. package/dist/esm/components/mail/services/template.service.js.map +1 -1
  191. package/dist/esm/components/mail/utilities/address.utility.d.ts +1 -0
  192. package/dist/esm/components/mail/utilities/address.utility.js +1 -0
  193. package/dist/esm/components/mail/utilities/address.utility.js.map +1 -1
  194. package/dist/esm/components/mail/utilities/mime.utility.d.ts +1 -0
  195. package/dist/esm/components/mail/utilities/mime.utility.js +5 -4
  196. package/dist/esm/components/mail/utilities/mime.utility.js.map +1 -1
  197. package/dist/esm/components/mail/utilities/verification.utility.d.ts +1 -0
  198. package/dist/esm/components/mail/utilities/verification.utility.js +1 -0
  199. package/dist/esm/components/mail/utilities/verification.utility.js.map +1 -1
  200. package/dist/esm/components/request-tracker/component.d.ts +1 -0
  201. package/dist/esm/components/request-tracker/component.js +1 -0
  202. package/dist/esm/components/request-tracker/component.js.map +1 -1
  203. package/dist/esm/components/server-info/common/constants.d.ts +6 -0
  204. package/dist/esm/components/server-info/common/constants.js +6 -0
  205. package/dist/esm/components/server-info/common/constants.js.map +1 -0
  206. package/dist/esm/components/server-info/common/index.d.ts +5 -0
  207. package/dist/esm/components/server-info/common/index.js +5 -0
  208. package/dist/esm/components/server-info/common/index.js.map +1 -0
  209. package/dist/esm/components/server-info/common/keys.d.ts +5 -0
  210. package/dist/esm/components/server-info/common/keys.js +5 -0
  211. package/dist/esm/components/server-info/common/keys.js.map +1 -0
  212. package/dist/esm/components/server-info/common/rest-paths.d.ts +5 -0
  213. package/dist/esm/components/server-info/common/rest-paths.js +5 -0
  214. package/dist/esm/components/server-info/common/rest-paths.js.map +1 -0
  215. package/dist/esm/components/server-info/common/types.d.ts +68 -0
  216. package/dist/esm/components/server-info/common/types.js +2 -0
  217. package/dist/esm/components/server-info/common/types.js.map +1 -0
  218. package/dist/esm/components/server-info/component.d.ts +31 -0
  219. package/dist/esm/components/server-info/component.js +87 -0
  220. package/dist/esm/components/server-info/component.js.map +1 -0
  221. package/dist/esm/components/server-info/controller.d.ts +14 -0
  222. package/dist/esm/components/server-info/controller.js +68 -0
  223. package/dist/esm/components/server-info/controller.js.map +1 -0
  224. package/dist/esm/components/server-info/index.d.ts +5 -0
  225. package/dist/esm/components/server-info/index.js +5 -0
  226. package/dist/esm/components/server-info/index.js.map +1 -0
  227. package/dist/esm/components/server-info/reporter.d.ts +25 -0
  228. package/dist/esm/components/server-info/reporter.js +68 -0
  229. package/dist/esm/components/server-info/reporter.js.map +1 -0
  230. package/dist/esm/components/socket-io/common/keys.d.ts +1 -0
  231. package/dist/esm/components/socket-io/common/keys.js +1 -0
  232. package/dist/esm/components/socket-io/common/keys.js.map +1 -1
  233. package/dist/esm/components/socket-io/component.d.ts +1 -0
  234. package/dist/esm/components/socket-io/component.js +1 -0
  235. package/dist/esm/components/socket-io/component.js.map +1 -1
  236. package/dist/esm/components/static-asset/common/constants.d.ts +5 -0
  237. package/dist/esm/components/static-asset/common/constants.js +3 -0
  238. package/dist/esm/components/static-asset/common/constants.js.map +1 -1
  239. package/dist/esm/components/static-asset/common/keys.d.ts +1 -0
  240. package/dist/esm/components/static-asset/common/keys.js +1 -0
  241. package/dist/esm/components/static-asset/common/keys.js.map +1 -1
  242. package/dist/esm/components/static-asset/common/types.d.ts +48 -6
  243. package/dist/esm/components/static-asset/common/types.js.map +1 -1
  244. package/dist/esm/components/static-asset/controller/base.definition.d.ts +2 -0
  245. package/dist/esm/components/static-asset/controller/base.definition.js +6 -4
  246. package/dist/esm/components/static-asset/controller/base.definition.js.map +1 -1
  247. package/dist/esm/components/static-asset/controller/factory.d.ts +3 -0
  248. package/dist/esm/components/static-asset/controller/factory.js +18 -9
  249. package/dist/esm/components/static-asset/controller/factory.js.map +1 -1
  250. package/dist/esm/components/static-asset/controller/meta-link.js +1 -1
  251. package/dist/esm/components/static-asset/controller/meta-link.js.map +1 -1
  252. package/dist/esm/components/static-asset/controller/route-options.d.ts +9 -0
  253. package/dist/esm/components/static-asset/controller/route-options.js +16 -3
  254. package/dist/esm/components/static-asset/controller/route-options.js.map +1 -1
  255. package/dist/esm/components/static-asset/ingest.d.ts +7 -3
  256. package/dist/esm/components/static-asset/ingest.js +2 -2
  257. package/dist/esm/components/static-asset/ingest.js.map +1 -1
  258. package/dist/esm/components/static-asset/models/base.model.d.ts +2 -0
  259. package/dist/esm/components/static-asset/models/base.model.js.map +1 -1
  260. package/dist/esm/components/websocket/common/keys.d.ts +1 -0
  261. package/dist/esm/components/websocket/common/keys.js +1 -0
  262. package/dist/esm/components/websocket/common/keys.js.map +1 -1
  263. package/dist/esm/components/websocket/component.d.ts +1 -0
  264. package/dist/esm/components/websocket/component.js +1 -0
  265. package/dist/esm/components/websocket/component.js.map +1 -1
  266. package/dist/esm/testing/assert-application-boots.d.ts +48 -8
  267. package/dist/esm/testing/assert-application-boots.js +25 -1
  268. package/dist/esm/testing/assert-application-boots.js.map +1 -1
  269. package/dist/esm/utilities/drizzle-result.utility.d.ts +1 -0
  270. package/dist/esm/utilities/drizzle-result.utility.js +1 -0
  271. package/dist/esm/utilities/drizzle-result.utility.js.map +1 -1
  272. package/dist/presets/app/preset.json +4 -4
  273. package/dist/presets/lib/preset.json +3 -3
  274. package/dist/presets/shared/preset.json +1 -1
  275. package/package.json +8 -8
@@ -1 +1 @@
1
- {"version":3,"file":"ingest.js","sourceRoot":"","sources":["../../../../src/components/static-asset/ingest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EACL,SAAS,EACT,iBAAiB,EACjB,eAAe,GAOhB,MAAM,wBAAwB,CAAC;AA2ChC,MAAM,cAAc,GAAG,CAAC,IAAuC,EAAU,EAAE;IACzE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;IACjC,MAAM,WAAW,GAAG,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,IAAI,QAAQ,CAAC;IAC9E,MAAM,UAAU,GAAG,WAAW,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAEhE,OAAO,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,IAAI,UAAU,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;AACjE,CAAC,CAAC;AAEF,uDAAuD;AACvD,MAAM,OAAO,WAAW;IACtB;;;;;;;;;;OAUG;IACH,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAA2B;QAC9C,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC;QAEtF,MAAM,QAAQ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,\n type IObjectRef,\n type IFileStat,\n type IStorageHelper,\n type IUploadResult,\n type IUrlSafetyPolicy,\n} from '@venizia/ignis-helpers';\n\n/**\n * What was stored, and what the backend reports about it. The stat is returned because `getStat`\n * already ran to size the result - a caller writing its own row would otherwise pay for it twice.\n *\n * This does NOT write a meta link. The columns an application attaches to an object - a principal,\n * a variant - come from its own domain, not from the object, so the row stays the caller's.\n */\nexport interface IIngestFromUrlResult {\n upload: IUploadResult;\n stat: IFileStat;\n}\n\n/** Where a fetched object lands, and what it is attached to. */\nexport interface IIngestFromUrlOptions {\n helper: IStorageHelper;\n url: string;\n bucket: IBucketRef;\n\n /**\n * Decides the stored key.\n *\n * **Absent, the key comes from the remote url's last path segment - which on an untrusted url is\n * named by whoever supplied it.** Pass `resolveKey` whenever the url is not your own; the\n * validation below bounds what it can do, but it does not make the remote name yours.\n */\n resolveKey?: (opts: { url: URL; contentType: string }) => string;\n folderPath?: string;\n\n /** Absent leaves IGNIS's own default: https only, no private address, 3 hops, 10s, 10 MB. */\n policy?: IUrlSafetyPolicy;\n\n /** Folder nesting the key may carry. Absent uses `BaseStorageHelper.DEFAULT_MAX_FOLDER_DEPTH`. */\n maxFolderDepth?: number;\n\n /**\n * Where the object is served from. **Required**: an absent hook used to yield an empty link, which\n * is exactly the value that satisfies a NOT NULL column and points nowhere.\n */\n normalizeLinkFn: (opts: { bucket: IBucketRef; object: IObjectRef }) => string;\n}\n\nconst readKeyFromUrl = (opts: { url: URL; folderPath?: string }): string => {\n const { url, folderPath } = opts;\n const lastSegment = url.pathname.split('/').filter(Boolean).pop() ?? 'object';\n const normalized = lastSegment.toLowerCase().replace(/ /g, '_');\n\n return folderPath ? `${folderPath}/${normalized}` : normalized;\n};\n\n/** Storing an object that came from somewhere else. */\nexport class AssetIngest {\n /**\n * Fetches an untrusted url and stores what comes back, without the bytes passing through this\n * process: the guarded body is capped and handed to `writeStream` as a stream.\n *\n * The url is guarded by `UrlIngest.fetchGuarded` - scheme allow-list, every resolved address\n * checked, redirects walked by hand with a per-hop re-check, and a timeout. A rebinding window\n * remains open between the check and the connect; see `UrlIngest.assertPublicHost`.\n *\n * The served content type is decided from the stored KEY, never from what the remote host\n * claimed - the same rule the asset routes apply, and for the same reason.\n */\n static async fromUrl(opts: IIngestFromUrlOptions): Promise<IIngestFromUrlResult> {\n const { helper, url, bucket, folderPath, policy, resolveKey, normalizeLinkFn } = opts;\n\n const response = await UrlIngest.fetchGuarded({ url, policy });\n const remoteType = response.headers.get('content-type')?.split(';')[0]?.trim() ?? '';\n const parsed = new URL(url);\n\n const key = resolveKey\n ? resolveKey({ url: parsed, contentType: remoteType })\n : readKeyFromUrl({ url: parsed, folderPath });\n\n // The helper's own default, not an unbounded one: an object arriving through ingest must obey\n // the same depth rule as one arriving through the upload route.\n if (!helper.isValidObjectKey({ object: { key }, maxDepth: opts.maxFolderDepth })) {\n await response.body?.cancel();\n throw getError({ message: `[AssetIngest.fromUrl] Invalid object key | key: ${key}` });\n }\n\n // Refused BEFORE the write starts, so a body that declares its size never opens a multipart\n // upload at all. A body that lies or omits the header is caught mid-flight by `capStream`, and\n // Bun's client answers that with `AbortMultipartUpload` - measured against a recording endpoint,\n // not assumed - so no orphaned parts are left behind either way.\n const declaredLength = Number(response.headers.get('content-length') ?? 0);\n const maxBytes = policy?.maxBytes ?? UrlSafetyDefaults.MAX_BYTES;\n\n if (declaredLength > maxBytes) {\n await response.body?.cancel();\n throw getError({\n error: UrlSafetyErrors.URL_REFUSED,\n message: `[AssetIngest.fromUrl] Body exceeds the cap | declared: ${declaredLength} | max: ${maxBytes}`,\n });\n }\n\n if (!response.body) {\n throw getError({ message: `[AssetIngest.fromUrl] Response carried no body | url: ${url}` });\n }\n\n const object: IObjectRef = { key };\n const contentType = helper.getMimeType({ filename: key });\n\n await helper.writeStream({\n bucket,\n object,\n source: UrlIngest.capStream({ source: response.body, policy }),\n contentType,\n maxFolderDepth: opts.maxFolderDepth,\n });\n\n const stat = await helper.getStat({ bucket, object });\n const link = normalizeLinkFn({ bucket, object });\n\n if (!link) {\n throw getError({\n message: `[AssetIngest.fromUrl] normalizeLinkFn returned an empty link | key: ${key}`,\n });\n }\n\n return {\n upload: {\n bucket: { name: bucket.name },\n object: { key, size: stat.size, contentType },\n link,\n },\n stat,\n };\n }\n}\n"]}
1
+ {"version":3,"file":"ingest.js","sourceRoot":"","sources":["../../../../src/components/static-asset/ingest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EACL,SAAS,EACT,iBAAiB,EACjB,eAAe,GAOhB,MAAM,wBAAwB,CAAC;AA+ChC,MAAM,cAAc,GAAG,CAAC,IAAuC,EAAU,EAAE;IACzE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;IACjC,MAAM,WAAW,GAAG,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,IAAI,QAAQ,CAAC;IAC9E,MAAM,UAAU,GAAG,WAAW,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAEhE,OAAO,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,IAAI,UAAU,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;AACjE,CAAC,CAAC;AAEF,uDAAuD;AACvD,MAAM,OAAO,WAAW;IACtB;;;;;;;;;;OAUG;IACH,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAA2B;QAC9C,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC;QAEtF,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,YAAY,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC;QAC/D,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,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I,EAAE,CAAC;YACnB,MAAM,QAAQ,CAAC,EAAE,OAAO,EAAE,yDAAyD,GAAG,EAAE,EAAE,CAAC,CAAC;QAC9F,CAAC;QAED,MAAM,MAAM,GAAe,EAAE,GAAG,EAAE,CAAC;QACnC,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC;QAE1D,MAAM,MAAM,CAAC,WAAW,CAAC;YACvB,MAAM;YACN,MAAM;YACN,MAAM,EAAE,SAAS,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;YAC9D,WAAW;YACX,cAAc,EAAE,IAAI,CAAC,cAAc;SACpC,CAAC,CAAC;QAEH,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QACtD,MAAM,IAAI,GAAG,eAAe,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QAEjD,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,QAAQ,CAAC;gBACb,OAAO,EAAE,uEAAuE,GAAG,EAAE;aACtF,CAAC,CAAC;QACL,CAAC;QAED,OAAO;YACL,MAAM,EAAE;gBACN,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE;gBAC7B,MAAM,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE;gBAC7C,IAAI;aACL;YACD,IAAI;SACL,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { getError } from '@venizia/ignis-helpers/core';\nimport {\n UrlIngest,\n UrlSafetyDefaults,\n UrlSafetyErrors,\n type IBucketRef,\n type IObjectRef,\n type IFileStat,\n type IStorageHelper,\n type IUploadResult,\n type IUrlSafetyPolicy,\n} from '@venizia/ignis-helpers';\n\n/**\n * What was stored, and what the backend reports about it. The stat is returned because `getStat`\n * already ran to size the result - a caller writing its own row would otherwise pay for it twice.\n *\n * This does NOT write a meta link. The columns an application attaches to an object - a principal,\n * a variant - come from its own domain, not from the object, so the row stays the caller's.\n */\nexport interface IIngestFromUrlResult {\n upload: IUploadResult;\n stat: IFileStat;\n}\n\n/** Where a fetched object lands, and what it is attached to. */\nexport interface IIngestFromUrlOptions {\n helper: IStorageHelper;\n url: string;\n bucket: IBucketRef;\n\n /**\n * Decides the stored key.\n *\n * **Absent, the key comes from the remote url's last path segment - which on an untrusted url is\n * named by whoever supplied it.** Pass `resolveKey` whenever the url is not your own; the\n * validation below bounds what it can do, but it does not make the remote name yours.\n */\n resolveKey?: (opts: { url: URL; contentType: string }) => string;\n folderPath?: string;\n\n /** Absent leaves IGNIS's own default: https only, no private address, 3 hops, 10s, 10 MB. */\n policy?: IUrlSafetyPolicy;\n\n /**\n * Folder nesting the key may carry.\n *\n * @default BaseStorageHelper.DEFAULT_MAX_FOLDER_DEPTH\n */\n maxFolderDepth?: number;\n\n /**\n * Where the object is served from. **Required**: an absent hook used to yield an empty link, which\n * is exactly the value that satisfies a NOT NULL column and points nowhere.\n */\n normalizeLinkFn: (opts: { bucket: IBucketRef; object: IObjectRef }) => string;\n}\n\nconst readKeyFromUrl = (opts: { url: URL; folderPath?: string }): string => {\n const { url, folderPath } = opts;\n const lastSegment = url.pathname.split('/').filter(Boolean).pop() ?? 'object';\n const normalized = lastSegment.toLowerCase().replace(/ /g, '_');\n\n return folderPath ? `${folderPath}/${normalized}` : normalized;\n};\n\n/** Storing an object that came from somewhere else. */\nexport class AssetIngest {\n /**\n * Fetches an untrusted url and stores what comes back, without the bytes passing through this\n * process: the guarded body is capped and handed to `writeStream` as a stream.\n *\n * The url is guarded by `UrlIngest.fetchGuarded` - scheme allow-list, every resolved address\n * checked, redirects walked by hand with a per-hop re-check, and a timeout. The connection goes to the\n * address that was checked, so a DNS answer that changes afterwards is never used; see `UrlIngest.fetchGuarded`.\n *\n * The served content type is decided from the stored KEY, never from what the remote host\n * claimed - the same rule the asset routes apply, and for the same reason.\n */\n static async fromUrl(opts: IIngestFromUrlOptions): Promise<IIngestFromUrlResult> {\n const { helper, url, bucket, folderPath, policy, resolveKey, normalizeLinkFn } = opts;\n\n const response = await UrlIngest.fetchGuarded({ url, policy });\n const remoteType = response.headers.get('content-type')?.split(';')[0]?.trim() ?? '';\n const parsed = new URL(url);\n\n const key = resolveKey\n ? resolveKey({ url: parsed, contentType: remoteType })\n : readKeyFromUrl({ url: parsed, folderPath });\n\n // The helper's own default, not an unbounded one: an object arriving through ingest must obey\n // the same depth rule as one arriving through the upload route.\n if (!helper.isValidObjectKey({ object: { key }, maxDepth: opts.maxFolderDepth })) {\n await response.body?.cancel();\n throw getError({ message: `[AssetIngest.fromUrl] Invalid object key | key: ${key}` });\n }\n\n // Refused BEFORE the write starts, so a body that declares its size never opens a multipart\n // upload at all. A body that lies or omits the header is caught mid-flight by `capStream`, and\n // Bun's client answers that with `AbortMultipartUpload` - measured against a recording endpoint,\n // not assumed - so no orphaned parts are left behind either way.\n const declaredLength = Number(response.headers.get('content-length') ?? 0);\n const maxBytes = policy?.maxBytes ?? UrlSafetyDefaults.MAX_BYTES;\n\n if (declaredLength > maxBytes) {\n await response.body?.cancel();\n throw getError({\n error: UrlSafetyErrors.URL_REFUSED,\n message: `[AssetIngest.fromUrl] Body exceeds the cap | declared: ${declaredLength} | max: ${maxBytes}`,\n });\n }\n\n if (!response.body) {\n throw getError({ message: `[AssetIngest.fromUrl] Response carried no body | url: ${url}` });\n }\n\n const object: IObjectRef = { key };\n const contentType = helper.getMimeType({ filename: key });\n\n await helper.writeStream({\n bucket,\n object,\n source: UrlIngest.capStream({ source: response.body, policy }),\n contentType,\n maxFolderDepth: opts.maxFolderDepth,\n });\n\n const stat = await helper.getStat({ bucket, object });\n const link = normalizeLinkFn({ bucket, object });\n\n if (!link) {\n throw getError({\n message: `[AssetIngest.fromUrl] normalizeLinkFn returned an empty link | key: ${key}`,\n });\n }\n\n return {\n upload: {\n bucket: { name: bucket.name },\n object: { key, size: stat.size, contentType },\n link,\n },\n stat,\n };\n }\n}\n"]}
@@ -567,7 +567,9 @@ export declare class BaseMetaLinkModel extends BaseRelationalEntity<typeof BaseM
567
567
  }>;
568
568
  static relations: () => never[];
569
569
  }
570
+ /** The table schema of `BaseMetaLinkModel`. */
570
571
  export type TMetaLinkSchema = typeof BaseMetaLinkModel.schema;
572
+ /** A MetaLink row as selected from the table. */
571
573
  export type TMetaLink = TTableObject<TMetaLinkSchema>;
572
574
  /** Any table whose row carries the MetaLink fields. The component reads and writes the ROW, so the table is free to carry another name or to live in another Postgres schema. */
573
575
  export type TMetaLinkCompatibleSchema = TTableSchemaWithId & {
@@ -1 +1 @@
1
- {"version":3,"file":"base.model.js","sourceRoot":"","sources":["../../../../../src/components/static-asset/models/base.model.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,GAGnB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAEpF,mNAAmN;AAE5M,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,oBAAqD;aAC1E,WAAM,GAAG,OAAO,CAC9B,UAAU,EACV;QACE,GAAG,kBAAkB,CAAC,kBAAkB,CAAC,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,CAAC;QACxE,GAAG,kBAAkB,CAAC,kBAAkB,EAAE;QAC1C,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,EAAE;QACzC,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,EAAE;QACzC,IAAI,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE;QACtB,QAAQ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BAAiB,CAqC7B","sourcesContent":["import { model } from '@/base/metadata';\nimport {\n BaseRelationalEntity,\n PostgresIdEnricher,\n PostgresTzEnricher,\n type TTableObject,\n type TTableSchemaWithId,\n} from '@venizia/ignis-connectors/postgres';\nimport { boolean, index, integer, jsonb, pgTable, text } from 'drizzle-orm/pg-core';\n\n/** One row per (object, owner) pairing, NOT per object: one product image attached to the product and to each variant is the common case, so `(bucketName, objectName)` is indexed and deliberately NOT unique. */\n@model({ migration: { use: false } })\nexport class BaseMetaLinkModel extends BaseRelationalEntity<typeof BaseMetaLinkModel.schema> {\n static override schema = pgTable(\n 'MetaLink',\n {\n ...PostgresIdEnricher.generateColumnDefs({ id: { dataType: 'string' } }),\n ...PostgresTzEnricher.generateColumnDefs(),\n bucketName: text('bucket_name').notNull(),\n objectName: text('object_name').notNull(),\n link: text().notNull(),\n mimetype: text().notNull(),\n size: integer().notNull(),\n etag: text(),\n metadata: jsonb().$type<Record<string, any>>(),\n storageType: text('storage_type').notNull(),\n isSynced: boolean('is_synced').notNull().default(false),\n\n /** An opaque label the caller chooses - a size, a role, a rendition name. The component stores and returns it and reads no meaning into it. */\n variant: text(),\n\n /** Display order within ONE principal. Defaults to 0 so legacy rows tie and `ORDER BY sequence, createdAt` reproduces the order they already had. */\n sequence: integer().notNull().default(0),\n\n /** A polymorphic owner: the type names the table, the id the row. Both nullable - an object may belong to nothing yet, which is how `recreate-metalink` writes one. */\n principalType: text('principal_type'),\n principalId: text('principal_id'),\n },\n (def) => [\n index(`IDX_MetaLink_bucketName`).on(def.bucketName),\n index(`IDX_MetaLink_objectName`).on(def.objectName),\n index(`IDX_MetaLink_storageType`).on(def.storageType),\n index(`IDX_MetaLink_isSynced`).on(def.isSynced),\n // Ordering runs inside a principal filter, so filter columns lead and the sort column trails.\n index(`IDX_MetaLink_principal_sequence`).on(def.principalType, def.principalId, def.sequence),\n ],\n );\n\n static override relations = () => [];\n}\n\nexport type TMetaLinkSchema = typeof BaseMetaLinkModel.schema;\nexport type TMetaLink = TTableObject<TMetaLinkSchema>;\n\n/** Any table whose row carries the MetaLink fields. The component reads and writes the ROW, so the table is free to carry another name or to live in another Postgres schema. */\nexport type TMetaLinkCompatibleSchema = TTableSchemaWithId & { $inferSelect: TMetaLink };\n"]}
1
+ {"version":3,"file":"base.model.js","sourceRoot":"","sources":["../../../../../src/components/static-asset/models/base.model.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,GAGnB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAEpF,mNAAmN;AAE5M,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,oBAAqD;aAC1E,WAAM,GAAG,OAAO,CAC9B,UAAU,EACV;QACE,GAAG,kBAAkB,CAAC,kBAAkB,CAAC,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,CAAC;QACxE,GAAG,kBAAkB,CAAC,kBAAkB,EAAE;QAC1C,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,EAAE;QACzC,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,EAAE;QACzC,IAAI,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE;QACtB,QAAQ,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE;QAC1B,IAAI,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE;QACzB,IAAI,EAAE,IAAI,EAAE;QACZ,QAAQ,EAAE,KAAK,EAAE,CAAC,KAAK,EAAuB;QAC9C,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE;QAC3C,QAAQ,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;QAEvD,+IAA+I;QAC/I,OAAO,EAAE,IAAI,EAAE;QAEf,qJAAqJ;QACrJ,QAAQ,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;QAExC,uKAAuK;QACvK,aAAa,EAAE,IAAI,CAAC,gBAAgB,CAAC;QACrC,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC;KAClC,EACD,CAAC,GAAG,EAAE,EAAE,CAAC;QACP,KAAK,CAAC,yBAAyB,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC;QACnD,KAAK,CAAC,yBAAyB,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC;QACnD,KAAK,CAAC,0BAA0B,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC;QACrD,KAAK,CAAC,uBAAuB,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC;QAC/C,8FAA8F;QAC9F,KAAK,CAAC,iCAAiC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,aAAa,EAAE,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,QAAQ,CAAC;KAC9F,CACF,AAjCqB,CAiCpB;aAEc,cAAS,GAAG,GAAG,EAAE,CAAC,EAAE,AAAX,CAAY;;AApC1B,iBAAiB;IAD7B,KAAK,CAAC,EAAE,SAAS,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC;GACxB,iBAAiB,CAqC7B","sourcesContent":["import { model } from '@/base/metadata';\nimport {\n BaseRelationalEntity,\n PostgresIdEnricher,\n PostgresTzEnricher,\n type TTableObject,\n type TTableSchemaWithId,\n} from '@venizia/ignis-connectors/postgres';\nimport { boolean, index, integer, jsonb, pgTable, text } from 'drizzle-orm/pg-core';\n\n/** One row per (object, owner) pairing, NOT per object: one product image attached to the product and to each variant is the common case, so `(bucketName, objectName)` is indexed and deliberately NOT unique. */\n@model({ migration: { use: false } })\nexport class BaseMetaLinkModel extends BaseRelationalEntity<typeof BaseMetaLinkModel.schema> {\n static override schema = pgTable(\n 'MetaLink',\n {\n ...PostgresIdEnricher.generateColumnDefs({ id: { dataType: 'string' } }),\n ...PostgresTzEnricher.generateColumnDefs(),\n bucketName: text('bucket_name').notNull(),\n objectName: text('object_name').notNull(),\n link: text().notNull(),\n mimetype: text().notNull(),\n size: integer().notNull(),\n etag: text(),\n metadata: jsonb().$type<Record<string, any>>(),\n storageType: text('storage_type').notNull(),\n isSynced: boolean('is_synced').notNull().default(false),\n\n /** An opaque label the caller chooses - a size, a role, a rendition name. The component stores and returns it and reads no meaning into it. */\n variant: text(),\n\n /** Display order within ONE principal. Defaults to 0 so legacy rows tie and `ORDER BY sequence, createdAt` reproduces the order they already had. */\n sequence: integer().notNull().default(0),\n\n /** A polymorphic owner: the type names the table, the id the row. Both nullable - an object may belong to nothing yet, which is how `recreate-metalink` writes one. */\n principalType: text('principal_type'),\n principalId: text('principal_id'),\n },\n (def) => [\n index(`IDX_MetaLink_bucketName`).on(def.bucketName),\n index(`IDX_MetaLink_objectName`).on(def.objectName),\n index(`IDX_MetaLink_storageType`).on(def.storageType),\n index(`IDX_MetaLink_isSynced`).on(def.isSynced),\n // Ordering runs inside a principal filter, so filter columns lead and the sort column trails.\n index(`IDX_MetaLink_principal_sequence`).on(def.principalType, def.principalId, def.sequence),\n ],\n );\n\n static override relations = () => [];\n}\n\n/** The table schema of `BaseMetaLinkModel`. */\nexport type TMetaLinkSchema = typeof BaseMetaLinkModel.schema;\n/** A MetaLink row as selected from the table. */\nexport type TMetaLink = TTableObject<TMetaLinkSchema>;\n\n/** Any table whose row carries the MetaLink fields. The component reads and writes the ROW, so the table is free to carry another name or to live in another Postgres schema. */\nexport type TMetaLinkCompatibleSchema = TTableSchemaWithId & { $inferSelect: TMetaLink };\n"]}
@@ -1,3 +1,4 @@
1
+ /** Container keys of the WebSocket component: the server instance, its options, the Redis connection and the handlers an application binds. */
1
2
  export declare class WebSocketBindingKeys {
2
3
  static readonly WEBSOCKET_INSTANCE = "@app/websocket/instance";
3
4
  static readonly SERVER_OPTIONS = "@app/websocket/server-options";
@@ -1,3 +1,4 @@
1
+ /** Container keys of the WebSocket component: the server instance, its options, the Redis connection and the handlers an application binds. */
1
2
  export class WebSocketBindingKeys {
2
3
  static { this.WEBSOCKET_INSTANCE = '@app/websocket/instance'; }
3
4
  static { this.SERVER_OPTIONS = '@app/websocket/server-options'; }
@@ -1 +1 @@
1
- {"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../../../src/components/websocket/common/keys.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,oBAAoB;aACf,uBAAkB,GAAG,yBAAyB,CAAC;aAE/C,mBAAc,GAAG,+BAA+B,CAAC;aACjD,qBAAgB,GAAG,iCAAiC,CAAC;aAErD,yBAAoB,GAAG,qCAAqC,CAAC;aAC7D,0BAAqB,GAAG,sCAAsC,CAAC;aAC/D,6BAAwB,GAAG,yCAAyC,CAAC;aACrE,gCAA2B,GAAG,4CAA4C,CAAC;aAC3E,oBAAe,GAAG,gCAAgC,CAAC;aACnD,yBAAoB,GAAG,qCAAqC,CAAC;aAC7D,sBAAiB,GAAG,kCAAkC,CAAC","sourcesContent":["export class WebSocketBindingKeys {\n static readonly WEBSOCKET_INSTANCE = '@app/websocket/instance';\n\n static readonly SERVER_OPTIONS = '@app/websocket/server-options';\n static readonly REDIS_CONNECTION = '@app/websocket/redis-connection';\n\n static readonly AUTHENTICATE_HANDLER = '@app/websocket/authenticate-handler';\n static readonly VALIDATE_ROOM_HANDLER = '@app/websocket/validate-room-handler';\n static readonly CLIENT_CONNECTED_HANDLER = '@app/websocket/client-connected-handler';\n static readonly CLIENT_DISCONNECTED_HANDLER = '@app/websocket/client-disconnected-handler';\n static readonly MESSAGE_HANDLER = '@app/websocket/message-handler';\n static readonly OUTBOUND_TRANSFORMER = '@app/websocket/outbound-transformer';\n static readonly HANDSHAKE_HANDLER = '@app/websocket/handshake-handler';\n}\n"]}
1
+ {"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../../../src/components/websocket/common/keys.ts"],"names":[],"mappings":"AAAA,+IAA+I;AAC/I,MAAM,OAAO,oBAAoB;aACf,uBAAkB,GAAG,yBAAyB,CAAC;aAE/C,mBAAc,GAAG,+BAA+B,CAAC;aACjD,qBAAgB,GAAG,iCAAiC,CAAC;aAErD,yBAAoB,GAAG,qCAAqC,CAAC;aAC7D,0BAAqB,GAAG,sCAAsC,CAAC;aAC/D,6BAAwB,GAAG,yCAAyC,CAAC;aACrE,gCAA2B,GAAG,4CAA4C,CAAC;aAC3E,oBAAe,GAAG,gCAAgC,CAAC;aACnD,yBAAoB,GAAG,qCAAqC,CAAC;aAC7D,sBAAiB,GAAG,kCAAkC,CAAC","sourcesContent":["/** Container keys of the WebSocket component: the server instance, its options, the Redis connection and the handlers an application binds. */\nexport class WebSocketBindingKeys {\n static readonly WEBSOCKET_INSTANCE = '@app/websocket/instance';\n\n static readonly SERVER_OPTIONS = '@app/websocket/server-options';\n static readonly REDIS_CONNECTION = '@app/websocket/redis-connection';\n\n static readonly AUTHENTICATE_HANDLER = '@app/websocket/authenticate-handler';\n static readonly VALIDATE_ROOM_HANDLER = '@app/websocket/validate-room-handler';\n static readonly CLIENT_CONNECTED_HANDLER = '@app/websocket/client-connected-handler';\n static readonly CLIENT_DISCONNECTED_HANDLER = '@app/websocket/client-disconnected-handler';\n static readonly MESSAGE_HANDLER = '@app/websocket/message-handler';\n static readonly OUTBOUND_TRANSFORMER = '@app/websocket/outbound-transformer';\n static readonly HANDSHAKE_HANDLER = '@app/websocket/handshake-handler';\n}\n"]}
@@ -2,6 +2,7 @@ import { type BaseApplication } from '../../base/applications/index.js';
2
2
  import { BaseComponent } from '@venizia/ignis-kernel';
3
3
  import { type ValueOrPromise } from '@venizia/ignis-helpers/common';
4
4
  import { type IServerOptions } from './common/index.js';
5
+ /** Starts a WebSocket server on Bun after the application starts. Requires a Redis helper at `WebSocketBindingKeys.REDIS_CONNECTION` and an authenticate handler at `AUTHENTICATE_HANDLER`; binding throws without them. */
5
6
  export declare class WebSocketComponent extends BaseComponent {
6
7
  private application;
7
8
  protected serverOptions: IServerOptions;
@@ -20,6 +20,7 @@ import { HTTP } from '@venizia/ignis-helpers/common';
20
20
  import { isRedisHelper, WebSocketDefaults, WebSocketServerHelper, } from '@venizia/ignis-helpers';
21
21
  import { WebSocketBindingKeys, DEFAULT_SERVER_OPTIONS, } from './common/index.js';
22
22
  import { WebSocketBunHandler } from './handlers/index.js';
23
+ /** Starts a WebSocket server on Bun after the application starts. Requires a Redis helper at `WebSocketBindingKeys.REDIS_CONNECTION` and an authenticate handler at `AUTHENTICATE_HANDLER`; binding throws without them. */
23
24
  let WebSocketComponent = WebSocketComponent_1 = class WebSocketComponent extends BaseComponent {
24
25
  constructor(application) {
25
26
  super({
@@ -1 +1 @@
1
- {"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../src/components/websocket/component.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,IAAI,EAAuB,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAEL,aAAa,EAQb,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,oBAAoB,EACpB,sBAAsB,GAGvB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,IAAa,kBAAkB,0BAA/B,MAAa,kBAAmB,SAAQ,aAAa;IAGnD,YAC8D,WAA4B;QAExF,KAAK,CAA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BAEH,MAAM,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC;YACvD,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAEQ,OAAO;QACd,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAElD,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,MAAM,QAAQ,CAAC;gBACb,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,mBAAmB;gBACrD,OAAO,EAAE,0DAA0D;aACpE,CAAC,CAAC;QACL,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;QAEpD,MAAM,QAAQ,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QACxC,MAAM,CAAC,KAAK,CAAC,8BAA8B,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAEjE,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC;CACF,CAAA;AAtMY,kBAAkB;IAI1B,WAAA,MAAM,CAAC,EAAE,GAAG,EAAE,YAAY,CAAC,oBAAoB,EAAE,CAAC,CAAA;;GAJ1C,kBAAkB,CAsM9B","sourcesContent":["import { type BaseApplication, type TBunServerInstance } from '@/base/applications';\nimport { BaseComponent } from '@venizia/ignis-kernel';\nimport { inject } from '@/base/metadata';\nimport { CoreBindings } from '@venizia/ignis-kernel';\nimport { Binding } from '@venizia/ignis-kernel';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport { HTTP, type ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport {\n type AbstractRedisHelper,\n isRedisHelper,\n type TWebSocketAuthenticateFn,\n type TWebSocketClientConnectedFn,\n type TWebSocketClientDisconnectedFn,\n type TWebSocketMessageHandler,\n type TWebSocketHandshakeFn,\n type TWebSocketOutboundTransformer,\n type TWebSocketValidateRoomFn,\n WebSocketDefaults,\n WebSocketServerHelper,\n} from '@venizia/ignis-helpers';\nimport {\n WebSocketBindingKeys,\n DEFAULT_SERVER_OPTIONS,\n type IResolvedBindings,\n type IServerOptions,\n} from './common';\nimport { WebSocketBunHandler } from './handlers';\n\nexport class WebSocketComponent extends BaseComponent {\n protected serverOptions: IServerOptions;\n\n constructor(\n @inject({ key: CoreBindings.APPLICATION_INSTANCE }) private application: BaseApplication,\n ) {\n super({\n scope: WebSocketComponent.name,\n initDefault: { enable: true, container: application },\n bindings: {\n [WebSocketBindingKeys.SERVER_OPTIONS]: Binding.bind<Partial<IServerOptions>>({\n key: WebSocketBindingKeys.SERVER_OPTIONS,\n }).toValue(DEFAULT_SERVER_OPTIONS),\n\n [WebSocketBindingKeys.REDIS_CONNECTION]: Binding.bind<AbstractRedisHelper | null>({\n key: WebSocketBindingKeys.REDIS_CONNECTION,\n }).toValue(null),\n\n [WebSocketBindingKeys.AUTHENTICATE_HANDLER]: Binding.bind<TWebSocketAuthenticateFn | null>({\n key: WebSocketBindingKeys.AUTHENTICATE_HANDLER,\n }).toValue(null),\n\n [WebSocketBindingKeys.VALIDATE_ROOM_HANDLER]: Binding.bind<TWebSocketValidateRoomFn | null>(\n {\n key: WebSocketBindingKeys.VALIDATE_ROOM_HANDLER,\n },\n ).toValue(null),\n\n [WebSocketBindingKeys.CLIENT_CONNECTED_HANDLER]:\n Binding.bind<TWebSocketClientConnectedFn | null>({\n key: WebSocketBindingKeys.CLIENT_CONNECTED_HANDLER,\n }).toValue(null),\n\n [WebSocketBindingKeys.CLIENT_DISCONNECTED_HANDLER]:\n Binding.bind<TWebSocketClientDisconnectedFn | null>({\n key: WebSocketBindingKeys.CLIENT_DISCONNECTED_HANDLER,\n }).toValue(null),\n\n [WebSocketBindingKeys.MESSAGE_HANDLER]: Binding.bind<TWebSocketMessageHandler | null>({\n key: WebSocketBindingKeys.MESSAGE_HANDLER,\n }).toValue(null),\n\n [WebSocketBindingKeys.OUTBOUND_TRANSFORMER]:\n Binding.bind<TWebSocketOutboundTransformer | null>({\n key: WebSocketBindingKeys.OUTBOUND_TRANSFORMER,\n }).toValue(null),\n\n [WebSocketBindingKeys.HANDSHAKE_HANDLER]: Binding.bind<TWebSocketHandshakeFn | null>({\n key: WebSocketBindingKeys.HANDSHAKE_HANDLER,\n }).toValue(null),\n },\n });\n }\n\n private resolveBindings(): IResolvedBindings {\n const extraServerOptions =\n this.application.get<Partial<IServerOptions>>({\n key: WebSocketBindingKeys.SERVER_OPTIONS,\n isOptional: true,\n }) ?? {};\n this.serverOptions = Object.assign({}, DEFAULT_SERVER_OPTIONS, extraServerOptions);\n\n const redisConnection = this.application.get<AbstractRedisHelper>({\n key: WebSocketBindingKeys.REDIS_CONNECTION,\n });\n\n if (!isRedisHelper(redisConnection)) {\n throw getError({\n message:\n '[WebSocketComponent][resolveBindings] Invalid instance of redisConnection | Please init connection with RedisSingleHelper (single), RedisClusterHelper (cluster), or RedisSentinelHelper (sentinel)!',\n });\n }\n\n const authenticateFn = this.application.get<TWebSocketAuthenticateFn>({\n key: WebSocketBindingKeys.AUTHENTICATE_HANDLER,\n });\n\n if (!authenticateFn) {\n throw getError({\n message: '[WebSocketComponent] Invalid authenticateFn to setup WebSocket server!',\n });\n }\n\n const validateRoomFn =\n this.application.get<TWebSocketValidateRoomFn | null>({\n key: WebSocketBindingKeys.VALIDATE_ROOM_HANDLER,\n }) ?? undefined;\n const clientConnectedFn =\n this.application.get<TWebSocketClientConnectedFn | null>({\n key: WebSocketBindingKeys.CLIENT_CONNECTED_HANDLER,\n }) ?? undefined;\n const clientDisconnectedFn =\n this.application.get<TWebSocketClientDisconnectedFn | null>({\n key: WebSocketBindingKeys.CLIENT_DISCONNECTED_HANDLER,\n }) ?? undefined;\n const messageHandler =\n this.application.get<TWebSocketMessageHandler | null>({\n key: WebSocketBindingKeys.MESSAGE_HANDLER,\n }) ?? undefined;\n const outboundTransformer =\n this.application.get<TWebSocketOutboundTransformer | null>({\n key: WebSocketBindingKeys.OUTBOUND_TRANSFORMER,\n }) ?? undefined;\n const handshakeFn =\n this.application.get<TWebSocketHandshakeFn | null>({\n key: WebSocketBindingKeys.HANDSHAKE_HANDLER,\n }) ?? undefined;\n\n return {\n redisConnection,\n authenticateFn,\n validateRoomFn,\n clientConnectedFn,\n clientDisconnectedFn,\n messageHandler,\n outboundTransformer,\n handshakeFn,\n };\n }\n\n private registerBunHook(opts: IResolvedBindings) {\n const {\n redisConnection,\n authenticateFn,\n validateRoomFn,\n clientConnectedFn,\n clientDisconnectedFn,\n messageHandler,\n outboundTransformer,\n handshakeFn,\n } = opts;\n const serverOptions = this.serverOptions;\n\n const logger = this.logger.for(this.registerBunHook.name);\n\n this.application.registerPostStartHook({\n identifier: 'websocket-initialize',\n hook: async () => {\n const serverInstance = this.application.getServerInstance<TBunServerInstance>();\n const honoServer = this.application.getServer();\n\n if (!serverInstance) {\n throw getError({\n message: '[WebSocketComponent] Bun server instance not available!',\n });\n }\n\n const wsHelper = new WebSocketServerHelper({\n identifier: serverOptions.identifier,\n path: serverOptions.path,\n defaultRooms: serverOptions.defaultRooms,\n serverOptions: serverOptions.serverOptions,\n heartbeatInterval: serverOptions.heartbeatInterval,\n heartbeatTimeout: serverOptions.heartbeatTimeout,\n server: serverInstance,\n redisConnection,\n authenticateFn,\n validateRoomFn,\n clientConnectedFn,\n clientDisconnectedFn,\n messageHandler,\n outboundTransformer,\n handshakeFn,\n requireEncryption: serverOptions.requireEncryption,\n });\n await wsHelper.configure();\n\n this.application.bind({ key: WebSocketBindingKeys.WEBSOCKET_INSTANCE }).toValue(wsHelper);\n\n const wsPath = serverOptions.path ?? WebSocketDefaults.PATH;\n\n serverInstance.reload({\n fetch: WebSocketBunHandler.createFetchHandler({ wsPath, honoServer }),\n websocket: wsHelper.getBunWebSocketHandler(),\n });\n\n logger.info('WebSocket initialized for Bun runtime');\n },\n });\n }\n\n override binding(): ValueOrPromise<void> {\n const logger = this.logger.for(this.binding.name);\n\n if (!this.application) {\n throw getError({\n statusCode: HTTP.ResultCodes.RS_5.InternalServerError,\n message: '[binding] Invalid application to bind WebSocketComponent',\n });\n }\n\n logger.info('Binding WebSocket for application...');\n\n const resolved = this.resolveBindings();\n logger.debug('WebSocket Server Options: %j', this.serverOptions);\n\n this.registerBunHook(resolved);\n }\n}\n"]}
1
+ {"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../src/components/websocket/component.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,IAAI,EAAuB,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAEL,aAAa,EAQb,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,oBAAoB,EACpB,sBAAsB,GAGvB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,4NAA4N;AAC5N,IAAa,kBAAkB,0BAA/B,MAAa,kBAAmB,SAAQ,aAAa;IAGnD,YAC8D,WAA4B;QAExF,KAAK,CAAC;YACJ,KAAK,EAAE,oBAAkB,CAAC,IAAI;YAC9B,WAAW,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE;YACrD,QAAQ,EAAE;gBACR,CAAC,oBAAoB,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,IAAI,CAA0B;oBAC3E,GAAG,EAAE,oBAAoB,CAAC,cAAc;iBACzC,CAAC,CAAC,OAAO,CAAC,sBAAsB,CAAC;gBAElC,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC,IAAI,CAA6B;oBAChF,GAAG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AAC,CAAC;QACL,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;QAEpD,MAAM,QAAQ,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QACxC,MAAM,CAAC,KAAK,CAAC,8BAA8B,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAEjE,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC;CACF,CAAA;AAtMY,kBAAkB;IAI1B,WAAA,MAAM,CAAC,EAAE,GAAG,EAAE,YAAY,CAAC,oBAAoB,EAAE,CAAC,CAAA;;GAJ1C,kBAAkB,CAsM9B","sourcesContent":["import { type BaseApplication, type TBunServerInstance } from '@/base/applications';\nimport { BaseComponent } from '@venizia/ignis-kernel';\nimport { inject } from '@/base/metadata';\nimport { CoreBindings } from '@venizia/ignis-kernel';\nimport { Binding } from '@venizia/ignis-kernel';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport { HTTP, type ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport {\n type AbstractRedisHelper,\n isRedisHelper,\n type TWebSocketAuthenticateFn,\n type TWebSocketClientConnectedFn,\n type TWebSocketClientDisconnectedFn,\n type TWebSocketMessageHandler,\n type TWebSocketHandshakeFn,\n type TWebSocketOutboundTransformer,\n type TWebSocketValidateRoomFn,\n WebSocketDefaults,\n WebSocketServerHelper,\n} from '@venizia/ignis-helpers';\nimport {\n WebSocketBindingKeys,\n DEFAULT_SERVER_OPTIONS,\n type IResolvedBindings,\n type IServerOptions,\n} from './common';\nimport { WebSocketBunHandler } from './handlers';\n\n/** Starts a WebSocket server on Bun after the application starts. Requires a Redis helper at `WebSocketBindingKeys.REDIS_CONNECTION` and an authenticate handler at `AUTHENTICATE_HANDLER`; binding throws without them. */\nexport class WebSocketComponent extends BaseComponent {\n protected serverOptions: IServerOptions;\n\n constructor(\n @inject({ key: CoreBindings.APPLICATION_INSTANCE }) private application: BaseApplication,\n ) {\n super({\n scope: WebSocketComponent.name,\n initDefault: { enable: true, container: application },\n bindings: {\n [WebSocketBindingKeys.SERVER_OPTIONS]: Binding.bind<Partial<IServerOptions>>({\n key: WebSocketBindingKeys.SERVER_OPTIONS,\n }).toValue(DEFAULT_SERVER_OPTIONS),\n\n [WebSocketBindingKeys.REDIS_CONNECTION]: Binding.bind<AbstractRedisHelper | null>({\n key: WebSocketBindingKeys.REDIS_CONNECTION,\n }).toValue(null),\n\n [WebSocketBindingKeys.AUTHENTICATE_HANDLER]: Binding.bind<TWebSocketAuthenticateFn | null>({\n key: WebSocketBindingKeys.AUTHENTICATE_HANDLER,\n }).toValue(null),\n\n [WebSocketBindingKeys.VALIDATE_ROOM_HANDLER]: Binding.bind<TWebSocketValidateRoomFn | null>(\n {\n key: WebSocketBindingKeys.VALIDATE_ROOM_HANDLER,\n },\n ).toValue(null),\n\n [WebSocketBindingKeys.CLIENT_CONNECTED_HANDLER]:\n Binding.bind<TWebSocketClientConnectedFn | null>({\n key: WebSocketBindingKeys.CLIENT_CONNECTED_HANDLER,\n }).toValue(null),\n\n [WebSocketBindingKeys.CLIENT_DISCONNECTED_HANDLER]:\n Binding.bind<TWebSocketClientDisconnectedFn | null>({\n key: WebSocketBindingKeys.CLIENT_DISCONNECTED_HANDLER,\n }).toValue(null),\n\n [WebSocketBindingKeys.MESSAGE_HANDLER]: Binding.bind<TWebSocketMessageHandler | null>({\n key: WebSocketBindingKeys.MESSAGE_HANDLER,\n }).toValue(null),\n\n [WebSocketBindingKeys.OUTBOUND_TRANSFORMER]:\n Binding.bind<TWebSocketOutboundTransformer | null>({\n key: WebSocketBindingKeys.OUTBOUND_TRANSFORMER,\n }).toValue(null),\n\n [WebSocketBindingKeys.HANDSHAKE_HANDLER]: Binding.bind<TWebSocketHandshakeFn | null>({\n key: WebSocketBindingKeys.HANDSHAKE_HANDLER,\n }).toValue(null),\n },\n });\n }\n\n private resolveBindings(): IResolvedBindings {\n const extraServerOptions =\n this.application.get<Partial<IServerOptions>>({\n key: WebSocketBindingKeys.SERVER_OPTIONS,\n isOptional: true,\n }) ?? {};\n this.serverOptions = Object.assign({}, DEFAULT_SERVER_OPTIONS, extraServerOptions);\n\n const redisConnection = this.application.get<AbstractRedisHelper>({\n key: WebSocketBindingKeys.REDIS_CONNECTION,\n });\n\n if (!isRedisHelper(redisConnection)) {\n throw getError({\n message:\n '[WebSocketComponent][resolveBindings] Invalid instance of redisConnection | Please init connection with RedisSingleHelper (single), RedisClusterHelper (cluster), or RedisSentinelHelper (sentinel)!',\n });\n }\n\n const authenticateFn = this.application.get<TWebSocketAuthenticateFn>({\n key: WebSocketBindingKeys.AUTHENTICATE_HANDLER,\n });\n\n if (!authenticateFn) {\n throw getError({\n message: '[WebSocketComponent] Invalid authenticateFn to setup WebSocket server!',\n });\n }\n\n const validateRoomFn =\n this.application.get<TWebSocketValidateRoomFn | null>({\n key: WebSocketBindingKeys.VALIDATE_ROOM_HANDLER,\n }) ?? undefined;\n const clientConnectedFn =\n this.application.get<TWebSocketClientConnectedFn | null>({\n key: WebSocketBindingKeys.CLIENT_CONNECTED_HANDLER,\n }) ?? undefined;\n const clientDisconnectedFn =\n this.application.get<TWebSocketClientDisconnectedFn | null>({\n key: WebSocketBindingKeys.CLIENT_DISCONNECTED_HANDLER,\n }) ?? undefined;\n const messageHandler =\n this.application.get<TWebSocketMessageHandler | null>({\n key: WebSocketBindingKeys.MESSAGE_HANDLER,\n }) ?? undefined;\n const outboundTransformer =\n this.application.get<TWebSocketOutboundTransformer | null>({\n key: WebSocketBindingKeys.OUTBOUND_TRANSFORMER,\n }) ?? undefined;\n const handshakeFn =\n this.application.get<TWebSocketHandshakeFn | null>({\n key: WebSocketBindingKeys.HANDSHAKE_HANDLER,\n }) ?? undefined;\n\n return {\n redisConnection,\n authenticateFn,\n validateRoomFn,\n clientConnectedFn,\n clientDisconnectedFn,\n messageHandler,\n outboundTransformer,\n handshakeFn,\n };\n }\n\n private registerBunHook(opts: IResolvedBindings) {\n const {\n redisConnection,\n authenticateFn,\n validateRoomFn,\n clientConnectedFn,\n clientDisconnectedFn,\n messageHandler,\n outboundTransformer,\n handshakeFn,\n } = opts;\n const serverOptions = this.serverOptions;\n\n const logger = this.logger.for(this.registerBunHook.name);\n\n this.application.registerPostStartHook({\n identifier: 'websocket-initialize',\n hook: async () => {\n const serverInstance = this.application.getServerInstance<TBunServerInstance>();\n const honoServer = this.application.getServer();\n\n if (!serverInstance) {\n throw getError({\n message: '[WebSocketComponent] Bun server instance not available!',\n });\n }\n\n const wsHelper = new WebSocketServerHelper({\n identifier: serverOptions.identifier,\n path: serverOptions.path,\n defaultRooms: serverOptions.defaultRooms,\n serverOptions: serverOptions.serverOptions,\n heartbeatInterval: serverOptions.heartbeatInterval,\n heartbeatTimeout: serverOptions.heartbeatTimeout,\n server: serverInstance,\n redisConnection,\n authenticateFn,\n validateRoomFn,\n clientConnectedFn,\n clientDisconnectedFn,\n messageHandler,\n outboundTransformer,\n handshakeFn,\n requireEncryption: serverOptions.requireEncryption,\n });\n await wsHelper.configure();\n\n this.application.bind({ key: WebSocketBindingKeys.WEBSOCKET_INSTANCE }).toValue(wsHelper);\n\n const wsPath = serverOptions.path ?? WebSocketDefaults.PATH;\n\n serverInstance.reload({\n fetch: WebSocketBunHandler.createFetchHandler({ wsPath, honoServer }),\n websocket: wsHelper.getBunWebSocketHandler(),\n });\n\n logger.info('WebSocket initialized for Bun runtime');\n },\n });\n }\n\n override binding(): ValueOrPromise<void> {\n const logger = this.logger.for(this.binding.name);\n\n if (!this.application) {\n throw getError({\n statusCode: HTTP.ResultCodes.RS_5.InternalServerError,\n message: '[binding] Invalid application to bind WebSocketComponent',\n });\n }\n\n logger.info('Binding WebSocket for application...');\n\n const resolved = this.resolveBindings();\n logger.debug('WebSocket Server Options: %j', this.serverOptions);\n\n this.registerBunHook(resolved);\n }\n}\n"]}
@@ -3,38 +3,55 @@ import { type TServerBootStep } from '../base/applications/index.js';
3
3
  import type { AnyType, TClass } from '@venizia/ignis-helpers/common';
4
4
  /** A class (matched against the instance's constructor) or a string (matched against the binding key or the class name). */
5
5
  export type TBootProbeTarget = TClass<AnyType> | string;
6
+ /** Options of `ApplicationBootAssertion.assert`; each field narrows or relaxes what the boot probe runs and verifies. */
6
7
  export interface IAssertApplicationBootsOptions {
7
8
  /**
8
9
  * Datasources whose real `configure()` runs. Every other datasource is bound and resolved but not
9
10
  * configured, so no connection is made. Close a kept one with `await application.stop()`.
11
+ *
12
+ * @default []
10
13
  */
11
14
  keepDataSources?: TBootProbeTarget[];
12
15
  /**
13
16
  * Components whose `configure()` (and so their `binding()`) is skipped, for the few that need
14
- * infrastructure. Components run by default. What a skipped component would have registered is
15
- * not registered.
17
+ * infrastructure. What a skipped component would have registered is not registered.
18
+ *
19
+ * @default []
16
20
  */
17
21
  skipComponents?: TBootProbeTarget[];
18
22
  /**
19
- * Boot steps that do not run. Default: `hydrateSecrets` and `wireSecretRotatables`, so a remote
20
- * secrets provider is never contacted. A value REPLACES the default; an unknown name rejects
21
- * before anything boots.
23
+ * Boot steps that do not run, so a remote secrets provider is never contacted. A value REPLACES
24
+ * the default; an unknown name rejects before anything boots.
25
+ *
26
+ * @default [ServerBootSteps.HYDRATE_SECRETS, ServerBootSteps.WIRE_SECRET_ROTATABLES]
22
27
  */
23
28
  skipSteps?: TServerBootStep[];
24
29
  /**
25
- * Default `true`: after boot, resolves every service and repository with the shared core of
30
+ * After boot, resolves every service and repository with the shared core of
26
31
  * `@venizia/ignis-inversion`, so an injection nobody references at boot still fails. An explicit value
27
32
  * wins over the application's own `bootChecks`, whose boot step is off for the run.
33
+ *
34
+ * @default true
28
35
  */
29
36
  verifyBindings?: boolean;
30
37
  /**
31
38
  * Services or repositories the verification leaves unresolved, for one whose constructor needs
32
39
  * infrastructure. A class (exact), a class name or a binding key. A name that matches nothing rejects.
40
+ *
41
+ * @default []
33
42
  */
34
43
  skipBindings?: TBootProbeTarget[];
35
- /** Default `false`: an application that registered no controller proves nothing, for example when the artifact index was empty. */
44
+ /**
45
+ * Whether an application that registered no controller passes. Off, it fails: it proves nothing, for example when the artifact index was empty.
46
+ *
47
+ * @default false
48
+ */
36
49
  allowNoControllers?: boolean;
37
- /** Default `true`: this helper's own check that no method and path is mounted twice. IGNIS boot does not detect that. */
50
+ /**
51
+ * This helper's own check that no method and path is mounted twice. IGNIS boot does not detect that.
52
+ *
53
+ * @default true
54
+ */
38
55
  routes?: boolean;
39
56
  }
40
57
  /**
@@ -45,12 +62,35 @@ export interface IAssertApplicationBootsOptions {
45
62
  * Datasources are bound and resolved but not configured, unless named in `keepDataSources`; the
46
63
  * secrets steps are skipped; every other step and every component runs as in a real boot. A component
47
64
  * that opens Redis, Kafka or S3 in `binding()` therefore runs for real: name it in `skipComponents`.
65
+ * `setupMiddlewares()` is not run: it is the application's own start-time step, user code that may open
66
+ * connections, and the probe cannot know it is free of side effects. The framework's default stack (CORS, body
67
+ * limit, request id) is a boot step of `initialize()`, so an invalid `configs.middlewares` value still fails here.
48
68
  * When the boot fails inside a component, one warning names it; the rejection is still the original error. When the
49
69
  * boot fails, the rejection is the original error. The application stays booted and is returned;
50
70
  * a failed boot leaves a half-booted instance, so build a new one rather than reuse it.
51
71
  *
52
72
  * It wraps `registerDynamicBindings` and `getBootSequence` on THIS instance only (an application's
53
73
  * own override of either still runs) and restores them whatever happens.
74
+ *
75
+ * It owns the process-wide `AuthorizationEnforcerRegistry` for the duration of the check: it resets it before it
76
+ * boots, so a second boot in the same process (another probe, or a test boot after this one) does not fail with
77
+ * `Enforcer already registered`. An application still running in the same process loses its enforcer registrations
78
+ * and its authorize options, so its requests are then decided by the no-enforcer default (deny unless configured
79
+ * otherwise): do not run the probe in a process that serves an application.
80
+ *
81
+ * @example
82
+ * ```typescript
83
+ * import { ApplicationBootAssertion } from '@venizia/ignis/testing';
84
+ * import { test } from 'bun:test';
85
+ * import { Application } from './application';
86
+ *
87
+ * test('the application boots offline', async () => {
88
+ * await ApplicationBootAssertion.assert({
89
+ * application: () => new Application({ scope: 'Application', config: { host: '127.0.0.1', port: 0, path: { base: '/', isStrict: true } } }),
90
+ * options: { skipComponents: ['MailComponent'], allowNoControllers: true },
91
+ * });
92
+ * });
93
+ * ```
54
94
  */
55
95
  export declare class ApplicationBootAssertion {
56
96
  static assert<Application extends BaseApplication>(opts: {
@@ -1,7 +1,7 @@
1
1
  import { ServerBootSteps } from '../base/applications/index.js';
2
2
  import { getError } from '@venizia/ignis-helpers/core';
3
3
  import { BindingVerifier } from '@venizia/ignis-inversion';
4
- import { BindingNamespaces, BindingValueTypes, ControllerTransports, CoreBindings, MetadataRegistry, } from '@venizia/ignis-kernel';
4
+ import { AuthorizationEnforcerRegistry, BindingNamespaces, BindingValueTypes, ControllerTransports, CoreBindings, MetadataRegistry, } from '@venizia/ignis-kernel';
5
5
  /** The boot sequence is the contract; these two are what the helper wraps on one instance. */
6
6
  const WRAPPED_METHODS = ['registerDynamicBindings', 'getBootSequence'];
7
7
  const DEFAULT_SKIPPED_STEPS = [
@@ -102,12 +102,35 @@ const assertNoDuplicateRoutes = (opts) => {
102
102
  * Datasources are bound and resolved but not configured, unless named in `keepDataSources`; the
103
103
  * secrets steps are skipped; every other step and every component runs as in a real boot. A component
104
104
  * that opens Redis, Kafka or S3 in `binding()` therefore runs for real: name it in `skipComponents`.
105
+ * `setupMiddlewares()` is not run: it is the application's own start-time step, user code that may open
106
+ * connections, and the probe cannot know it is free of side effects. The framework's default stack (CORS, body
107
+ * limit, request id) is a boot step of `initialize()`, so an invalid `configs.middlewares` value still fails here.
105
108
  * When the boot fails inside a component, one warning names it; the rejection is still the original error. When the
106
109
  * boot fails, the rejection is the original error. The application stays booted and is returned;
107
110
  * a failed boot leaves a half-booted instance, so build a new one rather than reuse it.
108
111
  *
109
112
  * It wraps `registerDynamicBindings` and `getBootSequence` on THIS instance only (an application's
110
113
  * own override of either still runs) and restores them whatever happens.
114
+ *
115
+ * It owns the process-wide `AuthorizationEnforcerRegistry` for the duration of the check: it resets it before it
116
+ * boots, so a second boot in the same process (another probe, or a test boot after this one) does not fail with
117
+ * `Enforcer already registered`. An application still running in the same process loses its enforcer registrations
118
+ * and its authorize options, so its requests are then decided by the no-enforcer default (deny unless configured
119
+ * otherwise): do not run the probe in a process that serves an application.
120
+ *
121
+ * @example
122
+ * ```typescript
123
+ * import { ApplicationBootAssertion } from '@venizia/ignis/testing';
124
+ * import { test } from 'bun:test';
125
+ * import { Application } from './application';
126
+ *
127
+ * test('the application boots offline', async () => {
128
+ * await ApplicationBootAssertion.assert({
129
+ * application: () => new Application({ scope: 'Application', config: { host: '127.0.0.1', port: 0, path: { base: '/', isStrict: true } } }),
130
+ * options: { skipComponents: ['MailComponent'], allowNoControllers: true },
131
+ * });
132
+ * });
133
+ * ```
111
134
  */
112
135
  export class ApplicationBootAssertion {
113
136
  static async assert(opts) {
@@ -205,6 +228,7 @@ export class ApplicationBootAssertion {
205
228
  doVerify: false,
206
229
  },
207
230
  };
231
+ AuthorizationEnforcerRegistry.getInstance().reset();
208
232
  try {
209
233
  if (!target.isBound({ key: CoreBindings.APPLICATION_INSTANCE })) {
210
234
  target.init();
@@ -1 +1 @@
1
- {"version":3,"file":"assert-application-boots.js","sourceRoot":"","sources":["../../../src/testing/assert-application-boots.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAwB,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAGL,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,YAAY,EACZ,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AA8C/B,8FAA8F;AAC9F,MAAM,eAAe,GAAG,CAAC,yBAAyB,EAAE,iBAAiB,CAAU,CAAC;AAEhF,MAAM,qBAAqB,GAAsB;IAC/C,eAAe,CAAC,eAAe;IAC/B,eAAe,CAAC,sBAAsB;CACvC,CAAC;AAEF,kFAAkF;AAClF,MAAM,gBAAgB,GAA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AE,CAAC;YAClB,CAAC;YAED,IAAI,kBAAkB,KAAK,SAAS,EAAE,CAAC;gBACrC,OAAO,OAAO,CAAC,UAAU,CAAC;YAC5B,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,UAAU,GAAG,kBAAkB,CAAC;YAC1C,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["import type { BaseApplication } from '@/base/applications';\nimport { ServerBootSteps, type TServerBootStep } from '@/base/applications';\nimport type { AnyType, TClass } from '@venizia/ignis-helpers/common';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport { BindingVerifier } from '@venizia/ignis-inversion';\nimport {\n type AbstractRestController,\n type Binding,\n BindingNamespaces,\n BindingValueTypes,\n ControllerTransports,\n CoreBindings,\n MetadataRegistry,\n} from '@venizia/ignis-kernel';\n\n/** A class (matched against the instance's constructor) or a string (matched against the binding key or the class name). */\nexport type TBootProbeTarget = TClass<AnyType> | string;\n\nexport interface IAssertApplicationBootsOptions {\n /**\n * Datasources whose real `configure()` runs. Every other datasource is bound and resolved but not\n * configured, so no connection is made. Close a kept one with `await application.stop()`.\n */\n keepDataSources?: TBootProbeTarget[];\n\n /**\n * Components whose `configure()` (and so their `binding()`) is skipped, for the few that need\n * infrastructure. Components run by default. What a skipped component would have registered is\n * not registered.\n */\n skipComponents?: TBootProbeTarget[];\n\n /**\n * Boot steps that do not run. Default: `hydrateSecrets` and `wireSecretRotatables`, so a remote\n * secrets provider is never contacted. A value REPLACES the default; an unknown name rejects\n * before anything boots.\n */\n skipSteps?: TServerBootStep[];\n\n /**\n * Default `true`: after boot, resolves every service and repository with the shared core of\n * `@venizia/ignis-inversion`, so an injection nobody references at boot still fails. An explicit value\n * wins over the application's own `bootChecks`, whose boot step is off for the run.\n */\n verifyBindings?: boolean;\n\n /**\n * Services or repositories the verification leaves unresolved, for one whose constructor needs\n * infrastructure. A class (exact), a class name or a binding key. A name that matches nothing rejects.\n */\n skipBindings?: TBootProbeTarget[];\n\n /** Default `false`: an application that registered no controller proves nothing, for example when the artifact index was empty. */\n allowNoControllers?: boolean;\n\n /** Default `true`: this helper's own check that no method and path is mounted twice. IGNIS boot does not detect that. */\n routes?: boolean;\n}\n\n/** The boot sequence is the contract; these two are what the helper wraps on one instance. */\nconst WRAPPED_METHODS = ['registerDynamicBindings', 'getBootSequence'] as const;\n\nconst DEFAULT_SKIPPED_STEPS: TServerBootStep[] = [\n ServerBootSteps.HYDRATE_SECRETS,\n ServerBootSteps.WIRE_SECRET_ROTATABLES,\n];\n\n/** Methods a route entry may carry that are middleware, not a mounted handler. */\nconst NON_ROUTE_METHOD = 'ALL';\n\nconst bootedApplications = new WeakSet<object>();\n\ninterface IProbeBinding {\n key: string;\n}\n\ninterface IDynamicBindingsOptions {\n namespace: string;\n onBeforeConfigure?: (opts: { binding: Binding<AnyType> }) => Promise<void>;\n onAfterConfigure?: (opts: { binding: Binding<AnyType>; instance: AnyType }) => Promise<void>;\n}\n\n/** What the helper replaced, so every path puts it back. */\ninterface IPatch {\n restore: () => void;\n}\n\nconst matchesTarget = (opts: {\n targets: TBootProbeTarget[];\n binding: IProbeBinding;\n instance: AnyType;\n}): boolean => {\n const { targets, binding, instance } = opts;\n const className: string | undefined = instance?.constructor?.name;\n\n return targets.some((target) =>\n typeof target === 'string'\n ? target === binding.key || target === className\n : instance?.constructor === target,\n );\n};\n\nconst fail = (message: string): never => {\n throw getError({ message: `[ApplicationBootAssertion.assert] ${message}` });\n};\n\n/** Replaces `object[name]` and returns the way back, even when `name` was inherited. */\nconst patchProperty = (opts: { object: AnyType; name: string; value: unknown }): IPatch => {\n const { object, name, value } = opts;\n const descriptor = Object.getOwnPropertyDescriptor(object, name);\n\n Object.defineProperty(object, name, { value, configurable: true, writable: true });\n\n return {\n restore: () => {\n if (descriptor) {\n Object.defineProperty(object, name, descriptor);\n\n return;\n }\n\n delete object[name];\n },\n };\n};\n\nconst normalizePath = (path: string): string => {\n const withParams = path.replace(/:[A-Za-z0-9_]+/g, ':param').replace(/\\/{2,}/g, '/');\n\n return withParams.length > 1 ? withParams.replace(/\\/$/, '') : withParams;\n};\n\n/** The helper's own check: IGNIS mounts a method and path twice without complaint, and the first one wins. */\nconst assertNoDuplicateRoutes = (opts: { application: BaseApplication }): void => {\n const { application } = opts;\n // signature -> controller key -> how many times that controller declares it\n const mounted = new Map<string, Map<string, number>>();\n\n const record = (signature: string, key: string, declarations: number): void => {\n const owners = mounted.get(signature) ?? new Map<string, number>();\n owners.set(key, Math.max(owners.get(key) ?? 0, declarations));\n mounted.set(signature, owners);\n };\n\n for (const binding of application.findByTag<AbstractRestController>({\n tag: BindingNamespaces.CONTROLLER,\n })) {\n const target = binding.getBindingMeta({ type: BindingValueTypes.CLASS });\n const metadata = target\n ? MetadataRegistry.getInstance().getControllerMetadata({ target })\n : undefined;\n\n if (!metadata?.path || metadata.transport === ControllerTransports.GRPC) {\n continue;\n }\n\n const instance = application.get<AbstractRestController>({\n key: binding.key,\n isOptional: true,\n });\n\n // Hono's `routes` has one entry PER HANDLER (a validator, an authenticate and the handler of one route are three\n // entries with the same method and path), so an entry is not a declaration: a controller counts once per signature.\n for (const route of instance?.getRouter().routes ?? []) {\n if (route.method === NON_ROUTE_METHOD) {\n continue;\n }\n\n record(`${route.method} ${normalizePath(`${metadata.path}/${route.path}`)}`, binding.key, 1);\n }\n\n // What the router cannot show: one controller declaring a method and path twice. Decorated routes are one\n // metadata entry per declaration, so those are counted there.\n const declared = new Map<string, number>();\n\n for (const route of MetadataRegistry.getInstance()\n .getRoutes({ target: (target as TClass<AnyType>).prototype })\n ?.values() ?? []) {\n const signature = `${String(route.method).toUpperCase()} ${normalizePath(`${metadata.path}/${route.path}`)}`;\n declared.set(signature, (declared.get(signature) ?? 0) + 1);\n }\n\n for (const [signature, declarations] of declared) {\n record(signature, binding.key, declarations);\n }\n }\n\n const duplicates = [...mounted.entries()].filter(\n ([, owners]) =>\n owners.size > 1 || [...owners.values()].some((declarations) => declarations > 1),\n );\n\n if (duplicates.length === 0) {\n return;\n }\n\n const lines = duplicates.map(\n ([signature, owners]) =>\n `${signature} | controllers: ${[...owners]\n .map(([key, declarations]) =>\n declarations > 1 ? `${key} (declared ${declarations} times)` : key,\n )\n .join(', ')}`,\n );\n fail(\n `${duplicates.length} route(s) are mounted more than once, and only the first one answers | ${lines.join(' ; ')} | This is the helper's own check (IGNIS boot does not detect it); pass { routes: false } to turn it off`,\n );\n};\n\n/**\n * Proves an IGNIS application boots, without a datasource connection, a socket or a secrets provider:\n * it runs the application's own boot sequence (`init()` then `initialize()`) and never calls `start()`,\n * so no socket is opened and no post-start hook runs.\n *\n * Datasources are bound and resolved but not configured, unless named in `keepDataSources`; the\n * secrets steps are skipped; every other step and every component runs as in a real boot. A component\n * that opens Redis, Kafka or S3 in `binding()` therefore runs for real: name it in `skipComponents`.\n * When the boot fails inside a component, one warning names it; the rejection is still the original error. When the\n * boot fails, the rejection is the original error. The application stays booted and is returned;\n * a failed boot leaves a half-booted instance, so build a new one rather than reuse it.\n *\n * It wraps `registerDynamicBindings` and `getBootSequence` on THIS instance only (an application's\n * own override of either still runs) and restores them whatever happens.\n */\nexport class ApplicationBootAssertion {\n static async assert<Application extends BaseApplication>(opts: {\n application: Application | (() => Application | Promise<Application>);\n options?: IAssertApplicationBootsOptions;\n }): Promise<Application> {\n const { application, options = {} } = opts;\n const {\n keepDataSources = [],\n skipComponents = [],\n skipSteps = DEFAULT_SKIPPED_STEPS,\n verifyBindings = true,\n skipBindings = [],\n allowNoControllers = false,\n routes = true,\n } = options;\n\n for (const step of skipSteps) {\n if (!ServerBootSteps.isValid(step)) {\n fail(\n `Unknown boot step in skipSteps: '${String(step)}' | Expected one of: ${[...ServerBootSteps.SCHEME_SET].join(', ')}`,\n );\n }\n }\n\n let target: Application;\n\n if (typeof application === 'function') {\n const built = await application();\n target = built;\n } else {\n target = application;\n }\n\n if (\n bootedApplications.has(target) ||\n Object.keys(target['registeredBindings'] ?? {}).length > 0\n ) {\n fail(\n `This application instance was already booted | A failed or finished boot leaves registrations behind, so build a new instance (pass a factory) for each call`,\n );\n }\n\n bootedApplications.add(target);\n\n for (const name of WRAPPED_METHODS) {\n if (typeof target[name] !== 'function') {\n fail(\n `The kernel method '${name}' is missing on this application | The helper cannot keep a boot offline without it, so it refuses to boot`,\n );\n }\n }\n\n const skippedSteps = new Set<string>(skipSteps);\n const patches: IPatch[] = [];\n let sweepsSeen = 0;\n // The components whose `configure()` is running, innermost last: when the boot rejects, the last one is where it failed.\n const configuringComponents: string[] = [];\n\n const neutralise = async (entry: {\n namespace: string;\n binding: Binding<AnyType>;\n }): Promise<void> => {\n const { namespace, binding } = entry;\n const isDataSource = namespace === BindingNamespaces.DATASOURCE;\n const isComponent = namespace === BindingNamespaces.COMPONENT;\n\n if (!isDataSource && !isComponent) {\n return;\n }\n\n const instance = target.get<AnyType>({ key: binding.key, isOptional: false });\n\n if (typeof instance?.configure !== 'function') {\n return;\n }\n\n const shouldRun = isDataSource\n ? matchesTarget({ targets: keepDataSources, binding, instance })\n : !matchesTarget({ targets: skipComponents, binding, instance });\n\n if (shouldRun) {\n return;\n }\n\n patches.push(patchProperty({ object: instance, name: 'configure', value: async () => {} }));\n };\n\n const originalRegisterDynamicBindings = target['registerDynamicBindings'] as unknown as (\n opts: IDynamicBindingsOptions,\n ) => Promise<void>;\n const originalGetBootSequence = target['getBootSequence'] as unknown as () => Array<{\n name: string;\n }>;\n\n const wrappedRegister = async (sweepOptions: IDynamicBindingsOptions): Promise<void> => {\n sweepsSeen += 1;\n const userBefore = sweepOptions.onBeforeConfigure;\n const userAfter = sweepOptions.onAfterConfigure;\n\n return originalRegisterDynamicBindings.call(target, {\n ...sweepOptions,\n onBeforeConfigure: async ({ binding }) => {\n await neutralise({ namespace: sweepOptions.namespace, binding });\n\n if (sweepOptions.namespace === BindingNamespaces.COMPONENT) {\n const instance = target.get<AnyType>({ key: binding.key, isOptional: true });\n configuringComponents.push(String(instance?.constructor?.name ?? binding.key));\n }\n\n await userBefore?.({ binding });\n },\n onAfterConfigure: async ({ binding, instance }) => {\n if (sweepOptions.namespace === BindingNamespaces.COMPONENT) {\n configuringComponents.pop();\n }\n\n await userAfter?.({ binding, instance });\n },\n });\n };\n\n patches.push(\n patchProperty({ object: target, name: 'registerDynamicBindings', value: wrappedRegister }),\n );\n patches.push(\n patchProperty({\n object: target,\n name: 'getBootSequence',\n value: () =>\n originalGetBootSequence.call(target).filter((step) => !skippedSteps.has(step.name)),\n }),\n );\n\n if ((target['registerDynamicBindings'] as unknown) !== wrappedRegister) {\n patches.forEach((patch) => patch.restore());\n fail(\n `The wrap of 'registerDynamicBindings' did not take effect | Refusing to boot against real infrastructure`,\n );\n }\n\n const configs = target['configs'];\n const originalBootChecks = configs.bootChecks;\n const originalBinding = originalBootChecks?.binding;\n configs.bootChecks = {\n ...originalBootChecks,\n binding: {\n allowManual: originalBinding?.allowManual ?? true,\n allowOverride: originalBinding?.allowOverride ?? true,\n doVerify: false,\n },\n };\n\n try {\n if (!target.isBound({ key: CoreBindings.APPLICATION_INSTANCE })) {\n target.init();\n }\n\n await target.initialize();\n\n const sweepsExpected = [\n ServerBootSteps.REGISTER_DATA_SOURCES,\n ServerBootSteps.REGISTER_COMPONENTS,\n ServerBootSteps.REGISTER_CONTRIBUTED_DATA_SOURCES,\n ].some((step) => !skippedSteps.has(step));\n\n if (sweepsExpected && sweepsSeen === 0) {\n fail(\n `The boot never went through 'registerDynamicBindings' | The wrap did not take effect, so datasources may have been configured`,\n );\n }\n\n if (verifyBindings) {\n BindingVerifier.assertResolve({\n container: target,\n namespaces: [BindingNamespaces.SERVICE, BindingNamespaces.REPOSITORY],\n skip: skipBindings,\n scope: 'verifyBindings',\n });\n }\n\n if (\n !allowNoControllers &&\n target.findByTag({ tag: BindingNamespaces.CONTROLLER }).length === 0\n ) {\n fail(\n `The application registered no controller | A boot that registers nothing proves nothing: check the artifact index (for example the AutoArtifacts plugin under 'bun test'), or pass { allowNoControllers: true }`,\n );\n }\n\n if (routes) {\n assertNoDuplicateRoutes({ application: target });\n }\n\n return target;\n } catch (error) {\n const failing = configuringComponents.at(-1);\n\n if (failing) {\n target.logger\n .for('ApplicationBootAssertion.assert')\n .warn(\n `The boot failed inside component ${failing} | If it needs infrastructure, skipComponents: ['${failing}'] skips it, and skipBindings lists the services that depend on it`,\n );\n }\n\n throw error;\n } finally {\n for (const patch of patches.reverse()) {\n patch.restore();\n }\n\n if (originalBootChecks === undefined) {\n delete configs.bootChecks;\n } else {\n configs.bootChecks = originalBootChecks;\n }\n }\n }\n}\n"]}
1
+ {"version":3,"file":"assert-application-boots.js","sourceRoot":"","sources":["../../../src/testing/assert-application-boots.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAwB,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAEL,6BAA6B,EAE7B,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,YAAY,EACZ,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AA+D/B,8FAA8F;AAC9F,MAAM,eAAe,GAAG,CAAC,yBAAyB,EAAE,iBAAiB,CAAU,CAAC;AAEhF,MAAM,qBAAqB,GAAsB;IAC/C,eAAe,CAAC,eAAe;IAC/B,eAAe,CAAC,sBAAsB;CACvC,CAAC;AAEF,kFAAkF;AAClF,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAE/B,MAAM,kBAAkB,GAAG,IAAI,OAAO,EAAU,CAAC;AAiBjD,MAAM,aAAa,GAAG,CAAC,IAItB,EAAW,EAAE;IACZ,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;IAC5C,MAAM,SAAS,GAAuB,QAAQ,EAAE,WAAW,EAAE,IAAI,CAAC;IAElE,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAC7B,OAAO,MAAM,KAA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{ ServerBootSteps, type TServerBootStep } from '@/base/applications';\nimport type { AnyType, TClass } from '@venizia/ignis-helpers/common';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport { BindingVerifier } from '@venizia/ignis-inversion';\nimport {\n type AbstractRestController,\n AuthorizationEnforcerRegistry,\n type Binding,\n BindingNamespaces,\n BindingValueTypes,\n ControllerTransports,\n CoreBindings,\n MetadataRegistry,\n} from '@venizia/ignis-kernel';\n\n/** A class (matched against the instance's constructor) or a string (matched against the binding key or the class name). */\nexport type TBootProbeTarget = TClass<AnyType> | string;\n\n/** Options of `ApplicationBootAssertion.assert`; each field narrows or relaxes what the boot probe runs and verifies. */\nexport interface IAssertApplicationBootsOptions {\n /**\n * Datasources whose real `configure()` runs. Every other datasource is bound and resolved but not\n * configured, so no connection is made. Close a kept one with `await application.stop()`.\n *\n * @default []\n */\n keepDataSources?: TBootProbeTarget[];\n\n /**\n * Components whose `configure()` (and so their `binding()`) is skipped, for the few that need\n * infrastructure. What a skipped component would have registered is not registered.\n *\n * @default []\n */\n skipComponents?: TBootProbeTarget[];\n\n /**\n * Boot steps that do not run, so a remote secrets provider is never contacted. A value REPLACES\n * the default; an unknown name rejects before anything boots.\n *\n * @default [ServerBootSteps.HYDRATE_SECRETS, ServerBootSteps.WIRE_SECRET_ROTATABLES]\n */\n skipSteps?: TServerBootStep[];\n\n /**\n * After boot, resolves every service and repository with the shared core of\n * `@venizia/ignis-inversion`, so an injection nobody references at boot still fails. An explicit value\n * wins over the application's own `bootChecks`, whose boot step is off for the run.\n *\n * @default true\n */\n verifyBindings?: boolean;\n\n /**\n * Services or repositories the verification leaves unresolved, for one whose constructor needs\n * infrastructure. A class (exact), a class name or a binding key. A name that matches nothing rejects.\n *\n * @default []\n */\n skipBindings?: TBootProbeTarget[];\n\n /**\n * Whether an application that registered no controller passes. Off, it fails: it proves nothing, for example when the artifact index was empty.\n *\n * @default false\n */\n allowNoControllers?: boolean;\n\n /**\n * This helper's own check that no method and path is mounted twice. IGNIS boot does not detect that.\n *\n * @default true\n */\n routes?: boolean;\n}\n\n/** The boot sequence is the contract; these two are what the helper wraps on one instance. */\nconst WRAPPED_METHODS = ['registerDynamicBindings', 'getBootSequence'] as const;\n\nconst DEFAULT_SKIPPED_STEPS: TServerBootStep[] = [\n ServerBootSteps.HYDRATE_SECRETS,\n ServerBootSteps.WIRE_SECRET_ROTATABLES,\n];\n\n/** Methods a route entry may carry that are middleware, not a mounted handler. */\nconst NON_ROUTE_METHOD = 'ALL';\n\nconst bootedApplications = new WeakSet<object>();\n\ninterface IProbeBinding {\n key: string;\n}\n\ninterface IDynamicBindingsOptions {\n namespace: string;\n onBeforeConfigure?: (opts: { binding: Binding<AnyType> }) => Promise<void>;\n onAfterConfigure?: (opts: { binding: Binding<AnyType>; instance: AnyType }) => Promise<void>;\n}\n\n/** What the helper replaced, so every path puts it back. */\ninterface IPatch {\n restore: () => void;\n}\n\nconst matchesTarget = (opts: {\n targets: TBootProbeTarget[];\n binding: IProbeBinding;\n instance: AnyType;\n}): boolean => {\n const { targets, binding, instance } = opts;\n const className: string | undefined = instance?.constructor?.name;\n\n return targets.some((target) =>\n typeof target === 'string'\n ? target === binding.key || target === className\n : instance?.constructor === target,\n );\n};\n\nconst fail = (message: string): never => {\n throw getError({ message: `[ApplicationBootAssertion.assert] ${message}` });\n};\n\n/** Replaces `object[name]` and returns the way back, even when `name` was inherited. */\nconst patchProperty = (opts: { object: AnyType; name: string; value: unknown }): IPatch => {\n const { object, name, value } = opts;\n const descriptor = Object.getOwnPropertyDescriptor(object, name);\n\n Object.defineProperty(object, name, { value, configurable: true, writable: true });\n\n return {\n restore: () => {\n if (descriptor) {\n Object.defineProperty(object, name, descriptor);\n\n return;\n }\n\n delete object[name];\n },\n };\n};\n\nconst normalizePath = (path: string): string => {\n const withParams = path.replace(/:[A-Za-z0-9_]+/g, ':param').replace(/\\/{2,}/g, '/');\n\n return withParams.length > 1 ? withParams.replace(/\\/$/, '') : withParams;\n};\n\n/** The helper's own check: IGNIS mounts a method and path twice without complaint, and the first one wins. */\nconst assertNoDuplicateRoutes = (opts: { application: BaseApplication }): void => {\n const { application } = opts;\n // signature -> controller key -> how many times that controller declares it\n const mounted = new Map<string, Map<string, number>>();\n\n const record = (signature: string, key: string, declarations: number): void => {\n const owners = mounted.get(signature) ?? new Map<string, number>();\n owners.set(key, Math.max(owners.get(key) ?? 0, declarations));\n mounted.set(signature, owners);\n };\n\n for (const binding of application.findByTag<AbstractRestController>({\n tag: BindingNamespaces.CONTROLLER,\n })) {\n const target = binding.getBindingMeta({ type: BindingValueTypes.CLASS });\n const metadata = target\n ? MetadataRegistry.getInstance().getControllerMetadata({ target })\n : undefined;\n\n if (!metadata?.path || metadata.transport === ControllerTransports.GRPC) {\n continue;\n }\n\n const instance = application.get<AbstractRestController>({\n key: binding.key,\n isOptional: true,\n });\n\n // Hono's `routes` has one entry PER HANDLER (a validator, an authenticate and the handler of one route are three\n // entries with the same method and path), so an entry is not a declaration: a controller counts once per signature.\n for (const route of instance?.getRouter().routes ?? []) {\n if (route.method === NON_ROUTE_METHOD) {\n continue;\n }\n\n record(`${route.method} ${normalizePath(`${metadata.path}/${route.path}`)}`, binding.key, 1);\n }\n\n // What the router cannot show: one controller declaring a method and path twice. Decorated routes are one\n // metadata entry per declaration, so those are counted there.\n const declared = new Map<string, number>();\n\n for (const route of MetadataRegistry.getInstance()\n .getRoutes({ target: (target as TClass<AnyType>).prototype })\n ?.values() ?? []) {\n const signature = `${String(route.method).toUpperCase()} ${normalizePath(`${metadata.path}/${route.path}`)}`;\n declared.set(signature, (declared.get(signature) ?? 0) + 1);\n }\n\n for (const [signature, declarations] of declared) {\n record(signature, binding.key, declarations);\n }\n }\n\n const duplicates = [...mounted.entries()].filter(\n ([, owners]) =>\n owners.size > 1 || [...owners.values()].some((declarations) => declarations > 1),\n );\n\n if (duplicates.length === 0) {\n return;\n }\n\n const lines = duplicates.map(\n ([signature, owners]) =>\n `${signature} | controllers: ${[...owners]\n .map(([key, declarations]) =>\n declarations > 1 ? `${key} (declared ${declarations} times)` : key,\n )\n .join(', ')}`,\n );\n fail(\n `${duplicates.length} route(s) are mounted more than once, and only the first one answers | ${lines.join(' ; ')} | This is the helper's own check (IGNIS boot does not detect it); pass { routes: false } to turn it off`,\n );\n};\n\n/**\n * Proves an IGNIS application boots, without a datasource connection, a socket or a secrets provider:\n * it runs the application's own boot sequence (`init()` then `initialize()`) and never calls `start()`,\n * so no socket is opened and no post-start hook runs.\n *\n * Datasources are bound and resolved but not configured, unless named in `keepDataSources`; the\n * secrets steps are skipped; every other step and every component runs as in a real boot. A component\n * that opens Redis, Kafka or S3 in `binding()` therefore runs for real: name it in `skipComponents`.\n * `setupMiddlewares()` is not run: it is the application's own start-time step, user code that may open\n * connections, and the probe cannot know it is free of side effects. The framework's default stack (CORS, body\n * limit, request id) is a boot step of `initialize()`, so an invalid `configs.middlewares` value still fails here.\n * When the boot fails inside a component, one warning names it; the rejection is still the original error. When the\n * boot fails, the rejection is the original error. The application stays booted and is returned;\n * a failed boot leaves a half-booted instance, so build a new one rather than reuse it.\n *\n * It wraps `registerDynamicBindings` and `getBootSequence` on THIS instance only (an application's\n * own override of either still runs) and restores them whatever happens.\n *\n * It owns the process-wide `AuthorizationEnforcerRegistry` for the duration of the check: it resets it before it\n * boots, so a second boot in the same process (another probe, or a test boot after this one) does not fail with\n * `Enforcer already registered`. An application still running in the same process loses its enforcer registrations\n * and its authorize options, so its requests are then decided by the no-enforcer default (deny unless configured\n * otherwise): do not run the probe in a process that serves an application.\n *\n * @example\n * ```typescript\n * import { ApplicationBootAssertion } from '@venizia/ignis/testing';\n * import { test } from 'bun:test';\n * import { Application } from './application';\n *\n * test('the application boots offline', async () => {\n * await ApplicationBootAssertion.assert({\n * application: () => new Application({ scope: 'Application', config: { host: '127.0.0.1', port: 0, path: { base: '/', isStrict: true } } }),\n * options: { skipComponents: ['MailComponent'], allowNoControllers: true },\n * });\n * });\n * ```\n */\nexport class ApplicationBootAssertion {\n static async assert<Application extends BaseApplication>(opts: {\n application: Application | (() => Application | Promise<Application>);\n options?: IAssertApplicationBootsOptions;\n }): Promise<Application> {\n const { application, options = {} } = opts;\n const {\n keepDataSources = [],\n skipComponents = [],\n skipSteps = DEFAULT_SKIPPED_STEPS,\n verifyBindings = true,\n skipBindings = [],\n allowNoControllers = false,\n routes = true,\n } = options;\n\n for (const step of skipSteps) {\n if (!ServerBootSteps.isValid(step)) {\n fail(\n `Unknown boot step in skipSteps: '${String(step)}' | Expected one of: ${[...ServerBootSteps.SCHEME_SET].join(', ')}`,\n );\n }\n }\n\n let target: Application;\n\n if (typeof application === 'function') {\n const built = await application();\n target = built;\n } else {\n target = application;\n }\n\n if (\n bootedApplications.has(target) ||\n Object.keys(target['registeredBindings'] ?? {}).length > 0\n ) {\n fail(\n `This application instance was already booted | A failed or finished boot leaves registrations behind, so build a new instance (pass a factory) for each call`,\n );\n }\n\n bootedApplications.add(target);\n\n for (const name of WRAPPED_METHODS) {\n if (typeof target[name] !== 'function') {\n fail(\n `The kernel method '${name}' is missing on this application | The helper cannot keep a boot offline without it, so it refuses to boot`,\n );\n }\n }\n\n const skippedSteps = new Set<string>(skipSteps);\n const patches: IPatch[] = [];\n let sweepsSeen = 0;\n // The components whose `configure()` is running, innermost last: when the boot rejects, the last one is where it failed.\n const configuringComponents: string[] = [];\n\n const neutralise = async (entry: {\n namespace: string;\n binding: Binding<AnyType>;\n }): Promise<void> => {\n const { namespace, binding } = entry;\n const isDataSource = namespace === BindingNamespaces.DATASOURCE;\n const isComponent = namespace === BindingNamespaces.COMPONENT;\n\n if (!isDataSource && !isComponent) {\n return;\n }\n\n const instance = target.get<AnyType>({ key: binding.key, isOptional: false });\n\n if (typeof instance?.configure !== 'function') {\n return;\n }\n\n const shouldRun = isDataSource\n ? matchesTarget({ targets: keepDataSources, binding, instance })\n : !matchesTarget({ targets: skipComponents, binding, instance });\n\n if (shouldRun) {\n return;\n }\n\n patches.push(patchProperty({ object: instance, name: 'configure', value: async () => {} }));\n };\n\n const originalRegisterDynamicBindings = target['registerDynamicBindings'] as unknown as (\n opts: IDynamicBindingsOptions,\n ) => Promise<void>;\n const originalGetBootSequence = target['getBootSequence'] as unknown as () => Array<{\n name: string;\n }>;\n\n const wrappedRegister = async (sweepOptions: IDynamicBindingsOptions): Promise<void> => {\n sweepsSeen += 1;\n const userBefore = sweepOptions.onBeforeConfigure;\n const userAfter = sweepOptions.onAfterConfigure;\n\n return originalRegisterDynamicBindings.call(target, {\n ...sweepOptions,\n onBeforeConfigure: async ({ binding }) => {\n await neutralise({ namespace: sweepOptions.namespace, binding });\n\n if (sweepOptions.namespace === BindingNamespaces.COMPONENT) {\n const instance = target.get<AnyType>({ key: binding.key, isOptional: true });\n configuringComponents.push(String(instance?.constructor?.name ?? binding.key));\n }\n\n await userBefore?.({ binding });\n },\n onAfterConfigure: async ({ binding, instance }) => {\n if (sweepOptions.namespace === BindingNamespaces.COMPONENT) {\n configuringComponents.pop();\n }\n\n await userAfter?.({ binding, instance });\n },\n });\n };\n\n patches.push(\n patchProperty({ object: target, name: 'registerDynamicBindings', value: wrappedRegister }),\n );\n patches.push(\n patchProperty({\n object: target,\n name: 'getBootSequence',\n value: () =>\n originalGetBootSequence.call(target).filter((step) => !skippedSteps.has(step.name)),\n }),\n );\n\n if ((target['registerDynamicBindings'] as unknown) !== wrappedRegister) {\n patches.forEach((patch) => patch.restore());\n fail(\n `The wrap of 'registerDynamicBindings' did not take effect | Refusing to boot against real infrastructure`,\n );\n }\n\n const configs = target['configs'];\n const originalBootChecks = configs.bootChecks;\n const originalBinding = originalBootChecks?.binding;\n configs.bootChecks = {\n ...originalBootChecks,\n binding: {\n allowManual: originalBinding?.allowManual ?? true,\n allowOverride: originalBinding?.allowOverride ?? true,\n doVerify: false,\n },\n };\n\n AuthorizationEnforcerRegistry.getInstance().reset();\n\n try {\n if (!target.isBound({ key: CoreBindings.APPLICATION_INSTANCE })) {\n target.init();\n }\n\n await target.initialize();\n\n const sweepsExpected = [\n ServerBootSteps.REGISTER_DATA_SOURCES,\n ServerBootSteps.REGISTER_COMPONENTS,\n ServerBootSteps.REGISTER_CONTRIBUTED_DATA_SOURCES,\n ].some((step) => !skippedSteps.has(step));\n\n if (sweepsExpected && sweepsSeen === 0) {\n fail(\n `The boot never went through 'registerDynamicBindings' | The wrap did not take effect, so datasources may have been configured`,\n );\n }\n\n if (verifyBindings) {\n BindingVerifier.assertResolve({\n container: target,\n namespaces: [BindingNamespaces.SERVICE, BindingNamespaces.REPOSITORY],\n skip: skipBindings,\n scope: 'verifyBindings',\n });\n }\n\n if (\n !allowNoControllers &&\n target.findByTag({ tag: BindingNamespaces.CONTROLLER }).length === 0\n ) {\n fail(\n `The application registered no controller | A boot that registers nothing proves nothing: check the artifact index (for example the AutoArtifacts plugin under 'bun test'), or pass { allowNoControllers: true }`,\n );\n }\n\n if (routes) {\n assertNoDuplicateRoutes({ application: target });\n }\n\n return target;\n } catch (error) {\n const failing = configuringComponents.at(-1);\n\n if (failing) {\n target.logger\n .for('ApplicationBootAssertion.assert')\n .warn(\n `The boot failed inside component ${failing} | If it needs infrastructure, skipComponents: ['${failing}'] skips it, and skipBindings lists the services that depend on it`,\n );\n }\n\n throw error;\n } finally {\n for (const patch of patches.reverse()) {\n patch.restore();\n }\n\n if (originalBootChecks === undefined) {\n delete configs.bootChecks;\n } else {\n configs.bootChecks = originalBootChecks;\n }\n }\n }\n}\n"]}
@@ -1,3 +1,4 @@
1
+ /** Normalizes the result of a raw Drizzle `execute()` call across the postgres-js and node-postgres drivers. */
1
2
  export declare class DrizzleResultUtility {
2
3
  /** Rows returned by `connector.execute(...)`. */
3
4
  static readResultRows<TRow>(opts: {
@@ -1,4 +1,5 @@
1
1
  import { getError } from '@venizia/ignis-helpers/core';
2
+ /** Normalizes the result of a raw Drizzle `execute()` call across the postgres-js and node-postgres drivers. */
2
3
  export class DrizzleResultUtility {
3
4
  /** Rows returned by `connector.execute(...)`. */
4
5
  static readResultRows(opts) {
@@ -1 +1 @@
1
- {"version":3,"file":"drizzle-result.utility.js","sourceRoot":"","sources":["../../../src/utilities/drizzle-result.utility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,MAAM,OAAO,oBAAoB;IAC/B,iDAAiD;IACjD,MAAM,CAAC,cAAc,CAAO,IAAyB;QACnD,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAExB,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YAC5C,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,2CAA2C;QAC3C,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAC1B,OAAO,MAAgB,CAAC;QAC1B,CAAC;QAED,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC/B,MAAM,QAAQ,CAAC;gBACb,OAAO,EAAE,4HAA4H,OAAO,MAAM,EAAE;aACrJ,CAAC,CAAC;QACL,CAAC;QAED,iCAAiC;QACjC,MAAM,EAAE,IAAI,EAAE,GAAG,MAA4B,CAAC;QAE9C,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YACxB,OAAO,IAAc,CAAC;QACxB,CAAC;QAED,MAAM,QAAQ,CAAC;YACb,OAAO,EAAE,oJAAoJ,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;SAC9L,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { getError } from '@venizia/ignis-helpers/core';\n\nexport class DrizzleResultUtility {\n /** Rows returned by `connector.execute(...)`. */\n static readResultRows<TRow>(opts: { result: unknown }): TRow[] {\n const { result } = opts;\n\n if (result === null || result === undefined) {\n return [];\n }\n\n // postgres-js: the result IS the row list.\n if (Array.isArray(result)) {\n return result as TRow[];\n }\n\n if (typeof result !== 'object') {\n throw getError({\n message: `[DrizzleResultUtility.readResultRows] Unrecognized driver result | expected pg.QueryResult or postgres-js RowList | got: ${typeof result}`,\n });\n }\n\n // node-postgres: pg.QueryResult.\n const { rows } = result as { rows?: unknown };\n\n if (Array.isArray(rows)) {\n return rows as TRow[];\n }\n\n throw getError({\n message: `[DrizzleResultUtility.readResultRows] Unrecognized driver result | expected an array (postgres-js) or a 'rows' array (node-postgres) | got keys: ${Object.keys(result).join(', ')}`,\n });\n }\n}\n"]}
1
+ {"version":3,"file":"drizzle-result.utility.js","sourceRoot":"","sources":["../../../src/utilities/drizzle-result.utility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,gHAAgH;AAChH,MAAM,OAAO,oBAAoB;IAC/B,iDAAiD;IACjD,MAAM,CAAC,cAAc,CAAO,IAAyB;QACnD,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAExB,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YAC5C,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,2CAA2C;QAC3C,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAC1B,OAAO,MAAgB,CAAC;QAC1B,CAAC;QAED,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC/B,MAAM,QAAQ,CAAC;gBACb,OAAO,EAAE,4HAA4H,OAAO,MAAM,EAAE;aACrJ,CAAC,CAAC;QACL,CAAC;QAED,iCAAiC;QACjC,MAAM,EAAE,IAAI,EAAE,GAAG,MAA4B,CAAC;QAE9C,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YACxB,OAAO,IAAc,CAAC;QACxB,CAAC;QAED,MAAM,QAAQ,CAAC;YACb,OAAO,EAAE,oJAAoJ,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;SAC9L,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { getError } from '@venizia/ignis-helpers/core';\n\n/** Normalizes the result of a raw Drizzle `execute()` call across the postgres-js and node-postgres drivers. */\nexport class DrizzleResultUtility {\n /** Rows returned by `connector.execute(...)`. */\n static readResultRows<TRow>(opts: { result: unknown }): TRow[] {\n const { result } = opts;\n\n if (result === null || result === undefined) {\n return [];\n }\n\n // postgres-js: the result IS the row list.\n if (Array.isArray(result)) {\n return result as TRow[];\n }\n\n if (typeof result !== 'object') {\n throw getError({\n message: `[DrizzleResultUtility.readResultRows] Unrecognized driver result | expected pg.QueryResult or postgres-js RowList | got: ${typeof result}`,\n });\n }\n\n // node-postgres: pg.QueryResult.\n const { rows } = result as { rows?: unknown };\n\n if (Array.isArray(rows)) {\n return rows as TRow[];\n }\n\n throw getError({\n message: `[DrizzleResultUtility.readResultRows] Unrecognized driver result | expected an array (postgres-js) or a 'rows' array (node-postgres) | got keys: ${Object.keys(result).join(', ')}`,\n });\n }\n}\n"]}
@@ -14,9 +14,9 @@
14
14
  "dependencies": {
15
15
  "@hono/zod-openapi": "^1.6.3",
16
16
  "@scalar/hono-api-reference": "^0.12.13",
17
- "@venizia/ignis": "0.4.8-0",
18
- "@venizia/ignis-boot": "0.4.8-0",
19
- "@venizia/ignis-helpers": "0.4.8-0",
17
+ "@venizia/ignis": "0.4.8-10",
18
+ "@venizia/ignis-boot": "0.4.8-8",
19
+ "@venizia/ignis-helpers": "0.4.8-8",
20
20
  "hono": "^4.13.13",
21
21
  "winston": "^3.19.0",
22
22
  "winston-daily-rotate-file": "^5.0.0",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/bun": "^1.4.3",
27
- "@venizia/dev-configs": "0.4.8-0",
27
+ "@venizia/dev-configs": "0.4.8-5",
28
28
  "eslint": "^10.13.0",
29
29
  "oxlint": "1.89.0",
30
30
  "oxlint-tsgolint": "7.0.2004",
@@ -4,15 +4,15 @@
4
4
  "dependencies": {},
5
5
  "devDependencies": {
6
6
  "@types/bun": "^1.4.3",
7
- "@venizia/dev-configs": "0.4.8-0",
8
- "@venizia/ignis": "0.4.8-0",
7
+ "@venizia/dev-configs": "0.4.8-5",
8
+ "@venizia/ignis": "0.4.8-10",
9
9
  "eslint": "^10.13.0",
10
10
  "oxlint": "1.89.0",
11
11
  "oxlint-tsgolint": "7.0.2004",
12
12
  "typescript": "^6.0.3"
13
13
  },
14
14
  "peerDependencies": {
15
- "@venizia/ignis": "0.4.8-0"
15
+ "@venizia/ignis": "0.4.8-10"
16
16
  },
17
17
  "scripts": {
18
18
  "typecheck": "bun check",
@@ -4,7 +4,7 @@
4
4
  "dependencies": {},
5
5
  "devDependencies": {
6
6
  "@types/bun": "^1.4.3",
7
- "@venizia/dev-configs": "0.4.8-0",
7
+ "@venizia/dev-configs": "0.4.8-5",
8
8
  "eslint": "^10.13.0",
9
9
  "oxlint": "1.89.0",
10
10
  "oxlint-tsgolint": "7.0.2004",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@venizia/ignis",
3
- "version": "0.4.8-0",
3
+ "version": "0.4.8-10",
4
4
  "description": "TypeScript server framework with decorator-based DI, the repository pattern and a component system, on Hono. Features auto-generated OpenAPI docs, Drizzle ORM type-safe SQL, JWT/Basic authentication, Casbin authorization, convention-based bootstrapping, and pluggable components for health checks, Swagger UI, mail, Socket.IO, and static assets. Built for Bun.",
5
5
  "keywords": [
6
6
  "access-control",
@@ -134,11 +134,11 @@
134
134
  "force-update": "sh ../../scripts/build/force-update.sh"
135
135
  },
136
136
  "dependencies": {
137
- "@venizia/ignis-connectors": "0.4.8-0",
138
- "@venizia/ignis-filter": "0.4.7-0",
139
- "@venizia/ignis-helpers": "0.4.8-0",
140
- "@venizia/ignis-inversion": "0.4.7-0",
141
- "@venizia/ignis-kernel": "0.4.8-0",
137
+ "@venizia/ignis-connectors": "0.4.8-9",
138
+ "@venizia/ignis-filter": "0.4.7-4",
139
+ "@venizia/ignis-helpers": "0.4.8-8",
140
+ "@venizia/ignis-inversion": "0.4.7-3",
141
+ "@venizia/ignis-kernel": "0.4.8-9",
142
142
  "reflect-metadata": "^0.2.2"
143
143
  },
144
144
  "devDependencies": {
@@ -151,8 +151,8 @@
151
151
  "@types/bun": "^1.4.3",
152
152
  "@types/nodemailer": "^8.0.2",
153
153
  "@types/pg": "^8.23.1",
154
- "@venizia/dev-configs": "0.4.8-0",
155
- "@venizia/ignis-boot": "0.4.8-0",
154
+ "@venizia/dev-configs": "0.4.8-5",
155
+ "@venizia/ignis-boot": "0.4.8-8",
156
156
  "casbin": "^5.51.1",
157
157
  "eslint": "^10.13.0",
158
158
  "meilisearch": "^0.62.0",