stratal 0.0.22 → 0.0.23

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 (270) hide show
  1. package/README.md +1 -1
  2. package/dist/bin/cloudflare-workers-loader.mjs +80 -7
  3. package/dist/bin/cloudflare-workers-loader.mjs.map +1 -1
  4. package/dist/bin/quarry.mjs +41 -54
  5. package/dist/bin/quarry.mjs.map +1 -1
  6. package/dist/cache/index.d.mts +5 -3
  7. package/dist/cache/index.d.mts.map +1 -1
  8. package/dist/cache/index.mjs +123 -39
  9. package/dist/cache/index.mjs.map +1 -1
  10. package/dist/{cache.service-e34gV6tz.d.mts → cache.service-uElmBtdS.d.mts} +24 -34
  11. package/dist/cache.service-uElmBtdS.d.mts.map +1 -0
  12. package/dist/{command-BU4ApTo5.mjs → command-BvmUAPPQ.mjs} +15 -3
  13. package/dist/command-BvmUAPPQ.mjs.map +1 -0
  14. package/dist/{command-wXfvHbBZ.d.mts → command-CPhFHjG3.d.mts} +2 -2
  15. package/dist/command-CPhFHjG3.d.mts.map +1 -0
  16. package/dist/command-not-found.error-ONAZ2Bpk.mjs +14 -0
  17. package/dist/command-not-found.error-ONAZ2Bpk.mjs.map +1 -0
  18. package/dist/config/index.d.mts +3 -3
  19. package/dist/config/index.d.mts.map +1 -1
  20. package/dist/config/index.mjs +7 -6
  21. package/dist/config/index.mjs.map +1 -1
  22. package/dist/{consumer-registry-DHQtypr1.d.mts → consumer-registry-D3iMTSdy.d.mts} +54 -22
  23. package/dist/consumer-registry-D3iMTSdy.d.mts.map +1 -0
  24. package/dist/{container-storage-GpNNz79X.mjs → container-storage-BmOJ4_Na.mjs} +1 -1
  25. package/dist/{container-storage-GpNNz79X.mjs.map → container-storage-BmOJ4_Na.mjs.map} +1 -1
  26. package/dist/{controller.decorator-DIUazNU7.mjs → controller.decorator-C5UVeJS3.mjs} +4 -4
  27. package/dist/{controller.decorator-DIUazNU7.mjs.map → controller.decorator-C5UVeJS3.mjs.map} +1 -1
  28. package/dist/cron/index.d.mts +79 -4
  29. package/dist/cron/index.d.mts.map +1 -1
  30. package/dist/cron/index.mjs +2 -2
  31. package/dist/cron-job-NesZRk8F.d.mts +58 -0
  32. package/dist/cron-job-NesZRk8F.d.mts.map +1 -0
  33. package/dist/{cron-manager-9bpN9bu4.mjs → cron.module-Bgzq5hiT.mjs} +17 -7
  34. package/dist/cron.module-Bgzq5hiT.mjs.map +1 -0
  35. package/dist/{decorate-HgTKAYK8.mjs → decorate-CuAoSZvs.mjs} +2 -2
  36. package/dist/{deep-merge-C8NgcXw4.mjs → deep-merge-ByiAOZ3r.mjs} +1 -1
  37. package/dist/{deep-merge-C8NgcXw4.mjs.map → deep-merge-ByiAOZ3r.mjs.map} +1 -1
  38. package/dist/di/index.d.mts +2 -2
  39. package/dist/di/index.mjs +3 -3
  40. package/dist/{di-BO1QIb5H.mjs → di-DseMn-z9.mjs} +244 -135
  41. package/dist/di-DseMn-z9.mjs.map +1 -0
  42. package/dist/email/index.d.mts +33 -40
  43. package/dist/email/index.d.mts.map +1 -1
  44. package/dist/email/index.mjs +456 -41
  45. package/dist/email/index.mjs.map +1 -1
  46. package/dist/{en-BPP6h6y5.mjs → en-CDZBMcc1.mjs} +2 -2
  47. package/dist/{en-BPP6h6y5.mjs.map → en-CDZBMcc1.mjs.map} +1 -1
  48. package/dist/{env-DKSbuBi5.d.mts → env-ug22bJj7.d.mts} +1 -1
  49. package/dist/env-ug22bJj7.d.mts.map +1 -0
  50. package/dist/errors/index.d.mts +1 -1
  51. package/dist/errors/index.mjs +3 -3
  52. package/dist/{errors-BBZTnjdq.mjs → errors-mXYxG0XB.mjs} +5 -5
  53. package/dist/{errors-BBZTnjdq.mjs.map → errors-mXYxG0XB.mjs.map} +1 -1
  54. package/dist/events/index.d.mts +14 -3
  55. package/dist/events/index.d.mts.map +1 -1
  56. package/dist/events/index.mjs +2 -2
  57. package/dist/{events-D1KdDaiP.mjs → events-BXJGZjpG.mjs} +16 -6
  58. package/dist/events-BXJGZjpG.mjs.map +1 -0
  59. package/dist/{exception-context-B4kM-M53.mjs → exception-context-kEoMFwze.mjs} +3 -3
  60. package/dist/{exception-context-B4kM-M53.mjs.map → exception-context-kEoMFwze.mjs.map} +1 -1
  61. package/dist/{gateway-context-CFe6a9gz.mjs → gateway-context-TMu_AlJt.mjs} +25 -6
  62. package/dist/{gateway-context-CFe6a9gz.mjs.map → gateway-context-TMu_AlJt.mjs.map} +1 -1
  63. package/dist/guards/index.d.mts +3 -3
  64. package/dist/guards/index.d.mts.map +1 -1
  65. package/dist/guards/index.mjs +1 -1
  66. package/dist/{guards-Ced-uNIF.mjs → guards-DALPXy3_.mjs} +2 -2
  67. package/dist/{guards-Ced-uNIF.mjs.map → guards-DALPXy3_.mjs.map} +1 -1
  68. package/dist/hono-app-CvV3hOfT.mjs +161 -0
  69. package/dist/hono-app-CvV3hOfT.mjs.map +1 -0
  70. package/dist/{http-method.decorator-CdjKFJZZ.mjs → http-method.decorator-ByWZb9DO.mjs} +4 -4
  71. package/dist/{http-method.decorator-CdjKFJZZ.mjs.map → http-method.decorator-ByWZb9DO.mjs.map} +1 -1
  72. package/dist/i18n/index.d.mts +4 -4
  73. package/dist/i18n/index.d.mts.map +1 -1
  74. package/dist/i18n/index.mjs +5 -5
  75. package/dist/i18n/index.mjs.map +1 -1
  76. package/dist/i18n/messages/en/index.d.mts +1 -1
  77. package/dist/i18n/messages/en/index.mjs +1 -1
  78. package/dist/i18n/utils/index.mjs +1 -1
  79. package/dist/i18n/validation/index.d.mts +3 -3
  80. package/dist/i18n/validation/index.mjs +3 -3
  81. package/dist/{i18n.module-BlXrtAlV.mjs → i18n.module-DRQAZoSZ.mjs} +14 -11
  82. package/dist/{i18n.module-BlXrtAlV.mjs.map → i18n.module-DRQAZoSZ.mjs.map} +1 -1
  83. package/dist/{i18n.tokens-hwRpmjRq.mjs → i18n.tokens-CZ_v8oyS.mjs} +1 -1
  84. package/dist/{i18n.tokens-hwRpmjRq.mjs.map → i18n.tokens-CZ_v8oyS.mjs.map} +1 -1
  85. package/dist/{index-B4UBK-2T.d.mts → index-0ItCjaqw.d.mts} +1 -1
  86. package/dist/index-0ItCjaqw.d.mts.map +1 -0
  87. package/dist/{index-CW1YHSft.d.mts → index-B5JBRcWD.d.mts} +249 -103
  88. package/dist/index-B5JBRcWD.d.mts.map +1 -0
  89. package/dist/{index-BtlE9RuO.d.mts → index-BUt92sAE.d.mts} +1 -1
  90. package/dist/index-BUt92sAE.d.mts.map +1 -0
  91. package/dist/{index-DEncMcC6.d.mts → index-B_JoEl3V.d.mts} +221 -16
  92. package/dist/index-B_JoEl3V.d.mts.map +1 -0
  93. package/dist/{index-Dj5IMwtr.d.mts → index-DtBNIFuP.d.mts} +4 -6
  94. package/dist/index-DtBNIFuP.d.mts.map +1 -0
  95. package/dist/{index-KMgSCSM7.d.mts → index-HgOLNruQ.d.mts} +1 -1
  96. package/dist/{index-KMgSCSM7.d.mts.map → index-HgOLNruQ.d.mts.map} +1 -1
  97. package/dist/index.d.mts +6 -5
  98. package/dist/index.mjs +3 -2
  99. package/dist/{is-command-CX5rAfZW.mjs → is-command-CEPO9n8c.mjs} +2 -2
  100. package/dist/{is-command-CX5rAfZW.mjs.map → is-command-CEPO9n8c.mjs.map} +1 -1
  101. package/dist/{is-seeder-CYCtELlm.mjs → is-seeder-Gvh_AM71.mjs} +1 -1
  102. package/dist/{is-seeder-CYCtELlm.mjs.map → is-seeder-Gvh_AM71.mjs.map} +1 -1
  103. package/dist/lazy-module-loader-Ib383jH_.d.mts +60 -0
  104. package/dist/lazy-module-loader-Ib383jH_.d.mts.map +1 -0
  105. package/dist/locale-path.service-D-dHiIPc.mjs +165 -0
  106. package/dist/locale-path.service-D-dHiIPc.mjs.map +1 -0
  107. package/dist/locale-url-nZrZxqJP.mjs +44 -0
  108. package/dist/locale-url-nZrZxqJP.mjs.map +1 -0
  109. package/dist/locale-url.service-C2EWmGdq.mjs +41 -0
  110. package/dist/locale-url.service-C2EWmGdq.mjs.map +1 -0
  111. package/dist/logger/index.d.mts +1 -1
  112. package/dist/logger/index.mjs +2 -2
  113. package/dist/logger/index.mjs.map +1 -1
  114. package/dist/macroable/index.d.mts +2 -2
  115. package/dist/macroable/index.mjs +1 -1
  116. package/dist/{macroable-DzlfzT50.mjs → macroable-cvDTFZ_A.mjs} +1 -1
  117. package/dist/{macroable-DzlfzT50.mjs.map → macroable-cvDTFZ_A.mjs.map} +1 -1
  118. package/dist/{metadata-BVkc4aUu.mjs → metadata-DzzprcID.mjs} +1 -1
  119. package/dist/{metadata-BVkc4aUu.mjs.map → metadata-DzzprcID.mjs.map} +1 -1
  120. package/dist/module/index.d.mts +4 -3
  121. package/dist/module/index.d.mts.map +1 -1
  122. package/dist/module/index.mjs +10 -2
  123. package/dist/module/index.mjs.map +1 -0
  124. package/dist/{module-xYoHba6B.mjs → module-registry-Dm-pqHd3.mjs} +189 -57
  125. package/dist/module-registry-Dm-pqHd3.mjs.map +1 -0
  126. package/dist/module.decorator-CYHY6pG5.mjs +19 -0
  127. package/dist/module.decorator-CYHY6pG5.mjs.map +1 -0
  128. package/dist/openapi/index.d.mts +44 -8
  129. package/dist/openapi/index.d.mts.map +1 -1
  130. package/dist/openapi/index.mjs +3 -2
  131. package/dist/{openapi-C6lm0RmV.mjs → openapi-CstuTM8S.mjs} +55 -229
  132. package/dist/openapi-CstuTM8S.mjs.map +1 -0
  133. package/dist/openapi-tools.service-BC5EC3R3.mjs +206 -0
  134. package/dist/openapi-tools.service-BC5EC3R3.mjs.map +1 -0
  135. package/dist/{openapi.service-CrLlsXAd.d.mts → openapi.service-YhTiJ1bO.d.mts} +3 -3
  136. package/dist/{openapi.service-CrLlsXAd.d.mts.map → openapi.service-YhTiJ1bO.d.mts.map} +1 -1
  137. package/dist/quarry/index.d.mts +14 -5
  138. package/dist/quarry/index.d.mts.map +1 -1
  139. package/dist/quarry/index.mjs +6 -5
  140. package/dist/quarry/runner.d.mts +11 -11
  141. package/dist/quarry/runner.d.mts.map +1 -1
  142. package/dist/quarry/runner.mjs +192 -22
  143. package/dist/quarry/runner.mjs.map +1 -1
  144. package/dist/{quarry-registry-D4hIGScf.d.mts → quarry-registry-CXg0RFXq.d.mts} +4 -4
  145. package/dist/quarry-registry-CXg0RFXq.d.mts.map +1 -0
  146. package/dist/{quarry-registry-DkraZNwn.mjs → quarry.module-BuRPGMDm.mjs} +22 -21
  147. package/dist/quarry.module-BuRPGMDm.mjs.map +1 -0
  148. package/dist/queue/index.d.mts +3 -3
  149. package/dist/queue/index.mjs +42 -31
  150. package/dist/queue/index.mjs.map +1 -1
  151. package/dist/queue.module-nddvxzCB.mjs +613 -0
  152. package/dist/queue.module-nddvxzCB.mjs.map +1 -0
  153. package/dist/queue.tokens-DjHnFmre.mjs +11 -0
  154. package/dist/queue.tokens-DjHnFmre.mjs.map +1 -0
  155. package/dist/{r2-storage.provider-Hfm6LdZQ.mjs → r2-storage.provider-DCxQt9dD.mjs} +4 -4
  156. package/dist/{r2-storage.provider-Hfm6LdZQ.mjs.map → r2-storage.provider-DCxQt9dD.mjs.map} +1 -1
  157. package/dist/{rate-limit.decorator-D69zdZbp.mjs → rate-limit.decorator-BPAie_p3.mjs} +3 -3
  158. package/dist/{rate-limit.decorator-D69zdZbp.mjs.map → rate-limit.decorator-BPAie_p3.mjs.map} +1 -1
  159. package/dist/rate-limiter/index.d.mts +5 -5
  160. package/dist/rate-limiter/index.d.mts.map +1 -1
  161. package/dist/rate-limiter/index.mjs +26 -21
  162. package/dist/rate-limiter/index.mjs.map +1 -1
  163. package/dist/route-name-DGoBOfPg.mjs +171 -0
  164. package/dist/route-name-DGoBOfPg.mjs.map +1 -0
  165. package/dist/route-registration.service-D6vSwiKP.mjs +918 -0
  166. package/dist/route-registration.service-D6vSwiKP.mjs.map +1 -0
  167. package/dist/route-registry-CYqLp2Nj.mjs +123 -0
  168. package/dist/route-registry-CYqLp2Nj.mjs.map +1 -0
  169. package/dist/router/index.d.mts +2 -2
  170. package/dist/router/index.mjs +18 -8
  171. package/dist/router-CWGBD-Bg.mjs +78 -0
  172. package/dist/router-CWGBD-Bg.mjs.map +1 -0
  173. package/dist/router-resolver-D4YlPNlm.mjs +88 -0
  174. package/dist/router-resolver-D4YlPNlm.mjs.map +1 -0
  175. package/dist/seeder/index.d.mts +14 -4
  176. package/dist/seeder/index.d.mts.map +1 -1
  177. package/dist/seeder/index.mjs +5 -3
  178. package/dist/{seeder-BADTig4n.mjs → seeder-7ubkms-Y.mjs} +7 -56
  179. package/dist/seeder-7ubkms-Y.mjs.map +1 -0
  180. package/dist/seeder-registry-CyUmKsJq.mjs +57 -0
  181. package/dist/seeder-registry-CyUmKsJq.mjs.map +1 -0
  182. package/dist/seeder.module-CYYwk3Qk.mjs +15 -0
  183. package/dist/seeder.module-CYYwk3Qk.mjs.map +1 -0
  184. package/dist/{signed-url-BqUqt5dF.mjs → signed-url-DIU0sK_6.mjs} +1 -1
  185. package/dist/{signed-url-BqUqt5dF.mjs.map → signed-url-DIU0sK_6.mjs.map} +1 -1
  186. package/dist/storage/index.d.mts +3 -3
  187. package/dist/storage/index.d.mts.map +1 -1
  188. package/dist/storage/index.mjs +2 -2
  189. package/dist/storage/providers/index.d.mts +2 -2
  190. package/dist/storage/providers/index.d.mts.map +1 -1
  191. package/dist/storage/providers/index.mjs +1 -1
  192. package/dist/{storage-BA3ppVYM.mjs → storage-MDZypIE9.mjs} +12 -11
  193. package/dist/{storage-BA3ppVYM.mjs.map → storage-MDZypIE9.mjs.map} +1 -1
  194. package/dist/{storage-provider.interface-DQMtT42e.d.mts → storage-provider.interface-ClUwxz4S.d.mts} +2 -2
  195. package/dist/storage-provider.interface-ClUwxz4S.d.mts.map +1 -0
  196. package/dist/storage.error-Dnib4VHc.mjs +8 -0
  197. package/dist/{storage.error-C6FY037a.mjs.map → storage.error-Dnib4VHc.mjs.map} +1 -1
  198. package/dist/{stratal-Bdq4IdB3.mjs → stratal-DL9M38_s.mjs} +142 -140
  199. package/dist/stratal-DL9M38_s.mjs.map +1 -0
  200. package/dist/{stratal-BsKmvP6J.d.mts → stratal-DwDJPY9N.d.mts} +3 -3
  201. package/dist/{stratal-BsKmvP6J.d.mts.map → stratal-DwDJPY9N.d.mts.map} +1 -1
  202. package/dist/tiered-cache.service-Dv3BhxxE.d.mts +79 -0
  203. package/dist/tiered-cache.service-Dv3BhxxE.d.mts.map +1 -0
  204. package/dist/trailing-slash-CFyw8nYu.mjs +34 -0
  205. package/dist/trailing-slash-CFyw8nYu.mjs.map +1 -0
  206. package/dist/{types-BaeHi67f.d.mts → types-CmV_9xBD.d.mts} +1 -1
  207. package/dist/types-CmV_9xBD.d.mts.map +1 -0
  208. package/dist/uri-h7Q8Jug9.mjs +251 -0
  209. package/dist/uri-h7Q8Jug9.mjs.map +1 -0
  210. package/dist/{usage-generator-DTqaUMR9.mjs → usage-generator-DAWYasuP.mjs} +4 -4
  211. package/dist/usage-generator-DAWYasuP.mjs.map +1 -0
  212. package/dist/{validation-DUzcjb8Q.mjs → validation-CpOjviyT.mjs} +6 -6
  213. package/dist/{validation-DUzcjb8Q.mjs.map → validation-CpOjviyT.mjs.map} +1 -1
  214. package/dist/{validation.context-XTysWJ3b.mjs → validation.context-CRvmrhq7.mjs} +3 -3
  215. package/dist/{validation.context-XTysWJ3b.mjs.map → validation.context-CRvmrhq7.mjs.map} +1 -1
  216. package/dist/versioning.service-C6aHky8-.mjs +36 -0
  217. package/dist/versioning.service-C6aHky8-.mjs.map +1 -0
  218. package/dist/websocket/index.d.mts +11 -2
  219. package/dist/websocket/index.d.mts.map +1 -1
  220. package/dist/websocket/index.mjs +1 -1
  221. package/dist/workers/index.d.mts +2 -2
  222. package/dist/workers/index.d.mts.map +1 -1
  223. package/dist/workers/index.mjs +3 -3
  224. package/dist/workers/index.mjs.map +1 -1
  225. package/dist/{zod-hMa3rSHV.mjs → zod-eKqqhZ5_.mjs} +2 -2
  226. package/dist/{zod-hMa3rSHV.mjs.map → zod-eKqqhZ5_.mjs.map} +1 -1
  227. package/dist/{zod-DvWTfRpI.d.mts → zod-wecrEVAs.d.mts} +8 -3
  228. package/dist/zod-wecrEVAs.d.mts.map +1 -0
  229. package/package.json +19 -30
  230. package/dist/base-email.provider-BWZHIjt8.mjs +0 -42
  231. package/dist/base-email.provider-BWZHIjt8.mjs.map +0 -1
  232. package/dist/cache.service-e34gV6tz.d.mts.map +0 -1
  233. package/dist/cache.tokens-ovi_c52J.mjs +0 -6
  234. package/dist/cache.tokens-ovi_c52J.mjs.map +0 -1
  235. package/dist/colors-axmupKdp.mjs +0 -16
  236. package/dist/colors-axmupKdp.mjs.map +0 -1
  237. package/dist/command-BU4ApTo5.mjs.map +0 -1
  238. package/dist/command-wXfvHbBZ.d.mts.map +0 -1
  239. package/dist/consumer-registry-DHQtypr1.d.mts.map +0 -1
  240. package/dist/cron-manager-9bpN9bu4.mjs.map +0 -1
  241. package/dist/cron-manager-CSTIBPcM.d.mts +0 -124
  242. package/dist/cron-manager-CSTIBPcM.d.mts.map +0 -1
  243. package/dist/di-BO1QIb5H.mjs.map +0 -1
  244. package/dist/env-DKSbuBi5.d.mts.map +0 -1
  245. package/dist/events-D1KdDaiP.mjs.map +0 -1
  246. package/dist/index-B4UBK-2T.d.mts.map +0 -1
  247. package/dist/index-BtlE9RuO.d.mts.map +0 -1
  248. package/dist/index-CW1YHSft.d.mts.map +0 -1
  249. package/dist/index-DEncMcC6.d.mts.map +0 -1
  250. package/dist/index-Dj5IMwtr.d.mts.map +0 -1
  251. package/dist/module-xYoHba6B.mjs.map +0 -1
  252. package/dist/openapi-C6lm0RmV.mjs.map +0 -1
  253. package/dist/quarry-registry-D4hIGScf.d.mts.map +0 -1
  254. package/dist/quarry-registry-DkraZNwn.mjs.map +0 -1
  255. package/dist/queue.module-DeWJ0tQM.mjs +0 -355
  256. package/dist/queue.module-DeWJ0tQM.mjs.map +0 -1
  257. package/dist/resend.provider-Ur6tU7fK.mjs +0 -68
  258. package/dist/resend.provider-Ur6tU7fK.mjs.map +0 -1
  259. package/dist/router-Cy6DjkvP.mjs +0 -1852
  260. package/dist/router-Cy6DjkvP.mjs.map +0 -1
  261. package/dist/seeder-BADTig4n.mjs.map +0 -1
  262. package/dist/smtp.provider-C129sNBT.mjs +0 -76
  263. package/dist/smtp.provider-C129sNBT.mjs.map +0 -1
  264. package/dist/storage-provider.interface-DQMtT42e.d.mts.map +0 -1
  265. package/dist/storage.error-C6FY037a.mjs +0 -8
  266. package/dist/stratal-Bdq4IdB3.mjs.map +0 -1
  267. package/dist/types-BaeHi67f.d.mts.map +0 -1
  268. package/dist/usage-generator-DTqaUMR9.mjs.map +0 -1
  269. package/dist/zod-DvWTfRpI.d.mts.map +0 -1
  270. /package/dist/{chunk-D1SwGrFN.mjs → chunk-BBjsoOtd.mjs} +0 -0
