stratal 0.0.16 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/README.md +4 -0
  2. package/dist/bin/cloudflare-workers-loader.mjs +33 -1
  3. package/dist/bin/cloudflare-workers-loader.mjs.map +1 -1
  4. package/dist/bin/quarry.mjs +183 -55
  5. package/dist/bin/quarry.mjs.map +1 -1
  6. package/dist/cache/index.d.mts +2 -2
  7. package/dist/cache/index.d.mts.map +1 -1
  8. package/dist/cache/index.mjs +3 -11
  9. package/dist/cache/index.mjs.map +1 -1
  10. package/dist/{colors-DJaRDXoS.mjs → colors-BTAnQRGU.mjs} +1 -1
  11. package/dist/{colors-DJaRDXoS.mjs.map → colors-BTAnQRGU.mjs.map} +1 -1
  12. package/dist/{command-B-QH-Vu3.d.mts → command-B1YuV-UZ.d.mts} +2 -2
  13. package/dist/{command-B-QH-Vu3.d.mts.map → command-B1YuV-UZ.d.mts.map} +1 -1
  14. package/dist/{command-BvCOD6df.mjs → command-DjGqCYHv.mjs} +7 -4
  15. package/dist/command-DjGqCYHv.mjs.map +1 -0
  16. package/dist/config/index.d.mts +2 -2
  17. package/dist/config/index.mjs +12 -20
  18. package/dist/config/index.mjs.map +1 -1
  19. package/dist/consumer-registry-BkuHXR_u.d.mts +142 -0
  20. package/dist/consumer-registry-BkuHXR_u.d.mts.map +1 -0
  21. package/dist/cron/index.d.mts +3 -116
  22. package/dist/cron/index.d.mts.map +1 -1
  23. package/dist/cron/index.mjs +1 -4
  24. package/dist/{cron-manager-DR7fiG6o.mjs → cron-manager-1KnZvojs.mjs} +3 -3
  25. package/dist/{cron-manager-DR7fiG6o.mjs.map → cron-manager-1KnZvojs.mjs.map} +1 -1
  26. package/dist/cron-manager-BnEZquBL.d.mts +117 -0
  27. package/dist/cron-manager-BnEZquBL.d.mts.map +1 -0
  28. package/dist/di/index.d.mts +2 -2
  29. package/dist/di/index.mjs +3 -4
  30. package/dist/email/index.d.mts +3 -3
  31. package/dist/email/index.mjs +8 -17
  32. package/dist/email/index.mjs.map +1 -1
  33. package/dist/{en-DaewN8hc.mjs → en-3QnZwP-u.mjs} +10 -1
  34. package/dist/en-3QnZwP-u.mjs.map +1 -0
  35. package/dist/errors/index.d.mts +2 -2
  36. package/dist/errors/index.mjs +2 -4
  37. package/dist/errors--RBIvDXr.mjs +1560 -0
  38. package/dist/errors--RBIvDXr.mjs.map +1 -0
  39. package/dist/{errors-H3TZnVeX.mjs → errors-B7hCnXgB.mjs} +2 -2
  40. package/dist/{errors-H3TZnVeX.mjs.map → errors-B7hCnXgB.mjs.map} +1 -1
  41. package/dist/events/index.d.mts +2 -2
  42. package/dist/events/index.mjs +1 -3
  43. package/dist/{events-CXl-o1Ad.mjs → events-UTJliZhl.mjs} +2 -3
  44. package/dist/{events-CXl-o1Ad.mjs.map → events-UTJliZhl.mjs.map} +1 -1
  45. package/dist/{gateway-context-BkZ4UKaX.mjs → gateway-context-BdBFoQd8.mjs} +66 -10
  46. package/dist/gateway-context-BdBFoQd8.mjs.map +1 -0
  47. package/dist/guards/index.d.mts +3 -3
  48. package/dist/guards/index.d.mts.map +1 -1
  49. package/dist/guards/index.mjs +1 -1
  50. package/dist/{guards-DUk_Kzst.mjs → guards-MtDgcHnF.mjs} +1 -1
  51. package/dist/{guards-DUk_Kzst.mjs.map → guards-MtDgcHnF.mjs.map} +1 -1
  52. package/dist/i18n/index.d.mts +3 -3
  53. package/dist/i18n/index.mjs +3 -16
  54. package/dist/i18n/messages/en/index.d.mts +1 -1
  55. package/dist/i18n/messages/en/index.mjs +1 -1
  56. package/dist/i18n/utils/index.d.mts +30 -0
  57. package/dist/i18n/utils/index.d.mts.map +1 -0
  58. package/dist/i18n/utils/index.mjs +2 -0
  59. package/dist/i18n/validation/index.d.mts +1 -1
  60. package/dist/i18n/validation/index.mjs +1 -1
  61. package/dist/i18n.module-BpLLLCTg.mjs +2462 -0
  62. package/dist/i18n.module-BpLLLCTg.mjs.map +1 -0
  63. package/dist/{index-D_w_Rmtd.d.mts → index-BDh9J2KD.d.mts} +10 -1
  64. package/dist/{index-D_w_Rmtd.d.mts.map → index-BDh9J2KD.d.mts.map} +1 -1
  65. package/dist/{index-Dp6A5ywM.d.mts → index-BR23zDMy.d.mts} +1 -1
  66. package/dist/{index-Dp6A5ywM.d.mts.map → index-BR23zDMy.d.mts.map} +1 -1
  67. package/dist/index-BrmS34sa.d.mts +4287 -0
  68. package/dist/index-BrmS34sa.d.mts.map +1 -0
  69. package/dist/{index-D9iYu2Yc.d.mts → index-DPxmo6AY.d.mts} +5 -144
  70. package/dist/index-DPxmo6AY.d.mts.map +1 -0
  71. package/dist/{index-DVhdhLvE.d.mts → index-Dfpd_ypO.d.mts} +38 -9
  72. package/dist/index-Dfpd_ypO.d.mts.map +1 -0
  73. package/dist/index.d.mts +4 -3
  74. package/dist/index.d.mts.map +1 -1
  75. package/dist/index.mjs +1 -20
  76. package/dist/{is-command-BfCgWAcQ.mjs → is-command-PvULqiTa.mjs} +2 -2
  77. package/dist/{is-command-BfCgWAcQ.mjs.map → is-command-PvULqiTa.mjs.map} +1 -1
  78. package/dist/{is-seeder-CebjZCDn.mjs → is-seeder-BN9Ej1r7.mjs} +1 -1
  79. package/dist/{is-seeder-CebjZCDn.mjs.map → is-seeder-BN9Ej1r7.mjs.map} +1 -1
  80. package/dist/logger/index.d.mts +1 -1
  81. package/dist/logger/index.mjs +1 -2
  82. package/dist/{logger-BR1-s1Um.mjs → logger-c0ftIK4G.mjs} +170 -4
  83. package/dist/logger-c0ftIK4G.mjs.map +1 -0
  84. package/dist/module/index.d.mts +3 -119
  85. package/dist/module/index.d.mts.map +1 -1
  86. package/dist/module/index.mjs +1 -11
  87. package/dist/module-C3YZ-kZN.mjs +719 -0
  88. package/dist/module-C3YZ-kZN.mjs.map +1 -0
  89. package/dist/openapi/index.d.mts +54 -54
  90. package/dist/openapi/index.d.mts.map +1 -1
  91. package/dist/openapi/index.mjs +3 -16
  92. package/dist/openapi-tools.service-B77QXD56.mjs +197 -0
  93. package/dist/openapi-tools.service-B77QXD56.mjs.map +1 -0
  94. package/dist/openapi.service-6yj0BUY4.d.mts +50 -0
  95. package/dist/openapi.service-6yj0BUY4.d.mts.map +1 -0
  96. package/dist/quarry/index.d.mts +124 -29
  97. package/dist/quarry/index.d.mts.map +1 -1
  98. package/dist/quarry/index.mjs +5 -7
  99. package/dist/quarry-registry-CQCIlYTO.mjs +686 -0
  100. package/dist/quarry-registry-CQCIlYTO.mjs.map +1 -0
  101. package/dist/queue/index.d.mts +2 -1
  102. package/dist/queue/index.mjs +3 -14
  103. package/dist/queue/index.mjs.map +1 -1
  104. package/dist/{queue.module-BZvmeAMj.mjs → queue.module-DIjD6nr-.mjs} +39 -42
  105. package/dist/queue.module-DIjD6nr-.mjs.map +1 -0
  106. package/dist/{resend.provider-BCCACQAU.mjs → resend.provider-Bvw36rQy.mjs} +1 -4
  107. package/dist/{resend.provider-BCCACQAU.mjs.map → resend.provider-Bvw36rQy.mjs.map} +1 -1
  108. package/dist/router/index.d.mts +2 -2
  109. package/dist/router/index.mjs +5 -16
  110. package/dist/{s3-storage.provider-BLlzQYiJ.mjs → s3-storage.provider-BAhHDMI3.mjs} +16 -9
  111. package/dist/s3-storage.provider-BAhHDMI3.mjs.map +1 -0
  112. package/dist/seeder/index.d.mts +3 -4
  113. package/dist/seeder/index.d.mts.map +1 -1
  114. package/dist/seeder/index.mjs +2 -7
  115. package/dist/{seeder-Cupi5jl-.mjs → seeder-D7VXULXB.mjs} +20 -17
  116. package/dist/seeder-D7VXULXB.mjs.map +1 -0
  117. package/dist/setup-BRIN-iYT.mjs +37 -0
  118. package/dist/setup-BRIN-iYT.mjs.map +1 -0
  119. package/dist/{smtp.provider-B8XtOcHU.mjs → smtp.provider-CAwpvzvD.mjs} +1 -4
  120. package/dist/{smtp.provider-B8XtOcHU.mjs.map → smtp.provider-CAwpvzvD.mjs.map} +1 -1
  121. package/dist/storage/index.d.mts +2 -195
  122. package/dist/storage/index.d.mts.map +1 -1
  123. package/dist/storage/index.mjs +2 -14
  124. package/dist/storage/providers/index.d.mts +273 -0
  125. package/dist/storage/providers/index.d.mts.map +1 -0
  126. package/dist/storage/providers/index.mjs +2 -0
  127. package/dist/{storage-By_ow2o_.mjs → storage-CJ-QOwNv.mjs} +8 -9
  128. package/dist/storage-CJ-QOwNv.mjs.map +1 -0
  129. package/dist/storage-provider.interface-YRtyYBxV.d.mts +203 -0
  130. package/dist/storage-provider.interface-YRtyYBxV.d.mts.map +1 -0
  131. package/dist/stratal-B7G4i9-N.mjs +502 -0
  132. package/dist/stratal-B7G4i9-N.mjs.map +1 -0
  133. package/dist/{types-DahElfUw.d.mts → types-CN0zONAZ.d.mts} +2 -2
  134. package/dist/types-CN0zONAZ.d.mts.map +1 -0
  135. package/dist/{usage-generator-C9hWziY4.mjs → usage-generator-Cl1HPlUp.mjs} +2 -2
  136. package/dist/{usage-generator-C9hWziY4.mjs.map → usage-generator-Cl1HPlUp.mjs.map} +1 -1
  137. package/dist/{validation-Bh875Lyg.mjs → validation-B4bePOa_.mjs} +5 -5
  138. package/dist/{validation-Bh875Lyg.mjs.map → validation-B4bePOa_.mjs.map} +1 -1
  139. package/dist/websocket/index.d.mts +2 -2
  140. package/dist/websocket/index.d.mts.map +1 -1
  141. package/dist/websocket/index.mjs +1 -5
  142. package/dist/workers/index.d.mts +1 -1
  143. package/dist/workers/index.d.mts.map +1 -1
  144. package/dist/workers/index.mjs +2 -20
  145. package/dist/workers/index.mjs.map +1 -1
  146. package/package.json +39 -31
  147. package/dist/application-zG8b-pol.d.mts +0 -116
  148. package/dist/application-zG8b-pol.d.mts.map +0 -1
  149. package/dist/command-BvCOD6df.mjs.map +0 -1
  150. package/dist/decorate-D5j-d9_z.mjs +0 -171
  151. package/dist/decorate-D5j-d9_z.mjs.map +0 -1
  152. package/dist/en-DaewN8hc.mjs.map +0 -1
  153. package/dist/errors-CtCi1wn6.mjs +0 -707
  154. package/dist/errors-CtCi1wn6.mjs.map +0 -1
  155. package/dist/gateway-context-BkZ4UKaX.mjs.map +0 -1
  156. package/dist/i18n.module-W8OJxg3d.mjs +0 -1791
  157. package/dist/i18n.module-W8OJxg3d.mjs.map +0 -1
  158. package/dist/index-BJWm863C.d.mts +0 -2616
  159. package/dist/index-BJWm863C.d.mts.map +0 -1
  160. package/dist/index-D9iYu2Yc.d.mts.map +0 -1
  161. package/dist/index-DVhdhLvE.d.mts.map +0 -1
  162. package/dist/logger-BR1-s1Um.mjs.map +0 -1
  163. package/dist/middleware/index.d.mts +0 -2
  164. package/dist/middleware/index.mjs +0 -6
  165. package/dist/middleware-C0Ebzswy.mjs +0 -362
  166. package/dist/middleware-C0Ebzswy.mjs.map +0 -1
  167. package/dist/module-BgdxxzBe.mjs +0 -370
  168. package/dist/module-BgdxxzBe.mjs.map +0 -1
  169. package/dist/quarry-registry-DCwqVcRp.mjs +0 -310
  170. package/dist/quarry-registry-DCwqVcRp.mjs.map +0 -1
  171. package/dist/queue.module-BZvmeAMj.mjs.map +0 -1
  172. package/dist/router-context-BEJe9HEB.mjs +0 -264
  173. package/dist/router-context-BEJe9HEB.mjs.map +0 -1
  174. package/dist/s3-storage.provider-BLlzQYiJ.mjs.map +0 -1
  175. package/dist/seeder-Cupi5jl-.mjs.map +0 -1
  176. package/dist/storage-By_ow2o_.mjs.map +0 -1
  177. package/dist/stratal-CE0iTz4f.mjs +0 -305
  178. package/dist/stratal-CE0iTz4f.mjs.map +0 -1
  179. package/dist/types-CLhOhYsQ.d.mts +0 -64
  180. package/dist/types-CLhOhYsQ.d.mts.map +0 -1
  181. package/dist/types-DahElfUw.d.mts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"usage-generator-C9hWziY4.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,cAA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AAIxB,MAAM,UAAU;;AAGhB,SAAS,UAAU,GAAmB;AACpC,QAAO,EAAE,QAAQ,SAAS,GAAG;;AAI/B,MAAM,WAAW;;AAGjB,SAAS,SAAS,MAAc,UAAkB,oBAAsC;AAEtF,KADmB,UAAU,KAAK,CAAC,UACjB,SAAU,QAAO,CAAC,KAAK;CAEzC,MAAM,SAAS,KAAK,MAAM,SAAS,IAAI,CAAC,KAAK;CAE7C,MAAM,QAAkB,EAAE;CAC1B,IAAI,cAAc;CAClB,IAAI,oBAAoB;AAExB,MAAK,MAAM,SAAS,QAAQ;EAC1B,MAAM,eAAe,UAAU,MAAM,CAAC;EACtC,MAAM,YAAY,gBAAgB,KAAK,KAAK;EAC5C,MAAM,eAAe,UAAU;AAE/B,MAAI,gBAAgB,MAAM,oBAAoB,eAAe,eAAe,UAAU;AACpF,SAAM,KAAK,YAAY;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-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,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AM,UAAU;;AAGhB,SAAS,UAAU,GAAmB;AACpC,QAAO,EAAE,QAAQ,SAAS,GAAG;;AAI/B,MAAM,WAAW;;AAGjB,SAAS,SAAS,MAAc,UAAkB,oBAAsC;AAEtF,KADmB,UAAU,KAAK,CAAC,UACjB,SAAU,QAAO,CAAC,KAAK;CAEzC,MAAM,SAAS,KAAK,MAAM,SAAS,IAAI,CAAC,KAAK;CAE7C,MAAM,QAAkB,EAAE;CAC1B,IAAI,cAAc;CAClB,IAAI,oBAAoB;AAExB,MAAK,MAAM,SAAS,QAAQ;EAC1B,MAAM,eAAe,UAAU,MAAM,CAAC;EACtC,MAAM,YAAY,gBAAgB,KAAK,KAAK;EAC5C,MAAM,eAAe,UAAU;AAE/B,MAAI,gBAAgB,MAAM,oBAAoB,eAAe,eAAe,UAAU;AACpF,SAAM,KAAK,YAAY;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,7 +1,7 @@
