@venizia/ignis 0.4.8-9 → 0.5.0-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (265) hide show
  1. package/dist/esm/base/applications/base.js +5 -2
  2. package/dist/esm/base/applications/base.js.map +1 -1
  3. package/dist/esm/base/middlewares/request-spy/request-spy.middleware.js +1 -1
  4. package/dist/esm/base/middlewares/request-spy/request-spy.middleware.js.map +1 -1
  5. package/dist/esm/components/api-reference/common/keys.d.ts +2 -1
  6. package/dist/esm/components/api-reference/common/keys.js +4 -1
  7. package/dist/esm/components/api-reference/common/keys.js.map +1 -1
  8. package/dist/esm/components/api-reference/common/types.d.ts +7 -4
  9. package/dist/esm/components/api-reference/common/types.js.map +1 -1
  10. package/dist/esm/components/api-reference/component.js +8 -3
  11. package/dist/esm/components/api-reference/component.js.map +1 -1
  12. package/dist/esm/components/auth/authenticate/component.js +13 -18
  13. package/dist/esm/components/auth/authenticate/component.js.map +1 -1
  14. package/dist/esm/components/auth/authenticate/controllers/factory.d.ts +3 -3
  15. package/dist/esm/components/auth/authenticate/controllers/factory.js +1 -1
  16. package/dist/esm/components/auth/authenticate/controllers/factory.js.map +1 -1
  17. package/dist/esm/components/auth/authenticate/controllers/jwks/controller.js.map +1 -1
  18. package/dist/esm/components/auth/authenticate/controllers/jwks/definitions.d.ts +2 -2
  19. package/dist/esm/components/auth/authenticate/controllers/service-certs/controller.js.map +1 -1
  20. package/dist/esm/components/auth/authenticate/controllers/service-certs/definitions.d.ts +2 -2
  21. package/dist/esm/components/auth/authenticate/services/basic/service.js +1 -1
  22. package/dist/esm/components/auth/authenticate/services/basic/service.js.map +1 -1
  23. package/dist/esm/components/auth/authenticate/services/bearer/abstract.service.d.ts +5 -3
  24. package/dist/esm/components/auth/authenticate/services/bearer/abstract.service.js +19 -2
  25. package/dist/esm/components/auth/authenticate/services/bearer/abstract.service.js.map +1 -1
  26. package/dist/esm/components/auth/authenticate/services/bearer/jwks/issuer.service.d.ts +3 -3
  27. package/dist/esm/components/auth/authenticate/services/bearer/jwks/issuer.service.js +1 -1
  28. package/dist/esm/components/auth/authenticate/services/bearer/jwks/issuer.service.js.map +1 -1
  29. package/dist/esm/components/auth/authenticate/services/bearer/jwks/verifier.service.d.ts +3 -3
  30. package/dist/esm/components/auth/authenticate/services/bearer/jwks/verifier.service.js +2 -2
  31. package/dist/esm/components/auth/authenticate/services/bearer/jwks/verifier.service.js.map +1 -1
  32. package/dist/esm/components/auth/authenticate/services/bearer/jws.service.d.ts +3 -3
  33. package/dist/esm/components/auth/authenticate/services/bearer/jws.service.js +1 -1
  34. package/dist/esm/components/auth/authenticate/services/bearer/jws.service.js.map +1 -1
  35. package/dist/esm/components/auth/authenticate/services/jwks-url-policy.d.ts +10 -22
  36. package/dist/esm/components/auth/authenticate/services/jwks-url-policy.js +16 -112
  37. package/dist/esm/components/auth/authenticate/services/jwks-url-policy.js.map +1 -1
  38. package/dist/esm/components/auth/authenticate/services/service/signer.service.d.ts +11 -0
  39. package/dist/esm/components/auth/authenticate/services/service/signer.service.js +18 -0
  40. package/dist/esm/components/auth/authenticate/services/service/signer.service.js.map +1 -1
  41. package/dist/esm/components/auth/authenticate/services/service/verifier.service.js +1 -1
  42. package/dist/esm/components/auth/authenticate/services/service/verifier.service.js.map +1 -1
  43. package/dist/esm/components/auth/authenticate/strategies/basic.strategy.js.map +1 -1
  44. package/dist/esm/components/auth/authenticate/strategies/jwks/issuer.js.map +1 -1
  45. package/dist/esm/components/auth/authenticate/strategies/jwks/verifier.js.map +1 -1
  46. package/dist/esm/components/auth/authenticate/strategies/jws.strategy.js.map +1 -1
  47. package/dist/esm/components/auth/authenticate/strategies/service.strategy.js.map +1 -1
  48. package/dist/esm/components/auth/authorize/adapters/common/types.d.ts +1 -2
  49. package/dist/esm/components/auth/authorize/adapters/common/types.js.map +1 -1
  50. package/dist/esm/components/auth/authorize/component.js.map +1 -1
  51. package/dist/esm/components/controller/grpc/common/types.d.ts +1 -1
  52. package/dist/esm/components/controller/grpc/common/types.js +4 -1
  53. package/dist/esm/components/controller/grpc/common/types.js.map +1 -1
  54. package/dist/esm/components/controller/grpc/grpc.component.js.map +1 -1
  55. package/dist/esm/components/health-check/common/keys.d.ts +4 -2
  56. package/dist/esm/components/health-check/common/keys.js +7 -2
  57. package/dist/esm/components/health-check/common/keys.js.map +1 -1
  58. package/dist/esm/components/health-check/common/types.d.ts +1 -1
  59. package/dist/esm/components/health-check/common/types.js.map +1 -1
  60. package/dist/esm/components/health-check/component.js +1 -3
  61. package/dist/esm/components/health-check/component.js.map +1 -1
  62. package/dist/esm/components/mail/common/constants.d.ts +32 -14
  63. package/dist/esm/components/mail/common/constants.js +25 -32
  64. package/dist/esm/components/mail/common/constants.js.map +1 -1
  65. package/dist/esm/components/mail/common/errors.d.ts +19 -1
  66. package/dist/esm/components/mail/common/errors.js +13 -1
  67. package/dist/esm/components/mail/common/errors.js.map +1 -1
  68. package/dist/esm/components/mail/common/keys.d.ts +14 -11
  69. package/dist/esm/components/mail/common/keys.js +34 -11
  70. package/dist/esm/components/mail/common/keys.js.map +1 -1
  71. package/dist/esm/components/mail/common/types/message.d.ts +7 -4
  72. package/dist/esm/components/mail/common/types/message.js.map +1 -1
  73. package/dist/esm/components/mail/common/types/options.d.ts +54 -10
  74. package/dist/esm/components/mail/common/types/options.js.map +1 -1
  75. package/dist/esm/components/mail/common/types/queue.d.ts +25 -12
  76. package/dist/esm/components/mail/common/types/queue.js.map +1 -1
  77. package/dist/esm/components/mail/common/types/template.d.ts +8 -4
  78. package/dist/esm/components/mail/common/types/template.js.map +1 -1
  79. package/dist/esm/components/mail/common/types/verification.d.ts +1 -0
  80. package/dist/esm/components/mail/common/types/verification.js.map +1 -1
  81. package/dist/esm/components/mail/component.js +11 -2
  82. package/dist/esm/components/mail/component.js.map +1 -1
  83. package/dist/esm/components/mail/helpers/executors/bull-mq-executor.helper.d.ts +3 -1
  84. package/dist/esm/components/mail/helpers/executors/bull-mq-executor.helper.js +27 -33
  85. package/dist/esm/components/mail/helpers/executors/bull-mq-executor.helper.js.map +1 -1
  86. package/dist/esm/components/mail/helpers/executors/internal-queue-executor.helper.d.ts +2 -0
  87. package/dist/esm/components/mail/helpers/executors/internal-queue-executor.helper.js +17 -10
  88. package/dist/esm/components/mail/helpers/executors/internal-queue-executor.helper.js.map +1 -1
  89. package/dist/esm/components/mail/helpers/transporters/amazon-ses-transporter.helper.js +11 -6
  90. package/dist/esm/components/mail/helpers/transporters/amazon-ses-transporter.helper.js.map +1 -1
  91. package/dist/esm/components/mail/helpers/transporters/mailgun-transporter.helper.d.ts +2 -3
  92. package/dist/esm/components/mail/helpers/transporters/mailgun-transporter.helper.js +15 -6
  93. package/dist/esm/components/mail/helpers/transporters/mailgun-transporter.helper.js.map +1 -1
  94. package/dist/esm/components/mail/helpers/transporters/nodemail-transporter.helper.d.ts +2 -3
  95. package/dist/esm/components/mail/helpers/transporters/nodemail-transporter.helper.js +2 -2
  96. package/dist/esm/components/mail/helpers/transporters/nodemail-transporter.helper.js.map +1 -1
  97. package/dist/esm/components/mail/providers/mail-queue-executor.provider.d.ts +2 -2
  98. package/dist/esm/components/mail/providers/mail-queue-executor.provider.js +7 -9
  99. package/dist/esm/components/mail/providers/mail-queue-executor.provider.js.map +1 -1
  100. package/dist/esm/components/mail/providers/mail-transporter.provider.js +7 -7
  101. package/dist/esm/components/mail/providers/mail-transporter.provider.js.map +1 -1
  102. package/dist/esm/components/mail/services/generators/numeric-code.d.ts +1 -6
  103. package/dist/esm/components/mail/services/generators/numeric-code.js +3 -31
  104. package/dist/esm/components/mail/services/generators/numeric-code.js.map +1 -1
  105. package/dist/esm/components/mail/services/generators/random-token.d.ts +4 -1
  106. package/dist/esm/components/mail/services/generators/random-token.js +9 -6
  107. package/dist/esm/components/mail/services/generators/random-token.js.map +1 -1
  108. package/dist/esm/components/mail/services/mail.service.d.ts +1 -2
  109. package/dist/esm/components/mail/services/mail.service.js +22 -19
  110. package/dist/esm/components/mail/services/mail.service.js.map +1 -1
  111. package/dist/esm/components/mail/services/template.service.d.ts +8 -6
  112. package/dist/esm/components/mail/services/template.service.js +34 -33
  113. package/dist/esm/components/mail/services/template.service.js.map +1 -1
  114. package/dist/esm/components/mail/utilities/attachment.utility.js +8 -6
  115. package/dist/esm/components/mail/utilities/attachment.utility.js.map +1 -1
  116. package/dist/esm/components/mail/utilities/header.utility.d.ts +14 -0
  117. package/dist/esm/components/mail/utilities/header.utility.js +44 -0
  118. package/dist/esm/components/mail/utilities/header.utility.js.map +1 -0
  119. package/dist/esm/components/mail/utilities/index.d.ts +2 -0
  120. package/dist/esm/components/mail/utilities/index.js +2 -0
  121. package/dist/esm/components/mail/utilities/index.js.map +1 -1
  122. package/dist/esm/components/mail/utilities/mime.utility.d.ts +5 -1
  123. package/dist/esm/components/mail/utilities/mime.utility.js +12 -58
  124. package/dist/esm/components/mail/utilities/mime.utility.js.map +1 -1
  125. package/dist/esm/components/mail/utilities/template-renderer.utility.d.ts +31 -0
  126. package/dist/esm/components/mail/utilities/template-renderer.utility.js +184 -0
  127. package/dist/esm/components/mail/utilities/template-renderer.utility.js.map +1 -0
  128. package/dist/esm/components/mail/utilities/type.utility.d.ts +2 -3
  129. package/dist/esm/components/mail/utilities/type.utility.js +6 -7
  130. package/dist/esm/components/mail/utilities/type.utility.js.map +1 -1
  131. package/dist/esm/components/request-tracker/component.d.ts +2 -1
  132. package/dist/esm/components/request-tracker/component.js +5 -5
  133. package/dist/esm/components/request-tracker/component.js.map +1 -1
  134. package/dist/esm/components/server-info/common/keys.d.ts +2 -1
  135. package/dist/esm/components/server-info/common/keys.js +4 -1
  136. package/dist/esm/components/server-info/common/keys.js.map +1 -1
  137. package/dist/esm/components/server-info/common/types.d.ts +1 -1
  138. package/dist/esm/components/server-info/common/types.js.map +1 -1
  139. package/dist/esm/components/server-info/component.js +1 -3
  140. package/dist/esm/components/server-info/component.js.map +1 -1
  141. package/dist/esm/components/socket-io/common/keys.d.ts +9 -6
  142. package/dist/esm/components/socket-io/common/keys.js +19 -6
  143. package/dist/esm/components/socket-io/common/keys.js.map +1 -1
  144. package/dist/esm/components/socket-io/component.js +1 -1
  145. package/dist/esm/components/socket-io/component.js.map +1 -1
  146. package/dist/esm/components/socket-io/handlers/bun.handler.d.ts +13 -3
  147. package/dist/esm/components/socket-io/handlers/bun.handler.js.map +1 -1
  148. package/dist/esm/components/static-asset/common/constants.d.ts +51 -24
  149. package/dist/esm/components/static-asset/common/constants.js +75 -47
  150. package/dist/esm/components/static-asset/common/constants.js.map +1 -1
  151. package/dist/esm/components/static-asset/common/errors.d.ts +30 -35
  152. package/dist/esm/components/static-asset/common/errors.js +31 -33
  153. package/dist/esm/components/static-asset/common/errors.js.map +1 -1
  154. package/dist/esm/components/static-asset/common/index.d.ts +1 -1
  155. package/dist/esm/components/static-asset/common/index.js +1 -1
  156. package/dist/esm/components/static-asset/common/index.js.map +1 -1
  157. package/dist/esm/components/static-asset/common/keys.d.ts +14 -2
  158. package/dist/esm/components/static-asset/common/keys.js +17 -2
  159. package/dist/esm/components/static-asset/common/keys.js.map +1 -1
  160. package/dist/esm/components/static-asset/common/types.d.ts +267 -147
  161. package/dist/esm/components/static-asset/common/types.js.map +1 -1
  162. package/dist/esm/components/static-asset/common/validation.d.ts +10 -0
  163. package/dist/esm/components/static-asset/common/validation.js +8 -0
  164. package/dist/esm/components/static-asset/common/validation.js.map +1 -0
  165. package/dist/esm/components/static-asset/component.d.ts +4 -2
  166. package/dist/esm/components/static-asset/component.js +27 -31
  167. package/dist/esm/components/static-asset/component.js.map +1 -1
  168. package/dist/esm/components/static-asset/controller/factory.d.ts +37 -79
  169. package/dist/esm/components/static-asset/controller/factory.js +26 -917
  170. package/dist/esm/components/static-asset/controller/factory.js.map +1 -1
  171. package/dist/esm/components/static-asset/controller/index.d.ts +1 -0
  172. package/dist/esm/components/static-asset/controller/index.js +1 -0
  173. package/dist/esm/components/static-asset/controller/index.js.map +1 -1
  174. package/dist/esm/components/static-asset/controller/routes/context.d.ts +62 -0
  175. package/dist/esm/components/static-asset/controller/routes/context.js +45 -0
  176. package/dist/esm/components/static-asset/controller/routes/context.js.map +1 -0
  177. package/dist/esm/components/static-asset/controller/routes/definition.d.ts +40 -0
  178. package/dist/esm/components/static-asset/controller/routes/definition.js +83 -0
  179. package/dist/esm/components/static-asset/controller/routes/definition.js.map +1 -0
  180. package/dist/esm/components/static-asset/controller/routes/direct-upload.d.ts +3 -0
  181. package/dist/esm/components/static-asset/controller/routes/direct-upload.js +153 -0
  182. package/dist/esm/components/static-asset/controller/routes/direct-upload.js.map +1 -0
  183. package/dist/esm/components/static-asset/controller/routes/labels.d.ts +16 -0
  184. package/dist/esm/components/static-asset/controller/routes/labels.js +19 -0
  185. package/dist/esm/components/static-asset/controller/routes/labels.js.map +1 -0
  186. package/dist/esm/components/static-asset/controller/routes/objects.d.ts +7 -0
  187. package/dist/esm/components/static-asset/controller/routes/objects.js +193 -0
  188. package/dist/esm/components/static-asset/controller/routes/objects.js.map +1 -0
  189. package/dist/esm/components/static-asset/controller/routes/serve.d.ts +29 -0
  190. package/dist/esm/components/static-asset/controller/routes/serve.js +152 -0
  191. package/dist/esm/components/static-asset/controller/routes/serve.js.map +1 -0
  192. package/dist/esm/components/static-asset/controller/routes/table.d.ts +12 -0
  193. package/dist/esm/components/static-asset/controller/routes/table.js +52 -0
  194. package/dist/esm/components/static-asset/controller/routes/table.js.map +1 -0
  195. package/dist/esm/components/static-asset/controller/routes/upload.d.ts +10 -0
  196. package/dist/esm/components/static-asset/controller/routes/upload.js +175 -0
  197. package/dist/esm/components/static-asset/controller/routes/upload.js.map +1 -0
  198. package/dist/esm/components/static-asset/index.d.ts +2 -1
  199. package/dist/esm/components/static-asset/index.js +2 -1
  200. package/dist/esm/components/static-asset/index.js.map +1 -1
  201. package/dist/esm/components/static-asset/models/base.model.d.ts +4 -4
  202. package/dist/esm/components/static-asset/models/base.model.js.map +1 -1
  203. package/dist/esm/components/static-asset/services/commitment.service.d.ts +103 -0
  204. package/dist/esm/components/static-asset/services/commitment.service.js +252 -0
  205. package/dist/esm/components/static-asset/services/commitment.service.js.map +1 -0
  206. package/dist/esm/components/static-asset/services/index.d.ts +3 -0
  207. package/dist/esm/components/static-asset/services/index.js +3 -0
  208. package/dist/esm/components/static-asset/services/index.js.map +1 -0
  209. package/dist/esm/components/static-asset/services/policy.service.d.ts +45 -0
  210. package/dist/esm/components/static-asset/services/policy.service.js +104 -0
  211. package/dist/esm/components/static-asset/services/policy.service.js.map +1 -0
  212. package/dist/esm/components/static-asset/utilities/commit-token.utility.d.ts +28 -0
  213. package/dist/esm/components/static-asset/utilities/commit-token.utility.js +112 -0
  214. package/dist/esm/components/static-asset/utilities/commit-token.utility.js.map +1 -0
  215. package/dist/esm/components/static-asset/utilities/entry.utility.d.ts +69 -0
  216. package/dist/esm/components/static-asset/utilities/entry.utility.js +160 -0
  217. package/dist/esm/components/static-asset/utilities/entry.utility.js.map +1 -0
  218. package/dist/esm/components/static-asset/utilities/index.d.ts +6 -0
  219. package/dist/esm/components/static-asset/utilities/index.js +6 -0
  220. package/dist/esm/components/static-asset/utilities/index.js.map +1 -0
  221. package/dist/esm/components/static-asset/{ingest.d.ts → utilities/ingest.utility.d.ts} +8 -8
  222. package/dist/esm/components/static-asset/{ingest.js → utilities/ingest.utility.js} +21 -23
  223. package/dist/esm/components/static-asset/utilities/ingest.utility.js.map +1 -0
  224. package/dist/esm/components/static-asset/{controller/key-scope.d.ts → utilities/key-scope.utility.d.ts} +21 -2
  225. package/dist/esm/components/static-asset/utilities/key-scope.utility.js +74 -0
  226. package/dist/esm/components/static-asset/utilities/key-scope.utility.js.map +1 -0
  227. package/dist/esm/components/static-asset/{controller/meta-link.d.ts → utilities/meta-link.utility.d.ts} +9 -9
  228. package/dist/esm/components/static-asset/{controller/meta-link.js → utilities/meta-link.utility.js} +10 -10
  229. package/dist/esm/components/static-asset/utilities/meta-link.utility.js.map +1 -0
  230. package/dist/esm/components/static-asset/utilities/object-link.utility.d.ts +16 -0
  231. package/dist/esm/components/static-asset/utilities/object-link.utility.js +20 -0
  232. package/dist/esm/components/static-asset/utilities/object-link.utility.js.map +1 -0
  233. package/dist/esm/components/static-asset/utilities/pinned-file.utility.d.ts +39 -0
  234. package/dist/esm/components/static-asset/utilities/pinned-file.utility.js +53 -0
  235. package/dist/esm/components/static-asset/utilities/pinned-file.utility.js.map +1 -0
  236. package/dist/esm/components/static-asset/utilities/route-options.utility.d.ts +43 -0
  237. package/dist/esm/components/static-asset/utilities/route-options.utility.js +71 -0
  238. package/dist/esm/components/static-asset/utilities/route-options.utility.js.map +1 -0
  239. package/dist/esm/components/static-asset/utilities/toggle.utility.d.ts +5 -0
  240. package/dist/esm/components/static-asset/utilities/toggle.utility.js +5 -0
  241. package/dist/esm/components/static-asset/utilities/toggle.utility.js.map +1 -0
  242. package/dist/esm/components/websocket/common/keys.d.ts +12 -10
  243. package/dist/esm/components/websocket/common/keys.js +31 -10
  244. package/dist/esm/components/websocket/common/keys.js.map +1 -1
  245. package/dist/esm/components/websocket/component.js.map +1 -1
  246. package/dist/esm/testing/assert-application-boots.d.ts +2 -2
  247. package/dist/esm/testing/assert-application-boots.js +6 -2
  248. package/dist/esm/testing/assert-application-boots.js.map +1 -1
  249. package/dist/presets/app/preset.json +4 -4
  250. package/dist/presets/lib/preset.json +3 -3
  251. package/dist/presets/shared/preset.json +1 -1
  252. package/package.json +8 -8
  253. package/dist/esm/components/static-asset/common/commit-token.d.ts +0 -28
  254. package/dist/esm/components/static-asset/common/commit-token.js +0 -48
  255. package/dist/esm/components/static-asset/common/commit-token.js.map +0 -1
  256. package/dist/esm/components/static-asset/controller/base.definition.d.ts +0 -30
  257. package/dist/esm/components/static-asset/controller/base.definition.js +0 -307
  258. package/dist/esm/components/static-asset/controller/base.definition.js.map +0 -1
  259. package/dist/esm/components/static-asset/controller/key-scope.js +0 -41
  260. package/dist/esm/components/static-asset/controller/key-scope.js.map +0 -1
  261. package/dist/esm/components/static-asset/controller/meta-link.js.map +0 -1
  262. package/dist/esm/components/static-asset/controller/route-options.d.ts +0 -29
  263. package/dist/esm/components/static-asset/controller/route-options.js +0 -47
  264. package/dist/esm/components/static-asset/controller/route-options.js.map +0 -1
  265. package/dist/esm/components/static-asset/ingest.js.map +0 -1
