stratal 0.0.16 → 0.0.18

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 (181) hide show
  1. package/README.md +4 -0
  2. package/dist/bin/cloudflare-workers-loader.mjs +33 -1
  3. package/dist/bin/cloudflare-workers-loader.mjs.map +1 -1
  4. package/dist/bin/quarry.mjs +183 -55
  5. package/dist/bin/quarry.mjs.map +1 -1
  6. package/dist/cache/index.d.mts +2 -2
  7. package/dist/cache/index.d.mts.map +1 -1
  8. package/dist/cache/index.mjs +3 -11
  9. package/dist/cache/index.mjs.map +1 -1
  10. package/dist/{colors-DJaRDXoS.mjs → colors-BTAnQRGU.mjs} +1 -1
  11. package/dist/{colors-DJaRDXoS.mjs.map → colors-BTAnQRGU.mjs.map} +1 -1
  12. package/dist/{command-B-QH-Vu3.d.mts → command-B1YuV-UZ.d.mts} +2 -2
  13. package/dist/{command-B-QH-Vu3.d.mts.map → command-B1YuV-UZ.d.mts.map} +1 -1
  14. package/dist/{command-BvCOD6df.mjs → command-DjGqCYHv.mjs} +7 -4
  15. package/dist/command-DjGqCYHv.mjs.map +1 -0
  16. package/dist/config/index.d.mts +2 -2
  17. package/dist/config/index.mjs +12 -20
  18. package/dist/config/index.mjs.map +1 -1
  19. package/dist/consumer-registry-BkuHXR_u.d.mts +142 -0
  20. package/dist/consumer-registry-BkuHXR_u.d.mts.map +1 -0
  21. package/dist/cron/index.d.mts +3 -116
  22. package/dist/cron/index.d.mts.map +1 -1
  23. package/dist/cron/index.mjs +1 -4
  24. package/dist/{cron-manager-DR7fiG6o.mjs → cron-manager-1KnZvojs.mjs} +3 -3
  25. package/dist/{cron-manager-DR7fiG6o.mjs.map → cron-manager-1KnZvojs.mjs.map} +1 -1
  26. package/dist/cron-manager-BnEZquBL.d.mts +117 -0
  27. package/dist/cron-manager-BnEZquBL.d.mts.map +1 -0
  28. package/dist/di/index.d.mts +2 -2
  29. package/dist/di/index.mjs +3 -4
  30. package/dist/email/index.d.mts +3 -3
  31. package/dist/email/index.mjs +8 -17
  32. package/dist/email/index.mjs.map +1 -1
  33. package/dist/{en-DaewN8hc.mjs → en-3QnZwP-u.mjs} +10 -1
  34. package/dist/en-3QnZwP-u.mjs.map +1 -0
  35. package/dist/errors/index.d.mts +2 -2
  36. package/dist/errors/index.mjs +2 -4
  37. package/dist/errors--RBIvDXr.mjs +1560 -0
  38. package/dist/errors--RBIvDXr.mjs.map +1 -0
  39. package/dist/{errors-H3TZnVeX.mjs → errors-B7hCnXgB.mjs} +2 -2
  40. package/dist/{errors-H3TZnVeX.mjs.map → errors-B7hCnXgB.mjs.map} +1 -1
  41. package/dist/events/index.d.mts +2 -2
  42. package/dist/events/index.mjs +1 -3
  43. package/dist/{events-CXl-o1Ad.mjs → events-UTJliZhl.mjs} +2 -3
  44. package/dist/{events-CXl-o1Ad.mjs.map → events-UTJliZhl.mjs.map} +1 -1
  45. package/dist/{gateway-context-BkZ4UKaX.mjs → gateway-context-BdBFoQd8.mjs} +66 -10
  46. package/dist/gateway-context-BdBFoQd8.mjs.map +1 -0
  47. package/dist/guards/index.d.mts +3 -3
  48. package/dist/guards/index.d.mts.map +1 -1
  49. package/dist/guards/index.mjs +1 -1
  50. package/dist/{guards-DUk_Kzst.mjs → guards-MtDgcHnF.mjs} +1 -1
  51. package/dist/{guards-DUk_Kzst.mjs.map → guards-MtDgcHnF.mjs.map} +1 -1
  52. package/dist/i18n/index.d.mts +3 -3
  53. package/dist/i18n/index.mjs +3 -16
  54. package/dist/i18n/messages/en/index.d.mts +1 -1
  55. package/dist/i18n/messages/en/index.mjs +1 -1
  56. package/dist/i18n/utils/index.d.mts +30 -0
  57. package/dist/i18n/utils/index.d.mts.map +1 -0
  58. package/dist/i18n/utils/index.mjs +2 -0
  59. package/dist/i18n/validation/index.d.mts +1 -1
  60. package/dist/i18n/validation/index.mjs +1 -1
  61. package/dist/i18n.module-BpLLLCTg.mjs +2462 -0
  62. package/dist/i18n.module-BpLLLCTg.mjs.map +1 -0
  63. package/dist/{index-D_w_Rmtd.d.mts → index-BDh9J2KD.d.mts} +10 -1
  64. package/dist/{index-D_w_Rmtd.d.mts.map → index-BDh9J2KD.d.mts.map} +1 -1
  65. package/dist/{index-Dp6A5ywM.d.mts → index-BR23zDMy.d.mts} +1 -1
  66. package/dist/{index-Dp6A5ywM.d.mts.map → index-BR23zDMy.d.mts.map} +1 -1
  67. package/dist/index-BrmS34sa.d.mts +4287 -0
  68. package/dist/index-BrmS34sa.d.mts.map +1 -0
  69. package/dist/{index-D9iYu2Yc.d.mts → index-DPxmo6AY.d.mts} +5 -144
  70. package/dist/index-DPxmo6AY.d.mts.map +1 -0
  71. package/dist/{index-DVhdhLvE.d.mts → index-Dfpd_ypO.d.mts} +38 -9
  72. package/dist/index-Dfpd_ypO.d.mts.map +1 -0
  73. package/dist/index.d.mts +4 -3
  74. package/dist/index.d.mts.map +1 -1
  75. package/dist/index.mjs +1 -20
  76. package/dist/{is-command-BfCgWAcQ.mjs → is-command-PvULqiTa.mjs} +2 -2
  77. package/dist/{is-command-BfCgWAcQ.mjs.map → is-command-PvULqiTa.mjs.map} +1 -1
  78. package/dist/{is-seeder-CebjZCDn.mjs → is-seeder-BN9Ej1r7.mjs} +1 -1
  79. package/dist/{is-seeder-CebjZCDn.mjs.map → is-seeder-BN9Ej1r7.mjs.map} +1 -1
  80. package/dist/logger/index.d.mts +1 -1
  81. package/dist/logger/index.mjs +1 -2
  82. package/dist/{logger-BR1-s1Um.mjs → logger-c0ftIK4G.mjs} +170 -4
  83. package/dist/logger-c0ftIK4G.mjs.map +1 -0
  84. package/dist/module/index.d.mts +3 -119
  85. package/dist/module/index.d.mts.map +1 -1
  86. package/dist/module/index.mjs +1 -11
  87. package/dist/module-C3YZ-kZN.mjs +719 -0
  88. package/dist/module-C3YZ-kZN.mjs.map +1 -0
  89. package/dist/openapi/index.d.mts +54 -54
  90. package/dist/openapi/index.d.mts.map +1 -1
  91. package/dist/openapi/index.mjs +3 -16
  92. package/dist/openapi-tools.service-B77QXD56.mjs +197 -0
  93. package/dist/openapi-tools.service-B77QXD56.mjs.map +1 -0
  94. package/dist/openapi.service-6yj0BUY4.d.mts +50 -0
  95. package/dist/openapi.service-6yj0BUY4.d.mts.map +1 -0
  96. package/dist/quarry/index.d.mts +124 -29
  97. package/dist/quarry/index.d.mts.map +1 -1
  98. package/dist/quarry/index.mjs +5 -7
  99. package/dist/quarry-registry-CQCIlYTO.mjs +686 -0
  100. package/dist/quarry-registry-CQCIlYTO.mjs.map +1 -0
  101. package/dist/queue/index.d.mts +2 -1
  102. package/dist/queue/index.mjs +3 -14
  103. package/dist/queue/index.mjs.map +1 -1
  104. package/dist/{queue.module-BZvmeAMj.mjs → queue.module-DIjD6nr-.mjs} +39 -42
  105. package/dist/queue.module-DIjD6nr-.mjs.map +1 -0
  106. package/dist/{resend.provider-BCCACQAU.mjs → resend.provider-Bvw36rQy.mjs} +1 -4
  107. package/dist/{resend.provider-BCCACQAU.mjs.map → resend.provider-Bvw36rQy.mjs.map} +1 -1
  108. package/dist/router/index.d.mts +2 -2
  109. package/dist/router/index.mjs +5 -16
  110. package/dist/{s3-storage.provider-BLlzQYiJ.mjs → s3-storage.provider-BAhHDMI3.mjs} +16 -9
  111. package/dist/s3-storage.provider-BAhHDMI3.mjs.map +1 -0
  112. package/dist/seeder/index.d.mts +3 -4
  113. package/dist/seeder/index.d.mts.map +1 -1
  114. package/dist/seeder/index.mjs +2 -7
  115. package/dist/{seeder-Cupi5jl-.mjs → seeder-D7VXULXB.mjs} +20 -17
  116. package/dist/seeder-D7VXULXB.mjs.map +1 -0
  117. package/dist/setup-BRIN-iYT.mjs +37 -0
  118. package/dist/setup-BRIN-iYT.mjs.map +1 -0
  119. package/dist/{smtp.provider-B8XtOcHU.mjs → smtp.provider-CAwpvzvD.mjs} +1 -4
  120. package/dist/{smtp.provider-B8XtOcHU.mjs.map → smtp.provider-CAwpvzvD.mjs.map} +1 -1
  121. package/dist/storage/index.d.mts +2 -195
  122. package/dist/storage/index.d.mts.map +1 -1
  123. package/dist/storage/index.mjs +2 -14
  124. package/dist/storage/providers/index.d.mts +273 -0
  125. package/dist/storage/providers/index.d.mts.map +1 -0
  126. package/dist/storage/providers/index.mjs +2 -0
  127. package/dist/{storage-By_ow2o_.mjs → storage-CJ-QOwNv.mjs} +8 -9
  128. package/dist/storage-CJ-QOwNv.mjs.map +1 -0
  129. package/dist/storage-provider.interface-YRtyYBxV.d.mts +203 -0
  130. package/dist/storage-provider.interface-YRtyYBxV.d.mts.map +1 -0
  131. package/dist/stratal-B7G4i9-N.mjs +502 -0
  132. package/dist/stratal-B7G4i9-N.mjs.map +1 -0
  133. package/dist/{types-DahElfUw.d.mts → types-CN0zONAZ.d.mts} +2 -2
  134. package/dist/types-CN0zONAZ.d.mts.map +1 -0
  135. package/dist/{usage-generator-C9hWziY4.mjs → usage-generator-Cl1HPlUp.mjs} +2 -2
  136. package/dist/{usage-generator-C9hWziY4.mjs.map → usage-generator-Cl1HPlUp.mjs.map} +1 -1
  137. package/dist/{validation-Bh875Lyg.mjs → validation-B4bePOa_.mjs} +5 -5
  138. package/dist/{validation-Bh875Lyg.mjs.map → validation-B4bePOa_.mjs.map} +1 -1
  139. package/dist/websocket/index.d.mts +2 -2
  140. package/dist/websocket/index.d.mts.map +1 -1
  141. package/dist/websocket/index.mjs +1 -5
  142. package/dist/workers/index.d.mts +1 -1
  143. package/dist/workers/index.d.mts.map +1 -1
  144. package/dist/workers/index.mjs +2 -20
  145. package/dist/workers/index.mjs.map +1 -1
  146. package/package.json +39 -31
  147. package/dist/application-zG8b-pol.d.mts +0 -116
  148. package/dist/application-zG8b-pol.d.mts.map +0 -1
  149. package/dist/command-BvCOD6df.mjs.map +0 -1
  150. package/dist/decorate-D5j-d9_z.mjs +0 -171
  151. package/dist/decorate-D5j-d9_z.mjs.map +0 -1
  152. package/dist/en-DaewN8hc.mjs.map +0 -1
  153. package/dist/errors-CtCi1wn6.mjs +0 -707
  154. package/dist/errors-CtCi1wn6.mjs.map +0 -1
  155. package/dist/gateway-context-BkZ4UKaX.mjs.map +0 -1
  156. package/dist/i18n.module-W8OJxg3d.mjs +0 -1791
  157. package/dist/i18n.module-W8OJxg3d.mjs.map +0 -1
  158. package/dist/index-BJWm863C.d.mts +0 -2616
  159. package/dist/index-BJWm863C.d.mts.map +0 -1
  160. package/dist/index-D9iYu2Yc.d.mts.map +0 -1
  161. package/dist/index-DVhdhLvE.d.mts.map +0 -1
  162. package/dist/logger-BR1-s1Um.mjs.map +0 -1
  163. package/dist/middleware/index.d.mts +0 -2
  164. package/dist/middleware/index.mjs +0 -6
  165. package/dist/middleware-C0Ebzswy.mjs +0 -362
  166. package/dist/middleware-C0Ebzswy.mjs.map +0 -1
  167. package/dist/module-BgdxxzBe.mjs +0 -370
  168. package/dist/module-BgdxxzBe.mjs.map +0 -1
  169. package/dist/quarry-registry-DCwqVcRp.mjs +0 -310
  170. package/dist/quarry-registry-DCwqVcRp.mjs.map +0 -1
  171. package/dist/queue.module-BZvmeAMj.mjs.map +0 -1
  172. package/dist/router-context-BEJe9HEB.mjs +0 -264
  173. package/dist/router-context-BEJe9HEB.mjs.map +0 -1
  174. package/dist/s3-storage.provider-BLlzQYiJ.mjs.map +0 -1
  175. package/dist/seeder-Cupi5jl-.mjs.map +0 -1
  176. package/dist/storage-By_ow2o_.mjs.map +0 -1
  177. package/dist/stratal-CE0iTz4f.mjs +0 -305
  178. package/dist/stratal-CE0iTz4f.mjs.map +0 -1
  179. package/dist/types-CLhOhYsQ.d.mts +0 -64
  180. package/dist/types-CLhOhYsQ.d.mts.map +0 -1
  181. package/dist/types-DahElfUw.d.mts.map +0 -1
