stratal 0.0.18 → 0.0.19

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 (172) hide show
  1. package/README.md +8 -8
  2. package/dist/{base-email.provider-Cuw4OAB0.mjs → base-email.provider-mjynzewK.mjs} +1 -1
  3. package/dist/{base-email.provider-Cuw4OAB0.mjs.map → base-email.provider-mjynzewK.mjs.map} +1 -1
  4. package/dist/bin/cloudflare-workers-loader.mjs.map +1 -1
  5. package/dist/bin/quarry.mjs +21 -36
  6. package/dist/bin/quarry.mjs.map +1 -1
  7. package/dist/cache/index.d.mts +3 -2
  8. package/dist/cache/index.d.mts.map +1 -1
  9. package/dist/cache/index.mjs +3 -3
  10. package/dist/{colors-BTAnQRGU.mjs → colors-DJaRDXoS.mjs} +1 -1
  11. package/dist/{colors-BTAnQRGU.mjs.map → colors-DJaRDXoS.mjs.map} +1 -1
  12. package/dist/{command-DjGqCYHv.mjs → command-BgSlsS4M.mjs} +2 -2
  13. package/dist/{command-DjGqCYHv.mjs.map → command-BgSlsS4M.mjs.map} +1 -1
  14. package/dist/{command-B1YuV-UZ.d.mts → command-DsQq56Lp.d.mts} +2 -2
  15. package/dist/{command-B1YuV-UZ.d.mts.map → command-DsQq56Lp.d.mts.map} +1 -1
  16. package/dist/config/index.d.mts +81 -37
  17. package/dist/config/index.d.mts.map +1 -1
  18. package/dist/config/index.mjs +126 -45
  19. package/dist/config/index.mjs.map +1 -1
  20. package/dist/{consumer-registry-BkuHXR_u.d.mts → consumer-registry-Doom7BEh.d.mts} +1 -1
  21. package/dist/{consumer-registry-BkuHXR_u.d.mts.map → consumer-registry-Doom7BEh.d.mts.map} +1 -1
  22. package/dist/controller.decorator-LZY9aHYG.mjs +66 -0
  23. package/dist/controller.decorator-LZY9aHYG.mjs.map +1 -0
  24. package/dist/cron/index.d.mts +4 -3
  25. package/dist/cron/index.d.mts.map +1 -1
  26. package/dist/cron/index.mjs +1 -1
  27. package/dist/{cron-manager-1KnZvojs.mjs → cron-manager-C30t9UZM.mjs} +29 -19
  28. package/dist/cron-manager-C30t9UZM.mjs.map +1 -0
  29. package/dist/{cron-manager-BnEZquBL.d.mts → cron-manager-RuPtFVLy.d.mts} +27 -13
  30. package/dist/cron-manager-RuPtFVLy.d.mts.map +1 -0
  31. package/dist/di/index.d.mts +1 -1
  32. package/dist/di/index.mjs +2 -2
  33. package/dist/email/index.d.mts +3 -3
  34. package/dist/email/index.mjs +87 -10
  35. package/dist/email/index.mjs.map +1 -1
  36. package/dist/{en-3QnZwP-u.mjs → en-rHmW6vD9.mjs} +5 -31
  37. package/dist/en-rHmW6vD9.mjs.map +1 -0
  38. package/dist/env-CamWD-U1.d.mts +25 -0
  39. package/dist/env-CamWD-U1.d.mts.map +1 -0
  40. package/dist/errors/index.d.mts +1 -1
  41. package/dist/errors/index.mjs +1 -1
  42. package/dist/{errors--RBIvDXr.mjs → errors-B4pYgYON.mjs} +161 -7
  43. package/dist/errors-B4pYgYON.mjs.map +1 -0
  44. package/dist/{errors-B7hCnXgB.mjs → errors-BUyUfr2Z.mjs} +14 -7
  45. package/dist/errors-BUyUfr2Z.mjs.map +1 -0
  46. package/dist/events/index.d.mts +2 -2
  47. package/dist/events/index.mjs +1 -1
  48. package/dist/{events-UTJliZhl.mjs → events-COKixqnG.mjs} +2 -2
  49. package/dist/{events-UTJliZhl.mjs.map → events-COKixqnG.mjs.map} +1 -1
  50. package/dist/{gateway-context-BdBFoQd8.mjs → gateway-context-cqZ8wMoi.mjs} +4 -65
  51. package/dist/gateway-context-cqZ8wMoi.mjs.map +1 -0
  52. package/dist/guards/index.d.mts +14 -5
  53. package/dist/guards/index.d.mts.map +1 -1
  54. package/dist/guards/index.mjs +1 -1
  55. package/dist/{guards-MtDgcHnF.mjs → guards-DMbsAxSX.mjs} +1 -1
  56. package/dist/guards-DMbsAxSX.mjs.map +1 -0
  57. package/dist/http-method.decorator-BT3ufnz8.mjs +96 -0
  58. package/dist/http-method.decorator-BT3ufnz8.mjs.map +1 -0
  59. package/dist/i18n/index.d.mts +3 -3
  60. package/dist/i18n/index.mjs +2 -2
  61. package/dist/i18n/messages/en/index.d.mts +1 -1
  62. package/dist/i18n/messages/en/index.mjs +1 -1
  63. package/dist/i18n/utils/index.mjs +1 -1
  64. package/dist/i18n/validation/index.d.mts +1 -1
  65. package/dist/i18n/validation/index.mjs +1 -1
  66. package/dist/{i18n.module-BpLLLCTg.mjs → i18n.module-CI_prYFD.mjs} +74 -196
  67. package/dist/i18n.module-CI_prYFD.mjs.map +1 -0
  68. package/dist/{index-Dfpd_ypO.d.mts → index-B437eK7p.d.mts} +26 -12
  69. package/dist/index-B437eK7p.d.mts.map +1 -0
  70. package/dist/{index-BR23zDMy.d.mts → index-CWRS7Ri3.d.mts} +1 -1
  71. package/dist/{index-BR23zDMy.d.mts.map → index-CWRS7Ri3.d.mts.map} +1 -1
  72. package/dist/{index-BDh9J2KD.d.mts → index-DFhEeFfC.d.mts} +4 -30
  73. package/dist/{index-BDh9J2KD.d.mts.map → index-DFhEeFfC.d.mts.map} +1 -1
  74. package/dist/{index-BrmS34sa.d.mts → index-DPFqRs8L.d.mts} +70 -39
  75. package/dist/index-DPFqRs8L.d.mts.map +1 -0
  76. package/dist/{index-DPxmo6AY.d.mts → index-Dnqm9ZB6.d.mts} +5 -4
  77. package/dist/index-Dnqm9ZB6.d.mts.map +1 -0
  78. package/dist/index-SHx31sBJ.d.mts +101 -0
  79. package/dist/index-SHx31sBJ.d.mts.map +1 -0
  80. package/dist/index.d.mts +3 -2
  81. package/dist/index.d.mts.map +1 -1
  82. package/dist/index.mjs +1 -1
  83. package/dist/{is-command-PvULqiTa.mjs → is-command-C6a7WTPw.mjs} +2 -2
  84. package/dist/{is-command-PvULqiTa.mjs.map → is-command-C6a7WTPw.mjs.map} +1 -1
  85. package/dist/{is-seeder-BN9Ej1r7.mjs → is-seeder-CebjZCDn.mjs} +1 -1
  86. package/dist/{is-seeder-BN9Ej1r7.mjs.map → is-seeder-CebjZCDn.mjs.map} +1 -1
  87. package/dist/logger/index.d.mts +1 -1
  88. package/dist/logger/index.mjs +1 -1
  89. package/dist/{logger-c0ftIK4G.mjs → logger-V6Ms3QnQ.mjs} +38 -20
  90. package/dist/{logger-c0ftIK4G.mjs.map → logger-V6Ms3QnQ.mjs.map} +1 -1
  91. package/dist/macroable/index.d.mts +2 -0
  92. package/dist/macroable/index.mjs +2 -0
  93. package/dist/macroable-BmufBshB.mjs +122 -0
  94. package/dist/macroable-BmufBshB.mjs.map +1 -0
  95. package/dist/module/index.d.mts +2 -2
  96. package/dist/module/index.mjs +1 -1
  97. package/dist/{module-C3YZ-kZN.mjs → module-qGE_1duv.mjs} +31 -18
  98. package/dist/module-qGE_1duv.mjs.map +1 -0
  99. package/dist/openapi/index.d.mts +3 -3
  100. package/dist/openapi/index.mjs +2 -2
  101. package/dist/{openapi-tools.service-B77QXD56.mjs → openapi-tools.service-CYWGuhue.mjs} +4 -1
  102. package/dist/{openapi-tools.service-B77QXD56.mjs.map → openapi-tools.service-CYWGuhue.mjs.map} +1 -1
  103. package/dist/{openapi.service-6yj0BUY4.d.mts → openapi.service-Bv_NioM9.d.mts} +3 -3
  104. package/dist/{openapi.service-6yj0BUY4.d.mts.map → openapi.service-Bv_NioM9.d.mts.map} +1 -1
  105. package/dist/quarry/index.d.mts +7 -7
  106. package/dist/quarry/index.d.mts.map +1 -1
  107. package/dist/quarry/index.mjs +4 -4
  108. package/dist/{quarry-registry-CQCIlYTO.mjs → quarry-registry-DFfRRkA7.mjs} +17 -15
  109. package/dist/quarry-registry-DFfRRkA7.mjs.map +1 -0
  110. package/dist/queue/index.d.mts +2 -2
  111. package/dist/queue/index.mjs +2 -2
  112. package/dist/{queue.module-DIjD6nr-.mjs → queue.module-P-G-nCYz.mjs} +4 -4
  113. package/dist/{queue.module-DIjD6nr-.mjs.map → queue.module-P-G-nCYz.mjs.map} +1 -1
  114. package/dist/r2-storage.provider-LdzK9tfG.mjs +244 -0
  115. package/dist/r2-storage.provider-LdzK9tfG.mjs.map +1 -0
  116. package/dist/{resend.provider-Bvw36rQy.mjs → resend.provider-bwILp0WI.mjs} +2 -2
  117. package/dist/{resend.provider-Bvw36rQy.mjs.map → resend.provider-bwILp0WI.mjs.map} +1 -1
  118. package/dist/router/index.d.mts +2 -2
  119. package/dist/router/index.mjs +7 -5
  120. package/dist/seeder/index.d.mts +3 -3
  121. package/dist/seeder/index.mjs +2 -2
  122. package/dist/{seeder-D7VXULXB.mjs → seeder-BcqIFa2X.mjs} +5 -5
  123. package/dist/{seeder-D7VXULXB.mjs.map → seeder-BcqIFa2X.mjs.map} +1 -1
  124. package/dist/{setup-BRIN-iYT.mjs → setup-CtekcwuO.mjs} +1 -1
  125. package/dist/{setup-BRIN-iYT.mjs.map → setup-CtekcwuO.mjs.map} +1 -1
  126. package/dist/signed-url-COX7cCWR.mjs +74 -0
  127. package/dist/signed-url-COX7cCWR.mjs.map +1 -0
  128. package/dist/{smtp.provider-CAwpvzvD.mjs → smtp.provider-B07yuARi.mjs} +2 -2
  129. package/dist/{smtp.provider-CAwpvzvD.mjs.map → smtp.provider-B07yuARi.mjs.map} +1 -1
  130. package/dist/storage/index.d.mts +39 -17
  131. package/dist/storage/index.d.mts.map +1 -1
  132. package/dist/storage/index.mjs +3 -3
  133. package/dist/storage/providers/index.d.mts +30 -70
  134. package/dist/storage/providers/index.d.mts.map +1 -1
  135. package/dist/storage/providers/index.mjs +2 -2
  136. package/dist/{storage-CJ-QOwNv.mjs → storage-P6X4h9So.mjs} +101 -27
  137. package/dist/storage-P6X4h9So.mjs.map +1 -0
  138. package/dist/{storage-provider.interface-YRtyYBxV.d.mts → storage-provider.interface-CC1nniHk.d.mts} +20 -21
  139. package/dist/storage-provider.interface-CC1nniHk.d.mts.map +1 -0
  140. package/dist/{stratal-B7G4i9-N.mjs → stratal-BCiwCFN9.mjs} +57 -26
  141. package/dist/stratal-BCiwCFN9.mjs.map +1 -0
  142. package/dist/{types-CN0zONAZ.d.mts → types-DIWemRad.d.mts} +1 -1
  143. package/dist/types-DIWemRad.d.mts.map +1 -0
  144. package/dist/{usage-generator-Cl1HPlUp.mjs → usage-generator-MBcRo0Q2.mjs} +2 -2
  145. package/dist/{usage-generator-Cl1HPlUp.mjs.map → usage-generator-MBcRo0Q2.mjs.map} +1 -1
  146. package/dist/{validation-B4bePOa_.mjs → validation-Dbg3ehdP.mjs} +1 -1
  147. package/dist/{validation-B4bePOa_.mjs.map → validation-Dbg3ehdP.mjs.map} +1 -1
  148. package/dist/websocket/index.d.mts +3 -3
  149. package/dist/websocket/index.mjs +1 -1
  150. package/dist/workers/index.d.mts +2 -1
  151. package/dist/workers/index.d.mts.map +1 -1
  152. package/dist/workers/index.mjs +2 -2
  153. package/package.json +27 -39
  154. package/dist/cron-manager-1KnZvojs.mjs.map +0 -1
  155. package/dist/cron-manager-BnEZquBL.d.mts.map +0 -1
  156. package/dist/en-3QnZwP-u.mjs.map +0 -1
  157. package/dist/errors--RBIvDXr.mjs.map +0 -1
  158. package/dist/errors-B7hCnXgB.mjs.map +0 -1
  159. package/dist/gateway-context-BdBFoQd8.mjs.map +0 -1
  160. package/dist/guards-MtDgcHnF.mjs.map +0 -1
  161. package/dist/i18n.module-BpLLLCTg.mjs.map +0 -1
  162. package/dist/index-BrmS34sa.d.mts.map +0 -1
  163. package/dist/index-DPxmo6AY.d.mts.map +0 -1
  164. package/dist/index-Dfpd_ypO.d.mts.map +0 -1
  165. package/dist/module-C3YZ-kZN.mjs.map +0 -1
  166. package/dist/quarry-registry-CQCIlYTO.mjs.map +0 -1
  167. package/dist/s3-storage.provider-BAhHDMI3.mjs +0 -343
  168. package/dist/s3-storage.provider-BAhHDMI3.mjs.map +0 -1
  169. package/dist/storage-CJ-QOwNv.mjs.map +0 -1
  170. package/dist/storage-provider.interface-YRtyYBxV.d.mts.map +0 -1
  171. package/dist/stratal-B7G4i9-N.mjs.map +0 -1
  172. package/dist/types-CN0zONAZ.d.mts.map +0 -1