@@ -0,0 +1,918 @@
1
+ import { t as __exportAll } from "./chunk-BBjsoOtd.mjs";
2
+ import { d as inject, m as getMethodInjections, r as DI_TOKENS, s as Singleton, v as ROUTER_TOKENS } from "./di-DseMn-z9.mjs";
3
+ import { n as getMetadata, t as defineMetadata } from "./metadata-DzzprcID.mjs";
4
+ import { n as __decorateParam, t as __decorate } from "./decorate-CuAoSZvs.mjs";
5
+ import { LOGGER_TOKENS } from "./logger/index.mjs";
6
+ import { d as abort, u as HttpException } from "./errors-mXYxG0XB.mjs";
7
+ import { a as RouterContext, c as METHOD_STATUS_CODES, d as SECURITY_SCHEMES, l as ROUTER_CONTEXT_KEYS, o as DEFAULT_CONTENT_TYPE, s as HTTP_METHODS, u as ROUTE_METADATA_KEYS } from "./exception-context-kEoMFwze.mjs";
8
+ import { o as RouterError, s as createThrottleMiddleware } from "./module-registry-Dm-pqHd3.mjs";
9
+ import { i as zod_exports, r as z } from "./zod-eKqqhZ5_.mjs";
10
+ import { n as getControllerOptions, r as getControllerRoute } from "./controller.decorator-C5UVeJS3.mjs";
11
+ import "./http-method.decorator-ByWZb9DO.mjs";
12
+ import { i as getMethodGuards, r as getControllerGuards, t as GuardExecutionService } from "./guards-DALPXy3_.mjs";
13
+ import { n as getRateLimits } from "./rate-limit.decorator-BPAie_p3.mjs";
14
+ import { a as getWsOnCloseMethod, o as getWsOnErrorMethod, s as getWsOnMessageMethod, t as GatewayContext, u as isGateway } from "./gateway-context-TMu_AlJt.mjs";
15
+ import { o as toOpenAPIPath, r as generateConventionRouteName, s as toRoutingOpenAPIPath } from "./route-name-DGoBOfPg.mjs";
16
+ //#region src/router/errors/route-not-found.error.ts
17
+ var RouteNotFoundError = class extends HttpException {
18
+ path;
19
+ method;
20
+ constructor(path, method) {
21
+ super(404, `Route not found: ${method} ${path}`);
22
+ this.path = path;
23
+ this.method = method;
24
+ }
25
+ };
26
+ //#endregion
27
+ //#region src/router/errors/schema-validation.error.ts
28
+ var SchemaValidationError = class extends HttpException {
29
+ issues;
30
+ constructor(zodError) {
31
+ super(400, "Schema validation failed");
32
+ this.issues = zodError.issues.map((err) => ({
33
+ path: err.path.join("."),
34
+ message: err.message,
35
+ code: err.code
36
+ }));
37
+ }
38
+ };
39
+ //#endregion
40
+ //#region src/router/errors/index.ts
41
+ /**
42
+ * Error thrown when a signed URL has an invalid or expired signature.
43
+ *
44
+ * HTTP Status: 403 Forbidden
45
+ */
46
+ var InvalidSignatureError = class extends HttpException {
47
+ constructor() {
48
+ super(403, "Invalid or expired signature");
49
+ }
50
+ };
51
+ /**
52
+ * ResponseValidationError
53
+ *
54
+ * Thrown when a controller's response body does not match the declared Zod response schema.
55
+ * Indicates a server-side schema mismatch — the controller is returning data that
56
+ * violates its own API contract.
57
+ */
58
+ var ResponseValidationError = class extends HttpException {
59
+ issues;
60
+ constructor(zodError) {
61
+ super(500, "Response validation failed");
62
+ this.issues = zodError.issues.map((err) => ({
63
+ path: err.path.join("."),
64
+ message: err.message,
65
+ code: err.code
66
+ }));
67
+ }
68
+ };
69
+ //#endregion
70
+ //#region src/router/middleware/domain.middleware.ts
71
+ /**
72
+ * Parse a domain pattern into a regex and extract parameter names.
73
+ *
74
+ * @example
75
+ * parseDomainPattern('{tenant}.example.com')
76
+ * // => { regex: /^([^.]+)\.example\.com$/, paramNames: ['tenant'] }
77
+ *
78
+ * parseDomainPattern('{region}.{tenant}.example.com')
79
+ * // => { regex: /^([^.]+)\.([^.]+)\.example\.com$/, paramNames: ['region', 'tenant'] }
80
+ */
81
+ function parseDomainPattern(pattern) {
82
+ const paramNames = [];
83
+ const escaped = pattern.replace(/\{([a-zA-Z_][a-zA-Z0-9_]*)\}/g, (_match, paramName) => {
84
+ paramNames.push(paramName);
85
+ return "([^.]+)";
86
+ }).replace(/\./g, "\\.");
87
+ return {
88
+ regex: new RegExp(`^${escaped}$`),
89
+ paramNames
90
+ };
91
+ }
92
+ /**
93
+ * Strip port number from a host header value.
94
+ * 'example.com:8787' => 'example.com'
95
+ */
96
+ function stripPort(host) {
97
+ const colonIdx = host.lastIndexOf(":");
98
+ if (colonIdx === -1) return host;
99
+ const afterColon = host.slice(colonIdx + 1);
100
+ return /^\d+$/.test(afterColon) ? host.slice(0, colonIdx) : host;
101
+ }
102
+ /**
103
+ * Create a Hono middleware that matches the request host against a domain pattern.
104
+ *
105
+ * When the host matches, domain parameters are extracted and stored in context
106
+ * variables accessible via `ctx.domain(key)`.
107
+ *
108
+ * When the host does NOT match, aborts with 404.
109
+ *
110
+ * @param pattern - Domain pattern with `{param}` placeholders (e.g., '{tenant}.myapp.com')
111
+ *
112
+ * @example
113
+ * ```typescript
114
+ * // Applied automatically by RouteRegistrationService for controllers with domain config
115
+ * @Controller('/dashboard', { domain: '{tenant}.myapp.com' })
116
+ * export class DashboardController {
117
+ * async index(ctx: RouterContext) {
118
+ * const tenant = ctx.domain('tenant')
119
+ * }
120
+ * }
121
+ * ```
122
+ */
123
+ function createDomainMiddleware(pattern) {
124
+ const { regex, paramNames } = parseDomainPattern(pattern);
125
+ return async (c, next) => {
126
+ const host = stripPort(c.req.header("host") ?? "");
127
+ const match = regex.exec(host);
128
+ if (!match) abort(404, "Domain mismatch");
129
+ for (let i = 0; i < paramNames.length; i++) c.set(`domain:${paramNames[i]}`, match[i + 1]);
130
+ await next();
131
+ };
132
+ }
133
+ //#endregion
134
+ //#region src/router/middleware/middleware-chain.ts
135
+ /**
136
+ * Create a Hono middleware handler that executes a chain of Stratal middleware classes.
137
+ *
138
+ * Each middleware is resolved from the request-scoped container per request,
139
+ * then executed in order (first registered = outermost in the chain).
140
+ *
141
+ * @param classes - Middleware classes to chain
142
+ * @returns Hono middleware handler
143
+ */
144
+ function createMiddlewareChain(classes) {
145
+ return async (c, next) => {
146
+ const requestContainer = c.get(ROUTER_CONTEXT_KEYS.REQUEST_CONTAINER);
147
+ const ctx = new RouterContext(c);
148
+ let current = next;
149
+ for (let i = classes.length - 1; i >= 0; i--) {
150
+ const prevNext = current;
151
+ const middlewareClass = classes[i];
152
+ current = () => {
153
+ const middleware = requestContainer.resolve(middlewareClass);
154
+ let called = false;
155
+ const guardedNext = () => {
156
+ if (called) return Promise.reject(new RouterError(`Middleware "${middlewareClass.name ?? "anonymous"}" called next() multiple times`));
157
+ called = true;
158
+ return prevNext();
159
+ };
160
+ return middleware.handle(ctx, guardedNext);
161
+ };
162
+ }
163
+ const result = await current();
164
+ if (result instanceof Response) return result;
165
+ };
166
+ }
167
+ //#endregion
168
+ //#region src/router/decorators/route.decorator.ts
169
+ /**
170
+ * Decorator to add OpenAPI metadata to a controller method using convention-based routing.
171
+ *
172
+ * **Cannot be mixed with HTTP method decorators** (`@Get`, `@Post`, `@Put`, `@Patch`,
173
+ * `@Delete`, `@All`) in the same controller. Use one pattern or the other.
174
+ *
175
+ * Stores route configuration (schemas, response, tags, security) in metadata.
176
+ * HTTP method, path, and success status code are auto-derived from the method name:
177
+ * - index() → GET /base-path → 200
178
+ * - show() → GET /base-path/:id → 200
179
+ * - create() → POST /base-path → 201
180
+ * - update() → PUT /base-path/:id → 200
181
+ * - patch() → PATCH /base-path/:id → 200
182
+ * - destroy() → DELETE /base-path/:id → 200
183
+ *
184
+ * @param config - Route configuration (schemas, response, tags, security)
185
+ *
186
+ * @example
187
+ * ```typescript
188
+ * @Controller('/api/v1/notes', {
189
+ * tags: ['Notes'],
190
+ * security: ['bearerAuth']
191
+ * })
192
+ * export class NotesController implements Controller {
193
+ * @Route({
194
+ * body: createNoteSchema,
195
+ * response: noteSchema, // 201 auto-derived from 'create' method
196
+ * tags: ['Mutations'],
197
+ * description: 'Create a new note'
198
+ * })
199
+ * async create(ctx: RouterContext): Promise<Response> {
200
+ * // POST /api/v1/notes (auto-derived from method name)
201
+ * // Body schema: createNoteSchema (auto-validated)
202
+ * // Response: 201 → noteSchema (status auto-derived)
203
+ * // Tags: ['Notes', 'Mutations'] (merged with controller)
204
+ * // Security: ['bearerAuth'] (inherited from controller)
205
+ * const body = ctx.body()
206
+ * const note = await this.notesService.create(body)
207
+ * return ctx.json(note, 201)
208
+ * }
209
+ *
210
+ * @Route({
211
+ * query: paginationSchema,
212
+ * response: z.array(noteSchema) // 200 auto-derived from 'index' method
213
+ * })
214
+ * async index(ctx: RouterContext): Promise<Response> {
215
+ * // GET /api/v1/notes (auto-derived)
216
+ * // Query params auto-validated
217
+ * const notes = await this.notesService.list()
218
+ * return ctx.json(notes)
219
+ * }
220
+ *
221
+ * @Route({
222
+ * params: z.object({ id: z.string().uuid() }),
223
+ * response: {
224
+ * schema: noteSchema,
225
+ * description: 'Note details'
226
+ * },
227
+ * security: [] // Override to make public
228
+ * })
229
+ * async show(ctx: RouterContext): Promise<Response> {
230
+ * // GET /api/v1/notes/:id (auto-derived)
231
+ * // URL params auto-validated
232
+ * // Response: 200 → noteSchema (status auto-derived)
233
+ * // Security: [] (public route, override controller security)
234
+ * const id = ctx.param('id')
235
+ * const note = await this.notesService.findById(id)
236
+ * return ctx.json(note)
237
+ * }
238
+ * }
239
+ * ```
240
+ */
241
+ function Route(config) {
242
+ return function(target, propertyKey, descriptor) {
243
+ const metadata = {
244
+ type: "convention",
245
+ config
246
+ };
247
+ defineMetadata(ROUTE_METADATA_KEYS.ROUTE_CONFIG, metadata, target, propertyKey);
248
+ const existing = getMetadata(ROUTE_METADATA_KEYS.DECORATED_METHODS, target) ?? [];
249
+ existing.push(propertyKey);
250
+ defineMetadata(ROUTE_METADATA_KEYS.DECORATED_METHODS, existing, target);
251
+ return descriptor;
252
+ };
253
+ }
254
+ /**
255
+ * Get the route metadata from a controller method
256
+ *
257
+ * @param target - Controller instance or prototype
258
+ * @param methodName - Name of the method
259
+ * @returns Route metadata or undefined if not decorated
260
+ */
261
+ function getRouteMetadata(target, methodName) {
262
+ return getMetadata(ROUTE_METADATA_KEYS.ROUTE_CONFIG, target, methodName);
263
+ }
264
+ /**
265
+ * Get all methods with route decorators (@Route, @Get, @Post, etc.) from a controller
266
+ *
267
+ * @param ControllerClass - Controller class
268
+ * @returns Array of method names that have route metadata
269
+ */
270
+ function getRouteDecoratedMethods(ControllerClass) {
271
+ const methods = /* @__PURE__ */ new Set();
272
+ let proto = ControllerClass.prototype;
273
+ while (proto && proto !== Object.prototype) {
274
+ const own = getMetadata(ROUTE_METADATA_KEYS.DECORATED_METHODS, proto);
275
+ if (own) for (const m of own) methods.add(m);
276
+ proto = Object.getPrototypeOf(proto);
277
+ }
278
+ return [...methods];
279
+ }
280
+ //#endregion
281
+ //#region src/router/schemas/common.schemas.ts
282
+ /**
283
+ * Common OpenAPI Schemas
284
+ *
285
+ * Reusable schema definitions for common API patterns:
286
+ * - Error responses
287
+ * - Pagination
288
+ * - Common parameters
289
+ */
290
+ /**
291
+ * Generic error response schema
292
+ * Used for all error responses (4xx, 5xx)
293
+ * Matches the ErrorResponse shape produced by ExceptionHandler
294
+ */
295
+ const errorResponseSchema = z.object({
296
+ message: z.string().describe("Human-readable error message"),
297
+ timestamp: z.string().datetime().describe("ISO timestamp when error occurred"),
298
+ stack: z.string().optional().describe("Stack trace (development only)")
299
+ }).openapi("ErrorResponse");
300
+ /**
301
+ * Validation error response schema
302
+ * Used for 400 Bad Request with validation failures
303
+ * Matches the ErrorResponse shape produced by ExceptionHandler
304
+ */
305
+ const validationErrorResponseSchema = errorResponseSchema.openapi("ValidationErrorResponse");
306
+ /**
307
+ * Pagination query parameters schema
308
+ * Used for list endpoints
309
+ */
310
+ const paginationQuerySchema = z.object({
311
+ page: z.coerce.number().int().positive().default(1).describe("Page number (1-indexed)"),
312
+ limit: z.coerce.number().int().positive().max(100).default(20).describe("Items per page (max 100)")
313
+ }).openapi("PaginationQuery");
314
+ /**
315
+ * Paginated response wrapper schema
316
+ * Generic wrapper for paginated list responses
317
+ */
318
+ const paginatedResponseSchema = (itemSchema) => z.object({
319
+ data: z.array(itemSchema).describe("Array of items for current page"),
320
+ pagination: z.object({
321
+ page: z.number().int().positive().describe("Current page number"),
322
+ limit: z.number().int().positive().describe("Items per page"),
323
+ total: z.number().int().nonnegative().describe("Total number of items"),
324
+ totalPages: z.number().int().nonnegative().describe("Total number of pages")
325
+ })
326
+ });
327
+ /**
328
+ * UUID parameter schema
329
+ * Used for :id parameters in RESTful routes
330
+ */
331
+ const uuidParamSchema = z.object({ id: z.string().uuid().describe("Resource UUID") }).openapi("UUIDParam");
332
+ /**
333
+ * Success message response schema
334
+ * Used for operations that don't return data (e.g., DELETE)
335
+ */
336
+ const successMessageSchema = z.object({
337
+ message: z.string().describe("Success message"),
338
+ data: z.record(z.string(), z.unknown()).optional().describe("Optional additional data")
339
+ }).openapi("SuccessMessage");
340
+ /**
341
+ * Common HTTP status error schemas
342
+ * Pre-configured for standard error responses
343
+ */
344
+ const commonErrorSchemas = {
345
+ 400: {
346
+ schema: validationErrorResponseSchema,
347
+ description: "Validation error"
348
+ },
349
+ 401: {
350
+ schema: errorResponseSchema,
351
+ description: "Unauthorized"
352
+ },
353
+ 403: {
354
+ schema: errorResponseSchema,
355
+ description: "Forbidden"
356
+ },
357
+ 404: {
358
+ schema: errorResponseSchema,
359
+ description: "Not found"
360
+ },
361
+ 409: {
362
+ schema: errorResponseSchema,
363
+ description: "Conflict"
364
+ },
365
+ 500: {
366
+ schema: errorResponseSchema,
367
+ description: "Internal server error"
368
+ }
369
+ };
370
+ //#endregion
371
+ //#region src/router/services/route-registration.service.ts
372
+ var route_registration_service_exports = /* @__PURE__ */ __exportAll({ RouteRegistrationService: () => RouteRegistrationService });
373
+ const invokeHandler = (instance, method, ...args) => {
374
+ try {
375
+ return Promise.resolve(instance[method](...args));
376
+ } catch (err) {
377
+ return Promise.reject(err);
378
+ }
379
+ };
380
+ let RouteRegistrationService = class RouteRegistrationService {
381
+ logger;
382
+ registry;
383
+ routerResolver;
384
+ localePathService;
385
+ app;
386
+ moduleRegistry;
387
+ controllerClasses = /* @__PURE__ */ new Map();
388
+ upgradeWebSocketFn = null;
389
+ constructor(logger, registry, routerResolver, localePathService, app, moduleRegistry) {
390
+ this.logger = logger;
391
+ this.registry = registry;
392
+ this.routerResolver = routerResolver;
393
+ this.localePathService = localePathService;
394
+ this.app = app;
395
+ this.moduleRegistry = moduleRegistry;
396
+ }
397
+ /**
398
+ * Configure router with controllers and global middleware.
399
+ * Resolves controllers from ModuleRegistry and global middleware from RouterResolver.
400
+ */
401
+ async configure() {
402
+ const controllers = this.moduleRegistry.getAllControllers();
403
+ const globalMiddleware = this.routerResolver?.getGlobalMiddleware() ?? [];
404
+ this.logger.info("Registering controllers", { controllerCount: controllers.length });
405
+ if (globalMiddleware.length > 0) this.app.use("*", createMiddlewareChain(globalMiddleware));
406
+ if (controllers.some(isGateway)) {
407
+ const { upgradeWebSocket } = await import("hono/cloudflare-workers");
408
+ this.upgradeWebSocketFn = upgradeWebSocket;
409
+ }
410
+ const actions = /* @__PURE__ */ new WeakMap();
411
+ for (const ControllerClass of controllers) this.collectRoutes(ControllerClass, actions);
412
+ for (const route of this.registry.all()) actions.get(route)?.();
413
+ this.logger.info("Controller registration complete");
414
+ }
415
+ /**
416
+ * Pass 1: Collect routes from a controller into RouteRegistry and store Hono actions.
417
+ * Versioning and locale expansion are handled by RouteRegistry.register().
418
+ */
419
+ collectRoutes(ControllerClass, actions) {
420
+ const isWsGateway = isGateway(ControllerClass);
421
+ const controllerRoute = getControllerRoute(ControllerClass);
422
+ if (!controllerRoute) throw new RouterError(`Controller "${ControllerClass.name}" registration failed: ${isWsGateway ? "Missing @Gateway decorator or route metadata" : "Missing @Controller decorator or route metadata"}`);
423
+ const controllerOpts = getControllerOptions(ControllerClass);
424
+ const controllerGuards = getControllerGuards(ControllerClass)?.guards ?? [];
425
+ const routerConfig = this.routerResolver?.resolveForController(ControllerClass) ?? { middleware: [] };
426
+ const classThrottleMiddleware = Array.from(new Set(getRateLimits(ControllerClass).map(createThrottleMiddleware)));
427
+ const basePath = routerConfig.prefix ? this.joinPaths(routerConfig.prefix, controllerRoute) : controllerRoute;
428
+ const effectiveVersion = controllerOpts?.version ?? routerConfig.version;
429
+ const effectiveDomain = controllerOpts?.domain ?? routerConfig.domain;
430
+ if (isWsGateway) {
431
+ const wsMiddleware = [...routerConfig.middleware, ...classThrottleMiddleware];
432
+ const expandedRoutes = this.registry.register({
433
+ method: "ws",
434
+ basePath,
435
+ version: effectiveVersion,
436
+ domain: effectiveDomain,
437
+ controller: ControllerClass.name,
438
+ action: "ws",
439
+ hidden: routerConfig.hideFromDocs ?? false,
440
+ middleware: wsMiddleware.map((m) => m.name)
441
+ });
442
+ for (const route of expandedRoutes) actions.set(route, () => {
443
+ if (wsMiddleware.length > 0) this.app.use(route.path, createMiddlewareChain(wsMiddleware));
444
+ if (effectiveDomain) {
445
+ const domainHandler = createDomainMiddleware(effectiveDomain);
446
+ this.app.use(route.path, domainHandler);
447
+ this.app.use(`${route.path}/*`, domainHandler);
448
+ }
449
+ this.registerGatewayForPath(ControllerClass, route.path, controllerGuards);
450
+ });
451
+ return;
452
+ }
453
+ const className = ControllerClass.name;
454
+ this.controllerClasses.set(className, ControllerClass);
455
+ const prototype = ControllerClass.prototype;
456
+ if (prototype.handle) {
457
+ const wildcardMiddleware = [...routerConfig.middleware, ...classThrottleMiddleware];
458
+ const expandedRoutes = this.registry.register({
459
+ method: "all",
460
+ basePath,
461
+ version: effectiveVersion,
462
+ domain: effectiveDomain,
463
+ controller: className,
464
+ action: "handle",
465
+ hidden: routerConfig.hideFromDocs ?? false,
466
+ middleware: wildcardMiddleware.map((m) => m.name)
467
+ });
468
+ for (const route of expandedRoutes) actions.set(route, () => {
469
+ if (wildcardMiddleware.length > 0) this.app.use(route.path, createMiddlewareChain(wildcardMiddleware));
470
+ this.registerWildcardRoute(ControllerClass, route.path);
471
+ });
472
+ return;
473
+ }
474
+ const decoratedMethods = getRouteDecoratedMethods(ControllerClass);
475
+ if (decoratedMethods.length === 0) throw new RouterError(`Controller "${ControllerClass.name}" registration failed: No route decorators found. Use @Route() or HTTP method decorators (@Get, @Post, etc.) on controller methods.`);
476
+ const methodMetadata = [];
477
+ let hasConvention = false;
478
+ let hasExplicit = false;
479
+ for (const m of decoratedMethods) {
480
+ const meta = getRouteMetadata(prototype, m);
481
+ if (!meta) continue;
482
+ methodMetadata.push({
483
+ method: m,
484
+ meta
485
+ });
486
+ if (meta.type === "convention") hasConvention = true;
487
+ else if (meta.type === "explicit") hasExplicit = true;
488
+ }
489
+ if (hasConvention && hasExplicit) throw new RouterError(`Controller "${ControllerClass.name}" registration failed: Cannot mix @Route() with HTTP method decorators (@Get, @Post, etc.) in the same controller. Use one pattern or the other.`);
490
+ const routerHidden = routerConfig.hideFromDocs;
491
+ const controllerHidden = controllerOpts?.hideFromDocs ?? false;
492
+ const routerName = routerConfig.name;
493
+ const controllerName = controllerOpts?.name;
494
+ const effectiveNamePrefix = routerName && controllerName ? `${routerName}${controllerName}` : routerName ?? controllerName;
495
+ for (const { method: methodName, meta } of methodMetadata) {
496
+ const resolved = this.resolveMethodAndPath(meta, methodName, basePath, className);
497
+ if (!resolved) continue;
498
+ const methodThrottleMiddleware = getRateLimits(prototype, methodName).map(createThrottleMiddleware);
499
+ const effectiveMiddleware = Array.from(new Set([
500
+ ...routerConfig.middleware,
501
+ ...classThrottleMiddleware,
502
+ ...methodThrottleMiddleware
503
+ ]));
504
+ const middlewareNames = effectiveMiddleware.map((m) => m.name);
505
+ const { httpMethod, fullPath, routeConfig: rawRouteConfig, statusCodeOverride } = resolved;
506
+ let mergedParams = rawRouteConfig.params;
507
+ if (routerConfig.params) {
508
+ const prefixShape = routerConfig.params.shape;
509
+ mergedParams = mergedParams ? mergedParams.extend(prefixShape) : routerConfig.params.extend({});
510
+ }
511
+ const routeConfig = mergedParams === rawRouteConfig.params ? rawRouteConfig : {
512
+ ...rawRouteConfig,
513
+ params: mergedParams
514
+ };
515
+ const hideFromDocs = routeConfig.hideFromDocs ?? routerHidden ?? controllerHidden;
516
+ let routeName;
517
+ if (routeConfig.name) routeName = effectiveNamePrefix ? `${effectiveNamePrefix}${routeConfig.name}` : routeConfig.name;
518
+ else if (meta.type === "convention") {
519
+ const autoName = generateConventionRouteName(basePath, methodName);
520
+ routeName = effectiveNamePrefix ? `${effectiveNamePrefix}${autoName}` : autoName;
521
+ }
522
+ const expandedRoutes = this.registry.register({
523
+ name: routeName,
524
+ method: httpMethod,
525
+ basePath: fullPath,
526
+ version: effectiveVersion,
527
+ domain: effectiveDomain,
528
+ controller: className,
529
+ action: methodName,
530
+ hidden: hideFromDocs,
531
+ middleware: middlewareNames
532
+ });
533
+ const methodGuards = getMethodGuards(prototype, methodName)?.guards ?? [];
534
+ const allGuards = methodGuards.length > 0 ? [...controllerGuards, ...methodGuards] : controllerGuards;
535
+ const responseSchema = httpMethod !== "all" ? this.extractResponseSchema(routeConfig) : null;
536
+ const handler = this.createControllerHandler(ControllerClass, methodName, responseSchema);
537
+ for (const route of expandedRoutes) actions.set(route, () => {
538
+ if (effectiveDomain) {
539
+ const domainHandler = createDomainMiddleware(effectiveDomain);
540
+ this.app.use(route.path, domainHandler);
541
+ this.app.use(`${route.path}/*`, domainHandler);
542
+ }
543
+ if (allGuards.length > 0) this.logger.info(`Route guards`, {
544
+ controller: className,
545
+ method: httpMethod.toUpperCase(),
546
+ path: route.path,
547
+ methodName,
548
+ guardCount: allGuards.length
549
+ });
550
+ if (httpMethod === "all") {
551
+ this.logger.info(`Registering @All route`, {
552
+ controller: className,
553
+ path: route.path,
554
+ methodName
555
+ });
556
+ if (effectiveMiddleware.length > 0) this.app.use(route.path, createMiddlewareChain(effectiveMiddleware));
557
+ if (allGuards.length > 0) this.app.use(route.path, this.createGuardMiddleware(allGuards));
558
+ this.app.all(route.path, handler);
559
+ return;
560
+ }
561
+ const metadata = this.mergeMetadata(controllerOpts, routeConfig, ControllerClass, methodName);
562
+ const openApiRoute = this.buildOpenAPIRoute(httpMethod, route.path, routeConfig, metadata, meta.type === "convention" ? methodName : void 0, statusCodeOverride, route.isLocaleVariant ?? false);
563
+ this.logger.info(`Registering route`, {
564
+ controller: className,
565
+ method: httpMethod.toUpperCase(),
566
+ path: route.path,
567
+ methodName,
568
+ tags: metadata.tags,
569
+ hidden: route.hidden
570
+ });
571
+ const wrappedHandler = this.wrapHandlerWithChain(handler, effectiveMiddleware, allGuards);
572
+ this.app.openapi(openApiRoute, wrappedHandler);
573
+ if (!route.hidden) {
574
+ const { hide: _, ...specRoute } = openApiRoute;
575
+ this.app.openAPIRegistry.registerPath({
576
+ ...specRoute,
577
+ path: toOpenAPIPath(route.path)
578
+ });
579
+ }
580
+ });
581
+ }
582
+ }
583
+ /**
584
+ * Register a single WebSocket gateway route
585
+ */
586
+ registerGatewayForPath(GatewayClass, fullPath, guards) {
587
+ const onMsgMethod = getWsOnMessageMethod(GatewayClass);
588
+ const onCloseMethod = getWsOnCloseMethod(GatewayClass);
589
+ const onErrMethod = getWsOnErrorMethod(GatewayClass);
590
+ const wsHandler = this.upgradeWebSocketFn((c) => {
591
+ const gateway = new RouterContext(c).getContainer().resolve(GatewayClass);
592
+ const events = {};
593
+ const bindWsHandler = (method, onCatch) => {
594
+ return (evt, ws) => {
595
+ invokeHandler(gateway, method, evt, new GatewayContext(c, ws)).catch((err) => {
596
+ this.logger.error(`WebSocket ${method} handler error`, err, { gateway: GatewayClass.name });
597
+ onCatch?.(err, ws);
598
+ });
599
+ };
600
+ };
601
+ if (onMsgMethod) events.onMessage = bindWsHandler(onMsgMethod, (_err, ws) => ws.close(1011, "Internal Error"));
602
+ if (onCloseMethod) events.onClose = bindWsHandler(onCloseMethod);
603
+ else events.onClose = (_evt, ws) => {
604
+ ws.close();
605
+ };
606
+ if (onErrMethod) events.onError = bindWsHandler(onErrMethod);
607
+ return events;
608
+ });
609
+ this.nameHandler(wsHandler, GatewayClass.name, onMsgMethod ?? "[anonymous]", "ws");
610
+ this.logger.info("Registering WebSocket gateway", {
611
+ gateway: GatewayClass.name,
612
+ path: fullPath
613
+ });
614
+ const handlers = [];
615
+ if (guards.length > 0) {
616
+ this.logger.info("Gateway guards", {
617
+ gateway: GatewayClass.name,
618
+ path: fullPath,
619
+ guardCount: guards.length
620
+ });
621
+ handlers.push(this.createGuardMiddleware(guards));
622
+ }
623
+ handlers.push(wsHandler);
624
+ this.app.get(fullPath, ...handlers);
625
+ }
626
+ /**
627
+ * Create a guard execution middleware
628
+ *
629
+ * This middleware executes all guards for a route before the handler.
630
+ * Guards are executed in order; all must pass for the request to proceed.
631
+ *
632
+ * @param guards - Array of guards to execute
633
+ * @returns Hono middleware function
634
+ */
635
+ createGuardMiddleware(guards) {
636
+ const guardService = new GuardExecutionService(this.logger);
637
+ return async (c, next) => {
638
+ const ctx = new RouterContext(c);
639
+ const container = ctx.getContainer();
640
+ await guardService.executeGuards(guards, ctx, container);
641
+ await next();
642
+ };
643
+ }
644
+ /**
645
+ * Wrap a controller handler with a `scopedMiddleware → guards → handler`
646
+ * chain that runs *inside* the Hono route handler — after request
647
+ * validators have populated `c.req.valid(...)`. This is the only place
648
+ * we can run user middleware after `@hono/zod-openapi`'s validators in
649
+ * the same pipeline.
650
+ *
651
+ * Returns a Hono handler with the same signature as the original so
652
+ * `app.openapi(route, wrapped)` works transparently.
653
+ */
654
+ wrapHandlerWithChain(handler, scopedMiddleware, guards) {
655
+ if (scopedMiddleware.length === 0 && guards.length === 0) return handler;
656
+ const scopedChain = scopedMiddleware.length > 0 ? createMiddlewareChain(scopedMiddleware) : null;
657
+ const guardChain = guards.length > 0 ? this.createGuardMiddleware(guards) : null;
658
+ return async (c) => {
659
+ let captured;
660
+ const runHandler = async () => {
661
+ captured = await handler(c);
662
+ };
663
+ const runGuards = guardChain ? () => guardChain(c, runHandler) : runHandler;
664
+ const result = await (scopedChain ? () => scopedChain(c, runGuards) : runGuards)();
665
+ if (result instanceof Response) return result;
666
+ return captured;
667
+ };
668
+ }
669
+ /**
670
+ * Register wildcard route for non-RESTful controllers
671
+ */
672
+ registerWildcardRoute(ControllerClass, route) {
673
+ this.logger.info(`Registering wildcard route`, {
674
+ controller: ControllerClass.name,
675
+ route: `${route}/:path{.+}`,
676
+ method: "ALL"
677
+ });
678
+ const handler = this.createControllerHandler(ControllerClass, "handle");
679
+ this.app.all(route, handler);
680
+ this.app.all(`${route}/:path{.+}`, handler);
681
+ }
682
+ /**
683
+ * Resolve HTTP method, path, route config, and status code from route metadata.
684
+ */
685
+ resolveMethodAndPath(meta, methodName, basePath, className) {
686
+ if (meta.type === "convention") {
687
+ const derived = this.deriveHttpMethodAndPath(methodName, basePath);
688
+ if (!derived) throw new RouterError(`Cannot derive HTTP method/path for convention-based route "${className}.${methodName}". Ensure the method name follows the naming convention (e.g., index, create, show).`);
689
+ return {
690
+ httpMethod: derived.method,
691
+ fullPath: derived.path,
692
+ routeConfig: meta.config,
693
+ statusCodeOverride: meta.config.statusCode
694
+ };
695
+ }
696
+ return {
697
+ httpMethod: meta.method,
698
+ fullPath: this.joinPaths(basePath, meta.path),
699
+ routeConfig: meta.config,
700
+ statusCodeOverride: meta.config.statusCode
701
+ };
702
+ }
703
+ /**
704
+ * Join a base path and a route path, normalizing slashes
705
+ */
706
+ joinPaths(basePath, routePath) {
707
+ if (basePath.endsWith("/")) basePath = basePath.slice(0, -1);
708
+ if (routePath === "/" || routePath === "") return basePath || "/";
709
+ if (!routePath.startsWith("/")) routePath = "/" + routePath;
710
+ return basePath + routePath;
711
+ }
712
+ /**
713
+ * Auto-derive HTTP method and path from controller method name
714
+ * Uses HTTP_METHODS constant for RESTful convention mapping
715
+ */
716
+ deriveHttpMethodAndPath(methodName, basePath) {
717
+ if (!(methodName in HTTP_METHODS)) return null;
718
+ const mapping = HTTP_METHODS[methodName];
719
+ return {
720
+ method: mapping.method,
721
+ path: basePath + mapping.path
722
+ };
723
+ }
724
+ /**
725
+ * Merge controller-level and route-level metadata
726
+ * Tags are merged (appended), security is merged (union)
727
+ * Guards automatically add sessionCookie security if present
728
+ */
729
+ mergeMetadata(controllerOpts, routeConfig, ControllerClass, methodName) {
730
+ const tags = [...controllerOpts?.tags ?? [], ...routeConfig.tags ?? []];
731
+ const prototype = ControllerClass.prototype;
732
+ const hasMethodGuards = (getMethodGuards(prototype, methodName)?.guards.length ?? 0) > 0;
733
+ const hasControllerGuards = (getControllerGuards(ControllerClass)?.guards.length ?? 0) > 0;
734
+ const requiresAuth = hasMethodGuards || hasControllerGuards;
735
+ let security = [];
736
+ if (routeConfig.security !== void 0) security = [...controllerOpts?.security ?? [], ...routeConfig.security];
737
+ else if (controllerOpts?.security) security = controllerOpts.security;
738
+ if (requiresAuth && !security.includes(SECURITY_SCHEMES.SESSION_COOKIE)) security.push(SECURITY_SCHEMES.SESSION_COOKIE);
739
+ return {
740
+ tags,
741
+ security: security.length > 0 ? security.map((scheme) => ({ [scheme]: [] })) : []
742
+ };
743
+ }
744
+ /**
745
+ * Build OpenAPI route configuration from metadata
746
+ * Creates a route definition compatible with @hono/zod-openapi.
747
+ *
748
+ * Scoped middleware and guards are NOT attached to `route.middleware`
749
+ * here — they're composed into a wrapped handler in `collectRoutes` so
750
+ * they run after Hono's request validators. See `wrapHandlerWithChain`.
751
+ */
752
+ buildOpenAPIRoute(method, path, routeConfig, metadata, methodName, statusCodeOverride, hasLocaleParam = false) {
753
+ try {
754
+ const route = {
755
+ method,
756
+ path: toRoutingOpenAPIPath(path),
757
+ request: {},
758
+ responses: {},
759
+ hide: true
760
+ };
761
+ if (routeConfig.body) {
762
+ const bodySchema = this.isRouteBodyObject(routeConfig.body) ? routeConfig.body.schema : routeConfig.body;
763
+ const bodyContentType = this.isRouteBodyObject(routeConfig.body) ? routeConfig.body.contentType ?? "application/json" : DEFAULT_CONTENT_TYPE;
764
+ route.request = {
765
+ ...route.request,
766
+ body: { content: { [bodyContentType]: { schema: bodySchema } } }
767
+ };
768
+ }
769
+ if (routeConfig.query) route.request = {
770
+ ...route.request,
771
+ query: routeConfig.query
772
+ };
773
+ if (routeConfig.params) route.request = {
774
+ ...route.request,
775
+ params: routeConfig.params
776
+ };
777
+ const localeConfig = this.localePathService.localePathConfig;
778
+ if (hasLocaleParam && localeConfig) {
779
+ const localeParam = z.object({ locale: z.enum(localeConfig.prefixedLocales).openapi({ param: {
780
+ name: "locale",
781
+ in: "path"
782
+ } }).optional() });
783
+ route.request = {
784
+ ...route.request,
785
+ params: route.request.params ? route.request.params.extend(localeParam.shape) : localeParam
786
+ };
787
+ }
788
+ const successStatus = statusCodeOverride ?? (methodName && METHOD_STATUS_CODES[methodName]) ?? 200;
789
+ const responses = {};
790
+ const responseDef = routeConfig.response;
791
+ if (responseDef) if (typeof responseDef === "object" && "schema" in responseDef) responses[successStatus] = {
792
+ content: { [responseDef.contentType ?? "application/json"]: { schema: responseDef.schema } },
793
+ description: responseDef.description ?? `Response ${successStatus}`
794
+ };
795
+ else responses[successStatus] = {
796
+ content: { [DEFAULT_CONTENT_TYPE]: { schema: responseDef } },
797
+ description: `Response ${successStatus}`
798
+ };
799
+ for (const [statusStr, schema] of Object.entries(commonErrorSchemas)) {
800
+ const status = parseInt(statusStr);
801
+ responses[status] ??= schema;
802
+ }
803
+ route.responses = responses;
804
+ if (metadata.tags.length > 0) route.tags = metadata.tags;
805
+ if (metadata.security.length > 0) route.security = metadata.security;
806
+ if (routeConfig.description) route.description = routeConfig.description;
807
+ if (routeConfig.summary) route.summary = routeConfig.summary;
808
+ return (0, zod_exports.createRoute)(route);
809
+ } catch (error) {
810
+ throw new RouterError(`OpenAPI route registration failed for "${path}": ${error instanceof Error ? error.message : String(error)}`);
811
+ }
812
+ }
813
+ /**
814
+ * Check if a body definition is a RouteBodyObject (has schema key) vs bare ZodType
815
+ */
816
+ isRouteBodyObject(body) {
817
+ return typeof body === "object" && "schema" in body;
818
+ }
819
+ /**
820
+ * Resolve method parameter injections from the container
821
+ *
822
+ * @param prototype - Controller prototype
823
+ * @param methodName - Method name to get injections for
824
+ * @param container - Request-scoped container
825
+ * @returns Array of resolved dependencies in parameter order
826
+ */
827
+ resolveMethodInjections(prototype, methodName, container) {
828
+ const injections = getMethodInjections(prototype, methodName);
829
+ if (!injections.length) return [];
830
+ return injections.map((inj) => container.resolve(inj.token));
831
+ }
832
+ /**
833
+ * Name a handler function so Hono's inspectRoutes() can identify it.
834
+ * Format: `{type}:{Controller}.{method}` (e.g. `http:UsersController.create`)
835
+ */
836
+ nameHandler(fn, controller, method, type = "http") {
837
+ Object.defineProperty(fn, "name", { value: `${type}:${controller}.${method}` });
838
+ }
839
+ /**
840
+ * Create controller handler that resolves controller from request-scoped container
841
+ * This ensures each request gets a fresh controller with request-scoped context
842
+ */
843
+ createControllerHandler(ControllerClass, methodName, responseSchema = null) {
844
+ const handler = async (c) => {
845
+ const override = c.get("validationSuccessResponse");
846
+ if (override) return override;
847
+ const ctx = new RouterContext(c);
848
+ const requestContainer = ctx.getContainer();
849
+ const controller = requestContainer.resolve(ControllerClass);
850
+ const method = controller[methodName];
851
+ if (typeof method === "function") {
852
+ const injectedArgs = this.resolveMethodInjections(ControllerClass.prototype, methodName, requestContainer);
853
+ const response = await method.apply(controller, [ctx, ...injectedArgs]);
854
+ if (responseSchema && c.env.ENVIRONMENT !== "production") return this.validateResponse(response, responseSchema);
855
+ return response;
856
+ }
857
+ throw new RouterError(`Method "${methodName}" not found on controller "${ControllerClass.name}"`);
858
+ };
859
+ this.nameHandler(handler, ControllerClass.name, methodName);
860
+ return handler;
861
+ }
862
+ /**
863
+ * Extract the Zod schema from a RouteResponse definition.
864
+ * Returns null for non-JSON content types or when no response is defined.
865
+ */
866
+ extractResponseSchema(routeConfig) {
867
+ const responseDef = routeConfig.response;
868
+ if (!responseDef) return null;
869
+ if (this.isRouteResponseObject(responseDef)) {
870
+ if (!(responseDef.contentType ?? "application/json").includes("application/json")) return null;
871
+ return responseDef.schema;
872
+ }
873
+ return responseDef;
874
+ }
875
+ /**
876
+ * Check if a response definition is a RouteResponseObject (has schema key) vs bare ZodType
877
+ */
878
+ isRouteResponseObject(response) {
879
+ return typeof response === "object" && "schema" in response;
880
+ }
881
+ /**
882
+ * Validate a Response body against its declared Zod schema.
883
+ *
884
+ * Skips validation for:
885
+ * - Non-JSON content types
886
+ * - Empty bodies (204 No Content, 304 Not Modified)
887
+ *
888
+ * Clones the response to read the body without consuming the original stream.
889
+ */
890
+ async validateResponse(response, schema) {
891
+ const contentType = response.headers.get("content-type");
892
+ if (!contentType || !contentType.includes("application/json")) return response;
893
+ if (response.status === 204 || response.status === 304) return response;
894
+ const cloned = response.clone();
895
+ let body;
896
+ try {
897
+ body = await cloned.json();
898
+ } catch {
899
+ return response;
900
+ }
901
+ const result = schema.safeParse(body);
902
+ if (!result.success) throw new ResponseValidationError(result.error);
903
+ return response;
904
+ }
905
+ };
906
+ RouteRegistrationService = __decorate([
907
+ Singleton(),
908
+ __decorateParam(0, inject(LOGGER_TOKENS.LoggerService)),
909
+ __decorateParam(1, inject(ROUTER_TOKENS.RouteRegistry)),
910
+ __decorateParam(2, inject(ROUTER_TOKENS.RouterResolver, { isOptional: true })),
911
+ __decorateParam(3, inject(ROUTER_TOKENS.LocalePathService)),
912
+ __decorateParam(4, inject(ROUTER_TOKENS.HonoApp)),
913
+ __decorateParam(5, inject(DI_TOKENS.ModuleRegistry))
914
+ ], RouteRegistrationService);
915
+ //#endregion
916
+ export { ResponseValidationError as _, paginatedResponseSchema as a, uuidParamSchema as c, getRouteDecoratedMethods as d, getRouteMetadata as f, InvalidSignatureError as g, parseDomainPattern as h, errorResponseSchema as i, validationErrorResponseSchema as l, createDomainMiddleware as m, route_registration_service_exports as n, paginationQuerySchema as o, createMiddlewareChain as p, commonErrorSchemas as r, successMessageSchema as s, RouteRegistrationService as t, Route as u, SchemaValidationError as v, RouteNotFoundError as y };
917
+
918
+ //# sourceMappingURL=route-registration.service-D6vSwiKP.mjs.map