@@ -14,16 +14,16 @@ var RequestTrackerComponent_1;
14
14
  import { BaseComponent } from '@venizia/ignis-kernel';
15
15
  import { inject } from '../../base/metadata/index.js';
16
16
  import { RequestSpyMiddleware } from '../../base/middlewares/index.js';
17
- import { BindingNamespaces, CoreBindings } from '@venizia/ignis-kernel';
17
+ import { BindingKeys, BindingNamespaces, CoreBindings } from '@venizia/ignis-kernel';
18
18
  import { Binding, BindingScopes } from '@venizia/ignis-kernel';
19
19
  import { getError } from '@venizia/ignis-helpers/core';
20
20
  /** Installs the request spy middleware on the application server, which tracks each request. */
21
21
  let RequestTrackerComponent = class RequestTrackerComponent extends BaseComponent {
22
22
  static { RequestTrackerComponent_1 = this; }
23
- static { this.REQUEST_TRACKER_MW_BINDING_KEY = [
24
- BindingNamespaces.MIDDLEWARE,
25
- RequestSpyMiddleware.name,
26
- ].join('.'); }
23
+ static { this.REQUEST_TRACKER_MW_BINDING_KEY = BindingKeys.build({
24
+ namespace: BindingNamespaces.MIDDLEWARE,
25
+ key: RequestSpyMiddleware.name,
26
+ }); }
27
27
  constructor(application) {
28
28
  super({
29
29
  scope: RequestTrackerComponent_1.name,
@@ -1 +1 @@
1
- {"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../src/components/request-tracker/component.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,aAAa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,CAAA;;GAP1C,uBAAuB,CAsCnC","sourcesContent":["import { type BaseApplication } from '@/base/applications';\nimport { BaseComponent } from '@venizia/ignis-kernel';\nimport { inject } from '@/base/metadata';\nimport { RequestSpyMiddleware } from '@/base/middlewares';\nimport { BindingNamespaces, CoreBindings } from '@venizia/ignis-kernel';\nimport { Binding, BindingScopes } from '@venizia/ignis-kernel';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport { type ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport { type MiddlewareHandler } from 'hono/types';\n\n/** Installs the request spy middleware on the application server, which tracks each request. */\nexport class RequestTrackerComponent extends BaseComponent {\n static readonly REQUEST_TRACKER_MW_BINDING_KEY = [\n BindingNamespaces.MIDDLEWARE,\n RequestSpyMiddleware.name,\n ].join('.');\n\n constructor(\n @inject({ key: CoreBindings.APPLICATION_INSTANCE }) private application: BaseApplication,\n ) {\n super({\n scope: RequestTrackerComponent.name,\n initDefault: { enable: true, container: application },\n bindings: {\n [RequestTrackerComponent.REQUEST_TRACKER_MW_BINDING_KEY]: Binding.bind({\n key: RequestTrackerComponent.REQUEST_TRACKER_MW_BINDING_KEY,\n })\n .toProvider(RequestSpyMiddleware)\n .setScope(BindingScopes.SINGLETON),\n },\n });\n }\n\n /** No `requestId()` here: the id is installed by `RestApplication.registerDefaultMiddlewares()`, which runs first and uses `RequestIdGenerator`. Same UUID v4 shape hono's own default produces, but hono calls `crypto.randomUUID` unguarded, and a browser leaves that one `undefined` outside a secure context. */\n override binding(): ValueOrPromise<void> {\n const server = this.application.getServer();\n\n const mw = this.application.get<MiddlewareHandler>({\n key: RequestTrackerComponent.REQUEST_TRACKER_MW_BINDING_KEY,\n });\n\n if (!mw) {\n throw getError({\n message: `[RequestTrackerComponent][binding] Invalid middleware to init request tracker | Please check again binding value | key: ${RequestTrackerComponent.REQUEST_TRACKER_MW_BINDING_KEY}`,\n });\n }\n\n server.use(mw);\n }\n}\n"]}
1
+ {"version":3,"file":"component.js","sourceRoot":"","sources":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AE,yBAAuB,CAAC,8BAA8B;SAC5D,CAAC,CAAC;QAEH,IAAI,CAAC,EAAE,EAAE,CAAC;YACR,MAAM,QAAQ,CAAC;gBACb,OAAO,EAAE,2HAA2H,yBAAuB,CAAC,8BAA8B,EAAE;aAC7L,CAAC,CAAC;QACL,CAAC;QAED,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;;AArCU,uBAAuB;IAO/B,WAAA,MAAM,CAAC,EAAE,GAAG,EAAE,YAAY,CAAC,oBAAoB,EAAE,CAAC,CAAA;;GAP1C,uBAAuB,CAsCnC","sourcesContent":["import { type BaseApplication } from '@/base/applications';\nimport { BaseComponent } from '@venizia/ignis-kernel';\nimport { inject } from '@/base/metadata';\nimport { RequestSpyMiddleware } from '@/base/middlewares';\nimport { BindingKeys, BindingNamespaces, CoreBindings } from '@venizia/ignis-kernel';\nimport { Binding, BindingScopes } from '@venizia/ignis-kernel';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport { type ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport { type MiddlewareHandler } from 'hono/types';\n\n/** Installs the request spy middleware on the application server, which tracks each request. */\nexport class RequestTrackerComponent extends BaseComponent {\n static readonly REQUEST_TRACKER_MW_BINDING_KEY = BindingKeys.build<MiddlewareHandler>({\n namespace: BindingNamespaces.MIDDLEWARE,\n key: RequestSpyMiddleware.name,\n });\n\n constructor(\n @inject({ key: CoreBindings.APPLICATION_INSTANCE }) private application: BaseApplication,\n ) {\n super({\n scope: RequestTrackerComponent.name,\n initDefault: { enable: true, container: application },\n bindings: {\n [RequestTrackerComponent.REQUEST_TRACKER_MW_BINDING_KEY]: Binding.bind({\n key: RequestTrackerComponent.REQUEST_TRACKER_MW_BINDING_KEY,\n })\n .toProvider(RequestSpyMiddleware)\n .setScope(BindingScopes.SINGLETON),\n },\n });\n }\n\n /** No `requestId()` here: the id is installed by `RestApplication.registerDefaultMiddlewares()`, which runs first and uses `RequestIdGenerator`. Same UUID v4 shape hono's own default produces, but hono calls `crypto.randomUUID` unguarded, and a browser leaves that one `undefined` outside a secure context. */\n override binding(): ValueOrPromise<void> {\n const server = this.application.getServer();\n\n const mw = this.application.get<MiddlewareHandler>({\n key: RequestTrackerComponent.REQUEST_TRACKER_MW_BINDING_KEY,\n });\n\n if (!mw) {\n throw getError({\n message: `[RequestTrackerComponent][binding] Invalid middleware to init request tracker | Please check again binding value | key: ${RequestTrackerComponent.REQUEST_TRACKER_MW_BINDING_KEY}`,\n });\n }\n\n server.use(mw);\n }\n}\n"]}
@@ -1,5 +1,6 @@
1
+ import type { IServerInfoOptions } from './types.js';
1
2
  /** Container keys of the server info component. */
2
3
  export declare class ServerInfoBindingKeys {
3
- static readonly SERVER_INFO_OPTIONS = "@app/server-info/options";
4
+ static readonly SERVER_INFO_OPTIONS: import("@venizia/ignis-inversion").TBindingKey<IServerInfoOptions>;
4
5
  }
5
6
  //# sourceMappingURL=keys.d.ts.map
@@ -1,5 +1,8 @@
1
+ import { BindingKeys } from '@venizia/ignis-inversion';
1
2
  /** Container keys of the server info component. */
2
3
  export class ServerInfoBindingKeys {
3
- static { this.SERVER_INFO_OPTIONS = '@app/server-info/options'; }
4
+ static { this.SERVER_INFO_OPTIONS = BindingKeys.build({
5
+ key: '@app/server-info/options',
6
+ }); }
4
7
  }
5
8
  //# sourceMappingURL=keys.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../../../src/components/server-info/common/keys.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,MAAM,OAAO,qBAAqB;aAChB,wBAAmB,GAAG,0BAA0B,CAAC","sourcesContent":["/** Container keys of the server info component. */\nexport class ServerInfoBindingKeys {\n static readonly SERVER_INFO_OPTIONS = '@app/server-info/options';\n}\n"]}
1
+ {"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../../../src/components/server-info/common/keys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,mDAAmD;AACnD,MAAM,OAAO,qBAAqB;aAChB,wBAAmB,GAAG,WAAW,CAAC,KAAK,CAAqB;QAC1E,GAAG,EAAE,0BAA0B;KAChC,CAAC,CAAC","sourcesContent":["import { BindingKeys } from '@venizia/ignis-inversion';\nimport type { IServerInfoOptions } from './types';\n\n/** Container keys of the server info component. */\nexport class ServerInfoBindingKeys {\n static readonly SERVER_INFO_OPTIONS = BindingKeys.build<IServerInfoOptions>({\n key: '@app/server-info/options',\n });\n}\n"]}
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * export const bindServerInfo = (application: BaseApplication) => {
9
9
  * application
10
- * .bind<IServerInfoOptions>({ key: ServerInfoBindingKeys.SERVER_INFO_OPTIONS })
10
+ * .bind({ key: ServerInfoBindingKeys.SERVER_INFO_OPTIONS })
11
11
  * .toValue({ restOptions: { path: '/clock' } });
12
12
  * };
13
13
  * ```
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/components/server-info/common/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Options of `ServerInfoComponent`, bound at `ServerInfoBindingKeys.SERVER_INFO_OPTIONS`.\n *\n * @example\n * ```typescript\n * import { ServerInfoBindingKeys, type BaseApplication, type IServerInfoOptions } from '@venizia/ignis';\n *\n * export const bindServerInfo = (application: BaseApplication) => {\n * application\n * .bind<IServerInfoOptions>({ key: ServerInfoBindingKeys.SERVER_INFO_OPTIONS })\n * .toValue({ restOptions: { path: '/clock' } });\n * };\n * ```\n */\nexport interface IServerInfoOptions {\n /** Partially-filled bindings are accepted; every missing field falls back to its default. */\n restOptions?: {\n /**\n * Base path the server info routes mount under. The routes are public by design.\n *\n * @default '/server/info'\n */\n path?: string;\n };\n}\n\n/**\n * Body of `GET <path>/time`. Every field comes from ONE captured instant, so they never disagree.\n *\n * @example\n * ```json\n * {\n * \"server\": {\n * \"date\": \"2026-11-10\",\n * \"time\": \"15:00:00.123\",\n * \"epoch\": 1794297600123,\n * \"iso\": \"2026-11-10T15:00:00.123+07:00\"\n * },\n * \"tz\": \"Asia/Ho_Chi_Minh\",\n * \"utc\": { \"offset\": \"+07:00\", \"minutes\": 420, \"iso\": \"2026-11-10T08:00:00.123Z\" }\n * }\n * ```\n */\nexport interface IServerTime {\n server: {\n /** Calendar date in the server time zone, `YYYY-MM-DD`. */\n date: string;\n /** Wall-clock time in the server time zone, `HH:mm:ss.SSS`. */\n time: string;\n /** Milliseconds since 1970-01-01T00:00:00Z (`Date.now()`). Compute clock skew from this field. */\n epoch: number;\n /** `date`, `time` and `utc.offset` joined as ISO-8601, e.g. `2026-11-10T15:00:00.123+07:00`. */\n iso: string;\n };\n /** IANA time zone the server process resolved, e.g. `Asia/Ho_Chi_Minh`. */\n tz: string;\n utc: {\n /** Offset of `tz` from UTC at response time, `+07:00` style. */\n offset: string;\n /**\n * The same offset in minutes, POSITIVE east of UTC (`420` for `+07:00`). This is the opposite\n * sign of JavaScript's `Date.prototype.getTimezoneOffset()`.\n */\n minutes: number;\n /** The same instant in UTC, ISO-8601 with milliseconds (`toISOString()`). */\n iso: string;\n };\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/components/server-info/common/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Options of `ServerInfoComponent`, bound at `ServerInfoBindingKeys.SERVER_INFO_OPTIONS`.\n *\n * @example\n * ```typescript\n * import { ServerInfoBindingKeys, type BaseApplication, type IServerInfoOptions } from '@venizia/ignis';\n *\n * export const bindServerInfo = (application: BaseApplication) => {\n * application\n * .bind({ key: ServerInfoBindingKeys.SERVER_INFO_OPTIONS })\n * .toValue({ restOptions: { path: '/clock' } });\n * };\n * ```\n */\nexport interface IServerInfoOptions {\n /** Partially-filled bindings are accepted; every missing field falls back to its default. */\n restOptions?: {\n /**\n * Base path the server info routes mount under. The routes are public by design.\n *\n * @default '/server/info'\n */\n path?: string;\n };\n}\n\n/**\n * Body of `GET <path>/time`. Every field comes from ONE captured instant, so they never disagree.\n *\n * @example\n * ```json\n * {\n * \"server\": {\n * \"date\": \"2026-11-10\",\n * \"time\": \"15:00:00.123\",\n * \"epoch\": 1794297600123,\n * \"iso\": \"2026-11-10T15:00:00.123+07:00\"\n * },\n * \"tz\": \"Asia/Ho_Chi_Minh\",\n * \"utc\": { \"offset\": \"+07:00\", \"minutes\": 420, \"iso\": \"2026-11-10T08:00:00.123Z\" }\n * }\n * ```\n */\nexport interface IServerTime {\n server: {\n /** Calendar date in the server time zone, `YYYY-MM-DD`. */\n date: string;\n /** Wall-clock time in the server time zone, `HH:mm:ss.SSS`. */\n time: string;\n /** Milliseconds since 1970-01-01T00:00:00Z (`Date.now()`). Compute clock skew from this field. */\n epoch: number;\n /** `date`, `time` and `utc.offset` joined as ISO-8601, e.g. `2026-11-10T15:00:00.123+07:00`. */\n iso: string;\n };\n /** IANA time zone the server process resolved, e.g. `Asia/Ho_Chi_Minh`. */\n tz: string;\n utc: {\n /** Offset of `tz` from UTC at response time, `+07:00` style. */\n offset: string;\n /**\n * The same offset in minutes, POSITIVE east of UTC (`420` for `+07:00`). This is the opposite\n * sign of JavaScript's `Date.prototype.getTimezoneOffset()`.\n */\n minutes: number;\n /** The same instant in UTC, ISO-8601 with milliseconds (`toISOString()`). */\n iso: string;\n };\n}\n"]}
@@ -60,9 +60,7 @@ let ServerInfoComponent = ServerInfoComponent_1 = class ServerInfoComponent exte
60
60
  return;
61
61
  }
62
62
  if (opts !== undefined) {
63
- this.application
64
- .bind({ key: ServerInfoBindingKeys.SERVER_INFO_OPTIONS })
65
- .toValue(opts);
63
+ this.application.bind({ key: ServerInfoBindingKeys.SERVER_INFO_OPTIONS }).toValue(opts);
66
64
  }
67
65
  await super.configure(opts);
68
66
  }
@@ -1 +1 @@
1
- {"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../src/components/server-info/component.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC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,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAqB;YACvD,GAAG,EAAE,qBAAqB,CAAC,mBAAmB;YAC9C,UAAU,EAAE,IAAI;SACjB,CAAC,CAAC;QAEH,6FAA6F;QAC7F,MAAM,IAAI,GAAG,OAAO,EAAE,WAAW,EAAE,IAAI,IAAI,iBAAiB,CAAC;QAE7D,6FAA6F;QAC7F,4FAA4F;QAC5F,OAAO,CAAC,QAAQ,CAAC,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,oBAAoB,CAAC,CAAC;QAC/D,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACpD,CAAC;CACF,CAAA;AA9CY,mBAAmB;IAE3B,WAAA,MAAM,CAAC,EAAE,GAAG,EAAE,YAAY,CAAC,oBAAoB,EAAE,CAAC,CAAA;;GAF1C,mBAAmB,CA8C/B","sourcesContent":["import { type BaseApplication } from '@/base/applications';\nimport { controller, inject } from '@/base/metadata';\nimport { BaseComponent, Binding, CoreBindings } from '@venizia/ignis-kernel';\nimport { ServerInfoBindingKeys, type IServerInfoOptions } from './common';\nimport { ServerInfoController } from './controller';\n\nconst DEFAULT_REST_PATH = '/server/info';\nconst DEFAULT_OPTIONS: IServerInfoOptions = {\n restOptions: { path: DEFAULT_REST_PATH },\n};\n\n/**\n * Mounts the server info controller: `GET <path>/time`, public, no authentication.\n *\n * The rule of this component: it carries only data that is safe to publish and does not help an\n * attacker. No version, runtime, pid, memory or environment - those stay in the gated\n * `/health/stats`. It is separate from `HealthCheckComponent` on purpose: operators may lock\n * `/health/*` away, and client features must not depend on it. `/server/info/*` is public by design.\n *\n * @example\n * ```typescript\n * import { BaseApplication, ServerInfoComponent, type IServerInfoOptions } from '@venizia/ignis';\n *\n * abstract class App extends BaseApplication {\n * preConfigure(): void {\n * const options: IServerInfoOptions = { restOptions: { path: '/clock' } };\n * this.component(ServerInfoComponent, { options });\n * }\n * }\n * ```\n */\nexport class ServerInfoComponent extends BaseComponent<IServerInfoOptions> {\n constructor(\n @inject({ key: CoreBindings.APPLICATION_INSTANCE }) private application: BaseApplication,\n ) {\n super({\n scope: ServerInfoComponent.name,\n initDefault: { enable: true, container: application },\n bindings: {\n [ServerInfoBindingKeys.SERVER_INFO_OPTIONS]: Binding.bind<IServerInfoOptions>({\n key: ServerInfoBindingKeys.SERVER_INFO_OPTIONS,\n }).toValue(DEFAULT_OPTIONS),\n },\n });\n }\n\n /** Options given at the call site win over anything bound earlier, as in `HealthCheckComponent`. */\n override async configure(opts?: IServerInfoOptions): Promise<void> {\n // The base short-circuits a second call; binding before that check would swap the options\n // under routes that were already mounted from the first ones.\n if (this.isConfigured) {\n return;\n }\n\n if (opts !== undefined) {\n this.application\n .bind<IServerInfoOptions>({ key: ServerInfoBindingKeys.SERVER_INFO_OPTIONS })\n .toValue(opts);\n }\n\n await super.configure(opts);\n }\n\n override binding(): void {\n const options = this.application.get<IServerInfoOptions>({\n key: ServerInfoBindingKeys.SERVER_INFO_OPTIONS,\n isOptional: true,\n });\n\n // A partially filled options binding (env/config driven) must not take the app down at boot.\n const path = options?.restOptions?.path ?? DEFAULT_REST_PATH;\n\n // `@controller` writes the PATH onto this shared class in the process-wide MetadataRegistry;\n // two applications booted concurrently with different paths would race, as in health-check.\n Reflect.decorate([controller({ path })], ServerInfoController);\n this.application.controller(ServerInfoController);\n }\n}\n"]}
1
+ {"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../src/components/server-info/component.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAA2B,MAAM,UAAU,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD,MAAM,iBAAiB,GAAG,cAAc,CA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7D,6FAA6F;QAC7F,4FAA4F;QAC5F,OAAO,CAAC,QAAQ,CAAC,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,oBAAoB,CAAC,CAAC;QAC/D,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACpD,CAAC;CACF,CAAA;AA5CY,mBAAmB;IAE3B,WAAA,MAAM,CAAC,EAAE,GAAG,EAAE,YAAY,CAAC,oBAAoB,EAAE,CAAC,CAAA;;GAF1C,mBAAmB,CA4C/B","sourcesContent":["import { type BaseApplication } from '@/base/applications';\nimport { controller, inject } from '@/base/metadata';\nimport { BaseComponent, Binding, CoreBindings } from '@venizia/ignis-kernel';\nimport { ServerInfoBindingKeys, type IServerInfoOptions } from './common';\nimport { ServerInfoController } from './controller';\n\nconst DEFAULT_REST_PATH = '/server/info';\nconst DEFAULT_OPTIONS: IServerInfoOptions = {\n restOptions: { path: DEFAULT_REST_PATH },\n};\n\n/**\n * Mounts the server info controller: `GET <path>/time`, public, no authentication.\n *\n * The rule of this component: it carries only data that is safe to publish and does not help an\n * attacker. No version, runtime, pid, memory or environment - those stay in the gated\n * `/health/stats`. It is separate from `HealthCheckComponent` on purpose: operators may lock\n * `/health/*` away, and client features must not depend on it. `/server/info/*` is public by design.\n *\n * @example\n * ```typescript\n * import { BaseApplication, ServerInfoComponent, type IServerInfoOptions } from '@venizia/ignis';\n *\n * abstract class App extends BaseApplication {\n * preConfigure(): void {\n * const options: IServerInfoOptions = { restOptions: { path: '/clock' } };\n * this.component(ServerInfoComponent, { options });\n * }\n * }\n * ```\n */\nexport class ServerInfoComponent extends BaseComponent<IServerInfoOptions> {\n constructor(\n @inject({ key: CoreBindings.APPLICATION_INSTANCE }) private application: BaseApplication,\n ) {\n super({\n scope: ServerInfoComponent.name,\n initDefault: { enable: true, container: application },\n bindings: {\n [ServerInfoBindingKeys.SERVER_INFO_OPTIONS]: Binding.bind({\n key: ServerInfoBindingKeys.SERVER_INFO_OPTIONS,\n }).toValue(DEFAULT_OPTIONS),\n },\n });\n }\n\n /** Options given at the call site win over anything bound earlier, as in `HealthCheckComponent`. */\n override async configure(opts?: IServerInfoOptions): Promise<void> {\n // The base short-circuits a second call; binding before that check would swap the options\n // under routes that were already mounted from the first ones.\n if (this.isConfigured) {\n return;\n }\n\n if (opts !== undefined) {\n this.application.bind({ key: ServerInfoBindingKeys.SERVER_INFO_OPTIONS }).toValue(opts);\n }\n\n await super.configure(opts);\n }\n\n override binding(): void {\n const options = this.application.get({\n key: ServerInfoBindingKeys.SERVER_INFO_OPTIONS,\n isOptional: true,\n });\n\n // A partially filled options binding (env/config driven) must not take the app down at boot.\n const path = options?.restOptions?.path ?? DEFAULT_REST_PATH;\n\n // `@controller` writes the PATH onto this shared class in the process-wide MetadataRegistry;\n // two applications booted concurrently with different paths would race, as in health-check.\n Reflect.decorate([controller({ path })], ServerInfoController);\n this.application.controller(ServerInfoController);\n }\n}\n"]}
@@ -1,10 +1,13 @@
1
+ import type { AbstractRedisHelper } from '@venizia/ignis-helpers';
2
+ import type { SocketIOServerHelper, TSocketIOAuthenticateFn, TSocketIOClientConnectedFn, TSocketIOValidateRoomFn } from '@venizia/ignis-helpers/socket-io';
3
+ import type { ServerOptions } from 'socket.io';
1
4
  /** Container keys of the Socket.IO component: the server instance, its options, the Redis connection and the handlers an application binds. */
2
5
  export declare class SocketIOBindingKeys {
3
- static readonly SOCKET_IO_INSTANCE = "@app/socket-io/instance";
4
- static readonly SERVER_OPTIONS = "@app/socket-io/server-options";
5
- static readonly REDIS_CONNECTION = "@app/socket-io/redis-connection";
6
- static readonly AUTHENTICATE_HANDLER = "@app/socket-io/authenticate-handler";
7
- static readonly VALIDATE_ROOM_HANDLER = "@app/socket-io/validate-room-handler";
8
- static readonly CLIENT_CONNECTED_HANDLER = "@app/socket-io/client-connected-handler";
6
+ static readonly SOCKET_IO_INSTANCE: import("@venizia/ignis-inversion").TBindingKey<SocketIOServerHelper>;
7
+ static readonly SERVER_OPTIONS: import("@venizia/ignis-inversion").TBindingKey<Partial<ServerOptions>>;
8
+ static readonly REDIS_CONNECTION: import("@venizia/ignis-inversion").TBindingKey<AbstractRedisHelper<import("@venizia/ignis-helpers").TRedisClient> | null>;
9
+ static readonly AUTHENTICATE_HANDLER: import("@venizia/ignis-inversion").TBindingKey<TSocketIOAuthenticateFn | null>;
10
+ static readonly VALIDATE_ROOM_HANDLER: import("@venizia/ignis-inversion").TBindingKey<TSocketIOValidateRoomFn | null>;
11
+ static readonly CLIENT_CONNECTED_HANDLER: import("@venizia/ignis-inversion").TBindingKey<TSocketIOClientConnectedFn | null>;
9
12
  }
10
13
  //# sourceMappingURL=keys.d.ts.map
@@ -1,10 +1,23 @@
1
+ import { BindingKeys } from '@venizia/ignis-inversion';
1
2
  /** Container keys of the Socket.IO component: the server instance, its options, the Redis connection and the handlers an application binds. */
2
3
  export class SocketIOBindingKeys {
3
- static { this.SOCKET_IO_INSTANCE = '@app/socket-io/instance'; }
4
- static { this.SERVER_OPTIONS = '@app/socket-io/server-options'; }
5
- static { this.REDIS_CONNECTION = '@app/socket-io/redis-connection'; }
6
- static { this.AUTHENTICATE_HANDLER = '@app/socket-io/authenticate-handler'; }
7
- static { this.VALIDATE_ROOM_HANDLER = '@app/socket-io/validate-room-handler'; }
8
- static { this.CLIENT_CONNECTED_HANDLER = '@app/socket-io/client-connected-handler'; }
4
+ static { this.SOCKET_IO_INSTANCE = BindingKeys.build({
5
+ key: '@app/socket-io/instance',
6
+ }); }
7
+ static { this.SERVER_OPTIONS = BindingKeys.build({
8
+ key: '@app/socket-io/server-options',
9
+ }); }
10
+ static { this.REDIS_CONNECTION = BindingKeys.build({
11
+ key: '@app/socket-io/redis-connection',
12
+ }); }
13
+ static { this.AUTHENTICATE_HANDLER = BindingKeys.build({
14
+ key: '@app/socket-io/authenticate-handler',
15
+ }); }
16
+ static { this.VALIDATE_ROOM_HANDLER = BindingKeys.build({
17
+ key: '@app/socket-io/validate-room-handler',
18
+ }); }
19
+ static { this.CLIENT_CONNECTED_HANDLER = BindingKeys.build({
20
+ key: '@app/socket-io/client-connected-handler',
21
+ }); }
9
22
  }
10
23
  //# sourceMappingURL=keys.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../../../src/components/socket-io/common/keys.ts"],"names":[],"mappings":"AAAA,+IAA+I;AAC/I,MAAM,OAAO,mBAAmB;aACd,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","sourcesContent":["/** Container keys of the Socket.IO component: the server instance, its options, the Redis connection and the handlers an application binds. */\nexport class SocketIOBindingKeys {\n static readonly SOCKET_IO_INSTANCE = '@app/socket-io/instance';\n\n static readonly SERVER_OPTIONS = '@app/socket-io/server-options';\n static readonly REDIS_CONNECTION = '@app/socket-io/redis-connection';\n\n static readonly AUTHENTICATE_HANDLER = '@app/socket-io/authenticate-handler';\n static readonly VALIDATE_ROOM_HANDLER = '@app/socket-io/validate-room-handler';\n static readonly CLIENT_CONNECTED_HANDLER = '@app/socket-io/client-connected-handler';\n}\n"]}
1
+ {"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../../../src/components/socket-io/common/keys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAUvD,+IAA+I;AAC/I,MAAM,OAAO,mBAAmB;aACd,uBAAkB,GAAG,WAAW,CAAC,KAAK,CAAuB;QAC3E,GAAG,EAAE,yBAAyB;KAC/B,CAAC,CAAC;aAEa,mBAAc,GAAG,WAAW,CAAC,KAAK,CAAyB;QACzE,GAAG,EAAE,+BAA+B;KACrC,CAAC,CAAC;aAEa,qBAAgB,GAAG,WAAW,CAAC,KAAK,CAA6B;QAC/E,GAAG,EAAE,iCAAiC;KACvC,CAAC,CAAC;aAEa,yBAAoB,GAAG,WAAW,CAAC,KAAK,CAAiC;QACvF,GAAG,EAAE,qCAAqC;KAC3C,CAAC,CAAC;aAEa,0BAAqB,GAAG,WAAW,CAAC,KAAK,CAAiC;QACxF,GAAG,EAAE,sCAAsC;KAC5C,CAAC,CAAC;aAEa,6BAAwB,GAAG,WAAW,CAAC,KAAK,CAAoC;QAC9F,GAAG,EAAE,yCAAyC;KAC/C,CAAC,CAAC","sourcesContent":["import { BindingKeys } from '@venizia/ignis-inversion';\nimport type { AbstractRedisHelper } from '@venizia/ignis-helpers';\nimport type {\n SocketIOServerHelper,\n TSocketIOAuthenticateFn,\n TSocketIOClientConnectedFn,\n TSocketIOValidateRoomFn,\n} from '@venizia/ignis-helpers/socket-io';\nimport type { ServerOptions } from 'socket.io';\n\n/** Container keys of the Socket.IO component: the server instance, its options, the Redis connection and the handlers an application binds. */\nexport class SocketIOBindingKeys {\n static readonly SOCKET_IO_INSTANCE = BindingKeys.build<SocketIOServerHelper>({\n key: '@app/socket-io/instance',\n });\n\n static readonly SERVER_OPTIONS = BindingKeys.build<Partial<ServerOptions>>({\n key: '@app/socket-io/server-options',\n });\n\n static readonly REDIS_CONNECTION = BindingKeys.build<AbstractRedisHelper | null>({\n key: '@app/socket-io/redis-connection',\n });\n\n static readonly AUTHENTICATE_HANDLER = BindingKeys.build<TSocketIOAuthenticateFn | null>({\n key: '@app/socket-io/authenticate-handler',\n });\n\n static readonly VALIDATE_ROOM_HANDLER = BindingKeys.build<TSocketIOValidateRoomFn | null>({\n key: '@app/socket-io/validate-room-handler',\n });\n\n static readonly CLIENT_CONNECTED_HANDLER = BindingKeys.build<TSocketIOClientConnectedFn | null>({\n key: '@app/socket-io/client-connected-handler',\n });\n}\n"]}
@@ -18,7 +18,7 @@ import { Binding } from '@venizia/ignis-kernel';
18
18
  import { getError } from '@venizia/ignis-helpers/core';
19
19
  import { HTTP, RuntimeModules } from '@venizia/ignis-helpers/common';
20
20
  import { isRedisHelper } from '@venizia/ignis-helpers';
21
- import { SocketIOServerHelper, } from '@venizia/ignis-helpers/socket-io';
21
+ import { SocketIOServerHelper } from '@venizia/ignis-helpers/socket-io';
22
22
  import { SocketIOBindingKeys, DEFAULT_SERVER_OPTIONS, } from './common/index.js';
23
23
  import { SocketIOBunHandler } from './handlers/index.js';
24
24
  /** Starts a Socket.IO server on Bun after the application starts. Requires a Redis helper at `SocketIOBindingKeys.REDIS_CONNECTION` and an authenticate handler at `AUTHENTICATE_HANDLER`; binding throws without them. */
@@ -1 +1 @@
1
- {"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../src/components/socket-io/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,EAAE,cAAc,EAAuB,MAAM,+BAA+B,CAAC;AAC1F,OAAO,EAA4B,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,EACL,oBAAoB,GAIrB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EACL,mBAAmB,EACnB,sBAAsB,GAGvB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,2NAA2N;AAC3N,IAAa,iBAAiB,yBAA9B,MAAa,iBAAkB,SAAQ,aAAa;IAGlD,YAC8D,WAA4B;QAExF,KAAK,CAAC;YACJ,KAAK,EAAE,mBAAiB,CAAC,IAAI;YAC7B,WAAW,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE;YACrD,QA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AqC,CAAC,CAAC;QAEnD,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;AArIY,iBAAiB;IAIzB,WAAA,MAAM,CAAC,EAAE,GAAG,EAAE,YAAY,CAAC,oBAAoB,EAAE,CAAC,CAAA;;GAJ1C,iBAAiB,CAqI7B","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, RuntimeModules, type ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport { type AbstractRedisHelper, isRedisHelper } from '@venizia/ignis-helpers';\nimport {\n SocketIOServerHelper,\n type TSocketIOAuthenticateFn,\n type TSocketIOClientConnectedFn,\n type TSocketIOValidateRoomFn,\n} from '@venizia/ignis-helpers/socket-io';\nimport type { ServerOptions } from 'socket.io';\nimport {\n SocketIOBindingKeys,\n DEFAULT_SERVER_OPTIONS,\n type IResolvedBindings,\n type IServerOptions,\n} from './common';\nimport { SocketIOBunHandler } from './handlers';\n\n/** Starts a Socket.IO server on Bun after the application starts. Requires a Redis helper at `SocketIOBindingKeys.REDIS_CONNECTION` and an authenticate handler at `AUTHENTICATE_HANDLER`; binding throws without them. */\nexport class SocketIOComponent extends BaseComponent {\n protected serverOptions: Partial<IServerOptions>;\n\n constructor(\n @inject({ key: CoreBindings.APPLICATION_INSTANCE }) private application: BaseApplication,\n ) {\n super({\n scope: SocketIOComponent.name,\n initDefault: { enable: true, container: application },\n bindings: {\n [SocketIOBindingKeys.SERVER_OPTIONS]: Binding.bind<Partial<ServerOptions>>({\n key: SocketIOBindingKeys.SERVER_OPTIONS,\n }).toValue(DEFAULT_SERVER_OPTIONS),\n\n [SocketIOBindingKeys.REDIS_CONNECTION]: Binding.bind<AbstractRedisHelper | null>({\n key: SocketIOBindingKeys.REDIS_CONNECTION,\n }).toValue(null),\n\n [SocketIOBindingKeys.AUTHENTICATE_HANDLER]: Binding.bind<TSocketIOAuthenticateFn | null>({\n key: SocketIOBindingKeys.AUTHENTICATE_HANDLER,\n }).toValue(null),\n\n [SocketIOBindingKeys.VALIDATE_ROOM_HANDLER]: Binding.bind<TSocketIOValidateRoomFn | null>({\n key: SocketIOBindingKeys.VALIDATE_ROOM_HANDLER,\n }).toValue(null),\n\n [SocketIOBindingKeys.CLIENT_CONNECTED_HANDLER]:\n Binding.bind<TSocketIOClientConnectedFn | null>({\n key: SocketIOBindingKeys.CLIENT_CONNECTED_HANDLER,\n }).toValue(null),\n },\n });\n }\n\n private resolveBindings(): IResolvedBindings {\n const extraServerOptions =\n this.application.get<Partial<ServerOptions>>({\n key: SocketIOBindingKeys.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: SocketIOBindingKeys.REDIS_CONNECTION,\n });\n\n if (!isRedisHelper(redisConnection)) {\n throw getError({\n message:\n '[SocketIOComponent][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<TSocketIOAuthenticateFn>({\n key: SocketIOBindingKeys.AUTHENTICATE_HANDLER,\n });\n\n if (!authenticateFn) {\n throw getError({\n message: '[DANGER][SocketIOComponent] Invalid authenticateFn to setup io socket server!',\n });\n }\n\n const validateRoomFn =\n this.application.get<TSocketIOValidateRoomFn | null>({\n key: SocketIOBindingKeys.VALIDATE_ROOM_HANDLER,\n }) ?? undefined;\n\n const clientConnectedFn =\n this.application.get<TSocketIOClientConnectedFn | null>({\n key: SocketIOBindingKeys.CLIENT_CONNECTED_HANDLER,\n }) ?? undefined;\n\n return { redisConnection, authenticateFn, validateRoomFn, clientConnectedFn };\n }\n\n private registerBunHook(opts: IResolvedBindings) {\n const { redisConnection, authenticateFn, validateRoomFn, clientConnectedFn } = opts;\n const serverOptions = this.serverOptions;\n const logger = this.logger.for(this.registerBunHook.name);\n\n this.application.registerPostStartHook({\n identifier: 'socket-io-initialize',\n hook: async () => {\n const { engine, engineHandler } = await SocketIOBunHandler.createEngine({ serverOptions });\n\n const socketIOHelper = new SocketIOServerHelper({\n runtime: RuntimeModules.BUN,\n identifier: serverOptions.identifier!,\n engine,\n serverOptions,\n redisConnection,\n authenticateFn,\n validateRoomFn,\n clientConnectedFn,\n });\n await socketIOHelper.configure();\n\n this.application\n .bind({ key: SocketIOBindingKeys.SOCKET_IO_INSTANCE })\n .toValue(socketIOHelper);\n\n const serverInstance = this.application.getServerInstance<TBunServerInstance>();\n const honoServer = this.application.getServer();\n const enginePath = serverOptions.path ?? '/socket.io/';\n\n serverInstance!.reload({\n fetch: SocketIOBunHandler.createFetchHandler({ engine, enginePath, honoServer }),\n websocket: engineHandler.websocket,\n });\n\n logger.info('SocketIO 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 SocketIOComponent',\n });\n }\n\n logger.info('Binding SocketIO for application...');\n\n const resolved = this.resolveBindings();\n logger.debug('Socket.IO Server Options: %j', this.serverOptions);\n\n this.registerBunHook(resolved);\n }\n}\n"]}
1
+ {"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../src/components/socket-io/component.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,MAAM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,CAAC;gBAChD,MAAM,UAAU,GAAG,aAAa,CAAC,IAAI,IAAI,aAAa,CAAC;gBAEvD,cAAe,CAAC,MAAM,CAAC;oBACrB,KAAK,EAAE,kBAAkB,CAAC,kBAAkB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;oBAChF,SAAS,EAAE,aAAa,CAAC,SAAS;iBACnC,CAAC,CAAC;gBAEH,MAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;YACtD,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,yDAAyD;aACnE,CAAC,CAAC;QACL,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;QAEnD,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;AApIY,iBAAiB;IAIzB,WAAA,MAAM,CAAC,EAAE,GAAG,EAAE,YAAY,CAAC,oBAAoB,EAAE,CAAC,CAAA;;GAJ1C,iBAAiB,CAoI7B","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, RuntimeModules, type ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport { isRedisHelper } from '@venizia/ignis-helpers';\nimport { SocketIOServerHelper } from '@venizia/ignis-helpers/socket-io';\nimport {\n SocketIOBindingKeys,\n DEFAULT_SERVER_OPTIONS,\n type IResolvedBindings,\n type IServerOptions,\n} from './common';\nimport { SocketIOBunHandler } from './handlers';\n\n/** Starts a Socket.IO server on Bun after the application starts. Requires a Redis helper at `SocketIOBindingKeys.REDIS_CONNECTION` and an authenticate handler at `AUTHENTICATE_HANDLER`; binding throws without them. */\nexport class SocketIOComponent extends BaseComponent {\n protected serverOptions: Partial<IServerOptions>;\n\n constructor(\n @inject({ key: CoreBindings.APPLICATION_INSTANCE }) private application: BaseApplication,\n ) {\n super({\n scope: SocketIOComponent.name,\n initDefault: { enable: true, container: application },\n bindings: {\n [SocketIOBindingKeys.SERVER_OPTIONS]: Binding.bind({\n key: SocketIOBindingKeys.SERVER_OPTIONS,\n }).toValue(DEFAULT_SERVER_OPTIONS),\n\n [SocketIOBindingKeys.REDIS_CONNECTION]: Binding.bind({\n key: SocketIOBindingKeys.REDIS_CONNECTION,\n }).toValue(null),\n\n [SocketIOBindingKeys.AUTHENTICATE_HANDLER]: Binding.bind({\n key: SocketIOBindingKeys.AUTHENTICATE_HANDLER,\n }).toValue(null),\n\n [SocketIOBindingKeys.VALIDATE_ROOM_HANDLER]: Binding.bind({\n key: SocketIOBindingKeys.VALIDATE_ROOM_HANDLER,\n }).toValue(null),\n\n [SocketIOBindingKeys.CLIENT_CONNECTED_HANDLER]: Binding.bind({\n key: SocketIOBindingKeys.CLIENT_CONNECTED_HANDLER,\n }).toValue(null),\n },\n });\n }\n\n private resolveBindings(): IResolvedBindings {\n const extraServerOptions =\n this.application.get({\n key: SocketIOBindingKeys.SERVER_OPTIONS,\n isOptional: true,\n }) ?? {};\n this.serverOptions = Object.assign({}, DEFAULT_SERVER_OPTIONS, extraServerOptions);\n\n const redisConnection = this.application.get({\n key: SocketIOBindingKeys.REDIS_CONNECTION,\n });\n\n if (!isRedisHelper(redisConnection)) {\n throw getError({\n message:\n '[SocketIOComponent][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({\n key: SocketIOBindingKeys.AUTHENTICATE_HANDLER,\n });\n\n if (!authenticateFn) {\n throw getError({\n message: '[DANGER][SocketIOComponent] Invalid authenticateFn to setup io socket server!',\n });\n }\n\n const validateRoomFn =\n this.application.get({\n key: SocketIOBindingKeys.VALIDATE_ROOM_HANDLER,\n }) ?? undefined;\n\n const clientConnectedFn =\n this.application.get({\n key: SocketIOBindingKeys.CLIENT_CONNECTED_HANDLER,\n }) ?? undefined;\n\n return { redisConnection, authenticateFn, validateRoomFn, clientConnectedFn };\n }\n\n private registerBunHook(opts: IResolvedBindings) {\n const { redisConnection, authenticateFn, validateRoomFn, clientConnectedFn } = opts;\n const serverOptions = this.serverOptions;\n const logger = this.logger.for(this.registerBunHook.name);\n\n this.application.registerPostStartHook({\n identifier: 'socket-io-initialize',\n hook: async () => {\n const { engine, engineHandler } = await SocketIOBunHandler.createEngine({ serverOptions });\n\n const socketIOHelper = new SocketIOServerHelper({\n runtime: RuntimeModules.BUN,\n identifier: serverOptions.identifier!,\n engine,\n serverOptions,\n redisConnection,\n authenticateFn,\n validateRoomFn,\n clientConnectedFn,\n });\n await socketIOHelper.configure();\n\n this.application\n .bind({ key: SocketIOBindingKeys.SOCKET_IO_INSTANCE })\n .toValue(socketIOHelper);\n\n const serverInstance = this.application.getServerInstance<TBunServerInstance>();\n const honoServer = this.application.getServer();\n const enginePath = serverOptions.path ?? '/socket.io/';\n\n serverInstance!.reload({\n fetch: SocketIOBunHandler.createFetchHandler({ engine, enginePath, honoServer }),\n websocket: engineHandler.websocket,\n });\n\n logger.info('SocketIO 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 SocketIOComponent',\n });\n }\n\n logger.info('Binding SocketIO for application...');\n\n const resolved = this.resolveBindings();\n logger.debug('Socket.IO Server Options: %j', this.serverOptions);\n\n this.registerBunHook(resolved);\n }\n}\n"]}
@@ -5,11 +5,21 @@ export declare class SocketIOBunHandler {
5
5
  static createEngine(opts: {
6
6
  serverOptions: Partial<ServerOptions>;
7
7
  }): Promise<{
8
- engine: any;
9
- engineHandler: any;
8
+ engine: import("@socket.io/bun-engine").Server;
9
+ engineHandler: {
10
+ fetch: (req: Request, server: Bun.Server<import("@socket.io/bun-engine").WebSocketData>) => Response | Promise<Response>;
11
+ websocket: {
12
+ open: (ws: import("@socket.io/bun-engine").BunWebSocket) => void;
13
+ message: (ws: import("@socket.io/bun-engine").BunWebSocket, message: import("@socket.io/bun-engine").RawData) => void;
14
+ close: (ws: import("@socket.io/bun-engine").BunWebSocket, code: number, message: string) => void;
15
+ maxPayloadLength: number;
16
+ };
17
+ idleTimeout: number;
18
+ maxRequestBodySize: number;
19
+ };
10
20
  }>;
11
21
  static createFetchHandler(opts: {
12
- engine: any;
22
+ engine: Awaited<ReturnType<typeof SocketIOBunHandler.createEngine>>['engine'];
13
23
  enginePath: string;
14
24
  honoServer: OpenAPIHono;
15
25
  }): (req: Request, server: TBunServerInstance) => Response | Promise<Response>;
@@ -1 +1 @@
1
- {"version":3,"file":"bun.handler.js","sourceRoot":"","sources":["../../../../../src/components/socket-io/handlers/bun.handler.ts"],"names":[],"mappings":"AAIA,MAAM,OAAO,kBAAkB;IAC7B,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,IAEzB;QACC,MAAM,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC;QAC/B,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,MAAM,CAAC,uBAAuB,CAAC,CAAC;QAEpE,iFAAiF;QACjF,MAAM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hono/zod-openapi';\nimport type { TBunServerInstance } from '@/base/applications';\nimport type { ServerOptions } from 'socket.io';\n\nexport class SocketIOBunHandler {\n static async createEngine(opts: {\n serverOptions: Partial<ServerOptions>;\n }): Promise<{ engine: any; engineHandler: any }> {\n const { serverOptions } = opts;\n const { Server: BunEngine } = await import('@socket.io/bun-engine');\n\n // Extract cors fields explicitly to bridge socket.io/bun-engine type differences\n const corsConfig = typeof serverOptions.cors === 'object' ? serverOptions.cors : undefined;\n const engine = new BunEngine({\n path: serverOptions.path ?? '/socket.io/',\n ...(corsConfig && {\n cors: {\n origin: corsConfig.origin as string | RegExp | (string | RegExp)[] | undefined,\n methods: corsConfig.methods,\n credentials: corsConfig.credentials,\n allowedHeaders: corsConfig.allowedHeaders,\n exposedHeaders: corsConfig.exposedHeaders,\n maxAge: corsConfig.maxAge,\n },\n }),\n });\n\n const engineHandler = engine.handler();\n\n return { engine, engineHandler };\n }\n\n static createFetchHandler(opts: {\n engine: any;\n enginePath: string;\n honoServer: OpenAPIHono;\n }): (req: Request, server: TBunServerInstance) => Response | Promise<Response> {\n const { engine, enginePath, honoServer } = opts;\n\n return (req: Request, server: TBunServerInstance): Response | Promise<Response> => {\n const url = new URL(req.url);\n\n if (!url.pathname.startsWith(enginePath)) {\n return honoServer.fetch(req, server);\n }\n\n return engine.handleRequest(req, server) ?? new Response(null, { status: 404 });\n };\n }\n}\n"]}
1
+ {"version":3,"file":"bun.handler.js","sourceRoot":"","sources":["../../../../../src/components/socket-io/handlers/bun.handler.ts"],"names":[],"mappings":"AAIA,MAAM,OAAO,kBAAkB;IAC7B,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,IAA+C;QACvE,MAAM,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC;QAC/B,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,MAAM,CAAC,uBAAuB,CAAC,CAAC;QAEpE,iFAAiF;QACjF,MAAM,UAAU,GAAG,OAAO,aAAa,CAAC,IAAI,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applications';\nimport type { ServerOptions } from 'socket.io';\n\nexport class SocketIOBunHandler {\n static async createEngine(opts: { serverOptions: Partial<ServerOptions> }) {\n const { serverOptions } = opts;\n const { Server: BunEngine } = await import('@socket.io/bun-engine');\n\n // Extract cors fields explicitly to bridge socket.io/bun-engine type differences\n const corsConfig = typeof serverOptions.cors === 'object' ? serverOptions.cors : undefined;\n const engine = new BunEngine({\n path: serverOptions.path ?? '/socket.io/',\n ...(corsConfig && {\n cors: {\n origin: corsConfig.origin as string | RegExp | (string | RegExp)[] | undefined,\n methods: corsConfig.methods,\n credentials: corsConfig.credentials,\n allowedHeaders: corsConfig.allowedHeaders,\n exposedHeaders: corsConfig.exposedHeaders,\n maxAge: corsConfig.maxAge,\n },\n }),\n });\n\n const engineHandler = engine.handler();\n\n return { engine, engineHandler };\n }\n\n static createFetchHandler(opts: {\n engine: Awaited<ReturnType<typeof SocketIOBunHandler.createEngine>>['engine'];\n enginePath: string;\n honoServer: OpenAPIHono;\n }): (req: Request, server: TBunServerInstance) => Response | Promise<Response> {\n const { engine, enginePath, honoServer } = opts;\n\n return (req: Request, server: TBunServerInstance): Response | Promise<Response> => {\n const url = new URL(req.url);\n\n if (!url.pathname.startsWith(enginePath)) {\n return honoServer.fetch(req, server);\n }\n\n return engine.handleRequest(req, server) ?? new Response(null, { status: 404 });\n };\n }\n}\n"]}
@@ -1,34 +1,61 @@
1
1
  import type { TConstValue } from '@venizia/ignis-helpers/common';