@@ -1,27 +1,15 @@
1
- import { o as z } from "./index-Dfpd_ypO.mjs";
2
- import { PutObjectCommandInput } from "@aws-sdk/client-s3";
1
+ import { o as z } from "./index-B437eK7p.mjs";
3
2
 
4
3
  //#region src/storage/types.d.ts
5
4
  /**
6
5
  * Storage entry configuration
7
- * Represents a single storage disk with its credentials
6
+ * Represents a single storage disk backed by Cloudflare R2
8
7
  */
9
8
  interface StorageEntry {
10
9
  disk: string;
11
- provider: 's3' | 'gcs';
12
- endpoint: string;
13
- /**
14
- * Base URL for generating presigned/temporary URLs (client-accessible).
15
- * When set, presigned URLs use this host instead of `endpoint`.
16
- * Useful when the S3 API endpoint differs from the client-facing URL.
17
- */
18
- url?: string;
19
- bucket: string;
20
- region: string;
21
- accessKeyId: string;
22
- secretAccessKey: string;
10
+ /** R2Bucket binding name from wrangler.toml */
11
+ binding: string;
23
12
  root: string;
24
- visibility: 'public' | 'private';
25
13
  }
26
14
  /**
27
15
  * Presigned URL configuration
@@ -30,6 +18,15 @@ interface PresignedUrlConfig {
30
18
  defaultExpiry: number;
31
19
  maxExpiry: number;
32
20
  }
21
+ /**
22
+ * Storage route configuration
23
+ */
24
+ interface StorageRouteConfig {
25
+ /** Base path for storage routes. Default: '/storage' */
26
+ basePath?: string;
27
+ /** Disable auto-registered storage routes. Default: false */
28
+ disabled?: boolean;
29
+ }
33
30
  /**
34
31
  * Storage configuration used by framework
35
32
  */
@@ -37,6 +34,8 @@ interface StorageConfig {
37
34
  storage: StorageEntry[];
38
35
  defaultStorageDisk: string;
39
36
  presignedUrl: PresignedUrlConfig;
37
+ /** Config for auto-registered storage routes (presigned URL proxying) */
38
+ route?: StorageRouteConfig;
40
39
  }
41
40
  //#endregion
42
41
  //#region src/storage/contracts/delete-file.input.d.ts
@@ -144,10 +143,10 @@ type UploadResult = z.infer<typeof uploadResultSchema>;
144
143
  //#endregion
145
144
  //#region src/storage/providers/storage-provider.interface.d.ts
146
145
  /**
147
- * Streaming blob payload input types from AWS SDK
148
- * Represents the types that can be used as the Body of a PutObjectCommand
146
+ * Streaming blob payload input types
147
+ * Represents the types that can be used as the body of an upload operation
149
148
  */
150
- type StreamingBlobPayloadInputTypes = PutObjectCommandInput['Body'];
149
+ type StreamingBlobPayloadInputTypes = ReadableStream | ArrayBuffer | ArrayBufferView | string | Blob | null;
151
150
  /**
152
151
  * Storage provider interface
153
152
  * Defines the contract for storage implementations (R2, S3, GCS, etc.)
@@ -199,5 +198,5 @@ interface IStorageProvider {
199
198
  }): Promise<UploadResult>;
200
199
  }
201
200
  //#endregion
202
- export { StorageEntry as _, uploadResultSchema as a, getPresignedUrlInputSchema as c, fileExistsInputSchema as d, DownloadResult as f, StorageConfig as g, PresignedUrlConfig as h, UploadResult as i, presignedUrlResultSchema as l, deleteFileInputSchema as m, StreamingBlobPayloadInputTypes as n, GetPresignedUrlInput as o, DeleteFileInput as p, UploadOptions as r, PresignedUrlResult as s, IStorageProvider as t, FileExistsInput as u };
203
- //# sourceMappingURL=storage-provider.interface-YRtyYBxV.d.mts.map
201
+ export { StorageEntry as _, uploadResultSchema as a, getPresignedUrlInputSchema as c, fileExistsInputSchema as d, DownloadResult as f, StorageConfig as g, PresignedUrlConfig as h, UploadResult as i, presignedUrlResultSchema as l, deleteFileInputSchema as m, StreamingBlobPayloadInputTypes as n, GetPresignedUrlInput as o, DeleteFileInput as p, UploadOptions as r, PresignedUrlResult as s, IStorageProvider as t, FileExistsInput as u, StorageRouteConfig as v };
202
+ //# sourceMappingURL=storage-provider.interface-CC1nniHk.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-provider.interface-CC1nniHk.d.mts","names":[],"sources":["../src/storage/types.ts","../src/storage/contracts/delete-file.input.ts","../src/storage/contracts/download-result.ts","../src/storage/contracts/file-exists.input.ts","../src/storage/contracts/get-presigned-url.input.ts","../src/storage/contracts/upload-file.input.ts","../src/storage/providers/storage-provider.interface.ts"],"mappings":";;;;;;AAIA;UAAiB,YAAA;EAChB,IAAA;EAD4B;EAG5B,OAA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AAML;;;;;AAQA;EMIE,MAAA,CAAO,IAAA,EAAM,8BAAA,EAAgC,IAAA,UAAc,OAAA,EAAS,aAAA,GAAgB,OAAA,CAAQ,YAAA;;;;ANM9F;;EMCE,QAAA,CAAS,IAAA,WAAe,OAAA,CAAQ,cAAA;ENAxB;;;;EMMR,MAAA,CAAO,IAAA,WAAe,OAAA;ENNvB;;;;;EMaC,MAAA,CAAO,IAAA,WAAe,OAAA;ENTf;;;;;;ACnCT;EKqDE,eAAA,CACE,IAAA,UACA,MAAA,qCACA,SAAA,WACC,OAAA,CAAQ,kBAAA;;;;;;;;;EAUX,aAAA,CACE,IAAA,EAAM,8BAAA,EACN,IAAA,UACA,OAAA,EAAS,IAAA,CAAK,aAAA;IAA2B,IAAA;EAAA,IACxC,OAAA,CAAQ,YAAA;AAAA"}
@@ -1,14 +1,14 @@
1
- import { A as Scope, D as runWithContainer, H as ApplicationError, V as ROUTER_TOKENS, g as DefaultExceptionHandler, i as createCronExceptionContext, j as Container, o as createQueueExceptionContext, r as createCliExceptionContext, t as StratalNotInitializedError } from "./errors--RBIvDXr.mjs";
2
- import { a as __decorate, f as DI_TOKENS, i as LoggerService, l as LogLevel, n as PrettyFormatter, o as __decorateParam, r as JsonFormatter, s as __decorateMetadata, t as ConsoleTransport, u as LOGGER_TOKENS } from "./logger-c0ftIK4G.mjs";
3
- import { a as getGroups, i as getGlobalMiddleware, r as getDefaultEntry, t as ModuleRegistry } from "./module-C3YZ-kZN.mjs";
4
- import { r as getListenerHandlers, t as EventRegistry } from "./events-UTJliZhl.mjs";
5
- import { t as Command } from "./command-DjGqCYHv.mjs";
1
+ import { A as Scope, D as runWithContainer, H as ApplicationError, V as ROUTER_TOKENS, g as DefaultExceptionHandler, i as createCronExceptionContext, j as Container, o as createQueueExceptionContext, r as createCliExceptionContext, t as StratalNotInitializedError } from "./errors-B4pYgYON.mjs";
2
+ import { a as __decorate, f as DI_TOKENS, i as LoggerService, n as PrettyFormatter, o as __decorateParam, r as JsonFormatter, s as __decorateMetadata, t as ConsoleTransport, u as LOGGER_TOKENS } from "./logger-V6Ms3QnQ.mjs";
3
+ import { a as getGroups, i as getGlobalMiddleware, r as getDefaultEntry, t as ModuleRegistry } from "./module-qGE_1duv.mjs";
4
+ import { r as getListenerHandlers, t as EventRegistry } from "./events-COKixqnG.mjs";
5
+ import { t as Command } from "./command-BgSlsS4M.mjs";
6
6
  import { CacheModule } from "./cache/index.mjs";
7
- import { t as CronManager } from "./cron-manager-1KnZvojs.mjs";
8
- import { R as OpenAPIModule, c as RouteRegistry, d as HonoApp, f as RouteRegistrationService, i as Uri, l as VersioningService, t as I18nModule, u as LocalePathService } from "./i18n.module-BpLLLCTg.mjs";
9
- import { a as QueueListCommand, c as HelpCommand, d as ApiCommand, i as RouteListCommand, o as McpToolsCommand, r as ScheduleListCommand, s as McpServeCommand, t as QuarryRegistry, u as EventListCommand } from "./quarry-registry-CQCIlYTO.mjs";
10
- import { t as QueueModule } from "./queue.module-DIjD6nr-.mjs";
11
- import { i as SeederRegistry, n as DbSeedListCommand, r as SEEDER_TOKENS, t as DbSeedCommand } from "./seeder-D7VXULXB.mjs";
7
+ import { t as CronManager } from "./cron-manager-C30t9UZM.mjs";
8
+ import { A as OpenAPIModule, c as LocalePathService, i as Uri, l as HonoApp, o as RouteRegistry, s as VersioningService, t as I18nModule, u as RouteRegistrationService } from "./i18n.module-CI_prYFD.mjs";
9
+ import { a as QueueListCommand, c as HelpCommand, d as ApiCommand, i as RouteListCommand, o as McpToolsCommand, r as ScheduleListCommand, s as McpServeCommand, t as QuarryRegistry, u as EventListCommand } from "./quarry-registry-DFfRRkA7.mjs";
10
+ import { t as QueueModule } from "./queue.module-P-G-nCYz.mjs";
11
+ import { i as SeederRegistry, n as DbSeedListCommand, r as SEEDER_TOKENS, t as DbSeedCommand } from "./seeder-BcqIFa2X.mjs";
12
12
  import { container, inject, injectable } from "tsyringe";
13
13
  import "reflect-metadata";
14
14
  import { writeFileSync } from "node:fs";
@@ -45,7 +45,9 @@ let RouteTypesCommand = class RouteTypesCommand extends Command {
45
45
  const optionalMarker = localeOptional ? "?" : "";
46
46
  paramEntries.push(`locale${optionalMarker}: StratalLocale`);
47
47
  }
48
- const paramsType = paramEntries.length === 0 ? "never" : `{ ${paramEntries.join("; ")} }`;
48
+ const indexSignature = localeType && route.localePaths?.length ? "[key: string]: string | StratalLocale | undefined" : "[key: string]: string | undefined";
49
+ paramEntries.push(indexSignature);
50
+ const paramsType = `{ ${paramEntries.join("; ")} }`;
49
51
  return ` '${route.name}': { params: ${paramsType} }`;
50
52
  }).join("\n");
51
53
  const lines = ["// Auto-generated by `quarry route:types` — do not edit manually", "declare module 'stratal/router' {"];
@@ -184,6 +186,8 @@ var Application = class {
184
186
  cronManager;
185
187
  quarry;
186
188
  initialized = false;
189
+ routingInitPromise = null;
190
+ handlerInitPromise = null;
187
191
  env;
188
192
  appConfig;
189
193
  constructor({ env, ctx, ...config }) {
@@ -207,9 +211,14 @@ var Application = class {
207
211
  return this._container;
208
212
  }
209
213
  /**
210
- * Get the HonoApp instance
214
+ * Lazily initialize routing and return the HonoApp instance.
215
+ *
216
+ * Routing (service registration, HonoApp resolution, route configuration)
217
+ * is deferred so that `scheduled` and `queue` handlers don't pay the CPU
218
+ * cost of route setup on cold start.
211
219
  */