1
1
  import { n as __reExport, t as __exportAll } from "./chunk-D1SwGrFN.mjs";
2
- import { OpenAPIHono, z } from "@hono/zod-openapi";
3
- import { ZodError } from "zod";
4
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
+ import { OpenAPIHono, z as z$1 } from "@hono/zod-openapi";
4
+ import { ZodError } from "zod";
5
5
  //#region src/i18n/validation/validation.error-map.ts
6
6
  /**
7
7
  * Type guards for narrowing Zod v4 issue types
@@ -184,11 +184,11 @@ var validation_exports = /* @__PURE__ */ __exportAll({
184
184
  backendErrorMap: () => backendErrorMap,
185
185
  runWithErrorMapContext: () => runWithErrorMapContext,
186
186
  withI18n: () => withI18n,
187
- z: () => z
187
+ z: () => z$1
188
188
  });
189
189
  import * as import__hono_zod_openapi from "@hono/zod-openapi";
190
190
  __reExport(validation_exports, import__hono_zod_openapi);
191
191
  //#endregion
192
- export { withI18n as a, z as i, ZodError as n, backendErrorMap as o, validation_exports as r, runWithErrorMapContext as s, OpenAPIHono as t };
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-Bh875Lyg.mjs.map
194
+ //# sourceMappingURL=validation-B4bePOa_.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"validation-Bh875Lyg.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,QAAO,MAAM,SAAS;;AAGxB,SAAS,aAAa,OAAiE;AACrF,QAAO,MAAM,SAAS;;;;;;AAOxB,SAAS,cAAc,OAAkC;AACvD,KAAI,cAAc,M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E;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-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,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@@
1
- import { Et as ControllerOptions, Nt as RouterEnv, Tt as RouterContext, s as ApplicationError, wt as ContextQueryResult } from "../index-BJWm863C.mjs";
2
- import { t as Constructor } from "../types-DahElfUw.mjs";
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";
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
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/websocket/types.ts","../../src/websocket/decorators/gateway.decorator.ts","../../src/websocket/decorators/ws-event.decorator.ts","../../src/websocket/errors/websocket-body-not-available.error.ts","../../src/websocket/errors/websocket-duplicate-event-handler.error.ts","../../src/websocket/gateway-context.ts"],"mappings":";;;;;;;;;;KAMY,cAAA,GAAiB,IAAA,CAAK,iBAAA;;;;;;;;AAAlC;;;;;;;;AC+BA;;;;;;;;;;;;;;;iBAAgB,OAAA,CAAQ,KAAA,UAAe,OAAA,GAAU,cAAA,cACpB,WAAA,EAAa,MAAA,EAAQ,CAAA,KAAC,CAAA;;;;AAiBnD;;;iBAAgB,SAAA,CAAU,MAAA;;;;;;;;;ADjD1B;;;;;;;;iBE4BgB,SAAA,CAAA,GAAa,eAAA;;;;;;;;;;;;;;;iBAsBb,OAAA,CAAA,GAAW,eAAA;;;;ADD3B;;;;;;;;ACrBA;;;iBA0CgB,OAAA,CAAA,GAAW,eAAA;;AApB3B;;iBA6BgB,oBAAA,CAAqB,MAAA,EAAQ,WAAA;;;AAT7C;iBAgBgB,kBAAA,CAAmB,MAAA,EAAQ,WAAA;;;;iBAO3B,kBAAA,CAAmB,MAAA,EAAQ,WAAA;;;cCjG9B,8BAAA,SAAuC,gBAAA;EAAA,WAAA,CAAA;AAAA;;;cCAvC,mCAAA,SAA4C,gBAAA;cAC3C,SAAA,UAAmB,cAAA;AAAA;;;;;AJGjC;;;;;;;;AC+BA;;;;;;;cIba,cAAA,SAAuB,aAAA;EAAA,SACiB,EAAA,EAAI,WAAA;cAA3C,CAAA,EAAG,OAAA,CAAQ,SAAA,GAA4B,EAAA,EAAI,WAAA;EJYR;EIP/C,IAAA,CAAK,IAAA,WAAe,WAAA,GAAc,UAAA,CAAW,WAAA;EJQ5B;EIHjB,KAAA,CAAM,IAAA,WAAe,MAAA;EJG2B;EAAA,IIE5C,UAAA,CAAA,GAAc,cAAA;EJF+B;;;AAiBnD;;EINW,KAAA,CAAM,GAAA;EJMS;;;;;EIGf,KAAA,WAAgB,MAAA,oFAAA,CAA2F,GAAA,GAAM,CAAA,GAAI,kBAAA,CAAmB,CAAA,EAAG,CAAA;EHxB7H;;;;AAsBzB;EGcW,IAAA,GAAA,CAAA,GAAW,OAAA,CAAQ,CAAA;AAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/websocket/types.ts","../../src/websocket/decorators/gateway.decorator.ts","../../src/websocket/decorators/ws-event.decorator.ts","../../src/websocket/errors/websocket-body-not-available.error.ts","../../src/websocket/errors/websocket-duplicate-event-handler.error.ts","../../src/websocket/gateway-context.ts"],"mappings":";;;;;;;;;;KAMY,cAAA,GAAiB,IAAA,CAAK,iBAAA;;;;;;;AAAlC;;;;;;;;AC6BA;;;;;;;;;;;;;;;;iBAAgB,OAAA,CAAQ,KAAA,UAAe,OAAA,GAAU,cAAA,cACpB,WAAA,EAAa,MAAA,EAAQ,CAAA,KAAC,CAAA;;;AAanD;;;;iBAAgB,SAAA,CAAU,MAAA;;;;;;;;AD3C1B;;;;;;;;AC6BA;iBCDgB,SAAA,CAAA,GAAa,eAAA;;;;;;;;;;;;;;;iBAsBb,OAAA,CAAA,GAAW,eAAA;;;ADP3B;;;;;;;;ACfA;;;;iBA0CgB,OAAA,CAAA,GAAW,eAAA;AApB3B;;;AAAA,iBA6BgB,oBAAA,CAAqB,MAAA,EAAQ,WAAA;;AAT7C;;iBAgBgB,kBAAA,CAAmB,MAAA,EAAQ,WAAA;;;AAP3C;iBAcgB,kBAAA,CAAmB,MAAA,EAAQ,WAAA;;;cCjG9B,8BAAA,SAAuC,gBAAA;EAAA,WAAA,CAAA;AAAA;;;cCAvC,mCAAA,SAA4C,gBAAA;cAC3C,SAAA,UAAmB,cAAA;AAAA;;;;AJGjC;;;;;;;;AC6BA;;;;;;;;cIXa,cAAA,SAAuB,aAAA;EAAA,SACiB,EAAA,EAAI,WAAA;cAA3C,CAAA,EAAG,OAAA,CAAQ,SAAA,GAA4B,EAAA,EAAI,WAAA;EJUlB;EILrC,IAAA,CAAK,IAAA,WAAe,WAAA,GAAc,UAAA,CAAW,WAAA;EJMlB;EID3B,KAAA,CAAM,IAAA,WAAe,MAAA;EJCmB;EAAA,IIIpC,UAAA,CAAA,GAAc,cAAA;EJJ+B;;AAanD;;;EIAW,KAAA,CAAM,GAAA;EJAuB;;;;ACfxC;EGwBW,KAAA,WAAgB,MAAA,oFAAA,CAA2F,GAAA,GAAM,CAAA,GAAI,kBAAA,CAAmB,CAAA,EAAG,CAAA;;;;AHFtJ;;EGcW,IAAA,GAAA,CAAA,GAAW,OAAA,CAAQ,CAAA;AAAA"}
@@ -1,6 +1,2 @@
1
- import "../errors-CtCi1wn6.mjs";
2
- import "../decorate-D5j-d9_z.mjs";
3
- import "../logger-BR1-s1Um.mjs";
4
- import "../router-context-BEJe9HEB.mjs";
5
- 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-BkZ4UKaX.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-BdBFoQd8.mjs";
6
2
  export { Gateway, GatewayContext, OnClose, OnError, OnMessage, WebSocketBodyNotAvailableError, WebSocketDuplicateEventHandlerError, getWsOnCloseMethod, getWsOnErrorMethod, getWsOnMessageMethod, isGateway };