2
- /** `content-type` is absent on purpose: it is decided from the object name, never from the backend. */
3
- export declare const WHITELIST_HEADERS: readonly ["content-encoding", "cache-control", "etag", "last-modified"];
4
- /**
5
- * Types the controller will let a browser render, keyed off the object name. Anything absent here is
6
- * served as an attachment, because a renderable upload on the API origin is stored XSS - and `nosniff`
7
- * cannot stop a type we declared ourselves. `image/svg+xml` is deliberately excluded: SVG carries script.
8
- */
9
- export declare const RENDERABLE_CONTENT_TYPES: Set<string>;
10
- /** Storage backends a static asset controller can serve from. `isValid` checks a string against them. */
11
- export declare class StaticAssetStorageTypes {
12
- static readonly DISK = "disk";
13
- static readonly BUN_S3 = "bun-s3";
14
- static readonly SCHEME_SET: Set<string>;
15
- static isValid(orgType: string): boolean;
2
+ /** What a controller sends with every object. */
3
+ export declare class StaticAssetHeaders {
4
+ static readonly NOSNIFF = "nosniff";
5
+ static readonly CSP_SANDBOX = "sandbox";
6
+ static readonly RANGE_UNIT: "bytes";
7
+ }
8
+ /** Content types the controller serves. */
9
+ export declare class StaticAssetContentTypes {
10
+ /**
11
+ * Types the controller will let a browser render, keyed off the object name. Anything absent here is
12
+ * served as an attachment, because a renderable upload on the API origin is stored XSS - and `nosniff`
13
+ * cannot stop a type we declared ourselves. `image/svg+xml` is deliberately excluded: SVG carries script.
14
+ */
15
+ static readonly RENDERABLE: Set<string>;
16
+ }
17
+ /** The built-in routes of a generated controller, the keys of `routes`. */
18
+ export declare class StaticAssetRouteKeys {
19
+ static readonly UPLOAD = "upload";
20
+ static readonly LIST_OBJECTS = "listObjects";
21
+ static readonly DELETE_OBJECT = "deleteObject";
22
+ static readonly GET_OBJECT_BY_NAME = "getObjectByName";
23
+ static readonly DOWNLOAD_OBJECT_BY_NAME = "downloadObjectByName";
24
+ static readonly UPLOAD_POLICY = "uploadPolicy";
25
+ static readonly UPLOAD_COMMIT = "uploadCommit";
26
+ static readonly UPLOAD_VALIDATE = "uploadValidate";
27
+ static readonly RECREATE_META_LINK = "recreateMetaLink";
28
+ /** Every key, in registration order. */
29
+ static readonly ALL: readonly ["getObjectByName", "downloadObjectByName", "upload", "deleteObject", "listObjects", "uploadPolicy", "uploadCommit", "uploadValidate", "recreateMetaLink"];
16
30
  }
17
- /** One of the `StaticAssetStorageTypes` values. */
18
- export type TStaticAssetStorageType = TConstValue<typeof StaticAssetStorageTypes>;
19
31
  /** What `recreate-metalink` did: refreshed the rows of an object, or created its first one. */
20
32
  export declare class MetaLinkRecreateActions {
21
33
  static readonly CREATED = "created";
22
34
  static readonly REFRESHED = "refreshed";
23
- static readonly SCHEME_SET: Set<string>;
24
- static isValid(value: string): boolean;
25
35
  }
26
36
  /** One of the `MetaLinkRecreateActions` values. */
27
37
  export type TMetaLinkRecreateAction = TConstValue<typeof MetaLinkRecreateActions>;
28
- /** Where a signed policy may write. The final key is never inside it, so content cannot be replaced after the commit. */
29
- export declare const DEFAULT_PENDING_PREFIX = "pending/";
30
- /** The most file parts one upload request may carry unless `parseMultipartBody.maxFiles` says otherwise. */
31
- export declare const DEFAULT_MAX_UPLOAD_FILES = 20;
32
- /** Reported in the body, never thrown: the bytes are stored, only the row is not. A CODE, because a 200 bypasses the middleware that strips the driver's `detail`/`table`/`constraint`. */
33
- export declare const META_LINK_CREATE_FAILED = "META_LINK_CREATE_FAILED";
38
+ /** Where a commit token is in its life: issued with the policy, then validated against the content it pins. */
39
+ export declare class StaticAssetTokenStages {
40
+ static readonly ISSUED = "issued";
41
+ static readonly VALIDATED = "validated";
42
+ }
43
+ /** One of the `StaticAssetTokenStages` values. */
44
+ export type TStaticAssetTokenStage = TConstValue<typeof StaticAssetTokenStages>;
45
+ /** Defaults of the static asset component. */
46
+ export declare class StaticAssetDefaults {
47
+ /** Where a signed policy may write. The final key is never inside it, so content cannot be replaced after the commit. */
48
+ static readonly PENDING_PREFIX = "pending/";
49
+ /** The most file parts one upload request may carry unless `serverUpload.maxFiles` says otherwise. */
50
+ static readonly MAX_UPLOAD_FILES = 20;
51
+ /** The most bytes of JSON one file's signed `metadata` may take: the token travels in every request. */
52
+ static readonly MAX_TOKEN_METADATA_BYTES = 1024;
53
+ /** The key of the application's token metadata inside a MetaLink row's `metadata` column. */
54
+ static readonly META_LINK_METADATA_KEY = "app";
55
+ }
56
+ /** Codes the component reports in a body instead of throwing. */
57
+ export declare class StaticAssetMetaLinkCodes {
58
+ /** Reported in the body, never thrown: the bytes are stored, only the row is not. A CODE, because a 200 bypasses the middleware that strips the driver's `detail`/`table`/`constraint`. */
59
+ static readonly CREATE_FAILED = "META_LINK_CREATE_FAILED";
60
+ }
34
61
  //# sourceMappingURL=constants.d.ts.map
@@ -1,55 +1,83 @@
1
1
  import { HTTP } from '@venizia/ignis-helpers/common';
2
- /** `content-type` is absent on purpose: it is decided from the object name, never from the backend. */
3
- export const WHITELIST_HEADERS = [
4
- HTTP.Headers.CONTENT_ENCODING,
5
- HTTP.Headers.CACHE_CONTROL,
6
- HTTP.Headers.ETAG,
7
- HTTP.Headers.LAST_MODIFIED,
8
- ];
9
- /**
10
- * Types the controller will let a browser render, keyed off the object name. Anything absent here is
11
- * served as an attachment, because a renderable upload on the API origin is stored XSS - and `nosniff`
12
- * cannot stop a type we declared ourselves. `image/svg+xml` is deliberately excluded: SVG carries script.
13
- */
14
- export const RENDERABLE_CONTENT_TYPES = new Set([
15
- 'image/png',
16
- 'image/jpeg',
17
- 'image/gif',
18
- 'image/webp',
19
- 'image/avif',
20
- 'image/bmp',
21
- 'image/x-icon',
22
- 'video/mp4',
23
- 'video/webm',
24
- 'audio/mpeg',
25
- 'audio/wav',
26
- 'audio/ogg',
27
- 'application/pdf',
28
- 'text/plain',
29
- 'text/csv',
30
- ]);
31
- /** Storage backends a static asset controller can serve from. `isValid` checks a string against them. */
32
- export class StaticAssetStorageTypes {
33
- static { this.DISK = 'disk'; }
34
- static { this.BUN_S3 = 'bun-s3'; }
35
- static { this.SCHEME_SET = new Set([this.DISK, this.BUN_S3]); }
36
- static isValid(orgType) {
37
- return this.SCHEME_SET.has(orgType);
38
- }
2
+ /** What a controller sends with every object. */
3
+ export class StaticAssetHeaders {
4
+ static { this.NOSNIFF = 'nosniff'; }
5
+ static { this.CSP_SANDBOX = 'sandbox'; }
6
+ static { this.RANGE_UNIT = HTTP.HeaderValues.RANGE_UNIT_BYTES; }
7
+ }
8
+ /** Content types the controller serves. */
9
+ export class StaticAssetContentTypes {
10
+ /**
11
+ * Types the controller will let a browser render, keyed off the object name. Anything absent here is
12
+ * served as an attachment, because a renderable upload on the API origin is stored XSS - and `nosniff`
13
+ * cannot stop a type we declared ourselves. `image/svg+xml` is deliberately excluded: SVG carries script.
14
+ */
15
+ static { this.RENDERABLE = new Set([
16
+ HTTP.HeaderValues.IMAGE_PNG,
17
+ HTTP.HeaderValues.IMAGE_JPEG,
18
+ HTTP.HeaderValues.IMAGE_GIF,
19
+ HTTP.HeaderValues.IMAGE_WEBP,
20
+ 'image/avif',
21
+ 'image/bmp',
22
+ 'image/x-icon',
23
+ 'video/mp4',
24
+ 'video/webm',
25
+ 'audio/mpeg',
26
+ 'audio/wav',
27
+ 'audio/ogg',
28
+ HTTP.HeaderValues.APPLICATION_PDF,
29
+ HTTP.HeaderValues.TEXT_PLAIN,
30
+ HTTP.HeaderValues.TEXT_CSV,
31
+ ]); }
32
+ }
33
+ /** The built-in routes of a generated controller, the keys of `routes`. */
34
+ export class StaticAssetRouteKeys {
35
+ static { this.UPLOAD = 'upload'; }
36
+ static { this.LIST_OBJECTS = 'listObjects'; }
37
+ static { this.DELETE_OBJECT = 'deleteObject'; }
38
+ static { this.GET_OBJECT_BY_NAME = 'getObjectByName'; }
39
+ static { this.DOWNLOAD_OBJECT_BY_NAME = 'downloadObjectByName'; }
40
+ static { this.UPLOAD_POLICY = 'uploadPolicy'; }
41
+ static { this.UPLOAD_COMMIT = 'uploadCommit'; }
42
+ static { this.UPLOAD_VALIDATE = 'uploadValidate'; }
43
+ static { this.RECREATE_META_LINK = 'recreateMetaLink'; }
44
+ /** Every key, in registration order. */
45
+ static { this.ALL = [
46
+ StaticAssetRouteKeys.GET_OBJECT_BY_NAME,
47
+ StaticAssetRouteKeys.DOWNLOAD_OBJECT_BY_NAME,
48
+ StaticAssetRouteKeys.UPLOAD,
49
+ StaticAssetRouteKeys.DELETE_OBJECT,
50
+ StaticAssetRouteKeys.LIST_OBJECTS,
51
+ StaticAssetRouteKeys.UPLOAD_POLICY,
52
+ StaticAssetRouteKeys.UPLOAD_COMMIT,
53
+ StaticAssetRouteKeys.UPLOAD_VALIDATE,
54
+ StaticAssetRouteKeys.RECREATE_META_LINK,
55
+ ]; }
39
56
  }
40
57
  /** What `recreate-metalink` did: refreshed the rows of an object, or created its first one. */
41
58
  export class MetaLinkRecreateActions {
42
59
  static { this.CREATED = 'created'; }
43
60
  static { this.REFRESHED = 'refreshed'; }
44
- static { this.SCHEME_SET = new Set([this.CREATED, this.REFRESHED]); }
45
- static isValid(value) {
46
- return this.SCHEME_SET.has(value);
47
- }
48
61
  }
49
- /** Where a signed policy may write. The final key is never inside it, so content cannot be replaced after the commit. */
50
- export const DEFAULT_PENDING_PREFIX = 'pending/';
51
- /** The most file parts one upload request may carry unless `parseMultipartBody.maxFiles` says otherwise. */
52
- export const DEFAULT_MAX_UPLOAD_FILES = 20;
53
- /** Reported in the body, never thrown: the bytes are stored, only the row is not. A CODE, because a 200 bypasses the middleware that strips the driver's `detail`/`table`/`constraint`. */
54
- export const META_LINK_CREATE_FAILED = 'META_LINK_CREATE_FAILED';
62
+ /** Where a commit token is in its life: issued with the policy, then validated against the content it pins. */
63
+ export class StaticAssetTokenStages {
64
+ static { this.ISSUED = 'issued'; }
65
+ static { this.VALIDATED = 'validated'; }
66
+ }
67
+ /** Defaults of the static asset component. */
68
+ export class StaticAssetDefaults {
69
+ /** Where a signed policy may write. The final key is never inside it, so content cannot be replaced after the commit. */
70
+ static { this.PENDING_PREFIX = 'pending/'; }
71
+ /** The most file parts one upload request may carry unless `serverUpload.maxFiles` says otherwise. */
72
+ static { this.MAX_UPLOAD_FILES = 20; }
73
+ /** The most bytes of JSON one file's signed `metadata` may take: the token travels in every request. */
74
+ static { this.MAX_TOKEN_METADATA_BYTES = 1024; }
75
+ /** The key of the application's token metadata inside a MetaLink row's `metadata` column. */
76
+ static { this.META_LINK_METADATA_KEY = 'app'; }
77
+ }
78
+ /** Codes the component reports in a body instead of throwing. */
79
+ export class StaticAssetMetaLinkCodes {
80
+ /** Reported in the body, never thrown: the bytes are stored, only the row is not. A CODE, because a 200 bypasses the middleware that strips the driver's `detail`/`table`/`constraint`. */
81
+ static { this.CREATE_FAILED = 'META_LINK_CREATE_FAILED'; }
82
+ }
55
83
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/components/static-asset/common/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAErD,uGAAuG;AACvG,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,IAAI,CAAC,OAAO,CAAC,gBAAgB;IAC7B,IAAI,CAAC,OAAO,CAAC,aAAa;IAC1B,IAAI,CAAC,OAAO,CAAC,IAAI;IACjB,IAAI,CAAC,OAAO,CAAC,aAAa;CAClB,CAAC;AAEX;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,GAAG,CAAS;IACtD,WAAW;IACX,YAAY;IACZ,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,WAAW;IACX,cAAc;IACd,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,WAAW;IACX,WAAW;IACX,iBAAiB;IACjB,YAAY;IACZ,UAAU;CACX,CAAC,CAAC;AAEH,yGAAyG;AACzG,MAAM,OAAO,uBAAuB;aAClB,SAAI,GAAG,MAAM,CAAC;aACd,WAAM,GAAG,QAAQ,CAAC;aAElB,eAAU,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAE/D,MAAM,CAAC,OAAO,CAAC,OAAe;QAC5B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;;AAMH,+FAA+F;AAC/F,MAAM,OAAO,uBAAuB;aAClB,YAAO,GAAG,SAAS,CAAC;aACpB,cAAS,GAAG,WAAW,CAAC;aAExB,eAAU,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IAErE,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAMH,yHAAyH;AACzH,MAAM,CAAC,MAAM,sBAAsB,GAAG,UAAU,CAAC;AAEjD,4GAA4G;AAC5G,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAE3C,2LAA2L;AAC3L,MAAM,CAAC,MAAM,uBAAuB,GAAG,yBAAyB,CAAC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\nimport { HTTP } from '@venizia/ignis-helpers/common';\n\n/** `content-type` is absent on purpose: it is decided from the object name, never from the backend. */\nexport const WHITELIST_HEADERS = [\n HTTP.Headers.CONTENT_ENCODING,\n HTTP.Headers.CACHE_CONTROL,\n HTTP.Headers.ETAG,\n HTTP.Headers.LAST_MODIFIED,\n] as const;\n\n/**\n * Types the controller will let a browser render, keyed off the object name. Anything absent here is\n * served as an attachment, because a renderable upload on the API origin is stored XSS - and `nosniff`\n * cannot stop a type we declared ourselves. `image/svg+xml` is deliberately excluded: SVG carries script.\n */\nexport const RENDERABLE_CONTENT_TYPES = new Set<string>([\n 'image/png',\n 'image/jpeg',\n 'image/gif',\n 'image/webp',\n 'image/avif',\n 'image/bmp',\n 'image/x-icon',\n 'video/mp4',\n 'video/webm',\n 'audio/mpeg',\n 'audio/wav',\n 'audio/ogg',\n 'application/pdf',\n 'text/plain',\n 'text/csv',\n]);\n\n/** Storage backends a static asset controller can serve from. `isValid` checks a string against them. */\nexport class StaticAssetStorageTypes {\n static readonly DISK = 'disk';\n static readonly BUN_S3 = 'bun-s3';\n\n static readonly SCHEME_SET = new Set([this.DISK, this.BUN_S3]);\n\n static isValid(orgType: string): boolean {\n return this.SCHEME_SET.has(orgType);\n }\n}\n\n/** One of the `StaticAssetStorageTypes` values. */\nexport type TStaticAssetStorageType = TConstValue<typeof StaticAssetStorageTypes>;\n\n/** What `recreate-metalink` did: refreshed the rows of an object, or created its first one. */\nexport class MetaLinkRecreateActions {\n static readonly CREATED = 'created';\n static readonly REFRESHED = 'refreshed';\n\n static readonly SCHEME_SET = new Set([this.CREATED, this.REFRESHED]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** One of the `MetaLinkRecreateActions` values. */\nexport type TMetaLinkRecreateAction = TConstValue<typeof MetaLinkRecreateActions>;\n\n/** Where a signed policy may write. The final key is never inside it, so content cannot be replaced after the commit. */\nexport const DEFAULT_PENDING_PREFIX = 'pending/';\n\n/** The most file parts one upload request may carry unless `parseMultipartBody.maxFiles` says otherwise. */\nexport const DEFAULT_MAX_UPLOAD_FILES = 20;\n\n/** Reported in the body, never thrown: the bytes are stored, only the row is not. A CODE, because a 200 bypasses the middleware that strips the driver's `detail`/`table`/`constraint`. */\nexport const META_LINK_CREATE_FAILED = 'META_LINK_CREATE_FAILED';\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/components/static-asset/common/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAErD,iDAAiD;AACjD,MAAM,OAAO,kBAAkB;aACb,YAAO,GAAG,SAAS,CAAC;aACpB,gBAAW,GAAG,SAAS,CAAC;aACxB,eAAU,GAAG,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC;;AAGlE,2CAA2C;AAC3C,MAAM,OAAO,uBAAuB;IAClC;;;;OAIG;aACa,eAAU,GAAG,IAAI,GAAG,CAAS;QAC3C,IAAI,CAAC,YAAY,CAAC,SAAS;QAC3B,IAAI,CAAC,YAAY,CAAC,UAAU;QAC5B,IAAI,CAAC,YAAY,CAAC,SAAS;QAC3B,IAAI,CAAC,YAAY,CAAC,UAAU;QAC5B,YAAY;QACZ,WAAW;QACX,cAAc;QACd,WAAW;QACX,YAAY;QACZ,YAAY;QACZ,WAAW;QACX,WAAW;QACX,IAAI,CAAC,YAAY,CAAC,eAAe;QACjC,IAAI,CAAC,YAAY,CAA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AyB,CAAC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\nimport { HTTP } from '@venizia/ignis-helpers/common';\n\n/** What a controller sends with every object. */\nexport class StaticAssetHeaders {\n static readonly NOSNIFF = 'nosniff';\n static readonly CSP_SANDBOX = 'sandbox';\n static readonly RANGE_UNIT = HTTP.HeaderValues.RANGE_UNIT_BYTES;\n}\n\n/** Content types the controller serves. */\nexport class StaticAssetContentTypes {\n /**\n * Types the controller will let a browser render, keyed off the object name. Anything absent here is\n * served as an attachment, because a renderable upload on the API origin is stored XSS - and `nosniff`\n * cannot stop a type we declared ourselves. `image/svg+xml` is deliberately excluded: SVG carries script.\n */\n static readonly RENDERABLE = new Set<string>([\n HTTP.HeaderValues.IMAGE_PNG,\n HTTP.HeaderValues.IMAGE_JPEG,\n HTTP.HeaderValues.IMAGE_GIF,\n HTTP.HeaderValues.IMAGE_WEBP,\n 'image/avif',\n 'image/bmp',\n 'image/x-icon',\n 'video/mp4',\n 'video/webm',\n 'audio/mpeg',\n 'audio/wav',\n 'audio/ogg',\n HTTP.HeaderValues.APPLICATION_PDF,\n HTTP.HeaderValues.TEXT_PLAIN,\n HTTP.HeaderValues.TEXT_CSV,\n ]);\n}\n\n/** The built-in routes of a generated controller, the keys of `routes`. */\nexport class StaticAssetRouteKeys {\n static readonly UPLOAD = 'upload';\n static readonly LIST_OBJECTS = 'listObjects';\n static readonly DELETE_OBJECT = 'deleteObject';\n static readonly GET_OBJECT_BY_NAME = 'getObjectByName';\n static readonly DOWNLOAD_OBJECT_BY_NAME = 'downloadObjectByName';\n\n static readonly UPLOAD_POLICY = 'uploadPolicy';\n static readonly UPLOAD_COMMIT = 'uploadCommit';\n static readonly UPLOAD_VALIDATE = 'uploadValidate';\n\n static readonly RECREATE_META_LINK = 'recreateMetaLink';\n\n /** Every key, in registration order. */\n static readonly ALL = [\n StaticAssetRouteKeys.GET_OBJECT_BY_NAME,\n StaticAssetRouteKeys.DOWNLOAD_OBJECT_BY_NAME,\n StaticAssetRouteKeys.UPLOAD,\n StaticAssetRouteKeys.DELETE_OBJECT,\n StaticAssetRouteKeys.LIST_OBJECTS,\n StaticAssetRouteKeys.UPLOAD_POLICY,\n StaticAssetRouteKeys.UPLOAD_COMMIT,\n StaticAssetRouteKeys.UPLOAD_VALIDATE,\n StaticAssetRouteKeys.RECREATE_META_LINK,\n ] as const;\n}\n\n/** What `recreate-metalink` did: refreshed the rows of an object, or created its first one. */\nexport class MetaLinkRecreateActions {\n static readonly CREATED = 'created';\n static readonly REFRESHED = 'refreshed';\n}\n\n/** One of the `MetaLinkRecreateActions` values. */\nexport type TMetaLinkRecreateAction = TConstValue<typeof MetaLinkRecreateActions>;\n\n/** Where a commit token is in its life: issued with the policy, then validated against the content it pins. */\nexport class StaticAssetTokenStages {\n static readonly ISSUED = 'issued';\n static readonly VALIDATED = 'validated';\n}\n\n/** One of the `StaticAssetTokenStages` values. */\nexport type TStaticAssetTokenStage = TConstValue<typeof StaticAssetTokenStages>;\n\n/** Defaults of the static asset component. */\nexport class StaticAssetDefaults {\n /** Where a signed policy may write. The final key is never inside it, so content cannot be replaced after the commit. */\n static readonly PENDING_PREFIX = 'pending/';\n\n /** The most file parts one upload request may carry unless `serverUpload.maxFiles` says otherwise. */\n static readonly MAX_UPLOAD_FILES = 20;\n\n /** The most bytes of JSON one file's signed `metadata` may take: the token travels in every request. */\n static readonly MAX_TOKEN_METADATA_BYTES = 1024;\n\n /** The key of the application's token metadata inside a MetaLink row's `metadata` column. */\n static readonly META_LINK_METADATA_KEY = 'app';\n}\n\n/** Codes the component reports in a body instead of throwing. */\nexport class StaticAssetMetaLinkCodes {\n /** Reported in the body, never thrown: the bytes are stored, only the row is not. A CODE, because a 200 bypasses the middleware that strips the driver's `detail`/`table`/`constraint`. */\n static readonly CREATE_FAILED = 'META_LINK_CREATE_FAILED';\n}\n"]}