@@ -0,0 +1,4287 @@
1
+ import { t as Constructor } from "./types-CN0zONAZ.mjs";
2
+ import { t as index_d_exports } from "./index-BDh9J2KD.mjs";
3
+ import { _ as II18nService, a as index_d_exports$1, b as MessageParams, i as ZodError, o as z, t as OpenAPIHono, v as MessageKeyPrefix, y as MessageKeys } from "./index-Dfpd_ypO.mjs";
4
+ import { i as LoggerService, l as LogLevel } from "./index-BR23zDMy.mjs";
5
+ import { DependencyContainer, DependencyContainer as DependencyContainer$1, container as container$1, delay, inject as inject$1, injectable as injectable$1, instancePerContainerCachingFactory as instancePerContainerCachingFactory$1, singleton } from "tsyringe";
6
+ import { AsyncLocalStorage } from "node:async_hooks";
7
+ import { SSEMessage, SSEStreamingApi, SSEStreamingApi as SSEStreamingApi$1 } from "hono/streaming";
8
+ import { CoreContext } from "@intlify/core-base";
9
+ import { DetectorOptions } from "hono/language";
10
+ import { Context, MiddlewareHandler, Next } from "hono";
11
+ import { ContentfulStatusCode, RedirectStatusCode } from "hono/utils/http-status";
12
+ import { StreamingApi, StreamingApi as StreamingApi$1 } from "hono/utils/stream";
13
+ import InjectionToken$1, { default as InjectionToken$2 } from "tsyringe/dist/typings/providers/injection-token";
14
+
15
+ //#region src/errors/error-response.d.ts
16
+ type Environment = 'development' | 'staging' | 'production';
17
+ interface ErrorResponse {
18
+ /**
19
+ * Numeric error code for identification and escalation
20
+ * See error-codes.ts for the complete registry
21
+ */
22
+ code: number;
23
+ /**
24
+ * Human-readable error message
25
+ * Fixed per error type, not customizable
26
+ */
27
+ message: string;
28
+ /**
29
+ * ISO timestamp when the error occurred
30
+ */
31
+ timestamp: string;
32
+ /**
33
+ * Additional structured data about the error
34
+ * Only included in development environment
35
+ */
36
+ metadata?: Record<string, unknown>;
37
+ /**
38
+ * Stack trace for debugging
39
+ * Only included in development environment
40
+ */
41
+ stack?: string;
42
+ }
43
+ /**
44
+ * Type guard to check if an object is an ErrorResponse
45
+ */
46
+ declare function isErrorResponse(obj: unknown): obj is ErrorResponse;
47
+ //#endregion
48
+ //#region src/di/types.d.ts
49
+ /**
50
+ * Service scope for DI registration
51
+ *
52
+ * Maps directly to tsyringe's Lifecycle enum.
53
+ * Scope is specified at registration time via provider configuration,
54
+ * not at class decoration time.
55
+ *
56
+ * @example
57
+ * ```typescript
58
+ * // In module providers:
59
+ * { provide: MY_TOKEN, useClass: MyService, scope: Scope.Singleton }
60
+ *
61
+ * // In Application.ts:
62
+ * container.register(MY_TOKEN, MyService, Scope.Request)
63
+ * ```
64
+ */
65
+ declare enum Scope {
66
+ /** New instance per resolution (default) */
67
+ Transient = 0,
68
+ /** Single instance shared globally */
69
+ Singleton = 1,
70
+ /** New instance per child container (per request) */
71
+ Request = 3
72
+ }
73
+ /**
74
+ * Options for conditional binding with `when()` method
75
+ */
76
+ interface WhenOptions {
77
+ /**
78
+ * Cache predicate result after first evaluation.
79
+ * When true, the predicate is evaluated once and the result is reused.
80
+ * When false (default), predicate is evaluated on each resolution.
81
+ */
82
+ cache?: boolean;
83
+ }
84
+ /**
85
+ * Decorator function type for extend() method
86
+ *
87
+ * @template T The service type being decorated
88
+ */
89
+ type ExtensionDecorator<T> = (service: T, container: ContainerLike) => T;
90
+ /**
91
+ * Minimal container interface for decorator functions
92
+ * Avoids circular dependency with Container class
93
+ */
94
+ interface ContainerLike {
95
+ resolve<T>(token: InjectionToken$1<T>): T;
96
+ }
97
+ //#endregion
98
+ //#region src/di/conditional-binding-builder.d.ts
99
+ /**
100
+ * Container interface for predicate functions
101
+ * Using a minimal interface to avoid circular imports
102
+ */
103
+ interface PredicateContainer {
104
+ resolve<T>(token: InjectionToken$1<T>): T;
105
+ isRegistered<T>(token: InjectionToken$1<T>): boolean;
106
+ }
107
+ /**
108
+ * Initial builder returned by container.when()
109
+ */
110
+ interface ConditionalBindingBuilder {
111
+ /**
112
+ * Specify the token to conditionally bind
113
+ *
114
+ * @param token - DI token for the service
115
+ * @returns Builder for specifying implementations
116
+ */
117
+ use<T extends object>(token: InjectionToken$1<T>): ConditionalBindingUse<T>;
118
+ }
119
+ /**
120
+ * Builder after specifying token with use()
121
+ */
122
+ interface ConditionalBindingUse<T extends object> {
123
+ /**
124
+ * Specify the implementation when predicate returns true.
125
+ * Registration is completed immediately.
126
+ *
127
+ * If predicate is false at resolution time:
128
+ * - Uses `otherwise()` implementation if provided
129
+ * - Falls back to existing registration if available
130
+ * - Throws error if no fallback exists
131
+ *
132
+ * @param implementation - Service class to use when predicate is true
133
+ * @returns Builder for optional fallback specification
134
+ */
135
+ give(implementation: Constructor<T>): ConditionalBindingGive<T>;
136
+ }
137
+ /**
138
+ * Builder after specifying true implementation with give()
139
+ * Registration is already complete at this point.
140
+ */
141
+ interface ConditionalBindingGive<T extends object> {
142
+ /**
143
+ * Optionally specify a fallback implementation when predicate returns false.
144
+ * This re-registers with the explicit fallback instead of existing registration.
145
+ *
146
+ * @param implementation - Service class to use when predicate is false
147
+ */
148
+ otherwise(implementation: Constructor<T>): void;
149
+ }
150
+ /**
151
+ * Implementation of ConditionalBindingBuilder
152
+ *
153
+ * @internal
154
+ */
155
+ declare class ConditionalBindingBuilderImpl implements ConditionalBindingBuilder {
156
+ private readonly tsyringeContainer;
157
+ private readonly predicateContainer;
158
+ private readonly predicate;
159
+ private readonly options;
160
+ constructor(tsyringeContainer: DependencyContainer, predicateContainer: PredicateContainer, predicate: (container: PredicateContainer) => boolean, options: WhenOptions);
161
+ use<T extends object>(token: InjectionToken$1<T>): ConditionalBindingUse<T>;
162
+ }
163
+ //#endregion
164
+ //#region src/di/container.d.ts
165
+ /**
166
+ * Options for creating a Container instance
167
+ */
168
+ interface ContainerOptions {
169
+ /** Pre-created DependencyContainer */
170
+ container: DependencyContainer;
171
+ /** Whether this is a request-scoped container */
172
+ isRequestScoped?: boolean;
173
+ }
174
+ /**
175
+ * Unified Container for DI management
176
+ *
177
+ * Manages the two-tier container hierarchy:
178
+ * - Global scope: Singletons, base instances of request-scoped services
179
+ * - Request scope: Context-enriched instances per HTTP request
180
+ *
181
+ * @example Basic registration
182
+ * ```typescript
183
+ * import { container as tsyringeRootContainer } from 'tsyringe'
184
+ *
185
+ * const container = new Container({
186
+ * container: tsyringeRootContainer.createChildContainer()
187
+ * })
188
+ *
189
+ * container.register(I18nService)
190
+ * container.register(MY_TOKEN, MyService)
191
+ * container.registerSingleton(ConfigService)
192
+ * container.registerValue(MY_TOKEN, myInstance)
193
+ * ```
194
+ *
195
+ * @example Request scope (automatic lifecycle)
196
+ * ```typescript
197
+ * await container.runInRequestScope(routerContext, async (requestContainer) => {
198
+ * const i18n = requestContainer.resolve(I18N_TOKEN)
199
+ * })
200
+ * ```
201
+ */
202
+ declare class Container {
203
+ private readonly container;
204
+ private readonly isRequestScoped;
205
+ constructor(options: ContainerOptions);
206
+ /**
207
+ * Register a service with optional explicit token and scope
208
+ */
209
+ register<T extends object>(serviceClass: Constructor<T>, scope?: Scope): void;
210
+ register<T extends object>(token: InjectionToken$1<T>, serviceClass: Constructor<T>, scope?: Scope): void;
211
+ /**
212
+ * Register a service as singleton
213
+ */
214
+ registerSingleton<T extends object>(serviceClass: Constructor<T>): void;
215
+ registerSingleton<T extends object>(token: InjectionToken$1<T>, serviceClass: Constructor<T>): void;
216
+ /**
217
+ * Register a value (instance) directly
218
+ */
219
+ registerValue<T>(token: InjectionToken$1<T>, value: T): void;
220
+ /**
221
+ * Register with factory function
222
+ */
223
+ registerFactory<T>(token: InjectionToken$1<T>, factory: (container: Container) => T): void;
224
+ /**
225
+ * Register an alias to an existing token
226
+ */
227
+ registerExisting<T>(alias: InjectionToken$1<T>, target: InjectionToken$1<T>): void;
228
+ /**
229
+ * Resolve a service from the container
230
+ */
231
+ resolve<T>(token: InjectionToken$1<T>): T;
232
+ /**
233
+ * Check if a token is registered
234
+ */
235
+ isRegistered<T>(token: InjectionToken$1<T>): boolean;
236
+ /**
237
+ * Start a conditional binding with predicate evaluation
238
+ */
239
+ when(predicate: (container: PredicateContainer) => boolean, options?: WhenOptions): ConditionalBindingBuilder;
240
+ /**
241
+ * Replace a service registration with a decorated version
242
+ */
243
+ extend<T>(token: InjectionToken$1<T>, decorator: ExtensionDecorator<T>): void;
244
+ /**
245
+ * Run callback within request scope
246
+ *
247
+ * Creates a child container with fresh instances for services registered with `scope: Scope.Request`.
248
+ * Callback receives the request-scoped container as argument.
249
+ *
250
+ * Can only be called on global container (not request-scoped).
251
+ */
252
+ runInRequestScope<T>(routerContext: RouterContext, callback: (requestContainer: Container) => T | Promise<T>): Promise<T>;
253
+ /**
254
+ * Create request scope container
255
+ *
256
+ * Can only be called on global container (not request-scoped).
257
+ */
258
+ createRequestScope(routerContext: RouterContext): Container;
259
+ /**
260
+ * Get underlying tsyringe container
261
+ */
262
+ getTsyringeContainer(): DependencyContainer;
263
+ dispose(): void | Promise<void>;
264
+ }
265
+ //#endregion
266
+ //#region src/router/route-map.d.ts
267
+ /**
268
+ * Augmentable route map for type-safe URL generation.
269
+ *
270
+ * Users augment this interface via `declare module 'stratal/router'` to get
271
+ * autocomplete on `route()` calls and type-checked params.
272
+ * Generated automatically by `quarry route:types`.
273
+ *
274
+ * Follows the same augmentation pattern as `CustomEventRegistry` in `stratal/events`.
275
+ *
276
+ * @example
277
+ * ```typescript
278
+ * declare module 'stratal/router' {
279
+ * interface StratalRouteMap {
280
+ * 'users.index': { params: never }
281
+ * 'users.show': { params: { id: string } }
282
+ * 'tenant.dashboard': { params: { tenant: string } }
283
+ * }
284
+ * }
285
+ * ```
286
+ */
287
+ interface StratalRouteMap {}
288
+ /**
289
+ * All valid route names.
290
+ * Falls back to `string` when no routes are registered in StratalRouteMap.
291
+ */
292
+ type RouteName = keyof StratalRouteMap extends never ? string : Extract<keyof StratalRouteMap, string>;
293
+ /**
294
+ * Resolves the required params for a named route.
295
+ * When StratalRouteMap is augmented, provides type-safe param objects.
296
+ * Falls back to `Record<string, string> | undefined` for untyped routes.
297
+ */
298
+ type RouteParams<N extends RouteName> = N extends keyof StratalRouteMap ? StratalRouteMap[N] extends {
299
+ params: infer P;
300
+ } ? [P] extends [never] ? Record<string, string> | undefined : P : Record<string, string> | undefined : Record<string, string> | undefined;
301
+ /**
302
+ * Minimal route data for client-side URL generation.
303
+ * Contains only the fields needed by URL building logic — no server metadata.
304
+ */
305
+ interface SerializedRoute {
306
+ path: string;
307
+ paramNames: string[];
308
+ domain?: string;
309
+ domainParamNames: string[];
310
+ localePaths?: string[];
311
+ }
312
+ /**
313
+ * A record of named routes keyed by route name, used for client-side URL building.
314
+ * Serialized from `RouteRegistry.named()` on the server, consumed by `useRoute()` on the client.
315
+ */
316
+ type SerializedRoutes = Record<string, SerializedRoute>;
317
+ //#endregion
318
+ //#region src/di/tokens.d.ts
319
+ /**
320
+ * Token for the Container instance
321
+ * Used for injecting the Container into services that need dynamic resolution
322
+ */
323
+ declare const CONTAINER_TOKEN: unique symbol;
324
+ declare const DI_TOKENS: {
325
+ readonly CloudflareEnv: symbol;
326
+ readonly ExecutionContext: symbol;
327
+ readonly Container: typeof CONTAINER_TOKEN;
328
+ readonly Application: symbol;
329
+ readonly ModuleRegistry: symbol;
330
+ readonly ExceptionHandler: symbol;
331
+ readonly Database: symbol;
332
+ readonly Queue: symbol;
333
+ readonly ConsumerRegistry: symbol;
334
+ readonly Cron: symbol;
335
+ readonly EventRegistry: symbol;
336
+ readonly Quarry: symbol;
337
+ /**
338
+ * AuthContext: Use for services that need user authentication (userId).
339
+ */
340
+ readonly AuthContext: symbol;
341
+ readonly DurableObjectState: symbol;
342
+ readonly DurableObjectId: symbol;
343
+ };
344
+ type DIToken = typeof DI_TOKENS[keyof typeof DI_TOKENS];
345
+ //#endregion
346
+ //#region src/di/decorators/inject-param.decorator.d.ts
347
+ /**
348
+ * Metadata key for storing parameter injection information
349
+ */
350
+ declare const INJECT_PARAM_METADATA_KEY: unique symbol;
351
+ /**
352
+ * Describes a parameter injection
353
+ */
354
+ interface ParamInjection {
355
+ /** Parameter index in the method signature (0-based) */
356
+ index: number;
357
+ /** DI token to resolve */
358
+ token: InjectionToken$1;
359
+ }
360
+ /**
361
+ * Mark a method parameter for DI injection
362
+ *
363
+ * The parameter will be resolved from the request-scoped container
364
+ * when the controller method is invoked.
365
+ *
366
+ * @param token - DI token to resolve (class or symbol)
367
+ *
368
+ * @example With class token
369
+ * ```typescript
370
+ * async show(
371
+ * ctx: RouterContext,
372
+ * @InjectParam(UserService) userService: UserService
373
+ * ) { }
374
+ * ```
375
+ *
376
+ * @example With symbol token
377
+ * ```typescript
378
+ * async show(
379
+ * ctx: RouterContext,
380
+ * @InjectParam(DI_TOKENS.Cache) cache: ICacheService
381
+ * ) { }
382
+ * ```
383
+ */
384
+ declare function InjectParam<T>(token: InjectionToken$1<T>): ParameterDecorator;
385
+ /**
386
+ * Get method parameter injections
387
+ *
388
+ * @param target - Controller prototype
389
+ * @param propertyKey - Method name
390
+ * @returns Array of parameter injections sorted by index
391
+ */
392
+ declare function getMethodInjections(target: object, propertyKey: string | symbol): ParamInjection[];
393
+ //#endregion
394
+ //#region src/di/decorators.d.ts
395
+ /**
396
+ * Mark a class as injectable
397
+ *
398
+ * This decorator wraps tsyringe's `@injectable` decorator and optionally
399
+ * associates a token with the class. The actual lifecycle (Singleton, Request,
400
+ * Transient) is determined at registration time, not decoration time.
401
+ *
402
+ * **Lifecycle Control:**
403
+ * - Use `scope: Scope.Singleton` in module providers for singleton
404
+ * - Use `scope: Scope.Request` in module providers for request-scoped
405
+ * - Default is Transient (new instance per resolution)
406
+ *
407
+ * @param token - Optional DI token for service resolution
408
+ *
409
+ * @example Basic usage (no token)
410
+ * ```typescript
411
+ * @Transient()
412
+ * export class UserService {
413
+ * constructor(@inject(DI_TOKENS.Database) private db: DatabaseService) {}
414
+ * }
415
+ *
416
+ * // In module:
417
+ * @Module({
418
+ * providers: [UserService] // Transient by default
419
+ * })
420
+ * ```
421
+ *
422
+ * @example With token
423
+ * ```typescript
424
+ * @Transient(DI_TOKENS.ConnectionManager)
425
+ * export class ConnectionManager implements Disposable {
426
+ * // ...
427
+ * }
428
+ *
429
+ * // In Application.ts:
430
+ * container.register(DI_TOKENS.ConnectionManager, ConnectionManager, Scope.Request)
431
+ * ```
432
+ *
433
+ * @example Singleton via provider scope
434
+ * ```typescript
435
+ * @Transient()
436
+ * export class ConsumerRegistry {
437
+ * // ...
438
+ * }
439
+ *
440
+ * // In module:
441
+ * @Module({
442
+ * providers: [
443
+ * { provide: DI_TOKENS.ConsumerRegistry, useClass: ConsumerRegistry, scope: Scope.Singleton }
444
+ * ]
445
+ * })
446
+ * ```
447
+ */
448
+ declare function Transient<T>(token?: InjectionToken$1<T>): <TFunction extends abstract new (...args: never[]) => unknown>(target: TFunction) => TFunction;
449
+ //#endregion
450
+ //#region src/di/errors/conditional-binding-fallback.error.d.ts
451
+ /**
452
+ * ConditionalBindingFallbackError
453
+ *
454
+ * Thrown when a conditional binding predicate returns false but no fallback
455
+ * implementation was provided and no existing registration exists for the token.
456
+ *
457
+ * This typically indicates a misconfiguration in the DI setup where:
458
+ * - A `when().use().give()` chain was used without `otherwise()`
459
+ * - AND the token wasn't previously registered
460
+ * - AND the predicate evaluated to false at resolution time
461
+ */
462
+ declare class ConditionalBindingFallbackError extends ApplicationError {
463
+ constructor(token: string);
464
+ }
465
+ //#endregion
466
+ //#region src/di/errors/request-scope-operation-not-allowed.error.d.ts
467
+ /**
468
+ * RequestScopeOperationNotAllowedError
469
+ *
470
+ * Thrown when attempting to call a method that is not allowed on the current container scope.
471
+ * - `createRequestScope()` and `runInRequestScope()` can only be called on global containers
472
+ */
473
+ declare class RequestScopeOperationNotAllowedError extends ApplicationError {
474
+ constructor(methodName: string);
475
+ }
476
+ //#endregion
477
+ //#region src/di/container-storage.d.ts
478
+ /**
479
+ * AsyncLocalStorage for the application container.
480
+ *
481
+ * Set by `Application.initialize()` — all code from that point onward
482
+ * (Stratal handlers, TestingModuleBuilder, standalone functions like `route()`)
483
+ * can access the container without DI or static singletons.
484
+ *
485
+ * Follows the same pattern as `errorMapContextStorage` in `i18n/validation/validation.context.ts`.
486
+ */
487
+ declare const containerStorage: AsyncLocalStorage<Container>;
488
+ /**
489
+ * Get the application container from AsyncLocalStorage.
490
+ *
491
+ * @throws ContainerNotInitializedError if called outside `Application.initialize()` scope
492
+ */
493
+ declare function getContainer(): Container;
494
+ /**
495
+ * Run a function within a container context.
496
+ *
497
+ * @param container - The application container to store
498
+ * @param fn - The function to execute with container access
499
+ */
500
+ declare function runWithContainer<T>(container: Container, fn: () => T): T;
501
+ //#endregion
502
+ //#region src/env.d.ts
503
+ /**
504
+ * Cloudflare Worker Environment Bindings
505
+ *
506
+ * This interface defines the base environment bindings required by Stratal.
507
+ * Use TypeScript module augmentation to add your own application-specific bindings.
508
+ *
509
+ * @example
510
+ * ```typescript
511
+ * declare module 'stratal' {
512
+ * interface StratalEnv {
513
+ * DATABASE: D1Database
514
+ * NOTIFICATIONS_QUEUE: Queue
515
+ * }
516
+ * }
517
+ * ```
518
+ */
519
+ interface StratalEnv {
520
+ ENVIRONMENT: string;
521
+ CACHE: KVNamespace;
522
+ }
523
+ //#endregion
524
+ //#region src/router/constants.d.ts
525
+ /**
526
+ * Type-safe context keys for Hono router variables
527
+ * Using symbols to avoid string collisions
528
+ */
529
+ declare const ROUTER_CONTEXT_KEYS: {
530
+ readonly REQUEST_CONTAINER: "requestContainer";
531
+ readonly LOCALE: "locale";
532
+ };
533
+ /**
534
+ * Metadata keys for storing route and controller configuration
535
+ * Using symbols to avoid collisions with other decorators
536
+ */
537
+ declare const ROUTE_METADATA_KEYS: {
538
+ readonly CONTROLLER_ROUTE: symbol;
539
+ readonly CONTROLLER_OPTIONS: symbol;
540
+ readonly CONTROLLER_MIDDLEWARES: symbol;
541
+ readonly ROUTE_CONFIG: symbol;
542
+ readonly DECORATED_METHODS: symbol;
543
+ readonly AUTH_GUARD: symbol;
544
+ readonly GATEWAY_MARKER: symbol;
545
+ readonly WS_ON_MESSAGE: symbol;
546
+ readonly WS_ON_CLOSE: symbol;
547
+ readonly WS_ON_ERROR: symbol;
548
+ };
549
+ /**
550
+ * Security scheme identifiers for OpenAPI
551
+ * These reference the security scheme definitions in security.schemas.ts
552
+ */
553
+ declare const SECURITY_SCHEMES: {
554
+ readonly BEARER_AUTH: "bearerAuth";
555
+ readonly API_KEY: "apiKey";
556
+ readonly SESSION_COOKIE: "sessionCookie";
557
+ };
558
+ /**
559
+ * HTTP method mapping for RESTful controller methods
560
+ * Maps controller method names to HTTP verbs and path patterns
561
+ */
562
+ declare const HTTP_METHODS: {
563
+ readonly index: {
564
+ readonly method: "get";
565
+ readonly path: "";
566
+ };
567
+ readonly show: {
568
+ readonly method: "get";
569
+ readonly path: "/:id";
570
+ };
571
+ readonly create: {
572
+ readonly method: "post";
573
+ readonly path: "";
574
+ };
575
+ readonly update: {
576
+ readonly method: "put";
577
+ readonly path: "/:id";
578
+ };
579
+ readonly patch: {
580
+ readonly method: "patch";
581
+ readonly path: "/:id";
582
+ };
583
+ readonly destroy: {
584
+ readonly method: "delete";
585
+ readonly path: "/:id";
586
+ };
587
+ };
588
+ /**
589
+ * Sentinel symbol to opt a controller out of versioning.
590
+ * When used as the version, no prefix is applied even when defaultVersion is set.
591
+ */
592
+ declare const VERSION_NEUTRAL: unique symbol;
593
+ //#endregion
594
+ //#region src/router/types.d.ts
595
+ /**
596
+ * Route parameter type for OpenAPI
597
+ * ZodObject or ZodPipe (piped validation)
598
+ */
599
+ type ZodObjectWithEffect = index_d_exports$1.ZodObject<any> | index_d_exports$1.ZodPipe<any, any>;
600
+ type RouteParameter = ZodObjectWithEffect | undefined;
601
+ /**
602
+ * Hono context variables with type-safe keys
603
+ */
604
+ interface RouterVariables {
605
+ [ROUTER_CONTEXT_KEYS.REQUEST_CONTAINER]: Container;
606
+ [ROUTER_CONTEXT_KEYS.LOCALE]?: string;
607
+ /**
608
+ * When set by middleware, the defaultHook returns this response after
609
+ * successful validation — skipping the controller handler entirely.
610
+ * Used by packages like `@stratal/inertia` for precognition support.
611
+ */
612
+ validationSuccessResponse?: Response;
613
+ /** Domain parameters set by the domain matching middleware (e.g., `domain:tenant`) */
614
+ [key: `domain:${string}`]: string;
615
+ }
616
+ /**
617
+ * Hono environment type for router
618
+ */
619
+ interface RouterEnv {
620
+ Bindings: StratalEnv;
621
+ Variables: RouterVariables;
622
+ }
623
+ /**
624
+ * Security scheme identifier type
625
+ * Matches the keys in SECURITY_SCHEMES constant
626
+ */
627
+ type SecurityScheme = typeof SECURITY_SCHEMES[keyof typeof SECURITY_SCHEMES];
628
+ /**
629
+ * HTTP method type from OpenAPI spec
630
+ */
631
+ type HttpMethod = 'get' | 'post' | 'put' | 'delete' | 'patch' | 'head' | 'options' | 'trace' | 'all';
632
+ /**
633
+ * Object form for request body with optional content type
634
+ */
635
+ interface RouteBodyObject {
636
+ schema: index_d_exports$1.ZodType;
637
+ contentType?: string;
638
+ }
639
+ /**
640
+ * Request body definition for @Route() decorator
641
+ * Bare ZodType defaults to application/json
642
+ */
643
+ type RouteBody = index_d_exports$1.ZodType | RouteBodyObject;
644
+ /**
645
+ * Object form for response with optional description and content type
646
+ */
647
+ interface RouteResponseObject {
648
+ schema: index_d_exports$1.ZodType;
649
+ description?: string;
650
+ contentType?: string;
651
+ }
652
+ /**
653
+ * Single response definition for @Route() decorator
654
+ * Status code is auto-derived from method name (create->201, others->200)
655
+ */
656
+ type RouteResponse = index_d_exports$1.ZodType | RouteResponseObject;
657
+ /**
658
+ * Route configuration for @Route() decorator
659
+ * Defines OpenAPI metadata for a controller method
660
+ */
661
+ interface RouteConfig {
662
+ /**
663
+ * Request body schema (for POST, PUT, PATCH)
664
+ * @example z.object({}) or { schema: z.object({}), contentType: 'multipart/form-data' }
665
+ */
666
+ body?: RouteBody;
667
+ /**
668
+ * URL parameters schema (e.g., { id: z.string().uuid() })
669
+ * Must be ZodObject or ZodPipe for OpenAPI compatibility
670
+ */
671
+ params?: RouteParameter;
672
+ /**
673
+ * Query parameters schema (e.g., pagination, filters)
674
+ * Must be ZodObject or ZodPipe for OpenAPI compatibility
675
+ */
676
+ query?: RouteParameter;
677
+ /**
678
+ * Response schema for success case
679
+ * Status code auto-derived: create()->201, others->200
680
+ * @example userSchema or { schema: userSchema, description: 'User details' }
681
+ */
682
+ response: RouteResponse;
683
+ /**
684
+ * OpenAPI tags for grouping endpoints
685
+ * Merged with controller-level tags
686
+ */
687
+ tags?: string[];
688
+ /**
689
+ * Security schemes required for this route
690
+ * Merged with controller-level security
691
+ * Empty array = public route (no auth)
692
+ */
693
+ security?: SecurityScheme[];
694
+ /**
695
+ * Human-readable description for OpenAPI docs
696
+ */
697
+ description?: string;
698
+ /**
699
+ * Detailed summary for OpenAPI docs
700
+ */
701
+ summary?: string;
702
+ /**
703
+ * Hide this route from OpenAPI documentation
704
+ * Route remains functional but won't appear in /api/docs or /api/openapi.json
705
+ * Useful for internal-only endpoints, debug routes, or work-in-progress features
706
+ */
707
+ hideFromDocs?: boolean;
708
+ /**
709
+ * HTTP success status code for the response
710
+ * Used by HTTP method decorators (@Get, @Post, etc.) to set the success status
711
+ * For @Route() decorator, status code is auto-derived from method name
712
+ */
713
+ statusCode?: number;
714
+ /**
715
+ * Explicit route name for URL generation.
716
+ * Used with the `route()` helper and type generation.
717
+ * For convention-based @Route(), names are auto-generated if not provided.
718
+ * For explicit @Get/@Post/etc., names must be provided manually.
719
+ *
720
+ * @example 'users.show', 'health.check'
721
+ */
722
+ name?: string;
723
+ }
724
+ /**
725
+ * Metadata for convention-based routes (@Route decorator)
726
+ * HTTP method and path are auto-derived from the method name
727
+ */
728
+ interface ConventionRouteMetadata {
729
+ type: 'convention';
730
+ config: RouteConfig;
731
+ }
732
+ /**
733
+ * Metadata for explicit routes (@Get, @Post, @Put, @Patch, @Delete, @All decorators)
734
+ * HTTP method and path are explicitly specified
735
+ */
736
+ interface ExplicitRouteMetadata {
737
+ type: 'explicit';
738
+ method: HttpMethod;
739
+ path: string;
740
+ config: RouteConfig;
741
+ }
742
+ /**
743
+ * Discriminated union for all route metadata
744
+ * Stored under a single metadata key for unified registration
745
+ */
746
+ type RouteMetadata = ConventionRouteMetadata | ExplicitRouteMetadata;
747
+ /**
748
+ * Controller options for @Controller() decorator
749
+ * Provides default configuration for all routes in the controller
750
+ */
751
+ interface ControllerOptions {
752
+ /**
753
+ * Default tags applied to all routes in this controller
754
+ * Routes can append additional tags
755
+ */
756
+ tags?: string[];
757
+ /**
758
+ * Default security schemes applied to all routes
759
+ * Routes can add more schemes or override with empty array
760
+ */
761
+ security?: SecurityScheme[];
762
+ /**
763
+ * Hide all routes in this controller from OpenAPI documentation
764
+ * Routes remain functional but won't appear in /api/docs or /api/openapi.json
765
+ * Can be overridden at route level with hideFromDocs: false
766
+ * Useful for internal-only controllers, debug endpoints, or utilities
767
+ */
768
+ hideFromDocs?: boolean;
769
+ /**
770
+ * API version(s) for this controller.
771
+ * When versioning is enabled, routes are prefixed with the version (e.g., /v1/users).
772
+ * Use VERSION_NEUTRAL to opt out of versioning (no prefix applied).
773
+ * Can be a single version string, array of versions, or VERSION_NEUTRAL symbol.
774
+ */
775
+ version?: string | string[] | typeof VERSION_NEUTRAL;
776
+ /**
777
+ * Route name prefix for this controller.
778
+ * Prepended to all route names in this controller.
779
+ * Overrides the Router-level name prefix entirely.
780
+ *
781
+ * @example 'admin.' — routes become 'admin.users.index', 'admin.users.show'
782
+ */
783
+ name?: string;
784
+ /**
785
+ * Domain pattern for this controller.
786
+ * Overrides the Router-level domain.
787
+ * Use `{param}` for dynamic subdomain segments.
788
+ *
789
+ * @example '{tenant}.myapp.com', 'admin.myapp.com'
790
+ */
791
+ domain?: string;
792
+ }
793
+ /**
794
+ * Versioning configuration for the application.
795
+ * Enables URI-based API versioning when provided to Stratal config.
796
+ */
797
+ interface VersioningOptions {
798
+ /**
799
+ * Prefix for version segments in the URL.
800
+ * @default 'v'
801
+ * @example 'v' produces /v1, /v2; 'api/v' produces /api/v1, /api/v2
802
+ */
803
+ prefix?: string;
804
+ /**
805
+ * Default version applied to controllers without explicit version.
806
+ * Controllers with VERSION_NEUTRAL are not affected.
807
+ */
808
+ defaultVersion?: string | string[];
809
+ }
810
+ /**
811
+ * Locale path configuration for route registration.
812
+ * Controls how locale prefixes are applied to route paths.
813
+ *
814
+ * Built from {@link I18nModuleOptions} when path-based locale detection is enabled.
815
+ */
816
+ interface LocalePathConfig {
817
+ /** All supported locale codes (e.g., `['en', 'fr']`) */
818
+ allLocales: string[];
819
+ /**
820
+ * Locales that require a `/{locale}` path prefix.
821
+ * Excludes `defaultLocale` when `prefixDefaultLocale` is not `true`.
822
+ */
823
+ prefixedLocales: string[];
824
+ /**
825
+ * The default locale used as the unprefixed root, derived from
826
+ * {@link I18nModuleOptions.defaultLocale}.
827
+ * `null` when all locales are prefixed (`prefixDefaultLocale: true`).
828
+ */
829
+ defaultLocale: string | null;
830
+ }
831
+ //#endregion
832
+ //#region src/router/hono-app.d.ts
833
+ /**
834
+ * HonoApp — extends OpenAPIHono with Stratal-specific setup
835
+ *
836
+ * - Request scope middleware (child container per request)
837
+ * - Global middleware (CORS, logging, error handling)
838
+ * - defaultHook for validation errors
839
+ * - `use()` overload for Stratal middleware classes
840
+ * - `configure()` for OpenAPI, routes, and 404
841
+ */
842
+ declare class HonoApp extends OpenAPIHono<RouterEnv> {
843
+ private configured;
844
+ private readonly _container;
845
+ private readonly _logger;
846
+ /**
847
+ * Reference to the original Hono `use` implementation.
848
+ * Captured in constructor after super() sets it as an instance property.
849
+ * Used by private methods to register middleware without going through the override.
850
+ */
851
+ private nativeUse;
852
+ constructor(container: Container, logger: LoggerService);
853
+ /**
854
+ * Apply global middleware (logger + error handler).
855
+ * Called by Application after locale middleware is applied by LocalePathService.
856
+ */
857
+ private applyGlobalMiddleware;
858
+ /**
859
+ * Configure OpenAPI endpoints, controller routes, and 404 handler.
860
+ * Called once by Application.initialize().
861
+ */
862
+ configure(): Promise<void>;
863
+ private setupRequestScope;
864
+ private handleException;
865
+ }
866
+ //#endregion
867
+ //#region src/router/services/locale-path.service.d.ts
868
+ /**
869
+ * A resolved path with locale variant metadata.
870
+ */
871
+ interface ResolvedPath {
872
+ /** The fully resolved path (may include /:locale prefix) */
873
+ path: string;
874
+ /** Whether this path is a locale-prefixed variant */
875
+ isLocaleVariant: boolean;
876
+ }
877
+ /**
878
+ * Resolves locale path variants for route paths.
879
+ *
880
+ * Computes `LocalePathConfig` from `I18nModuleOptions` and provides
881
+ * path expansion for locale-prefixed route variants.
882
+ *
883
+ * Also applies language detection and default locale redirect middleware
884
+ * to HonoApp when resolved from the container.
885
+ *
886
+ * Registered as a singleton in the container.
887
+ */
888
+ declare class LocalePathService {
889
+ private readonly honoApp;
890
+ private readonly _config;
891
+ private readonly _pathDetectionEnabled;
892
+ private readonly _prefixDefaultLocale;
893
+ constructor(container: Container, honoApp: HonoApp);
894
+ /** Whether path-based locale detection is enabled */
895
+ get enabled(): boolean;
896
+ /** The computed locale path config, or null if path detection is disabled */
897
+ get localePathConfig(): LocalePathConfig | null;
898
+ /** The prefixDefaultLocale setting (false, true, or 'redirect') */
899
+ get prefixDefaultLocale(): false | true | 'redirect';
900
+ /**
901
+ * Expand a path into primary + locale-prefixed variants.
902
+ *
903
+ * @param path - The base path to expand
904
+ * @returns Array of resolved paths with locale metadata
905
+ */
906
+ resolve(path: string): ResolvedPath[];
907
+ /**
908
+ * Build a Hono regex constraint from prefixed locales.
909
+ * e.g., `{en|de|fr}` — restricts `:locale` to only match known values.
910
+ */
911
+ private buildLocaleConstraint;
912
+ /**
913
+ * Apply Hono's languageDetector middleware and bridge the detected language
914
+ * to Stratal's LOCALE context variable.
915
+ */
916
+ private setupLanguageDetection;
917
+ /**
918
+ * Redirect requests that include the default locale prefix to the unprefixed path.
919
+ * For example, `/en/users` → 301 redirect to `/users`.
920
+ *
921
+ * Only active when `prefixDefaultLocale` is `'redirect'`.
922
+ */
923
+ private setupDefaultLocaleRedirect;
924
+ }
925
+ //#endregion
926
+ //#region src/execution-context.d.ts
927
+ interface StratalExecutionContext {
928
+ waitUntil(promise: Promise<unknown>): void;
929
+ }
930
+ //#endregion
931
+ //#region src/errors/exception-handler.types.d.ts
932
+ /**
933
+ * Log severity levels for exception reporting.
934
+ */
935
+ type LogSeverity = 'error' | 'warn' | 'info' | 'debug';
936
+ /**
937
+ * Callback invoked when a specific exception type is reported.
938
+ *
939
+ * @typeParam T - The exception type this callback handles
940
+ * @param error - The matched exception instance
941
+ * @param context - The execution context where the error occurred
942
+ */
943
+ type ReportableCallback<T extends ApplicationError> = (error: T, context: ExceptionContext) => void | Promise<void>;
944
+ /**
945
+ * Callback invoked to render a specific exception type into a Response.
946
+ *
947
+ * Return `undefined` to fall through to the default renderer.
948
+ *
949
+ * @typeParam T - The exception type this callback handles
950
+ * @param error - The matched exception instance
951
+ * @param context - The execution context where the error occurred
952
+ * @returns A Response, ErrorResponse, or undefined to fall through
953
+ */
954
+ type RenderableCallback<T extends ApplicationError> = (error: T, context: ExceptionContext) => Response | ErrorResponse | Promise<Response> | undefined;
955
+ /**
956
+ * Callback invoked to post-process every error Response before it is returned.
957
+ *
958
+ * Use this to add headers, change the response body, swap content type, etc.
959
+ *
960
+ * @param response - The rendered Response
961
+ * @param error - The original exception
962
+ * @param context - The execution context where the error occurred
963
+ * @returns The (possibly modified) Response
964
+ */
965
+ type RespondCallback = (response: Response, error: ApplicationError, context: ExceptionContext) => Response;
966
+ /**
967
+ * Callback that returns additional context data to include in all exception logs.
968
+ *
969
+ * @returns Key-value pairs merged into every log entry
970
+ */
971
+ type ContextCallback = () => Record<string, unknown>;
972
+ /**
973
+ * Handle returned by `reportable()` to control whether default reporting runs.
974
+ */
975
+ interface Reportable {
976
+ /**
977
+ * Prevent the default logger from reporting this exception
978
+ * after the custom reportable callback has run.
979
+ */
980
+ stop(): void;
981
+ }
982
+ /**
983
+ * Constructor type for ApplicationError subclasses.
984
+ */
985
+ type ApplicationErrorConstructor<T extends ApplicationError = ApplicationError> = new (...args: any[]) => T;
986
+ //#endregion
987
+ //#region src/errors/exception-handler.d.ts
988
+ /**
989
+ * ExceptionHandler — Laravel-inspired exception handling for Stratal.
990
+ *
991
+ * Provides a composable, expressive API for controlling how exceptions are
992
+ * reported (logged / sent to external services) and rendered (turned into
993
+ * HTTP Responses or ErrorResponse objects).
994
+ *
995
+ * **Lifecycle:**
996
+ * 1. The framework resolves this from the DI container (once at init time).
997
+ * 2. `register()` is called to let the user configure reporting / rendering.
998
+ * 3. Module `onException()` hooks contribute additional configuration.
999
+ * 4. On every error, `handle()` runs the pipeline: normalize → report → render → respond.
1000
+ *
1001
+ * **Usage — extend and override `register()`:**
1002
+ *
1003
+ * @example
1004
+ * ```typescript
1005
+ * export class AppExceptionHandler extends ExceptionHandler {
1006
+ * register(): void {
1007
+ * this.reportable(PaymentError, (e, ctx) => {
1008
+ * this.resolve(SentryService).captureException(e)
1009
+ * }).stop()
1010
+ *
1011
+ * this.renderable(MaintenanceError, (e, ctx) => {
1012
+ * if (ctx.type === 'http') return ctx.ctx.html('<h1>Maintenance</h1>', 503)
1013
+ * })
1014
+ *
1015
+ * this.dontReport([RouteNotFoundError])
1016
+ * this.level(RecordNotFoundError, 'warn')
1017
+ * this.context(() => ({ region: 'us-east-1' }))
1018
+ * this.respond((res, err) => {
1019
+ * res.headers.set('X-Error-Code', String(err.code))
1020
+ * return res
1021
+ * })
1022
+ * }
1023
+ * }
1024
+ * ```
1025
+ */
1026
+ declare abstract class ExceptionHandler {
1027
+ protected readonly logger: LoggerService;
1028
+ protected readonly env: StratalEnv;
1029
+ private readonly container;
1030
+ private readonly executionContext;
1031
+ private readonly reportables;
1032
+ private readonly renderables;
1033
+ private readonly dontReportSet;
1034
+ private readonly levelOverrides;
1035
+ private readonly contextCallbacks;
1036
+ private readonly respondCallbacks;
1037
+ private readonly environment;
1038
+ constructor(logger: LoggerService, env: StratalEnv, container: Container, executionContext: StratalExecutionContext);
1039
+ /**
1040
+ * Configure exception reporting and rendering.
1041
+ *
1042
+ * Override this method in your handler class to register custom
1043
+ * `reportable()`, `renderable()`, `dontReport()`, `level()`,
1044
+ * `context()`, and `respond()` callbacks.
1045
+ */
1046
+ abstract register(): void;
1047
+ /**
1048
+ * Register a custom reporting callback for a specific exception type.
1049
+ *
1050
+ * The callback is invoked when an error matching `errorClass` (via `instanceof`)
1051
+ * is thrown. Chain `.stop()` to prevent the default logger from also reporting.
1052
+ *
1053
+ * @typeParam T - The exception type to match
1054
+ * @param errorClass - Constructor of the exception to match
1055
+ * @param callback - Reporting function receiving the typed error and context
1056
+ * @returns A {@link Reportable} with a `stop()` method
1057
+ *
1058
+ * @example
1059
+ * ```typescript
1060
+ * this.reportable(PaymentError, (e, ctx) => {
1061
+ * sentry.captureException(e)
1062
+ * }).stop() // skip default logging
1063
+ * ```
1064
+ */
1065
+ reportable<T extends ApplicationError>(errorClass: ApplicationErrorConstructor<T>, callback: ReportableCallback<T>): Reportable;
1066
+ /**
1067
+ * Register a custom rendering callback for a specific exception type.
1068
+ *
1069
+ * The callback should return a `Response` (for HTTP contexts), an `ErrorResponse`,
1070
+ * or `undefined` to fall through to the default renderer.
1071
+ *
1072
+ * @typeParam T - The exception type to match
1073
+ * @param errorClass - Constructor of the exception to match
1074
+ * @param callback - Rendering function receiving the typed error and context
1075
+ *
1076
+ * @example
1077
+ * ```typescript
1078
+ * this.renderable(MaintenanceError, (e, ctx) => {
1079
+ * if (ctx.type === 'http') {
1080
+ * return ctx.ctx.html('<h1>Down for maintenance</h1>', 503)
1081
+ * }
1082
+ * })
1083
+ * ```
1084
+ */
1085
+ renderable<T extends ApplicationError>(errorClass: ApplicationErrorConstructor<T>, callback: RenderableCallback<T>): void;
1086
+ /**
1087
+ * Suppress reporting (logging) for the given exception types.
1088
+ *
1089
+ * Errors matching these classes will still be rendered into responses
1090
+ * but will not be logged or sent to external reporters.
1091
+ *
1092
+ * @param errorClasses - Array of exception constructors to suppress
1093
+ *
1094
+ * @example
1095
+ * ```typescript
1096
+ * this.dontReport([RouteNotFoundError, SchemaValidationError])
1097
+ * ```
1098
+ */
1099
+ dontReport(errorClasses: ApplicationErrorConstructor[]): void;
1100
+ /**
1101
+ * Override the log severity for a specific exception type.
1102
+ *
1103
+ * By default, severity is derived from the error code range.
1104
+ * Use this to promote or demote specific errors.
1105
+ *
1106
+ * @param errorClass - Constructor of the exception to override
1107
+ * @param severity - The log severity to use
1108
+ *
1109
+ * @example
1110
+ * ```typescript
1111
+ * this.level(RecordNotFoundError, 'warn')
1112
+ * ```
1113
+ */
1114
+ level(errorClass: ApplicationErrorConstructor, severity: LogSeverity): void;
1115
+ /**
1116
+ * Add global context data to all exception log entries.
1117
+ *
1118
+ * The callback is invoked on every reported error and its return value
1119
+ * is merged into the log data.
1120
+ *
1121
+ * @param callback - Function returning key-value pairs to include in logs
1122
+ *
1123
+ * @example
1124
+ * ```typescript
1125
+ * this.context(() => ({
1126
+ * appVersion: '1.2.3',
1127
+ * region: env.CF_REGION,
1128
+ * }))
1129
+ * ```
1130
+ */
1131
+ context(callback: ContextCallback): void;
1132
+ /**
1133
+ * Register a callback to post-process every error Response before it is returned.
1134
+ *
1135
+ * Use this to add headers, modify the body, change content type, or
1136
+ * transform the response in any way.
1137
+ *
1138
+ * @param callback - Function receiving (response, error, context) and returning a Response
1139
+ *
1140
+ * @example
1141
+ * ```typescript
1142
+ * this.respond((response, error, ctx) => {
1143
+ * response.headers.set('X-Error-Code', String(error.code))
1144
+ * return response
1145
+ * })
1146
+ * ```
1147
+ */
1148
+ respond(callback: RespondCallback): void;
1149
+ /**
1150
+ * Resolve a service from the DI container.
1151
+ *
1152
+ * Useful inside `register()` callbacks for accessing injected services
1153
+ * (e.g., Sentry, analytics, custom loggers).
1154
+ *
1155
+ * @typeParam T - The type of the service to resolve
1156
+ * @param token - DI token (symbol or constructor)
1157
+ * @returns The resolved service instance
1158
+ *
1159
+ * @example
1160
+ * ```typescript
1161
+ * this.reportable(CriticalError, (e) => {
1162
+ * this.resolve(SentryService).captureException(e)
1163
+ * })
1164
+ * ```
1165
+ */
1166
+ resolve<T>(token: symbol | (new (...args: unknown[]) => T)): T;
1167
+ /**
1168
+ * Handle an error through the full exception pipeline.
1169
+ *
1170
+ * This is the single entry point used by all contexts (HTTP, queue, cron, CLI).
1171
+ * It normalizes the error, reports it (non-blocking via `waitUntil`),
1172
+ * renders it into a Response, and applies post-processing.
1173
+ *
1174
+ * @param error - The thrown error (may or may not be an ApplicationError)
1175
+ * @param context - The execution context where the error occurred
1176
+ * @returns A Response (JSON by default, customizable via renderable/respond)
1177
+ */
1178
+ handle(error: unknown, context: ExceptionContext): Promise<Response>;
1179
+ /**
1180
+ * Normalize an unknown error into an ApplicationError.
1181
+ * Non-ApplicationError values are wrapped in InternalError.
1182
+ */
1183
+ private normalizeError;
1184
+ /**
1185
+ * Run the reporting pipeline for an error.
1186
+ */
1187
+ private performReport;
1188
+ /**
1189
+ * Run the rendering pipeline for an error, producing a Response.
1190
+ */
1191
+ private performRender;
1192
+ /**
1193
+ * Apply all respond() callbacks to post-process a Response.
1194
+ */
1195
+ private applyRespondCallbacks;
1196
+ /**
1197
+ * Check if an error is in the dontReport set.
1198
+ */
1199
+ private shouldNotReport;
1200
+ /**
1201
+ * Find the most-specific reportable entry for an error.
1202
+ * Walks entries in registration order; picks the most-specific `instanceof` match.
1203
+ */
1204
+ private findReportable;
1205
+ /**
1206
+ * Find the most-specific renderable entry for an error.
1207
+ */
1208
+ private findRenderable;
1209
+ /**
1210
+ * Default reporting — log with appropriate severity and i18n translation.
1211
+ */
1212
+ private defaultReport;
1213
+ /**
1214
+ * Default rendering — content-negotiated.
1215
+ *
1216
+ * For HTTP requests that accept HTML: renders a minimal branded HTML page.
1217
+ * For everything else (API, queue, cron, CLI): returns JSON.
1218
+ *
1219
+ * Errors are always logged via `performReport` (non-blocking waitUntil),
1220
+ * so they appear in the console regardless of the rendered response format.
1221
+ */
1222
+ private defaultRender;
1223
+ /**
1224
+ * Check if the HTTP request prefers an HTML response.
1225
+ *
1226
+ * Uses the `Accept` header to determine format. Inertia v3 XHR requests
1227
+ * send `Accept: text/html, application/xhtml+xml`, so they naturally
1228
+ * receive HTML error pages (displayed in Inertia's error modal in dev).
1229
+ *
1230
+ * Override in a subclass to customize content negotiation logic.
1231
+ */
1232
+ protected wantsHtml(context: HttpExceptionContext): boolean;
1233
+ /**
1234
+ * Minimal production HTML error page with inline styles.
1235
+ */
1236
+ private renderDefaultHtml;
1237
+ private escapeHtml;
1238
+ /**
1239
+ * Convert a render result (Response or ErrorResponse) into a Response.
1240
+ */
1241
+ private toResponse;
1242
+ /**
1243
+ * Translate an error's message key via i18n.
1244
+ * Uses the request container (from HTTP context) for correct locale,
1245
+ * falling back to the global container or raw message string.
1246
+ */
1247
+ private translateError;
1248
+ /**
1249
+ * Resolve the log severity for an error.
1250
+ * Checks level overrides first, then falls back to code-range-based severity.
1251
+ */
1252
+ private resolveSeverity;
1253
+ /**
1254
+ * Determine default log severity based on error code range.
1255
+ */
1256
+ private getDefaultSeverity;
1257
+ /**
1258
+ * Gather all global context data from registered callbacks.
1259
+ */
1260
+ private gatherContext;
1261
+ }
1262
+ //#endregion
1263
+ //#region src/module/types.d.ts
1264
+ /**
1265
+ * Provider that uses a class constructor
1266
+ *
1267
+ * @example Transient (default)
1268
+ * ```typescript
1269
+ * { provide: UserService, useClass: UserService }
1270
+ * ```
1271
+ *
1272
+ * @example Singleton
1273
+ * ```typescript
1274
+ * { provide: DI_TOKENS.ConsumerRegistry, useClass: ConsumerRegistry, scope: Scope.Singleton }
1275
+ * ```
1276
+ *
1277
+ * @example Request-scoped
1278
+ * ```typescript
1279
+ * { provide: DI_TOKENS.ConnectionManager, useClass: ConnectionManager, scope: Scope.Request }
1280
+ * ```
1281
+ */
1282
+ interface ClassProvider<T extends object = object> {
1283
+ provide: InjectionToken$2<T>;
1284
+ useClass: Constructor<T>;
1285
+ /** Lifecycle scope - defaults to Transient if not specified */
1286
+ scope?: Scope;
1287
+ }
1288
+ /**
1289
+ * Provider that uses a pre-created value
1290
+ *
1291
+ * Note: Values are inherently singleton-like (same instance always returned).
1292
+ * No scope option needed.
1293
+ */
1294
+ interface ValueProvider<T extends object = object> {
1295
+ provide: InjectionToken$2<T>;
1296
+ useValue: T;
1297
+ }
1298
+ /**
1299
+ * Provider that uses a factory function with auto-injection support
1300
+ *
1301
+ * Note: Factory providers do not support scope/lifecycle in tsyringe.
1302
+ * Factories are always called fresh on each resolution (transient-like behavior).
1303
+ *
1304
+ * @example Factory with dependencies
1305
+ * ```typescript
1306
+ * {
1307
+ * provide: LOGGER_TOKENS.Transports,
1308
+ * useFactory: (console) => [console],
1309
+ * inject: [LOGGER_TOKENS.ConsoleTransport]
1310
+ * }
1311
+ * ```
1312
+ */
1313
+ interface FactoryProvider<T extends object = object> {
1314
+ provide: InjectionToken$2<T>;
1315
+ useFactory: (...deps: any[]) => T | Promise<T>;
1316
+ inject?: InjectionToken$2<unknown>[];
1317
+ }
1318
+ /**
1319
+ * Provider that creates an alias to an existing token
1320
+ *
1321
+ * When the `provide` token is resolved, the container resolves `useExisting` instead.
1322
+ * Both tokens return the same instance (for singleton/request-scoped services).
1323
+ *
1324
+ * Use cases:
1325
+ * - Creating interface tokens that alias concrete implementations
1326
+ * - Multiple tokens resolving to the same service
1327
+ *
1328
+ * @example Basic alias
1329
+ * ```typescript
1330
+ * {
1331
+ * provide: 'IUserService',
1332
+ * useExisting: UserService
1333
+ * }
1334
+ * // Resolving 'IUserService' returns the UserService instance
1335
+ * ```
1336
+ *
1337
+ * @example Interface abstraction
1338
+ * ```typescript
1339
+ * providers: [
1340
+ * UserService,
1341
+ * { provide: I_USER_SERVICE, useExisting: UserService }
1342
+ * ]
1343
+ * // Both UserService and I_USER_SERVICE resolve to the same instance
1344
+ * ```
1345
+ */
1346
+ interface ExistingProvider<T extends object = object> {
1347
+ provide: InjectionToken$2<T>;
1348
+ useExisting: InjectionToken$2<T>;
1349
+ }
1350
+ /**
1351
+ * Union type for all provider types
1352
+ */
1353
+ type Provider<T extends object = object> = Constructor<T> | ClassProvider<T> | ValueProvider<T> | FactoryProvider<T> | ExistingProvider<T>;
1354
+ /**
1355
+ * Module class type (decorated with @Module)
1356
+ *
1357
+ * Static methods for dynamic module configuration:
1358
+ * - forRoot: Synchronous configuration (like NestJS forRoot)
1359
+ * - forRootAsync: Async configuration with factory (like NestJS forRootAsync)
1360
+ */
1361
+ interface ModuleClass<T extends object = object> extends Constructor<T> {
1362
+ /**
1363
+ * Synchronous module configuration
1364
+ *
1365
+ * Use for global singleton modules with static configuration
1366
+ *
1367
+ * @example
1368
+ * ```typescript
1369
+ * @Module({ providers: [] })
1370
+ * export class ConfigModule {
1371
+ * static forRoot(options: ConfigOptions): DynamicModule {
1372
+ * return {
1373
+ * providers: [
1374
+ * { provide: CONFIG_TOKEN, useValue: options }
1375
+ * ]
1376
+ * }
1377
+ * }
1378
+ * }
1379
+ *
1380
+ * // Usage in AppModule
1381
+ * @Module({ imports: [ConfigModule.forRoot({ apiKey: '...' })] })
1382
+ * ```
1383
+ */
1384
+ forRoot?: (...args: unknown[]) => DynamicModule;
1385
+ /**
1386
+ * Async module configuration with dependency injection
1387
+ *
1388
+ * Use when configuration depends on other services
1389
+ *
1390
+ * @example
1391
+ * ```typescript
1392
+ * @Module({ providers: [] })
1393
+ * export class DatabaseModule {
1394
+ * static forRootAsync<T>(options: AsyncModuleOptions<T>): DynamicModule {
1395
+ * return {
1396
+ * providers: [
1397
+ * {
1398
+ * provide: DB_TOKEN,
1399
+ * useFactory: options.useFactory,
1400
+ * inject: options.inject
1401
+ * }
1402
+ * ]
1403
+ * }
1404
+ * }
1405
+ * }
1406
+ *
1407
+ * // Usage in AppModule
1408
+ * @Module({
1409
+ * imports: [
1410
+ * DatabaseModule.forRootAsync({
1411
+ * inject: [CONFIG_TOKEN],
1412
+ * useFactory: (config) => ({ url: config.databaseUrl })
1413
+ * })
1414
+ * ]
1415
+ * })
1416
+ * ```
1417
+ */
1418
+ forRootAsync?: <TOptions>(options: AsyncModuleOptions<TOptions>) => DynamicModule;
1419
+ }
1420
+ /**
1421
+ * Module options for `@Module` decorator
1422
+ *
1423
+ * Note: Middlewares are configured via the RouteConfigurable interface's
1424
+ * configureRoutes() method, not via this options object. See router/router.ts.
1425
+ */
1426
+ interface ModuleOptions {
1427
+ imports?: (ModuleClass | DynamicModule)[];
1428
+ providers?: Provider[];
1429
+ controllers?: Constructor[];
1430
+ consumers?: Constructor[];
1431
+ jobs?: Constructor[];
1432
+ }
1433
+ /**
1434
+ * Dynamic module returned by forRoot/forRootAsync
1435
+ *
1436
+ * Contains additional providers, controllers, consumers, and jobs
1437
+ * that are added to the module when configured dynamically.
1438
+ */
1439
+ interface DynamicModule extends Omit<ModuleOptions, 'imports'> {
1440
+ /**
1441
+ * Reference to the module class that created this dynamic module
1442
+ *
1443
+ * Required for dynamic modules to support lifecycle methods (configure, onInitialize, onShutdown).
1444
+ * ModuleRegistry uses this to instantiate the actual module class instead of an anonymous wrapper.
1445
+ *
1446
+ * Note: This is NOT for provider scoping (tsyringe is always global).
1447
+ * It's purely for preserving the class reference for lifecycle method calls.
1448
+ */
1449
+ module: Constructor;
1450
+ }
1451
+ /**
1452
+ * Async configuration options for forRootAsync
1453
+ */
1454
+ interface AsyncModuleOptions<TOptions> {
1455
+ inject?: InjectionToken$2<unknown>[];
1456
+ useFactory: (...deps: any[]) => TOptions | Promise<TOptions>;
1457
+ }
1458
+ /**
1459
+ * Context passed to lifecycle hooks
1460
+ */
1461
+ interface ModuleContext {
1462
+ container: Container;
1463
+ logger: LoggerService;
1464
+ }
1465
+ /**
1466
+ * Lifecycle hook: called after all providers are registered
1467
+ */
1468
+ interface OnInitialize {
1469
+ onInitialize(context: ModuleContext): void | Promise<void>;
1470
+ }
1471
+ /**
1472
+ * Lifecycle hook: called during application shutdown
1473
+ */
1474
+ interface OnShutdown {
1475
+ onShutdown(context: ModuleContext): void | Promise<void>;
1476
+ }
1477
+ /**
1478
+ * Lifecycle hook: called after the {@link ExceptionHandler} is initialized.
1479
+ *
1480
+ * Implement this interface on a module class to contribute custom
1481
+ * `reportable()`, `renderable()`, `dontReport()`, etc. registrations
1482
+ * to the application's exception handler.
1483
+ *
1484
+ * @example
1485
+ * ```typescript
1486
+ * @Module({ providers: [PaymentService] })
1487
+ * export class PaymentModule implements OnException {
1488
+ * onException(handler: ExceptionHandler): void {
1489
+ * handler.reportable(PaymentError, (e) => { ... })
1490
+ * handler.renderable(PaymentDeclinedError, (e, ctx) => {
1491
+ * if (ctx.type === 'http') return ctx.ctx.json({ retryable: true }, 402)
1492
+ * })
1493
+ * }
1494
+ * }
1495
+ * ```
1496
+ */
1497
+ interface OnException {
1498
+ onException(handler: ExceptionHandler): void;
1499
+ }
1500
+ /**
1501
+ * Tsyringe registry entry type (for internal use)
1502
+ *
1503
+ * Note: useFactory receives DependencyContainer from tsyringe,
1504
+ * but we resolve our Container via CONTAINER_TOKEN for consistency.
1505
+ */
1506
+ interface RegistryEntry<T extends object = object> {
1507
+ token: InjectionToken$2<T>;
1508
+ useClass?: Constructor<T>;
1509
+ useValue?: T;
1510
+ useFactory?: (dependencyContainer: DependencyContainer) => T;
1511
+ useToken?: InjectionToken$2<T>;
1512
+ }
1513
+ //#endregion
1514
+ //#region src/quarry/types.d.ts
1515
+ /**
1516
+ * Flat input object for programmatic command invocation.
1517
+ */
1518
+ type CommandInput = Record<string, unknown>;
1519
+ /**
1520
+ * Result of a command execution.
1521
+ */
1522
+ interface CommandResult {
1523
+ exitCode: number;
1524
+ output: string[];
1525
+ errors: string[];
1526
+ }
1527
+ /**
1528
+ * User-facing Quarry interface. Only exposes the `call()` method.
1529
+ *
1530
+ * Inject via `@inject(DI_TOKENS.Quarry)` and type as `Quarry`.
1531
+ */
1532
+ interface Quarry {
1533
+ call(name: string, input?: CommandInput): Promise<CommandResult>;
1534
+ }
1535
+ /**
1536
+ * Internal mutable state stored on Command instances via Symbol key.
1537
+ * @internal
1538
+ */
1539
+ interface CommandInternals {
1540
+ inputs: CommandInput;
1541
+ output: string[];
1542
+ errors: string[];
1543
+ exitCode: number;
1544
+ quarry: Quarry | null;
1545
+ }
1546
+ /**
1547
+ * A parsed argument from a Laravel-style signature string.
1548
+ */
1549
+ interface ParsedArgument {
1550
+ name: string;
1551
+ required: boolean;
1552
+ default?: string;
1553
+ description?: string;
1554
+ isArray: boolean;
1555
+ }
1556
+ /**
1557
+ * A parsed option from a Laravel-style signature string.
1558
+ */
1559
+ interface ParsedOption {
1560
+ name: string;
1561
+ alias?: string;
1562
+ isFlag: boolean;
1563
+ isArray: boolean;
1564
+ default?: string;
1565
+ description?: string;
1566
+ }
1567
+ /**
1568
+ * Fully parsed command signature.
1569
+ */
1570
+ interface ParsedSignature {
1571
+ name: string;
1572
+ arguments: ParsedArgument[];
1573
+ options: ParsedOption[];
1574
+ }
1575
+ //#endregion
1576
+ //#region src/router/controller.d.ts
1577
+ /**
1578
+ * Controller interface for handling HTTP requests
1579
+ *
1580
+ * Controllers can implement RESTful methods or a custom handle() method.
1581
+ * The route for the controller is set via the `@Controller` decorator.
1582
+ *
1583
+ * RESTful methods auto-map to HTTP verbs:
1584
+ * - index() → GET /route
1585
+ * - show() → GET /route/:id
1586
+ * - create() → POST /route
1587
+ * - update() → PUT /route/:id
1588
+ * - patch() → PATCH /route/:id
1589
+ * - destroy() → DELETE /route/:id
1590
+ *
1591
+ * For non-RESTful routes (wildcards, custom patterns), implement handle()
1592
+ */
1593
+ interface IController {
1594
+ /**
1595
+ * GET /route
1596
+ * List all resources
1597
+ */
1598
+ index?(ctx: RouterContext): Promise<Response> | Response;
1599
+ /**
1600
+ * GET /route/:id
1601
+ * Show a specific resource
1602
+ */
1603
+ show?(ctx: RouterContext): Promise<Response> | Response;
1604
+ /**
1605
+ * POST /route
1606
+ * Create a new resource
1607
+ */
1608
+ create?(ctx: RouterContext): Promise<Response> | Response;
1609
+ /**
1610
+ * PUT /route/:id
1611
+ * Update a resource (full replacement)
1612
+ */
1613
+ update?(ctx: RouterContext): Promise<Response> | Response;
1614
+ /**
1615
+ * PATCH /route/:id
1616
+ * Patch a resource (partial update)
1617
+ */
1618
+ patch?(ctx: RouterContext): Promise<Response> | Response;
1619
+ /**
1620
+ * DELETE /route/:id
1621
+ * Delete a resource
1622
+ */
1623
+ destroy?(ctx: RouterContext): Promise<Response> | Response;
1624
+ /**
1625
+ * Custom handler for non-RESTful routes
1626
+ * Use this for wildcards (e.g., /api/v1/auth/*) or custom patterns
1627
+ * Takes precedence over RESTful methods if defined
1628
+ */
1629
+ handle?(ctx: RouterContext): Promise<Response> | Response;
1630
+ }
1631
+ //#endregion
1632
+ //#region src/router/middleware.interface.d.ts
1633
+ type Next$1 = Next;
1634
+ /**
1635
+ * Middleware interface for request processing
1636
+ *
1637
+ * Middlewares use the `@Transient()` decorator and are registered via
1638
+ * `configureRoutes(router)` in modules implementing `RouteConfigurable`.
1639
+ *
1640
+ * @example
1641
+ * ```typescript
1642
+ * @Transient()
1643
+ * export class LoggingMiddleware implements Middleware {
1644
+ * async handle(ctx: RouterContext, next: () => Promise<void>): Promise<void> {
1645
+ * const start = Date.now()
1646
+ * await next()
1647
+ * console.log(`Request took ${Date.now() - start}ms`)
1648
+ * }
1649
+ * }
1650
+ *
1651
+ * // Register in module:
1652
+ * @Module({ providers: [LoggingMiddleware] })
1653
+ * export class AppModule implements RouteConfigurable {
1654
+ * configureRoutes(router: Router): void {
1655
+ * router.middleware(LoggingMiddleware)
1656
+ * }
1657
+ * }
1658
+ * ```
1659
+ */
1660
+ interface Middleware {
1661
+ /**
1662
+ * Handle middleware logic
1663
+ * Call next() to continue the middleware chain
1664
+ *
1665
+ * @param ctx - Router context with request/response helpers
1666
+ * @param next - Function to call the next middleware or route handler
1667
+ */
1668
+ handle(ctx: RouterContext, next: Next$1): Promise<Response | void>;
1669
+ }
1670
+ //#endregion
1671
+ //#region src/router/router.internals.d.ts
1672
+ /**
1673
+ * Symbol keys for Router internal accessors.
1674
+ *
1675
+ * These symbols are NOT exported from the public `stratal/router` barrel.
1676
+ * Only internal modules (RouterResolver) import them, keeping the Router's
1677
+ * public API clean — users never see these methods.
1678
+ *
1679
+ * Declared as individual unique symbols so TypeScript can distinguish
1680
+ * their return types in computed property access.
1681
+ *
1682
+ * @internal
1683
+ */
1684
+ /** @internal */
1685
+ declare const getDefaultEntry: unique symbol;
1686
+ /** @internal */
1687
+ declare const getGroups: unique symbol;
1688
+ /** @internal */
1689
+ declare const getGlobalMiddleware: unique symbol;
1690
+ //#endregion
1691
+ //#region src/router/router.d.ts
1692
+ /**
1693
+ * Configuration for a sub-group created via `router.group()`.
1694
+ */
1695
+ interface RouterGroupConfig {
1696
+ prefix?: string;
1697
+ domain?: string;
1698
+ name?: string;
1699
+ middleware?: Constructor<Middleware>[];
1700
+ version?: string | string[];
1701
+ hideFromDocs?: boolean;
1702
+ params?: index_d_exports$1.ZodObject<any>;
1703
+ }
1704
+ /**
1705
+ * Internal entry representing a sub-group or the default scope.
1706
+ * @internal — used by RouterResolver, not exported publicly.
1707
+ */
1708
+ interface RouterEntry {
1709
+ prefix?: string;
1710
+ domain?: string;
1711
+ name?: string;
1712
+ middleware: Constructor<Middleware>[];
1713
+ version?: string | string[];
1714
+ hideFromDocs?: boolean;
1715
+ params?: index_d_exports$1.ZodObject<any>;
1716
+ /** Controllers in this entry. undefined = all controllers not in any sub-group */
1717
+ controllers?: Constructor[];
1718
+ }
1719
+ /**
1720
+ * Modules implement this to configure routes and middleware.
1721
+ * Replaces `MiddlewareConfigurable`.
1722
+ *
1723
+ * @example
1724
+ * ```typescript
1725
+ * @Module({ controllers: [UsersController, PostsController] })
1726
+ * export class ApiModule implements RouteConfigurable {
1727
+ * configureRoutes(router: Router): void {
1728
+ * router
1729
+ * .name('api.')
1730
+ * .middleware(CorsMiddleware)
1731
+ * .version('1')
1732
+ * }
1733
+ * }
1734
+ * ```
1735
+ */
1736
+ interface RouteConfigurable {
1737
+ configureRoutes(router: Router): void;
1738
+ }
1739
+ /**
1740
+ * Fluent builder for route and middleware configuration.
1741
+ *
1742
+ * Scoped methods (`middleware()`, `prefix()`, `domain()`, `name()`, `version()`, `hideFromDocs()`)
1743
+ * apply only to this module's controllers or the sub-group's controllers.
1744
+ *
1745
+ * `use()` registers global middleware (all routes in the entire app).
1746
+ * Only callable on the root Router — throws inside `group()` callbacks.
1747
+ *
1748
+ * `group()` creates sub-groups for specific controllers with a callback.
1749
+ * Controllers in a sub-group are excluded from the parent scope.
1750
+ */
1751
+ declare class Router {
1752
+ private readonly _isChild;
1753
+ private readonly _defaultEntry;
1754
+ private readonly _groups;
1755
+ private readonly _globalMiddleware;
1756
+ constructor(isChild?: boolean);
1757
+ /** Dynamic path prefix. For shared segments like `/:companyId` */
1758
+ prefix(path: string, params?: index_d_exports$1.ZodObject<any>): this;
1759
+ /** Domain pattern for controllers in this scope */
1760
+ domain(pattern: string): this;
1761
+ /** Name prefix for routes in this scope */
1762
+ name(prefix: string): this;
1763
+ /** Middleware applied to controllers in this scope */
1764
+ middleware(...middlewares: Constructor<Middleware>[]): this;
1765
+ /** API version for controllers in this scope */
1766
+ version(version: string | string[]): this;
1767
+ /** Hide/show routes in this scope from OpenAPI docs */
1768
+ hideFromDocs(hide?: boolean): this;
1769
+ /**
1770
+ * Global middleware — applied to ALL routes in the entire app.
1771
+ * Only callable on the root Router. Throws if called inside `group()`.
1772
+ */
1773
+ use(...middlewares: Constructor<Middleware>[]): this;
1774
+ /**
1775
+ * Create a sub-group for specific controllers/gateways.
1776
+ * Controllers in a sub-group are excluded from the parent (default) scope.
1777
+ * The callback receives a new Router (without `use()`) for fluent configuration.
1778
+ */
1779
+ group(controllers: Constructor[], callback: (router: Omit<Router, 'use'>) => void): this;
1780
+ [getDefaultEntry](): RouterEntry;
1781
+ [getGroups](): RouterEntry[];
1782
+ [getGlobalMiddleware](): Constructor<Middleware>[];
1783
+ }
1784
+ //#endregion
1785
+ //#region src/module/module-registry.d.ts
1786
+ /**
1787
+ * ModuleRegistry - manages module lifecycle
1788
+ *
1789
+ * @example
1790
+ * ```typescript
1791
+ * const registry = new ModuleRegistry(container, logger)
1792
+ * registry.register(AppModule) // Traverses imports recursively
1793
+ * await registry.initialize()
1794
+ * // ... application running ...
1795
+ * await registry.shutdown()
1796
+ * ```
1797
+ */
1798
+ declare class ModuleRegistry {
1799
+ private readonly container;
1800
+ private readonly logger;
1801
+ private modules;
1802
+ private registeredClasses;
1803
+ private initialized;
1804
+ private allControllers;
1805
+ private allConsumers;
1806
+ private allJobs;
1807
+ private allListeners;
1808
+ private allCommands;
1809
+ private allSeeders;
1810
+ private allRouterConfigs;
1811
+ constructor(container: Container, logger: LoggerService);
1812
+ /**
1813
+ * Register a module (static or dynamic)
1814
+ *
1815
+ * @param moduleOrDynamic - Module class decorated with `@Module` or DynamicModule from configure()
1816
+ */
1817
+ register(moduleOrDynamic: ModuleClass | DynamicModule): void;
1818
+ /**
1819
+ * Register multiple modules in order
1820
+ */
1821
+ registerAll(modules: (ModuleClass | DynamicModule)[]): void;
1822
+ /**
1823
+ * Initialize all modules (call configure and onInitialize hooks)
1824
+ */
1825
+ initialize(): Promise<void>;
1826
+ /**
1827
+ * Get all controllers registered from all modules
1828
+ */
1829
+ getAllControllers(): Constructor[];
1830
+ /**
1831
+ * Get all consumers registered from all modules
1832
+ */
1833
+ getAllConsumers(): Constructor[];
1834
+ /**
1835
+ * Get all jobs registered from all modules
1836
+ */
1837
+ getAllJobs(): Constructor[];
1838
+ /**
1839
+ * Get all listeners registered from all modules
1840
+ */
1841
+ getAllListeners(): Constructor[];
1842
+ /**
1843
+ * Get all commands registered from all modules
1844
+ */
1845
+ getAllCommands(): Constructor[];
1846
+ /**
1847
+ * Get all seeders registered from all modules
1848
+ */
1849
+ getAllSeeders(): Constructor[];
1850
+ /**
1851
+ * Get all Router configurations from modules implementing RouteConfigurable
1852
+ */
1853
+ getAllRouterConfigs(): {
1854
+ router: Router;
1855
+ controllers: Constructor[];
1856
+ }[];
1857
+ /**
1858
+ * Call `onException()` on all modules that implement the OnException interface.
1859
+ * Invoked by Application after the ExceptionHandler is resolved and `register()` is called.
1860
+ *
1861
+ * @param handler - The resolved ExceptionHandler instance
1862
+ */
1863
+ configureExceptionHandlers(handler: ExceptionHandler): void;
1864
+ /**
1865
+ * Shutdown all modules (call onShutdown hooks in reverse order)
1866
+ */
1867
+ shutdown(): Promise<void>;
1868
+ /**
1869
+ * Type guard for RouteConfigurable
1870
+ */
1871
+ private hasRouteConfigurable;
1872
+ /**
1873
+ * Type guard for OnInitialize
1874
+ */
1875
+ private hasOnInitialize;
1876
+ /**
1877
+ * Type guard for OnShutdown
1878
+ */
1879
+ private hasOnShutdown;
1880
+ /**
1881
+ * Type guard for OnException
1882
+ */
1883
+ private hasOnException;
1884
+ /**
1885
+ * Resolve module class and options from static or dynamic module
1886
+ *
1887
+ * For DynamicModules, merges the decorator metadata (consumers, controllers, jobs)
1888
+ * with the DynamicModule options (providers, imports). This ensures modules using
1889
+ * forRoot/forRootAsync patterns still have their decorator-defined consumers registered.
1890
+ */
1891
+ private resolveModule;
1892
+ /**
1893
+ * Type guard for DynamicModule
1894
+ */
1895
+ private isDynamicModule;
1896
+ /**
1897
+ * Register a single provider in the container
1898
+ */
1899
+ private registerProvider;
1900
+ /**
1901
+ * Check if a class is a `Command` and collect it for auto-wiring
1902
+ */
1903
+ private collectIfCommand;
1904
+ /**
1905
+ * Check if a class is a `Seeder` and collect it for auto-wiring
1906
+ */
1907
+ private collectIfSeeder;
1908
+ /**
1909
+ * Check if a class is a `@Listener()` and collect it for auto-wiring
1910
+ */
1911
+ private collectIfListener;
1912
+ }
1913
+ //#endregion
1914
+ //#region src/router/router-resolver.d.ts
1915
+ /**
1916
+ * Resolved configuration for a single controller.
1917
+ * Merges Router default entry, sub-group overrides, and inheritance rules.
1918
+ */
1919
+ interface ResolvedRouterConfig {
1920
+ prefix?: string;
1921
+ domain?: string;
1922
+ name?: string;
1923
+ middleware: Constructor<Middleware>[];
1924
+ version?: string | string[];
1925
+ hideFromDocs?: boolean;
1926
+ params?: index_d_exports$1.ZodObject<any>;
1927
+ }
1928
+ /**
1929
+ * Internal resolver that computes the effective Router config for each controller.
1930
+ *
1931
+ * Inheritance rules:
1932
+ * - `middleware`: parent middleware runs first, then child (concatenated)
1933
+ * - `prefix`: concatenated (parent + child)
1934
+ * - `name`: concatenated (parent + child)
1935
+ * - `domain`: child overrides parent
1936
+ * - `version`: child overrides parent
1937
+ * - `hideFromDocs`: child overrides parent
1938
+ *
1939
+ * @internal — not exported from stratal/router
1940
+ */
1941
+ declare class RouterResolver {
1942
+ private readonly routers;
1943
+ constructor(routers: {
1944
+ router: Router;
1945
+ controllers: Constructor[];
1946
+ }[]);
1947
+ /**
1948
+ * Resolve the effective config for a given controller class.
1949
+ * Searches through all module routers to find the one owning this controller.
1950
+ */
1951
+ resolveForController(controller: Constructor): ResolvedRouterConfig;
1952
+ /**
1953
+ * Collect all global middleware registered via `router.use()` across all modules.
1954
+ */
1955
+ getGlobalMiddleware(): Constructor<Middleware>[];
1956
+ /**
1957
+ * Merge parent default entry with child group entry following inheritance rules.
1958
+ */
1959
+ private mergeEntries;
1960
+ private entryToConfig;
1961
+ private mergeParams;
1962
+ private concatPrefixes;
1963
+ private concatNames;
1964
+ }
1965
+ //#endregion
1966
+ //#region src/router/services/route-registration.service.d.ts
1967
+ /**
1968
+ * Route registration service
1969
+ * Manages controller and route registration with OpenAPI support
1970
+ *
1971
+ * Responsibilities:
1972
+ * - Register RESTful controllers with OpenAPI metadata
1973
+ * - Auto-derive HTTP methods/paths from controller method names
1974
+ * - Build OpenAPI route configurations with guard execution
1975
+ * - Validate all controllers have access decorators (strict mode)
1976
+ * - Create controller handlers with DI resolution
1977
+ *
1978
+ * Two-pass strategy:
1979
+ * 1. Collect: iterate controllers, register in RouteRegistry, store Hono actions
1980
+ * 2. Register: iterate registry.all() (sorted), execute stored actions in Hono
1981
+ */
1982
+ declare class RouteRegistrationService {
1983
+ private logger;
1984
+ private registry;
1985
+ private routerResolver;
1986
+ private localePathService;
1987
+ private app;
1988
+ private moduleRegistry;
1989
+ private controllerClasses;
1990
+ private upgradeWebSocketFn;
1991
+ constructor(logger: LoggerService, registry: RouteRegistry, routerResolver: RouterResolver | null, localePathService: LocalePathService, app: HonoApp, moduleRegistry: ModuleRegistry);
1992
+ /**
1993
+ * Configure router with controllers and global middleware.
1994
+ * Resolves controllers from ModuleRegistry and global middleware from RouterResolver.
1995
+ */
1996
+ configure(): Promise<void>;
1997
+ /**
1998
+ * Pass 1: Collect routes from a controller into RouteRegistry and store Hono actions.
1999
+ * Versioning and locale expansion are handled by RouteRegistry.register().
2000
+ */
2001
+ private collectRoutes;
2002
+ /**
2003
+ * Register a single WebSocket gateway route
2004
+ */
2005
+ private registerGatewayForPath;
2006
+ /**
2007
+ * Create a guard execution middleware
2008
+ *
2009
+ * This middleware executes all guards for a route before the handler.
2010
+ * Guards are executed in order; all must pass for the request to proceed.
2011
+ *
2012
+ * @param guards - Array of guards to execute
2013
+ * @returns Hono middleware function
2014
+ */
2015
+ private createGuardMiddleware;
2016
+ /**
2017
+ * Register wildcard route for non-RESTful controllers
2018
+ */
2019
+ private registerWildcardRoute;
2020
+ /**
2021
+ * Resolve HTTP method, path, route config, and status code from route metadata.
2022
+ */
2023
+ private resolveMethodAndPath;
2024
+ /**
2025
+ * Join a base path and a route path, normalizing slashes
2026
+ */
2027
+ private joinPaths;
2028
+ /**
2029
+ * Auto-derive HTTP method and path from controller method name
2030
+ * Uses HTTP_METHODS constant for RESTful convention mapping
2031
+ */
2032
+ private deriveHttpMethodAndPath;
2033
+ /**
2034
+ * Merge controller-level and route-level metadata
2035
+ * Tags are merged (appended), security is merged (union)
2036
+ * Guards automatically add sessionCookie security if present
2037
+ */
2038
+ private mergeMetadata;
2039
+ /**
2040
+ * Build OpenAPI route configuration from metadata
2041
+ * Creates a route definition compatible with @hono/zod-openapi
2042
+ * Includes guard execution for proper access control
2043
+ *
2044
+ * Execution order: Global middlewares → Guards → Handler
2045
+ */
2046
+ private buildOpenAPIRoute;
2047
+ /**
2048
+ * Check if a body definition is a RouteBodyObject (has schema key) vs bare ZodType
2049
+ */
2050
+ private isRouteBodyObject;
2051
+ /**
2052
+ * Resolve method parameter injections from the container
2053
+ *
2054
+ * @param prototype - Controller prototype
2055
+ * @param methodName - Method name to get injections for
2056
+ * @param container - Request-scoped container
2057
+ * @returns Array of resolved dependencies in parameter order
2058
+ */
2059
+ private resolveMethodInjections;
2060
+ /**
2061
+ * Name a handler function so Hono's inspectRoutes() can identify it.
2062
+ * Format: `{type}:{Controller}.{method}` (e.g. `http:UsersController.create`)
2063
+ */
2064
+ private nameHandler;
2065
+ /**
2066
+ * Create controller handler that resolves controller from request-scoped container
2067
+ * This ensures each request gets a fresh controller with request-scoped context
2068
+ */
2069
+ private createControllerHandler;
2070
+ /**
2071
+ * Extract the Zod schema from a RouteResponse definition.
2072
+ * Returns null for non-JSON content types or when no response is defined.
2073
+ */
2074
+ private extractResponseSchema;
2075
+ /**
2076
+ * Check if a response definition is a RouteResponseObject (has schema key) vs bare ZodType
2077
+ */
2078
+ private isRouteResponseObject;
2079
+ /**
2080
+ * Validate a Response body against its declared Zod schema.
2081
+ *
2082
+ * Skips validation for:
2083
+ * - Non-JSON content types
2084
+ * - Empty bodies (204 No Content, 304 Not Modified)
2085
+ *
2086
+ * Clones the response to read the body without consuming the original stream.
2087
+ */
2088
+ private validateResponse;
2089
+ }
2090
+ //#endregion
2091
+ //#region src/router/router.tokens.d.ts
2092
+ /**
2093
+ * Dependency injection tokens for the router system
2094
+ */
2095
+ declare const ROUTER_TOKENS: {
2096
+ /**
2097
+ * Token for RouterContext (request-scoped)
2098
+ * Contains Hono context wrapper with helper methods
2099
+ */
2100
+ readonly RouterContext: symbol;
2101
+ /**
2102
+ * Token for RouteRegistry (singleton)
2103
+ * Central registry of all application routes — source of truth for route:list, route:types, URL generation
2104
+ */
2105
+ readonly RouteRegistry: symbol;
2106
+ /**
2107
+ * Token for VersioningService (singleton)
2108
+ * Resolves version prefixes for route paths
2109
+ */
2110
+ readonly VersioningService: symbol;
2111
+ /**
2112
+ * Token for LocalePathService (singleton)
2113
+ * Resolves locale path variants and computes LocalePathConfig
2114
+ */
2115
+ readonly LocalePathService: symbol;
2116
+ /**
2117
+ * Token for RouterResolver (singleton, may be null)
2118
+ * Internal resolver that computes effective Router config per controller
2119
+ */
2120
+ readonly RouterResolver: symbol;
2121
+ /**
2122
+ * Token for HonoApp (singleton)
2123
+ * The Hono application instance with Stratal-specific setup
2124
+ */
2125
+ readonly HonoApp: symbol;
2126
+ /**
2127
+ * Token for Uri (request-scoped)
2128
+ * URL generation service — route URLs, signed URLs, current/previous URL access
2129
+ */
2130
+ readonly Uri: symbol;
2131
+ };
2132
+ //#endregion
2133
+ //#region src/router/route-url.d.ts
2134
+ /**
2135
+ * Generate a URL from a named route.
2136
+ *
2137
+ * Keys in `params` matching `:param` placeholders fill the path.
2138
+ * Domain params (`{tenant}`) are also consumed from `params`.
2139
+ * Extra keys become query string parameters.
2140
+ *
2141
+ * Resolves RouteRegistry from the application container via AsyncLocalStorage.
2142
+ * Available after `Application.initialize()` has been called.
2143
+ *
2144
+ * @param name - Named route identifier
2145
+ * @param params - Route params + domain params + extra query params
2146
+ * @returns Generated URL string
2147
+ *
2148
+ * @example
2149
+ * ```typescript
2150
+ * // In a controller (preferred):
2151
+ * ctx.route('users.show', { id: '1' })
2152
+ *
2153
+ * // Outside controllers (standalone function):
2154
+ * import { route } from 'stratal/router'
2155
+ *
2156
+ * route('users.show', { id: '1' })
2157
+ * ```
2158
+ */
2159
+ declare function route<N extends RouteName>(name: N, params?: RouteParams<N>): string;
2160
+ //#endregion
2161
+ //#region src/router/utils/path.d.ts
2162
+ /**
2163
+ * Path normalization and route ordering utilities.
2164
+ *
2165
+ * Users always write Hono-style `:param` paths (`:companyId`, `:id`).
2166
+ * OpenAPI requires `{param}` style — conversion happens only at registration time.
2167
+ */
2168
+ /**
2169
+ * Convert Hono-style `:param` path segments to OpenAPI-style `{param}`.
2170
+ * Strips regex constraints (e.g., `:locale{sw}` → `{locale}`).
2171
+ *
2172
+ * @example
2173
+ * toOpenAPIPath('/users/:id') // '/users/{id}'
2174
+ * toOpenAPIPath('/:companyId/users/:userId') // '/{companyId}/users/{userId}'
2175
+ * toOpenAPIPath('/users/:id/posts') // '/users/{id}/posts'
2176
+ * toOpenAPIPath('/:locale{en|fr}/users') // '/{locale}/users'
2177
+ */
2178
+ declare function toOpenAPIPath(path: string): string;
2179
+ /**
2180
+ * Compute a specificity score for route ordering.
2181
+ * Lower score = higher priority (registered first in Hono).
2182
+ *
2183
+ * Scoring: static = 0, `:param{constraint}` = 5, `:param` = 10, wildcard `{.+}` / `{.*}` = 100.
2184
+ */
2185
+ declare function getPathSpecificityScore(path: string): number;
2186
+ /**
2187
+ * Sort routes by specificity so Hono registers them in the correct order.
2188
+ *
2189
+ * 1. Static paths before parameterized before wildcards
2190
+ * 2. More segments = more specific (tie-breaker)
2191
+ * 3. Primary paths before locale-prefixed variants
2192
+ */
2193
+ declare function sortRoutesBySpecificity<T extends {
2194
+ path: string;
2195
+ }>(routes: T[]): T[];
2196
+ //#endregion
2197
+ //#region src/router/utils/route-name.d.ts
2198
+ /**
2199
+ * Route naming utilities.
2200
+ *
2201
+ * Extracts parameter names from paths and domains,
2202
+ * and generates convention-based route names.
2203
+ */
2204
+ /**
2205
+ * Extract parameter names from a Hono-style path.
2206
+ *
2207
+ * @example
2208
+ * extractParamNames('/users/:id') // ['id']
2209
+ * extractParamNames('/:companyId/users/:userId') // ['companyId', 'userId']
2210
+ * extractParamNames('/users') // []
2211
+ */
2212
+ declare function extractParamNames(path: string): string[];
2213
+ /**
2214
+ * Extract parameter names from a domain pattern.
2215
+ *
2216
+ * @example
2217
+ * extractDomainParamNames('{tenant}.example.com') // ['tenant']
2218
+ * extractDomainParamNames('{region}.{tenant}.example.com') // ['region', 'tenant']
2219
+ * extractDomainParamNames('example.com') // []
2220
+ */
2221
+ declare function extractDomainParamNames(domain: string): string[];
2222
+ /**
2223
+ * Auto-generate a route name for convention-based `@Route` methods.
2224
+ *
2225
+ * Strips common prefixes (`/api/`, `/v{N}/`) and parameter segments,
2226
+ * then joins remaining static segments with dots and appends the method name.
2227
+ *
2228
+ * @example
2229
+ * generateConventionRouteName('/users', 'index') // 'users.index'
2230
+ * generateConventionRouteName('/users', 'show') // 'users.show'
2231
+ * generateConventionRouteName('/api/v1/users', 'create') // 'users.create'
2232
+ * generateConventionRouteName('/api/v1/users/:userId/notes', 'index') // 'users.notes.index'
2233
+ * generateConventionRouteName('/:companyId/users', 'index') // 'users.index'
2234
+ * generateConventionRouteName('/users/:userId/notes/:noteId/tags', 'index') // 'users.notes.tags.index'
2235
+ */
2236
+ declare function generateConventionRouteName(basePath: string, methodName: string): string;
2237
+ //#endregion
2238
+ //#region src/router/middleware/middleware-chain.d.ts
2239
+ /**
2240
+ * Create a Hono middleware handler that executes a chain of Stratal middleware classes.
2241
+ *
2242
+ * Each middleware is resolved from the request-scoped container per request,
2243
+ * then executed in order (first registered = outermost in the chain).
2244
+ *
2245
+ * @param classes - Middleware classes to chain
2246
+ * @returns Hono middleware handler
2247
+ */
2248
+ declare function createMiddlewareChain(classes: Constructor<Middleware>[]): MiddlewareHandler<RouterEnv>;
2249
+ //#endregion
2250
+ //#region src/router/decorators/controller.decorator.d.ts
2251
+ /**
2252
+ * Base controller decorator for route registration
2253
+ *
2254
+ * This is the core controller decorator that handles:
2255
+ * - Transient scope registration (request-scoped)
2256
+ * - Route metadata storage
2257
+ * - Controller options (tags, security schemes, hideFromDocs)
2258
+ *
2259
+ * @param route - Base route for this controller (e.g., '/api/v1/users')
2260
+ * @param options - Optional configuration (tags, security schemes, hideFromDocs)
2261
+ *
2262
+ * @example
2263
+ * ```typescript
2264
+ * import { Controller } from 'stratal/router'
2265
+ *
2266
+ * @Controller('/api/v1/users', { tags: ['Users'] })
2267
+ * export class UsersController implements IController {
2268
+ * // All routes accessible
2269
+ * }
2270
+ * ```
2271
+ */
2272
+ declare function Controller(route: string, options?: ControllerOptions): <T extends Constructor>(target: T) => T;
2273
+ /**
2274
+ * Get the route from controller class metadata
2275
+ *
2276
+ * @param target - Controller class or instance
2277
+ * @returns Route string or undefined if not set
2278
+ */
2279
+ declare function getControllerRoute(target: object): string | undefined;
2280
+ /**
2281
+ * Get the options from controller class metadata
2282
+ *
2283
+ * @param target - Controller class or instance
2284
+ * @returns Controller options or undefined if not set
2285
+ */
2286
+ declare function getControllerOptions(target: object): ControllerOptions | undefined;
2287
+ /**
2288
+ * Get the version from controller class metadata
2289
+ *
2290
+ * @param target - Controller class or instance
2291
+ * @returns Version string, array, VERSION_NEUTRAL symbol, or undefined if not set
2292
+ */
2293
+ declare function getControllerVersion(target: object): ControllerOptions['version'];
2294
+ //#endregion
2295
+ //#region src/router/decorators/http-method.decorator.d.ts
2296
+ /**
2297
+ * Registers a GET route on the controller method.
2298
+ *
2299
+ * @param path - Route path relative to the controller base path
2300
+ * @param config - Optional route configuration (response schema, body, params, etc.)
2301
+ *
2302
+ * @example
2303
+ * ```typescript
2304
+ * @Controller('/api/v1/users')
2305
+ * class UsersController {
2306
+ * @Get('/', { response: z.array(userSchema), summary: 'List users' })
2307
+ * async list(ctx: RouterContext) { ... }
2308
+ *
2309
+ * @Get('/:id', { params: z.object({ id: z.string().uuid() }), response: userSchema })
2310
+ * async getUser(ctx: RouterContext) { ... }
2311
+ * }
2312
+ * ```
2313
+ */
2314
+ declare const Get: (path: string, config?: RouteConfig) => (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
2315
+ /**
2316
+ * Registers a POST route on the controller method.
2317
+ *
2318
+ * @param path - Route path relative to the controller base path
2319
+ * @param config - Optional route configuration (response schema, body, params, etc.)
2320
+ *
2321
+ * @example
2322
+ * ```typescript
2323
+ * @Controller('/api/v1/users')
2324
+ * class UsersController {
2325
+ * @Post('/', { body: createUserSchema, response: userSchema, statusCode: 201 })
2326
+ * async createUser(ctx: RouterContext) { ... }
2327
+ * }
2328
+ * ```
2329
+ */
2330
+ declare const Post: (path: string, config?: RouteConfig) => (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
2331
+ /**
2332
+ * Registers a PUT route on the controller method.
2333
+ *
2334
+ * @param path - Route path relative to the controller base path
2335
+ * @param config - Optional route configuration
2336
+ */
2337
+ declare const Put: (path: string, config?: RouteConfig) => (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
2338
+ /**
2339
+ * Registers a PATCH route on the controller method.
2340
+ *
2341
+ * @param path - Route path relative to the controller base path
2342
+ * @param config - Optional route configuration
2343
+ */
2344
+ declare const Patch: (path: string, config?: RouteConfig) => (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
2345
+ /**
2346
+ * Registers a DELETE route on the controller method.
2347
+ *
2348
+ * @param path - Route path relative to the controller base path
2349
+ * @param config - Optional route configuration
2350
+ */
2351
+ declare const Delete: (path: string, config?: RouteConfig) => (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
2352
+ /**
2353
+ * Registers an ALL (any HTTP method) route on the controller method.
2354
+ * Routes using @All are registered without OpenAPI validation
2355
+ * since OpenAPI does not support a catch-all HTTP method.
2356
+ *
2357
+ * @param path - Route path relative to the controller base path
2358
+ * @param config - Optional route configuration
2359
+ */
2360
+ declare const All: (path: string, config?: RouteConfig) => (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
2361
+ //#endregion
2362
+ //#region src/router/decorators/route.decorator.d.ts
2363
+ /**
2364
+ * Decorator to add OpenAPI metadata to a controller method using convention-based routing.
2365
+ *
2366
+ * **Cannot be mixed with HTTP method decorators** (`@Get`, `@Post`, `@Put`, `@Patch`,
2367
+ * `@Delete`, `@All`) in the same controller. Use one pattern or the other.
2368
+ *
2369
+ * Stores route configuration (schemas, response, tags, security) in metadata.
2370
+ * HTTP method, path, and success status code are auto-derived from the method name:
2371
+ * - index() → GET /base-path → 200
2372
+ * - show() → GET /base-path/:id → 200
2373
+ * - create() → POST /base-path → 201
2374
+ * - update() → PUT /base-path/:id → 200
2375
+ * - patch() → PATCH /base-path/:id → 200
2376
+ * - destroy() → DELETE /base-path/:id → 200
2377
+ *
2378
+ * @param config - Route configuration (schemas, response, tags, security)
2379
+ *
2380
+ * @example
2381
+ * ```typescript
2382
+ * @Controller('/api/v1/notes', {
2383
+ * tags: ['Notes'],
2384
+ * security: ['bearerAuth']
2385
+ * })
2386
+ * export class NotesController implements Controller {
2387
+ * @Route({
2388
+ * body: createNoteSchema,
2389
+ * response: noteSchema, // 201 auto-derived from 'create' method
2390
+ * tags: ['Mutations'],
2391
+ * description: 'Create a new note'
2392
+ * })
2393
+ * async create(ctx: RouterContext): Promise<Response> {
2394
+ * // POST /api/v1/notes (auto-derived from method name)
2395
+ * // Body schema: createNoteSchema (auto-validated)
2396
+ * // Response: 201 → noteSchema (status auto-derived)
2397
+ * // Tags: ['Notes', 'Mutations'] (merged with controller)
2398
+ * // Security: ['bearerAuth'] (inherited from controller)
2399
+ * const body = ctx.body()
2400
+ * const note = await this.notesService.create(body)
2401
+ * return ctx.json(note, 201)
2402
+ * }
2403
+ *
2404
+ * @Route({
2405
+ * query: paginationSchema,
2406
+ * response: z.array(noteSchema) // 200 auto-derived from 'index' method
2407
+ * })
2408
+ * async index(ctx: RouterContext): Promise<Response> {
2409
+ * // GET /api/v1/notes (auto-derived)
2410
+ * // Query params auto-validated
2411
+ * const notes = await this.notesService.list()
2412
+ * return ctx.json(notes)
2413
+ * }
2414
+ *
2415
+ * @Route({
2416
+ * params: z.object({ id: z.string().uuid() }),
2417
+ * response: {
2418
+ * schema: noteSchema,
2419
+ * description: 'Note details'
2420
+ * },
2421
+ * security: [] // Override to make public
2422
+ * })
2423
+ * async show(ctx: RouterContext): Promise<Response> {
2424
+ * // GET /api/v1/notes/:id (auto-derived)
2425
+ * // URL params auto-validated
2426
+ * // Response: 200 → noteSchema (status auto-derived)
2427
+ * // Security: [] (public route, override controller security)
2428
+ * const id = ctx.param('id')
2429
+ * const note = await this.notesService.findById(id)
2430
+ * return ctx.json(note)
2431
+ * }
2432
+ * }
2433
+ * ```
2434
+ */
2435
+ declare function Route(config: Omit<RouteConfig, 'statusCode'>): (target: object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
2436
+ /**
2437
+ * Get the route metadata from a controller method
2438
+ *
2439
+ * @param target - Controller instance or prototype
2440
+ * @param methodName - Name of the method
2441
+ * @returns Route metadata or undefined if not decorated
2442
+ */
2443
+ declare function getRouteMetadata(target: object, methodName: string): RouteMetadata | undefined;
2444
+ /**
2445
+ * Get all methods with route decorators (@Route, @Get, @Post, etc.) from a controller
2446
+ *
2447
+ * @param ControllerClass - Controller class
2448
+ * @returns Array of method names that have route metadata
2449
+ */
2450
+ declare function getRouteDecoratedMethods(ControllerClass: new (...args: unknown[]) => object): string[];
2451
+ //#endregion
2452
+ //#region src/router/schemas/common.schemas.d.ts
2453
+ /**
2454
+ * Common OpenAPI Schemas
2455
+ *
2456
+ * Reusable schema definitions for common API patterns:
2457
+ * - Error responses
2458
+ * - Pagination
2459
+ * - Common parameters
2460
+ */
2461
+ /**
2462
+ * Generic error response schema
2463
+ * Used for all error responses (4xx, 5xx)
2464
+ * Matches ApplicationError.toErrorResponse() structure
2465
+ */
2466
+ declare const errorResponseSchema: z.ZodObject<{
2467
+ code: z.ZodNumber;
2468
+ message: z.ZodString;
2469
+ timestamp: z.ZodString;
2470
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2471
+ stack: z.ZodOptional<z.ZodString>;
2472
+ }, z.core.$strip>;
2473
+ /**
2474
+ * Validation error response schema
2475
+ * Used for 400 Bad Request with validation failures
2476
+ * Matches ApplicationError.toErrorResponse() structure with validation-specific metadata
2477
+ */
2478
+ declare const validationErrorResponseSchema: z.ZodObject<{
2479
+ code: z.ZodNumber;
2480
+ message: z.ZodString;
2481
+ timestamp: z.ZodString;
2482
+ metadata: z.ZodObject<{
2483
+ issues: z.ZodArray<z.ZodObject<{
2484
+ path: z.ZodString;
2485
+ message: z.ZodString;
2486
+ code: z.ZodString;
2487
+ }, z.core.$strip>>;
2488
+ }, z.core.$strip>;
2489
+ stack: z.ZodOptional<z.ZodString>;
2490
+ }, z.core.$strip>;
2491
+ /**
2492
+ * Pagination query parameters schema
2493
+ * Used for list endpoints
2494
+ */
2495
+ declare const paginationQuerySchema: z.ZodObject<{
2496
+ page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
2497
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
2498
+ }, z.core.$strip>;
2499
+ /**
2500
+ * Paginated response wrapper schema
2501
+ * Generic wrapper for paginated list responses
2502
+ */
2503
+ declare const paginatedResponseSchema: <T extends z.ZodType>(itemSchema: T) => z.ZodObject<{
2504
+ data: z.ZodArray<T>;
2505
+ pagination: z.ZodObject<{
2506
+ page: z.ZodNumber;
2507
+ limit: z.ZodNumber;
2508
+ total: z.ZodNumber;
2509
+ totalPages: z.ZodNumber;
2510
+ }, z.core.$strip>;
2511
+ }, z.core.$strip>;
2512
+ /**
2513
+ * UUID parameter schema
2514
+ * Used for :id parameters in RESTful routes
2515
+ */
2516
+ declare const uuidParamSchema: z.ZodObject<{
2517
+ id: z.ZodString;
2518
+ }, z.core.$strip>;
2519
+ /**
2520
+ * Success message response schema
2521
+ * Used for operations that don't return data (e.g., DELETE)
2522
+ */
2523
+ declare const successMessageSchema: z.ZodObject<{
2524
+ message: z.ZodString;
2525
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2526
+ }, z.core.$strip>;
2527
+ /**
2528
+ * Common HTTP status error schemas
2529
+ * Pre-configured for standard error responses
2530
+ */
2531
+ declare const commonErrorSchemas: {
2532
+ readonly 400: {
2533
+ readonly schema: z.ZodObject<{
2534
+ code: z.ZodNumber;
2535
+ message: z.ZodString;
2536
+ timestamp: z.ZodString;
2537
+ metadata: z.ZodObject<{
2538
+ issues: z.ZodArray<z.ZodObject<{
2539
+ path: z.ZodString;
2540
+ message: z.ZodString;
2541
+ code: z.ZodString;
2542
+ }, z.core.$strip>>;
2543
+ }, z.core.$strip>;
2544
+ stack: z.ZodOptional<z.ZodString>;
2545
+ }, z.core.$strip>;
2546
+ readonly description: "Validation error";
2547
+ };
2548
+ readonly 401: {
2549
+ readonly schema: z.ZodObject<{
2550
+ code: z.ZodNumber;
2551
+ message: z.ZodString;
2552
+ timestamp: z.ZodString;
2553
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2554
+ stack: z.ZodOptional<z.ZodString>;
2555
+ }, z.core.$strip>;
2556
+ readonly description: "Unauthorized";
2557
+ };
2558
+ readonly 403: {
2559
+ readonly schema: z.ZodObject<{
2560
+ code: z.ZodNumber;
2561
+ message: z.ZodString;
2562
+ timestamp: z.ZodString;
2563
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2564
+ stack: z.ZodOptional<z.ZodString>;
2565
+ }, z.core.$strip>;
2566
+ readonly description: "Forbidden";
2567
+ };
2568
+ readonly 404: {
2569
+ readonly schema: z.ZodObject<{
2570
+ code: z.ZodNumber;
2571
+ message: z.ZodString;
2572
+ timestamp: z.ZodString;
2573
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2574
+ stack: z.ZodOptional<z.ZodString>;
2575
+ }, z.core.$strip>;
2576
+ readonly description: "Not found";
2577
+ };
2578
+ readonly 409: {
2579
+ readonly schema: z.ZodObject<{
2580
+ code: z.ZodNumber;
2581
+ message: z.ZodString;
2582
+ timestamp: z.ZodString;
2583
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2584
+ stack: z.ZodOptional<z.ZodString>;
2585
+ }, z.core.$strip>;
2586
+ readonly description: "Conflict";
2587
+ };
2588
+ readonly 500: {
2589
+ readonly schema: z.ZodObject<{
2590
+ code: z.ZodNumber;
2591
+ message: z.ZodString;
2592
+ timestamp: z.ZodString;
2593
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2594
+ stack: z.ZodOptional<z.ZodString>;
2595
+ }, z.core.$strip>;
2596
+ readonly description: "Internal server error";
2597
+ };
2598
+ };
2599
+ //#endregion
2600
+ //#region src/router/middleware/domain.middleware.d.ts
2601
+ /**
2602
+ * Parse a domain pattern into a regex and extract parameter names.
2603
+ *
2604
+ * @example
2605
+ * parseDomainPattern('{tenant}.example.com')
2606
+ * // => { regex: /^([^.]+)\.example\.com$/, paramNames: ['tenant'] }
2607
+ *
2608
+ * parseDomainPattern('{region}.{tenant}.example.com')
2609
+ * // => { regex: /^([^.]+)\.([^.]+)\.example\.com$/, paramNames: ['region', 'tenant'] }
2610
+ */
2611
+ declare function parseDomainPattern(pattern: string): {
2612
+ regex: RegExp;
2613
+ paramNames: string[];
2614
+ };
2615
+ /**
2616
+ * Create a Hono middleware that matches the request host against a domain pattern.
2617
+ *
2618
+ * When the host matches, domain parameters are extracted and stored in context
2619
+ * variables accessible via `ctx.domain(key)`.
2620
+ *
2621
+ * When the host does NOT match, throws `DomainMismatchError` (404).
2622
+ *
2623
+ * @param pattern - Domain pattern with `{param}` placeholders (e.g., '{tenant}.myapp.com')
2624
+ *
2625
+ * @example
2626
+ * ```typescript
2627
+ * // Applied automatically by RouteRegistrationService for controllers with domain config
2628
+ * @Controller('/dashboard', { domain: '{tenant}.myapp.com' })
2629
+ * export class DashboardController {
2630
+ * async index(ctx: RouterContext) {
2631
+ * const tenant = ctx.domain('tenant')
2632
+ * }
2633
+ * }
2634
+ * ```
2635
+ */
2636
+ declare function createDomainMiddleware(pattern: string): MiddlewareHandler<RouterEnv>;
2637
+ //#endregion
2638
+ //#region src/router/middleware/verify-signature.middleware.d.ts
2639
+ /**
2640
+ * Middleware that verifies signed URLs.
2641
+ *
2642
+ * Checks the `signature` (and optionally `expires`) query params against the
2643
+ * request URL using HMAC-SHA256 via `crypto.subtle.verify()`.
2644
+ *
2645
+ * Requires `APP_SECRET` in the Cloudflare Workers environment bindings.
2646
+ *
2647
+ * @throws InvalidSignatureError (403) if signature is missing, invalid, or expired
2648
+ *
2649
+ * @example
2650
+ * ```typescript
2651
+ * @Module({ controllers: [UnsubscribeController], providers: [VerifySignatureMiddleware] })
2652
+ * export class EmailModule implements RouteConfigurable {
2653
+ * configureRoutes(router: Router): void {
2654
+ * router.middleware(VerifySignatureMiddleware)
2655
+ * }
2656
+ * }
2657
+ * ```
2658
+ */
2659
+ declare class VerifySignatureMiddleware implements Middleware {
2660
+ handle(ctx: RouterContext, next: Next$1): Promise<void>;
2661
+ }
2662
+ //#endregion
2663
+ //#region src/router/signed-url.d.ts
2664
+ /**
2665
+ * Signed URL utilities using HMAC-SHA256 via Web Crypto API.
2666
+ *
2667
+ * Follows the Cloudflare Workers signing pattern:
2668
+ * https://developers.cloudflare.com/workers/examples/signing-requests/
2669
+ *
2670
+ * Uses `crypto.subtle.verify()` for timing-attack-safe comparison.
2671
+ */
2672
+ /**
2673
+ * Options for signing a URL.
2674
+ */
2675
+ interface SignedUrlOptions {
2676
+ /** Time-to-live in seconds. URL expires after this duration. */
2677
+ expiresIn?: number;
2678
+ }
2679
+ /**
2680
+ * Sign a URL with HMAC-SHA256.
2681
+ *
2682
+ * Appends `signature` and optionally `expires` query parameters.
2683
+ * The signature covers the pathname + search (excluding the signature params themselves).
2684
+ *
2685
+ * @param url - Full URL or path to sign
2686
+ * @param secret - HMAC secret key (e.g., from env.APP_SECRET)
2687
+ * @param options - Optional expiration
2688
+ * @returns URL string with `signature` (and `expires`) query params appended
2689
+ */
2690
+ declare function signUrl(url: string, secret: string, options?: SignedUrlOptions): Promise<string>;
2691
+ /**
2692
+ * Verify a signed URL using `crypto.subtle.verify()` (timing-attack-safe).
2693
+ *
2694
+ * @param url - Full URL or path with signature query param
2695
+ * @param secret - HMAC secret key (same key used for signing)
2696
+ * @returns true if signature is valid and not expired
2697
+ */
2698
+ declare function verifySignedUrl(url: string, secret: string): Promise<boolean>;
2699
+ //#endregion
2700
+ //#region src/router/errors/controller-registration.error.d.ts
2701
+ /**
2702
+ * Error thrown when a controller fails to register
2703
+ *
2704
+ * This typically happens when:
2705
+ * - Controller is missing the `@Controller` decorator
2706
+ * - Controller route metadata is not set
2707
+ * - Controller class name is invalid
2708
+ *
2709
+ * Error Code: 9005
2710
+ */
2711
+ declare class ControllerRegistrationError extends ApplicationError {
2712
+ constructor(controllerName: string, reason?: string);
2713
+ }
2714
+ //#endregion
2715
+ //#region src/router/errors/hono-app-already-configured.error.d.ts
2716
+ /**
2717
+ * Error thrown when HonoApp.configure() is called more than once.
2718
+ *
2719
+ * HonoApp can only be configured a single time during application bootstrap.
2720
+ */
2721
+ declare class HonoAppAlreadyConfiguredError extends ApplicationError {
2722
+ constructor();
2723
+ }
2724
+ //#endregion
2725
+ //#region src/router/errors/openapi-route-registration.error.d.ts
2726
+ /**
2727
+ * OpenAPIRouteRegistrationError
2728
+ *
2729
+ * Thrown when an OpenAPI route fails to register properly
2730
+ * This indicates a configuration issue with route decorators or metadata
2731
+ * Uses i18n key for localized error messages
2732
+ *
2733
+ * @example
2734
+ * ```typescript
2735
+ * throw new OpenAPIRouteRegistrationError('/api/v1/users', 'Missing response schema')
2736
+ * ```
2737
+ */
2738
+ declare class OpenAPIRouteRegistrationError extends ApplicationError {
2739
+ constructor(path: string, reason: string);
2740
+ }
2741
+ //#endregion
2742
+ //#region src/router/errors/openapi-validation.error.d.ts
2743
+ /**
2744
+ * OpenAPIValidationError
2745
+ *
2746
+ * Thrown when OpenAPI request/response validation fails
2747
+ * Uses i18n key for localized error messages
2748
+ *
2749
+ * HTTP Status: 400 Bad Request
2750
+ * Error Code: 1004
2751
+ *
2752
+ * @example
2753
+ * ```typescript
2754
+ * throw new OpenAPIValidationError('Request body missing required field: email')
2755
+ * ```
2756
+ */
2757
+ declare class OpenAPIValidationError extends ApplicationError {
2758
+ constructor(details: string);
2759
+ }
2760
+ //#endregion
2761
+ //#region src/router/errors/route-not-found.error.d.ts
2762
+ /**
2763
+ * Error thrown when a requested route is not found
2764
+ *
2765
+ * HTTP Status: 404 Not Found
2766
+ * Error Code: 4004
2767
+ */
2768
+ declare class RouteNotFoundError extends ApplicationError {
2769
+ constructor(path: string, method: string);
2770
+ }
2771
+ //#endregion
2772
+ //#region src/router/errors/schema-validation.error.d.ts
2773
+ /**
2774
+ * SchemaValidationError
2775
+ *
2776
+ * Thrown when Zod schema validation fails
2777
+ */
2778
+ declare class SchemaValidationError extends ApplicationError {
2779
+ constructor(zodError: ZodError);
2780
+ }
2781
+ //#endregion
2782
+ //#region src/router/errors/index.d.ts
2783
+ /**
2784
+ * Error thrown when a request's host header does not match the expected domain pattern.
2785
+ *
2786
+ * HTTP Status: 404 Not Found
2787
+ */
2788
+ declare class DomainMismatchError extends HttpException {
2789
+ constructor();
2790
+ }
2791
+ /**
2792
+ * Thrown when registering a named route that conflicts with an existing route name.
2793
+ *
2794
+ * Error Code: 9010
2795
+ */
2796
+ declare class DuplicateRouteNameError extends ApplicationError {
2797
+ constructor(name: string, existingHandler: string, newHandler: string);
2798
+ }
2799
+ /**
2800
+ * Error thrown when a signed URL has an invalid or expired signature.
2801
+ *
2802
+ * HTTP Status: 403 Forbidden
2803
+ */
2804
+ declare class InvalidSignatureError extends HttpException {
2805
+ constructor();
2806
+ }
2807
+ /**
2808
+ * Thrown when a required environment variable is not set.
2809
+ *
2810
+ * Maps to HTTP 500 via error code range (9xxx → 500).
2811
+ */
2812
+ declare class MissingEnvironmentVariableError extends ApplicationError {
2813
+ constructor(variable: string);
2814
+ }
2815
+ /**
2816
+ * Thrown when a required path or domain parameter is missing during URL generation.
2817
+ *
2818
+ * Error Code: 9012
2819
+ */
2820
+ declare class MissingRouteParamError extends ApplicationError {
2821
+ constructor(param: string, name: string, path: string);
2822
+ }
2823
+ /**
2824
+ * ResponseValidationError
2825
+ *
2826
+ * Thrown when a controller's response body does not match the declared Zod response schema.
2827
+ * Indicates a server-side schema mismatch — the controller is returning data that
2828
+ * violates its own API contract.
2829
+ */
2830
+ declare class ResponseValidationError extends ApplicationError {
2831
+ constructor(zodError: ZodError);
2832
+ }
2833
+ /**
2834
+ * Thrown when attempting to generate a URL for a route name that doesn't exist in the registry.
2835
+ *
2836
+ * Error Code: 9011
2837
+ */
2838
+ declare class RouteNameNotFoundError extends ApplicationError {
2839
+ constructor(name: string);
2840
+ }
2841
+ /**
2842
+ * Thrown when `router.use()` is called inside a `group()` callback.
2843
+ * `use()` registers global middleware and is only allowed on the root Router.
2844
+ *
2845
+ * Error Code: 9013
2846
+ */
2847
+ declare class RouterUseScopeError extends ApplicationError {
2848
+ constructor();
2849
+ }
2850
+ //#endregion
2851
+ //#region src/application.d.ts
2852
+ interface ApplicationConfig {
2853
+ /** Root application module */
2854
+ module: ModuleClass | DynamicModule;
2855
+ /** Logging configuration. Defaults: level=INFO, formatter='json' */
2856
+ logging?: {
2857
+ level?: LogLevel;
2858
+ formatter?: 'json' | 'pretty';
2859
+ };
2860
+ /**
2861
+ * API versioning configuration.
2862
+ * When provided, enables URI-based versioning for controllers.
2863
+ */
2864
+ versioning?: VersioningOptions;
2865
+ /**
2866
+ * Custom exception handler class.
2867
+ *
2868
+ * Extend {@link ExceptionHandler} and override `register()` to configure
2869
+ * custom reporting, rendering, and post-processing of exceptions.
2870
+ *
2871
+ * When not provided, {@link DefaultExceptionHandler} is used (standard
2872
+ * severity-based logging and JSON error responses).
2873
+ *
2874
+ * @example
2875
+ * ```typescript
2876
+ * new Stratal({
2877
+ * module: AppModule,
2878
+ * exceptionHandler: AppExceptionHandler,
2879
+ * })
2880
+ * ```
2881
+ */
2882
+ exceptionHandler?: Constructor<ExceptionHandler>;
2883
+ }
2884
+ interface ApplicationOptions extends ApplicationConfig {
2885
+ env: StratalEnv;
2886
+ ctx: StratalExecutionContext;
2887
+ }
2888
+ /**
2889
+ * Application
2890
+ *
2891
+ * Main application class managing the two-tier container hierarchy:
2892
+ * - Global Container: All services (singletons via tsyringe native)
2893
+ * - Request Container: Child of global, context-enriched instances per request
2894
+ *
2895
+ * @example
2896
+ * ```typescript
2897
+ * const app = new Application({ module: AppModule, env, ctx })
2898
+ * await app.initialize()
2899
+ *
2900
+ * // Access container via getter
2901
+ * const service = app.container.resolve(MY_TOKEN)
2902
+ *
2903
+ * // Handle HTTP request (via HonoApp)
2904
+ * // Handle queue batch
2905
+ * await app.handleQueue(batch, 'my-queue')
2906
+ * ```
2907
+ */
2908
+ declare class Application {
2909
+ /**
2910
+ * Unified Container - manages all DI operations
2911
+ */
2912
+ private _container;
2913
+ private honoApp;
2914
+ private moduleRegistry;
2915
+ private consumerRegistry;
2916
+ private cronManager;
2917
+ private quarry;
2918
+ private initialized;
2919
+ readonly env: StratalEnv;
2920
+ private readonly appConfig;
2921
+ constructor({
2922
+ env,
2923
+ ctx,
2924
+ ...config
2925
+ }: ApplicationOptions);
2926
+ /**
2927
+ * Get the Container instance
2928
+ */
2929
+ get container(): Container;
2930
+ /**
2931
+ * Get the HonoApp instance
2932
+ */
2933
+ get hono(): HonoApp;
2934
+ /**
2935
+ * Get the application configuration
2936
+ */
2937
+ get config(): ApplicationConfig;
2938
+ initialize(): Promise<void>;
2939
+ private initializeInternal;
2940
+ /**
2941
+ * Register routing services as singletons in the container.
2942
+ * Called after module initialization so I18N_TOKENS.Options is available.
2943
+ */
2944
+ private registerRoutingServices;
2945
+ /**
2946
+ * Resolve a service from the container
2947
+ */
2948
+ resolve<T>(token: symbol): T;
2949
+ /**
2950
+ * Handle queue batch processing
2951
+ */
2952
+ handleQueue(batch: MessageBatch, queueName: string): Promise<void>;
2953
+ /**
2954
+ * Handle scheduled cron trigger
2955
+ */
2956
+ handleScheduled(controller: ScheduledController): Promise<void>;
2957
+ /**
2958
+ * Create mock RouterContext for queue/cron/seeder processing
2959
+ */
2960
+ createMockRouterContext(locale?: string): RouterContext;
2961
+ shutdown(): Promise<void>;
2962
+ /**
2963
+ * Execute a command by name in a request-scoped container.
2964
+ */
2965
+ handleCommand(name: string, input?: CommandInput): Promise<CommandResult>;
2966
+ private registerCommands;
2967
+ private registerSeeders;
2968
+ private registerQueueConsumers;
2969
+ private registerCronJobs;
2970
+ /**
2971
+ * Auto-wire `@Listener()` classes with the EventRegistry.
2972
+ */
2973
+ private registerEventListeners;
2974
+ /**
2975
+ * Register LoggerService and dependencies
2976
+ */
2977
+ private registerLoggerService;
2978
+ /**
2979
+ * Register core services with explicit scope
2980
+ */
2981
+ private registerCoreServices;
2982
+ /**
2983
+ * Initialize the ExceptionHandler: call register(), then module onException hooks.
2984
+ */
2985
+ private initializeExceptionHandler;
2986
+ }
2987
+ //#endregion
2988
+ //#region src/router/services/versioning.service.d.ts
2989
+ /**
2990
+ * Resolves version prefixes for route paths.
2991
+ *
2992
+ * Handles VERSION_NEUTRAL, multi-version arrays, default version fallback,
2993
+ * and configurable prefix (default: 'v').
2994
+ *
2995
+ * Registered as a singleton in the container.
2996
+ */
2997
+ declare class VersioningService {
2998
+ private readonly options;
2999
+ constructor(app: Application);
3000
+ /** Whether versioning is enabled */
3001
+ get enabled(): boolean;
3002
+ /**
3003
+ * Resolve versioned paths for a base path.
3004
+ *
3005
+ * @param basePath - The base path (e.g., '/users')
3006
+ * @param version - Explicit version from controller/router config
3007
+ * @returns Array of versioned path strings (e.g., ['/v1/users', '/v2/users'])
3008
+ */
3009
+ resolve(basePath: string, version?: string | string[] | typeof VERSION_NEUTRAL): string[];
3010
+ }
3011
+ //#endregion
3012
+ //#region src/router/route-registry.d.ts
3013
+ /**
3014
+ * A single registered route in the application.
3015
+ * Tracks both named and unnamed routes, HTTP and WebSocket.
3016
+ */
3017
+ interface RegisteredRoute {
3018
+ /** Route name for URL generation (undefined = unnamed, still tracked) */
3019
+ name?: string;
3020
+ /** HTTP method or 'ws' for WebSocket gateways */
3021
+ method: HttpMethod | 'ws';
3022
+ /** Primary path in Hono-style :param format */
3023
+ path: string;
3024
+ /** Locale-prefixed path variants (e.g., '/:locale/users/:id') */
3025
+ localePaths?: string[];
3026
+ /** Parameter names extracted from path */
3027
+ paramNames: string[];
3028
+ /** Domain pattern (e.g., '{tenant}.example.com') */
3029
+ domain?: string;
3030
+ /** Parameter names extracted from domain */
3031
+ domainParamNames: string[];
3032
+ /** Controller class name */
3033
+ controller: string;
3034
+ /** Controller method name */
3035
+ action: string;
3036
+ /** Whether the route is hidden from OpenAPI docs */
3037
+ hidden: boolean;
3038
+ /** Middleware class names applied to this route */
3039
+ middleware: string[];
3040
+ /** Whether this is a locale-prefixed variant */
3041
+ isLocaleVariant?: boolean;
3042
+ }
3043
+ /**
3044
+ * Input for registering a route. The registry auto-extracts param names
3045
+ * and expands versioned/locale paths via injected services.
3046
+ */
3047
+ type RouteRegistrationInput = Omit<RegisteredRoute, 'paramNames' | 'domainParamNames' | 'path' | 'localePaths' | 'isLocaleVariant'> & {
3048
+ /** Base path before versioning/locale expansion */basePath: string; /** Version from controller/router config (used by VersioningService). Accepts VERSION_NEUTRAL symbol. */
3049
+ version?: string | string[] | typeof VERSION_NEUTRAL; /** Pre-computed param names (optional, auto-extracted if omitted) */
3050
+ paramNames?: string[]; /** Pre-computed domain param names (optional, auto-extracted if omitted) */
3051
+ domainParamNames?: string[];
3052
+ };
3053
+ /**
3054
+ * Central registry for all application routes.
3055
+ * Single source of truth — used by `route:list`, `route:types`, and URL generation.
3056
+ *
3057
+ * Routes are automatically expanded via VersioningService and LocalePathService
3058
+ * during registration, and sorted by specificity when retrieved via `all()`.
3059
+ *
3060
+ * Registered as a singleton in the container.
3061
+ */
3062
+ declare class RouteRegistry {
3063
+ private readonly versioningService;
3064
+ private readonly localePathService;
3065
+ private readonly routes;
3066
+ private readonly namedRoutes;
3067
+ private _sortedCache;
3068
+ constructor(versioningService: VersioningService, localePathService: LocalePathService);
3069
+ /**
3070
+ * Register a route. Expands via VersioningService + LocalePathService.
3071
+ * Named routes must have unique names.
3072
+ *
3073
+ * @returns Array of expanded RegisteredRoute entries (primary + locale variants)
3074
+ * @throws DuplicateRouteNameError if a named route with the same name already exists
3075
+ */
3076
+ register(input: RouteRegistrationInput): RegisteredRoute[];
3077
+ /** Get a named route by name */
3078
+ get(name: string): RegisteredRoute | undefined;
3079
+ /** Check if a named route exists */
3080
+ has(name: string): boolean;
3081
+ /** Get all routes sorted by specificity (static > param > wildcard, primary before locale) */
3082
+ all(): RegisteredRoute[];
3083
+ /** Get only named routes */
3084
+ named(): RegisteredRoute[];
3085
+ }
3086
+ //#endregion
3087
+ //#region src/router/uri.d.ts
3088
+ /**
3089
+ * Options for URL generation methods.
3090
+ */
3091
+ interface UriOptions {
3092
+ /** Generate absolute URL (scheme + host). Defaults to false. */
3093
+ absolute?: boolean;
3094
+ }
3095
+ /**
3096
+ * Options for signed URL generation methods.
3097
+ */
3098
+ interface SignedUriOptions extends UriOptions, SignedUrlOptions {}
3099
+ /**
3100
+ * Build a URL from a registered route, filling path/domain params and appending extras as query string.
3101
+ *
3102
+ * Pure function — no request context needed. Used by both the `Uri` class and the standalone `route()` function.
3103
+ *
3104
+ * @param route - The registered route to build a URL for
3105
+ * @param name - Route name (used in error messages)
3106
+ * @param params - Path params, domain params, and extra query params
3107
+ * @returns Relative URL string (or absolute with domain prefix if route has a domain pattern)
3108
+ *
3109
+ * @throws MissingRouteParamError if a required path or domain param is missing
3110
+ */
3111
+ declare function buildRouteUrl(route: RegisteredRoute, name: string, params?: Record<string, string>): string;
3112
+ /**
3113
+ * URL generation service for named routes, signed URLs, and request URL access.
3114
+ *
3115
+ * Registered as request-scoped in the container — has access to the current request
3116
+ * via RouterContext for features like `current()`, `full()`, and signed URLs.
3117
+ *
3118
+ * @example
3119
+ * ```typescript
3120
+ * // In a controller:
3121
+ * const uri = ctx.getContainer().resolve<Uri>(ROUTER_TOKENS.Uri)
3122
+ * uri.route('users.show', { id: '1' })
3123
+ * uri.current()
3124
+ * await uri.signedRoute('unsubscribe', { user: '1' }, { expiresIn: 3600 })
3125
+ *
3126
+ * // Set defaults (e.g., in middleware):
3127
+ * uri.defaults({ locale: 'en' })
3128
+ * uri.route('posts.index') // auto-fills :locale param
3129
+ * ```
3130
+ */
3131
+ declare class Uri {
3132
+ private readonly registry;
3133
+ private readonly routerContext;
3134
+ private _defaults;
3135
+ constructor(registry: RouteRegistry, routerContext: RouterContext);
3136
+ /**
3137
+ * Set default URL parameters for this request.
3138
+ * Applied to all subsequent `route()` calls — explicit params override defaults.
3139
+ *
3140
+ * @param params - Default parameters (e.g., `{ locale: 'en' }`)
3141
+ */
3142
+ defaults(params: Record<string, string>): void;
3143
+ /**
3144
+ * Generate a URL from a named route.
3145
+ *
3146
+ * Keys matching `:param` placeholders fill the path.
3147
+ * Domain params (`{tenant}`) are consumed from the same object.
3148
+ * Extra keys become query string parameters.
3149
+ * Default params (from `defaults()`) are merged — explicit params override.
3150
+ *
3151
+ * @param name - Named route identifier
3152
+ * @param params - Route params + domain params + extra query params
3153
+ * @param options - URL generation options
3154
+ * @returns Generated URL string
3155
+ *
3156
+ * @throws RouteNameNotFoundError if route name not found
3157
+ * @throws MissingRouteParamError if required params missing
3158
+ */
3159
+ route<N extends RouteName>(name: N, params?: RouteParams<N>, options?: UriOptions): string;
3160
+ /**
3161
+ * Generate a signed URL from a named route.
3162
+ *
3163
+ * @param name - Named route identifier
3164
+ * @param params - Route params + domain params + extra query params
3165
+ * @param options - Signing options (e.g., expiresIn) and URL options
3166
+ * @returns Signed URL string with signature query param
3167
+ *
3168
+ * @throws Error if APP_SECRET environment variable is not set
3169
+ */
3170
+ signedRoute<N extends RouteName>(name: N, params?: RouteParams<N>, options?: SignedUriOptions): Promise<string>;
3171
+ /**
3172
+ * Generate a temporary signed URL from a named route.
3173
+ *
3174
+ * @param name - Named route identifier
3175
+ * @param expiresIn - Time-to-live in seconds
3176
+ * @param params - Route params + domain params + extra query params
3177
+ * @param options - URL generation options
3178
+ * @returns Signed URL string with signature and expires query params
3179
+ *
3180
+ * @throws Error if APP_SECRET environment variable is not set
3181
+ */
3182
+ temporarySignedRoute<N extends RouteName>(name: N, expiresIn: number, params?: RouteParams<N>, options?: UriOptions): Promise<string>;
3183
+ /**
3184
+ * Check if the current request has a valid signature.
3185
+ *
3186
+ * @returns true if the URL signature is valid and not expired
3187
+ */
3188
+ hasValidSignature(): Promise<boolean>;
3189
+ /**
3190
+ * Get the current request URL pathname (without query string).
3191
+ */
3192
+ current(): string;
3193
+ /**
3194
+ * Get the current request URL with query string (pathname + search).
3195
+ */
3196
+ full(): string;
3197
+ /**
3198
+ * Get the previous request URL from the Referer header.
3199
+ *
3200
+ * @param fallback - URL to return if no Referer header (default: '/')
3201
+ */
3202
+ previous(fallback?: string): string;
3203
+ /**
3204
+ * Get the previous request URL pathname (no query string or host) from the Referer header.
3205
+ *
3206
+ * @param fallback - Path to return if no Referer header (default: '/')
3207
+ */
3208
+ previousPath(fallback?: string): string;
3209
+ /**
3210
+ * Build a URL to a raw path (not a named route) with optional query params.
3211
+ *
3212
+ * @param path - URL path (e.g., '/users')
3213
+ * @param queryParams - Query parameters to append
3214
+ * @param options - URL generation options
3215
+ */
3216
+ to(path: string, queryParams?: Record<string, string>, options?: UriOptions): string;
3217
+ /**
3218
+ * Build a URL with query string parameters. Merges with existing query params in path.
3219
+ *
3220
+ * @param path - URL path, may already contain query params
3221
+ * @param queryParams - Query parameters to merge (new values override existing)
3222
+ */
3223
+ query(path: string, queryParams: Record<string, string>): string;
3224
+ private getAppSecret;
3225
+ }
3226
+ //#endregion
3227
+ //#region src/router/router-context.d.ts
3228
+ type ContextQueryResult<R extends Record<string, unknown> | undefined, K extends string | undefined> = K extends string ? string : R extends undefined ? Record<string, unknown> : R;
3229
+ /**
3230
+ * Router context wrapper with helper methods
3231
+ *
3232
+ * Provides convenient access to Hono's context and common request/response operations.
3233
+ * The native Hono context is available via the `c` property for advanced use cases.
3234
+ *
3235
+ * @example
3236
+ * ```typescript
3237
+ * async index(ctx: RouterContext): Promise<Response> {
3238
+ * // Use helper methods
3239
+ * const users = await this.service.findAll()
3240
+ * return ctx.json(users)
3241
+ * }
3242
+ *
3243
+ * async show(ctx: RouterContext): Promise<Response> {
3244
+ * // Access route params
3245
+ * const id = ctx.param('id')
3246
+ * const user = await this.service.findById(id)
3247
+ * return ctx.json(user)
3248
+ * }
3249
+ *
3250
+ * async create(ctx: RouterContext): Promise<Response> {
3251
+ * // Parse request body
3252
+ * const body = await ctx.body<CreateUserInput>()
3253
+ * const user = await this.service.create(body)
3254
+ * return ctx.json(user, 201)
3255
+ * }
3256
+ * ```
3257
+ */
3258
+ declare class RouterContext<T extends RouterEnv = RouterEnv> {
3259
+ readonly c: Context<T>;
3260
+ /**
3261
+ * Native Hono context
3262
+ * Access for advanced use cases not covered by helper methods
3263
+ */
3264
+ constructor(c: Context<T>);
3265
+ /**
3266
+ * Get request-scoped DI container
3267
+ * Contains request-specific services and context (AuthContext)
3268
+ *
3269
+ * @throws Error if container not initialized
3270
+ */
3271
+ getContainer(): Container;
3272
+ /**
3273
+ * Set locale for the current request
3274
+ *
3275
+ * @param locale - Locale code (e.g., 'en', 'fr')
3276
+ */
3277
+ setLocale(locale: string): void;
3278
+ /**
3279
+ * Get locale for the current request
3280
+ *
3281
+ * @returns Current locale code
3282
+ */
3283
+ getLocale(): string;
3284
+ /**
3285
+ * Return JSON response
3286
+ *
3287
+ * When data is null, automatically returns 204 No Content (configurable via status param).
3288
+ *
3289
+ * @param data - Data to serialize as JSON, or null for 204
3290
+ * @param status - HTTP status code (default: 200, or 204 when data is null)
3291
+ */
3292
+ json(data: object | null, status?: ContentfulStatusCode): Response;
3293
+ /**
3294
+ * Get route parameter value
3295
+ *
3296
+ * @param key - Parameter name (e.g., 'id' for /users/:id)
3297
+ */
3298
+ param(key: string): string;
3299
+ /**
3300
+ * Get query parameter value
3301
+ *
3302
+ * @param key - Query parameter name
3303
+ */
3304
+ query<R extends Record<string, unknown> | undefined = undefined, K extends string | undefined = undefined>(key?: K): ContextQueryResult<R, K>;
3305
+ /**
3306
+ * Get request header value
3307
+ *
3308
+ * @param name - Header name (case-insensitive)
3309
+ */
3310
+ header(name: string): string | undefined;
3311
+ /**
3312
+ * Get validated request body from OpenAPI route
3313
+ * Returns pre-validated data that has passed schema validation
3314
+ *
3315
+ * @returns Validated JSON body
3316
+ */
3317
+ body<T>(): Promise<T>;
3318
+ /**
3319
+ * Return text response
3320
+ *
3321
+ * @param text - Text content
3322
+ * @param status - HTTP status code (default: 200)
3323
+ */
3324
+ text(text: string, status?: ContentfulStatusCode): Response;
3325
+ /**
3326
+ * Return HTML response
3327
+ *
3328
+ * @param html - HTML content
3329
+ * @param status - HTTP status code (default: 200)
3330
+ */
3331
+ html(html: string, status?: ContentfulStatusCode): Response;
3332
+ /**
3333
+ * Generate a URL from a named route.
3334
+ *
3335
+ * Keys matching `:param` placeholders fill the path.
3336
+ * Domain params are consumed from the same object.
3337
+ * Extra keys become query string parameters.
3338
+ *
3339
+ * @param name - Named route identifier
3340
+ * @param params - Route params + domain params + extra query params
3341
+ * @param options - URL generation options (e.g., `{ absolute: true }`)
3342
+ *
3343
+ * @example
3344
+ * ```typescript
3345
+ * ctx.route('users.show', { id: '1' }) // '/v1/users/1'
3346
+ * ctx.route('users.show', { id: '1', q: 'test' }) // '/v1/users/1?q=test'
3347
+ * ```
3348
+ */
3349
+ route<N extends RouteName>(name: N, params?: RouteParams<N>, options?: UriOptions): string;
3350
+ /**
3351
+ * Get a domain parameter value from the current request.
3352
+ * Domain params are set by the domain matching middleware.
3353
+ *
3354
+ * @param key - Domain parameter name (e.g., 'tenant' from '{tenant}.myapp.com')
3355
+ *
3356
+ * @example
3357
+ * ```typescript
3358
+ * const tenant = ctx.domain('tenant')
3359
+ * ```
3360
+ */
3361
+ domain(key: string): string;
3362
+ /**
3363
+ * Generate a signed URL from a named route.
3364
+ *
3365
+ * @param name - Named route identifier
3366
+ * @param params - Route params (same as route())
3367
+ * @param options - Signing options (e.g., expiresIn) and URL options
3368
+ * @returns Signed URL string with signature query param
3369
+ */
3370
+ signedUrl<N extends RouteName>(name: N, params?: RouteParams<N>, options?: SignedUriOptions): Promise<string>;
3371
+ /**
3372
+ * Check if the current request has a valid signature.
3373
+ *
3374
+ * @returns true if the URL signature is valid and not expired
3375
+ */
3376
+ hasValidSignature(): Promise<boolean>;
3377
+ /**
3378
+ * Redirect to another URL
3379
+ *
3380
+ * @param url - Target URL
3381
+ * @param status - HTTP status code (default: 302)
3382
+ */
3383
+ redirect(url: string, status?: RedirectStatusCode): Response;
3384
+ /**
3385
+ * Return a streaming response (binary/generic)
3386
+ *
3387
+ * @param callback - Async function that writes to the stream
3388
+ * @param onError - Optional error handler called if an error occurs during streaming
3389
+ */
3390
+ stream(callback: (stream: StreamingApi) => Promise<void>, onError?: (err: Error, stream: StreamingApi) => Promise<void>): Response;
3391
+ /**
3392
+ * Return a streaming text response
3393
+ *
3394
+ * Automatically sets `Content-Encoding: Identity` for Cloudflare Workers compatibility.
3395
+ *
3396
+ * @param callback - Async function that writes text to the stream
3397
+ * @param onError - Optional error handler called if an error occurs during streaming
3398
+ */
3399
+ streamText(callback: (stream: StreamingApi) => Promise<void>, onError?: (err: Error, stream: StreamingApi) => Promise<void>): Response;
3400
+ /**
3401
+ * Return a Server-Sent Events (SSE) streaming response
3402
+ *
3403
+ * Automatically sets `Content-Encoding: Identity` for Cloudflare Workers compatibility.
3404
+ *
3405
+ * @param callback - Async function that writes SSE events to the stream
3406
+ * @param onError - Optional error handler called if an error occurs during streaming
3407
+ */
3408
+ streamSSE(callback: (stream: SSEStreamingApi) => Promise<void>, onError?: (err: Error, stream: SSEStreamingApi) => Promise<void>): Response;
3409
+ private resolveUri;
3410
+ }
3411
+ //#endregion
3412
+ //#region src/errors/exception-context.d.ts
3413
+ /**
3414
+ * Exception context for errors occurring during HTTP request handling.
3415
+ *
3416
+ * Provides access to the full {@link RouterContext} for building responses
3417
+ * with `ctx.json()`, `ctx.text()`, `ctx.html()`, etc.
3418
+ */
3419
+ interface HttpExceptionContext {
3420
+ readonly type: 'http';
3421
+ /** Stratal RouterContext — use for building HTTP responses */
3422
+ readonly ctx: RouterContext;
3423
+ }
3424
+ /**
3425
+ * Exception context for errors occurring during queue message processing.
3426
+ */
3427
+ interface QueueExceptionContext {
3428
+ readonly type: 'queue';
3429
+ /** Name of the queue being processed */
3430
+ readonly queueName: string;
3431
+ }
3432
+ /**
3433
+ * Exception context for errors occurring during scheduled cron execution.
3434
+ */
3435
+ interface CronExceptionContext {
3436
+ readonly type: 'cron';
3437
+ }
3438
+ /**
3439
+ * Exception context for errors occurring during CLI command execution.
3440
+ */
3441
+ interface CliExceptionContext {
3442
+ readonly type: 'cli';
3443
+ /** Name of the command that threw */
3444
+ readonly commandName: string;
3445
+ }
3446
+ /**
3447
+ * Discriminated union of all exception context types.
3448
+ *
3449
+ * Narrow via `ctx.type` to access context-specific properties:
3450
+ *
3451
+ * @example
3452
+ * ```typescript
3453
+ * handler.renderable(MyError, (error, ctx) => {
3454
+ * if (ctx.type === 'http') {
3455
+ * return ctx.ctx.json({ message: 'Something went wrong' }, 500)
3456
+ * }
3457
+ * // Non-HTTP contexts: return undefined to use default rendering
3458
+ * })
3459
+ * ```
3460
+ */
3461
+ type ExceptionContext = HttpExceptionContext | QueueExceptionContext | CronExceptionContext | CliExceptionContext;
3462
+ /**
3463
+ * Create an HTTP exception context from a Hono context.
3464
+ *
3465
+ * @param c - The raw Hono context from the request
3466
+ * @returns An {@link HttpExceptionContext} wrapping a RouterContext
3467
+ */
3468
+ declare function createHttpExceptionContext(c: Context<RouterEnv>): HttpExceptionContext;
3469
+ /**
3470
+ * Create a queue exception context.
3471
+ *
3472
+ * @param queueName - The name of the queue being processed
3473
+ * @returns A {@link QueueExceptionContext}
3474
+ */
3475
+ declare function createQueueExceptionContext(queueName: string): QueueExceptionContext;
3476
+ /**
3477
+ * Create a cron exception context.
3478
+ *
3479
+ * @returns A {@link CronExceptionContext}
3480
+ */
3481
+ declare function createCronExceptionContext(): CronExceptionContext;
3482
+ /**
3483
+ * Create a CLI command exception context.
3484
+ *
3485
+ * @param commandName - The name of the command that threw
3486
+ * @returns A {@link CliExceptionContext}
3487
+ */
3488
+ declare function createCliExceptionContext(commandName: string): CliExceptionContext;
3489
+ //#endregion
3490
+ //#region src/i18n/errors/locale-not-supported.error.d.ts
3491
+ declare class LocaleNotSupportedError extends ApplicationError {
3492
+ constructor(locale: string, supportedLocales: string[]);
3493
+ }
3494
+ //#endregion
3495
+ //#region src/i18n/errors/translation-missing.error.d.ts
3496
+ declare class TranslationMissingError extends ApplicationError {
3497
+ constructor(key: string, locale: string);
3498
+ }
3499
+ //#endregion
3500
+ //#region src/i18n/i18n.options.d.ts
3501
+ /**
3502
+ * Detection strategy for locale resolution
3503
+ *
3504
+ * - `'cookie'` — reads from the `locale` cookie (default)
3505
+ * - `'header'` — reads from the `Accept-Language` header
3506
+ * - `'querystring'` — reads from the `?locale=` query parameter
3507
+ * - `'path'` — reads from the first URL path segment (e.g., `/en/api/users`)
3508
+ */
3509
+ type DetectionStrategy = 'cookie' | 'header' | 'querystring' | 'path';
3510
+ interface BaseDetection {
3511
+ /** Set to false to disable language detection entirely. @default true */
3512
+ enabled?: boolean;
3513
+ }
3514
+ /**
3515
+ * Language detection options (discriminated by strategy)
3516
+ *
3517
+ * @example Cookie detection (default)
3518
+ * ```typescript
3519
+ * { strategy: 'cookie' }
3520
+ * ```
3521
+ *
3522
+ * @example Header detection
3523
+ * ```typescript
3524
+ * { strategy: 'header' }
3525
+ * ```
3526
+ *
3527
+ * @example Path detection
3528
+ * ```typescript
3529
+ * { strategy: 'path' }
3530
+ * ```
3531
+ *
3532
+ * @example Disable detection
3533
+ * ```typescript
3534
+ * { enabled: false }
3535
+ * ```
3536
+ */
3537
+ type LanguageDetectionOptions = (BaseDetection & {
3538
+ strategy?: 'cookie';
3539
+ cookieOptions?: DetectorOptions['cookieOptions'];
3540
+ }) | (BaseDetection & {
3541
+ strategy: 'header';
3542
+ }) | (BaseDetection & {
3543
+ strategy: 'querystring';
3544
+ }) | (BaseDetection & {
3545
+ strategy: 'path';
3546
+ /**
3547
+ * Controls whether the default locale gets a URL path prefix.
3548
+ *
3549
+ * - `false` (default) — The default locale has no prefix (`/users`), other locales
3550
+ * are prefixed (`/fr/users`). Requests to the prefixed default locale (`/en/users`) return 404.
3551
+ * - `'redirect'` — Same as `false`, but requests to the prefixed default locale
3552
+ * (`/en/users`) are 301-redirected to the unprefixed path (`/users`).
3553
+ * - `true` — All locales are prefixed (`/en/users`, `/fr/users`).
3554
+ *
3555
+ * @default false
3556
+ */
3557
+ prefixDefaultLocale?: false | true | 'redirect';
3558
+ }) | {
3559
+ enabled: false;
3560
+ };
3561
+ /**
3562
+ * Options for configuring the I18n module
3563
+ *
3564
+ * @example
3565
+ * ```typescript
3566
+ * I18nModule.forRoot({
3567
+ * defaultLocale: 'en',
3568
+ * fallbackLocale: 'en',
3569
+ * locales: ['en', 'fr'],
3570
+ * detection: { strategy: 'header' },
3571
+ * })
3572
+ * ```
3573
+ */
3574
+ interface I18nModuleOptions {
3575
+ /**
3576
+ * Default locale for the application
3577
+ * @default 'en'
3578
+ */
3579
+ defaultLocale?: string;
3580
+ /**
3581
+ * Fallback locale when translation is missing
3582
+ * @default 'en'
3583
+ */
3584
+ fallbackLocale?: string;
3585
+ /**
3586
+ * List of supported locales
3587
+ * Request locales not in this list will fall back to defaultLocale
3588
+ */
3589
+ locales?: string[];
3590
+ /**
3591
+ * Language detection configuration
3592
+ * Controls how the locale is extracted from incoming requests
3593
+ */
3594
+ detection?: LanguageDetectionOptions;
3595
+ }
3596
+ /**
3597
+ * Resolved options with all defaults applied
3598
+ * Used internally by I18n services
3599
+ */
3600
+ interface ResolvedI18nOptions {
3601
+ defaultLocale: string;
3602
+ fallbackLocale: string;
3603
+ locales: string[];
3604
+ detection: {
3605
+ enabled: boolean;
3606
+ strategy: DetectionStrategy; /** Resolved value of the path detection `prefixDefaultLocale` option. Only meaningful when `strategy` is `'path'`. */
3607
+ prefixDefaultLocale: false | true | 'redirect';
3608
+ };
3609
+ }
3610
+ /**
3611
+ * Resolve I18n options with defaults
3612
+ */
3613
+ declare function resolveI18nOptions(options?: I18nModuleOptions): ResolvedI18nOptions;
3614
+ /**
3615
+ * Build Hono languageDetector options from I18n module options
3616
+ */
3617
+ declare function buildDetectorOptions(options?: I18nModuleOptions): Partial<DetectorOptions>;
3618
+ //#endregion
3619
+ //#region src/i18n/i18n.module.d.ts
3620
+ declare class I18nModule implements RouteConfigurable {
3621
+ /**
3622
+ * Configure I18n locale settings
3623
+ *
3624
+ * Call once in the root module. Does not accept messages —
3625
+ * use `registerMessages()` to add translations.
3626
+ *
3627
+ * @param options - Locale configuration (defaultLocale, fallbackLocale, locales)
3628
+ */
3629
+ static forRoot(options?: I18nModuleOptions): DynamicModule;
3630
+ /**
3631
+ * Register i18n messages
3632
+ *
3633
+ * Can be called from any module, as many times as needed.
3634
+ * Messages are deep-merged in registration order — later calls override earlier ones at leaf level.
3635
+ *
3636
+ * @param messages - Messages keyed by locale code
3637
+ *
3638
+ * @example App-level messages
3639
+ * ```typescript
3640
+ * I18nModule.registerMessages({
3641
+ * en: { common: { hello: 'Hello' }, errors: { notFound: 'Not found' } },
3642
+ * fr: { common: { hello: 'Bonjour' }, errors: { notFound: 'Introuvable' } },
3643
+ * })
3644
+ * ```
3645
+ *
3646
+ * @example Package-level messages
3647
+ * ```typescript
3648
+ * I18nModule.registerMessages({
3649
+ * en: { tenancy: { tenantNotFound: 'Tenant not found' } },
3650
+ * })
3651
+ * ```
3652
+ */
3653
+ static registerMessages(messages: Record<string, Record<string, unknown>>): DynamicModule;
3654
+ configureRoutes(router: Router): void;
3655
+ }
3656
+ //#endregion
3657
+ //#region src/i18n/i18n.tokens.d.ts
3658
+ /**
3659
+ * I18n Module DI Tokens
3660
+ * Symbol-based tokens to avoid string collisions
3661
+ */
3662
+ declare const I18N_TOKENS: {
3663
+ /** MessageLoaderService - loads and caches locale messages */readonly MessageLoader: symbol; /** I18nService - request-scoped translation service */
3664
+ readonly I18nService: symbol; /** I18nModuleOptions - configuration options from forRoot() */
3665
+ readonly Options: symbol; /** MessageRegistry - singleton accumulator for registerMessages() contributions */
3666
+ readonly MessageRegistry: symbol;
3667
+ };
3668
+ //#endregion
3669
+ //#region src/i18n/messages/index.d.ts
3670
+ /**
3671
+ * All locale messages
3672
+ * Explicitly import and export (no filesystem scanning - Cloudflare Workers compatible)
3673
+ */
3674
+ declare const messages: {
3675
+ readonly en: typeof index_d_exports;
3676
+ };
3677
+ /**
3678
+ * Type for all messages
3679
+ */
3680
+ type Messages = typeof messages;
3681
+ /**
3682
+ * Get messages for all locales
3683
+ */
3684
+ declare function getMessages(): Record<string, Record<string, unknown>>;
3685
+ /**
3686
+ * Get available locales
3687
+ */
3688
+ declare function getLocales(): string[];
3689
+ //#endregion
3690
+ //#region src/i18n/services/message-registry.d.ts
3691
+ /**
3692
+ * Message Registry
3693
+ *
3694
+ * Accumulates i18n messages from multiple `I18nModule.registerMessages()` calls.
3695
+ * Messages are collected statically (at module import time) and deep-merged
3696
+ * when `getMergedMessages()` is called by `MessageLoaderService`.
3697
+ *
3698
+ * Later registrations override earlier ones at leaf level.
3699
+ */
3700
+ declare class MessageRegistry {
3701
+ /**
3702
+ * Add messages (called statically by I18nModule.registerMessages)
3703
+ */
3704
+ static addMessages(messages: Record<string, Record<string, unknown>>): void;
3705
+ /**
3706
+ * Get all messages deep-merged in registration order
3707
+ */
3708
+ getMergedMessages(): Record<string, Record<string, unknown>>;
3709
+ /**
3710
+ * Reset registry (for testing)
3711
+ * @internal
3712
+ */
3713
+ static reset(): void;
3714
+ }
3715
+ //#endregion
3716
+ //#region src/i18n/services/message-loader.service.d.ts
3717
+ declare class MessageLoaderService {
3718
+ private readonly registry;
3719
+ private readonly options?;
3720
+ private readonly cache;
3721
+ private readonly contextCache;
3722
+ private readonly locales;
3723
+ private readonly defaultLocale;
3724
+ constructor(registry: MessageRegistry, options?: I18nModuleOptions | undefined);
3725
+ /**
3726
+ * Get CoreContext for a locale (lazily built and cached on first access)
3727
+ * Falls back to default locale if locale not found
3728
+ */
3729
+ getCoreContext(locale: string): CoreContext;
3730
+ /**
3731
+ * Get messages for a specific locale.
3732
+ * Falls back to default locale if not found.
3733
+ */
3734
+ getMessages(locale: string): Record<string, unknown>;
3735
+ /** Get list of available locale codes */
3736
+ getAvailableLocales(): string[];
3737
+ /** Check if a locale is supported */
3738
+ isLocaleSupported(locale: string): boolean;
3739
+ /** Get default locale */
3740
+ getDefaultLocale(): string;
3741
+ /**
3742
+ * Get flattened (dot-notation) messages for a locale, optionally filtered by namespace prefixes.
3743
+ *
3744
+ * Returns flat key-value pairs matching the format used by `@intlify/core-base`'s
3745
+ * `createCoreContext`. Requires `registerMessageCompiler(compile)` to be called
3746
+ * before `translate()` can resolve these flat keys.
3747
+ *
3748
+ * @param locale - Locale code (falls back to default locale if not found)
3749
+ * @param options - Optional filter configuration
3750
+ * @param options.only - Dot-notation prefixes to include (e.g., `['common', 'nav.sidebar']`)
3751
+ * @returns Flattened messages as `{ 'key.path': 'translated value' }`
3752
+ *
3753
+ * @example
3754
+ * ```typescript
3755
+ * // All messages for the locale
3756
+ * loader.getFilteredMessages('en')
3757
+ *
3758
+ * // Only 'common' and 'nav' namespaces
3759
+ * loader.getFilteredMessages('en', { only: ['common', 'nav'] })
3760
+ *
3761
+ * // Deeply nested prefix
3762
+ * loader.getFilteredMessages('en', { only: ['common.actions'] })
3763
+ * ```
3764
+ */
3765
+ getFilteredMessages(locale: string, options?: {
3766
+ only?: MessageKeyPrefix[];
3767
+ }): Record<string, string>;
3768
+ /**
3769
+ * Flatten nested messages to dot-notation.
3770
+ * e.g. `{ a: { b: 'hello' } }` → `{ 'a.b': 'hello' }`
3771
+ */
3772
+ private flattenMessages;
3773
+ }
3774
+ //#endregion
3775
+ //#region src/i18n/services/i18n.service.d.ts
3776
+ /**
3777
+ * I18n Service
3778
+ *
3779
+ * Provides internationalization (i18n) support for the application.
3780
+ * Injects RouterContext to access request-specific locale.
3781
+ *
3782
+ * @example Usage in services
3783
+ * ```typescript
3784
+ * @Transient(MY_TOKENS.UserService)
3785
+ * export class UserService {
3786
+ * constructor(
3787
+ * @inject(I18N_TOKENS.I18nService) private readonly i18n: II18nService
3788
+ * ) {}
3789
+ *
3790
+ * getWelcomeMessage(): string {
3791
+ * return this.i18n.t('common.welcome')
3792
+ * }
3793
+ * }
3794
+ * ```
3795
+ */
3796
+ declare class I18nService implements II18nService {
3797
+ private readonly loader;
3798
+ private readonly routerContext?;
3799
+ constructor(loader: MessageLoaderService, routerContext?: RouterContext | undefined);
3800
+ /**
3801
+ * Translate a message key
3802
+ *
3803
+ * @param key - Message key (e.g., 'common.actions.save')
3804
+ * @param params - Optional parameters for interpolation
3805
+ * @returns Translated string
3806
+ */
3807
+ t(key: MessageKeys, params?: MessageParams): string;
3808
+ /**
3809
+ * Get current locale
3810
+ *
3811
+ * @returns Current locale code from RouterContext or default locale
3812
+ */
3813
+ getLocale(): string;
3814
+ }
3815
+ //#endregion
3816
+ //#region src/i18n/middleware/i18n-context.middleware.d.ts
3817
+ declare class I18nContextMiddleware implements Middleware {
3818
+ private readonly i18n;
3819
+ constructor(i18n: I18nService);
3820
+ handle(ctx: RouterContext, next: Next$1): Promise<void>;
3821
+ }
3822
+ //#endregion
3823
+ //#region src/errors/error-codes.d.ts
3824
+ /**
3825
+ * Centralized Error Code Registry
3826
+ *
3827
+ * Error codes are organized by category with specific ranges:
3828
+ * - 1000-1999: Validation errors
3829
+ * - 2000-2999: Database errors (generic)
3830
+ * - 3000-3999: Authentication & Authorization
3831
+ * - 4000-4999: Resource errors
3832
+ * - 5000-5999: Domain-specific business logic (per module)
3833
+ * - 9000-9999: System/Internal errors
3834
+ * - 9000-9099: Router errors
3835
+ * - 9100-9199: Configuration errors
3836
+ * - 9200-9299: Infrastructure errors
3837
+ * - 9300-9399: I18n errors
3838
+ */
3839
+ declare const ERROR_CODES: {
3840
+ /**
3841
+ * Database Errors (2000-2999)
3842
+ * Generic database errors thrown by Prisma client extensions
3843
+ */
3844
+ readonly DATABASE: {
3845
+ /** Generic database error */readonly GENERIC: 2000; /** Record not found in database */
3846
+ readonly RECORD_NOT_FOUND: 2001; /** Unique constraint violation */
3847
+ readonly UNIQUE_CONSTRAINT: 2002; /** Foreign key constraint violation */
3848
+ readonly FOREIGN_KEY_CONSTRAINT: 2003; /** Database connection failed */
3849
+ readonly CONNECTION_FAILED: 2004; /** Database timeout */
3850
+ readonly TIMEOUT: 2005; /** Null constraint violation */
3851
+ readonly NULL_CONSTRAINT: 2006; /** Too many database connections */
3852
+ readonly TOO_MANY_CONNECTIONS: 2007; /** Transaction conflict or deadlock */
3853
+ readonly TRANSACTION_CONFLICT: 2008;
3854
+ };
3855
+ /**
3856
+ * Authentication Errors (3000-3099)
3857
+ * Authentication-related failures
3858
+ */
3859
+ readonly AUTH: {
3860
+ /** Invalid credentials provided */readonly INVALID_CREDENTIALS: 3000; /** Session expired or invalid */
3861
+ readonly SESSION_EXPIRED: 3001; /** Account locked or disabled */
3862
+ readonly ACCOUNT_LOCKED: 3002; /** Invalid or expired token */
3863
+ readonly INVALID_TOKEN: 3003; /** Context not initialized */
3864
+ readonly CONTEXT_NOT_INITIALIZED: 3004; /** User not authenticated */
3865
+ readonly USER_NOT_AUTHENTICATED: 3005; /** Email verification required before login */
3866
+ readonly EMAIL_NOT_VERIFIED: 3007; /** Password doesn't meet minimum length */
3867
+ readonly PASSWORD_TOO_SHORT: 3008; /** Password exceeds maximum length */
3868
+ readonly PASSWORD_TOO_LONG: 3009; /** Account with email already exists */
3869
+ readonly ACCOUNT_ALREADY_EXISTS: 3010; /** User creation failed */
3870
+ readonly FAILED_TO_CREATE_USER: 3011; /** Session creation failed */
3871
+ readonly FAILED_TO_CREATE_SESSION: 3012; /** User update failed */
3872
+ readonly FAILED_TO_UPDATE_USER: 3013; /** Social account already linked */
3873
+ readonly SOCIAL_ACCOUNT_LINKED: 3014; /** Last account cannot be unlinked */
3874
+ readonly CANNOT_UNLINK_LAST_ACCOUNT: 3015;
3875
+ };
3876
+ /**
3877
+ * Authorization Errors (3100-3199)
3878
+ * Permission and access control failures
3879
+ */
3880
+ readonly AUTHZ: {
3881
+ /** Insufficient permissions */readonly FORBIDDEN: 3100; /** Resource access denied */
3882
+ readonly ACCESS_DENIED: 3101; /** User lacks required role */
3883
+ readonly INSUFFICIENT_PERMISSIONS: 3102;
3884
+ };
3885
+ /**
3886
+ * Resource Errors (4000-4999)
3887
+ * Generic resource-related errors
3888
+ */
3889
+ readonly RESOURCE: {
3890
+ /** Generic resource not found */readonly NOT_FOUND: 4000; /** Route/endpoint not found */
3891
+ readonly ROUTE_NOT_FOUND: 4004; /** Resource conflict or duplicate */
3892
+ readonly CONFLICT: 4100; /** Resource already exists */
3893
+ readonly ALREADY_EXISTS: 4101;
3894
+ };
3895
+ /**
3896
+ * Validation Errors (1000-1999)
3897
+ * Input validation failures
3898
+ */
3899
+ readonly VALIDATION: {
3900
+ /** Generic validation error */readonly GENERIC: 1000; /** Required field missing */
3901
+ readonly REQUIRED_FIELD: 1001; /** Invalid format */
3902
+ readonly INVALID_FORMAT: 1002; /** Schema validation failed */
3903
+ readonly SCHEMA_VALIDATION: 1003; /** Request validation failed (OpenAPI, etc.) */
3904
+ readonly REQUEST_VALIDATION: 1004; /** Response validation failed (response body doesn't match declared schema) */
3905
+ readonly RESPONSE_VALIDATION: 1005;
3906
+ };
3907
+ /**
3908
+ * Router Errors (9000-9099)
3909
+ * Router and controller-related INTERNAL errors
3910
+ */
3911
+ readonly ROUTER: {
3912
+ /** Controller registration error */readonly CONTROLLER_REGISTRATION_ERROR: 9005; /** Controller method not found */
3913
+ readonly CONTROLLER_METHOD_NOT_FOUND: 9006; /** OpenAPI route registration failed */
3914
+ readonly OPENAPI_ROUTE_REGISTRATION: 9008; /** Duplicate route name in RouteRegistry */
3915
+ readonly DUPLICATE_ROUTE_NAME: 9010; /** Named route not found in RouteRegistry */
3916
+ readonly ROUTE_NAME_NOT_FOUND: 9011; /** Required route parameter missing during URL generation */
3917
+ readonly MISSING_ROUTE_PARAM: 9012; /** router.use() called inside group() callback */
3918
+ readonly USE_SCOPE_VIOLATION: 9013;
3919
+ };
3920
+ /**
3921
+ * I18n Errors (9300-9399)
3922
+ * Internationalization and localization errors
3923
+ */
3924
+ readonly I18N: {
3925
+ /** Translation key missing from all locales */readonly TRANSLATION_MISSING: 9300; /** Requested locale not supported */
3926
+ readonly LOCALE_NOT_SUPPORTED: 9301;
3927
+ };
3928
+ /**
3929
+ * System Errors (9000-9999)
3930
+ * Internal system errors and unexpected failures
3931
+ */
3932
+ readonly SYSTEM: {
3933
+ /** Internal server error */readonly INTERNAL_ERROR: 9000; /** Generic configuration error */
3934
+ readonly CONFIGURATION_ERROR: 9100; /** ConfigService not initialized */
3935
+ readonly CONFIG_NOT_INITIALIZED: 9101; /** Module already registered */
3936
+ readonly MODULE_ALREADY_REGISTERED: 9102; /** Circular module dependency detected */
3937
+ readonly MODULE_CIRCULAR_DEPENDENCY: 9103; /** Module dependency not found */
3938
+ readonly MODULE_DEPENDENCY_NOT_FOUND: 9104; /** Invalid error code range */
3939
+ readonly INVALID_ERROR_CODE_RANGE: 9105; /** Invalid module provider configuration */
3940
+ readonly INVALID_MODULE_PROVIDER: 9106; /** ConfigModule.forRoot() was not called */
3941
+ readonly CONFIG_MODULE_NOT_INITIALIZED: 9107; /** Generic infrastructure error */
3942
+ readonly INFRASTRUCTURE_ERROR: 9200; /** Execution context not initialized */
3943
+ readonly EXECUTION_CONTEXT_NOT_INITIALIZED: 9201; /** Request container not initialized */
3944
+ readonly REQUEST_CONTAINER_NOT_INITIALIZED: 9202; /** Queue binding not found */
3945
+ readonly QUEUE_BINDING_NOT_FOUND: 9203; /** Cron job execution failed */
3946
+ readonly CRON_EXECUTION_FAILED: 9204; /** Queue provider not supported */
3947
+ readonly QUEUE_PROVIDER_NOT_SUPPORTED: 9205; /** body() called on WebSocket gateway context */
3948
+ readonly WEBSOCKET_BODY_NOT_AVAILABLE: 9206; /** Duplicate WebSocket event decorator on a gateway */
3949
+ readonly WEBSOCKET_DUPLICATE_EVENT_HANDLER: 9207; /** Seeder name collision — two seeders share the same class name */
3950
+ readonly SEEDER_NAME_COLLISION: 9208; /** Seeder not registered in the SeederRegistry */
3951
+ readonly SEEDER_NOT_REGISTERED: 9209; /** Application container not initialized (AsyncLocalStorage) */
3952
+ readonly CONTAINER_NOT_INITIALIZED: 9210; /** Required environment variable not set */
3953
+ readonly MISSING_ENVIRONMENT_VARIABLE: 9211;
3954
+ };
3955
+ };
3956
+ /**
3957
+ * Recursively extract all leaf values from a nested object type
3958
+ * Similar to DeepKeys but extracts values instead of keys
3959
+ *
3960
+ * Example:
3961
+ * { DATABASE: { GENERIC: 2000, NOT_FOUND: 2001 }, AUTH: { INVALID: 3000 } }
3962
+ * becomes
3963
+ * 2000 | 2001 | 3000
3964
+ */
3965
+ type DeepValues<T> = T extends object ? { [K in keyof T]: DeepValues<T[K]> }[keyof T] : T;
3966
+ /**
3967
+ * Type helper to extract all error code values
3968
+ * Union type of all numeric error codes defined in ERROR_CODES
3969
+ *
3970
+ * Type: 2000 | 2001 | 2002 | ... | 9203
3971
+ */
3972
+ type ErrorCode = DeepValues<typeof ERROR_CODES>;
3973
+ //#endregion
3974
+ //#region src/errors/application-error.d.ts
3975
+ /**
3976
+ * ApplicationError
3977
+ *
3978
+ * Abstract base class for all application errors.
3979
+ *
3980
+ * @deprecated Use {@link HttpException} for new error classes. `HttpException` provides
3981
+ * a simpler constructor that takes `(httpStatus, message?)` and derives the error code
3982
+ * automatically. Existing subclasses will continue to work but should be migrated over time.
3983
+ *
3984
+ * Features:
3985
+ * - Type-safe error codes from ERROR_CODES registry
3986
+ * - Type-safe message keys from i18n module
3987
+ * - Localized message keys (translated by ExceptionHandler)
3988
+ * - Structured metadata for logging and interpolation
3989
+ * - Proper Error prototype chain
3990
+ * - Automatic timestamp generation
3991
+ * - Serialization for RPC transmission
3992
+ * - Optional self-reporting via `report()` method
3993
+ * - Optional self-rendering via `render()` method
3994
+ *
3995
+ * Message Localization:
3996
+ * - Each error class passes an i18n key (e.g., 'errors.userNotFound') to super()
3997
+ * - `Error.message` contains the i18n key for useful stack traces and fallback display
3998
+ * - Metadata provides interpolation parameters (e.g., { userId: '123' })
3999
+ * - ExceptionHandler translates the message key using I18nService before sending response
4000
+ * - This ensures errors are localized based on the user's locale
4001
+ */
4002
+ declare abstract class ApplicationError extends Error {
4003
+ /**
4004
+ * Controls whether stack traces are captured.
4005
+ * Set to false in production to skip the expensive Error.captureStackTrace() call,
4006
+ * since stack traces are stripped from responses in production anyway.
4007
+ */
4008
+ static captureStackTraces: boolean;
4009
+ /**
4010
+ * Type-safe error code from ERROR_CODES registry
4011
+ * See error-codes.ts for the complete registry
4012
+ */
4013
+ readonly code: ErrorCode;
4014
+ /**
4015
+ * ISO timestamp when the error was created
4016
+ */
4017
+ readonly timestamp: string;
4018
+ /**
4019
+ * Additional structured data about the error
4020
+ * Used for:
4021
+ * 1. Logging and debugging
4022
+ * 2. Message interpolation (e.g., { userId: '123', email: 'user@example.com' })
4023
+ */
4024
+ readonly metadata?: Record<string, unknown>;
4025
+ /**
4026
+ * @param i18nKey - Type-safe i18n message key (e.g., 'errors.userNotFound')
4027
+ * @param code - Type-safe error code from ERROR_CODES registry
4028
+ * @param metadata - Optional data for logging and interpolation
4029
+ */
4030
+ constructor(i18nKey: MessageKeys, code: ErrorCode, metadata?: Record<string, unknown>);
4031
+ /**
4032
+ * Filter metadata to include only user-facing properties
4033
+ *
4034
+ * User-facing properties (validation/constraint errors):
4035
+ * - issues: Validation errors from SchemaValidationError
4036
+ * - fields: Constraint violation fields
4037
+ * - field: Single field constraint/foreign key
4038
+ *
4039
+ * Internal properties (excluded from response):
4040
+ * - path, method: Route debugging
4041
+ * - controllerName, reason: Controller errors
4042
+ * - details, etc.: Internal debugging info
4043
+ *
4044
+ * @param metadata - Raw metadata object
4045
+ * @returns Filtered metadata with only whitelisted properties
4046
+ */
4047
+ private static filterMetadata;
4048
+ /**
4049
+ * Serialize error to ErrorResponse format for RPC transmission
4050
+ *
4051
+ * @param env - Environment (development | production)
4052
+ * @param translatedMessage - Optional translated message (from ExceptionHandler)
4053
+ * @returns ErrorResponse object suitable for JSON serialization
4054
+ */
4055
+ toErrorResponse(env: Environment, translatedMessage?: string): ErrorResponse;
4056
+ /**
4057
+ * JSON serialization (used by JSON.stringify)
4058
+ * Defaults to development mode for backward compatibility
4059
+ * Note: This will use the untranslated message key - use ExceptionHandler for proper localization
4060
+ */
4061
+ toJSON(): ErrorResponse;
4062
+ /**
4063
+ * Self-reporting hook. Override in subclasses to define custom reporting logic
4064
+ * that runs instead of the default logger.
4065
+ *
4066
+ * - Return `void` (or nothing) to **skip** default reporting after this runs.
4067
+ * - Return `false` to **also run** default reporting after this runs.
4068
+ *
4069
+ * @example
4070
+ * ```typescript
4071
+ * class PaymentError extends HttpException {
4072
+ * report(): void {
4073
+ * sentry.captureException(this)
4074
+ * // Default logging is skipped
4075
+ * }
4076
+ * }
4077
+ *
4078
+ * class SoftError extends HttpException {
4079
+ * report(): false {
4080
+ * analytics.track(this)
4081
+ * return false // Default logging also runs
4082
+ * }
4083
+ * }
4084
+ * ```
4085
+ */
4086
+ report?(): void | false;
4087
+ /**
4088
+ * Self-rendering hook. Override in subclasses to define how this error
4089
+ * is rendered into a Response.
4090
+ *
4091
+ * Return `undefined` to fall through to the default renderer.
4092
+ *
4093
+ * @param ctx - The execution context (narrow via `ctx.type` for HTTP helpers)
4094
+ * @returns A Response, ErrorResponse, or undefined to use default rendering
4095
+ *
4096
+ * @example
4097
+ * ```typescript
4098
+ * class MaintenanceError extends HttpException {
4099
+ * render(ctx: ExceptionContext): Response | undefined {
4100
+ * if (ctx.type === 'http') {
4101
+ * return ctx.ctx.html('<h1>Down for maintenance</h1>', 503)
4102
+ * }
4103
+ * }
4104
+ * }
4105
+ * ```
4106
+ */
4107
+ render?(ctx: ExceptionContext): Response | ErrorResponse | undefined;
4108
+ }
4109
+ //#endregion
4110
+ //#region src/errors/default-exception-handler.d.ts
4111
+ /**
4112
+ * DefaultExceptionHandler — the built-in exception handler used when no
4113
+ * custom handler is provided via `ApplicationConfig.exceptionHandler`.
4114
+ *
4115
+ * Has an empty `register()` method, so all exceptions flow through the
4116
+ * default pipeline: severity-based logging, i18n translation, and JSON
4117
+ * error response serialization.
4118
+ *
4119
+ * To customize exception handling, extend {@link ExceptionHandler} and
4120
+ * override `register()`, then pass your class to the Stratal config:
4121
+ *
4122
+ * @example
4123
+ * ```typescript
4124
+ * new Stratal({
4125
+ * module: AppModule,
4126
+ * exceptionHandler: AppExceptionHandler,
4127
+ * })
4128
+ * ```
4129
+ */
4130
+ declare class DefaultExceptionHandler extends ExceptionHandler {
4131
+ register(): void;
4132
+ }
4133
+ //#endregion
4134
+ //#region src/errors/get-http-status.d.ts
4135
+ /**
4136
+ * Maps error codes to HTTP status codes
4137
+ *
4138
+ * This utility is used by the frontend to set appropriate HTTP status codes
4139
+ * when returning errors from API routes.
4140
+ *
4141
+ * @param code - Numeric error code from ERROR_CODES registry
4142
+ * @returns HTTP status code (200-599)
4143
+ */
4144
+ declare function getHttpStatus(code: number): ContentfulStatusCode;
4145
+ /**
4146
+ * Resolve the HTTP status code for an ApplicationError.
4147
+ *
4148
+ * If the error is an {@link HttpException}, its `httpStatus` property takes precedence.
4149
+ * Otherwise, falls back to the code-range-based mapping via {@link getHttpStatus}.
4150
+ *
4151
+ * @param error - The application error to resolve the status for
4152
+ * @returns HTTP status code
4153
+ */
4154
+ declare function resolveHttpStatus(error: ApplicationError): ContentfulStatusCode;
4155
+ //#endregion
4156
+ //#region src/errors/http-exception.d.ts
4157
+ /**
4158
+ * HTTP-centric exception base class.
4159
+ *
4160
+ * Unlike {@link ApplicationError} which requires `(i18nKey, code, metadata)`,
4161
+ * `HttpException` takes just `(httpStatus, message?)` and derives the error code
4162
+ * from the HTTP status automatically.
4163
+ *
4164
+ * The message can be a plain string or an i18n key — the {@link ExceptionHandler}
4165
+ * tries to translate it via `i18n.t()`, falling back to the raw string if the
4166
+ * key is not found.
4167
+ *
4168
+ * Existing {@link ApplicationError} subclasses can be migrated to this gradually.
4169
+ *
4170
+ * @example
4171
+ * ```typescript
4172
+ * // Simple usage with plain message
4173
+ * throw new HttpException(404, 'User not found')
4174
+ *
4175
+ * // With i18n key (auto-translated if key exists)
4176
+ * throw new HttpException(422, 'errors.invalidInput')
4177
+ *
4178
+ * // Default message for status code
4179
+ * throw new HttpException(500)
4180
+ *
4181
+ * // Subclass for domain-specific errors
4182
+ * class PaymentDeclinedError extends HttpException {
4183
+ * constructor() {
4184
+ * super(402, 'errors.paymentDeclined')
4185
+ * }
4186
+ * }
4187
+ * ```
4188
+ */
4189
+ declare class HttpException extends ApplicationError {
4190
+ /**
4191
+ * The HTTP status code for this exception.
4192
+ * Used by the {@link ExceptionHandler} to set the response status.
4193
+ */
4194
+ readonly httpStatus: ContentfulStatusCode;
4195
+ /**
4196
+ * @param httpStatus - HTTP status code (e.g., 404, 422, 500)
4197
+ * @param message - Optional message string or i18n key. Defaults to the
4198
+ * standard HTTP status message (e.g., "Not Found" for 404).
4199
+ */
4200
+ constructor(httpStatus: ContentfulStatusCode, message?: string);
4201
+ }
4202
+ /**
4203
+ * Throw an HTTP exception from anywhere in the application.
4204
+ *
4205
+ * The message can be a plain string or an i18n key — the {@link ExceptionHandler}
4206
+ * translates it automatically, falling back to the raw string if the key is not found.
4207
+ *
4208
+ * @param status - HTTP status code
4209
+ * @param message - Optional message (plain string or i18n key)
4210
+ * @throws {@link HttpException} — always throws, never returns
4211
+ *
4212
+ * @example
4213
+ * ```typescript
4214
+ * // With plain message
4215
+ * abort(404, 'User not found')
4216
+ *
4217
+ * // Default message for status
4218
+ * abort(403)
4219
+ *
4220
+ * // With i18n key
4221
+ * abort(422, 'errors.invalidInput')
4222
+ * ```
4223
+ */
4224
+ declare function abort(status: ContentfulStatusCode, message?: MessageKeys | string & {}): never;
4225
+ //#endregion
4226
+ //#region src/errors/internal-error.d.ts
4227
+ /**
4228
+ * InternalError
4229
+ *
4230
+ * Represents an unexpected internal server error.
4231
+ * Used to wrap unknown errors that don't fit into specific error categories.
4232
+ *
4233
+ * This error is thrown when:
4234
+ * - An unexpected exception occurs
4235
+ * - An error type is not recognized
4236
+ * - A system-level failure happens
4237
+ */
4238
+ declare class InternalError extends ApplicationError {
4239
+ constructor(metadata?: Record<string, unknown>);
4240
+ }
4241
+ //#endregion
4242
+ //#region src/errors/is-application-error.d.ts
4243
+ /**
4244
+ * Type guard to check if an error is an ApplicationError
4245
+ *
4246
+ * @param error - The error to check
4247
+ * @returns True if the error is an ApplicationError instance
4248
+ */
4249
+ declare function isApplicationError(error: unknown): error is ApplicationError;
4250
+ //#endregion
4251
+ //#region src/errors/container-not-initialized.error.d.ts
4252
+ /**
4253
+ * Thrown when attempting to access the application container via AsyncLocalStorage
4254
+ * before `Application.initialize()` has been called.
4255
+ *
4256
+ * This typically means `route()` or another standalone function is being called
4257
+ * outside the application lifecycle.
4258
+ */
4259
+ declare class ContainerNotInitializedError extends ApplicationError {
4260
+ constructor();
4261
+ }
4262
+ //#endregion
4263
+ //#region src/errors/request-container-not-initialized.error.d.ts
4264
+ /**
4265
+ * RequestContainerNotInitializedError
4266
+ *
4267
+ * Thrown when attempting to access the request-scoped container before it has been initialized.
4268
+ * This typically indicates that the RouterService middleware hasn't run yet,
4269
+ * or the router context is being accessed outside of a request lifecycle.
4270
+ */
4271
+ declare class RequestContainerNotInitializedError extends ApplicationError {
4272
+ constructor();
4273
+ }
4274
+ //#endregion
4275
+ //#region src/errors/stratal-not-initialized.error.d.ts
4276
+ /**
4277
+ * StratalNotInitializedError
4278
+ *
4279
+ * Thrown when attempting to resolve the Application instance before Stratal has been instantiated.
4280
+ * This typically indicates that the Stratal instance is not exported as the default export.
4281
+ */
4282
+ declare class StratalNotInitializedError extends ApplicationError {
4283
+ constructor();
4284
+ }
4285
+ //#endregion
4286
+ export { SSEMessage as $, HTTP_METHODS as $n, RouteConfigurable as $t, LocaleNotSupportedError as A, LogSeverity as An, instancePerContainerCachingFactory$1 as Ar, getRouteDecoratedMethods as At, ContextQueryResult as B, ConventionRouteMetadata as Bn, WhenOptions as Br, getControllerRoute as Bt, DetectionStrategy as C, OnShutdown as Cn, Container as Cr, errorResponseSchema as Ct, buildDetectorOptions as D, ExceptionHandler as Dn, delay as Dr, uuidParamSchema as Dt, ResolvedI18nOptions as E, ValueProvider as En, container$1 as Er, successMessageSchema as Et, QueueExceptionContext as F, StratalExecutionContext as Fn, ConditionalBindingUse as Fr, Patch as Ft, buildRouteUrl as G, RouteConfig as Gn, generateConventionRouteName as Gt, SignedUriOptions as H, LocalePathConfig as Hn, ErrorResponse as Hr, createMiddlewareChain as Ht, createCliExceptionContext as I, LocalePathService as In, PredicateContainer as Ir, Post as It, RouteRegistry as J, RouteResponseObject as Jn, toOpenAPIPath as Jt, RegisteredRoute as K, RouteMetadata as Kn, getPathSpecificityScore as Kt, createCronExceptionContext as L, ResolvedPath as Ln, ContainerLike as Lr, Put as Lt, CronExceptionContext as M, Reportable as Mn, ConditionalBindingBuilder as Mr, All as Mt, ExceptionContext as N, ReportableCallback as Nn, ConditionalBindingBuilderImpl as Nr, Delete as Nt, resolveI18nOptions as O, ApplicationErrorConstructor as On, inject$1 as Or, validationErrorResponseSchema as Ot, HttpExceptionContext as P, RespondCallback as Pn, ConditionalBindingGive as Pr, Get as Pt, ApplicationOptions as Q, VersioningOptions as Qn, ModuleRegistry as Qt, createHttpExceptionContext as R, HonoApp as Rn, ExtensionDecorator as Rr, Controller as Rt, I18nModule as S, OnInitialize as Sn, StratalRouteMap as Sr, commonErrorSchemas as St, LanguageDetectionOptions as T, RegistryEntry as Tn, DependencyContainer$1 as Tr, paginationQuerySchema as Tt, Uri as U, RouteBody as Un, isErrorResponse as Ur, extractDomainParamNames as Ut, RouterContext as V, ExplicitRouteMetadata as Vn, Environment as Vr, getControllerVersion as Vt, UriOptions as W, RouteBodyObject as Wn, extractParamNames as Wt, Application as X, RouterVariables as Xn, ROUTER_TOKENS as Xt, VersioningService as Y, RouterEnv as Yn, route as Yt, ApplicationConfig as Z, SecurityScheme as Zn, RouteRegistrationService as Zt, Messages as _, InjectionToken$2 as _n, DI_TOKENS as _r, signUrl as _t, InternalError as a, CommandInput as an, containerStorage as ar, MissingEnvironmentVariableError as at, messages as b, ModuleOptions as bn, SerializedRoute as br, createDomainMiddleware as bt, getHttpStatus as c, ParsedArgument as cn, RequestScopeOperationNotAllowedError as cr, RouteNameNotFoundError as ct, ApplicationError as d, Quarry as dn, INJECT_PARAM_METADATA_KEY as dr, RouteNotFoundError as dt, Router as en, ROUTER_CONTEXT_KEYS as er, SSEStreamingApi$1 as et, ERROR_CODES as f, AsyncModuleOptions as fn, InjectParam as fr, OpenAPIValidationError as ft, MessageRegistry as g, FactoryProvider as gn, DIToken as gr, SignedUrlOptions as gt, MessageLoaderService as h, ExistingProvider as hn, CONTAINER_TOKEN as hr, ControllerRegistrationError as ht, isApplicationError as i, IController as in, StratalEnv as ir, InvalidSignatureError as it, CliExceptionContext as j, RenderableCallback as jn, singleton as jr, getRouteMetadata as jt, TranslationMissingError as k, ContextCallback as kn, injectable$1 as kr, Route as kt, resolveHttpStatus as l, ParsedOption as ln, ConditionalBindingFallbackError as lr, RouterUseScopeError as lt, I18nContextMiddleware as m, DynamicModule as mn, getMethodInjections as mr, HonoAppAlreadyConfiguredError as mt, RequestContainerNotInitializedError as n, Middleware as nn, SECURITY_SCHEMES as nr, DomainMismatchError as nt, HttpException as o, CommandInternals as on, getContainer as or, MissingRouteParamError as ot, ErrorCode as p, ClassProvider as pn, ParamInjection as pr, OpenAPIRouteRegistrationError as pt, RouteRegistrationInput as q, RouteResponse as qn, sortRoutesBySpecificity as qt, ContainerNotInitializedError as r, Next$1 as rn, VERSION_NEUTRAL as rr, DuplicateRouteNameError as rt, abort as s, CommandResult as sn, runWithContainer as sr, ResponseValidationError as st, StratalNotInitializedError as t, RouterGroupConfig as tn, ROUTE_METADATA_KEYS as tr, StreamingApi$1 as tt, DefaultExceptionHandler as u, ParsedSignature as un, Transient as ur, SchemaValidationError as ut, getLocales as v, ModuleClass as vn, RouteName as vr, verifySignedUrl as vt, I18nModuleOptions as w, Provider as wn, ContainerOptions as wr, paginatedResponseSchema as wt, I18N_TOKENS as x, OnException as xn, SerializedRoutes as xr, parseDomainPattern as xt, getMessages as y, ModuleContext as yn, RouteParams as yr, VerifySignatureMiddleware as yt, createQueueExceptionContext as z, ControllerOptions as zn, Scope as zr, getControllerOptions as zt };
4287
+ //# sourceMappingURL=index-BrmS34sa.d.mts.map