@powerhousedao/ph-cli 6.2.3-dev.94 → 6.2.3-dev.96

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 (85) hide show
  1. package/dist/build-CH3XMW4i.mjs +4 -0
  2. package/dist/build-CVEsxazW.mjs +2036 -0
  3. package/dist/build-CVEsxazW.mjs.map +1 -0
  4. package/dist/check-DugP5VXV.mjs +60 -0
  5. package/dist/check-DugP5VXV.mjs.map +1 -0
  6. package/dist/check-_Vx8VsdJ.mjs +4 -0
  7. package/dist/{check-Dmx8U75w.mjs → check-d-VEsSZX.mjs} +4 -4
  8. package/dist/{check-Dmx8U75w.mjs.map → check-d-VEsSZX.mjs.map} +1 -1
  9. package/dist/{cli-connect-override-CLHLCeF5.mjs → cli-connect-override-BQr3yjC_.mjs} +4 -4
  10. package/dist/{cli-connect-override-CLHLCeF5.mjs.map → cli-connect-override-BQr3yjC_.mjs.map} +1 -1
  11. package/dist/cli.mjs +4 -4
  12. package/dist/{compound-Cv5yxdLC-DAYAbASE.mjs → compound-DO_mvh0O-D254asEo.mjs} +36 -19
  13. package/dist/{compound-Cv5yxdLC-DAYAbASE.mjs.map → compound-DO_mvh0O-D254asEo.mjs.map} +1 -1
  14. package/dist/{connect-build-D20s-YzT.mjs → connect-build-B3EnwJRo.mjs} +8 -7
  15. package/dist/connect-build-B3EnwJRo.mjs.map +1 -0
  16. package/dist/{connect-config-CoB5ejxj.mjs → connect-config-DWJf22Ro.mjs} +4 -4
  17. package/dist/{connect-config-CoB5ejxj.mjs.map → connect-config-DWJf22Ro.mjs.map} +1 -1
  18. package/dist/{connect-studio-CCjF7Fo2.mjs → connect-studio-DTZEwZ4C.mjs} +3 -3
  19. package/dist/{connect-studio-DWKRk0Zc.mjs → connect-studio-DWty6fZd.mjs} +4 -4
  20. package/dist/{connect-studio-DWKRk0Zc.mjs.map → connect-studio-DWty6fZd.mjs.map} +1 -1
  21. package/dist/definitions-worker.d.mts +96 -0
  22. package/dist/definitions-worker.d.mts.map +1 -0
  23. package/dist/definitions-worker.mjs +28 -0
  24. package/dist/definitions-worker.mjs.map +1 -0
  25. package/dist/{dist-CF0RfguD.mjs → dist-BOjmQhjX.mjs} +5 -5
  26. package/dist/dist-BOjmQhjX.mjs.map +1 -0
  27. package/dist/evidence-BiMKzRLV.mjs +120 -0
  28. package/dist/evidence-BiMKzRLV.mjs.map +1 -0
  29. package/dist/{explain-BD6bemOK.mjs → explain-DKS-t7dS.mjs} +5 -5
  30. package/dist/{explain-BD6bemOK.mjs.map → explain-DKS-t7dS.mjs.map} +1 -1
  31. package/dist/{export-BiIRQJ7L.mjs → export-DRw3XVfG.mjs} +4 -4
  32. package/dist/{export-BiIRQJ7L.mjs.map → export-DRw3XVfG.mjs.map} +1 -1
  33. package/dist/{index-CuWHsoBB.d.mts → external-M25AgDIE.d.mts} +2 -186
  34. package/dist/external-M25AgDIE.d.mts.map +1 -0
  35. package/dist/files-D05VjxVj.mjs +350 -0
  36. package/dist/files-D05VjxVj.mjs.map +1 -0
  37. package/dist/{generate-all-BWpiTcED.mjs → generate-all-CMpNPpD8.mjs} +4 -4
  38. package/dist/{generate-all-BWpiTcED.mjs.map → generate-all-CMpNPpD8.mjs.map} +1 -1
  39. package/dist/{generate-desktop-shell-NeH89X6S.mjs → generate-desktop-shell-B-Rf7ds8.mjs} +4 -4
  40. package/dist/{generate-desktop-shell-NeH89X6S.mjs.map → generate-desktop-shell-B-Rf7ds8.mjs.map} +1 -1
  41. package/dist/{generate-document-model-vzFHWp4O.mjs → generate-document-model-DCjzz3Sa.mjs} +4 -4
  42. package/dist/{generate-document-model-vzFHWp4O.mjs.map → generate-document-model-DCjzz3Sa.mjs.map} +1 -1
  43. package/dist/{generate-piece-DpFUr1ON.mjs → generate-piece-5Nyr2UZj.mjs} +4 -4
  44. package/dist/{generate-piece-DpFUr1ON.mjs.map → generate-piece-5Nyr2UZj.mjs.map} +1 -1
  45. package/dist/{get-version-Cou2oS93.mjs → get-version-CRMIOXgn.mjs} +4 -4
  46. package/dist/{get-version-Cou2oS93.mjs.map → get-version-CRMIOXgn.mjs.map} +1 -1
  47. package/dist/index-BdxG1c0H.d.mts +188 -0
  48. package/dist/index-BdxG1c0H.d.mts.map +1 -0
  49. package/dist/{inspect-CzjDr590.mjs → inspect-DlRPzee1.mjs} +4 -4
  50. package/dist/{inspect-CzjDr590.mjs.map → inspect-DlRPzee1.mjs.map} +1 -1
  51. package/dist/{mcp-v8q-w6FP.mjs → mcp-fJTu0s28.mjs} +4 -4
  52. package/dist/{mcp-v8q-w6FP.mjs.map → mcp-fJTu0s28.mjs.map} +1 -1
  53. package/dist/npm-args-g1Tgel4s.mjs +78 -0
  54. package/dist/npm-args-g1Tgel4s.mjs.map +1 -0
  55. package/dist/ph-cli-commands-CHLBIDlQ.mjs +4 -0
  56. package/dist/{ph-cli-commands-SGDvwQud.mjs → ph-cli-commands-CpLnxWAd.mjs} +64 -19
  57. package/dist/ph-cli-commands-CpLnxWAd.mjs.map +1 -0
  58. package/dist/render-CTQG4359.mjs +4 -0
  59. package/dist/{run-C7ExLhAm.mjs → run-DEKE4MJY.mjs} +34 -20
  60. package/dist/run-DEKE4MJY.mjs.map +1 -0
  61. package/dist/{run-BiS1kA5W.mjs → run-DP3fNgPv.mjs} +3 -3
  62. package/dist/{run-sugar-DZjQhZb1.mjs → run-sugar-yf2ggYJ9.mjs} +4 -4
  63. package/dist/{run-sugar-DZjQhZb1.mjs.map → run-sugar-yf2ggYJ9.mjs.map} +1 -1
  64. package/dist/runners/connect.d.mts +1 -1
  65. package/dist/runners/connect.mjs +2 -2
  66. package/dist/runners/switchboard.d.mts +1 -1
  67. package/dist/runners/switchboard.mjs +1 -1
  68. package/dist/{schemas-ByfuhvAb.mjs → schemas-ZQiV98u4.mjs} +186 -4
  69. package/dist/{schemas-ByfuhvAb.mjs.map → schemas-ZQiV98u4.mjs.map} +1 -1
  70. package/dist/verify-Dw_VUM2U.mjs +64 -0
  71. package/dist/verify-Dw_VUM2U.mjs.map +1 -0
  72. package/dist/{vetra-s0oeZqMz.mjs → vetra-CdYsxlvS.mjs} +6 -6
  73. package/dist/{vetra-s0oeZqMz.mjs.map → vetra-CdYsxlvS.mjs.map} +1 -1
  74. package/package.json +16 -15
  75. package/dist/build-t5pFQx0f.mjs +0 -304
  76. package/dist/build-t5pFQx0f.mjs.map +0 -1
  77. package/dist/build-wvc_NiGr.mjs +0 -4
  78. package/dist/check-B_uGHUz3.mjs +0 -20
  79. package/dist/check-B_uGHUz3.mjs.map +0 -1
  80. package/dist/connect-build-D20s-YzT.mjs.map +0 -1
  81. package/dist/dist-CF0RfguD.mjs.map +0 -1
  82. package/dist/index-CuWHsoBB.d.mts.map +0 -1
  83. package/dist/ph-cli-commands-CLbK9iC7.mjs +0 -4
  84. package/dist/ph-cli-commands-SGDvwQud.mjs.map +0 -1
  85. package/dist/run-C7ExLhAm.mjs.map +0 -1