212
- get hono() {
220
+ async ensureHono() {
221
+ await this.initializeRouting();
213
222
  return this.honoApp;
214
223
  }
215
224
  /**
@@ -225,7 +234,6 @@ var Application = class {
225
234
  async initializeInternal() {
226
235
  this.moduleRegistry.registerAll([
227
236
  I18nModule,
228
- OpenAPIModule,
229
237
  QueueModule,
230
238
  CacheModule
231
239
  ]);
@@ -235,12 +243,7 @@ var Application = class {
235
243
  this.consumerRegistry = this._container.resolve(DI_TOKENS.ConsumerRegistry);
236
244
  this.cronManager = this._container.resolve(DI_TOKENS.Cron);
237
245
  this.quarry = this._container.resolve(DI_TOKENS.Quarry);
238
- this.registerRoutingServices();
239
- this.honoApp = this._container.resolve(ROUTER_TOKENS.HonoApp);
240
- await this.honoApp.configure();
241
- this.registerQueueConsumers();
242
246
  this.registerCronJobs();
243
- this.registerEventListeners();
244
247
  this.registerSeeders();
245
248
  this.registerCommands();
246
249
  this.initialized = true;
@@ -261,6 +264,32 @@ var Application = class {
261
264
  this._container.register(RouteRegistrationService, RouteRegistrationService);
262
265
  }
263
266
  /**
267
+ * Wire up queue consumers and event listeners.
268
+ * Called lazily on first fetch/queue — not during scheduled handling.
269
+ */
270
+ initializeHandlers() {
271
+ this.handlerInitPromise ??= runWithContainer(this._container, () => {
272
+ this.registerQueueConsumers();
273
+ this.registerEventListeners();
274
+ return Promise.resolve();
275
+ });
276
+ return this.handlerInitPromise;
277
+ }
278
+ /**
279
+ * Register routing services, resolve HonoApp, and configure routes.
280
+ * Called lazily on first fetch — not during scheduled/queue handling.
281
+ */
282
+ initializeRouting() {
283
+ this.routingInitPromise ??= runWithContainer(this._container, async () => {
284
+ await this.initializeHandlers();
285
+ this.moduleRegistry.register(OpenAPIModule);
286
+ this.registerRoutingServices();
287
+ this.honoApp = this._container.resolve(ROUTER_TOKENS.HonoApp);
288
+ await this.honoApp.configure();
289
+ });
290
+ return this.routingInitPromise;
291
+ }
292
+ /**
264
293
  * Resolve a service from the container
265
294
  */
266
295
  resolve(token) {
@@ -277,6 +306,7 @@ var Application = class {
277
306
  * Handle queue batch processing
278
307
  */
279
308
  async handleQueue(batch, queueName) {
309
+ await this.initializeHandlers();
280
310
  const locale = (batch.messages[0]?.body)?.metadata?.locale ?? "en";
281
311
  const mockRouterContext = this.createMockRouterContext(locale);
282
312
  await this._container.runInRequestScope(mockRouterContext, async (requestContainer) => {
@@ -295,7 +325,7 @@ var Application = class {
295
325
  const mockRouterContext = this.createMockRouterContext("en");
296
326
  await this._container.runInRequestScope(mockRouterContext, async (requestContainer) => {
297
327
  try {
298
- await this.cronManager.executeScheduled(controller);
328
+ await this.cronManager.executeScheduled(controller, requestContainer);
299
329
  } catch (error) {
300
330
  await requestContainer.resolve(DI_TOKENS.ExceptionHandler).handle(error, createCronExceptionContext());
301
331
  throw error;
@@ -323,6 +353,7 @@ var Application = class {
323
353
  * Execute a command by name in a request-scoped container.
324
354
  */
325
355
  async handleCommand(name, input) {
356
+ await this.initializeRouting();
326
357
  const mockContext = this.createMockRouterContext("en");
327
358
  return this._container.runInRequestScope(mockContext, async () => {
328
359
  return this.quarry.call(name, input);
@@ -365,8 +396,8 @@ var Application = class {
365
396
  }
366
397
  registerCronJobs() {
367
398
  for (const JobClass of this.moduleRegistry.getAllJobs()) {
368
- const job = this._container.resolve(JobClass);
369
- this.cronManager.registerJob(job);
399
+ const tempJob = this._container.resolve(JobClass);
400
+ this.cronManager.registerJob(tempJob.schedule, JobClass);
370
401
  }
371
402
  }
372
403
  /**
@@ -386,7 +417,7 @@ var Application = class {
386
417
  * Register LoggerService and dependencies
387
418
  */
388
419
  registerLoggerService() {
389
- const logLevel = this.appConfig.logging?.level ?? LogLevel.INFO;
420
+ const logLevel = this.appConfig.logging?.level ?? "info";
390
421
  const formatter = this.appConfig.logging?.formatter ?? "json";
391
422
  this._container.registerValue(LOGGER_TOKENS.LogLevelOptions, logLevel);
392
423
  this._container.when(() => formatter === "pretty").use(LOGGER_TOKENS.Formatter).give(PrettyFormatter).otherwise(JsonFormatter);
@@ -446,7 +477,7 @@ var Stratal = class Stratal {
446
477
  Stratal._application = this.initPromise;
447
478
  }
448
479
  async fetch(request, env, ctx) {
449
- return (await this.ensureReady()).hono.fetch(request, env, ctx);
480
+ return (await (await this.ensureReady()).ensureHono()).fetch(request, env, ctx);
450
481
  }
451
482
  async queue(batch) {
452
483
  return (await this.ensureReady()).handleQueue(batch, batch.queue);
@@ -455,7 +486,7 @@ var Stratal = class Stratal {
455
486
  return (await this.ensureReady()).handleScheduled(controller);
456
487
  }
457
488
  get hono() {
458
- return this.initPromise.then((app) => app.hono);
489
+ return this.initPromise.then((app) => app.ensureHono());
459
490
  }
460
491
  async shutdown() {
461
492
  try {
@@ -499,4 +530,4 @@ var Stratal = class Stratal {
499
530
  //#endregion
500
531
  export { Application as n, Stratal as t };
501
532
 
502
- //# sourceMappingURL=stratal-B7G4i9-N.mjs.map
533
+ //# sourceMappingURL=stratal-BCiwCFN9.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stratal-BCiwCFN9.mjs","names":["internal.getGroups","internal.getDefaultEntry","internal.getGlobalMiddleware","tsyringeRootContainer"],"sources":["../src/quarry/commands/route-types.command.ts","../src/router/router-resolver.ts","../src/application.ts","../src/stratal.ts"],"sourcesContent":["import { writeFileSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport { inject } from 'tsyringe'\nimport type { RouteRegistry, RegisteredRoute } from '../../router/route-registry'\nimport { ROUTER_TOKENS } from '../../router/router.tokens'\nimport type { LocalePathService } from '../../router/services/locale-path.service'\nimport { Command } from '../command'\n\n/**\n * Generate TypeScript types for named routes.\n *\n * Outputs a `stratal.d.ts` file with `StratalRouteMap` augmentation\n * that provides autocomplete and type-safe params for `route()` and `ctx.route()`.\n *\n * @example\n * ```bash\n * quarry route:types # → src/stratal.d.ts\n * quarry route:types --output=types/routes.d.ts\n * ```\n */\nexport class RouteTypesCommand extends Command {\n static command = 'route:types {--output=src/stratal.d.ts : Output file path}'\n static description = 'Generate TypeScript types for named routes'\n\n constructor(\n @inject(ROUTER_TOKENS.RouteRegistry) private registry: RouteRegistry,\n @inject(ROUTER_TOKENS.LocalePathService) private localePathService: LocalePathService,\n ) {\n super()\n }\n\n handle(): number | undefined {\n const outputPath = resolve(this.string('output') || 'src/stratal.d.ts')\n const namedRoutes = this.registry.named()\n\n if (namedRoutes.length === 0) {\n this.warn('No named routes found. Add name to your @Route() or @Get()/@Post() decorators.')\n return 0\n }\n\n const content = this.generateDeclaration(namedRoutes)\n writeFileSync(outputPath, content, 'utf-8')\n this.info(`Generated route types for ${namedRoutes.length} named routes → ${outputPath}`)\n\n return undefined\n }\n\n /**\n * Generate the StratalRouteMap declaration content.\n */\n private generateDeclaration(routes: RegisteredRoute[]): string {\n const localeConfig = this.localePathService.enabled ? this.localePathService.localePathConfig : null\n const localeType = localeConfig\n ? localeConfig.allLocales.map(l => `'${l}'`).join(' | ')\n : null\n const localeOptional = localeConfig ? this.localePathService.prefixDefaultLocale !== true : false\n\n const entries = routes\n .filter((r): r is RegisteredRoute & { name: string } => r.name !== undefined)\n .sort((a, b) => a.name.localeCompare(b.name))\n .map(route => {\n const paramEntries = [\n ...route.paramNames.map(p => `${p}: string`),\n ...route.domainParamNames.map(p => `${p}: string`),\n ]\n\n if (localeType && route.localePaths?.length) {\n const optionalMarker = localeOptional ? '?' : ''\n paramEntries.push(`locale${optionalMarker}: StratalLocale`)\n }\n\n // Extra keys become query-string params at runtime, so allow any\n // string key. Typed path/domain params above still take precedence.\n const indexSignature = localeType && route.localePaths?.length\n ? '[key: string]: string | StratalLocale | undefined'\n : '[key: string]: string | undefined'\n paramEntries.push(indexSignature)\n\n const paramsType = `{ ${paramEntries.join('; ')} }`\n return ` '${route.name}': { params: ${paramsType} }`\n })\n .join('\\n')\n\n const lines = [\n '// Auto-generated by `quarry route:types` — do not edit manually',\n \"declare module 'stratal/router' {\",\n ]\n\n if (localeType) {\n lines.push(` type StratalLocale = ${localeType}`)\n lines.push('')\n }\n\n lines.push(\n ' interface StratalRouteMap {',\n entries,\n ' }',\n '}',\n )\n\n return [\n ...lines,\n '',\n 'export {}',\n '',\n ].join('\\n')\n }\n}\n","import type { ZodObject } from '../i18n/validation'\nimport type { Constructor } from '../types'\nimport type { Middleware } from './middleware.interface'\nimport type { Router, RouterEntry } from './router'\nimport * as internal from './router.internals'\n\n/**\n * Resolved configuration for a single controller.\n * Merges Router default entry, sub-group overrides, and inheritance rules.\n */\nexport interface ResolvedRouterConfig {\n prefix?: string\n domain?: string\n name?: string\n middleware: Constructor<Middleware>[]\n version?: string | string[]\n hideFromDocs?: boolean\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- ZodObject generics require any for flexible shape parameter\n params?: ZodObject<any>\n}\n\n/**\n * Internal resolver that computes the effective Router config for each controller.\n *\n * Inheritance rules:\n * - `middleware`: parent middleware runs first, then child (concatenated)\n * - `prefix`: concatenated (parent + child)\n * - `name`: concatenated (parent + child)\n * - `domain`: child overrides parent\n * - `version`: child overrides parent\n * - `hideFromDocs`: child overrides parent\n *\n * @internal — not exported from stratal/router\n */\nexport class RouterResolver {\n private readonly routers: { router: Router; controllers: Constructor[] }[]\n\n constructor(routers: { router: Router; controllers: Constructor[] }[]) {\n this.routers = routers\n }\n\n /**\n * Resolve the effective config for a given controller class.\n * Searches through all module routers to find the one owning this controller.\n */\n resolveForController(controller: Constructor): ResolvedRouterConfig {\n for (const { router, controllers: moduleControllers } of this.routers) {\n if (!moduleControllers.includes(controller)) continue\n\n // Check if controller is in a sub-group\n for (const group of router[internal.getGroups]()) {\n if (group.controllers?.includes(controller)) {\n return this.mergeEntries(router[internal.getDefaultEntry](), group)\n }\n }\n\n // Controller is in the default scope (not in any sub-group)\n // But only if it's not claimed by any sub-group in this module\n const groupedControllers = new Set(\n router[internal.getGroups]().flatMap(g => g.controllers ?? [])\n )\n if (!groupedControllers.has(controller)) {\n return this.entryToConfig(router[internal.getDefaultEntry]())\n }\n }\n\n // Controller not found in any module's router — return empty config\n return { middleware: [] }\n }\n\n /**\n * Collect all global middleware registered via `router.use()` across all modules.\n */\n getGlobalMiddleware(): Constructor<Middleware>[] {\n const global: Constructor<Middleware>[] = []\n for (const { router } of this.routers) {\n global.push(...router[internal.getGlobalMiddleware]())\n }\n return global\n }\n\n /**\n * Merge parent default entry with child group entry following inheritance rules.\n */\n private mergeEntries(parent: RouterEntry, child: RouterEntry): ResolvedRouterConfig {\n return {\n // Concatenate: parent prefix + child prefix\n prefix: this.concatPrefixes(parent.prefix, child.prefix),\n // Override: child domain wins\n domain: child.domain ?? parent.domain,\n // Concatenate: parent name + child name\n name: this.concatNames(parent.name, child.name),\n // Concatenate: parent middleware first, then child\n middleware: [...parent.middleware, ...child.middleware],\n // Override: child version wins\n version: child.version ?? parent.version,\n // Override: child hideFromDocs wins\n hideFromDocs: child.hideFromDocs ?? parent.hideFromDocs,\n // Extend: parent params extended with child params\n params: this.mergeParams(parent.params, child.params),\n }\n }\n\n private entryToConfig(entry: RouterEntry): ResolvedRouterConfig {\n return {\n prefix: entry.prefix,\n domain: entry.domain,\n name: entry.name,\n middleware: [...entry.middleware],\n version: entry.version,\n hideFromDocs: entry.hideFromDocs,\n params: entry.params,\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- ZodObject generics require any for flexible shape parameter\n private mergeParams(parent?: ZodObject<any>, child?: ZodObject<any>): ZodObject<any> | undefined {\n if (!parent && !child) return undefined\n if (!parent) return child\n if (!child) return parent\n // oxlint-disable-next-line typescript/no-explicit-any\n return parent.extend(child.shape) as ZodObject<any>\n }\n\n private concatPrefixes(parent?: string, child?: string): string | undefined {\n if (!parent && !child) return undefined\n if (!parent) return child\n if (!child) return parent\n // Normalize: remove trailing slash from parent, ensure child starts with /\n const p = parent.endsWith('/') ? parent.slice(0, -1) : parent\n const c = child.startsWith('/') ? child : `/${child}`\n return `${p}${c}`\n }\n\n private concatNames(parent?: string, child?: string): string | undefined {\n if (!parent && !child) return undefined\n if (!parent) return child\n if (!child) return parent\n return `${parent}${child}`\n }\n}\n","import { injectable, container as tsyringeRootContainer } from 'tsyringe'\nimport { CacheModule } from './cache'\nimport type { CronJob } from './cron/cron-job'\nimport { CronManager } from './cron/cron-manager'\nimport { Container } from './di/container'\nimport { runWithContainer } from './di/container-storage'\nimport { DI_TOKENS } from './di/tokens'\nimport { Scope } from './di/types'\nimport { type StratalEnv } from './env'\nimport { ApplicationError } from './errors'\nimport { DefaultExceptionHandler } from './errors/default-exception-handler'\nimport { createCliExceptionContext, createCronExceptionContext, createQueueExceptionContext } from './errors/exception-context'\nimport type { ExceptionHandler } from './errors/exception-handler'\nimport type { EventHandler } from './events'\nimport { EventRegistry, getListenerHandlers } from './events'\nimport type { StratalExecutionContext } from './execution-context'\nimport { I18nModule } from './i18n/i18n.module'\nimport { ConsoleTransport, JsonFormatter, LOGGER_TOKENS, LoggerService, LogLevel, PrettyFormatter } from './logger'\nimport { ModuleRegistry } from './module/module-registry'\nimport type { DynamicModule, ModuleClass } from './module/types'\nimport { OpenAPIModule } from './openapi'\nimport type { Command } from './quarry/command'\nimport { ApiCommand } from './quarry/commands/api.command'\nimport { EventListCommand } from './quarry/commands/event-list.command'\nimport { HelpCommand } from './quarry/commands/help.command'\nimport { McpServeCommand } from './quarry/commands/mcp-serve.command'\nimport { McpToolsCommand } from './quarry/commands/mcp-tools.command'\nimport { QueueListCommand } from './quarry/commands/queue-list.command'\nimport { RouteListCommand } from './quarry/commands/route-list.command'\nimport { RouteTypesCommand } from './quarry/commands/route-types.command'\nimport { ScheduleListCommand } from './quarry/commands/schedule-list.command'\nimport { QuarryRegistry } from './quarry/quarry-registry'\nimport type { CommandInput, CommandResult } from './quarry/types'\nimport { type ConsumerRegistry } from './queue/consumer-registry'\nimport type { IQueueConsumer, QueueMessage } from './queue/queue-consumer'\nimport { type QueueManager } from './queue/queue-manager'\nimport { QueueModule } from './queue/queue.module'\nimport { type RouterContext } from './router'\nimport { HonoApp } from './router/hono-app'\nimport { RouteRegistry } from './router/route-registry'\nimport { RouterResolver } from './router/router-resolver'\nimport { ROUTER_TOKENS } from './router/router.tokens'\nimport { LocalePathService } from './router/services/locale-path.service'\nimport { RouteRegistrationService } from './router/services/route-registration.service'\nimport { VersioningService } from './router/services/versioning.service'\nimport type { VersioningOptions } from './router/types'\nimport { Uri } from './router/uri'\nimport { DbSeedCommand, DbSeedListCommand, SEEDER_TOKENS, SeederRegistry, type Seeder } from './seeder'\nimport type { Constructor } from './types'\n\nexport interface ApplicationConfig {\n /** Root application module */\n module: ModuleClass | DynamicModule\n /** Logging configuration. Defaults: level=INFO, formatter='json' */\n logging?: {\n level?: LogLevel\n formatter?: 'json' | 'pretty'\n }\n /**\n * API versioning configuration.\n * When provided, enables URI-based versioning for controllers.\n */\n versioning?: VersioningOptions\n /**\n * Custom exception handler class.\n *\n * Extend {@link ExceptionHandler} and override `register()` to configure\n * custom reporting, rendering, and post-processing of exceptions.\n *\n * When not provided, {@link DefaultExceptionHandler} is used (standard\n * severity-based logging and JSON error responses).\n *\n * @example\n * ```typescript\n * new Stratal({\n * module: AppModule,\n * exceptionHandler: AppExceptionHandler,\n * })\n * ```\n */\n exceptionHandler?: Constructor<ExceptionHandler>\n}\n\nexport interface ApplicationOptions extends ApplicationConfig {\n env: StratalEnv\n ctx: StratalExecutionContext\n}\n\n/**\n * Application\n *\n * Main application class managing the two-tier container hierarchy:\n * - Global Container: All services (singletons via tsyringe native)\n * - Request Container: Child of global, context-enriched instances per request\n *\n * @example\n * ```typescript\n * const app = new Application({ module: AppModule, env, ctx })\n * await app.initialize()\n *\n * // Access container via getter\n * const service = app.container.resolve(MY_TOKEN)\n *\n * // Handle HTTP request (via HonoApp)\n * // Handle queue batch\n * await app.handleQueue(batch, 'my-queue')\n * ```\n */\nexport class Application {\n /**\n * Unified Container - manages all DI operations\n */\n private _container: Container\n\n private honoApp!: HonoApp\n private moduleRegistry: ModuleRegistry\n private consumerRegistry!: ConsumerRegistry\n private cronManager!: CronManager\n private quarry!: QuarryRegistry\n private initialized = false\n private routingInitPromise: Promise<void> | null = null\n private handlerInitPromise: Promise<void> | null = null\n\n readonly env: StratalEnv\n private readonly appConfig: ApplicationConfig\n\n constructor({ env, ctx, ...config }: ApplicationOptions) {\n this.env = env\n this.appConfig = config\n\n ApplicationError.captureStackTraces = env.ENVIRONMENT !== 'production'\n\n // Create unified Container with explicit child container\n this._container = new Container({\n container: tsyringeRootContainer.createChildContainer()\n })\n\n // Register globally — env and ctx always available\n this._container.registerValue(DI_TOKENS.Application, this)\n this._container.registerValue(DI_TOKENS.CloudflareEnv, env)\n this._container.registerValue(DI_TOKENS.ExecutionContext, ctx)\n\n // Register core infrastructure inline\n this.registerLoggerService()\n this.registerCoreServices()\n\n // Create ModuleRegistry with our Container\n const logger = this._container.resolve<LoggerService>(LOGGER_TOKENS.LoggerService)\n this.moduleRegistry = new ModuleRegistry(this._container, logger)\n\n // Register ModuleRegistry in container so modules can access it in onInitialize\n this._container.registerValue(DI_TOKENS.ModuleRegistry, this.moduleRegistry)\n }\n\n /**\n * Get the Container instance\n */\n get container(): Container {\n return this._container\n }\n\n /**\n * Lazily initialize routing and return the HonoApp instance.\n *\n * Routing (service registration, HonoApp resolution, route configuration)\n * is deferred so that `scheduled` and `queue` handlers don't pay the CPU\n * cost of route setup on cold start.\n */\n async ensureHono(): Promise<HonoApp> {\n await this.initializeRouting()\n return this.honoApp\n }\n\n /**\n * Get the application configuration\n */\n get config(): ApplicationConfig {\n return this.appConfig\n }\n\n async initialize(): Promise<void> {\n if (this.initialized) {\n return\n }\n\n // Wrap in AsyncLocalStorage so getContainer() works for route() and other standalone functions\n await runWithContainer(this._container, () => this.initializeInternal())\n }\n\n private async initializeInternal(): Promise<void> {\n // Phase 1: Register core infrastructure modules (internal)\n // OpenAPIModule is deferred to initializeRouting() (only needed for fetch)\n this.moduleRegistry.registerAll([\n I18nModule,\n QueueModule,\n CacheModule,\n ])\n\n // Phase 2: Register user's root module (traverses imports)\n this.moduleRegistry.register(this.appConfig.module)\n\n // Phase 3: Initialize all modules\n await this.moduleRegistry.initialize()\n\n // Phase 3.5: Initialize ExceptionHandler and call module onException hooks\n this.initializeExceptionHandler()\n\n // Phase 4: Resolve managers from container\n this.consumerRegistry = this._container.resolve<ConsumerRegistry>(DI_TOKENS.ConsumerRegistry)\n this.cronManager = this._container.resolve<CronManager>(DI_TOKENS.Cron)\n this.quarry = this._container.resolve<QuarryRegistry>(DI_TOKENS.Quarry)\n\n // Phase 5: Register cron jobs, seeders, and commands (cheap — stores class refs)\n // Queue consumers and event listeners are deferred (they resolve instances\n // from the container, which is expensive). Routing is also deferred.\n this.registerCronJobs()\n this.registerSeeders()\n this.registerCommands()\n\n this.initialized = true\n }\n\n /**\n * Register routing services as singletons in the container.\n * Called after module initialization so I18N_TOKENS.Options is available.\n */\n private registerRoutingServices(): void {\n // VersioningService — resolves version prefixes from appConfig.versioning\n this._container.register(ROUTER_TOKENS.VersioningService, VersioningService, Scope.Singleton)\n\n // HonoApp — the Hono application instance (must be before LocalePathService)\n this._container.register(ROUTER_TOKENS.HonoApp, HonoApp, Scope.Singleton)\n\n // LocalePathService — computes LocalePathConfig and applies locale middleware to HonoApp\n this._container.register(ROUTER_TOKENS.LocalePathService, LocalePathService, Scope.Singleton)\n\n // RouteRegistry — single source of truth, expands routes via services above\n this._container.register(ROUTER_TOKENS.RouteRegistry, RouteRegistry, Scope.Singleton)\n\n // Uri — URL generation service (request-scoped for access to RouterContext)\n this._container.register(ROUTER_TOKENS.Uri, Uri, Scope.Request)\n\n // RouterResolver — merges Router configs from modules\n const routerConfigs = this.moduleRegistry.getAllRouterConfigs()\n const routerResolver = routerConfigs.length > 0 ? new RouterResolver(routerConfigs) : null\n this._container.registerValue(ROUTER_TOKENS.RouterResolver, routerResolver)\n\n // RouteRegistrationService — transient, resolved in HonoApp.configure()\n this._container.register(RouteRegistrationService, RouteRegistrationService)\n }\n\n /**\n * Wire up queue consumers and event listeners.\n * Called lazily on first fetch/queue — not during scheduled handling.\n */\n private initializeHandlers(): Promise<void> {\n this.handlerInitPromise ??= runWithContainer(this._container, () => {\n this.registerQueueConsumers()\n this.registerEventListeners()\n return Promise.resolve()\n })\n return this.handlerInitPromise\n }\n\n /**\n * Register routing services, resolve HonoApp, and configure routes.\n * Called lazily on first fetch — not during scheduled/queue handling.\n */\n private initializeRouting(): Promise<void> {\n this.routingInitPromise ??= runWithContainer(this._container, async () => {\n await this.initializeHandlers()\n this.moduleRegistry.register(OpenAPIModule as unknown as ModuleClass)\n this.registerRoutingServices()\n this.honoApp = this._container.resolve<HonoApp>(ROUTER_TOKENS.HonoApp)\n await this.honoApp.configure()\n })\n return this.routingInitPromise\n }\n\n /**\n * Resolve a service from the container\n */\n resolve<T>(token: symbol): T {\n try {\n return this._container.resolve(token)\n } catch (error) {\n const handler = this._container.resolve<ExceptionHandler>(DI_TOKENS.ExceptionHandler)\n const ctx = createCliExceptionContext('resolve')\n // Fire-and-forget — reporting happens via waitUntil internally\n void handler.handle(error, ctx)\n throw error\n }\n }\n\n /**\n * Handle queue batch processing\n */\n async handleQueue(batch: MessageBatch, queueName: string): Promise<void> {\n await this.initializeHandlers()\n\n const firstMessage = batch.messages[0]?.body as QueueMessage | undefined\n const locale = firstMessage?.metadata?.locale ?? 'en'\n const mockRouterContext = this.createMockRouterContext(locale)\n\n await this._container.runInRequestScope(mockRouterContext, async (requestContainer) => {\n try {\n const queueManager = requestContainer.resolve<QueueManager>(DI_TOKENS.Queue)\n await queueManager.processBatch(queueName, batch)\n } catch (error) {\n const handler = requestContainer.resolve<ExceptionHandler>(DI_TOKENS.ExceptionHandler)\n await handler.handle(error, createQueueExceptionContext(queueName))\n throw error\n }\n })\n }\n\n /**\n * Handle scheduled cron trigger\n */\n async handleScheduled(controller: ScheduledController): Promise<void> {\n const mockRouterContext = this.createMockRouterContext('en')\n\n await this._container.runInRequestScope(mockRouterContext, async (requestContainer) => {\n try {\n await this.cronManager.executeScheduled(controller, requestContainer)\n } catch (error) {\n const handler = requestContainer.resolve<ExceptionHandler>(DI_TOKENS.ExceptionHandler)\n await handler.handle(error, createCronExceptionContext())\n throw error\n }\n })\n }\n\n /**\n * Create mock RouterContext for queue/cron/seeder processing\n */\n createMockRouterContext(locale = 'en'): RouterContext {\n return {\n getLocale: () => locale,\n setLocale: () => { /* no-op */ },\n getContainer: () => this._container,\n } as unknown as RouterContext\n }\n\n async shutdown(): Promise<void> {\n if (!this.initialized) return\n this.initialized = false\n\n await this.moduleRegistry.shutdown()\n\n const logger = this._container.resolve<LoggerService>(LOGGER_TOKENS.LoggerService)\n logger.info('Disposing container...')\n\n await this._container.dispose()\n }\n\n /**\n * Execute a command by name in a request-scoped container.\n */\n async handleCommand(name: string, input?: CommandInput): Promise<CommandResult> {\n await this.initializeRouting()\n const mockContext = this.createMockRouterContext('en')\n return this._container.runInRequestScope(mockContext, async () => {\n return this.quarry.call(name, input)\n })\n }\n\n private registerCommands(): void {\n // Built-in commands (always available)\n const builtinCommands: Constructor<Command>[] = [\n HelpCommand,\n DbSeedCommand, DbSeedListCommand,\n RouteListCommand, RouteTypesCommand, EventListCommand,\n ScheduleListCommand, QueueListCommand,\n McpServeCommand, McpToolsCommand, ApiCommand,\n ]\n for (const Cmd of builtinCommands) {\n injectable()(Cmd)\n this._container.register(Cmd, Cmd, Scope.Singleton)\n this.quarry.register(Cmd)\n }\n\n // User commands from modules\n const commands = this.moduleRegistry.getAllCommands()\n if (commands.length === 0) {\n return\n }\n\n for (const CommandClass of commands) {\n this.quarry.register(CommandClass as Constructor<Command>)\n }\n }\n\n private registerSeeders(): void {\n const seeders = this.moduleRegistry.getAllSeeders()\n if (seeders.length === 0) return\n const registry = this._container.resolve<SeederRegistry>(SEEDER_TOKENS.SeederRegistry)\n for (const SeederClass of seeders) {\n registry.register(SeederClass as Constructor<Seeder>)\n }\n }\n\n private registerQueueConsumers(): void {\n for (const ConsumerClass of this.moduleRegistry.getAllConsumers()) {\n const consumer = this._container.resolve(ConsumerClass) as IQueueConsumer\n this.consumerRegistry.register(consumer)\n }\n }\n\n private registerCronJobs(): void {\n for (const JobClass of this.moduleRegistry.getAllJobs()) {\n // Resolve temporarily to read the schedule property.\n // The delay() proxy on DB dependencies is created but never triggered\n // since we only access the schedule string.\n const tempJob = this._container.resolve(JobClass) as CronJob\n this.cronManager.registerJob(tempJob.schedule, JobClass as Constructor<CronJob>)\n }\n }\n\n /**\n * Auto-wire `@Listener()` classes with the EventRegistry.\n */\n private registerEventListeners(): void {\n const listeners = this.moduleRegistry.getAllListeners()\n if (listeners.length === 0) {\n return\n }\n\n const eventRegistry = this._container.resolve<EventRegistry>(DI_TOKENS.EventRegistry)\n\n for (const ListenerClass of listeners) {\n const instance = this._container.resolve(ListenerClass) as Record<string, ((...args: unknown[]) => unknown)>\n const handlers = getListenerHandlers(ListenerClass)\n\n for (const { methodName, event, options } of handlers) {\n eventRegistry.on(event, instance[methodName].bind(instance) as EventHandler, options)\n }\n }\n }\n\n /**\n * Register LoggerService and dependencies\n */\n private registerLoggerService(): void {\n const logLevel = this.appConfig.logging?.level ?? LogLevel.INFO\n const formatter = this.appConfig.logging?.formatter ?? 'json'\n\n this._container.registerValue(LOGGER_TOKENS.LogLevelOptions, logLevel)\n\n this._container\n .when(() => formatter === 'pretty')\n .use(LOGGER_TOKENS.Formatter)\n .give(PrettyFormatter)\n .otherwise(JsonFormatter)\n\n this._container.registerSingleton(LOGGER_TOKENS.ConsoleTransport, ConsoleTransport)\n this._container.registerFactory(LOGGER_TOKENS.Transports, (c) => [c.resolve(LOGGER_TOKENS.ConsoleTransport)])\n this._container.registerSingleton(LOGGER_TOKENS.LoggerService, LoggerService)\n }\n\n /**\n * Register core services with explicit scope\n */\n private registerCoreServices(): void {\n this._container.registerSingleton(DI_TOKENS.Cron, CronManager)\n this._container.registerSingleton(\n DI_TOKENS.ExceptionHandler,\n (this.appConfig.exceptionHandler ?? DefaultExceptionHandler) as Constructor,\n )\n this._container.registerSingleton(DI_TOKENS.EventRegistry, EventRegistry)\n this._container.registerSingleton(DI_TOKENS.Quarry, QuarryRegistry)\n this._container.registerValue(SEEDER_TOKENS.SeederRegistry, new SeederRegistry(this))\n }\n\n /**\n * Initialize the ExceptionHandler: call register(), then module onException hooks.\n */\n private initializeExceptionHandler(): void {\n const handler = this._container.resolve<ExceptionHandler>(DI_TOKENS.ExceptionHandler)\n handler.register()\n this.moduleRegistry.configureExceptionHandlers(handler)\n }\n}\n","import 'reflect-metadata'\n\nimport { Application, type ApplicationConfig } from './application'\nimport type { StratalEnv } from './env'\nimport { StratalNotInitializedError } from './errors'\nimport type { HonoApp } from './router/hono-app'\n\n/**\n * Stratal — Hono-style entry point for Cloudflare Workers.\n *\n * Eagerly bootstraps the Application at construction time, dynamically\n * importing `cloudflare:workers` for env and waitUntil.\n *\n * @example\n * ```typescript\n * import { Stratal } from 'stratal'\n * import { AppModule } from './app.module'\n *\n * export default new Stratal({ module: AppModule })\n * ```\n */\nexport class Stratal<Env extends StratalEnv = StratalEnv> {\n private app: Application | null = null\n private initPromise: Promise<Application>\n\n private static _application: Promise<Application> | null = null\n private static _generation = 0\n private static _previousInstance: Stratal | null = null\n\n constructor(config: ApplicationConfig) {\n this.fetch = this.fetch.bind(this)\n this.queue = this.queue.bind(this)\n this.scheduled = this.scheduled.bind(this)\n\n // Invalidate any in-flight initialization from a previous instance (Vite HMR reload)\n const generation = ++Stratal._generation\n\n if (Stratal._previousInstance) {\n void Stratal._previousInstance.shutdown()\n }\n Stratal._previousInstance = this\n\n this.initPromise = this.prepareApp(config, generation)\n Stratal._application = this.initPromise\n }\n\n async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {\n const app = await this.ensureReady()\n const hono = await app.ensureHono()\n return hono.fetch(request, env, ctx)\n }\n\n async queue(batch: MessageBatch): Promise<void> {\n const app = await this.ensureReady()\n return app.handleQueue(batch, batch.queue)\n }\n\n async scheduled(controller: ScheduledController): Promise<void> {\n const app = await this.ensureReady()\n return app.handleScheduled(controller)\n }\n\n get hono(): Promise<HonoApp> {\n return this.initPromise.then(app => app.ensureHono())\n }\n\n async shutdown(): Promise<void> {\n try { this.app = await this.initPromise } catch { /* ignore */ }\n if (this.app) {\n await this.app.shutdown()\n this.app = null\n }\n }\n\n /**\n * @internal\n * Resolves the Application instance from the static singleton.\n * Used by worker base classes (DurableObject, Workflow, WorkerEntrypoint)\n * to access the DI container without going through Cloudflare RPC.\n */\n static resolveApplication(): Promise<Application> {\n if (!Stratal._application) {\n throw new StratalNotInitializedError()\n }\n return Stratal._application\n }\n\n private async ensureReady(): Promise<Application> {\n this.app ??= await this.initPromise;\n return this.app\n }\n\n private async prepareApp(config: ApplicationConfig, generation: number): Promise<Application> {\n const { env, waitUntil } = await import('cloudflare:workers')\n\n // After async import, check if a newer instance has replaced us (Vite HMR reload)\n if (generation !== Stratal._generation) {\n return new Promise<Application>(() => {\n //\n }) // Never resolves — avoids cross-request promise warning\n }\n\n const app = new Application({ ...config, env: env as Env, ctx: { waitUntil } })\n await app.initialize()\n\n // Check again after initialization completes\n if (generation !== Stratal._generation) {\n await app.shutdown()\n return new Promise<Application>(() => {\n //\n })\n }\n\n return app\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAoBO,IAAA,oBAAA,MAAM,0BAA0B,QAAQ;CAC7C,OAAO,UAAU;CACjB,OAAO,cAAc;CAErB,YACE,UACA,mBACA;AACA,SAAO;AAHsC,OAAA,WAAA;AACI,OAAA,oBAAA;;CAKnD,SAA6B;EAC3B,MAAM,aAAa,QAAQ,KAAK,OAAO,SAAS,IAAI,mBAAmB;EACvE,MAAM,cAAc,KAAK,SAAS,OAAO;AAEzC,MAAI,YAAY,WAAW,GAAG;AAC5B,QAAK,KAAK,iFAAiF;AAC3F,UAAO;;AAIT,gBAAc,YADE,KAAK,oBAAoB,YACR,EAAE,QAAQ;AAC3C,OAAK,KAAK,6BAA6B,YAAY,OAAO,kBAAkB,aAAa;;;;;CAQ3F,oBAA4B,QAAmC;EAC7D,MAAM,eAAe,KAAK,kBAAkB,UAAU,KAAK,kBAAkB,mBAAmB;EAChG,MAAM,aAAa,eACf,aAAa,WAAW,KAAI,MAAK,IAAI,EAAE,GAAG,CAAC,KAAK,MAAM,GACtD;EACJ,MAAM,iBAAiB,eAAe,KAAK,kBAAkB,wBAAwB,OAAO;EAE5F,MAAM,UAAU,OACb,QAAQ,MAA+C,EAAE,SAAS,KAAA,EAAU,CAC5E,MAAM,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,KAAK,CAAC,CAC5C,KAAI,UAAS;GACZ,MAAM,eAAe,CACnB,GAAG,MAAM,WAAW,KAAI,MAAK,GAAG,EAAE,UAAU,EAC5C,GAAG,MAAM,iBAAiB,KAAI,MAAK,GAAG,EAAE,UAAU,CACnD;AAED,OAAI,cAAc,MAAM,aAAa,QAAQ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,aAAa,EACb,YAAY,EACvB,MAAM,SAAS,KAAK,IAAI;;CAGtC,MAAM,MAAM,OAAoC;AAE9C,UAAO,MADW,KAAK,aAAa,EACzB,YAAY,OAAO,MAAM,MAAM;;CAG5C,MAAM,UAAU,YAAgD;AAE9D,UAAO,MADW,KAAK,aAAa,EACzB,gBAAgB,WAAW;;CAGxC,IAAI,OAAyB;AAC3B,SAAO,KAAK,YAAY,MAAK,QAAO,IAAI,YAAY,CAAC;;CAGvD,MAAM,WAA0B;AAC9B,MAAI;AAAE,QAAK,MAAM,MAAM,KAAK;UAAoB;AAChD,MAAI,KAAK,KAAK;AACZ,SAAM,KAAK,IAAI,UAAU;AACzB,QAAK,MAAM;;;;;;;;;CAUf,OAAO,qBAA2C;AAChD,MAAI,CAAC,QAAQ,aACX,OAAM,IAAI,4BAA4B;AAExC,SAAO,QAAQ;;CAGjB,MAAc,cAAoC;AAChD,OAAK,QAAQ,MAAM,KAAK;AACxB,SAAO,KAAK;;CAGd,MAAc,WAAW,QAA2B,YAA0C;EAC5F,MAAM,EAAE,KAAK,cAAc,MAAM,OAAO;AAGxC,MAAI,eAAe,QAAQ,YACzB,QAAO,IAAI,cAA2B,GAEpC;EAGJ,MAAM,MAAM,IAAI,YAAY;GAAE,GAAG;GAAa;GAAY,KAAK,EAAE,WAAW;GAAE,CAAC;AAC/E,QAAM,IAAI,YAAY;AAGtB,MAAI,eAAe,QAAQ,aAAa;AACtC,SAAM,IAAI,UAAU;AACpB,UAAO,IAAI,cAA2B,GAEpC;;AAGJ,SAAO"}
@@ -16,4 +16,4 @@
16
16
  type Constructor<T = object> = new (...args: any[]) => T;
17
17
  //#endregion
18
18
  export { Constructor as t };
19
- //# sourceMappingURL=types-CN0zONAZ.d.mts.map
19
+ //# sourceMappingURL=types-DIWemRad.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-DIWemRad.d.mts","names":[],"sources":["../src/types.ts"],"mappings":";;AAeA;;;;;;;;;;;;;KAAY,WAAA,uBAAkC,IAAA,YAAgB,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./chunk-D1SwGrFN.mjs";
2
- import { i as dimWhite, n as cyan, r as dim, s as yellow, t as bold } from "./colors-BTAnQRGU.mjs";
2
+ import { i as dimWhite, n as cyan, r as dim, s as yellow, t as bold } from "./colors-DJaRDXoS.mjs";
3
3
  //#region src/quarry/usage-generator.ts
4
4
  var usage_generator_exports = /* @__PURE__ */ __exportAll({
5
5
  generateListing: () => generateListing,
@@ -155,4 +155,4 @@ function formatTable(rows) {
155
155
  //#endregion
156
156
  export { usage_generator_exports as n, generateUsage as t };
157
157
 
158
- //# sourceMappingURL=usage-generator-Cl1HPlUp.mjs.map
158
+ //# sourceMappingURL=usage-generator-MBcRo0Q2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"usage-generator-Cl1HPlUp.mjs","names":[],"sources":["../src/quarry/usage-generator.ts"],"sourcesContent":["import { bold, cyan, dim, dimWhite, yellow } from './colors'\nimport type { ParsedSignature } from './types'\n\n/**\n * Generate formatted help/usage text from a parsed signature.\n *\n * Pure function, edge-compatible.\n */\nexport function generateUsage(signature: ParsedSignature, description?: string): string {\n const lines: string[] = []\n\n // Usage line\n lines.push(`${bold('Usage:')} ${bold(cyan('quarry ' + buildUsageLine(signature)))}`)\n\n // Description\n if (description) {\n lines.push('')\n lines.push(description)\n }\n\n // Arguments section\n if (signature.arguments.length > 0) {\n lines.push('')\n lines.push(bold(yellow('Arguments:')))\n const argRows = signature.arguments.map((arg) => {\n const label = arg.name\n const parts: string[] = []\n\n if (arg.description) parts.push(arg.description)\n\n if (arg.isArray) {\n parts.push('(variadic)')\n } else if (arg.required) {\n parts.push('(required)')\n } else if (arg.default !== undefined) {\n parts.push(dim(`(default: ${arg.default})`))\n } else {\n parts.push('(optional)')\n }\n\n return [label, parts.join(' ')] as const\n })\n lines.push(...formatTable(argRows))\n }\n\n // Options section\n if (signature.options.length > 0) {\n lines.push('')\n lines.push(bold(yellow('Options:')))\n const optRows = signature.options.map((opt) => {\n const flagParts: string[] = []\n if (opt.alias) flagParts.push(`-${opt.alias},`)\n flagParts.push(`--${opt.name}`)\n\n const label = flagParts.join(' ')\n const parts: string[] = []\n\n if (opt.description) parts.push(opt.description)\n if (!opt.isFlag && !opt.description) parts.push('Accepts a value')\n if (opt.isFlag && !opt.description) parts.push('Boolean flag')\n if (opt.isArray) parts.push('(multiple)')\n if (opt.default !== undefined) parts.push(dim(`(default: ${opt.default})`))\n\n return [label, parts.join(' ')] as const\n })\n lines.push(...formatTable(optRows))\n }\n\n return lines.join('\\n')\n}\n\nexport interface ListingOptions {\n binaryName?: string\n binaryLabel?: string\n binaryVersion?: string\n}\n\n/**\n * Generate a compact command listing with visual hierarchy.\n */\nexport function generateListing(\n commands: { name: string; description?: string; aliases: string[] }[],\n signatures: Map<string, ParsedSignature>,\n options?: ListingOptions,\n): string {\n const bin = options?.binaryName ?? 'quarry'\n const label = options?.binaryLabel ?? 'Quarry CLI'\n const version = options?.binaryVersion\n\n const lines: string[] = []\n\n // Header\n lines.push(bold(`${label}${version ? ` v${version}` : ''}`))\n lines.push('')\n\n // Usage\n lines.push(bold(yellow('Usage')))\n lines.push(` $ ${bin} <command> [options]`)\n lines.push('')\n\n // Commands\n if (commands.length === 0) {\n lines.push('No registered commands.')\n return lines.join('\\n')\n }\n\n lines.push(bold(yellow('Commands')))\n\n const termWidth = typeof process !== 'undefined'\n ? (process.stdout.columns as number | undefined) ?? 80\n : 80\n\n for (let i = 0; i < commands.length; i++) {\n const cmd = commands[i]\n const sig = signatures.get(cmd.name)\n const sigParts: string[] = [cyan(cmd.name)]\n\n if (cmd.aliases.length > 0) {\n sigParts.push(cyan(`(alias: ${cmd.aliases.join(', ')})`))\n }\n\n if (sig) {\n const inlineParts: string[] = []\n for (const arg of sig.arguments) {\n inlineParts.push(formatArgPlaceholder(arg))\n }\n\n for (const opt of sig.options) {\n const flagStr = opt.alias ? `-${opt.alias},--${opt.name}` : `--${opt.name}`\n inlineParts.push(`[${flagStr}]`)\n }\n\n if (inlineParts.length > 0) {\n sigParts.push(dim(inlineParts.join(' ')))\n }\n }\n\n const sigLine = ' ' + sigParts.join(' ')\n lines.push(...wrapLine(sigLine, termWidth, ' '))\n\n if (cmd.description) {\n lines.push(` ${dimWhite(cmd.description)}`)\n }\n\n if (i < commands.length - 1) {\n lines.push('')\n }\n }\n\n lines.push('')\n\n // Footer\n lines.push(dimWhite(`Run ${bin} help <command> for detailed information.`))\n\n return lines.join('\\n')\n}\n\n/** Format a single argument into its placeholder representation (e.g. `<name>`, `[name=default]`). */\nfunction formatArgPlaceholder(arg: ParsedSignature['arguments'][number]): string {\n if (arg.isArray) return `<${arg.name}...>`\n if (arg.required) return `<${arg.name}>`\n if (arg.default !== undefined) return `[${arg.name}=${arg.default}]`\n return `[${arg.name}]`\n}\n\n/** Build the inline usage line showing the command name with argument and option placeholders. */\nfunction buildUsageLine(signature: ParsedSignature): string {\n const parts = [signature.name]\n\n for (const arg of signature.arguments) {\n parts.push(formatArgPlaceholder(arg))\n }\n\n for (const opt of signature.options) {\n const flagStr = opt.alias ? `-${opt.alias},--${opt.name}` : `--${opt.name}`\n\n if (opt.isFlag) {\n parts.push(`[${flagStr}]`)\n } else if (opt.isArray) {\n parts.push(`[${flagStr} <value...>]`)\n } else {\n parts.push(`[${flagStr} <value>]`)\n }\n }\n\n return parts.join(' ')\n}\n\n// eslint-disable-next-line no-control-regex\nconst ANSI_RE = /\\x1b\\[[0-9;]*m/g\n\n/** Remove ANSI escape sequences from a string. */\nfunction stripAnsi(s: string): string {\n return s.replace(ANSI_RE, '')\n}\n\n// eslint-disable-next-line no-control-regex\nconst TOKEN_RE = /(?:\\x1b\\[[0-9;]*m)*[^\\s\\x1b]+(?:\\x1b\\[[0-9;]*m)*/g\n\n/** Wrap a single line at word boundaries, preserving ANSI codes across wrapped segments. */\nfunction wrapLine(text: string, maxWidth: number, continuationIndent: string): string[] {\n const visibleLen = stripAnsi(text).length\n if (visibleLen <= maxWidth) return [text]\n\n const tokens = text.match(TOKEN_RE) ?? [text]\n\n const lines: string[] = []\n let currentLine = ''\n let currentVisibleLen = 0\n\n for (const token of tokens) {\n const tokenVisible = stripAnsi(token).length\n const separator = currentLine === '' ? '' : ' '\n const separatorLen = separator.length\n\n if (currentLine !== '' && currentVisibleLen + separatorLen + tokenVisible > maxWidth) {\n lines.push(currentLine)\n currentLine = continuationIndent + token\n currentVisibleLen = continuationIndent.length + tokenVisible\n } else {\n currentLine += separator + token\n currentVisibleLen += separatorLen + tokenVisible\n }\n }\n\n if (currentLine !== '') {\n lines.push(currentLine)\n }\n\n return lines\n}\n\n/** Format label/description pairs into aligned two-column table rows. */\nfunction formatTable(rows: readonly (readonly [string, string])[]): string[] {\n if (rows.length === 0) return []\n\n const maxLabel = Math.max(...rows.map(([label]) => stripAnsi(label).length))\n const padding = 4\n\n return rows.map(([label, desc]) => {\n const visibleLen = stripAnsi(label).length\n const pad = ' '.repeat(maxLabel - visibleLen + padding)\n return ` ${label}${pad}${desc}`\n })\n}\n"],"mappings":";;;;;;;;;;;;AAQA,SAAgB,cAAc,WAA4B,aAA8B;CACtF,MAAM,QAAkB,EAAE;AAG1B,OAAM,KAAK,GAAG,KAAK,SAAS,CAAC,GAAG,KAAK,KAAK,YAAY,eAAe,UAAU,CAAC,CAAC,GAAG;AAGpF,KAAI,aAAa;AACf,QAAM,KAAK,GAAG;AACd,QAAM,KAAK,YAAY;;AAIzB,KAAI,UAAU,UAAU,SAAS,GAAG;AAClC,QAAM,KAAK,GAAG;AACd,QAAM,KAAK,KAAK,OAAO,aAAa,CAAC,CAAC;EACtC,MAAM,UAAU,UAAU,UAAU,KAAK,QAAQ;GAC/C,MAAM,QAAQ,IAAI;GAClB,MAAM,QAAkB,EAAE;AAE1B,OAAI,IAAI,YAAa,OAAM,KAAK,IAAI,YAAY;AAEhD,OAAI,IAAI,QACN,OAAM,KAAK,aAAa;YACf,IAAI,SACb,OAAM,KAAK,aAAa;YACf,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;AACvB,iBAAc,qBAAqB;AACnC,uBAAoB,mBAAmB,SAAS;SAC3C;AACL,kBAAe,YAAY;AAC3B,wBAAqB,eAAe;;;AAIxC,KAAI,gBAAgB,GAClB,OAAM,KAAK,YAAY;AAGzB,QAAO;;;AAIT,SAAS,YAAY,MAAwD;AAC3E,KAAI,KAAK,WAAW,EAAG,QAAO,EAAE;CAEhC,MAAM,WAAW,KAAK,IAAI,GAAG,KAAK,KAAK,CAAC,WAAW,UAAU,MAAM,CAAC,OAAO,CAAC;CAC5E,MAAM,UAAU;AAEhB,QAAO,KAAK,KAAK,CAAC,OAAO,UAAU;EACjC,MAAM,aAAa,UAAU,MAAM,CAAC;AAEpC,SAAO,KAAK,QADA,IAAI,OAAO,WAAW,aAAa,QAAQ,GAC7B;GAC1B"}
1
+ {"version":3,"file":"usage-generator-MBcRo0Q2.mjs","names":[],"sources":["../src/quarry/usage-generator.ts"],"sourcesContent":["import { bold, cyan, dim, dimWhite, yellow } from './colors'\nimport type { ParsedSignature } from './types'\n\n/**\n * Generate formatted help/usage text from a parsed signature.\n *\n * Pure function, edge-compatible.\n */\nexport function generateUsage(signature: ParsedSignature, description?: string): string {\n const lines: string[] = []\n\n // Usage line\n lines.push(`${bold('Usage:')} ${bold(cyan('quarry ' + buildUsageLine(signature)))}`)\n\n // Description\n if (description) {\n lines.push('')\n lines.push(description)\n }\n\n // Arguments section\n if (signature.arguments.length > 0) {\n lines.push('')\n lines.push(bold(yellow('Arguments:')))\n const argRows = signature.arguments.map((arg) => {\n const label = arg.name\n const parts: string[] = []\n\n if (arg.description) parts.push(arg.description)\n\n if (arg.isArray) {\n parts.push('(variadic)')\n } else if (arg.required) {\n parts.push('(required)')\n } else if (arg.default !== undefined) {\n parts.push(dim(`(default: ${arg.default})`))\n } else {\n parts.push('(optional)')\n }\n\n return [label, parts.join(' ')] as const\n })\n lines.push(...formatTable(argRows))\n }\n\n // Options section\n if (signature.options.length > 0) {\n lines.push('')\n lines.push(bold(yellow('Options:')))\n const optRows = signature.options.map((opt) => {\n const flagParts: string[] = []\n if (opt.alias) flagParts.push(`-${opt.alias},`)\n flagParts.push(`--${opt.name}`)\n\n const label = flagParts.join(' ')\n const parts: string[] = []\n\n if (opt.description) parts.push(opt.description)\n if (!opt.isFlag && !opt.description) parts.push('Accepts a value')\n if (opt.isFlag && !opt.description) parts.push('Boolean flag')\n if (opt.isArray) parts.push('(multiple)')\n if (opt.default !== undefined) parts.push(dim(`(default: ${opt.default})`))\n\n return [label, parts.join(' ')] as const\n })\n lines.push(...formatTable(optRows))\n }\n\n return lines.join('\\n')\n}\n\nexport interface ListingOptions {\n binaryName?: string\n binaryLabel?: string\n binaryVersion?: string\n}\n\n/**\n * Generate a compact command listing with visual hierarchy.\n */\nexport function generateListing(\n commands: { name: string; description?: string; aliases: string[] }[],\n signatures: Map<string, ParsedSignature>,\n options?: ListingOptions,\n): string {\n const bin = options?.binaryName ?? 'quarry'\n const label = options?.binaryLabel ?? 'Quarry CLI'\n const version = options?.binaryVersion\n\n const lines: string[] = []\n\n // Header\n lines.push(bold(`${label}${version ? ` v${version}` : ''}`))\n lines.push('')\n\n // Usage\n lines.push(bold(yellow('Usage')))\n lines.push(` $ ${bin} <command> [options]`)\n lines.push('')\n\n // Commands\n if (commands.length === 0) {\n lines.push('No registered commands.')\n return lines.join('\\n')\n }\n\n lines.push(bold(yellow('Commands')))\n\n const termWidth = typeof process !== 'undefined'\n ? (process.stdout.columns as number | undefined) ?? 80\n : 80\n\n for (let i = 0; i < commands.length; i++) {\n const cmd = commands[i]\n const sig = signatures.get(cmd.name)\n const sigParts: string[] = [cyan(cmd.name)]\n\n if (cmd.aliases.length > 0) {\n sigParts.push(cyan(`(alias: ${cmd.aliases.join(', ')})`))\n }\n\n if (sig) {\n const inlineParts: string[] = []\n for (const arg of sig.arguments) {\n inlineParts.push(formatArgPlaceholder(arg))\n }\n\n for (const opt of sig.options) {\n const flagStr = opt.alias ? `-${opt.alias},--${opt.name}` : `--${opt.name}`\n inlineParts.push(`[${flagStr}]`)\n }\n\n if (inlineParts.length > 0) {\n sigParts.push(dim(inlineParts.join(' ')))\n }\n }\n\n const sigLine = ' ' + sigParts.join(' ')\n lines.push(...wrapLine(sigLine, termWidth, ' '))\n\n if (cmd.description) {\n lines.push(` ${dimWhite(cmd.description)}`)\n }\n\n if (i < commands.length - 1) {\n lines.push('')\n }\n }\n\n lines.push('')\n\n // Footer\n lines.push(dimWhite(`Run ${bin} help <command> for detailed information.`))\n\n return lines.join('\\n')\n}\n\n/** Format a single argument into its placeholder representation (e.g. `<name>`, `[name=default]`). */\nfunction formatArgPlaceholder(arg: ParsedSignature['arguments'][number]): string {\n if (arg.isArray) return `<${arg.name}...>`\n if (arg.required) return `<${arg.name}>`\n if (arg.default !== undefined) return `[${arg.name}=${arg.default}]`\n return `[${arg.name}]`\n}\n\n/** Build the inline usage line showing the command name with argument and option placeholders. */\nfunction buildUsageLine(signature: ParsedSignature): string {\n const parts = [signature.name]\n\n for (const arg of signature.arguments) {\n parts.push(formatArgPlaceholder(arg))\n }\n\n for (const opt of signature.options) {\n const flagStr = opt.alias ? `-${opt.alias},--${opt.name}` : `--${opt.name}`\n\n if (opt.isFlag) {\n parts.push(`[${flagStr}]`)\n } else if (opt.isArray) {\n parts.push(`[${flagStr} <value...>]`)\n } else {\n parts.push(`[${flagStr} <value>]`)\n }\n }\n\n return parts.join(' ')\n}\n\n// eslint-disable-next-line no-control-regex\nconst ANSI_RE = /\\x1b\\[[0-9;]*m/g\n\n/** Remove ANSI escape sequences from a string. */\nfunction stripAnsi(s: string): string {\n return s.replace(ANSI_RE, '')\n}\n\n// eslint-disable-next-line no-control-regex\nconst TOKEN_RE = /(?:\\x1b\\[[0-9;]*m)*[^\\s\\x1b]+(?:\\x1b\\[[0-9;]*m)*/g\n\n/** Wrap a single line at word boundaries, preserving ANSI codes across wrapped segments. */\nfunction wrapLine(text: string, maxWidth: number, continuationIndent: string): string[] {\n const visibleLen = stripAnsi(text).length\n if (visibleLen <= maxWidth) return [text]\n\n const tokens = text.match(TOKEN_RE) ?? [text]\n\n const lines: string[] = []\n let currentLine = ''\n let currentVisibleLen = 0\n\n for (const token of tokens) {\n const tokenVisible = stripAnsi(token).length\n const separator = currentLine === '' ? '' : ' '\n const separatorLen = separator.length\n\n if (currentLine !== '' && currentVisibleLen + separatorLen + tokenVisible > maxWidth) {\n lines.push(currentLine)\n currentLine = continuationIndent + token\n currentVisibleLen = continuationIndent.length + tokenVisible\n } else {\n currentLine += separator + token\n currentVisibleLen += separatorLen + tokenVisible\n }\n }\n\n if (currentLine !== '') {\n lines.push(currentLine)\n }\n\n return lines\n}\n\n/** Format label/description pairs into aligned two-column table rows. */\nfunction formatTable(rows: readonly (readonly [string, string])[]): string[] {\n if (rows.length === 0) return []\n\n const maxLabel = Math.max(...rows.map(([label]) => stripAnsi(label).length))\n const padding = 4\n\n return rows.map(([label, desc]) => {\n const visibleLen = stripAnsi(label).length\n const pad = ' '.repeat(maxLabel - visibleLen + padding)\n return ` ${label}${pad}${desc}`\n })\n}\n"],"mappings":";;;;;;;;;;;;AAQA,SAAgB,cAAc,WAA4B,aAA8B;CACtF,MAAM,QAAkB,EAAE;AAG1B,OAAM,KAAK,GAAG,KAAK,SAAS,CAAC,GAAG,KAAK,KAAK,YAAY,eAAe,UAAU,CAAC,CAAC,GAAG;AAGpF,KAAI,aAAa;AACf,QAAM,KAAK,GAAG;AACd,QAAM,KAAK,YAAY;;AAIzB,KAAI,UAAU,UAAU,SAAS,GAAG;AAClC,QAAM,KAAK,GAAG;AACd,QAAM,KAAK,KAAK,OAAO,aAAa,CAAC,CAAC;EACtC,MAAM,UAAU,UAAU,UAAU,KAAK,QAAQ;GAC/C,MAAM,QAAQ,IAAI;GAClB,MAAM,QAAkB,EAAE;AAE1B,OAAI,IAAI,YAAa,OAAM,KAAK,IAAI,YAAY;AAEhD,OAAI,IAAI,QACN,OAAM,KAAK,aAAa;YACf,IAAI,SACb,OAAM,KAAK,aAAa;YACf,IAAI,YAA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AAc,qBAAqB;AACnC,uBAAoB,mBAAmB,SAAS;SAC3C;AACL,kBAAe,YAAY;AAC3B,wBAAqB,eAAe;;;AAIxC,KAAI,gBAAgB,GAClB,OAAM,KAAK,YAAY;AAGzB,QAAO;;;AAIT,SAAS,YAAY,MAAwD;AAC3E,KAAI,KAAK,WAAW,EAAG,QAAO,EAAE;CAEhC,MAAM,WAAW,KAAK,IAAI,GAAG,KAAK,KAAK,CAAC,WAAW,UAAU,MAAM,CAAC,OAAO,CAAC;CAC5E,MAAM,UAAU;AAEhB,QAAO,KAAK,KAAK,CAAC,OAAO,UAAU;EACjC,MAAM,aAAa,UAAU,MAAM,CAAC;AAEpC,SAAO,KAAK,QADA,IAAI,OAAO,WAAW,aAAa,QACxB,GAAG;GAC1B"}
@@ -191,4 +191,4 @@ __reExport(validation_exports, import__hono_zod_openapi);
191
191
  //#endregion
192
192
  export { withI18n as a, z$1 as i, ZodError as n, backendErrorMap as o, validation_exports as r, runWithErrorMapContext as s, OpenAPIHono as t };
193
193
 
194
- //# sourceMappingURL=validation-B4bePOa_.mjs.map
194
+ //# sourceMappingURL=validation-Dbg3ehdP.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"validation-B4bePOa_.mjs","names":[],"sources":["../src/i18n/validation/validation.error-map.ts","../src/i18n/validation/validation.context.ts","../src/i18n/validation/with-i18n.ts","../src/i18n/validation/index.ts"],"sourcesContent":["import type {\n $ZodErrorMap,\n $ZodIssueInvalidKey,\n $ZodIssueInvalidStringFormat,\n $ZodIssueInvalidType,\n $ZodIssueInvalidUnion,\n $ZodIssueNotMultipleOf,\n $ZodIssueTooBig,\n $ZodIssueTooSmall,\n $ZodIssueUnrecognizedKeys,\n $ZodRawIssue,\n} from 'zod/v4/core'\nimport type { MessageKeys } from '../i18n.types'\nimport type { ErrorMapContext } from './validation.types'\n\n/**\n * Type guards for narrowing Zod v4 issue types\n */\nfunction isInvalidType(issue: $ZodRawIssue): issue is $ZodRawIssue<$ZodIssueInvalidType> {\n return issue.code === 'invalid_type'\n}\n\nfunction isTooBig(issue: $ZodRawIssue): issue is $ZodRawIssue<$ZodIssueTooBig> {\n return issue.code === 'too_big'\n}\n\nfunction isTooSmall(issue: $ZodRawIssue): issue is $ZodRawIssue<$ZodIssueTooSmall> {\n return issue.code === 'too_small'\n}\n\nfunction isInvalidFormat(issue: $ZodRawIssue): issue is $ZodRawIssue<$ZodIssueInvalidStringFormat> {\n return issue.code === 'invalid_format'\n}\n\nfunction isNotMultipleOf(issue: $ZodRawIssue): issue is $ZodRawIssue<$ZodIssueNotMultipleOf> {\n return issue.code === 'not_multiple_of'\n}\n\nfunction isUnrecognizedKeys(issue: $ZodRawIssue): issue is $ZodRawIssue<$ZodIssueUnrecognizedKeys> {\n return issue.code === 'unrecognized_keys'\n}\n\nfunction isInvalidUnion(issue: $ZodRawIssue): issue is $ZodRawIssue<$ZodIssueInvalidUnion> {\n return issue.code === 'invalid_union'\n}\n\nfunction isInvalidKey(issue: $ZodRawIssue): issue is $ZodRawIssue<$ZodIssueInvalidKey> {\n return issue.code === 'invalid_key'\n}\n\n/**\n * Maps Zod issue codes to zodI18n message keys\n * Adapted for Zod v4's simpler issue code system\n */\nfunction getMessageKey(issue: $ZodRawIssue): MessageKeys {\n if (isInvalidType(issue)) {\n if (issue.input === undefined) {\n return 'zodI18n.errors.required'\n }\n return 'zodI18n.errors.invalid_type'\n }\n\n if (isTooSmall(issue)) {\n const typeKey = issue.origin || 'string'\n const exactKey = issue.exact\n ? 'exact'\n : issue.inclusive\n ? 'inclusive'\n : 'not_inclusive'\n return `zodI18n.errors.too_small.${typeKey}.${exactKey}` as MessageKeys\n }\n\n if (isTooBig(issue)) {\n const typeKey = issue.origin || 'string'\n const exactKey = issue.exact\n ? 'exact'\n : issue.inclusive\n ? 'inclusive'\n : 'not_inclusive'\n return `zodI18n.errors.too_big.${typeKey}.${exactKey}` as MessageKeys\n }\n\n if (isInvalidFormat(issue)) {\n // Map v4's format to v3-style validation keys\n return `zodI18n.errors.invalid_string.${issue.format}` as MessageKeys\n }\n\n if (isNotMultipleOf(issue)) {\n return 'zodI18n.errors.not_multiple_of'\n }\n\n if (isUnrecognizedKeys(issue)) {\n return 'zodI18n.errors.unrecognized_keys'\n }\n\n if (isInvalidUnion(issue)) {\n return 'zodI18n.errors.invalid_union'\n }\n\n if (isInvalidKey(issue)) {\n // v4: Replaces invalid_enum_value, invalid_literal\n return 'zodI18n.errors.invalid_enum_value'\n }\n\n // invalid_element, invalid_value, or unknown codes\n return 'zodI18n.errors.custom.default'\n}\n\n/**\n * Extracts interpolation parameters from Zod issue\n * Uses proper type narrowing for v4\n */\nfunction getMessageParams(issue: $ZodRawIssue): Record<string, unknown> {\n const params: Record<string, unknown> = {}\n\n if (isInvalidType(issue)) {\n params.expected = issue.expected\n params.received = String(issue.input)\n return params\n }\n\n if (isUnrecognizedKeys(issue)) {\n params.keys = issue.keys.join(', ')\n return params\n }\n\n if (isInvalidKey(issue)) {\n // v4: For enums and records\n // Since v4 doesn't have options field, we'll use generic message\n return params\n }\n\n if (isInvalidFormat(issue)) {\n params.validation = issue.format\n\n // Check for specific string format issues with additional fields\n if ('prefix' in issue) {\n params.startsWith = (issue as { prefix?: string }).prefix\n }\n if ('suffix' in issue) {\n params.endsWith = (issue as { suffix?: string }).suffix\n }\n if ('includes' in issue) {\n params.includes = (issue as { includes?: string }).includes\n }\n if (issue.pattern) {\n params.pattern = issue.pattern\n }\n\n return params\n }\n\n if (isTooSmall(issue)) {\n params.minimum = issue.minimum\n params.type = issue.origin\n if (issue.origin === 'date') {\n params.minimum = new Date(Number(issue.minimum)).toLocaleDateString()\n }\n return params\n }\n\n if (isTooBig(issue)) {\n params.maximum = issue.maximum\n params.type = issue.origin\n if (issue.origin === 'date') {\n params.maximum = new Date(Number(issue.maximum)).toLocaleDateString()\n }\n return params\n }\n\n if (isNotMultipleOf(issue)) {\n params.multipleOf = issue.divisor\n return params\n }\n\n return params\n}\n\n/**\n * Creates a Zod error map that uses i18n for translation\n * Uses Zod v4 native $ZodErrorMap signature (no ctx parameter)\n */\nexport function createI18nErrorMap(getContext: () => ErrorMapContext | undefined): $ZodErrorMap {\n return (issue: $ZodRawIssue): { message: string } => {\n // Get message key and params for this issue\n const messageKey = getMessageKey(issue)\n const messageParams = getMessageParams(issue)\n\n // Get translation context\n const context = getContext()\n\n if (!context) {\n // Fallback: Use English messages directly\n // This handles config validation at startup, tests, etc.\n return { message: 'Invalid input' }\n }\n\n // Normal flow: Use context-aware i18n (respects user locale)\n return {\n message: context.t(messageKey, messageParams),\n }\n }\n}\n","import { AsyncLocalStorage } from 'node:async_hooks'\nimport type { ErrorMapContext } from './validation.types'\nimport { createI18nErrorMap } from './validation.error-map'\n\n/**\n * AsyncLocalStorage for storing request-scoped ErrorMapContext\n * Allows error map to access I18nService without passing through function calls\n */\nexport const errorMapContextStorage = new AsyncLocalStorage<ErrorMapContext>()\n\n/**\n * Gets the current error map context from AsyncLocalStorage\n */\nfunction getErrorMapContext(): ErrorMapContext | undefined {\n return errorMapContextStorage.getStore()\n}\n\n/**\n * Backend error map that accesses I18nService from AsyncLocalStorage\n * Must be initialized in router middleware after locale detection\n */\nexport const backendErrorMap = createI18nErrorMap(getErrorMapContext)\n\n/**\n * Runs a function within an error map context\n * Used by router middleware to provide I18nService to validation\n *\n * @example\n * ```typescript\n * router.use('*', async (c, next) => {\n * const i18nService = c.get('i18nService')\n * const locale = c.get('locale')\n *\n * return runWithErrorMapContext(\n * {\n * t: (key, params) => i18nService.t(key, params),\n * locale,\n * },\n * () => next()\n * )\n * })\n * ```\n */\nexport function runWithErrorMapContext<T>(\n context: ErrorMapContext,\n fn: () => T\n): T {\n return errorMapContextStorage.run(context, fn)\n}\n","import type { MessageKeys } from '../i18n.types'\nimport { errorMapContextStorage } from './validation.context'\n\n/**\n * Type-safe helper for creating custom Zod error messages with i18n support (Backend)\n *\n * Usage with .refine():\n * ```typescript\n * const schema = z.string().refine(\n * (val) => val.length > 5,\n * withI18n('validation.minLength', { min: 5 })\n * )\n * ```\n *\n * Usage with built-in validators:\n * ```typescript\n * const schema = z.string().min(5, withI18n('validation.minLength', { min: 5 }))\n * const schema = z.string().email(withI18n('validation.email'))\n * ```\n *\n * Note: This is the backend version using AsyncLocalStorage.\n * For frontend, use withI18nFrontend from the frontend validation module\n *\n * @param key - Message key from shared i18n messages (type-safe via MessageKeys)\n * @param params - Optional interpolation parameters for the message\n * @returns Zod error configuration object with translated message\n */\nexport function withI18n(\n key: MessageKeys,\n params?: Record<string, unknown>\n): { error: () => string } {\n return {\n error: () => {\n // Get i18n context from AsyncLocalStorage (backend)\n // This is set by the router middleware before validation\n const context = errorMapContextStorage.getStore()\n\n // Translate using context if available, otherwise fallback to generic message\n const message = context\n ? context.t(key, params as Record<string, string | number> | undefined)\n : 'Invalid input'\n\n return message\n },\n }\n}\n","// Consolidated zod - single source from @hono/zod-openapi (superset of zod)\nexport { OpenAPIHono, z } from '@hono/zod-openapi'\nexport type * from 'zod'\nexport { ZodError } from 'zod'\n\n// OpenAPI utilities\nexport * from '@hono/zod-openapi'\nexport type { OpenAPIObject, PathItemObject } from 'openapi3-ts/oas30'\n\n// Helpers\nexport { withI18n } from './with-i18n'\n\n// Backend utilities\nexport { backendErrorMap, runWithErrorMapContext } from './validation.context'\n\n// Types\nexport type { ErrorMapContext, I18nErrorMetadata, LocaleProvider, ZodCustomIssue } from './validation.types'\n\n"],"mappings":";;;;;;;;AAkBA,SAAS,cAAc,OAAkE;AACvF,QAAO,MAAM,SAAS;;AAGxB,SAAS,SAAS,OAA6D;AAC7E,QAAO,MAAM,SAAS;;AAGxB,SAAS,WAAW,OAA+D;AACjF,QAAO,MAAM,SAAS;;AAGxB,SAAS,gBAAgB,OAA0E;AACjG,QAAO,MAAM,SAAS;;AAGxB,SAAS,gBAAgB,OAAoE;AAC3F,QAAO,MAAM,SAAS;;AAGxB,SAAS,mBAAmB,OAAuE;AACjG,QAAO,MAAM,SAAS;;AAGxB,SAAS,eAAe,OAAmE;AACzF,QA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,WAAW,OACnB,QAAO,UAAU,IAAI,KAAK,OAAO,MAAM,QAAQ,CAAC,CAAC,oBAAoB;AAEvE,SAAO;;AAGT,KAAI,SAAS,MAAM,EAAE;AACnB,SAAO,UAAU,MAAM;AACvB,SAAO,OAAO,MAAM;AACpB,MAAI,MAAM,WAAW,OACnB,QAAO,UAAU,IAAI,KAAK,OAAO,MAAM,QAAQ,CAAC,CAAC,oBAAoB;AAEvE,SAAO;;AAGT,KAAI,gBAAgB,MAAM,EAAE;AAC1B,SAAO,aAAa,MAAM;AAC1B,SAAO;;AAGT,QAAO;;;;;;AAOT,SAAgB,mBAAmB,YAA6D;AAC9F,SAAQ,UAA6C;EAEnD,MAAM,aAAa,cAAc,MAAM;EACvC,MAAM,gBAAgB,iBAAiB,MAAM;EAG7C,MAAM,UAAU,YAAY;AAE5B,MAAI,CAAC,QAGH,QAAO,EAAE,SAAS,iBAAiB;AAIrC,SAAO,EACL,SAAS,QAAQ,EAAE,YAAY,cAAc,EAC9C;;;;;;;;;AChML,MAAa,yBAAyB,IAAI,mBAAoC;;;;AAK9E,SAAS,qBAAkD;AACzD,QAAO,uBAAuB,UAAU;;;;;;AAO1C,MAAa,kBAAkB,mBAAmB,mBAAmB;;;;;;;;;;;;;;;;;;;;;AAsBrE,SAAgB,uBACd,SACA,IACG;AACH,QAAO,uBAAuB,IAAI,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACpBhD,SAAgB,SACd,KACA,QACyB;AACzB,QAAO,EACL,aAAa;EAGX,MAAM,UAAU,uBAAuB,UAAU;AAOjD,SAJgB,UACZ,QAAQ,EAAE,KAAK,OAAsD,GACrE;IAIP"}
1
+ {"version":3,"file":"validation-Dbg3ehdP.mjs","names":[],"sources":["../src/i18n/validation/validation.error-map.ts","../src/i18n/validation/validation.context.ts","../src/i18n/validation/with-i18n.ts","../src/i18n/validation/index.ts"],"sourcesContent":["import type {\n $ZodErrorMap,\n $ZodIssueInvalidKey,\n $ZodIssueInvalidStringFormat,\n $ZodIssueInvalidType,\n $ZodIssueInvalidUnion,\n $ZodIssueNotMultipleOf,\n $ZodIssueTooBig,\n $ZodIssueTooSmall,\n $ZodIssueUnrecognizedKeys,\n $ZodRawIssue,\n} from 'zod/v4/core'\nimport type { MessageKeys } from '../i18n.types'\nimport type { ErrorMapContext } from './validation.types'\n\n/**\n * Type guards for narrowing Zod v4 issue types\n */\nfunction isInvalidType(issue: $ZodRawIssue): issue is $ZodRawIssue<$ZodIssueInvalidType> {\n return issue.code === 'invalid_type'\n}\n\nfunction isTooBig(issue: $ZodRawIssue): issue is $ZodRawIssue<$ZodIssueTooBig> {\n return issue.code === 'too_big'\n}\n\nfunction isTooSmall(issue: $ZodRawIssue): issue is $ZodRawIssue<$ZodIssueTooSmall> {\n return issue.code === 'too_small'\n}\n\nfunction isInvalidFormat(issue: $ZodRawIssue): issue is $ZodRawIssue<$ZodIssueInvalidStringFormat> {\n return issue.code === 'invalid_format'\n}\n\nfunction isNotMultipleOf(issue: $ZodRawIssue): issue is $ZodRawIssue<$ZodIssueNotMultipleOf> {\n return issue.code === 'not_multiple_of'\n}\n\nfunction isUnrecognizedKeys(issue: $ZodRawIssue): issue is $ZodRawIssue<$ZodIssueUnrecognizedKeys> {\n return issue.code === 'unrecognized_keys'\n}\n\nfunction isInvalidUnion(issue: $ZodRawIssue): issue is $ZodRawIssue<$ZodIssueInvalidUnion> {\n return issue.code === 'invalid_union'\n}\n\nfunction isInvalidKey(issue: $ZodRawIssue): issue is $ZodRawIssue<$ZodIssueInvalidKey> {\n return issue.code === 'invalid_key'\n}\n\n/**\n * Maps Zod issue codes to zodI18n message keys\n * Adapted for Zod v4's simpler issue code system\n */\nfunction getMessageKey(issue: $ZodRawIssue): MessageKeys {\n if (isInvalidType(issue)) {\n if (issue.input === undefined) {\n return 'zodI18n.errors.required'\n }\n return 'zodI18n.errors.invalid_type'\n }\n\n if (isTooSmall(issue)) {\n const typeKey = issue.origin || 'string'\n const exactKey = issue.exact\n ? 'exact'\n : issue.inclusive\n ? 'inclusive'\n : 'not_inclusive'\n return `zodI18n.errors.too_small.${typeKey}.${exactKey}` as MessageKeys\n }\n\n if (isTooBig(issue)) {\n const typeKey = issue.origin || 'string'\n const exactKey = issue.exact\n ? 'exact'\n : issue.inclusive\n ? 'inclusive'\n : 'not_inclusive'\n return `zodI18n.errors.too_big.${typeKey}.${exactKey}` as MessageKeys\n }\n\n if (isInvalidFormat(issue)) {\n // Map v4's format to v3-style validation keys\n return `zodI18n.errors.invalid_string.${issue.format}` as MessageKeys\n }\n\n if (isNotMultipleOf(issue)) {\n return 'zodI18n.errors.not_multiple_of'\n }\n\n if (isUnrecognizedKeys(issue)) {\n return 'zodI18n.errors.unrecognized_keys'\n }\n\n if (isInvalidUnion(issue)) {\n return 'zodI18n.errors.invalid_union'\n }\n\n if (isInvalidKey(issue)) {\n // v4: Replaces invalid_enum_value, invalid_literal\n return 'zodI18n.errors.invalid_enum_value'\n }\n\n // invalid_element, invalid_value, or unknown codes\n return 'zodI18n.errors.custom.default'\n}\n\n/**\n * Extracts interpolation parameters from Zod issue\n * Uses proper type narrowing for v4\n */\nfunction getMessageParams(issue: $ZodRawIssue): Record<string, unknown> {\n const params: Record<string, unknown> = {}\n\n if (isInvalidType(issue)) {\n params.expected = issue.expected\n params.received = String(issue.input)\n return params\n }\n\n if (isUnrecognizedKeys(issue)) {\n params.keys = issue.keys.join(', ')\n return params\n }\n\n if (isInvalidKey(issue)) {\n // v4: For enums and records\n // Since v4 doesn't have options field, we'll use generic message\n return params\n }\n\n if (isInvalidFormat(issue)) {\n params.validation = issue.format\n\n // Check for specific string format issues with additional fields\n if ('prefix' in issue) {\n params.startsWith = (issue as { prefix?: string }).prefix\n }\n if ('suffix' in issue) {\n params.endsWith = (issue as { suffix?: string }).suffix\n }\n if ('includes' in issue) {\n params.includes = (issue as { includes?: string }).includes\n }\n if (issue.pattern) {\n params.pattern = issue.pattern\n }\n\n return params\n }\n\n if (isTooSmall(issue)) {\n params.minimum = issue.minimum\n params.type = issue.origin\n if (issue.origin === 'date') {\n params.minimum = new Date(Number(issue.minimum)).toLocaleDateString()\n }\n return params\n }\n\n if (isTooBig(issue)) {\n params.maximum = issue.maximum\n params.type = issue.origin\n if (issue.origin === 'date') {\n params.maximum = new Date(Number(issue.maximum)).toLocaleDateString()\n }\n return params\n }\n\n if (isNotMultipleOf(issue)) {\n params.multipleOf = issue.divisor\n return params\n }\n\n return params\n}\n\n/**\n * Creates a Zod error map that uses i18n for translation\n * Uses Zod v4 native $ZodErrorMap signature (no ctx parameter)\n */\nexport function createI18nErrorMap(getContext: () => ErrorMapContext | undefined): $ZodErrorMap {\n return (issue: $ZodRawIssue): { message: string } => {\n // Get message key and params for this issue\n const messageKey = getMessageKey(issue)\n const messageParams = getMessageParams(issue)\n\n // Get translation context\n const context = getContext()\n\n if (!context) {\n // Fallback: Use English messages directly\n // This handles config validation at startup, tests, etc.\n return { message: 'Invalid input' }\n }\n\n // Normal flow: Use context-aware i18n (respects user locale)\n return {\n message: context.t(messageKey, messageParams),\n }\n }\n}\n","import { AsyncLocalStorage } from 'node:async_hooks'\nimport type { ErrorMapContext } from './validation.types'\nimport { createI18nErrorMap } from './validation.error-map'\n\n/**\n * AsyncLocalStorage for storing request-scoped ErrorMapContext\n * Allows error map to access I18nService without passing through function calls\n */\nexport const errorMapContextStorage = new AsyncLocalStorage<ErrorMapContext>()\n\n/**\n * Gets the current error map context from AsyncLocalStorage\n */\nfunction getErrorMapContext(): ErrorMapContext | undefined {\n return errorMapContextStorage.getStore()\n}\n\n/**\n * Backend error map that accesses I18nService from AsyncLocalStorage\n * Must be initialized in router middleware after locale detection\n */\nexport const backendErrorMap = createI18nErrorMap(getErrorMapContext)\n\n/**\n * Runs a function within an error map context\n * Used by router middleware to provide I18nService to validation\n *\n * @example\n * ```typescript\n * router.use('*', async (c, next) => {\n * const i18nService = c.get('i18nService')\n * const locale = c.get('locale')\n *\n * return runWithErrorMapContext(\n * {\n * t: (key, params) => i18nService.t(key, params),\n * locale,\n * },\n * () => next()\n * )\n * })\n * ```\n */\nexport function runWithErrorMapContext<T>(\n context: ErrorMapContext,\n fn: () => T\n): T {\n return errorMapContextStorage.run(context, fn)\n}\n","import type { MessageKeys } from '../i18n.types'\nimport { errorMapContextStorage } from './validation.context'\n\n/**\n * Type-safe helper for creating custom Zod error messages with i18n support (Backend)\n *\n * Usage with .refine():\n * ```typescript\n * const schema = z.string().refine(\n * (val) => val.length > 5,\n * withI18n('validation.minLength', { min: 5 })\n * )\n * ```\n *\n * Usage with built-in validators:\n * ```typescript\n * const schema = z.string().min(5, withI18n('validation.minLength', { min: 5 }))\n * const schema = z.string().email(withI18n('validation.email'))\n * ```\n *\n * Note: This is the backend version using AsyncLocalStorage.\n * For frontend, use withI18nFrontend from the frontend validation module\n *\n * @param key - Message key from shared i18n messages (type-safe via MessageKeys)\n * @param params - Optional interpolation parameters for the message\n * @returns Zod error configuration object with translated message\n */\nexport function withI18n(\n key: MessageKeys,\n params?: Record<string, unknown>\n): { error: () => string } {\n return {\n error: () => {\n // Get i18n context from AsyncLocalStorage (backend)\n // This is set by the router middleware before validation\n const context = errorMapContextStorage.getStore()\n\n // Translate using context if available, otherwise fallback to generic message\n const message = context\n ? context.t(key, params as Record<string, string | number> | undefined)\n : 'Invalid input'\n\n return message\n },\n }\n}\n","// Consolidated zod - single source from @hono/zod-openapi (superset of zod)\nexport { OpenAPIHono, z } from '@hono/zod-openapi'\nexport type * from 'zod'\nexport { ZodError } from 'zod'\n\n// OpenAPI utilities\nexport * from '@hono/zod-openapi'\nexport type { OpenAPIObject, PathItemObject } from 'openapi3-ts/oas30'\n\n// Helpers\nexport { withI18n } from './with-i18n'\n\n// Backend utilities\nexport { backendErrorMap, runWithErrorMapContext } from './validation.context'\n\n// Types\nexport type { ErrorMapContext, I18nErrorMetadata, LocaleProvider, ZodCustomIssue } from './validation.types'\n\n"],"mappings":";;;;;;;;AAkBA,SAAS,cAAc,OAAkE;AACvF,QAAO,MAAM,SAA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,EACL,aAAa;EAGX,MAAM,UAAU,uBAAuB,UAAU;AAOjD,SAJgB,UACZ,QAAQ,EAAE,KAAK,OAAsD,GACrE;IAIP"}
@@ -1,5 +1,5 @@
1
- import { B as ContextQueryResult, V as RouterContext, Yn as RouterEnv, d as ApplicationError, zn as ControllerOptions } from "../index-BrmS34sa.mjs";
2
- import { t as Constructor } from "../types-CN0zONAZ.mjs";
1
+ import { B as ContextQueryResult, Bn as ControllerOptions, V as RouterContext, Xn as RouterEnv, d as ApplicationError } from "../index-DPFqRs8L.mjs";
2
+ import { t as Constructor } from "../types-DIWemRad.mjs";
3
3
  import { Context } from "hono";
4
4
  import { WSContext, WSContext as WSContext$1, WSEvents, WSMessageReceive, WSReadyState, WSReadyState as WSReadyState$1 } from "hono/ws";
5
5
 
@@ -8,7 +8,7 @@ import { WSContext, WSContext as WSContext$1, WSEvents, WSMessageReceive, WSRead
8
8
  * Gateway options for @Gateway() decorator
9
9
  * Subset of ControllerOptions relevant to WebSocket gateways (no OpenAPI-specific fields)
10
10
  */
11
- type GatewayOptions = Pick<ControllerOptions, 'version'>;
11
+ type GatewayOptions = Pick<ControllerOptions, 'version' | 'name' | 'domain'>;
12
12
  //#endregion
13
13
  //#region src/websocket/decorators/gateway.decorator.d.ts
14
14
  /**
@@ -1,2 +1,2 @@
1
- import { a as OnMessage, c as getWsOnMessageMethod, d as isGateway, i as OnError, l as WebSocketDuplicateEventHandlerError, n as WebSocketBodyNotAvailableError, o as getWsOnCloseMethod, r as OnClose, s as getWsOnErrorMethod, t as GatewayContext, u as Gateway } from "../gateway-context-BdBFoQd8.mjs";
1
+ import { a as OnMessage, c as getWsOnMessageMethod, d as isGateway, i as OnError, l as WebSocketDuplicateEventHandlerError, n as WebSocketBodyNotAvailableError, o as getWsOnCloseMethod, r as OnClose, s as getWsOnErrorMethod, t as GatewayContext, u as Gateway } from "../gateway-context-cqZ8wMoi.mjs";
2
2
  export { Gateway, GatewayContext, OnClose, OnError, OnMessage, WebSocketBodyNotAvailableError, WebSocketDuplicateEventHandlerError, getWsOnCloseMethod, getWsOnErrorMethod, getWsOnMessageMethod, isGateway };
@@ -1,4 +1,5 @@
1
- import { Cr as Container, ir as StratalEnv } from "../index-BrmS34sa.mjs";
1
+ import { Cr as Container } from "../index-DPFqRs8L.mjs";
2
+ import { t as StratalEnv } from "../env-CamWD-U1.mjs";
2
3
  import { DurableObject, WorkerEntrypoint, WorkflowEntrypoint } from "cloudflare:workers";
3
4
 
4
5
  //#region src/workers/run-in-scope.d.ts
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/workers/run-in-scope.ts","../../src/workers/stratal-durable-object.ts","../../src/workers/stratal-worker-entrypoint.ts","../../src/workers/stratal-workflow.ts"],"mappings":";;;;;;;AASA;;;iBAAsB,UAAA,GAAA,CACpB,QAAA,GAAW,SAAA,EAAW,SAAA,KAAc,CAAA,GAAI,OAAA,CAAQ,CAAA,IAC/C,OAAA,CAAQ,CAAA;;;;AAFX;;;;;;;;;;;;;;;;;;;;uBCkBsB,oBAAA,aACR,UAAA,GAAa,UAAA,UACjB,aAAA,CAAc,GAAA;EAAA,UACN,UAAA,GAAA,CACd,QAAA,GAAW,SAAA,EAAW,SAAA,KAAc,CAAA,GAAI,OAAA,CAAQ,CAAA,IAC/C,OAAA,CAAQ,CAAA;AAAA;;;;ADvBb;;;;;;;;;;;;;;;;;;;uBEgBsB,uBAAA,aACR,UAAA,GAAa,UAAA,UACjB,gBAAA,CAAiB,GAAA;EAAA,UACf,UAAA,GAAA,CACR,QAAA,GAAW,SAAA,EAAW,SAAA,KAAc,CAAA,GAAI,OAAA,CAAQ,CAAA,IAC/C,OAAA,CAAQ,CAAA;AAAA;;;;AFrBb;;;;;;;;;;;;;;;;;;;uBGgBsB,eAAA,aACR,UAAA,GAAa,UAAA,4BAEjB,kBAAA,CAAmB,GAAA,EAAK,MAAA;EAAA,UACtB,UAAA,GAAA,CACR,QAAA,GAAW,SAAA,EAAW,SAAA,KAAc,CAAA,GAAI,OAAA,CAAQ,CAAA,IAC/C,OAAA,CAAQ,CAAA;AAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/workers/run-in-scope.ts","../../src/workers/stratal-durable-object.ts","../../src/workers/stratal-worker-entrypoint.ts","../../src/workers/stratal-workflow.ts"],"mappings":";;;;;;;;;AASA;;iBAAsB,UAAA,GAAA,CACpB,QAAA,GAAW,SAAA,EAAW,SAAA,KAAc,CAAA,GAAI,OAAA,CAAQ,CAAA,IAC/C,OAAA,CAAQ,CAAA;;;;;AAFX;;;;;;;;;;;;;;;;;;;uBCkBsB,oBAAA,aACR,UAAA,GAAa,UAAA,UACjB,aAAA,CAAc,GAAA;EAAA,UACN,UAAA,GAAA,CACd,QAAA,GAAW,SAAA,EAAW,SAAA,KAAc,CAAA,GAAI,OAAA,CAAQ,CAAA,IAC/C,OAAA,CAAQ,CAAA;AAAA;;;;;ADvBb;;;;;;;;;;;;;;;;;;uBEgBsB,uBAAA,aACR,UAAA,GAAa,UAAA,UACjB,gBAAA,CAAiB,GAAA;EAAA,UACf,UAAA,GAAA,CACR,QAAA,GAAW,SAAA,EAAW,SAAA,KAAc,CAAA,GAAI,OAAA,CAAQ,CAAA,IAC/C,OAAA,CAAQ,CAAA;AAAA;;;;;AFrBb;;;;;;;;;;;;;;;;;;uBGgBsB,eAAA,aACR,UAAA,GAAa,UAAA,4BAEjB,kBAAA,CAAmB,GAAA,EAAK,MAAA;EAAA,UACtB,UAAA,GAAA,CACR,QAAA,GAAW,SAAA,EAAW,SAAA,KAAc,CAAA,GAAI,OAAA,CAAQ,CAAA,IAC/C,OAAA,CAAQ,CAAA;AAAA"}
@@ -1,5 +1,5 @@
1
- import { f as DI_TOKENS } from "../logger-c0ftIK4G.mjs";
2
- import { t as Stratal } from "../stratal-B7G4i9-N.mjs";
1
+ import { f as DI_TOKENS } from "../logger-V6Ms3QnQ.mjs";
2
+ import { t as Stratal } from "../stratal-BCiwCFN9.mjs";
3
3
  import { DurableObject, WorkerEntrypoint, WorkflowEntrypoint } from "cloudflare:workers";
4
4
  //#region src/workers/run-in-scope.ts
5
5
  /**