stratal 0.0.18 → 0.0.20

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 (185) hide show
  1. package/README.md +8 -8
  2. package/dist/{base-email.provider-Cuw4OAB0.mjs → base-email.provider-CfQCA08m.mjs} +1 -1
  3. package/dist/{base-email.provider-Cuw4OAB0.mjs.map → base-email.provider-CfQCA08m.mjs.map} +1 -1
  4. package/dist/bin/cloudflare-workers-loader.mjs.map +1 -1
  5. package/dist/bin/quarry.mjs +26 -35
  6. package/dist/bin/quarry.mjs.map +1 -1
  7. package/dist/cache/index.d.mts +2 -153
  8. package/dist/cache/index.d.mts.map +1 -1
  9. package/dist/cache/index.mjs +4 -6
  10. package/dist/cache/index.mjs.map +1 -1
  11. package/dist/cache.service-DsnKuNyO.d.mts +156 -0
  12. package/dist/cache.service-DsnKuNyO.d.mts.map +1 -0
  13. package/dist/cache.tokens-B7Rw1C9Q.mjs +6 -0
  14. package/dist/cache.tokens-B7Rw1C9Q.mjs.map +1 -0
  15. package/dist/{colors-BTAnQRGU.mjs → colors-DJaRDXoS.mjs} +1 -1
  16. package/dist/{colors-BTAnQRGU.mjs.map → colors-DJaRDXoS.mjs.map} +1 -1
  17. package/dist/{command-DjGqCYHv.mjs → command-BgSlsS4M.mjs} +2 -2
  18. package/dist/{command-DjGqCYHv.mjs.map → command-BgSlsS4M.mjs.map} +1 -1
  19. package/dist/{command-B1YuV-UZ.d.mts → command-Bu-PjJrX.d.mts} +2 -2
  20. package/dist/{command-B1YuV-UZ.d.mts.map → command-Bu-PjJrX.d.mts.map} +1 -1
  21. package/dist/config/index.d.mts +81 -37
  22. package/dist/config/index.d.mts.map +1 -1
  23. package/dist/config/index.mjs +126 -45
  24. package/dist/config/index.mjs.map +1 -1
  25. package/dist/{consumer-registry-BkuHXR_u.d.mts → consumer-registry-B7yUNh0q.d.mts} +1 -1
  26. package/dist/{consumer-registry-BkuHXR_u.d.mts.map → consumer-registry-B7yUNh0q.d.mts.map} +1 -1
  27. package/dist/controller.decorator-DQzenvSN.mjs +66 -0
  28. package/dist/controller.decorator-DQzenvSN.mjs.map +1 -0
  29. package/dist/cron/index.d.mts +4 -3
  30. package/dist/cron/index.d.mts.map +1 -1
  31. package/dist/cron/index.mjs +1 -1
  32. package/dist/{cron-manager-1KnZvojs.mjs → cron-manager-7Symz_TE.mjs} +29 -19
  33. package/dist/cron-manager-7Symz_TE.mjs.map +1 -0
  34. package/dist/{cron-manager-BnEZquBL.d.mts → cron-manager-BEsH1mjW.d.mts} +27 -13
  35. package/dist/cron-manager-BEsH1mjW.d.mts.map +1 -0
  36. package/dist/di/index.d.mts +1 -1
  37. package/dist/di/index.mjs +2 -2
  38. package/dist/email/index.d.mts +3 -3
  39. package/dist/email/index.mjs +87 -10
  40. package/dist/email/index.mjs.map +1 -1
  41. package/dist/{en-3QnZwP-u.mjs → en-DSH_bhh6.mjs} +10 -30
  42. package/dist/en-DSH_bhh6.mjs.map +1 -0
  43. package/dist/env-D1rcZ8_r.d.mts +25 -0
  44. package/dist/env-D1rcZ8_r.d.mts.map +1 -0
  45. package/dist/errors/index.d.mts +1 -1
  46. package/dist/errors/index.mjs +1 -1
  47. package/dist/{errors--RBIvDXr.mjs → errors-BdyV5PnY.mjs} +180 -15
  48. package/dist/errors-BdyV5PnY.mjs.map +1 -0
  49. package/dist/{errors-B7hCnXgB.mjs → errors-Da3Pz2X7.mjs} +14 -7
  50. package/dist/errors-Da3Pz2X7.mjs.map +1 -0
  51. package/dist/events/index.d.mts +2 -2
  52. package/dist/events/index.mjs +1 -1
  53. package/dist/{events-UTJliZhl.mjs → events-COKixqnG.mjs} +2 -2
  54. package/dist/{events-UTJliZhl.mjs.map → events-COKixqnG.mjs.map} +1 -1
  55. package/dist/{gateway-context-BdBFoQd8.mjs → gateway-context-CdJjpUCW.mjs} +5 -70
  56. package/dist/gateway-context-CdJjpUCW.mjs.map +1 -0
  57. package/dist/guards/index.d.mts +14 -5
  58. package/dist/guards/index.d.mts.map +1 -1
  59. package/dist/guards/index.mjs +1 -1
  60. package/dist/{guards-MtDgcHnF.mjs → guards-DUk_Kzst.mjs} +1 -1
  61. package/dist/guards-DUk_Kzst.mjs.map +1 -0
  62. package/dist/http-method.decorator-DXwxAfb_.mjs +96 -0
  63. package/dist/http-method.decorator-DXwxAfb_.mjs.map +1 -0
  64. package/dist/i18n/index.d.mts +3 -3
  65. package/dist/i18n/index.mjs +2 -2
  66. package/dist/i18n/messages/en/index.d.mts +1 -1
  67. package/dist/i18n/messages/en/index.mjs +1 -1
  68. package/dist/i18n/utils/index.mjs +1 -1
  69. package/dist/i18n/validation/index.d.mts +2 -2
  70. package/dist/i18n/validation/index.mjs +2 -2
  71. package/dist/{i18n.module-BpLLLCTg.mjs → i18n.module-BBlNNlcG.mjs} +234 -204
  72. package/dist/i18n.module-BBlNNlcG.mjs.map +1 -0
  73. package/dist/index-7-hU3GTV.d.mts +101 -0
  74. package/dist/index-7-hU3GTV.d.mts.map +1 -0
  75. package/dist/{index-Dfpd_ypO.d.mts → index-Bnpfq6uk.d.mts} +81 -19
  76. package/dist/index-Bnpfq6uk.d.mts.map +1 -0
  77. package/dist/{index-BDh9J2KD.d.mts → index-C1KvMncZ.d.mts} +9 -29
  78. package/dist/{index-BDh9J2KD.d.mts.map → index-C1KvMncZ.d.mts.map} +1 -1
  79. package/dist/{index-DPxmo6AY.d.mts → index-CjaQ6_tZ.d.mts} +5 -4
  80. package/dist/index-CjaQ6_tZ.d.mts.map +1 -0
  81. package/dist/{index-BrmS34sa.d.mts → index-D0US0X14.d.mts} +375 -235
  82. package/dist/index-D0US0X14.d.mts.map +1 -0
  83. package/dist/{index-BR23zDMy.d.mts → index-DBd_2wv8.d.mts} +1 -1
  84. package/dist/{index-BR23zDMy.d.mts.map → index-DBd_2wv8.d.mts.map} +1 -1
  85. package/dist/index.d.mts +3 -2
  86. package/dist/index.d.mts.map +1 -1
  87. package/dist/index.mjs +1 -1
  88. package/dist/{is-command-PvULqiTa.mjs → is-command-C6a7WTPw.mjs} +2 -2
  89. package/dist/{is-command-PvULqiTa.mjs.map → is-command-C6a7WTPw.mjs.map} +1 -1
  90. package/dist/{is-seeder-BN9Ej1r7.mjs → is-seeder-CebjZCDn.mjs} +1 -1
  91. package/dist/{is-seeder-BN9Ej1r7.mjs.map → is-seeder-CebjZCDn.mjs.map} +1 -1
  92. package/dist/logger/index.d.mts +1 -1
  93. package/dist/logger/index.mjs +1 -1
  94. package/dist/{logger-c0ftIK4G.mjs → logger-V6Ms3QnQ.mjs} +38 -20
  95. package/dist/{logger-c0ftIK4G.mjs.map → logger-V6Ms3QnQ.mjs.map} +1 -1
  96. package/dist/macroable/index.d.mts +2 -0
  97. package/dist/macroable/index.mjs +2 -0
  98. package/dist/macroable-BmufBshB.mjs +122 -0
  99. package/dist/macroable-BmufBshB.mjs.map +1 -0
  100. package/dist/module/index.d.mts +2 -2
  101. package/dist/module/index.mjs +1 -1
  102. package/dist/{module-C3YZ-kZN.mjs → module-Dk2qTa77.mjs} +160 -19
  103. package/dist/module-Dk2qTa77.mjs.map +1 -0
  104. package/dist/openapi/index.d.mts +3 -3
  105. package/dist/openapi/index.mjs +2 -2
  106. package/dist/{openapi-tools.service-B77QXD56.mjs → openapi-tools.service-Zs-Ewv7F.mjs} +4 -1
  107. package/dist/{openapi-tools.service-B77QXD56.mjs.map → openapi-tools.service-Zs-Ewv7F.mjs.map} +1 -1
  108. package/dist/{openapi.service-6yj0BUY4.d.mts → openapi.service-BLgvn3hJ.d.mts} +3 -3
  109. package/dist/{openapi.service-6yj0BUY4.d.mts.map → openapi.service-BLgvn3hJ.d.mts.map} +1 -1
  110. package/dist/quarry/index.d.mts +7 -7
  111. package/dist/quarry/index.d.mts.map +1 -1
  112. package/dist/quarry/index.mjs +4 -4
  113. package/dist/{quarry-registry-CQCIlYTO.mjs → quarry-registry-DNEej-Db.mjs} +17 -15
  114. package/dist/quarry-registry-DNEej-Db.mjs.map +1 -0
  115. package/dist/queue/index.d.mts +2 -2
  116. package/dist/queue/index.mjs +2 -2
  117. package/dist/{queue.module-DIjD6nr-.mjs → queue.module-BCdCiySt.mjs} +4 -4
  118. package/dist/{queue.module-DIjD6nr-.mjs.map → queue.module-BCdCiySt.mjs.map} +1 -1
  119. package/dist/r2-storage.provider-Co6F0ZYV.mjs +244 -0
  120. package/dist/r2-storage.provider-Co6F0ZYV.mjs.map +1 -0
  121. package/dist/rate-limit.decorator--o6Q6p9w.mjs +55 -0
  122. package/dist/rate-limit.decorator--o6Q6p9w.mjs.map +1 -0
  123. package/dist/rate-limiter/index.d.mts +420 -0
  124. package/dist/rate-limiter/index.d.mts.map +1 -0
  125. package/dist/rate-limiter/index.mjs +365 -0
  126. package/dist/rate-limiter/index.mjs.map +1 -0
  127. package/dist/{resend.provider-Bvw36rQy.mjs → resend.provider-M6qRLrcy.mjs} +2 -2
  128. package/dist/{resend.provider-Bvw36rQy.mjs.map → resend.provider-M6qRLrcy.mjs.map} +1 -1
  129. package/dist/router/index.d.mts +2 -2
  130. package/dist/router/index.mjs +7 -5
  131. package/dist/seeder/index.d.mts +3 -3
  132. package/dist/seeder/index.mjs +2 -2
  133. package/dist/{seeder-D7VXULXB.mjs → seeder-CJAOHEIo.mjs} +5 -5
  134. package/dist/{seeder-D7VXULXB.mjs.map → seeder-CJAOHEIo.mjs.map} +1 -1
  135. package/dist/{setup-BRIN-iYT.mjs → setup-CefZKV_e.mjs} +1 -1
  136. package/dist/{setup-BRIN-iYT.mjs.map → setup-CefZKV_e.mjs.map} +1 -1
  137. package/dist/signed-url-BQPbv2In.mjs +74 -0
  138. package/dist/signed-url-BQPbv2In.mjs.map +1 -0
  139. package/dist/{smtp.provider-CAwpvzvD.mjs → smtp.provider-w0Ve52Xg.mjs} +2 -2
  140. package/dist/{smtp.provider-CAwpvzvD.mjs.map → smtp.provider-w0Ve52Xg.mjs.map} +1 -1
  141. package/dist/storage/index.d.mts +39 -17
  142. package/dist/storage/index.d.mts.map +1 -1
  143. package/dist/storage/index.mjs +3 -3
  144. package/dist/storage/providers/index.d.mts +30 -70
  145. package/dist/storage/providers/index.d.mts.map +1 -1
  146. package/dist/storage/providers/index.mjs +2 -2
  147. package/dist/{storage-CJ-QOwNv.mjs → storage-1zw-6Yiz.mjs} +101 -27
  148. package/dist/storage-1zw-6Yiz.mjs.map +1 -0
  149. package/dist/{storage-provider.interface-YRtyYBxV.d.mts → storage-provider.interface-Bd6vA4ak.d.mts} +20 -21
  150. package/dist/storage-provider.interface-Bd6vA4ak.d.mts.map +1 -0
  151. package/dist/{stratal-B7G4i9-N.mjs → stratal-DeEcGgdq.mjs} +57 -26
  152. package/dist/stratal-DeEcGgdq.mjs.map +1 -0
  153. package/dist/{types-CN0zONAZ.d.mts → types-cySNS_lp.d.mts} +1 -1
  154. package/dist/types-cySNS_lp.d.mts.map +1 -0
  155. package/dist/{usage-generator-Cl1HPlUp.mjs → usage-generator-BUdlhnCK.mjs} +2 -2
  156. package/dist/{usage-generator-Cl1HPlUp.mjs.map → usage-generator-BUdlhnCK.mjs.map} +1 -1
  157. package/dist/{validation-B4bePOa_.mjs → validation-DtJwAv7O.mjs} +62 -8
  158. package/dist/validation-DtJwAv7O.mjs.map +1 -0
  159. package/dist/websocket/index.d.mts +9 -4
  160. package/dist/websocket/index.d.mts.map +1 -1
  161. package/dist/websocket/index.mjs +1 -1
  162. package/dist/workers/index.d.mts +2 -1
  163. package/dist/workers/index.d.mts.map +1 -1
  164. package/dist/workers/index.mjs +2 -2
  165. package/package.json +32 -40
  166. package/dist/cron-manager-1KnZvojs.mjs.map +0 -1
  167. package/dist/cron-manager-BnEZquBL.d.mts.map +0 -1
  168. package/dist/en-3QnZwP-u.mjs.map +0 -1
  169. package/dist/errors--RBIvDXr.mjs.map +0 -1
  170. package/dist/errors-B7hCnXgB.mjs.map +0 -1
  171. package/dist/gateway-context-BdBFoQd8.mjs.map +0 -1
  172. package/dist/guards-MtDgcHnF.mjs.map +0 -1
  173. package/dist/i18n.module-BpLLLCTg.mjs.map +0 -1
  174. package/dist/index-BrmS34sa.d.mts.map +0 -1
  175. package/dist/index-DPxmo6AY.d.mts.map +0 -1
  176. package/dist/index-Dfpd_ypO.d.mts.map +0 -1
  177. package/dist/module-C3YZ-kZN.mjs.map +0 -1
  178. package/dist/quarry-registry-CQCIlYTO.mjs.map +0 -1
  179. package/dist/s3-storage.provider-BAhHDMI3.mjs +0 -343
  180. package/dist/s3-storage.provider-BAhHDMI3.mjs.map +0 -1
  181. package/dist/storage-CJ-QOwNv.mjs.map +0 -1
  182. package/dist/storage-provider.interface-YRtyYBxV.d.mts.map +0 -1
  183. package/dist/stratal-B7G4i9-N.mjs.map +0 -1
  184. package/dist/types-CN0zONAZ.d.mts.map +0 -1
  185. package/dist/validation-B4bePOa_.mjs.map +0 -1