@@ -1,6 +1,6 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="36ad752b-6041-5d44-abd2-9096eaeb3e49")}catch(e){}}();
3
- import { M as probeHostsFolder } from "./compound-Cv5yxdLC-DAYAbASE.mjs";
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="613b3166-be1b-5b2d-8b71-9aa0f22cf181")}catch(e){}}();
3
+ import { M as probeHostsFolder } from "./compound-DO_mvh0O-D254asEo.mjs";
4
4
  //#region src/utils/run-sugar.ts
5
5
  /**
6
6
  * `ph <host-name> [verb]` sugar: when the first arg is not a registered
@@ -35,5 +35,5 @@ function applyRunSugar(args, knownCommands, projectRoot) {
35
35
  //#endregion
36
36
  export { applyRunSugar };
37
37
 
38
- //# sourceMappingURL=run-sugar-DZjQhZb1.mjs.map
39
- //# debugId=36ad752b-6041-5d44-abd2-9096eaeb3e49
38
+ //# sourceMappingURL=run-sugar-yf2ggYJ9.mjs.map
39
+ //# debugId=613b3166-be1b-5b2d-8b71-9aa0f22cf181
@@ -1 +1 @@
1
- {"version":3,"file":"run-sugar-DZjQhZb1.mjs","sources":["../src/utils/run-sugar.ts"],"sourcesContent":["import { probeHostsFolder } from \"@powerhousedao/host-core\";\n\nexport interface RunSugarResult {\n args: string[];\n /** Set when hosts/ exists but is empty — the guard state: warn loudly, stay legacy. */\n warning?: string;\n}\n\n/**\n * `ph <host-name> [verb]` sugar: when the first arg is not a registered\n * command and names a host in the project's hosts/ folder, splice in `run`\n * (mirrors the connect→`connect studio` default-subcommand rewrite).\n * Built-in commands win collisions by construction — the known-command check\n * runs first. Callers only invoke this when the uniform-runners flag is on.\n */\n/** Classic commands that route through `ph run` in a hosts project — BARE\n * invocations only: extra flags are not representable on `ph run` yet, and\n * the classic path calls the same service, so flagged invocations stay\n * classic until the host-core compound takes over (phase 1). */\nconst CLASSIC_ALIASES = new Set([\"vetra\"]);\n\nexport function applyRunSugar(\n args: string[],\n knownCommands: ReadonlySet<string>,\n projectRoot: string,\n): RunSugarResult {\n const first = args[0];\n if (!first || first.startsWith(\"-\")) {\n return { args };\n }\n if (knownCommands.has(first)) {\n if (CLASSIC_ALIASES.has(first) && args.length === 1) {\n const probe = probeHostsFolder(projectRoot);\n if (probe.kind === \"present\" && probe.hosts.includes(first)) {\n return { args: [\"run\", first] };\n }\n }\n return { args };\n }\n const probe = probeHostsFolder(projectRoot);\n if (probe.kind === \"empty\") {\n return {\n args,\n warning:\n `hosts/ exists at ${probe.dir} but contains no <name>/host.js — ` +\n \"uniform-runners stays inactive (legacy command handling).\",\n };\n }\n if (probe.kind === \"present\" && probe.hosts.includes(first)) {\n return { args: [\"run\", ...args] };\n }\n return { args };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAmBA,MAAM,kCAAkB,IAAI,IAAI,CAAC,OAAO,CAAC;AAEzC,SAAgB,cACd,MACA,eACA,aACgB;CAChB,MAAM,QAAQ,KAAK;CACnB,IAAI,CAAC,SAAS,MAAM,WAAW,GAAG,GAChC,OAAO,EAAE,KAAK;CAEhB,IAAI,cAAc,IAAI,KAAK,GAAG;EAC5B,IAAI,gBAAgB,IAAI,KAAK,KAAK,KAAK,WAAW,GAAG;GACnD,MAAM,QAAQ,iBAAiB,WAAW;GAC1C,IAAI,MAAM,SAAS,aAAa,MAAM,MAAM,SAAS,KAAK,GACxD,OAAO,EAAE,MAAM,CAAC,OAAO,KAAK,EAAE;EAElC;EACA,OAAO,EAAE,KAAK;CAChB;CACA,MAAM,QAAQ,iBAAiB,WAAW;CAC1C,IAAI,MAAM,SAAS,SACjB,OAAO;EACL;EACA,SACE,oBAAoB,MAAM,IAAI;CAElC;CAEF,IAAI,MAAM,SAAS,aAAa,MAAM,MAAM,SAAS,KAAK,GACxD,OAAO,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,EAAE;CAElC,OAAO,EAAE,KAAK;AAChB","debug_id":"36ad752b-6041-5d44-abd2-9096eaeb3e49"}
1
+ {"version":3,"file":"run-sugar-yf2ggYJ9.mjs","sources":["../src/utils/run-sugar.ts"],"sourcesContent":["import { probeHostsFolder } from \"@powerhousedao/host-core\";\n\nexport interface RunSugarResult {\n args: string[];\n /** Set when hosts/ exists but is empty — the guard state: warn loudly, stay legacy. */\n warning?: string;\n}\n\n/**\n * `ph <host-name> [verb]` sugar: when the first arg is not a registered\n * command and names a host in the project's hosts/ folder, splice in `run`\n * (mirrors the connect→`connect studio` default-subcommand rewrite).\n * Built-in commands win collisions by construction — the known-command check\n * runs first. Callers only invoke this when the uniform-runners flag is on.\n */\n/** Classic commands that route through `ph run` in a hosts project — BARE\n * invocations only: extra flags are not representable on `ph run` yet, and\n * the classic path calls the same service, so flagged invocations stay\n * classic until the host-core compound takes over (phase 1). */\nconst CLASSIC_ALIASES = new Set([\"vetra\"]);\n\nexport function applyRunSugar(\n args: string[],\n knownCommands: ReadonlySet<string>,\n projectRoot: string,\n): RunSugarResult {\n const first = args[0];\n if (!first || first.startsWith(\"-\")) {\n return { args };\n }\n if (knownCommands.has(first)) {\n if (CLASSIC_ALIASES.has(first) && args.length === 1) {\n const probe = probeHostsFolder(projectRoot);\n if (probe.kind === \"present\" && probe.hosts.includes(first)) {\n return { args: [\"run\", first] };\n }\n }\n return { args };\n }\n const probe = probeHostsFolder(projectRoot);\n if (probe.kind === \"empty\") {\n return {\n args,\n warning:\n `hosts/ exists at ${probe.dir} but contains no <name>/host.js — ` +\n \"uniform-runners stays inactive (legacy command handling).\",\n };\n }\n if (probe.kind === \"present\" && probe.hosts.includes(first)) {\n return { args: [\"run\", ...args] };\n }\n return { args };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAmBA,MAAM,kCAAkB,IAAI,IAAI,CAAC,OAAO,CAAC;AAEzC,SAAgB,cACd,MACA,eACA,aACgB;CAChB,MAAM,QAAQ,KAAK;CACnB,IAAI,CAAC,SAAS,MAAM,WAAW,GAAG,GAChC,OAAO,EAAE,KAAK;CAEhB,IAAI,cAAc,IAAI,KAAK,GAAG;EAC5B,IAAI,gBAAgB,IAAI,KAAK,KAAK,KAAK,WAAW,GAAG;GACnD,MAAM,QAAQ,iBAAiB,WAAW;GAC1C,IAAI,MAAM,SAAS,aAAa,MAAM,MAAM,SAAS,KAAK,GACxD,OAAO,EAAE,MAAM,CAAC,OAAO,KAAK,EAAE;EAElC;EACA,OAAO,EAAE,KAAK;CAChB;CACA,MAAM,QAAQ,iBAAiB,WAAW;CAC1C,IAAI,MAAM,SAAS,SACjB,OAAO;EACL;EACA,SACE,oBAAoB,MAAM,IAAI;CAElC;CAEF,IAAI,MAAM,SAAS,aAAa,MAAM,MAAM,SAAS,KAAK,GACxD,OAAO,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,EAAE;CAElC,OAAO,EAAE,KAAK;AAChB","debug_id":"613b3166-be1b-5b2d-8b71-9aa0f22cf181"}
@@ -1,4 +1,4 @@
1
- import { n as RunnerHandle, t as RunnerContext } from "../index-CuWHsoBB.mjs";
1
+ import { n as RunnerHandle, t as RunnerContext } from "../index-BdxG1c0H.mjs";
2
2
  import { ConnectHostParsed, ConnectOutputs } from "@powerhousedao/ph-run/runners/connect";
3
3
  export * from "@powerhousedao/ph-run/runners/connect";
4
4
  //#region src/runners/connect.d.ts
@@ -28,7 +28,7 @@ function toStudioArgs(host) {
28
28
  const viteCacheOf = (host, ctx) => join(ctx.projectRoot, "node_modules", `.vite-${host.name.replace(/[^\w.-]/g, "_")}`);
29
29
  async function dev(host, ctx) {
30
30
  await validateComposition(host, ctx);
31
- const { runConnectStudio } = await import("../connect-studio-CCjF7Fo2.mjs");
31
+ const { runConnectStudio } = await import("../connect-studio-DTZEwZ4C.mjs");
32
32
  const args = toStudioArgs(host);
33
33
  const server = await startUnderSupervisor(ctx, () => runConnectStudio(args, void 0, callerOverride(host, ctx, ctx.verb), {
34
34
  routes: host.runner.routes,
@@ -46,7 +46,7 @@ const run = dev;
46
46
  /** P3.3 — `build`: the SAME service as classic `ph connect build`. */
47
47
  async function build(host, ctx) {
48
48
  await validateComposition(host, ctx);
49
- const { runConnectBuild } = await import("../connect-build-D20s-YzT.mjs");
49
+ const { runConnectBuild } = await import("../connect-build-B3EnwJRo.mjs");
50
50
  await runConnectBuild({ outDir: host.runner.outDir ?? DEFAULT_CONNECT_OUTDIR }, callerOverride(host, ctx, ctx.verb), { routes: host.runner.routes });
51
51
  }
52
52
  /** Opening a browser is a developer's convenience, and vite's to give, which
@@ -1,4 +1,4 @@
1
- import { t as RunnerContext } from "../index-CuWHsoBB.mjs";
1
+ import { t as RunnerContext } from "../index-BdxG1c0H.mjs";
2
2
  import { SwitchboardHostParsed } from "@powerhousedao/ph-run/runners/switchboard";
3
3
  export * from "@powerhousedao/ph-run/runners/switchboard";
4
4
  //#region src/runners/switchboard.d.ts
@@ -11,7 +11,7 @@ const verbs = [
11
11
  /** Build the project's reactor package (the SAME service as `ph build`) — what
12
12
  * this switchboard serves. Starts no server; orthogonal to run/serve/dev. */
13
13
  async function build(host, _ctx) {
14
- const { runBuild } = await import("../build-wvc_NiGr.mjs");
14
+ const { runBuild } = await import("../build-CH3XMW4i.mjs");
15
15
  await runBuild({ outDir: host.runner.outDir ?? "dist" });
16
16
  }
17
17
  //#endregion
@@ -1,6 +1,6 @@
1
1
  //#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/util.js
2
2
 
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="51a5423e-6284-5181-ad66-2a900df25585")}catch(e){}}();
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="47289605-f5d4-5fd4-8c5a-849d76058804")}catch(e){}}();
4
4
  function getEnumValues(entries) {
5
5
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
6
6
  return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
@@ -154,6 +154,14 @@ const propertyKeyTypes = /* @__PURE__*/ new Set([
154
154
  "number",
155
155
  "symbol"
156
156
  ]);
157
+ const primitiveTypes = /* @__PURE__*/ new Set([
158
+ "string",
159
+ "number",
160
+ "bigint",
161
+ "boolean",
162
+ "symbol",
163
+ "undefined"
164
+ ]);
157
165
  function escapeRegex(str) {
158
166
  return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
159
167
  }
@@ -1067,6 +1075,10 @@ function datetime(args) {
1067
1075
  return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
1068
1076
  }
1069
1077
  const anyString = /^[\s\S]{0,}$/;
1078
+ const string$1 = (params) => {
1079
+ const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
1080
+ return new RegExp(`^${regex}$`);
1081
+ };
1070
1082
  const integer = /^-?\d+$/;
1071
1083
  const number$1 = /^-?\d+(?:\.\d+)?$/;
1072
1084
  const boolean$1 = /^(?:true|false)$/i;
@@ -2271,6 +2283,70 @@ const $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def) => {
2271
2283
  });