@@ -1,4 +1,4 @@
1
- import { $t as Container, Ht as StratalEnv } from "../index-BJWm863C.mjs";
1
+ import { Cr as Container, ir as StratalEnv } from "../index-BrmS34sa.mjs";
2
2
  import { DurableObject, WorkerEntrypoint, WorkflowEntrypoint } from "cloudflare:workers";
3
3
 
4
4
  //#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,23 +1,5 @@
1
- import "../errors-CtCi1wn6.mjs";
2
- import { l as DI_TOKENS } from "../decorate-D5j-d9_z.mjs";
3
- import "../logger-BR1-s1Um.mjs";
4
- import "../module-BgdxxzBe.mjs";
5
- import "../events-CXl-o1Ad.mjs";
6
- import "../colors-DJaRDXoS.mjs";
7
- import "../command-BvCOD6df.mjs";
8
- import "../is-command-BfCgWAcQ.mjs";
9
- import "../is-seeder-CebjZCDn.mjs";
10
- import "../middleware-C0Ebzswy.mjs";
11
- import "../router-context-BEJe9HEB.mjs";
12
- import "../cron-manager-DR7fiG6o.mjs";
13
- import "../validation-Bh875Lyg.mjs";
14
- import "../i18n.module-W8OJxg3d.mjs";
15
- import "../guards-DUk_Kzst.mjs";
16
- import "../gateway-context-BkZ4UKaX.mjs";
17
- import "../quarry-registry-DCwqVcRp.mjs";
18
- import "../queue.module-BZvmeAMj.mjs";
19
- import "../seeder-Cupi5jl-.mjs";
20
- import { t as Stratal } from "../stratal-CE0iTz4f.mjs";
1
+ import { f as DI_TOKENS } from "../logger-c0ftIK4G.mjs";
2
+ import { t as Stratal } from "../stratal-B7G4i9-N.mjs";
21
3
  import { DurableObject, WorkerEntrypoint, WorkflowEntrypoint } from "cloudflare:workers";