@@ -1,7 +1,9 @@
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";
1
+ import { t as Constructor } from "./types-cySNS_lp.mjs";
2
+ import { t as Macroable } from "./index-7-hU3GTV.mjs";
3
+ import { t as StratalEnv } from "./env-D1rcZ8_r.mjs";
4
+ import { t as index_d_exports } from "./index-C1KvMncZ.mjs";
5
+ import { C as MessageParams, S as MessageKeys, a as index_d_exports$1, b as II18nService, i as ZodError, o as z, t as OpenAPIHono, x as MessageKeyPrefix } from "./index-Bnpfq6uk.mjs";
6
+ import { i as LoggerService, l as LogLevel } from "./index-DBd_2wv8.mjs";
5
7
  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
8
  import { AsyncLocalStorage } from "node:async_hooks";
7
9
  import { SSEMessage, SSEStreamingApi, SSEStreamingApi as SSEStreamingApi$1 } from "hono/streaming";
@@ -314,6 +316,47 @@ interface SerializedRoute {
314
316
  * Serialized from `RouteRegistry.named()` on the server, consumed by `useRoute()` on the client.
315
317
  */
316
318
  type SerializedRoutes = Record<string, SerializedRoute>;
319
+ /**
320
+ * Snapshot of the route bound to the current request — shared with the client
321
+ * so URL helpers can answer "which route am I on?", "what are its params?",
322
+ * and "which sticky defaults should I auto-apply?" without parsing the URL.
323
+ *
324
+ * Discriminated by `name`. When `StratalRouteMap` is augmented, narrowing on
325
+ * `name` strictly types `params` per route:
326
+ *
327
+ * ```ts
328
+ * if (route.name === 'users.show') {
329
+ * route.params.id // typed as string
330
+ * }
331
+ * ```
332
+ */
333
+ type CurrentRoute = { [K in RouteName]: {
334
+ name: K;
335
+ params: NonNullable<RouteParams<K>>;
336
+ defaults: Record<string, string>;
337
+ } }[RouteName] | {
338
+ name: null;
339
+ params: Record<string, string>;
340
+ defaults: Record<string, string>;
341
+ };
342
+ /**
343
+ * All valid arguments to `current(name)` — strict route names plus dotted
344
+ * wildcard patterns like `'users.*'` derived from real route prefixes.
345
+ *
346
+ * When `StratalRouteMap` is augmented and contains `'admin.users.show'`,
347
+ * valid wildcards are `'admin.*'` and `'admin.users.*'`. When un-augmented,
348
+ * collapses to `string`. When augmented but no route name has a `.`
349
+ * separator, the wildcard alternative resolves to `never` and the union
350
+ * collapses to just `RouteName`.
351
+ */
352
+ type RouteMatcher = keyof StratalRouteMap extends never ? string : RouteName | `${RoutePrefixes<RouteName>}.*`;
353
+ /**
354
+ * Recursively split a dotted name into all its prefix segments.
355
+ *
356
+ * @example
357
+ * RoutePrefixes<'admin.users.show'> // 'admin' | 'admin.users'
358
+ */
359
+ type RoutePrefixes<S extends string> = S extends `${infer Head}.${infer Rest}` ? Head | `${Head}.${RoutePrefixes<Rest>}` : never;
317
360
  //#endregion
318
361
  //#region src/di/tokens.d.ts
319
362
  /**
@@ -499,28 +542,6 @@ declare function getContainer(): Container;
499
542
  */
500
543
  declare function runWithContainer<T>(container: Container, fn: () => T): T;
501
544
  //#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
545
  //#region src/router/constants.d.ts
525
546
  /**
526
547
  * Type-safe context keys for Hono router variables
@@ -545,6 +566,7 @@ declare const ROUTE_METADATA_KEYS: {
545
566
  readonly WS_ON_MESSAGE: symbol;
546
567
  readonly WS_ON_CLOSE: symbol;
547
568
  readonly WS_ON_ERROR: symbol;
569
+ readonly RATE_LIMIT: symbol;
548
570
  };
549
571
  /**
550
572
  * Security scheme identifiers for OpenAPI
@@ -679,7 +701,7 @@ interface RouteConfig {
679
701
  * Status code auto-derived: create()->201, others->200
680
702
  * @example userSchema or { schema: userSchema, description: 'User details' }
681
703
  */
682
- response: RouteResponse;
704
+ response?: RouteResponse;
683
705
  /**
684
706
  * OpenAPI tags for grouping endpoints
685
707
  * Merged with controller-level tags
@@ -790,6 +812,15 @@ interface ControllerOptions {
790
812
  */
791
813
  domain?: string;
792
814
  }