2272
2284
  };
2273
2285
  });
2286
+ function discriminatorMap(def) {
2287
+ const map = /* @__PURE__ */ new Map();
2288
+ for (const option of def.options) {
2289
+ const values = option._zod.propValues?.[def.discriminator];
2290
+ if (!values || values.size === 0) throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
2291
+ for (const value of values) if (map.has(value)) {
2292
+ if (value !== void 0) throw new Error(`Duplicate discriminator value "${String(value)}"`);
2293
+ map.set(value, null);
2294
+ } else map.set(value, option);
2295
+ }
2296
+ return map;
2297
+ }
2298
+ const $ZodDiscriminatedUnion = /*@__PURE__*/ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
2299
+ def.inclusive = false;
2300
+ $ZodUnion.init(inst, def);
2301
+ const _super = inst._zod.parse;
2302
+ defineLazyInternal(inst, "propValues", (zod) => {
2303
+ const propValues = {};
2304
+ let undefinedCount = 0;
2305
+ for (const option of zod.def.options) {
2306
+ const pv = option._zod.propValues;
2307
+ if (!pv || Object.keys(pv).length === 0) throw new Error(`Invalid discriminated union option at index "${zod.def.options.indexOf(option)}"`);
2308
+ if (pv[zod.def.discriminator]?.has(void 0)) undefinedCount++;
2309
+ for (const [k, v] of Object.entries(pv)) {
2310
+ if (!Object.prototype.hasOwnProperty.call(propValues, k)) assignProp(propValues, k, /* @__PURE__ */ new Set());
2311
+ for (const val of v) propValues[k].add(val);
2312
+ }
2313
+ }
2314
+ if (!zod.def.unionFallback && undefinedCount > 1) propValues[zod.def.discriminator]?.delete(void 0);
2315
+ return propValues;
2316
+ });
2317
+ def.options.forEach((option, i) => {
2318
+ const propShape = rawShape(option._zod.def);
2319
+ if (propShape && !Object.prototype.hasOwnProperty.call(propShape, def.discriminator)) throw new Error(`Invalid discriminated union option at index "${i}"`);
2320
+ });
2321
+ const disc = cached(() => discriminatorMap(def));
2322
+ inst._zod.parse = (payload, ctx) => {
2323
+ const input = payload.value;
2324
+ if (!isObject(input)) {
2325
+ payload.issues.push({
2326
+ code: "invalid_type",
2327
+ expected: "object",
2328
+ input,
2329
+ inst
2330
+ });
2331
+ return payload;
2332
+ }
2333
+ const value = input?.[def.discriminator];
2334
+ const opt = disc.value.get(value);
2335
+ if (opt && (value !== void 0 || ctx.direction !== "backward")) return opt._zod.run(payload, ctx);
2336
+ if (def.unionFallback || ctx.direction === "backward") return _super(payload, ctx);
2337
+ payload.issues.push({
2338
+ code: "invalid_union",
2339
+ errors: [],
2340
+ note: "No matching discriminator",
2341
+ discriminator: def.discriminator,
2342
+ options: Array.from(disc.value.keys()).filter((value) => disc.value.get(value) !== null),
2343
+ input,
2344
+ path: [def.discriminator],
2345
+ inst
2346
+ });
2347
+ return payload;
2348
+ };
2349
+ });
2274
2350
  const $ZodIntersection = /*@__PURE__*/ $constructor("$ZodIntersection", (inst, def) => {
2275
2351
  $ZodType.init(inst, def);
2276
2352
  inst._zod.parse = (payload, ctx) => {
@@ -2753,6 +2829,80 @@ function handleReadonlyResult(payload) {
2753
2829
  if (!payload.memo) payload.value = Object.freeze(payload.value);
2754
2830
  return payload;
2755
2831
  }
2832
+ function leafPattern(schema) {
2833
+ const def = schema._zod.def;
2834
+ let pattern = def.pattern;
2835
+ let isInt = !!def.format?.includes("int");
2836
+ let minimum;
2837
+ let maximum;
2838
+ for (const ch of def.checks ?? []) {
2839
+ const d = ch._zod.def;
2840
+ if (d.pattern) pattern = d.pattern;
2841
+ isInt || (isInt = !!d.format?.includes("int"));
2842
+ const lo = d.minimum ?? d.length;
2843
+ const hi = d.maximum ?? d.length;
2844
+ if (lo !== void 0 && (minimum === void 0 || lo > minimum)) minimum = lo;
2845
+ if (hi !== void 0 && (maximum === void 0 || hi < maximum)) maximum = hi;
2846
+ }
2847
+ if (pattern) return pattern.source;
2848
+ if (minimum !== void 0 && maximum !== void 0 && minimum > maximum) return "(?!)";
2849
+ if (minimum !== void 0 || maximum !== void 0) return string$1({
2850
+ minimum,
2851
+ maximum
2852
+ }).source;
2853
+ const own = schema._zod.pattern;
2854
+ return (isInt && own === number$1 ? integer : own)?.source;
2855
+ }
2856
+ function partPattern(schema) {
2857
+ const def = schema._zod.def;
2858
+ const own = schema._zod.pattern?.source;
2859
+ const inner = def.innerType ?? schema._zod.innerType;
2860
+ if (inner) {
2861
+ const before = inner._zod.pattern?.source;
2862
+ const after = partPattern(inner);
2863
+ if (own && before && after && after !== before) return own.replace(cleanRegex(before), () => cleanRegex(after));
2864
+ return own;
2865
+ }
2866
+ if (def.options) {
2867
+ const sources = def.options.map(partPattern);
2868
+ if (sources.every(Boolean)) return `^(${sources.map((s) => cleanRegex(s)).join("|")})$`;
2869
+ }
2870
+ return leafPattern(schema);
2871
+ }
2872
+ const $ZodTemplateLiteral = /*@__PURE__*/ $constructor("$ZodTemplateLiteral", (inst, def) => {
2873
+ $ZodType.init(inst, def);
2874
+ const regexParts = [];
2875
+ for (const part of def.parts) if (typeof part === "object" && part !== null) {
2876
+ const source = partPattern(part);
2877
+ if (!source) throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);
2878
+ regexParts.push(cleanRegex(source));
2879
+ } else if (part === null || primitiveTypes.has(typeof part)) regexParts.push(escapeRegex(`${part}`));
2880
+ else throw new Error(`Invalid template literal part: ${part}`);
2881
+ inst._zod.pattern = new RegExp(`^${regexParts.join("")}$`);
2882
+ inst._zod.parse = (payload, _ctx) => {
2883
+ if (typeof payload.value !== "string") {
2884
+ payload.issues.push({
2885
+ input: payload.value,
2886
+ inst,
2887
+ expected: "string",
2888
+ code: "invalid_type"
2889
+ });
2890
+ return payload;
2891
+ }
2892
+ inst._zod.pattern.lastIndex = 0;
2893
+ if (!inst._zod.pattern.test(payload.value)) {
2894
+ payload.issues.push({
2895
+ input: payload.value,
2896
+ inst,
2897
+ code: "invalid_format",
2898
+ format: def.format ?? "template_literal",
2899
+ pattern: inst._zod.pattern.source
2900
+ });
2901
+ return payload;
2902
+ }
2903
+ return payload;
2904
+ };
2905
+ });
2756
2906
  const $ZodCustom = /*@__PURE__*/ $constructor("$ZodCustom", (inst, def) => {
2757
2907
  $ZodCheck.init(inst, def);
2758
2908
  $ZodType.init(inst, def);
@@ -5460,6 +5610,14 @@ const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
5460
5610
  return required(ZodNonOptional, this, args[0]);
5461
5611
  }
5462
5612
  });
5613
+ function object(shape, params) {
5614
+ const def = {
5615
+ type: "object",
5616
+ shape: shape ?? {},
5617
+ ...normalizeParams(params)
5618
+ };
5619
+ return new ZodObject(def);
5620
+ }
5463
5621
  function strictObject(shape, params) {
5464
5622
  return new ZodObject({
5465
5623
  type: "object",
@@ -5489,6 +5647,18 @@ function union(options, params) {
5489
5647
  ...normalizeParams(params)
5490
5648
  });
5491
5649
  }
5650
+ const ZodDiscriminatedUnion = /*@__PURE__*/ $constructor("ZodDiscriminatedUnion", (inst, def) => {
5651
+ ZodUnion.init(inst, def);
5652
+ $ZodDiscriminatedUnion.init(inst, def);
5653
+ });
5654
+ function discriminatedUnion(discriminator, options, params) {
5655
+ return new ZodDiscriminatedUnion({
5656
+ type: "union",
5657
+ options,
5658
+ discriminator,
5659
+ ...normalizeParams(params)
5660
+ });
5661
+ }
5492
5662
  const ZodIntersection = /*@__PURE__*/ $constructor("ZodIntersection", (inst, def) => {
5493
5663
  $ZodIntersection.init(inst, def);
5494
5664
  ZodType.init(inst, def);
@@ -5731,6 +5901,18 @@ function readonly(innerType) {
5731
5901
  innerType
5732
5902
  });
5733
5903
  }
5904
+ const ZodTemplateLiteral = /*@__PURE__*/ $constructor("ZodTemplateLiteral", (inst, def) => {
5905
+ $ZodTemplateLiteral.init(inst, def);
5906
+ ZodType.init(inst, def);
5907
+ inst._zod.processJSONSchema = (ctx, json, params) => templateLiteralProcessor(inst, ctx, json, params);
5908
+ });
5909
+ function templateLiteral(parts, params) {
5910
+ return new ZodTemplateLiteral({
5911
+ type: "template_literal",
5912
+ parts,
5913
+ ...normalizeParams(params)
5914
+ });
5915
+ }
5734
5916
  const ZodCustom = /*@__PURE__*/ $constructor("ZodCustom", (inst, def) => {
5735
5917
  $ZodCustom.init(inst, def);
5736
5918
  ZodType.init(inst, def);
@@ -5746,7 +5928,7 @@ function superRefine(fn, params) {
5746
5928
  return /* @__PURE__ */ _superRefine(fn, params);
5747
5929
  }
5748
5930
  //#endregion
5749
- export { custom as a, number as c, string as d, union as f, prettifyError as g, toJSONSchema as h, boolean as i, record as l, url as m, _enum as n, literal as o, unknown as p, array as r, looseObject as s, ZodType as t, strictObject as u };
5931
+ export { url as _, custom as a, looseObject as c, record as d, strictObject as f, unknown as g, union as h, boolean as i, number as l, templateLiteral as m, _enum as n, discriminatedUnion as o, string as p, array as r, literal as s, ZodType as t, object as u, toJSONSchema as v, prettifyError as y };
5750
5932
 
5751
- //# sourceMappingURL=schemas-ByfuhvAb.mjs.map
5752
- //# debugId=51a5423e-6284-5181-ad66-2a900df25585
5933
+ //# sourceMappingURL=schemas-ZQiV98u4.mjs.map
5934
+ //# debugId=47289605-f5d4-5fd4-8c5a-849d76058804