22
4
  //#region src/workers/run-in-scope.ts
23
5
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","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"],"sourcesContent":["import type { Container } from '../di/container'\nimport { Stratal } from '../stratal'\n\n/**\n * Shared helper that creates a request-scoped DI container by accessing the\n * Stratal Application via the static singleton.\n *\n * Works with Durable Objects, Workflows, and WorkerEntrypoints.\n */\nexport async function runInScope<T>(\n callback: (container: Container) => T | Promise<T>\n): Promise<T> {\n const app = await Stratal.resolveApplication()\n const mockCtx = app.createMockRouterContext('en')\n return app.container.runInRequestScope(mockCtx, callback)\n}\n","import { DurableObject } from 'cloudflare:workers'\nimport type { Container } from '../di/container'\nimport { DI_TOKENS } from '../di/tokens'\nimport type { StratalEnv } from '../env'\nimport { runInScope } from './run-in-scope'\n\n/**\n * Base class for Durable Objects with full DI access.\n *\n * Extends Cloudflare's `DurableObject` and provides a `runInScope()` helper\n * that creates a request-scoped container with `DurableObjectState` and\n * `DurableObjectId` tokens registered.\n *\n * @example\n * ```typescript\n * import { StratalDurableObject } from 'stratal/workers'\n *\n * export class Counter extends StratalDurableObject {\n * async increment() {\n * return this.runInScope(async (container) => {\n * const svc = container.resolve(CounterService)\n * return svc.increment()\n * })\n * }\n * }\n * ```\n */\nexport abstract class StratalDurableObject<\n Env extends StratalEnv = StratalEnv\n> extends DurableObject<Env> {\n protected async runInScope<T>(\n callback: (container: Container) => T | Promise<T>\n ): Promise<T> {\n return runInScope(async (requestContainer) => {\n requestContainer.registerValue(DI_TOKENS.DurableObjectState, this.ctx)\n requestContainer.registerValue(DI_TOKENS.DurableObjectId, this.ctx.id)\n return callback(requestContainer)\n })\n }\n}\n","import { WorkerEntrypoint } from 'cloudflare:workers'\nimport type { Container } from '../di/container'\nimport type { StratalEnv } from '../env'\nimport { runInScope } from './run-in-scope'\n\n/**\n * Base class for Cloudflare WorkerEntrypoints (Service Bindings / RPC) with full DI access.\n *\n * Extends Cloudflare's `WorkerEntrypoint` and provides a `runInScope()` helper\n * that creates a request-scoped DI container.\n *\n * @example\n * ```typescript\n * import { StratalWorkerEntrypoint } from 'stratal/workers'\n *\n * export class AuthRpc extends StratalWorkerEntrypoint {\n * async verifyToken(token: string) {\n * return this.runInScope(async (container) => {\n * const auth = container.resolve(AuthService)\n * return auth.verify(token)\n * })\n * }\n * }\n * ```\n */\nexport abstract class StratalWorkerEntrypoint<\n Env extends StratalEnv = StratalEnv\n> extends WorkerEntrypoint<Env> {\n protected runInScope<T>(\n callback: (container: Container) => T | Promise<T>\n ): Promise<T> {\n return runInScope(callback)\n }\n}\n","import { WorkflowEntrypoint } from 'cloudflare:workers'\nimport type { Container } from '../di/container'\nimport type { StratalEnv } from '../env'\nimport { runInScope } from './run-in-scope'\n\n/**\n * Base class for Cloudflare Workflows with full DI access.\n *\n * Extends Cloudflare's `WorkflowEntrypoint` and provides a `runInScope()` helper\n * that creates a request-scoped DI container.\n *\n * @example\n * ```typescript\n * import { StratalWorkflow } from 'stratal/workers'\n *\n * export class MyWorkflow extends StratalWorkflow<Env, { userId: string }> {\n * async run(event: WorkflowEvent<{ userId: string }>, step: WorkflowStep) {\n * await this.runInScope(async (container) => {\n * const svc = container.resolve(UserService)\n * await svc.process(event.payload.userId)\n * })\n * }\n * }\n * ```\n */\nexport abstract class StratalWorkflow<\n Env extends StratalEnv = StratalEnv,\n Params = unknown\n> extends WorkflowEntrypoint<Env, Params> {\n protected runInScope<T>(\n callback: (container: Container) => T | Promise<T>\n ): Promise<T> {\n return runInScope(callback)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,eAAsB,WACpB,UACY;CACZ,MAAM,MAAM,MAAM,QAAQ,oBAAoB;CAC9C,MAAM,UAAU,IAAI,wBAAwB,KAAK;AACjD,QAAO,IAAI,UAAU,kBAAkB,SAAS,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;ACa3D,IAAsB,uBAAtB,cAEU,cAAmB;CAC3B,MAAgB,WACd,UACY;AACZ,SAAO,WAAW,OAAO,qBAAqB;AAC5C,oBAAiB,cAAc,UAAU,oBAAoB,KAAK,IAAI;AACtE,oBAAiB,cAAc,UAAU,iBAAiB,KAAK,IAAI,GAAG;AACtE,UAAO,SAAS,iBAAiB;IACjC;;;;;;;;;;;;;;;;;;;;;;;;;ACZN,IAAsB,0BAAtB,cAEU,iBAAsB;CAC9B,WACE,UACY;AACZ,SAAO,WAAW,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;ACN/B,IAAsB,kBAAtB,cAGU,mBAAgC;CACxC,WACE,UACY;AACZ,SAAO,WAAW,SAAS"}
1
+ {"version":3,"file":"index.mjs","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"],"sourcesContent":["import type { Container } from '../di/container'\nimport { Stratal } from '../stratal'\n\n/**\n * Shared helper that creates a request-scoped DI container by accessing the\n * Stratal Application via the static singleton.\n *\n * Works with Durable Objects, Workflows, and WorkerEntrypoints.\n */\nexport async function runInScope<T>(\n callback: (container: Container) => T | Promise<T>\n): Promise<T> {\n const app = await Stratal.resolveApplication()\n const mockCtx = app.createMockRouterContext('en')\n return app.container.runInRequestScope(mockCtx, callback)\n}\n","import { DurableObject } from 'cloudflare:workers'\nimport type { Container } from '../di/container'\nimport { DI_TOKENS } from '../di/tokens'\nimport type { StratalEnv } from '../env'\nimport { runInScope } from './run-in-scope'\n\n/**\n * Base class for Durable Objects with full DI access.\n *\n * Extends Cloudflare's `DurableObject` and provides a `runInScope()` helper\n * that creates a request-scoped container with `DurableObjectState` and\n * `DurableObjectId` tokens registered.\n *\n * @example\n * ```typescript\n * import { StratalDurableObject } from 'stratal/workers'\n *\n * export class Counter extends StratalDurableObject {\n * async increment() {\n * return this.runInScope(async (container) => {\n * const svc = container.resolve(CounterService)\n * return svc.increment()\n * })\n * }\n * }\n * ```\n */\nexport abstract class StratalDurableObject<\n Env extends StratalEnv = StratalEnv\n> extends DurableObject<Env> {\n protected async runInScope<T>(\n callback: (container: Container) => T | Promise<T>\n ): Promise<T> {\n return runInScope(async (requestContainer) => {\n requestContainer.registerValue(DI_TOKENS.DurableObjectState, this.ctx)\n requestContainer.registerValue(DI_TOKENS.DurableObjectId, this.ctx.id)\n return callback(requestContainer)\n })\n }\n}\n","import { WorkerEntrypoint } from 'cloudflare:workers'\nimport type { Container } from '../di/container'\nimport type { StratalEnv } from '../env'\nimport { runInScope } from './run-in-scope'\n\n/**\n * Base class for Cloudflare WorkerEntrypoints (Service Bindings / RPC) with full DI access.\n *\n * Extends Cloudflare's `WorkerEntrypoint` and provides a `runInScope()` helper\n * that creates a request-scoped DI container.\n *\n * @example\n * ```typescript\n * import { StratalWorkerEntrypoint } from 'stratal/workers'\n *\n * export class AuthRpc extends StratalWorkerEntrypoint {\n * async verifyToken(token: string) {\n * return this.runInScope(async (container) => {\n * const auth = container.resolve(AuthService)\n * return auth.verify(token)\n * })\n * }\n * }\n * ```\n */\nexport abstract class StratalWorkerEntrypoint<\n Env extends StratalEnv = StratalEnv\n> extends WorkerEntrypoint<Env> {\n protected runInScope<T>(\n callback: (container: Container) => T | Promise<T>\n ): Promise<T> {\n return runInScope(callback)\n }\n}\n","import { WorkflowEntrypoint } from 'cloudflare:workers'\nimport type { Container } from '../di/container'\nimport type { StratalEnv } from '../env'\nimport { runInScope } from './run-in-scope'\n\n/**\n * Base class for Cloudflare Workflows with full DI access.\n *\n * Extends Cloudflare's `WorkflowEntrypoint` and provides a `runInScope()` helper\n * that creates a request-scoped DI container.\n *\n * @example\n * ```typescript\n * import { StratalWorkflow } from 'stratal/workers'\n *\n * export class MyWorkflow extends StratalWorkflow<Env, { userId: string }> {\n * async run(event: WorkflowEvent<{ userId: string }>, step: WorkflowStep) {\n * await this.runInScope(async (container) => {\n * const svc = container.resolve(UserService)\n * await svc.process(event.payload.userId)\n * })\n * }\n * }\n * ```\n */\nexport abstract class StratalWorkflow<\n Env extends StratalEnv = StratalEnv,\n Params = unknown\n> extends WorkflowEntrypoint<Env, Params> {\n protected runInScope<T>(\n callback: (container: Container) => T | Promise<T>\n ): Promise<T> {\n return runInScope(callback)\n }\n}\n"],"mappings":";;;;;;;;;;AASA,eAAsB,WACpB,UACY;CACZ,MAAM,MAAM,MAAM,QAAQ,oBAAoB;CAC9C,MAAM,UAAU,IAAI,wBAAwB,KAAK;AACjD,QAAO,IAAI,UAAU,kBAAkB,SAAS,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;ACa3D,IAAsB,uBAAtB,cAEU,cAAmB;CAC3B,MAAgB,WACd,UACY;AACZ,SAAO,WAAW,OAAO,qBAAqB;AAC5C,oBAAiB,cAAc,UAAU,oBAAoB,KAAK,IAAI;AACtE,oBAAiB,cAAc,UAAU,iBAAiB,KAAK,IAAI,GAAG;AACtE,UAAO,SAAS,iBAAiB;IACjC;;;;;;;;;;;;;;;;;;;;;;;;;ACZN,IAAsB,0BAAtB,cAEU,iBAAsB;CAC9B,WACE,UACY;AACZ,SAAO,WAAW,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;ACN/B,IAAsB,kBAAtB,cAGU,mBAAgC;CACxC,WACE,UACY;AACZ,SAAO,WAAW,SAAS"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stratal",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "description": "A modular Cloudflare Workers framework with dependency injection, queue-based events, and type-safe configuration",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -34,7 +34,8 @@
34
34
  "provenance": true
35
35
  },
36
36
  "bin": {
37
- "quarry": "./dist/bin/quarry.mjs"
37
+ "quarry": "./dist/bin/quarry.mjs",
38
+ "stratal": "./dist/bin/quarry.mjs"
38
39
  },
39
40
  "files": [
40
41
  "dist",
@@ -85,14 +86,14 @@
85
86
  "types": "./dist/i18n/messages/en/index.d.mts",
86
87
  "import": "./dist/i18n/messages/en/index.mjs"
87
88
  },
89
+ "./i18n/utils": {
90
+ "types": "./dist/i18n/utils/index.d.mts",
91
+ "import": "./dist/i18n/utils/index.mjs"
92
+ },
88
93
  "./logger": {
89
94
  "types": "./dist/logger/index.d.mts",
90
95
  "import": "./dist/logger/index.mjs"
91
96
  },
92
- "./middleware": {
93
- "types": "./dist/middleware/index.d.mts",
94
- "import": "./dist/middleware/index.mjs"
95
- },
96
97
  "./module": {
97
98
  "types": "./dist/module/index.d.mts",
98
99
  "import": "./dist/module/index.mjs"
@@ -121,6 +122,10 @@
121
122
  "types": "./dist/storage/index.d.mts",
122
123
  "import": "./dist/storage/index.mjs"
123
124
  },
125
+ "./storage/providers": {
126
+ "types": "./dist/storage/providers/index.d.mts",
127
+ "import": "./dist/storage/providers/index.mjs"
128
+ },
124
129
  "./websocket": {
125
130
  "types": "./dist/websocket/index.d.mts",
126
131
  "import": "./dist/websocket/index.mjs"
@@ -146,32 +151,34 @@
146
151
  "test:watch": "vitest",
147
152
  "test:integration": "vitest run --project workerd",
148
153
  "test:coverage": "vitest run --coverage",
149
- "lint": "npx eslint .",
150
- "lint:fix": "npx eslint --fix ."
154
+ "lint": "npx oxlint .",
155
+ "lint:fix": "npx oxlint --fix ."
151
156
  },
152
157
  "dependencies": {
153
158
  "@hono/swagger-ui": "^0.6.1",
154
- "@hono/zod-openapi": "^1.2.2",
159
+ "@hono/zod-openapi": "^1.2.3",
155
160
  "@intlify/core-base": "^11.3.0",
156
161
  "@intlify/message-compiler": "^11.3.0",
162
+ "@modelcontextprotocol/sdk": "^1.28.0",
157
163
  "@swc-node/register": "^1.11.1",
158
- "@swc/core": "^1.11.29",
164
+ "@swc/core": "^1.15.21",
165
+ "@swc/helpers": "^0.5.20",
159
166
  "@xmldom/xmldom": "^0.8.11",
160
167
  "clipanion": "^4.0.0-rc.4",
161
- "hono": "^4.12.8",
168
+ "hono": "^4.12.9",
162
169
  "tsyringe": "^4.10.0",
163
170
  "zod": "^4.3.6"
164
171
  },
165
172
  "peerDependencies": {
166
- "@aws-sdk/client-s3": "^3.700.0",
167
- "@aws-sdk/lib-storage": "^3.700.0",
168
- "@aws-sdk/s3-request-presigner": "^3.700.0",
169
- "@react-email/components": "^1.0.0",
170
- "nodemailer": ">=7.0.0",
171
- "react": "^19.0.0",
172
- "react-dom": "^19.0.0",
173
- "reflect-metadata": "^0.2.2",
174
- "resend": "^6.0.0"
173
+ "@aws-sdk/client-s3": ">=3",
174
+ "@aws-sdk/lib-storage": ">=3",
175
+ "@aws-sdk/s3-request-presigner": ">=3",
176
+ "@react-email/components": ">=1",
177
+ "nodemailer": ">=7",
178
+ "react": ">=19",
179
+ "react-dom": ">=19",
180
+ "reflect-metadata": ">=0.2",
181
+ "resend": ">=6"
175
182
  },
176
183
  "peerDependenciesMeta": {
177
184
  "@aws-sdk/client-s3": {
@@ -200,10 +207,10 @@
200
207
  }
201
208
  },
202
209
  "devDependencies": {
203
- "@aws-sdk/client-s3": "3.1011.0",
204
- "@aws-sdk/lib-storage": "^3.1011.0",
205
- "@aws-sdk/s3-request-presigner": "3.1011.0",
206
- "@cloudflare/vitest-pool-workers": "^0.13.2",
210
+ "@aws-sdk/client-s3": "3.1019.0",
211
+ "@aws-sdk/lib-storage": "^3.1019.0",
212
+ "@aws-sdk/s3-request-presigner": "3.1019.0",
213
+ "@cloudflare/vitest-pool-workers": "^0.13.5",
207
214
  "@cloudflare/workers-types": "4.20260317.1",
208
215
  "@react-email/components": "^1.0.10",
209
216
  "@stratal/testing": "workspace:*",
@@ -211,16 +218,17 @@
211
218
  "@types/nodemailer": "^7.0.11",
212
219
  "@types/react": "^19.2.14",
213
220
  "@types/react-dom": "^19.2.3",
214
- "@vitest/coverage-v8": "^4.1.0",
215
- "@vitest/runner": "~4.1.0",
216
- "@vitest/snapshot": "~4.1.0",
217
- "nodemailer": "^8.0.2",
221
+ "@vitest/coverage-v8": "^4.1.2",
222
+ "@vitest/runner": "~4.1.2",
223
+ "@vitest/snapshot": "~4.1.2",
224
+ "jsonc-parser": "^3.3.1",
225
+ "nodemailer": "^8.0.4",
218
226
  "react": "^19.2.4",
219
227
  "react-dom": "^19.2.4",
220
228
  "reflect-metadata": "^0.2.2",
221
229
  "resend": "^6.9.4",
222
- "tsdown": "^0.21.4",
223
- "typescript": "^5.9.3",
224
- "vitest": "~4.1.0"
230
+ "tsdown": "^0.21.6",
231
+ "typescript": "^6.0.2",
232
+ "vitest": "~4.1.2"
225
233
  }
226
234
  }