815
+ /**
816
+ * Trailing-slash handling for incoming requests.
817
+ *
818
+ * - `'ignore'` (default) — match both `/foo` and `/foo/` for the same route, no redirect.
819
+ * - `'always'` — non-trailing requests redirect (308) to the trailing-slash form.
820
+ * Paths whose last segment contains `.` (e.g. `/api/openapi.json`) are skipped.
821
+ * - `'never'` — trailing requests redirect (308) to the non-trailing form.
822
+ */
823
+ type TrailingSlashMode = 'ignore' | 'always' | 'never';
793
824
  /**
794
825
  * Versioning configuration for the application.
795
826
  * Enables URI-based API versioning when provided to Stratal config.
@@ -829,100 +860,6 @@ interface LocalePathConfig {
829
860
  defaultLocale: string | null;
830
861
  }
831
862
  //#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
863
  //#region src/execution-context.d.ts
927
864
  interface StratalExecutionContext {
928
865
  waitUntil(promise: Promise<unknown>): void;
@@ -1668,6 +1605,100 @@ interface Middleware {
1668
1605
  handle(ctx: RouterContext, next: Next$1): Promise<Response | void>;
1669
1606
  }
1670
1607
  //#endregion
1608
+ //#region src/router/hono-app.d.ts
1609
+ /**
1610
+ * HonoApp — extends OpenAPIHono with Stratal-specific setup
1611
+ *
1612
+ * - Request scope middleware (child container per request)
1613
+ * - Global middleware (CORS, logging, error handling)
1614
+ * - defaultHook for validation errors
1615
+ * - `use()` overload for Stratal middleware classes
1616
+ * - `configure()` for OpenAPI, routes, and 404
1617
+ */
1618
+ declare class HonoApp extends OpenAPIHono<RouterEnv> {
1619
+ private configured;
1620
+ private readonly _container;
1621
+ private readonly _logger;
1622
+ /**
1623
+ * Reference to the original Hono `use` implementation.
1624
+ * Captured in constructor after super() sets it as an instance property.
1625
+ * Used by private methods to register middleware without going through the override.
1626
+ */
1627
+ private nativeUse;
1628
+ constructor(container: Container, logger: LoggerService, application: Application);
1629
+ /**
1630
+ * Apply global middleware (logger + error handler).
1631
+ * Called by Application after locale middleware is applied by LocalePathService.
1632
+ */
1633
+ private applyGlobalMiddleware;
1634
+ /**
1635
+ * Configure OpenAPI endpoints, controller routes, and 404 handler.
1636
+ * Called once by Application.initialize().
1637
+ */
1638
+ configure(): Promise<void>;
1639
+ private setupRequestScope;
1640
+ private handleException;
1641
+ }
1642
+ //#endregion
1643
+ //#region src/router/services/locale-path.service.d.ts
1644
+ /**
1645
+ * A resolved path with locale variant metadata.
1646
+ */
1647
+ interface ResolvedPath {
1648
+ /** The fully resolved path (may include /:locale prefix) */
1649
+ path: string;
1650
+ /** Whether this path is a locale-prefixed variant */
1651
+ isLocaleVariant: boolean;
1652
+ }
1653
+ /**
1654
+ * Resolves locale path variants for route paths.
1655
+ *
1656
+ * Computes `LocalePathConfig` from `I18nModuleOptions` and provides
1657
+ * path expansion for locale-prefixed route variants.
1658
+ *
1659
+ * Also applies language detection and default locale redirect middleware
1660
+ * to HonoApp when resolved from the container.
1661
+ *
1662
+ * Registered as a singleton in the container.
1663
+ */
1664
+ declare class LocalePathService {
1665
+ private readonly honoApp;
1666
+ private readonly _config;
1667
+ private readonly _pathDetectionEnabled;
1668
+ private readonly _prefixDefaultLocale;
1669
+ constructor(container: Container, honoApp: HonoApp);
1670
+ /** Whether path-based locale detection is enabled */
1671
+ get enabled(): boolean;
1672
+ /** The computed locale path config, or null if path detection is disabled */
1673
+ get localePathConfig(): LocalePathConfig | null;
1674
+ /** The prefixDefaultLocale setting (false, true, or 'redirect') */
1675
+ get prefixDefaultLocale(): false | true | 'redirect';
1676
+ /**
1677
+ * Expand a path into primary + locale-prefixed variants.
1678
+ *
1679
+ * @param path - The base path to expand
1680
+ * @returns Array of resolved paths with locale metadata
1681
+ */
1682
+ resolve(path: string): ResolvedPath[];
1683
+ /**
1684
+ * Build a Hono regex constraint from prefixed locales.
1685
+ * e.g., `{en|de|fr}` — restricts `:locale` to only match known values.
1686
+ */
1687
+ private buildLocaleConstraint;
1688
+ /**
1689
+ * Apply Hono's languageDetector middleware and bridge the detected language
1690
+ * to Stratal's LOCALE context variable.
1691
+ */
1692
+ private setupLanguageDetection;
1693
+ /**
1694
+ * Redirect requests that include the default locale prefix to the unprefixed path.
1695
+ * For example, `/en/users` → 301 redirect to `/users`.
1696
+ *
1697
+ * Only active when `prefixDefaultLocale` is `'redirect'`.
1698
+ */
1699
+ private setupDefaultLocaleRedirect;
1700
+ }
1701
+ //#endregion
1671
1702
  //#region src/router/router.internals.d.ts