@@ -1,116 +0,0 @@
1
- import { $t as Container, Ht as StratalEnv, It as VersioningOptions, Tt as RouterContext, U as HonoApp, ct as ModuleClass, it as DynamicModule } from "./index-BJWm863C.mjs";
2
- import { l as LogLevel } from "./index-Dp6A5ywM.mjs";
3
- import { r as CommandResult, t as CommandInput } from "./types-CLhOhYsQ.mjs";
4
-
5
- //#region src/execution-context.d.ts
6
- interface StratalExecutionContext {
7
- waitUntil(promise: Promise<unknown>): void;
8
- }
9
- //#endregion
10
- //#region src/application.d.ts
11
- interface ApplicationConfig {
12
- /** Root application module */
13
- module: ModuleClass | DynamicModule;
14
- /** Logging configuration. Defaults: level=INFO, formatter='json' */
15
- logging?: {
16
- level?: LogLevel;
17
- formatter?: 'json' | 'pretty';
18
- };
19
- /**
20
- * API versioning configuration.
21
- * When provided, enables URI-based versioning for controllers.
22
- */
23
- versioning?: VersioningOptions;
24
- }
25
- interface ApplicationOptions extends ApplicationConfig {
26
- env: StratalEnv;
27
- ctx: StratalExecutionContext;
28
- }
29
- /**
30
- * Application
31
- *
32
- * Main application class managing the two-tier container hierarchy:
33
- * - Global Container: All services (singletons via tsyringe native)
34
- * - Request Container: Child of global, context-enriched instances per request
35
- *
36
- * @example
37
- * ```typescript
38
- * const app = new Application({ module: AppModule, env, ctx })
39
- * await app.initialize()
40
- *
41
- * // Access container via getter
42
- * const service = app.container.resolve(MY_TOKEN)
43
- *
44
- * // Handle HTTP request (via HonoApp)
45
- * // Handle queue batch
46
- * await app.handleQueue(batch, 'my-queue')
47
- * ```
48
- */
49
- declare class Application {
50
- /**
51
- * Unified Container - manages all DI operations
52
- */
53
- private _container;
54
- private honoApp;
55
- private moduleRegistry;
56
- private consumerRegistry;
57
- private cronManager;
58
- private quarry;
59
- private initialized;
60
- readonly env: StratalEnv;
61
- private readonly appConfig;
62
- constructor({
63
- env,
64
- ctx,
65
- ...config
66
- }: ApplicationOptions);
67
- /**
68
- * Get the Container instance
69
- */
70
- get container(): Container;
71
- /**
72
- * Get the HonoApp instance
73
- */
74
- get hono(): HonoApp;
75
- initialize(): Promise<void>;
76
- /**
77
- * Resolve a service from the container
78
- */
79
- resolve<T>(token: symbol): T;
80
- /**
81
- * Handle queue batch processing
82
- */
83
- handleQueue(batch: MessageBatch, queueName: string): Promise<void>;
84
- /**
85
- * Handle scheduled cron trigger
86
- */
87
- handleScheduled(controller: ScheduledController): Promise<void>;
88
- /**
89
- * Create mock RouterContext for queue/cron/seeder processing
90
- */
91
- createMockRouterContext(locale?: string): RouterContext;
92
- shutdown(): Promise<void>;
93
- /**
94
- * Execute a command by name in a request-scoped container.
95
- */
96
- handleCommand(name: string, input?: CommandInput): Promise<CommandResult>;
97
- private registerCommands;
98
- private registerSeeders;
99
- private registerQueueConsumers;
100
- private registerCronJobs;
101
- /**
102
- * Auto-wire `@Listener()` classes with the EventRegistry.
103
- */
104
- private registerEventListeners;
105
- /**
106
- * Register LoggerService and dependencies
107
- */
108
- private registerLoggerService;
109
- /**
110
- * Register core services with explicit scope
111
- */
112
- private registerCoreServices;
113
- }
114
- //#endregion
115
- export { StratalExecutionContext as i, ApplicationConfig as n, ApplicationOptions as r, Application as t };
116
- //# sourceMappingURL=application-zG8b-pol.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"application-zG8b-pol.d.mts","names":[],"sources":["../src/execution-context.ts","../src/application.ts"],"mappings":";;;;;UAAiB,uBAAA;EACf,SAAA,CAAU,OAAA,EAAS,OAAA;AAAA;;;UC6BJ,iBAAA;ED7BI;EC+BnB,MAAA,EAAQ,WAAA,GAAc,aAAA;ED/Ba;ECiCnC,OAAA;IACE,KAAA,GAAQ,QAAA;IACR,SAAA;EAAA;EANa;;;;EAYf,UAAA,GAAa,iBAAA;AAAA;AAAA,UAGE,kBAAA,SAA2B,iBAAA;EAC1C,GAAA,EAAK,UAAA;EACL,GAAA,EAAK,uBAAA;AAAA;;;;;;;;;;;AAFP;;;;;;;;;;cAyBa,WAAA;EAvBX;;;EAAA,QA2BQ,UAAA;EAAA,QAEA,OAAA;EAAA,QACA,cAAA;EAAA,QACA,gBAAA;EAAA,QACA,WAAA;EAAA,QACA,MAAA;EAAA,QACA,WAAA;EAAA,SAEC,GAAA,EAAK,UAAA;EAAA,iBACG,SAAA;;IAEH,GAAA;IAAK,GAAA;IAAA,GAAQ;EAAA,GAAU,kBAAA;EA0CjB;;;EAAA,IAXhB,SAAA,CAAA,GAAa,SAAA;EAwFiB;;;EAAA,IAjF9B,IAAA,CAAA,GAAQ,OAAA;EAIN,UAAA,CAAA,GAAc,OAAA;EAqH6C;;;EAzEjE,OAAA,GAAA,CAAW,KAAA,WAAgB,CAAA;EAlGnB;;;EA+GF,WAAA,CAAY,KAAA,EAAO,YAAA,EAAc,SAAA,WAAoB,OAAA;EA1GnD;;;EA8HF,eAAA,CAAgB,UAAA,EAAY,mBAAA,GAAsB,OAAA;EA1H1C;;;EA2Id,uBAAA,CAAwB,MAAA,YAAgB,aAAA;EAQlC,QAAA,CAAA,GAAY,OAAA;EAhJC;;;EA+Jb,aAAA,CAAc,IAAA,UAAc,KAAA,GAAQ,YAAA,GAAe,OAAA,CAAQ,aAAA;EAAA,QAOzD,gBAAA;EAAA,QAoBA,eAAA;EAAA,QASA,sBAAA;EAAA,QAOA,gBAAA;EAhKF;;;EAAA,QA0KE,sBAAA;EA9HG;;;EAAA,QAmJH,qBAAA;EAtIU;;;EAAA,QA0JV,oBAAA;AAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"command-BvCOD6df.mjs","names":[],"sources":["../src/quarry/constants.ts","../src/quarry/errors/command.error.ts","../src/quarry/command.ts"],"sourcesContent":["/**\n * Symbol key for storing internal mutable state on Command instances.\n * Keeps internal state hidden from user-facing autocomplete.\n */\nexport const COMMAND_INTERNALS = Symbol.for('stratal:command:internals')\n","/**\n * User-facing command error with a plain English message.\n *\n * Quarry catches this in `call()` and puts the message into `CommandResult.errors`.\n * Does NOT extend `ApplicationError` (which requires i18n keys + error codes).\n * Not routed through GlobalErrorHandler.\n */\nexport class CommandError extends Error {\n constructor(message: string) {\n super(message)\n this.name = 'CommandError'\n }\n}\n","import 'reflect-metadata'\n\nimport { bold, cyan, dim, green, red, yellow } from './colors'\nimport { COMMAND_INTERNALS } from './constants'\nimport { CommandError } from './errors/command.error'\nimport type { CommandInput, CommandInternals, CommandResult } from './types'\n\n/**\n * Abstract base class for Quarry commands.\n *\n * Subclasses define a static `command` signature string and implement `handle()`.\n *\n * @example\n * ```typescript\n * export class GreetCommand extends Command {\n * static command = 'greet {name : The name to greet} {--loud}'\n * static description = 'Greet someone'\n *\n * async handle(): Promise<void> {\n * const name = this.string('name')\n * const loud = this.boolean('loud')\n * this.info(loud ? `HELLO, ${name.toUpperCase()}!` : `Hello, ${name}!`)\n * }\n * }\n * ```\n */\nexport abstract class Command {\n /**\n * Laravel-style command signature string.\n *\n * **Command names:**\n * - `'greet'` — flat command (`quarry greet`)\n * - `'task add'` — subcommand hierarchy via spaces (`quarry task add`)\n * - `'task:add'` — namespaced flat command via colons (`quarry task:add`)\n *\n * **Arguments:**\n * - `{name}` — required argument\n * - `{name?}` — optional argument\n * - `{name=default}` — argument with default value\n * - `{name*}` — array/variadic argument\n * - `{name : description}` — argument with description\n *\n * **Options:**\n * - `{--flag}` — boolean flag\n * - `{--name=}` — option that accepts a value\n * - `{--name=default}` — option with default value\n * - `{--name=*}` — array option (multiple values)\n * - `{--A|name}` — option with single-char alias\n * - `{--name= : description}` — option with description\n *\n * @example\n * ```typescript\n * // Namespaced flat command: `quarry users:create ...`\n * static command = 'users:create {email : The user email} {--A|admin} {--R|role= : Assign a role}'\n *\n * // Subcommand hierarchy: `quarry users create ...`\n * static command = 'users create {email : The user email} {--A|admin} {--R|role= : Assign a role}'\n * ```\n */\n static command: string\n /** Human-readable description */\n static description?: string\n /** Alternative command names */\n static aliases?: string[];\n\n [COMMAND_INTERNALS]: CommandInternals\n\n constructor() {\n this[COMMAND_INTERNALS] = {\n inputs: {},\n output: [],\n errors: [],\n exitCode: 0,\n quarry: null,\n }\n }\n\n /**\n * Implement this method with the command's logic.\n * Return a number to set the exit code, or void for exit code 0.\n */\n // eslint-disable-next-line @typescript-eslint/no-invalid-void-type\n abstract handle(): number | void | Promise<number | void>\n\n // ── Input Accessors ──────────────────────────────────────────────\n\n /**\n * Get an input value with generic type.\n */\n input<T>(name: string): T {\n return this[COMMAND_INTERNALS].inputs[name] as T\n }\n\n /**\n * Get a string input. Throws CommandError if present but not a string.\n */\n string(name: string): string {\n const value = this[COMMAND_INTERNALS].inputs[name]\n if (value === undefined || value === null) {\n return ''\n }\n if (typeof value !== 'string') {\n throw new CommandError(`Input \"${name}\" expected a string, got ${typeof value}`)\n }\n return value\n }\n\n /**\n * Get a boolean input. Throws CommandError if present but not a boolean.\n */\n boolean(name: string): boolean {\n const value = this[COMMAND_INTERNALS].inputs[name]\n if (value === undefined || value === null) {\n return false\n }\n if (typeof value !== 'boolean') {\n throw new CommandError(`Input \"${name}\" expected a boolean, got ${typeof value}`)\n }\n return value\n }\n\n /**\n * Get a number input. Coerces strings to numbers. Throws CommandError on NaN.\n */\n number(name: string): number {\n const value = this[COMMAND_INTERNALS].inputs[name]\n if (value === undefined || value === null) {\n return 0\n }\n const num = typeof value === 'string' ? Number(value) : value\n if (typeof num !== 'number' || Number.isNaN(num)) {\n throw new CommandError(`Input \"${name}\" expected a number, got ${typeof value}`)\n }\n return num\n }\n\n /**\n * Get an array input. Throws CommandError if present but not an array.\n */\n array(name: string): string[] {\n const value = this[COMMAND_INTERNALS].inputs[name]\n if (value === undefined || value === null) {\n return []\n }\n if (!Array.isArray(value)) {\n throw new CommandError(`Input \"${name}\" expected an array, got ${typeof value}`)\n }\n return value as string[]\n }\n\n // ── Output Helpers ───────────────────────────────────────────────\n\n /** Write an informational message to output */\n info(message: string): void {\n this[COMMAND_INTERNALS].output.push(cyan(message))\n }\n\n /** Write a success message to output */\n success(message: string): void {\n this[COMMAND_INTERNALS].output.push(`${green(bold('✔'))} ${green(message)}`)\n }\n\n /** Write a warning message to output */\n warn(message: string): void {\n this[COMMAND_INTERNALS].output.push(`${yellow(bold('⚠'))} ${yellow(message)}`)\n }\n\n /** Write an error message to errors */\n error(message: string): void {\n this[COMMAND_INTERNALS].errors.push(red(message))\n }\n\n /** Write a plain line to output */\n line(message?: string): void {\n this[COMMAND_INTERNALS].output.push(message ?? '')\n }\n\n /** Write an empty line to output */\n newLine(): void {\n this[COMMAND_INTERNALS].output.push('')\n }\n\n /** Write a comment-style line to output */\n comment(message: string): void {\n this[COMMAND_INTERNALS].output.push(dim(`// ${message}`))\n }\n\n /** Write a formatted table to output */\n table(headers: string[], rows: string[][]): void {\n const colWidths = headers.map((h, i) => {\n const maxRow = rows.reduce((max, row) => Math.max(max, (row[i] ?? '').length), 0)\n return Math.max(h.length, maxRow)\n })\n\n const formatRow = (cells: string[]) =>\n cells.map((cell, i) => cell.padEnd(colWidths[i])).join(' ')\n\n this[COMMAND_INTERNALS].output.push(bold(formatRow(headers)))\n this[COMMAND_INTERNALS].output.push(dim(colWidths.map((w) => '-'.repeat(w)).join(' ')))\n for (const row of rows) {\n this[COMMAND_INTERNALS].output.push(formatRow(row))\n }\n }\n\n /** Write an error message and set exit code */\n fail(message: string, exitCode = 1): void {\n this[COMMAND_INTERNALS].errors.push(`${red(bold('✖'))} ${red(message)}`)\n this[COMMAND_INTERNALS].exitCode = exitCode\n }\n\n // ── Command Calling ──────────────────────────────────────────────\n\n /**\n * Call another command from within this command.\n * Delegates to Quarry.call() via internal reference.\n */\n async call(name: string, input?: CommandInput): Promise<CommandResult> {\n const internals = this[COMMAND_INTERNALS]\n if (!internals.quarry) {\n throw new CommandError('Cannot call commands: Quarry reference not set')\n }\n return internals.quarry.call(name, input)\n }\n}\n"],"mappings":";;;;;;;AAIA,MAAa,oBAAoB,OAAO,IAAI,4BAA4B;;;;;;;;;;ACGxE,IAAa,eAAb,cAAkC,MAAM;CACtC,YAAY,SAAiB;AAC3B,QAAM,QAAQ;AACd,OAAK,OAAO;;;;;;;;;;;;;;;;;;;;;;;;ACgBhB,IAAsB,UAAtB,MAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiC5B,OAAO;;CAEP,OAAO;;CAEP,OAAO;CAEP,CAAC;CAED,cAAc;AACZ,OAAK,qBAAqB;GACxB,QAAQ,EAAE;GACV,QAAQ,EAAE;GACV,QAAQ,EAAE;GACV,UAAU;GACV,QAAQ;GACT;;;;;CAeH,MAAS,MAAiB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