1672
1703
  /**
1673
1704
  * Symbol keys for Router internal accessors.
@@ -1762,6 +1793,20 @@ declare class Router {
1762
1793
  name(prefix: string): this;
1763
1794
  /** Middleware applied to controllers in this scope */
1764
1795
  middleware(...middlewares: Constructor<Middleware>[]): this;
1796
+ /**
1797
+ * Apply a named rate limiter to controllers in this scope.
1798
+ *
1799
+ * The named limiter must be registered via `RateLimiterRegistry.for(name, ...)`
1800
+ * (typically inside a module's `onInitialize` hook), and the user must
1801
+ * import `RateLimiterModule.forRoot({ store: ... })` in their AppModule.
1802
+ *
1803
+ * @example
1804
+ * ```typescript
1805
+ * router.prefix('/uploads').throttle('uploads')
1806
+ * router.group([AdminController], (admin) => admin.throttle('admin'))
1807
+ * ```
1808
+ */
1809
+ throttle(name: string): this;
1765
1810
  /** API version for controllers in this scope */
1766
1811
  version(version: string | string[]): this;
1767
1812
  /** Hide/show routes in this scope from OpenAPI docs */
@@ -1848,7 +1893,8 @@ declare class ModuleRegistry {
1848
1893
  */
1849
1894
  getAllSeeders(): Constructor[];
1850
1895
  /**
1851
- * Get all Router configurations from modules implementing RouteConfigurable
1896
+ * Get all Router configurations from modules implementing RouteConfigurable.
1897
+ * Runs configureRoutes() lazily on first call (deferred from initialize()).
1852
1898
  */
1853
1899
  getAllRouterConfigs(): {
1854
1900
  router: Router;
@@ -1911,6 +1957,114 @@ declare class ModuleRegistry {
1911
1957
  private collectIfListener;
1912
1958
  }
1913
1959
  //#endregion
1960
+ //#region src/router/services/versioning.service.d.ts
1961
+ /**
1962
+ * Resolves version prefixes for route paths.
1963
+ *
1964
+ * Handles VERSION_NEUTRAL, multi-version arrays, default version fallback,
1965
+ * and configurable prefix (default: 'v').
1966
+ *
1967
+ * Registered as a singleton in the container.
1968
+ */
1969
+ declare class VersioningService {
1970
+ private readonly options;
1971
+ constructor(app: Application);
1972
+ /** Whether versioning is enabled */
1973
+ get enabled(): boolean;
1974
+ /**
1975
+ * Resolve versioned paths for a base path.
1976
+ *
1977
+ * @param basePath - The base path (e.g., '/users')
1978
+ * @param version - Explicit version from controller/router config
1979
+ * @returns Array of versioned path strings (e.g., ['/v1/users', '/v2/users'])
1980
+ */
1981
+ resolve(basePath: string, version?: string | string[] | typeof VERSION_NEUTRAL): string[];
1982
+ }
1983
+ //#endregion
1984
+ //#region src/router/route-registry.d.ts
1985
+ /**
1986
+ * A single registered route in the application.
1987
+ * Tracks both named and unnamed routes, HTTP and WebSocket.
1988
+ */
1989
+ interface RegisteredRoute {
1990
+ /** Route name for URL generation (undefined = unnamed, still tracked) */
1991
+ name?: string;
1992
+ /** HTTP method or 'ws' for WebSocket gateways */
1993
+ method: HttpMethod | 'ws';
1994
+ /** Primary path in Hono-style :param format */
1995
+ path: string;
1996
+ /** Locale-prefixed path variants (e.g., '/:locale/users/:id') */
1997
+ localePaths?: string[];
1998
+ /** Parameter names extracted from path */
1999
+ paramNames: string[];
2000
+ /** Domain pattern (e.g., '{tenant}.example.com') */
2001
+ domain?: string;
2002
+ /** Parameter names extracted from domain */
2003
+ domainParamNames: string[];
2004
+ /** Controller class name */
2005
+ controller: string;
2006
+ /** Controller method name */
2007
+ action: string;
2008
+ /** Whether the route is hidden from OpenAPI docs */
2009
+ hidden: boolean;
2010
+ /** Middleware class names applied to this route */
2011
+ middleware: string[];
2012
+ /** Whether this is a locale-prefixed variant */
2013
+ isLocaleVariant?: boolean;
2014
+ }
2015
+ /**
2016
+ * Input for registering a route. The registry auto-extracts param names
2017
+ * and expands versioned/locale paths via injected services.
2018
+ */
2019
+ type RouteRegistrationInput = Omit<RegisteredRoute, 'paramNames' | 'domainParamNames' | 'path' | 'localePaths' | 'isLocaleVariant'> & {
2020
+ /** Base path before versioning/locale expansion */basePath: string; /** Version from controller/router config (used by VersioningService). Accepts VERSION_NEUTRAL symbol. */
2021
+ version?: string | string[] | typeof VERSION_NEUTRAL; /** Pre-computed param names (optional, auto-extracted if omitted) */
2022
+ paramNames?: string[]; /** Pre-computed domain param names (optional, auto-extracted if omitted) */
2023
+ domainParamNames?: string[];
2024
+ };
2025
+ /**
2026
+ * Central registry for all application routes.
2027
+ * Single source of truth — used by `route:list`, `route:types`, and URL generation.
2028
+ *
2029
+ * Routes are automatically expanded via VersioningService and LocalePathService
2030
+ * during registration, and sorted by specificity when retrieved via `all()`.
2031
+ *
2032
+ * Registered as a singleton in the container.
2033
+ */
2034
+ declare class RouteRegistry {
2035
+ private readonly versioningService;
2036
+ private readonly localePathService;
2037
+ private readonly routes;
2038
+ private readonly namedRoutes;
2039
+ private _sortedCache;
2040
+ private _routeToNameCache;
2041
+ constructor(versioningService: VersioningService, localePathService: LocalePathService);
2042
+ /**
2043
+ * Register a route. Expands via VersioningService + LocalePathService.
2044
+ * Named routes must have unique names.
2045
+ *
2046
+ * @returns Array of expanded RegisteredRoute entries (primary + locale variants)
2047
+ * @throws DuplicateRouteNameError if a named route with the same name already exists
2048
+ */
2049
+ register(input: RouteRegistrationInput): RegisteredRoute[];
2050
+ /** Get a named route by name */
2051
+ get(name: string): RegisteredRoute | undefined;
2052
+ /** Check if a named route exists */
2053
+ has(name: string): boolean;
2054
+ /**
2055
+ * Resolve a Hono-style route path pattern (e.g. as exposed by `c.req.routePath`)
2056
+ * back to its registered name, scoped to the request's HTTP method. Locale variant
2057
+ * paths resolve to the canonical primary route name. Method matching is
2058
+ * case-insensitive; routes registered with `'all'` resolve under any verb.
2059
+ */
2060
+ findNameByRoute(method: string, path: string): string | undefined;
2061
+ private buildRouteToNameCache;
2062
+ /** Get all routes sorted by specificity (static > param > wildcard, primary before locale) */
2063
+ all(): RegisteredRoute[];
2064
+ /** Get only named routes */
2065
+ named(): RegisteredRoute[];
2066
+ }
2067
+ //#endregion
1914
2068
  //#region src/router/router-resolver.d.ts
1915
2069
  /**
1916
2070
  * Resolved configuration for a single controller.
@@ -2013,6 +2167,17 @@ declare class RouteRegistrationService {
2013
2167
  * @returns Hono middleware function
2014
2168
  */
2015
2169
  private createGuardMiddleware;
2170
+ /**
2171
+ * Wrap a controller handler with a `scopedMiddleware → guards → handler`
2172
+ * chain that runs *inside* the Hono route handler — after request
2173
+ * validators have populated `c.req.valid(...)`. This is the only place
2174
+ * we can run user middleware after `@hono/zod-openapi`'s validators in
2175
+ * the same pipeline.
2176
+ *
2177
+ * Returns a Hono handler with the same signature as the original so
2178
+ * `app.openapi(route, wrapped)` works transparently.
2179
+ */
2180
+ private wrapHandlerWithChain;
2016
2181
  /**
2017
2182
  * Register wildcard route for non-RESTful controllers
2018
2183
  */
@@ -2038,10 +2203,11 @@ declare class RouteRegistrationService {
2038
2203
  private mergeMetadata;
2039
2204
  /**
2040
2205
  * Build OpenAPI route configuration from metadata
2041
- * Creates a route definition compatible with @hono/zod-openapi
2042
- * Includes guard execution for proper access control
2206
+ * Creates a route definition compatible with @hono/zod-openapi.
2043
2207
  *
2044
- * Execution order: Global middlewares Guards Handler
2208
+ * Scoped middleware and guards are NOT attached to `route.middleware`
2209
+ * here — they're composed into a wrapped handler in `collectRoutes` so
2210
+ * they run after Hono's request validators. See `wrapHandlerWithChain`.
2045
2211
  */
2046
2212
  private buildOpenAPIRoute;
2047
2213
  /**
@@ -2847,6 +3013,15 @@ declare class RouteNameNotFoundError extends ApplicationError {
2847
3013
  declare class RouterUseScopeError extends ApplicationError {
2848
3014
  constructor();
2849
3015
  }
3016
+ /**
3017
+ * Thrown when a middleware calls next() more than once.
3018
+ * This is a programming error — each middleware must call next() at most once.
3019
+ *
3020
+ * Error Code: 9014
3021
+ */
3022
+ declare class MiddlewareNextCalledMultipleTimesError extends ApplicationError {
3023
+ constructor(middlewareName: string);
3024
+ }
2850
3025
  //#endregion
2851
3026
  //#region src/application.d.ts
2852
3027
  interface ApplicationConfig {
@@ -2862,6 +3037,16 @@ interface ApplicationConfig {
2862
3037
  * When provided, enables URI-based versioning for controllers.
2863
3038
  */
2864
3039
  versioning?: VersioningOptions;
3040
+ /**
3041
+ * Trailing-slash handling for incoming requests.
3042
+ *
3043
+ * Defaults to `'ignore'` — both `/foo` and `/foo/` resolve to the same route.
3044
+ *
3045
+ * - `'ignore'` — match both, no redirect.
3046
+ * - `'always'` — non-trailing requests redirect (308) to the trailing-slash form.
3047
+ * - `'never'` — trailing requests redirect (308) to the non-trailing form.
3048
+ */
3049
+ trailingSlash?: TrailingSlashMode;
2865
3050
  /**
2866
3051
  * Custom exception handler class.
2867
3052
  *
@@ -2916,6 +3101,8 @@ declare class Application {
2916
3101
  private cronManager;
2917
3102
  private quarry;
2918
3103
  private initialized;
3104
+ private routingInitPromise;
3105
+ private handlerInitPromise;
2919
3106
  readonly env: StratalEnv;
2920
3107
  private readonly appConfig;
2921
3108
  constructor({
@@ -2928,9 +3115,13 @@ declare class Application {
2928
3115
  */
2929
3116
  get container(): Container;
2930
3117
  /**
2931
- * Get the HonoApp instance
3118
+ * Lazily initialize routing and return the HonoApp instance.
3119
+ *
3120
+ * Routing (service registration, HonoApp resolution, route configuration)
3121
+ * is deferred so that `scheduled` and `queue` handlers don't pay the CPU
3122
+ * cost of route setup on cold start.
2932
3123
  */
2933
- get hono(): HonoApp;
3124
+ ensureHono(): Promise<HonoApp>;
2934
3125
  /**
2935
3126
  * Get the application configuration
2936
3127
  */
@@ -2942,6 +3133,16 @@ declare class Application {
2942
3133
  * Called after module initialization so I18N_TOKENS.Options is available.
2943
3134
  */
2944
3135
  private registerRoutingServices;
3136
+ /**
3137
+ * Wire up queue consumers and event listeners.
3138
+ * Called lazily on first fetch/queue — not during scheduled handling.
3139
+ */
3140
+ private initializeHandlers;
3141
+ /**
3142
+ * Register routing services, resolve HonoApp, and configure routes.
3143
+ * Called lazily on first fetch — not during scheduled/queue handling.
3144
+ */
3145
+ private initializeRouting;
2945
3146
  /**
2946
3147
  * Resolve a service from the container
2947
3148
  */
@@ -2985,105 +3186,6 @@ declare class Application {
2985
3186
  private initializeExceptionHandler;
2986
3187
  }
2987
3188
  //#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
3189
  //#region src/router/uri.d.ts
3088
3190
  /**
3089
3191
  * Options for URL generation methods.
@@ -3132,7 +3234,8 @@ declare class Uri {
3132
3234
  private readonly registry;
3133
3235
  private readonly routerContext;
3134
3236
  private _defaults;
3135
- constructor(registry: RouteRegistry, routerContext: RouterContext);
3237
+ private readonly trailingSlash;
3238
+ constructor(registry: RouteRegistry, routerContext: RouterContext, application: Application);
3136
3239
  /**
3137
3240
  * Set default URL parameters for this request.
3138
3241
  * Applied to all subsequent `route()` calls — explicit params override defaults.
@@ -3140,6 +3243,14 @@ declare class Uri {
3140
3243
  * @param params - Default parameters (e.g., `{ locale: 'en' }`)
3141
3244
  */
3142
3245
  defaults(params: Record<string, string>): void;
3246
+ /**
3247
+ * Read the currently configured default URL parameters.
3248
+ *
3249
+ * Used by frameworks that need to share these with the client (e.g. the
3250
+ * Inertia adapter ships them as a shared prop so `route()` calls in the
3251
+ * browser auto-fill the same sticky params as the server).
3252
+ */
3253
+ getDefaults(): Record<string, string>;
3143
3254
  /**
3144
3255
  * Generate a URL from a named route.
3145
3256
  *
@@ -3255,13 +3366,18 @@ type ContextQueryResult<R extends Record<string, unknown> | undefined, K extends
3255
3366
  * }
3256
3367
  * ```
3257
3368
  */
3258
- declare class RouterContext<T extends RouterEnv = RouterEnv> {
3369
+ declare class RouterContext<T extends RouterEnv = RouterEnv> extends Macroable {
3259
3370
  readonly c: Context<T>;
3260
3371
  /**
3261
3372
  * Native Hono context
3262
3373
  * Access for advanced use cases not covered by helper methods
3263
3374
  */
3264
3375
  constructor(c: Context<T>);
3376
+ /**
3377
+ * Cloudflare-provided request properties (geo, TLS, bot management, etc.).
3378
+ * Always available on Cloudflare Workers requests via `c.req.raw.cf`.
3379
+ */
3380
+ get cf(): CfProperties;
3265
3381
  /**
3266
3382
  * Get request-scoped DI container
3267
3383
  * Contains request-specific services and context (AuthContext)
@@ -3291,10 +3407,20 @@ declare class RouterContext<T extends RouterEnv = RouterEnv> {
3291
3407
  */
3292
3408
  json(data: object | null, status?: ContentfulStatusCode): Response;
3293
3409
  /**
3294
- * Get route parameter value
3410
+ * Get route parameter value(s).
3411
+ *
3412
+ * Reads the validated, Zod-coerced param record from `c.req.valid('param')`,
3413
+ * which is what `@hono/zod-openapi` populates for every route registered
3414
+ * via `app.openapi(...)`. Bare `c.req.param()` returns `undefined` for those
3415
+ * routes — always go through the validated record.
3416
+ *
3417
+ * - With a key → returns the single string value.
3418
+ * - With no args → returns the full `Record<string, string>` (or `{}` when
3419
+ * the matched route has no path params).
3295
3420
  *
3296
3421
  * @param key - Parameter name (e.g., 'id' for /users/:id)
3297
3422
  */
3423
+ param(): Record<string, string>;
3298
3424
  param(key: string): string;
3299
3425
  /**
3300
3426
  * Get query parameter value
@@ -3871,7 +3997,13 @@ declare const ERROR_CODES: {
3871
3997
  readonly FAILED_TO_CREATE_SESSION: 3012; /** User update failed */
3872
3998
  readonly FAILED_TO_UPDATE_USER: 3013; /** Social account already linked */
3873
3999
  readonly SOCIAL_ACCOUNT_LINKED: 3014; /** Last account cannot be unlinked */
3874
- readonly CANNOT_UNLINK_LAST_ACCOUNT: 3015;
4000
+ readonly CANNOT_UNLINK_LAST_ACCOUNT: 3015; /** Organization not found */
4001
+ readonly ORGANIZATION_NOT_FOUND: 3020; /** Organization member not found */
4002
+ readonly MEMBER_NOT_FOUND: 3021; /** Organization invitation not found */
4003
+ readonly INVITATION_NOT_FOUND: 3022; /** Invitation recipient mismatch */
4004
+ readonly INVITATION_RECIPIENT_MISMATCH: 3023; /** Organization limit reached */
4005
+ readonly ORGANIZATION_LIMIT_REACHED: 3024; /** Organization membership constraint violation */
4006
+ readonly ORGANIZATION_MEMBERSHIP_REQUIRED: 3025;
3875
4007
  };
3876
4008
  /**
3877
4009
  * Authorization Errors (3100-3199)
@@ -3890,7 +4022,8 @@ declare const ERROR_CODES: {
3890
4022
  /** Generic resource not found */readonly NOT_FOUND: 4000; /** Route/endpoint not found */
3891
4023
  readonly ROUTE_NOT_FOUND: 4004; /** Resource conflict or duplicate */
3892
4024
  readonly CONFLICT: 4100; /** Resource already exists */
3893
- readonly ALREADY_EXISTS: 4101;
4025
+ readonly ALREADY_EXISTS: 4101; /** Rate limit exceeded */
4026
+ readonly TOO_MANY_REQUESTS: 4290;
3894
4027
  };
3895
4028
  /**
3896
4029
  * Validation Errors (1000-1999)
@@ -3915,7 +4048,8 @@ declare const ERROR_CODES: {
3915
4048
  readonly DUPLICATE_ROUTE_NAME: 9010; /** Named route not found in RouteRegistry */
3916
4049
  readonly ROUTE_NAME_NOT_FOUND: 9011; /** Required route parameter missing during URL generation */
3917
4050
  readonly MISSING_ROUTE_PARAM: 9012; /** router.use() called inside group() callback */
3918
- readonly USE_SCOPE_VIOLATION: 9013;
4051
+ readonly USE_SCOPE_VIOLATION: 9013; /** next() called more than once in a middleware */
4052
+ readonly MIDDLEWARE_NEXT_CALLED_MULTIPLE_TIMES: 9014;
3919
4053
  };
3920
4054
  /**
3921
4055
  * I18n Errors (9300-9399)
@@ -4241,7 +4375,13 @@ declare class InternalError extends ApplicationError {
4241
4375
  //#endregion
4242
4376
  //#region src/errors/is-application-error.d.ts
4243
4377
  /**
4244
- * Type guard to check if an error is an ApplicationError
4378
+ * Type guard to check if an error is an ApplicationError.
4379
+ *
4380
+ * Uses `instanceof` first, then falls back to a structural check
4381
+ * for the `code` and `timestamp` properties that all ApplicationError
4382
+ * instances have. This handles cross-module boundary cases where
4383
+ * `instanceof` fails due to duplicate class identities (e.g., Vite's
4384
+ * module graph in workerd).
4245
4385
  *
4246
4386
  * @param error - The error to check
4247
4387
  * @returns True if the error is an ApplicationError instance
@@ -4283,5 +4423,5 @@ declare class StratalNotInitializedError extends ApplicationError {
4283
4423
  constructor();
4284
4424
  }
4285
4425
  //#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
4426
+ export { DuplicateRouteNameError as $, TrailingSlashMode as $n, ModuleRegistry as $t, LocaleNotSupportedError as A, ValueProvider as An, container$1 as Ar, Delete as At, ContextQueryResult as B, ControllerOptions as Bn, PredicateContainer as Br, extractDomainParamNames as Bt, DetectionStrategy as C, ModuleContext as Cn, RoutePrefixes as Cr, successMessageSchema as Ct, buildDetectorOptions as D, OnShutdown as Dn, Container as Dr, getRouteDecoratedMethods as Dt, ResolvedI18nOptions as E, OnInitialize as En, StratalRouteMap as Er, Route as Et, QueueExceptionContext as F, RenderableCallback as Fn, singleton as Fr, Controller as Ft, buildRouteUrl as G, RouteBodyObject as Gn, Environment as Gr, toOpenAPIPath as Gt, SignedUriOptions as H, ExplicitRouteMetadata as Hn, ExtensionDecorator as Hr, generateConventionRouteName as Ht, createCliExceptionContext as I, Reportable as In, ConditionalBindingBuilder as Ir, getControllerOptions as It, ApplicationOptions as J, RouteResponse as Jn, RouteRegistrationService as Jt, Application as K, RouteConfig as Kn, ErrorResponse as Kr, route as Kt, createCronExceptionContext as L, ReportableCallback as Ln, ConditionalBindingBuilderImpl as Lr, getControllerRoute as Lt, CronExceptionContext as M, ApplicationErrorConstructor as Mn, inject$1 as Mr, Patch as Mt, ExceptionContext as N, ContextCallback as Nn, injectable$1 as Nr, Post as Nt, resolveI18nOptions as O, Provider as On, ContainerOptions as Or, getRouteMetadata as Ot, HttpExceptionContext as P, LogSeverity as Pn, instancePerContainerCachingFactory$1 as Pr, Put as Pt, DomainMismatchError as Q, SecurityScheme as Qn, VersioningService as Qt, createHttpExceptionContext as R, RespondCallback as Rn, ConditionalBindingGive as Rr, getControllerVersion as Rt, I18nModule as S, ModuleClass as Sn, RouteParams as Sr, paginationQuerySchema as St, LanguageDetectionOptions as T, OnException as Tn, SerializedRoutes as Tr, validationErrorResponseSchema as Tt, Uri as U, LocalePathConfig as Un, Scope as Ur, getPathSpecificityScore as Ut, RouterContext as V, ConventionRouteMetadata as Vn, ContainerLike as Vr, extractParamNames as Vt, UriOptions as W, RouteBody as Wn, WhenOptions as Wr, sortRoutesBySpecificity as Wt, SSEStreamingApi$1 as X, RouterEnv as Xn, RouteRegistrationInput as Xt, SSEMessage as Y, RouteResponseObject as Yn, RegisteredRoute as Yt, StreamingApi$1 as Z, RouterVariables as Zn, RouteRegistry as Zt, Messages as _, ClassProvider as _n, DIToken as _r, createDomainMiddleware as _t, InternalError as a, HonoApp as an, VERSION_NEUTRAL as ar, RouteNameNotFoundError as at, messages as b, FactoryProvider as bn, RouteMatcher as br, errorResponseSchema as bt, getHttpStatus as c, IController as cn, runWithContainer as cr, RouteNotFoundError as ct, ApplicationError as d, CommandResult as dn, Transient as dr, HonoAppAlreadyConfiguredError as dt, RouteConfigurable as en, VersioningOptions as er, InvalidSignatureError as et, ERROR_CODES as f, ParsedArgument as fn, INJECT_PARAM_METADATA_KEY as fr, ControllerRegistrationError as ft, MessageRegistry as g, AsyncModuleOptions as gn, CONTAINER_TOKEN as gr, VerifySignatureMiddleware as gt, MessageLoaderService as h, Quarry as hn, getMethodInjections as hr, verifySignedUrl as ht, isApplicationError as i, ResolvedPath as in, SECURITY_SCHEMES as ir, ResponseValidationError as it, CliExceptionContext as j, ExceptionHandler as jn, delay as jr, Get as jt, TranslationMissingError as k, RegistryEntry as kn, DependencyContainer$1 as kr, All as kt, resolveHttpStatus as l, CommandInput as ln, RequestScopeOperationNotAllowedError as lr, OpenAPIValidationError as lt, I18nContextMiddleware as m, ParsedSignature as mn, ParamInjection as mr, signUrl as mt, RequestContainerNotInitializedError as n, RouterGroupConfig as nn, ROUTER_CONTEXT_KEYS as nr, MissingEnvironmentVariableError as nt, HttpException as o, Middleware as on, containerStorage as or, RouterUseScopeError as ot, ErrorCode as p, ParsedOption as pn, InjectParam as pr, SignedUrlOptions as pt, ApplicationConfig as q, RouteMetadata as qn, isErrorResponse as qr, ROUTER_TOKENS as qt, ContainerNotInitializedError as r, LocalePathService as rn, ROUTE_METADATA_KEYS as rr, MissingRouteParamError as rt, abort as s, Next$1 as sn, getContainer as sr, SchemaValidationError as st, StratalNotInitializedError as t, Router as tn, HTTP_METHODS as tr, MiddlewareNextCalledMultipleTimesError as tt, DefaultExceptionHandler as u, CommandInternals as un, ConditionalBindingFallbackError as ur, OpenAPIRouteRegistrationError as ut, getLocales as v, DynamicModule as vn, DI_TOKENS as vr, parseDomainPattern as vt, I18nModuleOptions as w, ModuleOptions as wn, SerializedRoute as wr, uuidParamSchema as wt, I18N_TOKENS as x, InjectionToken$2 as xn, RouteName as xr, paginatedResponseSchema as xt, getMessages as y, ExistingProvider as yn, CurrentRoute as yr, commonErrorSchemas as yt, createQueueExceptionContext as z, StratalExecutionContext as zn, ConditionalBindingUse as zr, createMiddlewareChain as zt };
4427
+ //# sourceMappingURL=index-D0US0X14.d.mts.map