@getverbal/cli 0.4.3 → 0.6.0
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.
- package/dist/agent-hooks/claude.d.ts +10 -0
- package/dist/agent-hooks/claude.d.ts.map +1 -0
- package/dist/agent-hooks/claude.js +218 -0
- package/dist/agent-hooks/claude.js.map +1 -0
- package/dist/agent-hooks/cli.d.ts +2 -0
- package/dist/agent-hooks/cli.d.ts.map +1 -0
- package/dist/agent-hooks/cli.js +271 -0
- package/dist/agent-hooks/cli.js.map +1 -0
- package/dist/agent-hooks/codex.d.ts +9 -0
- package/dist/agent-hooks/codex.d.ts.map +1 -0
- package/dist/agent-hooks/codex.js +349 -0
- package/dist/agent-hooks/codex.js.map +1 -0
- package/dist/agent-hooks/config.d.ts +32 -0
- package/dist/agent-hooks/config.d.ts.map +1 -0
- package/dist/agent-hooks/config.js +176 -0
- package/dist/agent-hooks/config.js.map +1 -0
- package/dist/agent-hooks/ingest.d.ts +4 -0
- package/dist/agent-hooks/ingest.d.ts.map +1 -0
- package/dist/agent-hooks/ingest.js +22 -0
- package/dist/agent-hooks/ingest.js.map +1 -0
- package/dist/agent-hooks/launchagent.d.ts +7 -0
- package/dist/agent-hooks/launchagent.d.ts.map +1 -0
- package/dist/agent-hooks/launchagent.js +51 -0
- package/dist/agent-hooks/launchagent.js.map +1 -0
- package/dist/agent-hooks/runtime-context.d.ts +20 -0
- package/dist/agent-hooks/runtime-context.d.ts.map +1 -0
- package/dist/agent-hooks/runtime-context.js +90 -0
- package/dist/agent-hooks/runtime-context.js.map +1 -0
- package/dist/agent-hooks/state.d.ts +26 -0
- package/dist/agent-hooks/state.d.ts.map +1 -0
- package/dist/agent-hooks/state.js +67 -0
- package/dist/agent-hooks/state.js.map +1 -0
- package/dist/agent-hooks/tokscale.d.ts +70 -0
- package/dist/agent-hooks/tokscale.d.ts.map +1 -0
- package/dist/agent-hooks/tokscale.js +142 -0
- package/dist/agent-hooks/tokscale.js.map +1 -0
- package/dist/agent-hooks/tool-extraction.d.ts +7 -0
- package/dist/agent-hooks/tool-extraction.d.ts.map +1 -0
- package/dist/agent-hooks/tool-extraction.js +100 -0
- package/dist/agent-hooks/tool-extraction.js.map +1 -0
- package/dist/agent-hooks/trace.d.ts +17 -0
- package/dist/agent-hooks/trace.d.ts.map +1 -0
- package/dist/agent-hooks/trace.js +25 -0
- package/dist/agent-hooks/trace.js.map +1 -0
- package/dist/auth/browser-auth.d.ts +6 -0
- package/dist/auth/browser-auth.d.ts.map +1 -0
- package/dist/auth/browser-auth.js +202 -0
- package/dist/auth/browser-auth.js.map +1 -0
- package/dist/auth/credentials.d.ts +6 -0
- package/dist/auth/credentials.d.ts.map +1 -0
- package/dist/auth/credentials.js +78 -0
- package/dist/auth/credentials.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +1513 -440
- package/dist/cli.js.map +1 -0
- package/dist/commands/dashboard.d.ts +2 -0
- package/dist/commands/dashboard.d.ts.map +1 -0
- package/dist/commands/dashboard.js +19 -0
- package/dist/commands/dashboard.js.map +1 -0
- package/dist/commands/hooks.d.ts +2 -0
- package/dist/commands/hooks.d.ts.map +1 -0
- package/dist/commands/hooks.js +6 -0
- package/dist/commands/hooks.js.map +1 -0
- package/dist/commands/import.d.ts +2 -0
- package/dist/commands/import.d.ts.map +1 -0
- package/dist/commands/import.js +129 -0
- package/dist/commands/import.js.map +1 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +262 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/logout.d.ts +2 -0
- package/dist/commands/logout.d.ts.map +1 -0
- package/dist/commands/logout.js +17 -0
- package/dist/commands/logout.js.map +1 -0
- package/dist/commands/mcp-serve.d.ts +2 -0
- package/dist/commands/mcp-serve.d.ts.map +1 -0
- package/dist/commands/mcp-serve.js +7 -0
- package/dist/commands/mcp-serve.js.map +1 -0
- package/dist/commands/status.d.ts +2 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +43 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/uninstall.d.ts +2 -0
- package/dist/commands/uninstall.d.ts.map +1 -0
- package/dist/commands/uninstall.js +43 -0
- package/dist/commands/uninstall.js.map +1 -0
- package/dist/commands/update.d.ts +2 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +58 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/configure/claude-code.d.ts +7 -0
- package/dist/configure/claude-code.d.ts.map +1 -0
- package/dist/configure/claude-code.js +11 -0
- package/dist/configure/claude-code.js.map +1 -0
- package/dist/configure/claude-desktop.d.ts +8 -0
- package/dist/configure/claude-desktop.d.ts.map +1 -0
- package/dist/configure/claude-desktop.js +28 -0
- package/dist/configure/claude-desktop.js.map +1 -0
- package/dist/configure/codex.d.ts +7 -0
- package/dist/configure/codex.d.ts.map +1 -0
- package/dist/configure/codex.js +12 -0
- package/dist/configure/codex.js.map +1 -0
- package/dist/configure/cursor.d.ts +7 -0
- package/dist/configure/cursor.d.ts.map +1 -0
- package/dist/configure/cursor.js +12 -0
- package/dist/configure/cursor.js.map +1 -0
- package/dist/configure/index.d.ts +34 -0
- package/dist/configure/index.d.ts.map +1 -0
- package/dist/configure/index.js +153 -0
- package/dist/configure/index.js.map +1 -0
- package/dist/detect/claude-code.d.ts +3 -0
- package/dist/detect/claude-code.d.ts.map +1 -0
- package/dist/detect/claude-code.js +82 -0
- package/dist/detect/claude-code.js.map +1 -0
- package/dist/detect/claude-desktop.d.ts +3 -0
- package/dist/detect/claude-desktop.d.ts.map +1 -0
- package/dist/detect/claude-desktop.js +89 -0
- package/dist/detect/claude-desktop.js.map +1 -0
- package/dist/detect/codex.d.ts +3 -0
- package/dist/detect/codex.d.ts.map +1 -0
- package/dist/detect/codex.js +64 -0
- package/dist/detect/codex.js.map +1 -0
- package/dist/detect/cursor.d.ts +3 -0
- package/dist/detect/cursor.d.ts.map +1 -0
- package/dist/detect/cursor.js +81 -0
- package/dist/detect/cursor.js.map +1 -0
- package/dist/detect/index.d.ts +3 -0
- package/dist/detect/index.d.ts.map +1 -0
- package/dist/detect/index.js +28 -0
- package/dist/detect/index.js.map +1 -0
- package/dist/import/file-upload.d.ts +10 -0
- package/dist/import/file-upload.d.ts.map +1 -0
- package/dist/import/file-upload.js +37 -0
- package/dist/import/file-upload.js.map +1 -0
- package/dist/import/index.d.ts +11 -0
- package/dist/import/index.d.ts.map +1 -0
- package/dist/import/index.js +51 -0
- package/dist/import/index.js.map +1 -0
- package/dist/mcp/exports.d.ts +13 -0
- package/dist/mcp/exports.d.ts.map +1 -0
- package/dist/mcp/exports.js +13 -0
- package/dist/mcp/exports.js.map +1 -0
- package/dist/mcp/git-context.d.ts +17 -0
- package/dist/mcp/git-context.d.ts.map +1 -0
- package/dist/mcp/git-context.js +72 -0
- package/dist/mcp/git-context.js.map +1 -0
- package/dist/mcp/hooks/anthropic.d.ts +31 -0
- package/dist/mcp/hooks/anthropic.d.ts.map +1 -0
- package/dist/mcp/hooks/anthropic.js +137 -0
- package/dist/mcp/hooks/anthropic.js.map +1 -0
- package/dist/mcp/hooks/google.d.ts +53 -0
- package/dist/mcp/hooks/google.d.ts.map +1 -0
- package/dist/mcp/hooks/google.js +161 -0
- package/dist/mcp/hooks/google.js.map +1 -0
- package/dist/mcp/hooks/index.d.ts +9 -0
- package/dist/mcp/hooks/index.d.ts.map +1 -0
- package/dist/mcp/hooks/index.js +7 -0
- package/dist/mcp/hooks/index.js.map +1 -0
- package/dist/mcp/hooks/openai.d.ts +59 -0
- package/dist/mcp/hooks/openai.d.ts.map +1 -0
- package/dist/mcp/hooks/openai.js +158 -0
- package/dist/mcp/hooks/openai.js.map +1 -0
- package/dist/mcp/hooks/types.d.ts +8 -0
- package/dist/mcp/hooks/types.d.ts.map +1 -0
- package/dist/mcp/hooks/types.js +5 -0
- package/dist/mcp/hooks/types.js.map +1 -0
- package/dist/mcp/ingestor.d.ts +23 -0
- package/dist/mcp/ingestor.d.ts.map +1 -0
- package/dist/mcp/ingestor.js +310 -0
- package/dist/mcp/ingestor.js.map +1 -0
- package/dist/mcp/pricing.d.ts +19 -0
- package/dist/mcp/pricing.d.ts.map +1 -0
- package/dist/mcp/pricing.js +130 -0
- package/dist/mcp/pricing.js.map +1 -0
- package/dist/mcp/server.d.ts +10 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +689 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/session-tracker.d.ts +52 -0
- package/dist/mcp/session-tracker.d.ts.map +1 -0
- package/dist/mcp/session-tracker.js +186 -0
- package/dist/mcp/session-tracker.js.map +1 -0
- package/dist/mcp/tools/analyze-spending-trend.d.ts +10 -0
- package/dist/mcp/tools/analyze-spending-trend.d.ts.map +1 -0
- package/dist/mcp/tools/analyze-spending-trend.js +126 -0
- package/dist/mcp/tools/analyze-spending-trend.js.map +1 -0
- package/dist/mcp/tools/get-budget-status.d.ts +9 -0
- package/dist/mcp/tools/get-budget-status.d.ts.map +1 -0
- package/dist/mcp/tools/get-budget-status.js +59 -0
- package/dist/mcp/tools/get-budget-status.js.map +1 -0
- package/dist/mcp/tools/get-cost-breakdown.d.ts +10 -0
- package/dist/mcp/tools/get-cost-breakdown.d.ts.map +1 -0
- package/dist/mcp/tools/get-cost-breakdown.js +52 -0
- package/dist/mcp/tools/get-cost-breakdown.js.map +1 -0
- package/dist/mcp/tools/get-model-efficiency.d.ts +9 -0
- package/dist/mcp/tools/get-model-efficiency.d.ts.map +1 -0
- package/dist/mcp/tools/get-model-efficiency.js +137 -0
- package/dist/mcp/tools/get-model-efficiency.js.map +1 -0
- package/dist/mcp/tools/get-recent-prompts.d.ts +13 -0
- package/dist/mcp/tools/get-recent-prompts.d.ts.map +1 -0
- package/dist/mcp/tools/get-recent-prompts.js +56 -0
- package/dist/mcp/tools/get-recent-prompts.js.map +1 -0
- package/dist/mcp/tools/get-roi-metrics.d.ts +9 -0
- package/dist/mcp/tools/get-roi-metrics.d.ts.map +1 -0
- package/dist/mcp/tools/get-roi-metrics.js +84 -0
- package/dist/mcp/tools/get-roi-metrics.js.map +1 -0
- package/dist/mcp/tools/get-usage-summary.d.ts +10 -0
- package/dist/mcp/tools/get-usage-summary.d.ts.map +1 -0
- package/dist/mcp/tools/get-usage-summary.js +47 -0
- package/dist/mcp/tools/get-usage-summary.js.map +1 -0
- package/dist/mcp/tools/index.d.ts +221 -0
- package/dist/mcp/tools/index.d.ts.map +1 -0
- package/dist/mcp/tools/index.js +161 -0
- package/dist/mcp/tools/index.js.map +1 -0
- package/dist/mcp/tools/list-projects.d.ts +6 -0
- package/dist/mcp/tools/list-projects.d.ts.map +1 -0
- package/dist/mcp/tools/list-projects.js +43 -0
- package/dist/mcp/tools/list-projects.js.map +1 -0
- package/dist/mcp/tools/optimize-prompt.d.ts +44 -0
- package/dist/mcp/tools/optimize-prompt.d.ts.map +1 -0
- package/dist/mcp/tools/optimize-prompt.js +95 -0
- package/dist/mcp/tools/optimize-prompt.js.map +1 -0
- package/dist/mcp/types.d.ts +118 -0
- package/dist/mcp/types.d.ts.map +1 -0
- package/dist/mcp/types.js +5 -0
- package/dist/mcp/types.js.map +1 -0
- package/dist/types.d.ts +18 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/update-check/check.d.ts +6 -0
- package/dist/update-check/check.d.ts.map +1 -0
- package/dist/update-check/check.js +64 -0
- package/dist/update-check/check.js.map +1 -0
- package/dist/update-check/notify.d.ts +6 -0
- package/dist/update-check/notify.d.ts.map +1 -0
- package/dist/update-check/notify.js +40 -0
- package/dist/update-check/notify.js.map +1 -0
- package/dist/verify.d.ts +7 -0
- package/dist/verify.d.ts.map +1 -0
- package/dist/verify.js +40 -0
- package/dist/verify.js.map +1 -0
- package/dist/version.d.ts +9 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +21 -0
- package/dist/version.js.map +1 -0
- package/package.json +10 -5
package/dist/cli.js
CHANGED
|
@@ -113,7 +113,7 @@ function compareSemver(a, b) {
|
|
|
113
113
|
}
|
|
114
114
|
return 0;
|
|
115
115
|
}
|
|
116
|
-
var VERSION = "0.
|
|
116
|
+
var VERSION = "0.5.0";
|
|
117
117
|
|
|
118
118
|
// src/auth/credentials.ts
|
|
119
119
|
import { readFileSync, writeFileSync, rmSync, mkdirSync, chmodSync, renameSync } from "node:fs";
|
|
@@ -361,22 +361,22 @@ function installClaudeHooks(useGlobal = false) {
|
|
|
361
361
|
const settings = readJson(settingsPath) ?? {};
|
|
362
362
|
settings.hooks = settings.hooks ?? {};
|
|
363
363
|
if (useCliCommands) {
|
|
364
|
-
upsertHook(settings, "Stop", "getverbal ingest-claude-hook", {
|
|
364
|
+
upsertHook(settings, "Stop", "getverbal hooks ingest-claude-hook", {
|
|
365
365
|
timeout: 30,
|
|
366
366
|
statusMessage: "Tracking usage in Verbal",
|
|
367
367
|
async: true,
|
|
368
368
|
env: { HOOK_EVENT: "Stop", ...configEnv }
|
|
369
369
|
});
|
|
370
|
-
upsertHook(settings, "SessionEnd", "getverbal ingest-claude-hook", {
|
|
370
|
+
upsertHook(settings, "SessionEnd", "getverbal hooks ingest-claude-hook", {
|
|
371
371
|
timeout: 30,
|
|
372
372
|
statusMessage: "Finalizing usage data",
|
|
373
373
|
env: { HOOK_EVENT: "SessionEnd", ...configEnv }
|
|
374
374
|
});
|
|
375
|
-
upsertHook(settings, "Stop", "getverbal session-review", {
|
|
375
|
+
upsertHook(settings, "Stop", "getverbal hooks session-review", {
|
|
376
376
|
timeout: 5,
|
|
377
377
|
statusMessage: "Checking session review timer"
|
|
378
378
|
});
|
|
379
|
-
upsertHook(settings, "UserPromptSubmit", "getverbal preflight", {
|
|
379
|
+
upsertHook(settings, "UserPromptSubmit", "getverbal hooks preflight", {
|
|
380
380
|
timeout: 10,
|
|
381
381
|
statusMessage: "Coaching prompt",
|
|
382
382
|
env: configEnv
|
|
@@ -1015,6 +1015,7 @@ class VerbalIngestor {
|
|
|
1015
1015
|
const effectiveBillingType = event.billing_type ?? this.config.billingType;
|
|
1016
1016
|
const computedCost = effectiveBillingType === "subscription" ? 0 : this.config.costCalcEnabled && event.cost === undefined && provider && model ? calculateCost(model, tokensIn, tokensOut, event.cache_read_tokens, event.cache_write_tokens) : event.cost;
|
|
1017
1017
|
const enrichedEvent = {
|
|
1018
|
+
...event,
|
|
1018
1019
|
event_id: event.event_id ?? crypto2.randomUUID(),
|
|
1019
1020
|
timestamp: event.timestamp ?? new Date().toISOString(),
|
|
1020
1021
|
source: event.source ?? this.config.source,
|
|
@@ -1022,7 +1023,6 @@ class VerbalIngestor {
|
|
|
1022
1023
|
org_id: event.org_id ?? (this.config.orgId || undefined),
|
|
1023
1024
|
project: event.project ?? (this.config.defaultProject || undefined),
|
|
1024
1025
|
cost: computedCost,
|
|
1025
|
-
...event,
|
|
1026
1026
|
metadata
|
|
1027
1027
|
};
|
|
1028
1028
|
event.event_id = enrichedEvent.event_id;
|
|
@@ -2556,20 +2556,29 @@ var init_update = __esm(() => {
|
|
|
2556
2556
|
// node_modules/zod/v4/core/core.js
|
|
2557
2557
|
function $constructor(name, initializer, params) {
|
|
2558
2558
|
function init(inst, def) {
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2559
|
+
if (!inst._zod) {
|
|
2560
|
+
Object.defineProperty(inst, "_zod", {
|
|
2561
|
+
value: {
|
|
2562
|
+
def,
|
|
2563
|
+
constr: _,
|
|
2564
|
+
traits: new Set
|
|
2565
|
+
},
|
|
2566
|
+
enumerable: false
|
|
2567
|
+
});
|
|
2568
|
+
}
|
|
2569
|
+
if (inst._zod.traits.has(name)) {
|
|
2570
|
+
return;
|
|
2571
|
+
}
|
|
2565
2572
|
inst._zod.traits.add(name);
|
|
2566
2573
|
initializer(inst, def);
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2574
|
+
const proto = _.prototype;
|
|
2575
|
+
const keys = Object.keys(proto);
|
|
2576
|
+
for (let i = 0;i < keys.length; i++) {
|
|
2577
|
+
const k = keys[i];
|
|
2578
|
+
if (!(k in inst)) {
|
|
2579
|
+
inst[k] = proto[k].bind(inst);
|
|
2580
|
+
}
|
|
2570
2581
|
}
|
|
2571
|
-
inst._zod.constr = _;
|
|
2572
|
-
inst._zod.def = def;
|
|
2573
2582
|
}
|
|
2574
2583
|
const Parent = params?.Parent ?? Object;
|
|
2575
2584
|
|
|
@@ -2602,7 +2611,7 @@ function config(newConfig) {
|
|
|
2602
2611
|
Object.assign(globalConfig, newConfig);
|
|
2603
2612
|
return globalConfig;
|
|
2604
2613
|
}
|
|
2605
|
-
var NEVER, $brand, $ZodAsyncError, globalConfig;
|
|
2614
|
+
var NEVER, $brand, $ZodAsyncError, $ZodEncodeError, globalConfig;
|
|
2606
2615
|
var init_core = __esm(() => {
|
|
2607
2616
|
NEVER = Object.freeze({
|
|
2608
2617
|
status: "aborted"
|
|
@@ -2613,6 +2622,12 @@ var init_core = __esm(() => {
|
|
|
2613
2622
|
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
2614
2623
|
}
|
|
2615
2624
|
};
|
|
2625
|
+
$ZodEncodeError = class $ZodEncodeError extends Error {
|
|
2626
|
+
constructor(name) {
|
|
2627
|
+
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
2628
|
+
this.name = "ZodEncodeError";
|
|
2629
|
+
}
|
|
2630
|
+
};
|
|
2616
2631
|
globalConfig = {};
|
|
2617
2632
|
});
|
|
2618
2633
|
|
|
@@ -2620,7 +2635,13 @@ var init_core = __esm(() => {
|
|
|
2620
2635
|
var exports_util = {};
|
|
2621
2636
|
__export(exports_util, {
|
|
2622
2637
|
unwrapMessage: () => unwrapMessage,
|
|
2638
|
+
uint8ArrayToHex: () => uint8ArrayToHex,
|
|
2639
|
+
uint8ArrayToBase64url: () => uint8ArrayToBase64url,
|
|
2640
|
+
uint8ArrayToBase64: () => uint8ArrayToBase64,
|
|
2623
2641
|
stringifyPrimitive: () => stringifyPrimitive,
|
|
2642
|
+
slugify: () => slugify,
|
|
2643
|
+
shallowClone: () => shallowClone,
|
|
2644
|
+
safeExtend: () => safeExtend,
|
|
2624
2645
|
required: () => required,
|
|
2625
2646
|
randomString: () => randomString,
|
|
2626
2647
|
propertyKeyTypes: () => propertyKeyTypes,
|
|
@@ -2629,17 +2650,21 @@ __export(exports_util, {
|
|
|
2629
2650
|
prefixIssues: () => prefixIssues,
|
|
2630
2651
|
pick: () => pick,
|
|
2631
2652
|
partial: () => partial,
|
|
2653
|
+
parsedType: () => parsedType,
|
|
2632
2654
|
optionalKeys: () => optionalKeys,
|
|
2633
2655
|
omit: () => omit,
|
|
2656
|
+
objectClone: () => objectClone,
|
|
2634
2657
|
numKeys: () => numKeys,
|
|
2635
2658
|
nullish: () => nullish,
|
|
2636
2659
|
normalizeParams: () => normalizeParams,
|
|
2660
|
+
mergeDefs: () => mergeDefs,
|
|
2637
2661
|
merge: () => merge,
|
|
2638
2662
|
jsonStringifyReplacer: () => jsonStringifyReplacer,
|
|
2639
2663
|
joinValues: () => joinValues,
|
|
2640
2664
|
issue: () => issue,
|
|
2641
2665
|
isPlainObject: () => isPlainObject,
|
|
2642
2666
|
isObject: () => isObject,
|
|
2667
|
+
hexToUint8Array: () => hexToUint8Array,
|
|
2643
2668
|
getSizableOrigin: () => getSizableOrigin,
|
|
2644
2669
|
getParsedType: () => getParsedType,
|
|
2645
2670
|
getLengthableOrigin: () => getLengthableOrigin,
|
|
@@ -2652,11 +2677,14 @@ __export(exports_util, {
|
|
|
2652
2677
|
esc: () => esc,
|
|
2653
2678
|
defineLazy: () => defineLazy,
|
|
2654
2679
|
createTransparentProxy: () => createTransparentProxy,
|
|
2680
|
+
cloneDef: () => cloneDef,
|
|
2655
2681
|
clone: () => clone,
|
|
2656
2682
|
cleanRegex: () => cleanRegex,
|
|
2657
2683
|
cleanEnum: () => cleanEnum,
|
|
2658
2684
|
captureStackTrace: () => captureStackTrace,
|
|
2659
2685
|
cached: () => cached,
|
|
2686
|
+
base64urlToUint8Array: () => base64urlToUint8Array,
|
|
2687
|
+
base64ToUint8Array: () => base64ToUint8Array,
|
|
2660
2688
|
assignProp: () => assignProp,
|
|
2661
2689
|
assertNotEqual: () => assertNotEqual,
|
|
2662
2690
|
assertNever: () => assertNever,
|
|
@@ -2677,7 +2705,7 @@ function assertNotEqual(val) {
|
|
|
2677
2705
|
}
|
|
2678
2706
|
function assertIs(_arg) {}
|
|
2679
2707
|
function assertNever(_x) {
|
|
2680
|
-
throw new Error;
|
|
2708
|
+
throw new Error("Unexpected value in exhaustive check");
|
|
2681
2709
|
}
|
|
2682
2710
|
function assert(_) {}
|
|
2683
2711
|
function getEnumValues(entries) {
|
|
@@ -2716,22 +2744,31 @@ function cleanRegex(source) {
|
|
|
2716
2744
|
}
|
|
2717
2745
|
function floatSafeRemainder(val, step) {
|
|
2718
2746
|
const valDecCount = (val.toString().split(".")[1] || "").length;
|
|
2719
|
-
const
|
|
2747
|
+
const stepString = step.toString();
|
|
2748
|
+
let stepDecCount = (stepString.split(".")[1] || "").length;
|
|
2749
|
+
if (stepDecCount === 0 && /\d?e-\d?/.test(stepString)) {
|
|
2750
|
+
const match = stepString.match(/\d?e-(\d?)/);
|
|
2751
|
+
if (match?.[1]) {
|
|
2752
|
+
stepDecCount = Number.parseInt(match[1]);
|
|
2753
|
+
}
|
|
2754
|
+
}
|
|
2720
2755
|
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
|
|
2721
2756
|
const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
|
|
2722
2757
|
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
|
2723
2758
|
return valInt % stepInt / 10 ** decCount;
|
|
2724
2759
|
}
|
|
2725
2760
|
function defineLazy(object, key, getter) {
|
|
2726
|
-
|
|
2761
|
+
let value = undefined;
|
|
2727
2762
|
Object.defineProperty(object, key, {
|
|
2728
2763
|
get() {
|
|
2729
|
-
if (
|
|
2730
|
-
|
|
2731
|
-
object[key] = value;
|
|
2732
|
-
return value;
|
|
2764
|
+
if (value === EVALUATING) {
|
|
2765
|
+
return;
|
|
2733
2766
|
}
|
|
2734
|
-
|
|
2767
|
+
if (value === undefined) {
|
|
2768
|
+
value = EVALUATING;
|
|
2769
|
+
value = getter();
|
|
2770
|
+
}
|
|
2771
|
+
return value;
|
|
2735
2772
|
},
|
|
2736
2773
|
set(v) {
|
|
2737
2774
|
Object.defineProperty(object, key, {
|
|
@@ -2741,6 +2778,9 @@ function defineLazy(object, key, getter) {
|
|
|
2741
2778
|
configurable: true
|
|
2742
2779
|
});
|
|
2743
2780
|
}
|
|
2781
|
+
function objectClone(obj) {
|
|
2782
|
+
return Object.create(Object.getPrototypeOf(obj), Object.getOwnPropertyDescriptors(obj));
|
|
2783
|
+
}
|
|
2744
2784
|
function assignProp(target, prop, value) {
|
|
2745
2785
|
Object.defineProperty(target, prop, {
|
|
2746
2786
|
value,
|
|
@@ -2749,6 +2789,17 @@ function assignProp(target, prop, value) {
|
|
|
2749
2789
|
configurable: true
|
|
2750
2790
|
});
|
|
2751
2791
|
}
|
|
2792
|
+
function mergeDefs(...defs) {
|
|
2793
|
+
const mergedDescriptors = {};
|
|
2794
|
+
for (const def of defs) {
|
|
2795
|
+
const descriptors = Object.getOwnPropertyDescriptors(def);
|
|
2796
|
+
Object.assign(mergedDescriptors, descriptors);
|
|
2797
|
+
}
|
|
2798
|
+
return Object.defineProperties({}, mergedDescriptors);
|
|
2799
|
+
}
|
|
2800
|
+
function cloneDef(schema) {
|
|
2801
|
+
return mergeDefs(schema._zod.def);
|
|
2802
|
+
}
|
|
2752
2803
|
function getElementAtPath(obj, path11) {
|
|
2753
2804
|
if (!path11)
|
|
2754
2805
|
return obj;
|
|
@@ -2776,6 +2827,9 @@ function randomString(length = 10) {
|
|
|
2776
2827
|
function esc(str) {
|
|
2777
2828
|
return JSON.stringify(str);
|
|
2778
2829
|
}
|
|
2830
|
+
function slugify(input) {
|
|
2831
|
+
return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
2832
|
+
}
|
|
2779
2833
|
function isObject(data) {
|
|
2780
2834
|
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
2781
2835
|
}
|
|
@@ -2785,6 +2839,8 @@ function isPlainObject(o) {
|
|
|
2785
2839
|
const ctor = o.constructor;
|
|
2786
2840
|
if (ctor === undefined)
|
|
2787
2841
|
return true;
|
|
2842
|
+
if (typeof ctor !== "function")
|
|
2843
|
+
return true;
|
|
2788
2844
|
const prot = ctor.prototype;
|
|
2789
2845
|
if (isObject(prot) === false)
|
|
2790
2846
|
return false;
|
|
@@ -2793,6 +2849,13 @@ function isPlainObject(o) {
|
|
|
2793
2849
|
}
|
|
2794
2850
|
return true;
|
|
2795
2851
|
}
|
|
2852
|
+
function shallowClone(o) {
|
|
2853
|
+
if (isPlainObject(o))
|
|
2854
|
+
return { ...o };
|
|
2855
|
+
if (Array.isArray(o))
|
|
2856
|
+
return [...o];
|
|
2857
|
+
return o;
|
|
2858
|
+
}
|
|
2796
2859
|
function numKeys(data) {
|
|
2797
2860
|
let keyCount = 0;
|
|
2798
2861
|
for (const key in data) {
|
|
@@ -2873,128 +2936,181 @@ function optionalKeys(shape) {
|
|
|
2873
2936
|
});
|
|
2874
2937
|
}
|
|
2875
2938
|
function pick(schema, mask) {
|
|
2876
|
-
const newShape = {};
|
|
2877
2939
|
const currDef = schema._zod.def;
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
if (!mask[key])
|
|
2883
|
-
continue;
|
|
2884
|
-
newShape[key] = currDef.shape[key];
|
|
2940
|
+
const checks = currDef.checks;
|
|
2941
|
+
const hasChecks = checks && checks.length > 0;
|
|
2942
|
+
if (hasChecks) {
|
|
2943
|
+
throw new Error(".pick() cannot be used on object schemas containing refinements");
|
|
2885
2944
|
}
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2945
|
+
const def = mergeDefs(schema._zod.def, {
|
|
2946
|
+
get shape() {
|
|
2947
|
+
const newShape = {};
|
|
2948
|
+
for (const key in mask) {
|
|
2949
|
+
if (!(key in currDef.shape)) {
|
|
2950
|
+
throw new Error(`Unrecognized key: "${key}"`);
|
|
2951
|
+
}
|
|
2952
|
+
if (!mask[key])
|
|
2953
|
+
continue;
|
|
2954
|
+
newShape[key] = currDef.shape[key];
|
|
2955
|
+
}
|
|
2956
|
+
assignProp(this, "shape", newShape);
|
|
2957
|
+
return newShape;
|
|
2958
|
+
},
|
|
2889
2959
|
checks: []
|
|
2890
2960
|
});
|
|
2961
|
+
return clone(schema, def);
|
|
2891
2962
|
}
|
|
2892
2963
|
function omit(schema, mask) {
|
|
2893
|
-
const newShape = { ...schema._zod.def.shape };
|
|
2894
2964
|
const currDef = schema._zod.def;
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
if (!mask[key])
|
|
2900
|
-
continue;
|
|
2901
|
-
delete newShape[key];
|
|
2965
|
+
const checks = currDef.checks;
|
|
2966
|
+
const hasChecks = checks && checks.length > 0;
|
|
2967
|
+
if (hasChecks) {
|
|
2968
|
+
throw new Error(".omit() cannot be used on object schemas containing refinements");
|
|
2902
2969
|
}
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2970
|
+
const def = mergeDefs(schema._zod.def, {
|
|
2971
|
+
get shape() {
|
|
2972
|
+
const newShape = { ...schema._zod.def.shape };
|
|
2973
|
+
for (const key in mask) {
|
|
2974
|
+
if (!(key in currDef.shape)) {
|
|
2975
|
+
throw new Error(`Unrecognized key: "${key}"`);
|
|
2976
|
+
}
|
|
2977
|
+
if (!mask[key])
|
|
2978
|
+
continue;
|
|
2979
|
+
delete newShape[key];
|
|
2980
|
+
}
|
|
2981
|
+
assignProp(this, "shape", newShape);
|
|
2982
|
+
return newShape;
|
|
2983
|
+
},
|
|
2906
2984
|
checks: []
|
|
2907
2985
|
});
|
|
2986
|
+
return clone(schema, def);
|
|
2908
2987
|
}
|
|
2909
2988
|
function extend(schema, shape) {
|
|
2910
2989
|
if (!isPlainObject(shape)) {
|
|
2911
2990
|
throw new Error("Invalid input to extend: expected a plain object");
|
|
2912
2991
|
}
|
|
2913
|
-
const
|
|
2914
|
-
|
|
2992
|
+
const checks = schema._zod.def.checks;
|
|
2993
|
+
const hasChecks = checks && checks.length > 0;
|
|
2994
|
+
if (hasChecks) {
|
|
2995
|
+
const existingShape = schema._zod.def.shape;
|
|
2996
|
+
for (const key in shape) {
|
|
2997
|
+
if (Object.getOwnPropertyDescriptor(existingShape, key) !== undefined) {
|
|
2998
|
+
throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
2999
|
+
}
|
|
3000
|
+
}
|
|
3001
|
+
}
|
|
3002
|
+
const def = mergeDefs(schema._zod.def, {
|
|
2915
3003
|
get shape() {
|
|
2916
3004
|
const _shape = { ...schema._zod.def.shape, ...shape };
|
|
2917
3005
|
assignProp(this, "shape", _shape);
|
|
2918
3006
|
return _shape;
|
|
2919
|
-
}
|
|
2920
|
-
|
|
2921
|
-
|
|
3007
|
+
}
|
|
3008
|
+
});
|
|
3009
|
+
return clone(schema, def);
|
|
3010
|
+
}
|
|
3011
|
+
function safeExtend(schema, shape) {
|
|
3012
|
+
if (!isPlainObject(shape)) {
|
|
3013
|
+
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
3014
|
+
}
|
|
3015
|
+
const def = mergeDefs(schema._zod.def, {
|
|
3016
|
+
get shape() {
|
|
3017
|
+
const _shape = { ...schema._zod.def.shape, ...shape };
|
|
3018
|
+
assignProp(this, "shape", _shape);
|
|
3019
|
+
return _shape;
|
|
3020
|
+
}
|
|
3021
|
+
});
|
|
2922
3022
|
return clone(schema, def);
|
|
2923
3023
|
}
|
|
2924
3024
|
function merge(a, b) {
|
|
2925
|
-
|
|
2926
|
-
...a._zod.def,
|
|
3025
|
+
const def = mergeDefs(a._zod.def, {
|
|
2927
3026
|
get shape() {
|
|
2928
3027
|
const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
|
|
2929
3028
|
assignProp(this, "shape", _shape);
|
|
2930
3029
|
return _shape;
|
|
2931
3030
|
},
|
|
2932
|
-
catchall
|
|
3031
|
+
get catchall() {
|
|
3032
|
+
return b._zod.def.catchall;
|
|
3033
|
+
},
|
|
2933
3034
|
checks: []
|
|
2934
3035
|
});
|
|
3036
|
+
return clone(a, def);
|
|
2935
3037
|
}
|
|
2936
3038
|
function partial(Class, schema, mask) {
|
|
2937
|
-
const
|
|
2938
|
-
const
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
throw new Error(`Unrecognized key: "${key}"`);
|
|
2943
|
-
}
|
|
2944
|
-
if (!mask[key])
|
|
2945
|
-
continue;
|
|
2946
|
-
shape[key] = Class ? new Class({
|
|
2947
|
-
type: "optional",
|
|
2948
|
-
innerType: oldShape[key]
|
|
2949
|
-
}) : oldShape[key];
|
|
2950
|
-
}
|
|
2951
|
-
} else {
|
|
2952
|
-
for (const key in oldShape) {
|
|
2953
|
-
shape[key] = Class ? new Class({
|
|
2954
|
-
type: "optional",
|
|
2955
|
-
innerType: oldShape[key]
|
|
2956
|
-
}) : oldShape[key];
|
|
2957
|
-
}
|
|
3039
|
+
const currDef = schema._zod.def;
|
|
3040
|
+
const checks = currDef.checks;
|
|
3041
|
+
const hasChecks = checks && checks.length > 0;
|
|
3042
|
+
if (hasChecks) {
|
|
3043
|
+
throw new Error(".partial() cannot be used on object schemas containing refinements");
|
|
2958
3044
|
}
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
3045
|
+
const def = mergeDefs(schema._zod.def, {
|
|
3046
|
+
get shape() {
|
|
3047
|
+
const oldShape = schema._zod.def.shape;
|
|
3048
|
+
const shape = { ...oldShape };
|
|
3049
|
+
if (mask) {
|
|
3050
|
+
for (const key in mask) {
|
|
3051
|
+
if (!(key in oldShape)) {
|
|
3052
|
+
throw new Error(`Unrecognized key: "${key}"`);
|
|
3053
|
+
}
|
|
3054
|
+
if (!mask[key])
|
|
3055
|
+
continue;
|
|
3056
|
+
shape[key] = Class ? new Class({
|
|
3057
|
+
type: "optional",
|
|
3058
|
+
innerType: oldShape[key]
|
|
3059
|
+
}) : oldShape[key];
|
|
3060
|
+
}
|
|
3061
|
+
} else {
|
|
3062
|
+
for (const key in oldShape) {
|
|
3063
|
+
shape[key] = Class ? new Class({
|
|
3064
|
+
type: "optional",
|
|
3065
|
+
innerType: oldShape[key]
|
|
3066
|
+
}) : oldShape[key];
|
|
3067
|
+
}
|
|
3068
|
+
}
|
|
3069
|
+
assignProp(this, "shape", shape);
|
|
3070
|
+
return shape;
|
|
3071
|
+
},
|
|
2962
3072
|
checks: []
|
|
2963
3073
|
});
|
|
3074
|
+
return clone(schema, def);
|
|
2964
3075
|
}
|
|
2965
3076
|
function required(Class, schema, mask) {
|
|
2966
|
-
const
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
if (
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
3077
|
+
const def = mergeDefs(schema._zod.def, {
|
|
3078
|
+
get shape() {
|
|
3079
|
+
const oldShape = schema._zod.def.shape;
|
|
3080
|
+
const shape = { ...oldShape };
|
|
3081
|
+
if (mask) {
|
|
3082
|
+
for (const key in mask) {
|
|
3083
|
+
if (!(key in shape)) {
|
|
3084
|
+
throw new Error(`Unrecognized key: "${key}"`);
|
|
3085
|
+
}
|
|
3086
|
+
if (!mask[key])
|
|
3087
|
+
continue;
|
|
3088
|
+
shape[key] = new Class({
|
|
3089
|
+
type: "nonoptional",
|
|
3090
|
+
innerType: oldShape[key]
|
|
3091
|
+
});
|
|
3092
|
+
}
|
|
3093
|
+
} else {
|
|
3094
|
+
for (const key in oldShape) {
|
|
3095
|
+
shape[key] = new Class({
|
|
3096
|
+
type: "nonoptional",
|
|
3097
|
+
innerType: oldShape[key]
|
|
3098
|
+
});
|
|
3099
|
+
}
|
|
3100
|
+
}
|
|
3101
|
+
assignProp(this, "shape", shape);
|
|
3102
|
+
return shape;
|
|
2986
3103
|
}
|
|
2987
|
-
}
|
|
2988
|
-
return clone(schema, {
|
|
2989
|
-
...schema._zod.def,
|
|
2990
|
-
shape,
|
|
2991
|
-
checks: []
|
|
2992
3104
|
});
|
|
3105
|
+
return clone(schema, def);
|
|
2993
3106
|
}
|
|
2994
3107
|
function aborted(x, startIndex = 0) {
|
|
3108
|
+
if (x.aborted === true)
|
|
3109
|
+
return true;
|
|
2995
3110
|
for (let i = startIndex;i < x.issues.length; i++) {
|
|
2996
|
-
if (x.issues[i]?.continue !== true)
|
|
3111
|
+
if (x.issues[i]?.continue !== true) {
|
|
2997
3112
|
return true;
|
|
3113
|
+
}
|
|
2998
3114
|
}
|
|
2999
3115
|
return false;
|
|
3000
3116
|
}
|
|
@@ -3038,6 +3154,27 @@ function getLengthableOrigin(input) {
|
|
|
3038
3154
|
return "string";
|
|
3039
3155
|
return "unknown";
|
|
3040
3156
|
}
|
|
3157
|
+
function parsedType(data) {
|
|
3158
|
+
const t = typeof data;
|
|
3159
|
+
switch (t) {
|
|
3160
|
+
case "number": {
|
|
3161
|
+
return Number.isNaN(data) ? "nan" : "number";
|
|
3162
|
+
}
|
|
3163
|
+
case "object": {
|
|
3164
|
+
if (data === null) {
|
|
3165
|
+
return "null";
|
|
3166
|
+
}
|
|
3167
|
+
if (Array.isArray(data)) {
|
|
3168
|
+
return "array";
|
|
3169
|
+
}
|
|
3170
|
+
const obj = data;
|
|
3171
|
+
if (obj && Object.getPrototypeOf(obj) !== Object.prototype && "constructor" in obj && obj.constructor) {
|
|
3172
|
+
return obj.constructor.name;
|
|
3173
|
+
}
|
|
3174
|
+
}
|
|
3175
|
+
}
|
|
3176
|
+
return t;
|
|
3177
|
+
}
|
|
3041
3178
|
function issue(...args) {
|
|
3042
3179
|
const [iss, input, inst] = args;
|
|
3043
3180
|
if (typeof iss === "string") {
|
|
@@ -3055,11 +3192,48 @@ function cleanEnum(obj) {
|
|
|
3055
3192
|
return Number.isNaN(Number.parseInt(k, 10));
|
|
3056
3193
|
}).map((el) => el[1]);
|
|
3057
3194
|
}
|
|
3195
|
+
function base64ToUint8Array(base64) {
|
|
3196
|
+
const binaryString = atob(base64);
|
|
3197
|
+
const bytes = new Uint8Array(binaryString.length);
|
|
3198
|
+
for (let i = 0;i < binaryString.length; i++) {
|
|
3199
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
3200
|
+
}
|
|
3201
|
+
return bytes;
|
|
3202
|
+
}
|
|
3203
|
+
function uint8ArrayToBase64(bytes) {
|
|
3204
|
+
let binaryString = "";
|
|
3205
|
+
for (let i = 0;i < bytes.length; i++) {
|
|
3206
|
+
binaryString += String.fromCharCode(bytes[i]);
|
|
3207
|
+
}
|
|
3208
|
+
return btoa(binaryString);
|
|
3209
|
+
}
|
|
3210
|
+
function base64urlToUint8Array(base64url) {
|
|
3211
|
+
const base64 = base64url.replace(/-/g, "+").replace(/_/g, "/");
|
|
3212
|
+
const padding = "=".repeat((4 - base64.length % 4) % 4);
|
|
3213
|
+
return base64ToUint8Array(base64 + padding);
|
|
3214
|
+
}
|
|
3215
|
+
function uint8ArrayToBase64url(bytes) {
|
|
3216
|
+
return uint8ArrayToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
3217
|
+
}
|
|
3218
|
+
function hexToUint8Array(hex) {
|
|
3219
|
+
const cleanHex = hex.replace(/^0x/, "");
|
|
3220
|
+
if (cleanHex.length % 2 !== 0) {
|
|
3221
|
+
throw new Error("Invalid hex string length");
|
|
3222
|
+
}
|
|
3223
|
+
const bytes = new Uint8Array(cleanHex.length / 2);
|
|
3224
|
+
for (let i = 0;i < cleanHex.length; i += 2) {
|
|
3225
|
+
bytes[i / 2] = Number.parseInt(cleanHex.slice(i, i + 2), 16);
|
|
3226
|
+
}
|
|
3227
|
+
return bytes;
|
|
3228
|
+
}
|
|
3229
|
+
function uint8ArrayToHex(bytes) {
|
|
3230
|
+
return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
3231
|
+
}
|
|
3058
3232
|
|
|
3059
3233
|
class Class {
|
|
3060
3234
|
constructor(..._args) {}
|
|
3061
3235
|
}
|
|
3062
|
-
var captureStackTrace, allowsEval, getParsedType = (data) => {
|
|
3236
|
+
var EVALUATING, captureStackTrace, allowsEval, getParsedType = (data) => {
|
|
3063
3237
|
const t = typeof data;
|
|
3064
3238
|
switch (t) {
|
|
3065
3239
|
case "undefined":
|
|
@@ -3104,7 +3278,8 @@ var captureStackTrace, allowsEval, getParsedType = (data) => {
|
|
|
3104
3278
|
}
|
|
3105
3279
|
}, propertyKeyTypes, primitiveTypes, NUMBER_FORMAT_RANGES, BIGINT_FORMAT_RANGES;
|
|
3106
3280
|
var init_util = __esm(() => {
|
|
3107
|
-
|
|
3281
|
+
EVALUATING = Symbol("evaluating");
|
|
3282
|
+
captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
|
|
3108
3283
|
allowsEval = cached(() => {
|
|
3109
3284
|
if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
|
|
3110
3285
|
return false;
|
|
@@ -3146,10 +3321,7 @@ function flattenError(error, mapper = (issue2) => issue2.message) {
|
|
|
3146
3321
|
}
|
|
3147
3322
|
return { formErrors, fieldErrors };
|
|
3148
3323
|
}
|
|
3149
|
-
function formatError(error,
|
|
3150
|
-
const mapper = _mapper || function(issue2) {
|
|
3151
|
-
return issue2.message;
|
|
3152
|
-
};
|
|
3324
|
+
function formatError(error, mapper = (issue2) => issue2.message) {
|
|
3153
3325
|
const fieldErrors = { _errors: [] };
|
|
3154
3326
|
const processError = (error2) => {
|
|
3155
3327
|
for (const issue2 of error2.issues) {
|
|
@@ -3192,12 +3364,7 @@ var initializer = (inst, def) => {
|
|
|
3192
3364
|
value: def,
|
|
3193
3365
|
enumerable: false
|
|
3194
3366
|
});
|
|
3195
|
-
|
|
3196
|
-
get() {
|
|
3197
|
-
return JSON.stringify(def, jsonStringifyReplacer, 2);
|
|
3198
|
-
},
|
|
3199
|
-
enumerable: true
|
|
3200
|
-
});
|
|
3367
|
+
inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
|
|
3201
3368
|
Object.defineProperty(inst, "toString", {
|
|
3202
3369
|
value: () => inst.message,
|
|
3203
3370
|
enumerable: false
|
|
@@ -3253,7 +3420,27 @@ var _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
|
3253
3420
|
success: false,
|
|
3254
3421
|
error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
3255
3422
|
} : { success: true, data: result.value };
|
|
3256
|
-
}, safeParseAsync
|
|
3423
|
+
}, safeParseAsync, _encode = (_Err) => (schema, value, _ctx) => {
|
|
3424
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
3425
|
+
return _parse(_Err)(schema, value, ctx);
|
|
3426
|
+
}, _decode = (_Err) => (schema, value, _ctx) => {
|
|
3427
|
+
return _parse(_Err)(schema, value, _ctx);
|
|
3428
|
+
}, _encodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
3429
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
3430
|
+
return _parseAsync(_Err)(schema, value, ctx);
|
|
3431
|
+
}, _decodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
3432
|
+
return _parseAsync(_Err)(schema, value, _ctx);
|
|
3433
|
+
}, _safeEncode = (_Err) => (schema, value, _ctx) => {
|
|
3434
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
3435
|
+
return _safeParse(_Err)(schema, value, ctx);
|
|
3436
|
+
}, _safeDecode = (_Err) => (schema, value, _ctx) => {
|
|
3437
|
+
return _safeParse(_Err)(schema, value, _ctx);
|
|
3438
|
+
}, _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
3439
|
+
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
3440
|
+
return _safeParseAsync(_Err)(schema, value, ctx);
|
|
3441
|
+
}, _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
3442
|
+
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
3443
|
+
};
|
|
3257
3444
|
var init_parse = __esm(() => {
|
|
3258
3445
|
init_core();
|
|
3259
3446
|
init_errors();
|
|
@@ -3280,15 +3467,15 @@ function datetime(args) {
|
|
|
3280
3467
|
if (args.local)
|
|
3281
3468
|
opts.push("");
|
|
3282
3469
|
if (args.offset)
|
|
3283
|
-
opts.push(`([+-]\\d
|
|
3470
|
+
opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
|
|
3284
3471
|
const timeRegex = `${time2}(?:${opts.join("|")})`;
|
|
3285
3472
|
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
3286
3473
|
}
|
|
3287
3474
|
var cuid, cuid2, ulid, xid, ksuid, nanoid, duration, guid, uuid = (version) => {
|
|
3288
3475
|
if (!version)
|
|
3289
|
-
return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/;
|
|
3476
|
+
return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
|
|
3290
3477
|
return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
|
|
3291
|
-
}, email, _emoji = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`, ipv4, ipv6, cidrv4, cidrv6, base64, base64url,
|
|
3478
|
+
}, email, _emoji = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`, ipv4, ipv6, cidrv4, cidrv6, base64, base64url, e164, dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`, date, string = (params) => {
|
|
3292
3479
|
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
3293
3480
|
return new RegExp(`^${regex}$`);
|
|
3294
3481
|
}, integer, number, boolean, _null, lowercase, uppercase;
|
|
@@ -3303,18 +3490,17 @@ var init_regexes = __esm(() => {
|
|
|
3303
3490
|
guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
|
|
3304
3491
|
email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
|
3305
3492
|
ipv4 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
|
|
3306
|
-
ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}
|
|
3493
|
+
ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;
|
|
3307
3494
|
cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
|
|
3308
3495
|
cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
3309
3496
|
base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
3310
3497
|
base64url = /^[A-Za-z0-9_-]*$/;
|
|
3311
|
-
|
|
3312
|
-
e164 = /^\+(?:[0-9]){6,14}[0-9]$/;
|
|
3498
|
+
e164 = /^\+[1-9]\d{6,14}$/;
|
|
3313
3499
|
date = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
|
|
3314
|
-
integer =
|
|
3315
|
-
number = /^-?\d+(?:\.\d+)
|
|
3316
|
-
boolean =
|
|
3317
|
-
_null =
|
|
3500
|
+
integer = /^-?\d+$/;
|
|
3501
|
+
number = /^-?\d+(?:\.\d+)?$/;
|
|
3502
|
+
boolean = /^(?:true|false)$/i;
|
|
3503
|
+
_null = /^null$/i;
|
|
3318
3504
|
lowercase = /^[^A-Z]*$/;
|
|
3319
3505
|
uppercase = /^[^a-z]*$/;
|
|
3320
3506
|
});
|
|
@@ -3356,7 +3542,7 @@ var init_checks = __esm(() => {
|
|
|
3356
3542
|
payload.issues.push({
|
|
3357
3543
|
origin,
|
|
3358
3544
|
code: "too_big",
|
|
3359
|
-
maximum: def.value,
|
|
3545
|
+
maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
3360
3546
|
input: payload.value,
|
|
3361
3547
|
inclusive: def.inclusive,
|
|
3362
3548
|
inst,
|
|
@@ -3384,7 +3570,7 @@ var init_checks = __esm(() => {
|
|
|
3384
3570
|
payload.issues.push({
|
|
3385
3571
|
origin,
|
|
3386
3572
|
code: "too_small",
|
|
3387
|
-
minimum: def.value,
|
|
3573
|
+
minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
3388
3574
|
input: payload.value,
|
|
3389
3575
|
inclusive: def.inclusive,
|
|
3390
3576
|
inst,
|
|
@@ -3436,6 +3622,7 @@ var init_checks = __esm(() => {
|
|
|
3436
3622
|
expected: origin,
|
|
3437
3623
|
format: def.format,
|
|
3438
3624
|
code: "invalid_type",
|
|
3625
|
+
continue: false,
|
|
3439
3626
|
input,
|
|
3440
3627
|
inst
|
|
3441
3628
|
});
|
|
@@ -3450,6 +3637,7 @@ var init_checks = __esm(() => {
|
|
|
3450
3637
|
note: "Integers must be within the safe integer range.",
|
|
3451
3638
|
inst,
|
|
3452
3639
|
origin,
|
|
3640
|
+
inclusive: true,
|
|
3453
3641
|
continue: !def.abort
|
|
3454
3642
|
});
|
|
3455
3643
|
} else {
|
|
@@ -3460,6 +3648,7 @@ var init_checks = __esm(() => {
|
|
|
3460
3648
|
note: "Integers must be within the safe integer range.",
|
|
3461
3649
|
inst,
|
|
3462
3650
|
origin,
|
|
3651
|
+
inclusive: true,
|
|
3463
3652
|
continue: !def.abort
|
|
3464
3653
|
});
|
|
3465
3654
|
}
|
|
@@ -3483,7 +3672,9 @@ var init_checks = __esm(() => {
|
|
|
3483
3672
|
input,
|
|
3484
3673
|
code: "too_big",
|
|
3485
3674
|
maximum,
|
|
3486
|
-
|
|
3675
|
+
inclusive: true,
|
|
3676
|
+
inst,
|
|
3677
|
+
continue: !def.abort
|
|
3487
3678
|
});
|
|
3488
3679
|
}
|
|
3489
3680
|
};
|
|
@@ -3752,8 +3943,8 @@ var version;
|
|
|
3752
3943
|
var init_versions = __esm(() => {
|
|
3753
3944
|
version = {
|
|
3754
3945
|
major: 4,
|
|
3755
|
-
minor:
|
|
3756
|
-
patch:
|
|
3946
|
+
minor: 3,
|
|
3947
|
+
patch: 6
|
|
3757
3948
|
};
|
|
3758
3949
|
});
|
|
3759
3950
|
|
|
@@ -3803,30 +3994,71 @@ function handleArrayResult(result, final, index) {
|
|
|
3803
3994
|
}
|
|
3804
3995
|
final.value[index] = result.value;
|
|
3805
3996
|
}
|
|
3806
|
-
function
|
|
3997
|
+
function handlePropertyResult(result, final, key, input, isOptionalOut) {
|
|
3807
3998
|
if (result.issues.length) {
|
|
3999
|
+
if (isOptionalOut && !(key in input)) {
|
|
4000
|
+
return;
|
|
4001
|
+
}
|
|
3808
4002
|
final.issues.push(...prefixIssues(key, result.issues));
|
|
3809
4003
|
}
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
function handleOptionalObjectResult(result, final, key, input) {
|
|
3813
|
-
if (result.issues.length) {
|
|
3814
|
-
if (input[key] === undefined) {
|
|
3815
|
-
if (key in input) {
|
|
3816
|
-
final.value[key] = undefined;
|
|
3817
|
-
} else {
|
|
3818
|
-
final.value[key] = result.value;
|
|
3819
|
-
}
|
|
3820
|
-
} else {
|
|
3821
|
-
final.issues.push(...prefixIssues(key, result.issues));
|
|
3822
|
-
}
|
|
3823
|
-
} else if (result.value === undefined) {
|
|
3824
|
-
if (key in input)
|
|
4004
|
+
if (result.value === undefined) {
|
|
4005
|
+
if (key in input) {
|
|
3825
4006
|
final.value[key] = undefined;
|
|
4007
|
+
}
|
|
3826
4008
|
} else {
|
|
3827
4009
|
final.value[key] = result.value;
|
|
3828
4010
|
}
|
|
3829
4011
|
}
|
|
4012
|
+
function normalizeDef(def) {
|
|
4013
|
+
const keys = Object.keys(def.shape);
|
|
4014
|
+
for (const k of keys) {
|
|
4015
|
+
if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) {
|
|
4016
|
+
throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
|
|
4017
|
+
}
|
|
4018
|
+
}
|
|
4019
|
+
const okeys = optionalKeys(def.shape);
|
|
4020
|
+
return {
|
|
4021
|
+
...def,
|
|
4022
|
+
keys,
|
|
4023
|
+
keySet: new Set(keys),
|
|
4024
|
+
numKeys: keys.length,
|
|
4025
|
+
optionalKeys: new Set(okeys)
|
|
4026
|
+
};
|
|
4027
|
+
}
|
|
4028
|
+
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
4029
|
+
const unrecognized = [];
|
|
4030
|
+
const keySet = def.keySet;
|
|
4031
|
+
const _catchall = def.catchall._zod;
|
|
4032
|
+
const t = _catchall.def.type;
|
|
4033
|
+
const isOptionalOut = _catchall.optout === "optional";
|
|
4034
|
+
for (const key in input) {
|
|
4035
|
+
if (keySet.has(key))
|
|
4036
|
+
continue;
|
|
4037
|
+
if (t === "never") {
|
|
4038
|
+
unrecognized.push(key);
|
|
4039
|
+
continue;
|
|
4040
|
+
}
|
|
4041
|
+
const r = _catchall.run({ value: input[key], issues: [] }, ctx);
|
|
4042
|
+
if (r instanceof Promise) {
|
|
4043
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalOut)));
|
|
4044
|
+
} else {
|
|
4045
|
+
handlePropertyResult(r, payload, key, input, isOptionalOut);
|
|
4046
|
+
}
|
|
4047
|
+
}
|
|
4048
|
+
if (unrecognized.length) {
|
|
4049
|
+
payload.issues.push({
|
|
4050
|
+
code: "unrecognized_keys",
|
|
4051
|
+
keys: unrecognized,
|
|
4052
|
+
input,
|
|
4053
|
+
inst
|
|
4054
|
+
});
|
|
4055
|
+
}
|
|
4056
|
+
if (!proms.length)
|
|
4057
|
+
return payload;
|
|
4058
|
+
return Promise.all(proms).then(() => {
|
|
4059
|
+
return payload;
|
|
4060
|
+
});
|
|
4061
|
+
}
|
|
3830
4062
|
function handleUnionResults(results, final, inst, ctx) {
|
|
3831
4063
|
for (const result of results) {
|
|
3832
4064
|
if (result.issues.length === 0) {
|
|
@@ -3834,6 +4066,11 @@ function handleUnionResults(results, final, inst, ctx) {
|
|
|
3834
4066
|
return final;
|
|
3835
4067
|
}
|
|
3836
4068
|
}
|
|
4069
|
+
const nonaborted = results.filter((r) => !aborted(r));
|
|
4070
|
+
if (nonaborted.length === 1) {
|
|
4071
|
+
final.value = nonaborted[0].value;
|
|
4072
|
+
return nonaborted[0];
|
|
4073
|
+
}
|
|
3837
4074
|
final.issues.push({
|
|
3838
4075
|
code: "invalid_union",
|
|
3839
4076
|
input: final.value,
|
|
@@ -3887,11 +4124,34 @@ function mergeValues(a, b) {
|
|
|
3887
4124
|
return { valid: false, mergeErrorPath: [] };
|
|
3888
4125
|
}
|
|
3889
4126
|
function handleIntersectionResults(result, left, right) {
|
|
3890
|
-
|
|
3891
|
-
|
|
4127
|
+
const unrecKeys = new Map;
|
|
4128
|
+
let unrecIssue;
|
|
4129
|
+
for (const iss of left.issues) {
|
|
4130
|
+
if (iss.code === "unrecognized_keys") {
|
|
4131
|
+
unrecIssue ?? (unrecIssue = iss);
|
|
4132
|
+
for (const k of iss.keys) {
|
|
4133
|
+
if (!unrecKeys.has(k))
|
|
4134
|
+
unrecKeys.set(k, {});
|
|
4135
|
+
unrecKeys.get(k).l = true;
|
|
4136
|
+
}
|
|
4137
|
+
} else {
|
|
4138
|
+
result.issues.push(iss);
|
|
4139
|
+
}
|
|
3892
4140
|
}
|
|
3893
|
-
|
|
3894
|
-
|
|
4141
|
+
for (const iss of right.issues) {
|
|
4142
|
+
if (iss.code === "unrecognized_keys") {
|
|
4143
|
+
for (const k of iss.keys) {
|
|
4144
|
+
if (!unrecKeys.has(k))
|
|
4145
|
+
unrecKeys.set(k, {});
|
|
4146
|
+
unrecKeys.get(k).r = true;
|
|
4147
|
+
}
|
|
4148
|
+
} else {
|
|
4149
|
+
result.issues.push(iss);
|
|
4150
|
+
}
|
|
4151
|
+
}
|
|
4152
|
+
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
4153
|
+
if (bothKeys.length && unrecIssue) {
|
|
4154
|
+
result.issues.push({ ...unrecIssue, keys: bothKeys });
|
|
3895
4155
|
}
|
|
3896
4156
|
if (aborted(result))
|
|
3897
4157
|
return result;
|
|
@@ -3902,6 +4162,12 @@ function handleIntersectionResults(result, left, right) {
|
|
|
3902
4162
|
result.value = merged.data;
|
|
3903
4163
|
return result;
|
|
3904
4164
|
}
|
|
4165
|
+
function handleOptionalResult(result, input) {
|
|
4166
|
+
if (result.issues.length && input === undefined) {
|
|
4167
|
+
return { issues: [], value: undefined };
|
|
4168
|
+
}
|
|
4169
|
+
return result;
|
|
4170
|
+
}
|
|
3905
4171
|
function handleDefaultResult(payload, def) {
|
|
3906
4172
|
if (payload.value === undefined) {
|
|
3907
4173
|
payload.value = def.defaultValue;
|
|
@@ -3919,11 +4185,12 @@ function handleNonOptionalResult(payload, inst) {
|
|
|
3919
4185
|
}
|
|
3920
4186
|
return payload;
|
|
3921
4187
|
}
|
|
3922
|
-
function handlePipeResult(left,
|
|
3923
|
-
if (
|
|
4188
|
+
function handlePipeResult(left, next, ctx) {
|
|
4189
|
+
if (left.issues.length) {
|
|
4190
|
+
left.aborted = true;
|
|
3924
4191
|
return left;
|
|
3925
4192
|
}
|
|
3926
|
-
return
|
|
4193
|
+
return next._zod.run({ value: left.value, issues: left.issues }, ctx);
|
|
3927
4194
|
}
|
|
3928
4195
|
function handleReadonlyResult(payload) {
|
|
3929
4196
|
payload.value = Object.freeze(payload.value);
|
|
@@ -3943,7 +4210,7 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
3943
4210
|
payload.issues.push(issue(_iss));
|
|
3944
4211
|
}
|
|
3945
4212
|
}
|
|
3946
|
-
var $ZodType, $ZodString, $ZodStringFormat, $ZodGUID, $ZodUUID, $ZodEmail, $ZodURL, $ZodEmoji, $ZodNanoID, $ZodCUID, $ZodCUID2, $ZodULID, $ZodXID, $ZodKSUID, $ZodISODateTime, $ZodISODate, $ZodISOTime, $ZodISODuration, $ZodIPv4, $ZodIPv6, $ZodCIDRv4, $ZodCIDRv6, $ZodBase64, $ZodBase64URL, $ZodE164, $ZodJWT, $ZodNumber, $ZodNumberFormat, $ZodBoolean, $ZodNull, $ZodUnknown, $ZodNever, $ZodArray, $ZodObject, $ZodUnion, $ZodDiscriminatedUnion, $ZodIntersection, $ZodRecord, $ZodEnum, $ZodLiteral, $ZodTransform, $ZodOptional, $ZodNullable, $ZodDefault, $ZodPrefault, $ZodNonOptional, $ZodCatch, $ZodPipe, $ZodReadonly, $ZodCustom;
|
|
4213
|
+
var $ZodType, $ZodString, $ZodStringFormat, $ZodGUID, $ZodUUID, $ZodEmail, $ZodURL, $ZodEmoji, $ZodNanoID, $ZodCUID, $ZodCUID2, $ZodULID, $ZodXID, $ZodKSUID, $ZodISODateTime, $ZodISODate, $ZodISOTime, $ZodISODuration, $ZodIPv4, $ZodIPv6, $ZodCIDRv4, $ZodCIDRv6, $ZodBase64, $ZodBase64URL, $ZodE164, $ZodJWT, $ZodNumber, $ZodNumberFormat, $ZodBoolean, $ZodNull, $ZodUnknown, $ZodNever, $ZodArray, $ZodObject, $ZodObjectJIT, $ZodUnion, $ZodDiscriminatedUnion, $ZodIntersection, $ZodRecord, $ZodEnum, $ZodLiteral, $ZodTransform, $ZodOptional, $ZodExactOptional, $ZodNullable, $ZodDefault, $ZodPrefault, $ZodNonOptional, $ZodCatch, $ZodPipe, $ZodReadonly, $ZodCustom;
|
|
3947
4214
|
var init_schemas = __esm(() => {
|
|
3948
4215
|
init_checks();
|
|
3949
4216
|
init_core();
|
|
@@ -4013,7 +4280,32 @@ var init_schemas = __esm(() => {
|
|
|
4013
4280
|
}
|
|
4014
4281
|
return payload;
|
|
4015
4282
|
};
|
|
4283
|
+
const handleCanaryResult = (canary, payload, ctx) => {
|
|
4284
|
+
if (aborted(canary)) {
|
|
4285
|
+
canary.aborted = true;
|
|
4286
|
+
return canary;
|
|
4287
|
+
}
|
|
4288
|
+
const checkResult = runChecks(payload, checks, ctx);
|
|
4289
|
+
if (checkResult instanceof Promise) {
|
|
4290
|
+
if (ctx.async === false)
|
|
4291
|
+
throw new $ZodAsyncError;
|
|
4292
|
+
return checkResult.then((checkResult2) => inst._zod.parse(checkResult2, ctx));
|
|
4293
|
+
}
|
|
4294
|
+
return inst._zod.parse(checkResult, ctx);
|
|
4295
|
+
};
|
|
4016
4296
|
inst._zod.run = (payload, ctx) => {
|
|
4297
|
+
if (ctx.skipChecks) {
|
|
4298
|
+
return inst._zod.parse(payload, ctx);
|
|
4299
|
+
}
|
|
4300
|
+
if (ctx.direction === "backward") {
|
|
4301
|
+
const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });
|
|
4302
|
+
if (canary instanceof Promise) {
|
|
4303
|
+
return canary.then((canary2) => {
|
|
4304
|
+
return handleCanaryResult(canary2, payload, ctx);
|
|
4305
|
+
});
|
|
4306
|
+
}
|
|
4307
|
+
return handleCanaryResult(canary, payload, ctx);
|
|
4308
|
+
}
|
|
4017
4309
|
const result = inst._zod.parse(payload, ctx);
|
|
4018
4310
|
if (result instanceof Promise) {
|
|
4019
4311
|
if (ctx.async === false)
|
|
@@ -4023,7 +4315,7 @@ var init_schemas = __esm(() => {
|
|
|
4023
4315
|
return runChecks(result, checks, ctx);
|
|
4024
4316
|
};
|
|
4025
4317
|
}
|
|
4026
|
-
inst
|
|
4318
|
+
defineLazy(inst, "~standard", () => ({
|
|
4027
4319
|
validate: (value) => {
|
|
4028
4320
|
try {
|
|
4029
4321
|
const r = safeParse(inst, value);
|
|
@@ -4034,7 +4326,7 @@ var init_schemas = __esm(() => {
|
|
|
4034
4326
|
},
|
|
4035
4327
|
vendor: "zod",
|
|
4036
4328
|
version: 1
|
|
4037
|
-
};
|
|
4329
|
+
}));
|
|
4038
4330
|
});
|
|
4039
4331
|
$ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
|
|
4040
4332
|
$ZodType.init(inst, def);
|
|
@@ -4091,9 +4383,8 @@ var init_schemas = __esm(() => {
|
|
|
4091
4383
|
$ZodStringFormat.init(inst, def);
|
|
4092
4384
|
inst._zod.check = (payload) => {
|
|
4093
4385
|
try {
|
|
4094
|
-
const
|
|
4095
|
-
const url = new URL(
|
|
4096
|
-
const href = url.href;
|
|
4386
|
+
const trimmed = payload.value.trim();
|
|
4387
|
+
const url = new URL(trimmed);
|
|
4097
4388
|
if (def.hostname) {
|
|
4098
4389
|
def.hostname.lastIndex = 0;
|
|
4099
4390
|
if (!def.hostname.test(url.hostname)) {
|
|
@@ -4101,7 +4392,7 @@ var init_schemas = __esm(() => {
|
|
|
4101
4392
|
code: "invalid_format",
|
|
4102
4393
|
format: "url",
|
|
4103
4394
|
note: "Invalid hostname",
|
|
4104
|
-
pattern: hostname.source,
|
|
4395
|
+
pattern: def.hostname.source,
|
|
4105
4396
|
input: payload.value,
|
|
4106
4397
|
inst,
|
|
4107
4398
|
continue: !def.abort
|
|
@@ -4122,10 +4413,10 @@ var init_schemas = __esm(() => {
|
|
|
4122
4413
|
});
|
|
4123
4414
|
}
|
|
4124
4415
|
}
|
|
4125
|
-
if (
|
|
4126
|
-
payload.value = href
|
|
4416
|
+
if (def.normalize) {
|
|
4417
|
+
payload.value = url.href;
|
|
4127
4418
|
} else {
|
|
4128
|
-
payload.value =
|
|
4419
|
+
payload.value = trimmed;
|
|
4129
4420
|
}
|
|
4130
4421
|
return;
|
|
4131
4422
|
} catch (_) {
|
|
@@ -4186,18 +4477,12 @@ var init_schemas = __esm(() => {
|
|
|
4186
4477
|
$ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
|
|
4187
4478
|
def.pattern ?? (def.pattern = ipv4);
|
|
4188
4479
|
$ZodStringFormat.init(inst, def);
|
|
4189
|
-
inst._zod.
|
|
4190
|
-
const bag = inst2._zod.bag;
|
|
4191
|
-
bag.format = `ipv4`;
|
|
4192
|
-
});
|
|
4480
|
+
inst._zod.bag.format = `ipv4`;
|
|
4193
4481
|
});
|
|
4194
4482
|
$ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
|
|
4195
4483
|
def.pattern ?? (def.pattern = ipv6);
|
|
4196
4484
|
$ZodStringFormat.init(inst, def);
|
|
4197
|
-
inst._zod.
|
|
4198
|
-
const bag = inst2._zod.bag;
|
|
4199
|
-
bag.format = `ipv6`;
|
|
4200
|
-
});
|
|
4485
|
+
inst._zod.bag.format = `ipv6`;
|
|
4201
4486
|
inst._zod.check = (payload) => {
|
|
4202
4487
|
try {
|
|
4203
4488
|
new URL(`http://[${payload.value}]`);
|
|
@@ -4220,8 +4505,11 @@ var init_schemas = __esm(() => {
|
|
|
4220
4505
|
def.pattern ?? (def.pattern = cidrv6);
|
|
4221
4506
|
$ZodStringFormat.init(inst, def);
|
|
4222
4507
|
inst._zod.check = (payload) => {
|
|
4223
|
-
const
|
|
4508
|
+
const parts = payload.value.split("/");
|
|
4224
4509
|
try {
|
|
4510
|
+
if (parts.length !== 2)
|
|
4511
|
+
throw new Error;
|
|
4512
|
+
const [address, prefix] = parts;
|
|
4225
4513
|
if (!prefix)
|
|
4226
4514
|
throw new Error;
|
|
4227
4515
|
const prefixNum = Number(prefix);
|
|
@@ -4244,9 +4532,7 @@ var init_schemas = __esm(() => {
|
|
|
4244
4532
|
$ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
4245
4533
|
def.pattern ?? (def.pattern = base64);
|
|
4246
4534
|
$ZodStringFormat.init(inst, def);
|
|
4247
|
-
inst._zod.
|
|
4248
|
-
inst2._zod.bag.contentEncoding = "base64";
|
|
4249
|
-
});
|
|
4535
|
+
inst._zod.bag.contentEncoding = "base64";
|
|
4250
4536
|
inst._zod.check = (payload) => {
|
|
4251
4537
|
if (isValidBase64(payload.value))
|
|
4252
4538
|
return;
|
|
@@ -4262,9 +4548,7 @@ var init_schemas = __esm(() => {
|
|
|
4262
4548
|
$ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
|
|
4263
4549
|
def.pattern ?? (def.pattern = base64url);
|
|
4264
4550
|
$ZodStringFormat.init(inst, def);
|
|
4265
|
-
inst._zod.
|
|
4266
|
-
inst2._zod.bag.contentEncoding = "base64url";
|
|
4267
|
-
});
|
|
4551
|
+
inst._zod.bag.contentEncoding = "base64url";
|
|
4268
4552
|
inst._zod.check = (payload) => {
|
|
4269
4553
|
if (isValidBase64URL(payload.value))
|
|
4270
4554
|
return;
|
|
@@ -4318,7 +4602,7 @@ var init_schemas = __esm(() => {
|
|
|
4318
4602
|
return payload;
|
|
4319
4603
|
};
|
|
4320
4604
|
});
|
|
4321
|
-
$ZodNumberFormat = /* @__PURE__ */ $constructor("$
|
|
4605
|
+
$ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst, def) => {
|
|
4322
4606
|
$ZodCheckNumberFormat.init(inst, def);
|
|
4323
4607
|
$ZodNumber.init(inst, def);
|
|
4324
4608
|
});
|
|
@@ -4410,22 +4694,20 @@ var init_schemas = __esm(() => {
|
|
|
4410
4694
|
});
|
|
4411
4695
|
$ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
4412
4696
|
$ZodType.init(inst, def);
|
|
4413
|
-
const
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4697
|
+
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
4698
|
+
if (!desc?.get) {
|
|
4699
|
+
const sh = def.shape;
|
|
4700
|
+
Object.defineProperty(def, "shape", {
|
|
4701
|
+
get: () => {
|
|
4702
|
+
const newSh = { ...sh };
|
|
4703
|
+
Object.defineProperty(def, "shape", {
|
|
4704
|
+
value: newSh
|
|
4705
|
+
});
|
|
4706
|
+
return newSh;
|
|
4418
4707
|
}
|
|
4419
|
-
}
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
shape: def.shape,
|
|
4423
|
-
keys,
|
|
4424
|
-
keySet: new Set(keys),
|
|
4425
|
-
numKeys: keys.length,
|
|
4426
|
-
optionalKeys: new Set(okeys)
|
|
4427
|
-
};
|
|
4428
|
-
});
|
|
4708
|
+
});
|
|
4709
|
+
}
|
|
4710
|
+
const _normalized = cached(() => normalizeDef(def));
|
|
4429
4711
|
defineLazy(inst._zod, "propValues", () => {
|
|
4430
4712
|
const shape = def.shape;
|
|
4431
4713
|
const propValues = {};
|
|
@@ -4439,6 +4721,44 @@ var init_schemas = __esm(() => {
|
|
|
4439
4721
|
}
|
|
4440
4722
|
return propValues;
|
|
4441
4723
|
});
|
|
4724
|
+
const isObject2 = isObject;
|
|
4725
|
+
const catchall = def.catchall;
|
|
4726
|
+
let value;
|
|
4727
|
+
inst._zod.parse = (payload, ctx) => {
|
|
4728
|
+
value ?? (value = _normalized.value);
|
|
4729
|
+
const input = payload.value;
|
|
4730
|
+
if (!isObject2(input)) {
|
|
4731
|
+
payload.issues.push({
|
|
4732
|
+
expected: "object",
|
|
4733
|
+
code: "invalid_type",
|
|
4734
|
+
input,
|
|
4735
|
+
inst
|
|
4736
|
+
});
|
|
4737
|
+
return payload;
|
|
4738
|
+
}
|
|
4739
|
+
payload.value = {};
|
|
4740
|
+
const proms = [];
|
|
4741
|
+
const shape = value.shape;
|
|
4742
|
+
for (const key of value.keys) {
|
|
4743
|
+
const el = shape[key];
|
|
4744
|
+
const isOptionalOut = el._zod.optout === "optional";
|
|
4745
|
+
const r = el._zod.run({ value: input[key], issues: [] }, ctx);
|
|
4746
|
+
if (r instanceof Promise) {
|
|
4747
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalOut)));
|
|
4748
|
+
} else {
|
|
4749
|
+
handlePropertyResult(r, payload, key, input, isOptionalOut);
|
|
4750
|
+
}
|
|
4751
|
+
}
|
|
4752
|
+
if (!catchall) {
|
|
4753
|
+
return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
4754
|
+
}
|
|
4755
|
+
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
4756
|
+
};
|
|
4757
|
+
});
|
|
4758
|
+
$ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
|
|
4759
|
+
$ZodObject.init(inst, def);
|
|
4760
|
+
const superParse = inst._zod.parse;
|
|
4761
|
+
const _normalized = cached(() => normalizeDef(def));
|
|
4442
4762
|
const generateFastpass = (shape) => {
|
|
4443
4763
|
const doc = new Doc(["shape", "payload", "ctx"]);
|
|
4444
4764
|
const normalized = _normalized.value;
|
|
@@ -4452,41 +4772,51 @@ var init_schemas = __esm(() => {
|
|
|
4452
4772
|
for (const key of normalized.keys) {
|
|
4453
4773
|
ids[key] = `key_${counter++}`;
|
|
4454
4774
|
}
|
|
4455
|
-
doc.write(`const newResult = {}
|
|
4775
|
+
doc.write(`const newResult = {};`);
|
|
4456
4776
|
for (const key of normalized.keys) {
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4777
|
+
const id = ids[key];
|
|
4778
|
+
const k = esc(key);
|
|
4779
|
+
const schema = shape[key];
|
|
4780
|
+
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
4781
|
+
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
4782
|
+
if (isOptionalOut) {
|
|
4461
4783
|
doc.write(`
|
|
4462
4784
|
if (${id}.issues.length) {
|
|
4463
|
-
if (
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4785
|
+
if (${k} in input) {
|
|
4786
|
+
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
4787
|
+
...iss,
|
|
4788
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
4789
|
+
})));
|
|
4790
|
+
}
|
|
4791
|
+
}
|
|
4792
|
+
|
|
4793
|
+
if (${id}.value === undefined) {
|
|
4794
|
+
if (${k} in input) {
|
|
4795
|
+
newResult[${k}] = undefined;
|
|
4474
4796
|
}
|
|
4475
|
-
} else if (${id}.value === undefined) {
|
|
4476
|
-
if (${k} in input) newResult[${k}] = undefined;
|
|
4477
4797
|
} else {
|
|
4478
4798
|
newResult[${k}] = ${id}.value;
|
|
4479
4799
|
}
|
|
4480
|
-
|
|
4800
|
+
|
|
4801
|
+
`);
|
|
4481
4802
|
} else {
|
|
4482
|
-
const id = ids[key];
|
|
4483
|
-
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
4484
4803
|
doc.write(`
|
|
4485
|
-
|
|
4804
|
+
if (${id}.issues.length) {
|
|
4805
|
+
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
4486
4806
|
...iss,
|
|
4487
|
-
path: iss.path ? [${
|
|
4488
|
-
})))
|
|
4489
|
-
|
|
4807
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
4808
|
+
})));
|
|
4809
|
+
}
|
|
4810
|
+
|
|
4811
|
+
if (${id}.value === undefined) {
|
|
4812
|
+
if (${k} in input) {
|
|
4813
|
+
newResult[${k}] = undefined;
|
|
4814
|
+
}
|
|
4815
|
+
} else {
|
|
4816
|
+
newResult[${k}] = ${id}.value;
|
|
4817
|
+
}
|
|
4818
|
+
|
|
4819
|
+
`);
|
|
4490
4820
|
}
|
|
4491
4821
|
}
|
|
4492
4822
|
doc.write(`payload.value = newResult;`);
|
|
@@ -4513,61 +4843,15 @@ var init_schemas = __esm(() => {
|
|
|
4513
4843
|
});
|
|
4514
4844
|
return payload;
|
|
4515
4845
|
}
|
|
4516
|
-
const proms = [];
|
|
4517
4846
|
if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
|
|
4518
4847
|
if (!fastpass)
|
|
4519
4848
|
fastpass = generateFastpass(def.shape);
|
|
4520
4849
|
payload = fastpass(payload, ctx);
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
for (const key of value.keys) {
|
|
4525
|
-
const el = shape[key];
|
|
4526
|
-
const r = el._zod.run({ value: input[key], issues: [] }, ctx);
|
|
4527
|
-
const isOptional = el._zod.optin === "optional" && el._zod.optout === "optional";
|
|
4528
|
-
if (r instanceof Promise) {
|
|
4529
|
-
proms.push(r.then((r2) => isOptional ? handleOptionalObjectResult(r2, payload, key, input) : handleObjectResult(r2, payload, key)));
|
|
4530
|
-
} else if (isOptional) {
|
|
4531
|
-
handleOptionalObjectResult(r, payload, key, input);
|
|
4532
|
-
} else {
|
|
4533
|
-
handleObjectResult(r, payload, key);
|
|
4534
|
-
}
|
|
4535
|
-
}
|
|
4536
|
-
}
|
|
4537
|
-
if (!catchall) {
|
|
4538
|
-
return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
4539
|
-
}
|
|
4540
|
-
const unrecognized = [];
|
|
4541
|
-
const keySet = value.keySet;
|
|
4542
|
-
const _catchall = catchall._zod;
|
|
4543
|
-
const t = _catchall.def.type;
|
|
4544
|
-
for (const key of Object.keys(input)) {
|
|
4545
|
-
if (keySet.has(key))
|
|
4546
|
-
continue;
|
|
4547
|
-
if (t === "never") {
|
|
4548
|
-
unrecognized.push(key);
|
|
4549
|
-
continue;
|
|
4550
|
-
}
|
|
4551
|
-
const r = _catchall.run({ value: input[key], issues: [] }, ctx);
|
|
4552
|
-
if (r instanceof Promise) {
|
|
4553
|
-
proms.push(r.then((r2) => handleObjectResult(r2, payload, key)));
|
|
4554
|
-
} else {
|
|
4555
|
-
handleObjectResult(r, payload, key);
|
|
4556
|
-
}
|
|
4557
|
-
}
|
|
4558
|
-
if (unrecognized.length) {
|
|
4559
|
-
payload.issues.push({
|
|
4560
|
-
code: "unrecognized_keys",
|
|
4561
|
-
keys: unrecognized,
|
|
4562
|
-
input,
|
|
4563
|
-
inst
|
|
4564
|
-
});
|
|
4850
|
+
if (!catchall)
|
|
4851
|
+
return payload;
|
|
4852
|
+
return handleCatchall([], input, payload, ctx, value, inst);
|
|
4565
4853
|
}
|
|
4566
|
-
|
|
4567
|
-
return payload;
|
|
4568
|
-
return Promise.all(proms).then(() => {
|
|
4569
|
-
return payload;
|
|
4570
|
-
});
|
|
4854
|
+
return superParse(payload, ctx);
|
|
4571
4855
|
};
|
|
4572
4856
|
});
|
|
4573
4857
|
$ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
@@ -4587,7 +4871,12 @@ var init_schemas = __esm(() => {
|
|
|
4587
4871
|
}
|
|
4588
4872
|
return;
|
|
4589
4873
|
});
|
|
4874
|
+
const single = def.options.length === 1;
|
|
4875
|
+
const first = def.options[0]._zod.run;
|
|
4590
4876
|
inst._zod.parse = (payload, ctx) => {
|
|
4877
|
+
if (single) {
|
|
4878
|
+
return first(payload, ctx);
|
|
4879
|
+
}
|
|
4591
4880
|
let async = false;
|
|
4592
4881
|
const results = [];
|
|
4593
4882
|
for (const option of def.options) {
|
|
@@ -4612,6 +4901,7 @@ var init_schemas = __esm(() => {
|
|
|
4612
4901
|
};
|
|
4613
4902
|
});
|
|
4614
4903
|
$ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
4904
|
+
def.inclusive = false;
|
|
4615
4905
|
$ZodUnion.init(inst, def);
|
|
4616
4906
|
const _super = inst._zod.parse;
|
|
4617
4907
|
defineLazy(inst._zod, "propValues", () => {
|
|
@@ -4634,7 +4924,7 @@ var init_schemas = __esm(() => {
|
|
|
4634
4924
|
const opts = def.options;
|
|
4635
4925
|
const map = new Map;
|
|
4636
4926
|
for (const o of opts) {
|
|
4637
|
-
const values = o._zod.propValues[def.discriminator];
|
|
4927
|
+
const values = o._zod.propValues?.[def.discriminator];
|
|
4638
4928
|
if (!values || values.size === 0)
|
|
4639
4929
|
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
|
|
4640
4930
|
for (const v of values) {
|
|
@@ -4668,6 +4958,7 @@ var init_schemas = __esm(() => {
|
|
|
4668
4958
|
code: "invalid_union",
|
|
4669
4959
|
errors: [],
|
|
4670
4960
|
note: "No matching discriminator",
|
|
4961
|
+
discriminator: def.discriminator,
|
|
4671
4962
|
input,
|
|
4672
4963
|
path: [def.discriminator],
|
|
4673
4964
|
inst
|
|
@@ -4704,11 +4995,13 @@ var init_schemas = __esm(() => {
|
|
|
4704
4995
|
return payload;
|
|
4705
4996
|
}
|
|
4706
4997
|
const proms = [];
|
|
4707
|
-
|
|
4708
|
-
|
|
4998
|
+
const values = def.keyType._zod.values;
|
|
4999
|
+
if (values) {
|
|
4709
5000
|
payload.value = {};
|
|
5001
|
+
const recordKeys = new Set;
|
|
4710
5002
|
for (const key of values) {
|
|
4711
5003
|
if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
5004
|
+
recordKeys.add(typeof key === "number" ? key.toString() : key);
|
|
4712
5005
|
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
4713
5006
|
if (result instanceof Promise) {
|
|
4714
5007
|
proms.push(result.then((result2) => {
|
|
@@ -4727,7 +5020,7 @@ var init_schemas = __esm(() => {
|
|
|
4727
5020
|
}
|
|
4728
5021
|
let unrecognized;
|
|
4729
5022
|
for (const key in input) {
|
|
4730
|
-
if (!
|
|
5023
|
+
if (!recordKeys.has(key)) {
|
|
4731
5024
|
unrecognized = unrecognized ?? [];
|
|
4732
5025
|
unrecognized.push(key);
|
|
4733
5026
|
}
|
|
@@ -4745,20 +5038,33 @@ var init_schemas = __esm(() => {
|
|
|
4745
5038
|
for (const key of Reflect.ownKeys(input)) {
|
|
4746
5039
|
if (key === "__proto__")
|
|
4747
5040
|
continue;
|
|
4748
|
-
|
|
5041
|
+
let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
4749
5042
|
if (keyResult instanceof Promise) {
|
|
4750
5043
|
throw new Error("Async schemas not supported in object keys currently");
|
|
4751
5044
|
}
|
|
5045
|
+
const checkNumericKey = typeof key === "string" && number.test(key) && keyResult.issues.length;
|
|
5046
|
+
if (checkNumericKey) {
|
|
5047
|
+
const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
|
|
5048
|
+
if (retryResult instanceof Promise) {
|
|
5049
|
+
throw new Error("Async schemas not supported in object keys currently");
|
|
5050
|
+
}
|
|
5051
|
+
if (retryResult.issues.length === 0) {
|
|
5052
|
+
keyResult = retryResult;
|
|
5053
|
+
}
|
|
5054
|
+
}
|
|
4752
5055
|
if (keyResult.issues.length) {
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
5056
|
+
if (def.mode === "loose") {
|
|
5057
|
+
payload.value[key] = input[key];
|
|
5058
|
+
} else {
|
|
5059
|
+
payload.issues.push({
|
|
5060
|
+
code: "invalid_key",
|
|
5061
|
+
origin: "record",
|
|
5062
|
+
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
5063
|
+
input: key,
|
|
5064
|
+
path: [key],
|
|
5065
|
+
inst
|
|
5066
|
+
});
|
|
5067
|
+
}
|
|
4762
5068
|
continue;
|
|
4763
5069
|
}
|
|
4764
5070
|
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
@@ -4786,11 +5092,12 @@ var init_schemas = __esm(() => {
|
|
|
4786
5092
|
$ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
4787
5093
|
$ZodType.init(inst, def);
|
|
4788
5094
|
const values = getEnumValues(def.entries);
|
|
4789
|
-
|
|
5095
|
+
const valuesSet = new Set(values);
|
|
5096
|
+
inst._zod.values = valuesSet;
|
|
4790
5097
|
inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
|
|
4791
5098
|
inst._zod.parse = (payload, _ctx) => {
|
|
4792
5099
|
const input = payload.value;
|
|
4793
|
-
if (
|
|
5100
|
+
if (valuesSet.has(input)) {
|
|
4794
5101
|
return payload;
|
|
4795
5102
|
}
|
|
4796
5103
|
payload.issues.push({
|
|
@@ -4804,11 +5111,15 @@ var init_schemas = __esm(() => {
|
|
|
4804
5111
|
});
|
|
4805
5112
|
$ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
4806
5113
|
$ZodType.init(inst, def);
|
|
4807
|
-
|
|
4808
|
-
|
|
5114
|
+
if (def.values.length === 0) {
|
|
5115
|
+
throw new Error("Cannot create literal schema with no valid values");
|
|
5116
|
+
}
|
|
5117
|
+
const values = new Set(def.values);
|
|
5118
|
+
inst._zod.values = values;
|
|
5119
|
+
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
|
|
4809
5120
|
inst._zod.parse = (payload, _ctx) => {
|
|
4810
5121
|
const input = payload.value;
|
|
4811
|
-
if (
|
|
5122
|
+
if (values.has(input)) {
|
|
4812
5123
|
return payload;
|
|
4813
5124
|
}
|
|
4814
5125
|
payload.issues.push({
|
|
@@ -4822,9 +5133,12 @@ var init_schemas = __esm(() => {
|
|
|
4822
5133
|
});
|
|
4823
5134
|
$ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
|
|
4824
5135
|
$ZodType.init(inst, def);
|
|
4825
|
-
inst._zod.parse = (payload,
|
|
5136
|
+
inst._zod.parse = (payload, ctx) => {
|
|
5137
|
+
if (ctx.direction === "backward") {
|
|
5138
|
+
throw new $ZodEncodeError(inst.constructor.name);
|
|
5139
|
+
}
|
|
4826
5140
|
const _out = def.transform(payload.value, payload);
|
|
4827
|
-
if (
|
|
5141
|
+
if (ctx.async) {
|
|
4828
5142
|
const output = _out instanceof Promise ? _out : Promise.resolve(_out);
|
|
4829
5143
|
return output.then((output2) => {
|
|
4830
5144
|
payload.value = output2;
|
|
@@ -4851,7 +5165,10 @@ var init_schemas = __esm(() => {
|
|
|
4851
5165
|
});
|
|
4852
5166
|
inst._zod.parse = (payload, ctx) => {
|
|
4853
5167
|
if (def.innerType._zod.optin === "optional") {
|
|
4854
|
-
|
|
5168
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
5169
|
+
if (result instanceof Promise)
|
|
5170
|
+
return result.then((r) => handleOptionalResult(r, payload.value));
|
|
5171
|
+
return handleOptionalResult(result, payload.value);
|
|
4855
5172
|
}
|
|
4856
5173
|
if (payload.value === undefined) {
|
|
4857
5174
|
return payload;
|
|
@@ -4859,6 +5176,14 @@ var init_schemas = __esm(() => {
|
|
|
4859
5176
|
return def.innerType._zod.run(payload, ctx);
|
|
4860
5177
|
};
|
|
4861
5178
|
});
|
|
5179
|
+
$ZodExactOptional = /* @__PURE__ */ $constructor("$ZodExactOptional", (inst, def) => {
|
|
5180
|
+
$ZodOptional.init(inst, def);
|
|
5181
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
5182
|
+
defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
|
|
5183
|
+
inst._zod.parse = (payload, ctx) => {
|
|
5184
|
+
return def.innerType._zod.run(payload, ctx);
|
|
5185
|
+
};
|
|
5186
|
+
});
|
|
4862
5187
|
$ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
|
|
4863
5188
|
$ZodType.init(inst, def);
|
|
4864
5189
|
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
@@ -4881,6 +5206,9 @@ var init_schemas = __esm(() => {
|
|
|
4881
5206
|
inst._zod.optin = "optional";
|
|
4882
5207
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
4883
5208
|
inst._zod.parse = (payload, ctx) => {
|
|
5209
|
+
if (ctx.direction === "backward") {
|
|
5210
|
+
return def.innerType._zod.run(payload, ctx);
|
|
5211
|
+
}
|
|
4884
5212
|
if (payload.value === undefined) {
|
|
4885
5213
|
payload.value = def.defaultValue;
|
|
4886
5214
|
return payload;
|
|
@@ -4897,6 +5225,9 @@ var init_schemas = __esm(() => {
|
|
|
4897
5225
|
inst._zod.optin = "optional";
|
|
4898
5226
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
4899
5227
|
inst._zod.parse = (payload, ctx) => {
|
|
5228
|
+
if (ctx.direction === "backward") {
|
|
5229
|
+
return def.innerType._zod.run(payload, ctx);
|
|
5230
|
+
}
|
|
4900
5231
|
if (payload.value === undefined) {
|
|
4901
5232
|
payload.value = def.defaultValue;
|
|
4902
5233
|
}
|
|
@@ -4919,10 +5250,13 @@ var init_schemas = __esm(() => {
|
|
|
4919
5250
|
});
|
|
4920
5251
|
$ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
4921
5252
|
$ZodType.init(inst, def);
|
|
4922
|
-
inst._zod
|
|
5253
|
+
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
4923
5254
|
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
4924
5255
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
4925
5256
|
inst._zod.parse = (payload, ctx) => {
|
|
5257
|
+
if (ctx.direction === "backward") {
|
|
5258
|
+
return def.innerType._zod.run(payload, ctx);
|
|
5259
|
+
}
|
|
4926
5260
|
const result = def.innerType._zod.run(payload, ctx);
|
|
4927
5261
|
if (result instanceof Promise) {
|
|
4928
5262
|
return result.then((result2) => {
|
|
@@ -4959,21 +5293,32 @@ var init_schemas = __esm(() => {
|
|
|
4959
5293
|
defineLazy(inst._zod, "values", () => def.in._zod.values);
|
|
4960
5294
|
defineLazy(inst._zod, "optin", () => def.in._zod.optin);
|
|
4961
5295
|
defineLazy(inst._zod, "optout", () => def.out._zod.optout);
|
|
5296
|
+
defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
|
|
4962
5297
|
inst._zod.parse = (payload, ctx) => {
|
|
5298
|
+
if (ctx.direction === "backward") {
|
|
5299
|
+
const right = def.out._zod.run(payload, ctx);
|
|
5300
|
+
if (right instanceof Promise) {
|
|
5301
|
+
return right.then((right2) => handlePipeResult(right2, def.in, ctx));
|
|
5302
|
+
}
|
|
5303
|
+
return handlePipeResult(right, def.in, ctx);
|
|
5304
|
+
}
|
|
4963
5305
|
const left = def.in._zod.run(payload, ctx);
|
|
4964
5306
|
if (left instanceof Promise) {
|
|
4965
|
-
return left.then((left2) => handlePipeResult(left2, def, ctx));
|
|
5307
|
+
return left.then((left2) => handlePipeResult(left2, def.out, ctx));
|
|
4966
5308
|
}
|
|
4967
|
-
return handlePipeResult(left, def, ctx);
|
|
5309
|
+
return handlePipeResult(left, def.out, ctx);
|
|
4968
5310
|
};
|
|
4969
5311
|
});
|
|
4970
5312
|
$ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
|
|
4971
5313
|
$ZodType.init(inst, def);
|
|
4972
5314
|
defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
|
|
4973
5315
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
4974
|
-
defineLazy(inst._zod, "optin", () => def.innerType
|
|
4975
|
-
defineLazy(inst._zod, "optout", () => def.innerType
|
|
5316
|
+
defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
|
|
5317
|
+
defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
|
|
4976
5318
|
inst._zod.parse = (payload, ctx) => {
|
|
5319
|
+
if (ctx.direction === "backward") {
|
|
5320
|
+
return def.innerType._zod.run(payload, ctx);
|
|
5321
|
+
}
|
|
4977
5322
|
const result = def.innerType._zod.run(payload, ctx);
|
|
4978
5323
|
if (result instanceof Promise) {
|
|
4979
5324
|
return result.then(handleReadonlyResult);
|
|
@@ -5005,36 +5350,18 @@ function en_default() {
|
|
|
5005
5350
|
localeError: error()
|
|
5006
5351
|
};
|
|
5007
5352
|
}
|
|
5008
|
-
var
|
|
5009
|
-
const t = typeof data;
|
|
5010
|
-
switch (t) {
|
|
5011
|
-
case "number": {
|
|
5012
|
-
return Number.isNaN(data) ? "NaN" : "number";
|
|
5013
|
-
}
|
|
5014
|
-
case "object": {
|
|
5015
|
-
if (Array.isArray(data)) {
|
|
5016
|
-
return "array";
|
|
5017
|
-
}
|
|
5018
|
-
if (data === null) {
|
|
5019
|
-
return "null";
|
|
5020
|
-
}
|
|
5021
|
-
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
|
5022
|
-
return data.constructor.name;
|
|
5023
|
-
}
|
|
5024
|
-
}
|
|
5025
|
-
}
|
|
5026
|
-
return t;
|
|
5027
|
-
}, error = () => {
|
|
5353
|
+
var error = () => {
|
|
5028
5354
|
const Sizable = {
|
|
5029
5355
|
string: { unit: "characters", verb: "to have" },
|
|
5030
5356
|
file: { unit: "bytes", verb: "to have" },
|
|
5031
5357
|
array: { unit: "items", verb: "to have" },
|
|
5032
|
-
set: { unit: "items", verb: "to have" }
|
|
5358
|
+
set: { unit: "items", verb: "to have" },
|
|
5359
|
+
map: { unit: "entries", verb: "to have" }
|
|
5033
5360
|
};
|
|
5034
5361
|
function getSizing(origin) {
|
|
5035
5362
|
return Sizable[origin] ?? null;
|
|
5036
5363
|
}
|
|
5037
|
-
const
|
|
5364
|
+
const FormatDictionary = {
|
|
5038
5365
|
regex: "input",
|
|
5039
5366
|
email: "email address",
|
|
5040
5367
|
url: "URL",
|
|
@@ -5055,6 +5382,7 @@ var parsedType = (data) => {
|
|
|
5055
5382
|
duration: "ISO duration",
|
|
5056
5383
|
ipv4: "IPv4 address",
|
|
5057
5384
|
ipv6: "IPv6 address",
|
|
5385
|
+
mac: "MAC address",
|
|
5058
5386
|
cidrv4: "IPv4 range",
|
|
5059
5387
|
cidrv6: "IPv6 range",
|
|
5060
5388
|
base64: "base64-encoded string",
|
|
@@ -5064,10 +5392,17 @@ var parsedType = (data) => {
|
|
|
5064
5392
|
jwt: "JWT",
|
|
5065
5393
|
template_literal: "input"
|
|
5066
5394
|
};
|
|
5395
|
+
const TypeDictionary = {
|
|
5396
|
+
nan: "NaN"
|
|
5397
|
+
};
|
|
5067
5398
|
return (issue2) => {
|
|
5068
5399
|
switch (issue2.code) {
|
|
5069
|
-
case "invalid_type":
|
|
5070
|
-
|
|
5400
|
+
case "invalid_type": {
|
|
5401
|
+
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
|
|
5402
|
+
const receivedType = parsedType(issue2.input);
|
|
5403
|
+
const received = TypeDictionary[receivedType] ?? receivedType;
|
|
5404
|
+
return `Invalid input: expected ${expected}, received ${received}`;
|
|
5405
|
+
}
|
|
5071
5406
|
case "invalid_value":
|
|
5072
5407
|
if (issue2.values.length === 1)
|
|
5073
5408
|
return `Invalid input: expected ${stringifyPrimitive(issue2.values[0])}`;
|
|
@@ -5098,7 +5433,7 @@ var parsedType = (data) => {
|
|
|
5098
5433
|
return `Invalid string: must include "${_issue.includes}"`;
|
|
5099
5434
|
if (_issue.format === "regex")
|
|
5100
5435
|
return `Invalid string: must match pattern ${_issue.pattern}`;
|
|
5101
|
-
return `Invalid ${
|
|
5436
|
+
return `Invalid ${FormatDictionary[_issue.format] ?? issue2.format}`;
|
|
5102
5437
|
}
|
|
5103
5438
|
case "not_multiple_of":
|
|
5104
5439
|
return `Invalid number: must be a multiple of ${issue2.divisor}`;
|
|
@@ -5125,22 +5460,19 @@ var init_locales = () => {};
|
|
|
5125
5460
|
// node_modules/zod/v4/core/registries.js
|
|
5126
5461
|
class $ZodRegistry {
|
|
5127
5462
|
constructor() {
|
|
5128
|
-
this._map = new
|
|
5463
|
+
this._map = new WeakMap;
|
|
5129
5464
|
this._idmap = new Map;
|
|
5130
5465
|
}
|
|
5131
5466
|
add(schema, ..._meta) {
|
|
5132
5467
|
const meta = _meta[0];
|
|
5133
5468
|
this._map.set(schema, meta);
|
|
5134
5469
|
if (meta && typeof meta === "object" && "id" in meta) {
|
|
5135
|
-
if (this._idmap.has(meta.id)) {
|
|
5136
|
-
throw new Error(`ID ${meta.id} already exists in the registry`);
|
|
5137
|
-
}
|
|
5138
5470
|
this._idmap.set(meta.id, schema);
|
|
5139
5471
|
}
|
|
5140
5472
|
return this;
|
|
5141
5473
|
}
|
|
5142
5474
|
clear() {
|
|
5143
|
-
this._map = new
|
|
5475
|
+
this._map = new WeakMap;
|
|
5144
5476
|
this._idmap = new Map;
|
|
5145
5477
|
return this;
|
|
5146
5478
|
}
|
|
@@ -5157,7 +5489,8 @@ class $ZodRegistry {
|
|
|
5157
5489
|
if (p) {
|
|
5158
5490
|
const pm = { ...this.get(p) ?? {} };
|
|
5159
5491
|
delete pm.id;
|
|
5160
|
-
|
|
5492
|
+
const f = { ...pm, ...this._map.get(schema) };
|
|
5493
|
+
return Object.keys(f).length ? f : undefined;
|
|
5161
5494
|
}
|
|
5162
5495
|
return this._map.get(schema);
|
|
5163
5496
|
}
|
|
@@ -5168,11 +5501,12 @@ class $ZodRegistry {
|
|
|
5168
5501
|
function registry() {
|
|
5169
5502
|
return new $ZodRegistry;
|
|
5170
5503
|
}
|
|
5171
|
-
var $output, $input, globalRegistry;
|
|
5504
|
+
var _a, $output, $input, globalRegistry;
|
|
5172
5505
|
var init_registries = __esm(() => {
|
|
5173
5506
|
$output = Symbol("ZodOutput");
|
|
5174
5507
|
$input = Symbol("ZodInput");
|
|
5175
|
-
|
|
5508
|
+
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
|
5509
|
+
globalRegistry = globalThis.__zod_globalRegistry;
|
|
5176
5510
|
});
|
|
5177
5511
|
|
|
5178
5512
|
// node_modules/zod/v4/core/api.js
|
|
@@ -5583,6 +5917,9 @@ function _toLowerCase() {
|
|
|
5583
5917
|
function _toUpperCase() {
|
|
5584
5918
|
return _overwrite((input) => input.toUpperCase());
|
|
5585
5919
|
}
|
|
5920
|
+
function _slugify() {
|
|
5921
|
+
return _overwrite((input) => slugify(input));
|
|
5922
|
+
}
|
|
5586
5923
|
function _array(Class2, element, params) {
|
|
5587
5924
|
return new Class2({
|
|
5588
5925
|
type: "array",
|
|
@@ -5610,16 +5947,704 @@ function _refine(Class2, fn, _params) {
|
|
|
5610
5947
|
});
|
|
5611
5948
|
return schema;
|
|
5612
5949
|
}
|
|
5950
|
+
function _superRefine(fn) {
|
|
5951
|
+
const ch = _check((payload) => {
|
|
5952
|
+
payload.addIssue = (issue2) => {
|
|
5953
|
+
if (typeof issue2 === "string") {
|
|
5954
|
+
payload.issues.push(issue(issue2, payload.value, ch._zod.def));
|
|
5955
|
+
} else {
|
|
5956
|
+
const _issue = issue2;
|
|
5957
|
+
if (_issue.fatal)
|
|
5958
|
+
_issue.continue = false;
|
|
5959
|
+
_issue.code ?? (_issue.code = "custom");
|
|
5960
|
+
_issue.input ?? (_issue.input = payload.value);
|
|
5961
|
+
_issue.inst ?? (_issue.inst = ch);
|
|
5962
|
+
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
|
|
5963
|
+
payload.issues.push(issue(_issue));
|
|
5964
|
+
}
|
|
5965
|
+
};
|
|
5966
|
+
return fn(payload.value, payload);
|
|
5967
|
+
});
|
|
5968
|
+
return ch;
|
|
5969
|
+
}
|
|
5970
|
+
function _check(fn, params) {
|
|
5971
|
+
const ch = new $ZodCheck({
|
|
5972
|
+
check: "custom",
|
|
5973
|
+
...normalizeParams(params)
|
|
5974
|
+
});
|
|
5975
|
+
ch._zod.check = fn;
|
|
5976
|
+
return ch;
|
|
5977
|
+
}
|
|
5613
5978
|
var init_api = __esm(() => {
|
|
5614
5979
|
init_checks();
|
|
5615
5980
|
init_util();
|
|
5616
5981
|
});
|
|
5617
5982
|
|
|
5618
|
-
// node_modules/zod/v4/core/function.js
|
|
5619
|
-
var init_function = () => {};
|
|
5620
|
-
|
|
5621
5983
|
// node_modules/zod/v4/core/to-json-schema.js
|
|
5622
|
-
|
|
5984
|
+
function initializeContext(params) {
|
|
5985
|
+
let target = params?.target ?? "draft-2020-12";
|
|
5986
|
+
if (target === "draft-4")
|
|
5987
|
+
target = "draft-04";
|
|
5988
|
+
if (target === "draft-7")
|
|
5989
|
+
target = "draft-07";
|
|
5990
|
+
return {
|
|
5991
|
+
processors: params.processors ?? {},
|
|
5992
|
+
metadataRegistry: params?.metadata ?? globalRegistry,
|
|
5993
|
+
target,
|
|
5994
|
+
unrepresentable: params?.unrepresentable ?? "throw",
|
|
5995
|
+
override: params?.override ?? (() => {}),
|
|
5996
|
+
io: params?.io ?? "output",
|
|
5997
|
+
counter: 0,
|
|
5998
|
+
seen: new Map,
|
|
5999
|
+
cycles: params?.cycles ?? "ref",
|
|
6000
|
+
reused: params?.reused ?? "inline",
|
|
6001
|
+
external: params?.external ?? undefined
|
|
6002
|
+
};
|
|
6003
|
+
}
|
|
6004
|
+
function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
6005
|
+
var _a2;
|
|
6006
|
+
const def = schema._zod.def;
|
|
6007
|
+
const seen = ctx.seen.get(schema);
|
|
6008
|
+
if (seen) {
|
|
6009
|
+
seen.count++;
|
|
6010
|
+
const isCycle = _params.schemaPath.includes(schema);
|
|
6011
|
+
if (isCycle) {
|
|
6012
|
+
seen.cycle = _params.path;
|
|
6013
|
+
}
|
|
6014
|
+
return seen.schema;
|
|
6015
|
+
}
|
|
6016
|
+
const result = { schema: {}, count: 1, cycle: undefined, path: _params.path };
|
|
6017
|
+
ctx.seen.set(schema, result);
|
|
6018
|
+
const overrideSchema = schema._zod.toJSONSchema?.();
|
|
6019
|
+
if (overrideSchema) {
|
|
6020
|
+
result.schema = overrideSchema;
|
|
6021
|
+
} else {
|
|
6022
|
+
const params = {
|
|
6023
|
+
..._params,
|
|
6024
|
+
schemaPath: [..._params.schemaPath, schema],
|
|
6025
|
+
path: _params.path
|
|
6026
|
+
};
|
|
6027
|
+
if (schema._zod.processJSONSchema) {
|
|
6028
|
+
schema._zod.processJSONSchema(ctx, result.schema, params);
|
|
6029
|
+
} else {
|
|
6030
|
+
const _json = result.schema;
|
|
6031
|
+
const processor = ctx.processors[def.type];
|
|
6032
|
+
if (!processor) {
|
|
6033
|
+
throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
|
|
6034
|
+
}
|
|
6035
|
+
processor(schema, ctx, _json, params);
|
|
6036
|
+
}
|
|
6037
|
+
const parent = schema._zod.parent;
|
|
6038
|
+
if (parent) {
|
|
6039
|
+
if (!result.ref)
|
|
6040
|
+
result.ref = parent;
|
|
6041
|
+
process2(parent, ctx, params);
|
|
6042
|
+
ctx.seen.get(parent).isParent = true;
|
|
6043
|
+
}
|
|
6044
|
+
}
|
|
6045
|
+
const meta = ctx.metadataRegistry.get(schema);
|
|
6046
|
+
if (meta)
|
|
6047
|
+
Object.assign(result.schema, meta);
|
|
6048
|
+
if (ctx.io === "input" && isTransforming(schema)) {
|
|
6049
|
+
delete result.schema.examples;
|
|
6050
|
+
delete result.schema.default;
|
|
6051
|
+
}
|
|
6052
|
+
if (ctx.io === "input" && result.schema._prefault)
|
|
6053
|
+
(_a2 = result.schema).default ?? (_a2.default = result.schema._prefault);
|
|
6054
|
+
delete result.schema._prefault;
|
|
6055
|
+
const _result = ctx.seen.get(schema);
|
|
6056
|
+
return _result.schema;
|
|
6057
|
+
}
|
|
6058
|
+
function extractDefs(ctx, schema) {
|
|
6059
|
+
const root = ctx.seen.get(schema);
|
|
6060
|
+
if (!root)
|
|
6061
|
+
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
6062
|
+
const idToSchema = new Map;
|
|
6063
|
+
for (const entry of ctx.seen.entries()) {
|
|
6064
|
+
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
6065
|
+
if (id) {
|
|
6066
|
+
const existing = idToSchema.get(id);
|
|
6067
|
+
if (existing && existing !== entry[0]) {
|
|
6068
|
+
throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
6069
|
+
}
|
|
6070
|
+
idToSchema.set(id, entry[0]);
|
|
6071
|
+
}
|
|
6072
|
+
}
|
|
6073
|
+
const makeURI = (entry) => {
|
|
6074
|
+
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
6075
|
+
if (ctx.external) {
|
|
6076
|
+
const externalId = ctx.external.registry.get(entry[0])?.id;
|
|
6077
|
+
const uriGenerator = ctx.external.uri ?? ((id2) => id2);
|
|
6078
|
+
if (externalId) {
|
|
6079
|
+
return { ref: uriGenerator(externalId) };
|
|
6080
|
+
}
|
|
6081
|
+
const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
6082
|
+
entry[1].defId = id;
|
|
6083
|
+
return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` };
|
|
6084
|
+
}
|
|
6085
|
+
if (entry[1] === root) {
|
|
6086
|
+
return { ref: "#" };
|
|
6087
|
+
}
|
|
6088
|
+
const uriPrefix = `#`;
|
|
6089
|
+
const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
|
|
6090
|
+
const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
|
|
6091
|
+
return { defId, ref: defUriPrefix + defId };
|
|
6092
|
+
};
|
|
6093
|
+
const extractToDef = (entry) => {
|
|
6094
|
+
if (entry[1].schema.$ref) {
|
|
6095
|
+
return;
|
|
6096
|
+
}
|
|
6097
|
+
const seen = entry[1];
|
|
6098
|
+
const { ref, defId } = makeURI(entry);
|
|
6099
|
+
seen.def = { ...seen.schema };
|
|
6100
|
+
if (defId)
|
|
6101
|
+
seen.defId = defId;
|
|
6102
|
+
const schema2 = seen.schema;
|
|
6103
|
+
for (const key in schema2) {
|
|
6104
|
+
delete schema2[key];
|
|
6105
|
+
}
|
|
6106
|
+
schema2.$ref = ref;
|
|
6107
|
+
};
|
|
6108
|
+
if (ctx.cycles === "throw") {
|
|
6109
|
+
for (const entry of ctx.seen.entries()) {
|
|
6110
|
+
const seen = entry[1];
|
|
6111
|
+
if (seen.cycle) {
|
|
6112
|
+
throw new Error("Cycle detected: " + `#/${seen.cycle?.join("/")}/<root>` + '\n\nSet the `cycles` parameter to `"ref"` to resolve cyclical schemas with defs.');
|
|
6113
|
+
}
|
|
6114
|
+
}
|
|
6115
|
+
}
|
|
6116
|
+
for (const entry of ctx.seen.entries()) {
|
|
6117
|
+
const seen = entry[1];
|
|
6118
|
+
if (schema === entry[0]) {
|
|
6119
|
+
extractToDef(entry);
|
|
6120
|
+
continue;
|
|
6121
|
+
}
|
|
6122
|
+
if (ctx.external) {
|
|
6123
|
+
const ext = ctx.external.registry.get(entry[0])?.id;
|
|
6124
|
+
if (schema !== entry[0] && ext) {
|
|
6125
|
+
extractToDef(entry);
|
|
6126
|
+
continue;
|
|
6127
|
+
}
|
|
6128
|
+
}
|
|
6129
|
+
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
6130
|
+
if (id) {
|
|
6131
|
+
extractToDef(entry);
|
|
6132
|
+
continue;
|
|
6133
|
+
}
|
|
6134
|
+
if (seen.cycle) {
|
|
6135
|
+
extractToDef(entry);
|
|
6136
|
+
continue;
|
|
6137
|
+
}
|
|
6138
|
+
if (seen.count > 1) {
|
|
6139
|
+
if (ctx.reused === "ref") {
|
|
6140
|
+
extractToDef(entry);
|
|
6141
|
+
continue;
|
|
6142
|
+
}
|
|
6143
|
+
}
|
|
6144
|
+
}
|
|
6145
|
+
}
|
|
6146
|
+
function finalize(ctx, schema) {
|
|
6147
|
+
const root = ctx.seen.get(schema);
|
|
6148
|
+
if (!root)
|
|
6149
|
+
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
6150
|
+
const flattenRef = (zodSchema) => {
|
|
6151
|
+
const seen = ctx.seen.get(zodSchema);
|
|
6152
|
+
if (seen.ref === null)
|
|
6153
|
+
return;
|
|
6154
|
+
const schema2 = seen.def ?? seen.schema;
|
|
6155
|
+
const _cached = { ...schema2 };
|
|
6156
|
+
const ref = seen.ref;
|
|
6157
|
+
seen.ref = null;
|
|
6158
|
+
if (ref) {
|
|
6159
|
+
flattenRef(ref);
|
|
6160
|
+
const refSeen = ctx.seen.get(ref);
|
|
6161
|
+
const refSchema = refSeen.schema;
|
|
6162
|
+
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
6163
|
+
schema2.allOf = schema2.allOf ?? [];
|
|
6164
|
+
schema2.allOf.push(refSchema);
|
|
6165
|
+
} else {
|
|
6166
|
+
Object.assign(schema2, refSchema);
|
|
6167
|
+
}
|
|
6168
|
+
Object.assign(schema2, _cached);
|
|
6169
|
+
const isParentRef = zodSchema._zod.parent === ref;
|
|
6170
|
+
if (isParentRef) {
|
|
6171
|
+
for (const key in schema2) {
|
|
6172
|
+
if (key === "$ref" || key === "allOf")
|
|
6173
|
+
continue;
|
|
6174
|
+
if (!(key in _cached)) {
|
|
6175
|
+
delete schema2[key];
|
|
6176
|
+
}
|
|
6177
|
+
}
|
|
6178
|
+
}
|
|
6179
|
+
if (refSchema.$ref && refSeen.def) {
|
|
6180
|
+
for (const key in schema2) {
|
|
6181
|
+
if (key === "$ref" || key === "allOf")
|
|
6182
|
+
continue;
|
|
6183
|
+
if (key in refSeen.def && JSON.stringify(schema2[key]) === JSON.stringify(refSeen.def[key])) {
|
|
6184
|
+
delete schema2[key];
|
|
6185
|
+
}
|
|
6186
|
+
}
|
|
6187
|
+
}
|
|
6188
|
+
}
|
|
6189
|
+
const parent = zodSchema._zod.parent;
|
|
6190
|
+
if (parent && parent !== ref) {
|
|
6191
|
+
flattenRef(parent);
|
|
6192
|
+
const parentSeen = ctx.seen.get(parent);
|
|
6193
|
+
if (parentSeen?.schema.$ref) {
|
|
6194
|
+
schema2.$ref = parentSeen.schema.$ref;
|
|
6195
|
+
if (parentSeen.def) {
|
|
6196
|
+
for (const key in schema2) {
|
|
6197
|
+
if (key === "$ref" || key === "allOf")
|
|
6198
|
+
continue;
|
|
6199
|
+
if (key in parentSeen.def && JSON.stringify(schema2[key]) === JSON.stringify(parentSeen.def[key])) {
|
|
6200
|
+
delete schema2[key];
|
|
6201
|
+
}
|
|
6202
|
+
}
|
|
6203
|
+
}
|
|
6204
|
+
}
|
|
6205
|
+
}
|
|
6206
|
+
ctx.override({
|
|
6207
|
+
zodSchema,
|
|
6208
|
+
jsonSchema: schema2,
|
|
6209
|
+
path: seen.path ?? []
|
|
6210
|
+
});
|
|
6211
|
+
};
|
|
6212
|
+
for (const entry of [...ctx.seen.entries()].reverse()) {
|
|
6213
|
+
flattenRef(entry[0]);
|
|
6214
|
+
}
|
|
6215
|
+
const result = {};
|
|
6216
|
+
if (ctx.target === "draft-2020-12") {
|
|
6217
|
+
result.$schema = "https://json-schema.org/draft/2020-12/schema";
|
|
6218
|
+
} else if (ctx.target === "draft-07") {
|
|
6219
|
+
result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
6220
|
+
} else if (ctx.target === "draft-04") {
|
|
6221
|
+
result.$schema = "http://json-schema.org/draft-04/schema#";
|
|
6222
|
+
} else if (ctx.target === "openapi-3.0") {} else {}
|
|
6223
|
+
if (ctx.external?.uri) {
|
|
6224
|
+
const id = ctx.external.registry.get(schema)?.id;
|
|
6225
|
+
if (!id)
|
|
6226
|
+
throw new Error("Schema is missing an `id` property");
|
|
6227
|
+
result.$id = ctx.external.uri(id);
|
|
6228
|
+
}
|
|
6229
|
+
Object.assign(result, root.def ?? root.schema);
|
|
6230
|
+
const defs = ctx.external?.defs ?? {};
|
|
6231
|
+
for (const entry of ctx.seen.entries()) {
|
|
6232
|
+
const seen = entry[1];
|
|
6233
|
+
if (seen.def && seen.defId) {
|
|
6234
|
+
defs[seen.defId] = seen.def;
|
|
6235
|
+
}
|
|
6236
|
+
}
|
|
6237
|
+
if (ctx.external) {} else {
|
|
6238
|
+
if (Object.keys(defs).length > 0) {
|
|
6239
|
+
if (ctx.target === "draft-2020-12") {
|
|
6240
|
+
result.$defs = defs;
|
|
6241
|
+
} else {
|
|
6242
|
+
result.definitions = defs;
|
|
6243
|
+
}
|
|
6244
|
+
}
|
|
6245
|
+
}
|
|
6246
|
+
try {
|
|
6247
|
+
const finalized = JSON.parse(JSON.stringify(result));
|
|
6248
|
+
Object.defineProperty(finalized, "~standard", {
|
|
6249
|
+
value: {
|
|
6250
|
+
...schema["~standard"],
|
|
6251
|
+
jsonSchema: {
|
|
6252
|
+
input: createStandardJSONSchemaMethod(schema, "input", ctx.processors),
|
|
6253
|
+
output: createStandardJSONSchemaMethod(schema, "output", ctx.processors)
|
|
6254
|
+
}
|
|
6255
|
+
},
|
|
6256
|
+
enumerable: false,
|
|
6257
|
+
writable: false
|
|
6258
|
+
});
|
|
6259
|
+
return finalized;
|
|
6260
|
+
} catch (_err) {
|
|
6261
|
+
throw new Error("Error converting schema to JSON.");
|
|
6262
|
+
}
|
|
6263
|
+
}
|
|
6264
|
+
function isTransforming(_schema, _ctx) {
|
|
6265
|
+
const ctx = _ctx ?? { seen: new Set };
|
|
6266
|
+
if (ctx.seen.has(_schema))
|
|
6267
|
+
return false;
|
|
6268
|
+
ctx.seen.add(_schema);
|
|
6269
|
+
const def = _schema._zod.def;
|
|
6270
|
+
if (def.type === "transform")
|
|
6271
|
+
return true;
|
|
6272
|
+
if (def.type === "array")
|
|
6273
|
+
return isTransforming(def.element, ctx);
|
|
6274
|
+
if (def.type === "set")
|
|
6275
|
+
return isTransforming(def.valueType, ctx);
|
|
6276
|
+
if (def.type === "lazy")
|
|
6277
|
+
return isTransforming(def.getter(), ctx);
|
|
6278
|
+
if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault") {
|
|
6279
|
+
return isTransforming(def.innerType, ctx);
|
|
6280
|
+
}
|
|
6281
|
+
if (def.type === "intersection") {
|
|
6282
|
+
return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
|
|
6283
|
+
}
|
|
6284
|
+
if (def.type === "record" || def.type === "map") {
|
|
6285
|
+
return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
|
|
6286
|
+
}
|
|
6287
|
+
if (def.type === "pipe") {
|
|
6288
|
+
return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
|
|
6289
|
+
}
|
|
6290
|
+
if (def.type === "object") {
|
|
6291
|
+
for (const key in def.shape) {
|
|
6292
|
+
if (isTransforming(def.shape[key], ctx))
|
|
6293
|
+
return true;
|
|
6294
|
+
}
|
|
6295
|
+
return false;
|
|
6296
|
+
}
|
|
6297
|
+
if (def.type === "union") {
|
|
6298
|
+
for (const option of def.options) {
|
|
6299
|
+
if (isTransforming(option, ctx))
|
|
6300
|
+
return true;
|
|
6301
|
+
}
|
|
6302
|
+
return false;
|
|
6303
|
+
}
|
|
6304
|
+
if (def.type === "tuple") {
|
|
6305
|
+
for (const item of def.items) {
|
|
6306
|
+
if (isTransforming(item, ctx))
|
|
6307
|
+
return true;
|
|
6308
|
+
}
|
|
6309
|
+
if (def.rest && isTransforming(def.rest, ctx))
|
|
6310
|
+
return true;
|
|
6311
|
+
return false;
|
|
6312
|
+
}
|
|
6313
|
+
return false;
|
|
6314
|
+
}
|
|
6315
|
+
var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
6316
|
+
const ctx = initializeContext({ ...params, processors });
|
|
6317
|
+
process2(schema, ctx);
|
|
6318
|
+
extractDefs(ctx, schema);
|
|
6319
|
+
return finalize(ctx, schema);
|
|
6320
|
+
}, createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
|
|
6321
|
+
const { libraryOptions, target } = params ?? {};
|
|
6322
|
+
const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
|
|
6323
|
+
process2(schema, ctx);
|
|
6324
|
+
extractDefs(ctx, schema);
|
|
6325
|
+
return finalize(ctx, schema);
|
|
6326
|
+
};
|
|
6327
|
+
var init_to_json_schema = __esm(() => {
|
|
6328
|
+
init_registries();
|
|
6329
|
+
});
|
|
6330
|
+
|
|
6331
|
+
// node_modules/zod/v4/core/json-schema-processors.js
|
|
6332
|
+
var formatMap, stringProcessor = (schema, ctx, _json, _params) => {
|
|
6333
|
+
const json = _json;
|
|
6334
|
+
json.type = "string";
|
|
6335
|
+
const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
|
|
6336
|
+
if (typeof minimum === "number")
|
|
6337
|
+
json.minLength = minimum;
|
|
6338
|
+
if (typeof maximum === "number")
|
|
6339
|
+
json.maxLength = maximum;
|
|
6340
|
+
if (format) {
|
|
6341
|
+
json.format = formatMap[format] ?? format;
|
|
6342
|
+
if (json.format === "")
|
|
6343
|
+
delete json.format;
|
|
6344
|
+
if (format === "time") {
|
|
6345
|
+
delete json.format;
|
|
6346
|
+
}
|
|
6347
|
+
}
|
|
6348
|
+
if (contentEncoding)
|
|
6349
|
+
json.contentEncoding = contentEncoding;
|
|
6350
|
+
if (patterns && patterns.size > 0) {
|
|
6351
|
+
const regexes = [...patterns];
|
|
6352
|
+
if (regexes.length === 1)
|
|
6353
|
+
json.pattern = regexes[0].source;
|
|
6354
|
+
else if (regexes.length > 1) {
|
|
6355
|
+
json.allOf = [
|
|
6356
|
+
...regexes.map((regex) => ({
|
|
6357
|
+
...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
|
|
6358
|
+
pattern: regex.source
|
|
6359
|
+
}))
|
|
6360
|
+
];
|
|
6361
|
+
}
|
|
6362
|
+
}
|
|
6363
|
+
}, numberProcessor = (schema, ctx, _json, _params) => {
|
|
6364
|
+
const json = _json;
|
|
6365
|
+
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
6366
|
+
if (typeof format === "string" && format.includes("int"))
|
|
6367
|
+
json.type = "integer";
|
|
6368
|
+
else
|
|
6369
|
+
json.type = "number";
|
|
6370
|
+
if (typeof exclusiveMinimum === "number") {
|
|
6371
|
+
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
6372
|
+
json.minimum = exclusiveMinimum;
|
|
6373
|
+
json.exclusiveMinimum = true;
|
|
6374
|
+
} else {
|
|
6375
|
+
json.exclusiveMinimum = exclusiveMinimum;
|
|
6376
|
+
}
|
|
6377
|
+
}
|
|
6378
|
+
if (typeof minimum === "number") {
|
|
6379
|
+
json.minimum = minimum;
|
|
6380
|
+
if (typeof exclusiveMinimum === "number" && ctx.target !== "draft-04") {
|
|
6381
|
+
if (exclusiveMinimum >= minimum)
|
|
6382
|
+
delete json.minimum;
|
|
6383
|
+
else
|
|
6384
|
+
delete json.exclusiveMinimum;
|
|
6385
|
+
}
|
|
6386
|
+
}
|
|
6387
|
+
if (typeof exclusiveMaximum === "number") {
|
|
6388
|
+
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
6389
|
+
json.maximum = exclusiveMaximum;
|
|
6390
|
+
json.exclusiveMaximum = true;
|
|
6391
|
+
} else {
|
|
6392
|
+
json.exclusiveMaximum = exclusiveMaximum;
|
|
6393
|
+
}
|
|
6394
|
+
}
|
|
6395
|
+
if (typeof maximum === "number") {
|
|
6396
|
+
json.maximum = maximum;
|
|
6397
|
+
if (typeof exclusiveMaximum === "number" && ctx.target !== "draft-04") {
|
|
6398
|
+
if (exclusiveMaximum <= maximum)
|
|
6399
|
+
delete json.maximum;
|
|
6400
|
+
else
|
|
6401
|
+
delete json.exclusiveMaximum;
|
|
6402
|
+
}
|
|
6403
|
+
}
|
|
6404
|
+
if (typeof multipleOf === "number")
|
|
6405
|
+
json.multipleOf = multipleOf;
|
|
6406
|
+
}, booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
6407
|
+
json.type = "boolean";
|
|
6408
|
+
}, nullProcessor = (_schema, ctx, json, _params) => {
|
|
6409
|
+
if (ctx.target === "openapi-3.0") {
|
|
6410
|
+
json.type = "string";
|
|
6411
|
+
json.nullable = true;
|
|
6412
|
+
json.enum = [null];
|
|
6413
|
+
} else {
|
|
6414
|
+
json.type = "null";
|
|
6415
|
+
}
|
|
6416
|
+
}, neverProcessor = (_schema, _ctx, json, _params) => {
|
|
6417
|
+
json.not = {};
|
|
6418
|
+
}, unknownProcessor = (_schema, _ctx, _json, _params) => {}, enumProcessor = (schema, _ctx, json, _params) => {
|
|
6419
|
+
const def = schema._zod.def;
|
|
6420
|
+
const values = getEnumValues(def.entries);
|
|
6421
|
+
if (values.every((v) => typeof v === "number"))
|
|
6422
|
+
json.type = "number";
|
|
6423
|
+
if (values.every((v) => typeof v === "string"))
|
|
6424
|
+
json.type = "string";
|
|
6425
|
+
json.enum = values;
|
|
6426
|
+
}, literalProcessor = (schema, ctx, json, _params) => {
|
|
6427
|
+
const def = schema._zod.def;
|
|
6428
|
+
const vals = [];
|
|
6429
|
+
for (const val of def.values) {
|
|
6430
|
+
if (val === undefined) {
|
|
6431
|
+
if (ctx.unrepresentable === "throw") {
|
|
6432
|
+
throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
6433
|
+
} else {}
|
|
6434
|
+
} else if (typeof val === "bigint") {
|
|
6435
|
+
if (ctx.unrepresentable === "throw") {
|
|
6436
|
+
throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
6437
|
+
} else {
|
|
6438
|
+
vals.push(Number(val));
|
|
6439
|
+
}
|
|
6440
|
+
} else {
|
|
6441
|
+
vals.push(val);
|
|
6442
|
+
}
|
|
6443
|
+
}
|
|
6444
|
+
if (vals.length === 0) {} else if (vals.length === 1) {
|
|
6445
|
+
const val = vals[0];
|
|
6446
|
+
json.type = val === null ? "null" : typeof val;
|
|
6447
|
+
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
6448
|
+
json.enum = [val];
|
|
6449
|
+
} else {
|
|
6450
|
+
json.const = val;
|
|
6451
|
+
}
|
|
6452
|
+
} else {
|
|
6453
|
+
if (vals.every((v) => typeof v === "number"))
|
|
6454
|
+
json.type = "number";
|
|
6455
|
+
if (vals.every((v) => typeof v === "string"))
|
|
6456
|
+
json.type = "string";
|
|
6457
|
+
if (vals.every((v) => typeof v === "boolean"))
|
|
6458
|
+
json.type = "boolean";
|
|
6459
|
+
if (vals.every((v) => v === null))
|
|
6460
|
+
json.type = "null";
|
|
6461
|
+
json.enum = vals;
|
|
6462
|
+
}
|
|
6463
|
+
}, customProcessor = (_schema, ctx, _json, _params) => {
|
|
6464
|
+
if (ctx.unrepresentable === "throw") {
|
|
6465
|
+
throw new Error("Custom types cannot be represented in JSON Schema");
|
|
6466
|
+
}
|
|
6467
|
+
}, transformProcessor = (_schema, ctx, _json, _params) => {
|
|
6468
|
+
if (ctx.unrepresentable === "throw") {
|
|
6469
|
+
throw new Error("Transforms cannot be represented in JSON Schema");
|
|
6470
|
+
}
|
|
6471
|
+
}, arrayProcessor = (schema, ctx, _json, params) => {
|
|
6472
|
+
const json = _json;
|
|
6473
|
+
const def = schema._zod.def;
|
|
6474
|
+
const { minimum, maximum } = schema._zod.bag;
|
|
6475
|
+
if (typeof minimum === "number")
|
|
6476
|
+
json.minItems = minimum;
|
|
6477
|
+
if (typeof maximum === "number")
|
|
6478
|
+
json.maxItems = maximum;
|
|
6479
|
+
json.type = "array";
|
|
6480
|
+
json.items = process2(def.element, ctx, { ...params, path: [...params.path, "items"] });
|
|
6481
|
+
}, objectProcessor = (schema, ctx, _json, params) => {
|
|
6482
|
+
const json = _json;
|
|
6483
|
+
const def = schema._zod.def;
|
|
6484
|
+
json.type = "object";
|
|
6485
|
+
json.properties = {};
|
|
6486
|
+
const shape = def.shape;
|
|
6487
|
+
for (const key in shape) {
|
|
6488
|
+
json.properties[key] = process2(shape[key], ctx, {
|
|
6489
|
+
...params,
|
|
6490
|
+
path: [...params.path, "properties", key]
|
|
6491
|
+
});
|
|
6492
|
+
}
|
|
6493
|
+
const allKeys = new Set(Object.keys(shape));
|
|
6494
|
+
const requiredKeys = new Set([...allKeys].filter((key) => {
|
|
6495
|
+
const v = def.shape[key]._zod;
|
|
6496
|
+
if (ctx.io === "input") {
|
|
6497
|
+
return v.optin === undefined;
|
|
6498
|
+
} else {
|
|
6499
|
+
return v.optout === undefined;
|
|
6500
|
+
}
|
|
6501
|
+
}));
|
|
6502
|
+
if (requiredKeys.size > 0) {
|
|
6503
|
+
json.required = Array.from(requiredKeys);
|
|
6504
|
+
}
|
|
6505
|
+
if (def.catchall?._zod.def.type === "never") {
|
|
6506
|
+
json.additionalProperties = false;
|
|
6507
|
+
} else if (!def.catchall) {
|
|
6508
|
+
if (ctx.io === "output")
|
|
6509
|
+
json.additionalProperties = false;
|
|
6510
|
+
} else if (def.catchall) {
|
|
6511
|
+
json.additionalProperties = process2(def.catchall, ctx, {
|
|
6512
|
+
...params,
|
|
6513
|
+
path: [...params.path, "additionalProperties"]
|
|
6514
|
+
});
|
|
6515
|
+
}
|
|
6516
|
+
}, unionProcessor = (schema, ctx, json, params) => {
|
|
6517
|
+
const def = schema._zod.def;
|
|
6518
|
+
const isExclusive = def.inclusive === false;
|
|
6519
|
+
const options = def.options.map((x, i) => process2(x, ctx, {
|
|
6520
|
+
...params,
|
|
6521
|
+
path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
|
|
6522
|
+
}));
|
|
6523
|
+
if (isExclusive) {
|
|
6524
|
+
json.oneOf = options;
|
|
6525
|
+
} else {
|
|
6526
|
+
json.anyOf = options;
|
|
6527
|
+
}
|
|
6528
|
+
}, intersectionProcessor = (schema, ctx, json, params) => {
|
|
6529
|
+
const def = schema._zod.def;
|
|
6530
|
+
const a = process2(def.left, ctx, {
|
|
6531
|
+
...params,
|
|
6532
|
+
path: [...params.path, "allOf", 0]
|
|
6533
|
+
});
|
|
6534
|
+
const b = process2(def.right, ctx, {
|
|
6535
|
+
...params,
|
|
6536
|
+
path: [...params.path, "allOf", 1]
|
|
6537
|
+
});
|
|
6538
|
+
const isSimpleIntersection = (val) => ("allOf" in val) && Object.keys(val).length === 1;
|
|
6539
|
+
const allOf = [
|
|
6540
|
+
...isSimpleIntersection(a) ? a.allOf : [a],
|
|
6541
|
+
...isSimpleIntersection(b) ? b.allOf : [b]
|
|
6542
|
+
];
|
|
6543
|
+
json.allOf = allOf;
|
|
6544
|
+
}, recordProcessor = (schema, ctx, _json, params) => {
|
|
6545
|
+
const json = _json;
|
|
6546
|
+
const def = schema._zod.def;
|
|
6547
|
+
json.type = "object";
|
|
6548
|
+
const keyType = def.keyType;
|
|
6549
|
+
const keyBag = keyType._zod.bag;
|
|
6550
|
+
const patterns = keyBag?.patterns;
|
|
6551
|
+
if (def.mode === "loose" && patterns && patterns.size > 0) {
|
|
6552
|
+
const valueSchema = process2(def.valueType, ctx, {
|
|
6553
|
+
...params,
|
|
6554
|
+
path: [...params.path, "patternProperties", "*"]
|
|
6555
|
+
});
|
|
6556
|
+
json.patternProperties = {};
|
|
6557
|
+
for (const pattern of patterns) {
|
|
6558
|
+
json.patternProperties[pattern.source] = valueSchema;
|
|
6559
|
+
}
|
|
6560
|
+
} else {
|
|
6561
|
+
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
|
|
6562
|
+
json.propertyNames = process2(def.keyType, ctx, {
|
|
6563
|
+
...params,
|
|
6564
|
+
path: [...params.path, "propertyNames"]
|
|
6565
|
+
});
|
|
6566
|
+
}
|
|
6567
|
+
json.additionalProperties = process2(def.valueType, ctx, {
|
|
6568
|
+
...params,
|
|
6569
|
+
path: [...params.path, "additionalProperties"]
|
|
6570
|
+
});
|
|
6571
|
+
}
|
|
6572
|
+
const keyValues = keyType._zod.values;
|
|
6573
|
+
if (keyValues) {
|
|
6574
|
+
const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
|
|
6575
|
+
if (validKeyValues.length > 0) {
|
|
6576
|
+
json.required = validKeyValues;
|
|
6577
|
+
}
|
|
6578
|
+
}
|
|
6579
|
+
}, nullableProcessor = (schema, ctx, json, params) => {
|
|
6580
|
+
const def = schema._zod.def;
|
|
6581
|
+
const inner = process2(def.innerType, ctx, params);
|
|
6582
|
+
const seen = ctx.seen.get(schema);
|
|
6583
|
+
if (ctx.target === "openapi-3.0") {
|
|
6584
|
+
seen.ref = def.innerType;
|
|
6585
|
+
json.nullable = true;
|
|
6586
|
+
} else {
|
|
6587
|
+
json.anyOf = [inner, { type: "null" }];
|
|
6588
|
+
}
|
|
6589
|
+
}, nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
6590
|
+
const def = schema._zod.def;
|
|
6591
|
+
process2(def.innerType, ctx, params);
|
|
6592
|
+
const seen = ctx.seen.get(schema);
|
|
6593
|
+
seen.ref = def.innerType;
|
|
6594
|
+
}, defaultProcessor = (schema, ctx, json, params) => {
|
|
6595
|
+
const def = schema._zod.def;
|
|
6596
|
+
process2(def.innerType, ctx, params);
|
|
6597
|
+
const seen = ctx.seen.get(schema);
|
|
6598
|
+
seen.ref = def.innerType;
|
|
6599
|
+
json.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
6600
|
+
}, prefaultProcessor = (schema, ctx, json, params) => {
|
|
6601
|
+
const def = schema._zod.def;
|
|
6602
|
+
process2(def.innerType, ctx, params);
|
|
6603
|
+
const seen = ctx.seen.get(schema);
|
|
6604
|
+
seen.ref = def.innerType;
|
|
6605
|
+
if (ctx.io === "input")
|
|
6606
|
+
json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
|
|
6607
|
+
}, catchProcessor = (schema, ctx, json, params) => {
|
|
6608
|
+
const def = schema._zod.def;
|
|
6609
|
+
process2(def.innerType, ctx, params);
|
|
6610
|
+
const seen = ctx.seen.get(schema);
|
|
6611
|
+
seen.ref = def.innerType;
|
|
6612
|
+
let catchValue;
|
|
6613
|
+
try {
|
|
6614
|
+
catchValue = def.catchValue(undefined);
|
|
6615
|
+
} catch {
|
|
6616
|
+
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
|
6617
|
+
}
|
|
6618
|
+
json.default = catchValue;
|
|
6619
|
+
}, pipeProcessor = (schema, ctx, _json, params) => {
|
|
6620
|
+
const def = schema._zod.def;
|
|
6621
|
+
const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
|
|
6622
|
+
process2(innerType, ctx, params);
|
|
6623
|
+
const seen = ctx.seen.get(schema);
|
|
6624
|
+
seen.ref = innerType;
|
|
6625
|
+
}, readonlyProcessor = (schema, ctx, json, params) => {
|
|
6626
|
+
const def = schema._zod.def;
|
|
6627
|
+
process2(def.innerType, ctx, params);
|
|
6628
|
+
const seen = ctx.seen.get(schema);
|
|
6629
|
+
seen.ref = def.innerType;
|
|
6630
|
+
json.readOnly = true;
|
|
6631
|
+
}, optionalProcessor = (schema, ctx, _json, params) => {
|
|
6632
|
+
const def = schema._zod.def;
|
|
6633
|
+
process2(def.innerType, ctx, params);
|
|
6634
|
+
const seen = ctx.seen.get(schema);
|
|
6635
|
+
seen.ref = def.innerType;
|
|
6636
|
+
};
|
|
6637
|
+
var init_json_schema_processors = __esm(() => {
|
|
6638
|
+
init_to_json_schema();
|
|
6639
|
+
init_util();
|
|
6640
|
+
formatMap = {
|
|
6641
|
+
guid: "uuid",
|
|
6642
|
+
url: "uri",
|
|
6643
|
+
datetime: "date-time",
|
|
6644
|
+
json_string: "json-string",
|
|
6645
|
+
regex: ""
|
|
6646
|
+
};
|
|
6647
|
+
});
|
|
5623
6648
|
|
|
5624
6649
|
// node_modules/zod/v4/core/json-schema.js
|
|
5625
6650
|
var init_json_schema = () => {};
|
|
@@ -5637,7 +6662,6 @@ var init_core2 = __esm(() => {
|
|
|
5637
6662
|
init_checks();
|
|
5638
6663
|
init_versions();
|
|
5639
6664
|
init_registries();
|
|
5640
|
-
init_function();
|
|
5641
6665
|
init_api();
|
|
5642
6666
|
init_to_json_schema();
|
|
5643
6667
|
});
|
|
@@ -5670,14 +6694,9 @@ var init_external = __esm(() => {
|
|
|
5670
6694
|
init_checks2();
|
|
5671
6695
|
});
|
|
5672
6696
|
|
|
5673
|
-
// node_modules/zod/v4/mini/index.js
|
|
5674
|
-
var init_mini = __esm(() => {
|
|
5675
|
-
init_external();
|
|
5676
|
-
});
|
|
5677
|
-
|
|
5678
6697
|
// node_modules/zod/v4-mini/index.js
|
|
5679
6698
|
var init_v4_mini = __esm(() => {
|
|
5680
|
-
|
|
6699
|
+
init_external();
|
|
5681
6700
|
});
|
|
5682
6701
|
|
|
5683
6702
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
|
|
@@ -5809,10 +6828,16 @@ var initializer2 = (inst, issues) => {
|
|
|
5809
6828
|
value: (mapper) => flattenError(inst, mapper)
|
|
5810
6829
|
},
|
|
5811
6830
|
addIssue: {
|
|
5812
|
-
value: (issue2) =>
|
|
6831
|
+
value: (issue2) => {
|
|
6832
|
+
inst.issues.push(issue2);
|
|
6833
|
+
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
6834
|
+
}
|
|
5813
6835
|
},
|
|
5814
6836
|
addIssues: {
|
|
5815
|
-
value: (issues2) =>
|
|
6837
|
+
value: (issues2) => {
|
|
6838
|
+
inst.issues.push(...issues2);
|
|
6839
|
+
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
6840
|
+
}
|
|
5816
6841
|
},
|
|
5817
6842
|
isEmpty: {
|
|
5818
6843
|
get() {
|
|
@@ -5824,6 +6849,7 @@ var initializer2 = (inst, issues) => {
|
|
|
5824
6849
|
var init_errors2 = __esm(() => {
|
|
5825
6850
|
init_core2();
|
|
5826
6851
|
init_core2();
|
|
6852
|
+
init_util();
|
|
5827
6853
|
ZodError = $constructor("ZodError", initializer2);
|
|
5828
6854
|
ZodRealError = $constructor("ZodError", initializer2, {
|
|
5829
6855
|
Parent: Error
|
|
@@ -5831,7 +6857,7 @@ var init_errors2 = __esm(() => {
|
|
|
5831
6857
|
});
|
|
5832
6858
|
|
|
5833
6859
|
// node_modules/zod/v4/classic/parse.js
|
|
5834
|
-
var parse4, parseAsync2, safeParse3, safeParseAsync2;
|
|
6860
|
+
var parse4, parseAsync2, safeParse3, safeParseAsync2, encode2, decode2, encodeAsync2, decodeAsync2, safeEncode2, safeDecode2, safeEncodeAsync2, safeDecodeAsync2;
|
|
5835
6861
|
var init_parse3 = __esm(() => {
|
|
5836
6862
|
init_core2();
|
|
5837
6863
|
init_errors2();
|
|
@@ -5839,6 +6865,14 @@ var init_parse3 = __esm(() => {
|
|
|
5839
6865
|
parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
5840
6866
|
safeParse3 = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
5841
6867
|
safeParseAsync2 = /* @__PURE__ */ _safeParseAsync(ZodRealError);
|
|
6868
|
+
encode2 = /* @__PURE__ */ _encode(ZodRealError);
|
|
6869
|
+
decode2 = /* @__PURE__ */ _decode(ZodRealError);
|
|
6870
|
+
encodeAsync2 = /* @__PURE__ */ _encodeAsync(ZodRealError);
|
|
6871
|
+
decodeAsync2 = /* @__PURE__ */ _decodeAsync(ZodRealError);
|
|
6872
|
+
safeEncode2 = /* @__PURE__ */ _safeEncode(ZodRealError);
|
|
6873
|
+
safeDecode2 = /* @__PURE__ */ _safeDecode(ZodRealError);
|
|
6874
|
+
safeEncodeAsync2 = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
6875
|
+
safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
5842
6876
|
});
|
|
5843
6877
|
|
|
5844
6878
|
// node_modules/zod/v4/classic/schemas.js
|
|
@@ -5869,10 +6903,7 @@ function array(element, params) {
|
|
|
5869
6903
|
function object2(shape, params) {
|
|
5870
6904
|
const def = {
|
|
5871
6905
|
type: "object",
|
|
5872
|
-
|
|
5873
|
-
exports_util.assignProp(this, "shape", { ...shape });
|
|
5874
|
-
return this.shape;
|
|
5875
|
-
},
|
|
6906
|
+
shape: shape ?? {},
|
|
5876
6907
|
...exports_util.normalizeParams(params)
|
|
5877
6908
|
};
|
|
5878
6909
|
return new ZodObject(def);
|
|
@@ -5880,10 +6911,7 @@ function object2(shape, params) {
|
|
|
5880
6911
|
function looseObject(shape, params) {
|
|
5881
6912
|
return new ZodObject({
|
|
5882
6913
|
type: "object",
|
|
5883
|
-
|
|
5884
|
-
exports_util.assignProp(this, "shape", { ...shape });
|
|
5885
|
-
return this.shape;
|
|
5886
|
-
},
|
|
6914
|
+
shape,
|
|
5887
6915
|
catchall: unknown(),
|
|
5888
6916
|
...exports_util.normalizeParams(params)
|
|
5889
6917
|
});
|
|
@@ -5945,6 +6973,12 @@ function optional(innerType) {
|
|
|
5945
6973
|
innerType
|
|
5946
6974
|
});
|
|
5947
6975
|
}
|
|
6976
|
+
function exactOptional(innerType) {
|
|
6977
|
+
return new ZodExactOptional({
|
|
6978
|
+
type: "optional",
|
|
6979
|
+
innerType
|
|
6980
|
+
});
|
|
6981
|
+
}
|
|
5948
6982
|
function nullable(innerType) {
|
|
5949
6983
|
return new ZodNullable({
|
|
5950
6984
|
type: "nullable",
|
|
@@ -5956,7 +6990,7 @@ function _default(innerType, defaultValue) {
|
|
|
5956
6990
|
type: "default",
|
|
5957
6991
|
innerType,
|
|
5958
6992
|
get defaultValue() {
|
|
5959
|
-
return typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
|
6993
|
+
return typeof defaultValue === "function" ? defaultValue() : exports_util.shallowClone(defaultValue);
|
|
5960
6994
|
}
|
|
5961
6995
|
});
|
|
5962
6996
|
}
|
|
@@ -5965,7 +6999,7 @@ function prefault(innerType, defaultValue) {
|
|
|
5965
6999
|
type: "prefault",
|
|
5966
7000
|
innerType,
|
|
5967
7001
|
get defaultValue() {
|
|
5968
|
-
return typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
|
7002
|
+
return typeof defaultValue === "function" ? defaultValue() : exports_util.shallowClone(defaultValue);
|
|
5969
7003
|
}
|
|
5970
7004
|
});
|
|
5971
7005
|
}
|
|
@@ -5996,13 +7030,6 @@ function readonly(innerType) {
|
|
|
5996
7030
|
innerType
|
|
5997
7031
|
});
|
|
5998
7032
|
}
|
|
5999
|
-
function check(fn) {
|
|
6000
|
-
const ch = new $ZodCheck({
|
|
6001
|
-
check: "custom"
|
|
6002
|
-
});
|
|
6003
|
-
ch._zod.check = fn;
|
|
6004
|
-
return ch;
|
|
6005
|
-
}
|
|
6006
7033
|
function custom(fn, _params) {
|
|
6007
7034
|
return _custom(ZodCustom, fn ?? (() => true), _params);
|
|
6008
7035
|
}
|
|
@@ -6010,52 +7037,47 @@ function refine(fn, _params = {}) {
|
|
|
6010
7037
|
return _refine(ZodCustom, fn, _params);
|
|
6011
7038
|
}
|
|
6012
7039
|
function superRefine(fn) {
|
|
6013
|
-
|
|
6014
|
-
payload.addIssue = (issue2) => {
|
|
6015
|
-
if (typeof issue2 === "string") {
|
|
6016
|
-
payload.issues.push(exports_util.issue(issue2, payload.value, ch._zod.def));
|
|
6017
|
-
} else {
|
|
6018
|
-
const _issue = issue2;
|
|
6019
|
-
if (_issue.fatal)
|
|
6020
|
-
_issue.continue = false;
|
|
6021
|
-
_issue.code ?? (_issue.code = "custom");
|
|
6022
|
-
_issue.input ?? (_issue.input = payload.value);
|
|
6023
|
-
_issue.inst ?? (_issue.inst = ch);
|
|
6024
|
-
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
|
|
6025
|
-
payload.issues.push(exports_util.issue(_issue));
|
|
6026
|
-
}
|
|
6027
|
-
};
|
|
6028
|
-
return fn(payload.value, payload);
|
|
6029
|
-
});
|
|
6030
|
-
return ch;
|
|
7040
|
+
return _superRefine(fn);
|
|
6031
7041
|
}
|
|
6032
7042
|
function preprocess(fn, schema) {
|
|
6033
7043
|
return pipe(transform(fn), schema);
|
|
6034
7044
|
}
|
|
6035
|
-
var ZodType, _ZodString, ZodString, ZodStringFormat, ZodEmail, ZodGUID, ZodUUID, ZodURL, ZodEmoji, ZodNanoID, ZodCUID, ZodCUID2, ZodULID, ZodXID, ZodKSUID, ZodIPv4, ZodIPv6, ZodCIDRv4, ZodCIDRv6, ZodBase64, ZodBase64URL, ZodE164, ZodJWT, ZodNumber, ZodNumberFormat, ZodBoolean, ZodNull, ZodUnknown, ZodNever, ZodArray, ZodObject, ZodUnion, ZodDiscriminatedUnion, ZodIntersection, ZodRecord, ZodEnum, ZodLiteral, ZodTransform, ZodOptional, ZodNullable, ZodDefault, ZodPrefault, ZodNonOptional, ZodCatch, ZodPipe, ZodReadonly, ZodCustom;
|
|
7045
|
+
var ZodType, _ZodString, ZodString, ZodStringFormat, ZodEmail, ZodGUID, ZodUUID, ZodURL, ZodEmoji, ZodNanoID, ZodCUID, ZodCUID2, ZodULID, ZodXID, ZodKSUID, ZodIPv4, ZodIPv6, ZodCIDRv4, ZodCIDRv6, ZodBase64, ZodBase64URL, ZodE164, ZodJWT, ZodNumber, ZodNumberFormat, ZodBoolean, ZodNull, ZodUnknown, ZodNever, ZodArray, ZodObject, ZodUnion, ZodDiscriminatedUnion, ZodIntersection, ZodRecord, ZodEnum, ZodLiteral, ZodTransform, ZodOptional, ZodExactOptional, ZodNullable, ZodDefault, ZodPrefault, ZodNonOptional, ZodCatch, ZodPipe, ZodReadonly, ZodCustom;
|
|
6036
7046
|
var init_schemas3 = __esm(() => {
|
|
6037
7047
|
init_core2();
|
|
6038
7048
|
init_core2();
|
|
7049
|
+
init_json_schema_processors();
|
|
7050
|
+
init_to_json_schema();
|
|
6039
7051
|
init_checks3();
|
|
6040
7052
|
init_iso2();
|
|
6041
7053
|
init_parse3();
|
|
6042
7054
|
ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
6043
7055
|
$ZodType.init(inst, def);
|
|
7056
|
+
Object.assign(inst["~standard"], {
|
|
7057
|
+
jsonSchema: {
|
|
7058
|
+
input: createStandardJSONSchemaMethod(inst, "input"),
|
|
7059
|
+
output: createStandardJSONSchemaMethod(inst, "output")
|
|
7060
|
+
}
|
|
7061
|
+
});
|
|
7062
|
+
inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
|
|
6044
7063
|
inst.def = def;
|
|
7064
|
+
inst.type = def.type;
|
|
6045
7065
|
Object.defineProperty(inst, "_def", { value: def });
|
|
6046
7066
|
inst.check = (...checks3) => {
|
|
6047
|
-
return inst.clone({
|
|
6048
|
-
...def,
|
|
7067
|
+
return inst.clone(exports_util.mergeDefs(def, {
|
|
6049
7068
|
checks: [
|
|
6050
7069
|
...def.checks ?? [],
|
|
6051
7070
|
...checks3.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
|
|
6052
7071
|
]
|
|
7072
|
+
}), {
|
|
7073
|
+
parent: true
|
|
6053
7074
|
});
|
|
6054
7075
|
};
|
|
7076
|
+
inst.with = inst.check;
|
|
6055
7077
|
inst.clone = (def2, params) => clone(inst, def2, params);
|
|
6056
7078
|
inst.brand = () => inst;
|
|
6057
|
-
inst.register = (reg,
|
|
6058
|
-
reg.add(inst,
|
|
7079
|
+
inst.register = (reg, meta2) => {
|
|
7080
|
+
reg.add(inst, meta2);
|
|
6059
7081
|
return inst;
|
|
6060
7082
|
};
|
|
6061
7083
|
inst.parse = (data, params) => parse4(inst, data, params, { callee: inst.parse });
|
|
@@ -6063,10 +7085,19 @@ var init_schemas3 = __esm(() => {
|
|
|
6063
7085
|
inst.parseAsync = async (data, params) => parseAsync2(inst, data, params, { callee: inst.parseAsync });
|
|
6064
7086
|
inst.safeParseAsync = async (data, params) => safeParseAsync2(inst, data, params);
|
|
6065
7087
|
inst.spa = inst.safeParseAsync;
|
|
7088
|
+
inst.encode = (data, params) => encode2(inst, data, params);
|
|
7089
|
+
inst.decode = (data, params) => decode2(inst, data, params);
|
|
7090
|
+
inst.encodeAsync = async (data, params) => encodeAsync2(inst, data, params);
|
|
7091
|
+
inst.decodeAsync = async (data, params) => decodeAsync2(inst, data, params);
|
|
7092
|
+
inst.safeEncode = (data, params) => safeEncode2(inst, data, params);
|
|
7093
|
+
inst.safeDecode = (data, params) => safeDecode2(inst, data, params);
|
|
7094
|
+
inst.safeEncodeAsync = async (data, params) => safeEncodeAsync2(inst, data, params);
|
|
7095
|
+
inst.safeDecodeAsync = async (data, params) => safeDecodeAsync2(inst, data, params);
|
|
6066
7096
|
inst.refine = (check, params) => inst.check(refine(check, params));
|
|
6067
7097
|
inst.superRefine = (refinement) => inst.check(superRefine(refinement));
|
|
6068
7098
|
inst.overwrite = (fn) => inst.check(_overwrite(fn));
|
|
6069
7099
|
inst.optional = () => optional(inst);
|
|
7100
|
+
inst.exactOptional = () => exactOptional(inst);
|
|
6070
7101
|
inst.nullable = () => nullable(inst);
|
|
6071
7102
|
inst.nullish = () => optional(nullable(inst));
|
|
6072
7103
|
inst.nonoptional = (params) => nonoptional(inst, params);
|
|
@@ -6100,11 +7131,13 @@ var init_schemas3 = __esm(() => {
|
|
|
6100
7131
|
};
|
|
6101
7132
|
inst.isOptional = () => inst.safeParse(undefined).success;
|
|
6102
7133
|
inst.isNullable = () => inst.safeParse(null).success;
|
|
7134
|
+
inst.apply = (fn) => fn(inst);
|
|
6103
7135
|
return inst;
|
|
6104
7136
|
});
|
|
6105
7137
|
_ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
|
|
6106
7138
|
$ZodString.init(inst, def);
|
|
6107
7139
|
ZodType.init(inst, def);
|
|
7140
|
+
inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
|
|
6108
7141
|
const bag = inst._zod.bag;
|
|
6109
7142
|
inst.format = bag.format ?? null;
|
|
6110
7143
|
inst.minLength = bag.minimum ?? null;
|
|
@@ -6123,6 +7156,7 @@ var init_schemas3 = __esm(() => {
|
|
|
6123
7156
|
inst.normalize = (...args) => inst.check(_normalize(...args));
|
|
6124
7157
|
inst.toLowerCase = () => inst.check(_toLowerCase());
|
|
6125
7158
|
inst.toUpperCase = () => inst.check(_toUpperCase());
|
|
7159
|
+
inst.slugify = () => inst.check(_slugify());
|
|
6126
7160
|
});
|
|
6127
7161
|
ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
|
|
6128
7162
|
$ZodString.init(inst, def);
|
|
@@ -6238,6 +7272,7 @@ var init_schemas3 = __esm(() => {
|
|
|
6238
7272
|
ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
|
|
6239
7273
|
$ZodNumber.init(inst, def);
|
|
6240
7274
|
ZodType.init(inst, def);
|
|
7275
|
+
inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
|
|
6241
7276
|
inst.gt = (value, params) => inst.check(_gt(value, params));
|
|
6242
7277
|
inst.gte = (value, params) => inst.check(_gte(value, params));
|
|
6243
7278
|
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
@@ -6267,22 +7302,27 @@ var init_schemas3 = __esm(() => {
|
|
|
6267
7302
|
ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
|
|
6268
7303
|
$ZodBoolean.init(inst, def);
|
|
6269
7304
|
ZodType.init(inst, def);
|
|
7305
|
+
inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
|
|
6270
7306
|
});
|
|
6271
7307
|
ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
|
|
6272
7308
|
$ZodNull.init(inst, def);
|
|
6273
7309
|
ZodType.init(inst, def);
|
|
7310
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nullProcessor(inst, ctx, json, params);
|
|
6274
7311
|
});
|
|
6275
7312
|
ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
6276
7313
|
$ZodUnknown.init(inst, def);
|
|
6277
7314
|
ZodType.init(inst, def);
|
|
7315
|
+
inst._zod.processJSONSchema = (ctx, json, params) => unknownProcessor(inst, ctx, json, params);
|
|
6278
7316
|
});
|
|
6279
7317
|
ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
|
|
6280
7318
|
$ZodNever.init(inst, def);
|
|
6281
7319
|
ZodType.init(inst, def);
|
|
7320
|
+
inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params);
|
|
6282
7321
|
});
|
|
6283
7322
|
ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
|
|
6284
7323
|
$ZodArray.init(inst, def);
|
|
6285
7324
|
ZodType.init(inst, def);
|
|
7325
|
+
inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
|
|
6286
7326
|
inst.element = def.element;
|
|
6287
7327
|
inst.min = (minLength, params) => inst.check(_minLength(minLength, params));
|
|
6288
7328
|
inst.nonempty = (params) => inst.check(_minLength(1, params));
|
|
@@ -6291,9 +7331,12 @@ var init_schemas3 = __esm(() => {
|
|
|
6291
7331
|
inst.unwrap = () => inst.element;
|
|
6292
7332
|
});
|
|
6293
7333
|
ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
6294
|
-
$
|
|
7334
|
+
$ZodObjectJIT.init(inst, def);
|
|
6295
7335
|
ZodType.init(inst, def);
|
|
6296
|
-
|
|
7336
|
+
inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
|
|
7337
|
+
exports_util.defineLazy(inst, "shape", () => {
|
|
7338
|
+
return def.shape;
|
|
7339
|
+
});
|
|
6297
7340
|
inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
|
|
6298
7341
|
inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall });
|
|
6299
7342
|
inst.passthrough = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
|
|
@@ -6303,6 +7346,9 @@ var init_schemas3 = __esm(() => {
|
|
|
6303
7346
|
inst.extend = (incoming) => {
|
|
6304
7347
|
return exports_util.extend(inst, incoming);
|
|
6305
7348
|
};
|
|
7349
|
+
inst.safeExtend = (incoming) => {
|
|
7350
|
+
return exports_util.safeExtend(inst, incoming);
|
|
7351
|
+
};
|
|
6306
7352
|
inst.merge = (other) => exports_util.merge(inst, other);
|
|
6307
7353
|
inst.pick = (mask) => exports_util.pick(inst, mask);
|
|
6308
7354
|
inst.omit = (mask) => exports_util.omit(inst, mask);
|
|
@@ -6312,6 +7358,7 @@ var init_schemas3 = __esm(() => {
|
|
|
6312
7358
|
ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
|
|
6313
7359
|
$ZodUnion.init(inst, def);
|
|
6314
7360
|
ZodType.init(inst, def);
|
|
7361
|
+
inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
|
|
6315
7362
|
inst.options = def.options;
|
|
6316
7363
|
});
|
|
6317
7364
|
ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("ZodDiscriminatedUnion", (inst, def) => {
|
|
@@ -6321,16 +7368,19 @@ var init_schemas3 = __esm(() => {
|
|
|
6321
7368
|
ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
|
|
6322
7369
|
$ZodIntersection.init(inst, def);
|
|
6323
7370
|
ZodType.init(inst, def);
|
|
7371
|
+
inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params);
|
|
6324
7372
|
});
|
|
6325
7373
|
ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
|
|
6326
7374
|
$ZodRecord.init(inst, def);
|
|
6327
7375
|
ZodType.init(inst, def);
|
|
7376
|
+
inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
|
|
6328
7377
|
inst.keyType = def.keyType;
|
|
6329
7378
|
inst.valueType = def.valueType;
|
|
6330
7379
|
});
|
|
6331
7380
|
ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
6332
7381
|
$ZodEnum.init(inst, def);
|
|
6333
7382
|
ZodType.init(inst, def);
|
|
7383
|
+
inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
|
|
6334
7384
|
inst.enum = def.entries;
|
|
6335
7385
|
inst.options = Object.values(def.entries);
|
|
6336
7386
|
const keys = new Set(Object.keys(def.entries));
|
|
@@ -6368,6 +7418,7 @@ var init_schemas3 = __esm(() => {
|
|
|
6368
7418
|
ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
|
|
6369
7419
|
$ZodLiteral.init(inst, def);
|
|
6370
7420
|
ZodType.init(inst, def);
|
|
7421
|
+
inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor(inst, ctx, json, params);
|
|
6371
7422
|
inst.values = new Set(def.values);
|
|
6372
7423
|
Object.defineProperty(inst, "value", {
|
|
6373
7424
|
get() {
|
|
@@ -6381,7 +7432,11 @@ var init_schemas3 = __esm(() => {
|
|
|
6381
7432
|
ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
6382
7433
|
$ZodTransform.init(inst, def);
|
|
6383
7434
|
ZodType.init(inst, def);
|
|
7435
|
+
inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
|
|
6384
7436
|
inst._zod.parse = (payload, _ctx) => {
|
|
7437
|
+
if (_ctx.direction === "backward") {
|
|
7438
|
+
throw new $ZodEncodeError(inst.constructor.name);
|
|
7439
|
+
}
|
|
6385
7440
|
payload.addIssue = (issue2) => {
|
|
6386
7441
|
if (typeof issue2 === "string") {
|
|
6387
7442
|
payload.issues.push(exports_util.issue(issue2, payload.value, def));
|
|
@@ -6392,7 +7447,6 @@ var init_schemas3 = __esm(() => {
|
|
|
6392
7447
|
_issue.code ?? (_issue.code = "custom");
|
|
6393
7448
|
_issue.input ?? (_issue.input = payload.value);
|
|
6394
7449
|
_issue.inst ?? (_issue.inst = inst);
|
|
6395
|
-
_issue.continue ?? (_issue.continue = true);
|
|
6396
7450
|
payload.issues.push(exports_util.issue(_issue));
|
|
6397
7451
|
}
|
|
6398
7452
|
};
|
|
@@ -6410,53 +7464,72 @@ var init_schemas3 = __esm(() => {
|
|
|
6410
7464
|
ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
|
|
6411
7465
|
$ZodOptional.init(inst, def);
|
|
6412
7466
|
ZodType.init(inst, def);
|
|
7467
|
+
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
7468
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
7469
|
+
});
|
|
7470
|
+
ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
|
|
7471
|
+
$ZodExactOptional.init(inst, def);
|
|
7472
|
+
ZodType.init(inst, def);
|
|
7473
|
+
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
6413
7474
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
6414
7475
|
});
|
|
6415
7476
|
ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
|
|
6416
7477
|
$ZodNullable.init(inst, def);
|
|
6417
7478
|
ZodType.init(inst, def);
|
|
7479
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
|
|
6418
7480
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
6419
7481
|
});
|
|
6420
7482
|
ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
|
|
6421
7483
|
$ZodDefault.init(inst, def);
|
|
6422
7484
|
ZodType.init(inst, def);
|
|
7485
|
+
inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
|
|
6423
7486
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
6424
7487
|
inst.removeDefault = inst.unwrap;
|
|
6425
7488
|
});
|
|
6426
7489
|
ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
|
|
6427
7490
|
$ZodPrefault.init(inst, def);
|
|
6428
7491
|
ZodType.init(inst, def);
|
|
7492
|
+
inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params);
|
|
6429
7493
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
6430
7494
|
});
|
|
6431
7495
|
ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
|
|
6432
7496
|
$ZodNonOptional.init(inst, def);
|
|
6433
7497
|
ZodType.init(inst, def);
|
|
7498
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params);
|
|
6434
7499
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
6435
7500
|
});
|
|
6436
7501
|
ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
|
|
6437
7502
|
$ZodCatch.init(inst, def);
|
|
6438
7503
|
ZodType.init(inst, def);
|
|
7504
|
+
inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
|
|
6439
7505
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
6440
7506
|
inst.removeCatch = inst.unwrap;
|
|
6441
7507
|
});
|
|
6442
7508
|
ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
|
|
6443
7509
|
$ZodPipe.init(inst, def);
|
|
6444
7510
|
ZodType.init(inst, def);
|
|
7511
|
+
inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
|
|
6445
7512
|
inst.in = def.in;
|
|
6446
7513
|
inst.out = def.out;
|
|
6447
7514
|
});
|
|
6448
7515
|
ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
|
|
6449
7516
|
$ZodReadonly.init(inst, def);
|
|
6450
7517
|
ZodType.init(inst, def);
|
|
7518
|
+
inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
|
|
7519
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
6451
7520
|
});
|
|
6452
7521
|
ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
|
|
6453
7522
|
$ZodCustom.init(inst, def);
|
|
6454
7523
|
ZodType.init(inst, def);
|
|
7524
|
+
inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
|
|
6455
7525
|
});
|
|
6456
7526
|
});
|
|
6457
7527
|
|
|
6458
7528
|
// node_modules/zod/v4/classic/compat.js
|
|
6459
|
-
var
|
|
7529
|
+
var ZodFirstPartyTypeKind;
|
|
7530
|
+
var init_compat = __esm(() => {
|
|
7531
|
+
(function(ZodFirstPartyTypeKind2) {})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
|
|
7532
|
+
});
|
|
6460
7533
|
|
|
6461
7534
|
// node_modules/zod/v4/classic/coerce.js
|
|
6462
7535
|
var init_coerce2 = () => {};
|
|
@@ -8438,12 +9511,12 @@ var require_code = __commonJS((exports) => {
|
|
|
8438
9511
|
return item === "" || item === '""';
|
|
8439
9512
|
}
|
|
8440
9513
|
get str() {
|
|
8441
|
-
var
|
|
8442
|
-
return (
|
|
9514
|
+
var _a2;
|
|
9515
|
+
return (_a2 = this._str) !== null && _a2 !== undefined ? _a2 : this._str = this._items.reduce((s, c) => `${s}${c}`, "");
|
|
8443
9516
|
}
|
|
8444
9517
|
get names() {
|
|
8445
|
-
var
|
|
8446
|
-
return (
|
|
9518
|
+
var _a2;
|
|
9519
|
+
return (_a2 = this._names) !== null && _a2 !== undefined ? _a2 : this._names = this._items.reduce((names, c) => {
|
|
8447
9520
|
if (c instanceof Name)
|
|
8448
9521
|
names[c.str] = (names[c.str] || 0) + 1;
|
|
8449
9522
|
return names;
|
|
@@ -8588,8 +9661,8 @@ var require_scope = __commonJS((exports) => {
|
|
|
8588
9661
|
return `${prefix}${ng.index++}`;
|
|
8589
9662
|
}
|
|
8590
9663
|
_nameGroup(prefix) {
|
|
8591
|
-
var
|
|
8592
|
-
if (((_b = (
|
|
9664
|
+
var _a2, _b;
|
|
9665
|
+
if (((_b = (_a2 = this._parent) === null || _a2 === undefined ? undefined : _a2._prefixes) === null || _b === undefined ? undefined : _b.has(prefix)) || this._prefixes && !this._prefixes.has(prefix)) {
|
|
8593
9666
|
throw new Error(`CodeGen: prefix "${prefix}" is not allowed in this scope`);
|
|
8594
9667
|
}
|
|
8595
9668
|
return this._names[prefix] = { prefix, index: 0 };
|
|
@@ -8624,12 +9697,12 @@ var require_scope = __commonJS((exports) => {
|
|
|
8624
9697
|
return new ValueScopeName(prefix, this._newName(prefix));
|
|
8625
9698
|
}
|
|
8626
9699
|
value(nameOrPrefix, value) {
|
|
8627
|
-
var
|
|
9700
|
+
var _a2;
|
|
8628
9701
|
if (value.ref === undefined)
|
|
8629
9702
|
throw new Error("CodeGen: ref must be passed in value");
|
|
8630
9703
|
const name = this.toName(nameOrPrefix);
|
|
8631
9704
|
const { prefix } = name;
|
|
8632
|
-
const valueKey = (
|
|
9705
|
+
const valueKey = (_a2 = value.key) !== null && _a2 !== undefined ? _a2 : value.ref;
|
|
8633
9706
|
let vs = this._values[prefix];
|
|
8634
9707
|
if (vs) {
|
|
8635
9708
|
const _name = vs.get(valueKey);
|
|
@@ -8957,8 +10030,8 @@ var require_codegen = __commonJS((exports) => {
|
|
|
8957
10030
|
return this;
|
|
8958
10031
|
}
|
|
8959
10032
|
optimizeNames(names, constants) {
|
|
8960
|
-
var
|
|
8961
|
-
this.else = (
|
|
10033
|
+
var _a2;
|
|
10034
|
+
this.else = (_a2 = this.else) === null || _a2 === undefined ? undefined : _a2.optimizeNames(names, constants);
|
|
8962
10035
|
if (!(super.optimizeNames(names, constants) || this.else))
|
|
8963
10036
|
return;
|
|
8964
10037
|
this.condition = optimizeExpr(this.condition, names, constants);
|
|
@@ -9069,16 +10142,16 @@ var require_codegen = __commonJS((exports) => {
|
|
|
9069
10142
|
return code;
|
|
9070
10143
|
}
|
|
9071
10144
|
optimizeNodes() {
|
|
9072
|
-
var
|
|
10145
|
+
var _a2, _b;
|
|
9073
10146
|
super.optimizeNodes();
|
|
9074
|
-
(
|
|
10147
|
+
(_a2 = this.catch) === null || _a2 === undefined || _a2.optimizeNodes();
|
|
9075
10148
|
(_b = this.finally) === null || _b === undefined || _b.optimizeNodes();
|
|
9076
10149
|
return this;
|
|
9077
10150
|
}
|
|
9078
10151
|
optimizeNames(names, constants) {
|
|
9079
|
-
var
|
|
10152
|
+
var _a2, _b;
|
|
9080
10153
|
super.optimizeNames(names, constants);
|
|
9081
|
-
(
|
|
10154
|
+
(_a2 = this.catch) === null || _a2 === undefined || _a2.optimizeNames(names, constants);
|
|
9082
10155
|
(_b = this.finally) === null || _b === undefined || _b.optimizeNames(names, constants);
|
|
9083
10156
|
return this;
|
|
9084
10157
|
}
|
|
@@ -9801,8 +10874,8 @@ var require_applicability = __commonJS((exports) => {
|
|
|
9801
10874
|
}
|
|
9802
10875
|
exports.shouldUseGroup = shouldUseGroup;
|
|
9803
10876
|
function shouldUseRule(schema, rule) {
|
|
9804
|
-
var
|
|
9805
|
-
return schema[rule.keyword] !== undefined || ((
|
|
10877
|
+
var _a2;
|
|
10878
|
+
return schema[rule.keyword] !== undefined || ((_a2 = rule.definition.implements) === null || _a2 === undefined ? undefined : _a2.some((kwd) => schema[kwd] !== undefined));
|
|
9806
10879
|
}
|
|
9807
10880
|
exports.shouldUseRule = shouldUseRule;
|
|
9808
10881
|
});
|
|
@@ -10177,14 +11250,14 @@ var require_keyword = __commonJS((exports) => {
|
|
|
10177
11250
|
}
|
|
10178
11251
|
exports.macroKeywordCode = macroKeywordCode;
|
|
10179
11252
|
function funcKeywordCode(cxt, def) {
|
|
10180
|
-
var
|
|
11253
|
+
var _a2;
|
|
10181
11254
|
const { gen, keyword, schema, parentSchema, $data, it } = cxt;
|
|
10182
11255
|
checkAsyncKeyword(it, def);
|
|
10183
11256
|
const validate = !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate;
|
|
10184
11257
|
const validateRef = useKeyword(gen, keyword, validate);
|
|
10185
11258
|
const valid = gen.let("valid");
|
|
10186
11259
|
cxt.block$data(valid, validateKeyword);
|
|
10187
|
-
cxt.ok((
|
|
11260
|
+
cxt.ok((_a2 = def.valid) !== null && _a2 !== undefined ? _a2 : valid);
|
|
10188
11261
|
function validateKeyword() {
|
|
10189
11262
|
if (def.errors === false) {
|
|
10190
11263
|
assignValid();
|
|
@@ -10215,8 +11288,8 @@ var require_keyword = __commonJS((exports) => {
|
|
|
10215
11288
|
gen.assign(valid, (0, codegen_1._)`${_await}${(0, code_1.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def.modifying);
|
|
10216
11289
|
}
|
|
10217
11290
|
function reportErrs(errors3) {
|
|
10218
|
-
var
|
|
10219
|
-
gen.if((0, codegen_1.not)((
|
|
11291
|
+
var _a3;
|
|
11292
|
+
gen.if((0, codegen_1.not)((_a3 = def.valid) !== null && _a3 !== undefined ? _a3 : valid), errors3);
|
|
10220
11293
|
}
|
|
10221
11294
|
}
|
|
10222
11295
|
exports.funcKeywordCode = funcKeywordCode;
|
|
@@ -11171,7 +12244,7 @@ var require_compile = __commonJS((exports) => {
|
|
|
11171
12244
|
|
|
11172
12245
|
class SchemaEnv {
|
|
11173
12246
|
constructor(env) {
|
|
11174
|
-
var
|
|
12247
|
+
var _a2;
|
|
11175
12248
|
this.refs = {};
|
|
11176
12249
|
this.dynamicAnchors = {};
|
|
11177
12250
|
let schema;
|
|
@@ -11180,7 +12253,7 @@ var require_compile = __commonJS((exports) => {
|
|
|
11180
12253
|
this.schema = env.schema;
|
|
11181
12254
|
this.schemaId = env.schemaId;
|
|
11182
12255
|
this.root = env.root || this;
|
|
11183
|
-
this.baseId = (
|
|
12256
|
+
this.baseId = (_a2 = env.baseId) !== null && _a2 !== undefined ? _a2 : (0, resolve_1.normalizeId)(schema === null || schema === undefined ? undefined : schema[env.schemaId || "$id"]);
|
|
11184
12257
|
this.schemaPath = env.schemaPath;
|
|
11185
12258
|
this.localRefs = env.localRefs;
|
|
11186
12259
|
this.meta = env.meta;
|
|
@@ -11275,14 +12348,14 @@ var require_compile = __commonJS((exports) => {
|
|
|
11275
12348
|
}
|
|
11276
12349
|
exports.compileSchema = compileSchema;
|
|
11277
12350
|
function resolveRef(root, baseId, ref) {
|
|
11278
|
-
var
|
|
12351
|
+
var _a2;
|
|
11279
12352
|
ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref);
|
|
11280
12353
|
const schOrFunc = root.refs[ref];
|
|
11281
12354
|
if (schOrFunc)
|
|
11282
12355
|
return schOrFunc;
|
|
11283
12356
|
let _sch = resolve2.call(this, root, ref);
|
|
11284
12357
|
if (_sch === undefined) {
|
|
11285
|
-
const schema = (
|
|
12358
|
+
const schema = (_a2 = root.localRefs) === null || _a2 === undefined ? undefined : _a2[ref];
|
|
11286
12359
|
const { schemaId } = this.opts;
|
|
11287
12360
|
if (schema)
|
|
11288
12361
|
_sch = new SchemaEnv({ schema, schemaId, root, baseId });
|
|
@@ -11351,8 +12424,8 @@ var require_compile = __commonJS((exports) => {
|
|
|
11351
12424
|
"definitions"
|
|
11352
12425
|
]);
|
|
11353
12426
|
function getJsonPointer(parsedRef, { baseId, schema, root }) {
|
|
11354
|
-
var
|
|
11355
|
-
if (((
|
|
12427
|
+
var _a2;
|
|
12428
|
+
if (((_a2 = parsedRef.fragment) === null || _a2 === undefined ? undefined : _a2[0]) !== "/")
|
|
11356
12429
|
return;
|
|
11357
12430
|
for (const part of parsedRef.fragment.slice(1).split("/")) {
|
|
11358
12431
|
if (typeof schema === "boolean")
|
|
@@ -12163,9 +13236,9 @@ var require_core = __commonJS((exports) => {
|
|
|
12163
13236
|
};
|
|
12164
13237
|
var MAX_EXPRESSION = 200;
|
|
12165
13238
|
function requiredOptions(o) {
|
|
12166
|
-
var
|
|
13239
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
12167
13240
|
const s = o.strict;
|
|
12168
|
-
const _optz = (
|
|
13241
|
+
const _optz = (_a2 = o.code) === null || _a2 === undefined ? undefined : _a2.optimize;
|
|
12169
13242
|
const optimize = _optz === true || _optz === undefined ? 1 : _optz || 0;
|
|
12170
13243
|
const regExp = (_c = (_b = o.code) === null || _b === undefined ? undefined : _b.regExp) !== null && _c !== undefined ? _c : defaultRegExp;
|
|
12171
13244
|
const uriResolver = (_d = o.uriResolver) !== null && _d !== undefined ? _d : uri_1.default;
|
|
@@ -12224,19 +13297,19 @@ var require_core = __commonJS((exports) => {
|
|
|
12224
13297
|
this.addKeyword("$async");
|
|
12225
13298
|
}
|
|
12226
13299
|
_addDefaultMetaSchema() {
|
|
12227
|
-
const { $data, meta, schemaId } = this.opts;
|
|
13300
|
+
const { $data, meta: meta2, schemaId } = this.opts;
|
|
12228
13301
|
let _dataRefSchema = $dataRefSchema;
|
|
12229
13302
|
if (schemaId === "id") {
|
|
12230
13303
|
_dataRefSchema = { ...$dataRefSchema };
|
|
12231
13304
|
_dataRefSchema.id = _dataRefSchema.$id;
|
|
12232
13305
|
delete _dataRefSchema.$id;
|
|
12233
13306
|
}
|
|
12234
|
-
if (
|
|
13307
|
+
if (meta2 && $data)
|
|
12235
13308
|
this.addMetaSchema(_dataRefSchema, _dataRefSchema[schemaId], false);
|
|
12236
13309
|
}
|
|
12237
13310
|
defaultMeta() {
|
|
12238
|
-
const { meta, schemaId } = this.opts;
|
|
12239
|
-
return this.opts.defaultMeta = typeof
|
|
13311
|
+
const { meta: meta2, schemaId } = this.opts;
|
|
13312
|
+
return this.opts.defaultMeta = typeof meta2 == "object" ? meta2[schemaId] || meta2 : undefined;
|
|
12240
13313
|
}
|
|
12241
13314
|
validate(schemaKeyRef, data) {
|
|
12242
13315
|
let v;
|
|
@@ -12256,12 +13329,12 @@ var require_core = __commonJS((exports) => {
|
|
|
12256
13329
|
const sch = this._addSchema(schema, _meta);
|
|
12257
13330
|
return sch.validate || this._compileSchemaEnv(sch);
|
|
12258
13331
|
}
|
|
12259
|
-
compileAsync(schema,
|
|
13332
|
+
compileAsync(schema, meta2) {
|
|
12260
13333
|
if (typeof this.opts.loadSchema != "function") {
|
|
12261
13334
|
throw new Error("options.loadSchema should be a function");
|
|
12262
13335
|
}
|
|
12263
13336
|
const { loadSchema } = this.opts;
|
|
12264
|
-
return runCompileAsync.call(this, schema,
|
|
13337
|
+
return runCompileAsync.call(this, schema, meta2);
|
|
12265
13338
|
async function runCompileAsync(_schema, _meta) {
|
|
12266
13339
|
await loadMetaSchema.call(this, _schema.$schema);
|
|
12267
13340
|
const sch = this._addSchema(_schema, _meta);
|
|
@@ -12293,7 +13366,7 @@ var require_core = __commonJS((exports) => {
|
|
|
12293
13366
|
if (!this.refs[ref])
|
|
12294
13367
|
await loadMetaSchema.call(this, _schema.$schema);
|
|
12295
13368
|
if (!this.refs[ref])
|
|
12296
|
-
this.addSchema(_schema, ref,
|
|
13369
|
+
this.addSchema(_schema, ref, meta2);
|
|
12297
13370
|
}
|
|
12298
13371
|
async function _loadSchema(ref) {
|
|
12299
13372
|
const p = this._loading[ref];
|
|
@@ -12497,7 +13570,7 @@ var require_core = __commonJS((exports) => {
|
|
|
12497
13570
|
}
|
|
12498
13571
|
}
|
|
12499
13572
|
}
|
|
12500
|
-
_addSchema(schema,
|
|
13573
|
+
_addSchema(schema, meta2, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) {
|
|
12501
13574
|
let id;
|
|
12502
13575
|
const { schemaId } = this.opts;
|
|
12503
13576
|
if (typeof schema == "object") {
|
|
@@ -12513,7 +13586,7 @@ var require_core = __commonJS((exports) => {
|
|
|
12513
13586
|
return sch;
|
|
12514
13587
|
baseId = (0, resolve_1.normalizeId)(id || baseId);
|
|
12515
13588
|
const localRefs = resolve_1.getSchemaRefs.call(this, schema, baseId);
|
|
12516
|
-
sch = new compile_1.SchemaEnv({ schema, schemaId, meta, baseId, localRefs });
|
|
13589
|
+
sch = new compile_1.SchemaEnv({ schema, schemaId, meta: meta2, baseId, localRefs });
|
|
12517
13590
|
this._cache.set(sch.schema, sch);
|
|
12518
13591
|
if (addSchema && !baseId.startsWith("#")) {
|
|
12519
13592
|
if (baseId)
|
|
@@ -12624,7 +13697,7 @@ var require_core = __commonJS((exports) => {
|
|
|
12624
13697
|
}
|
|
12625
13698
|
}
|
|
12626
13699
|
function addRule(keyword, definition, dataType) {
|
|
12627
|
-
var
|
|
13700
|
+
var _a2;
|
|
12628
13701
|
const post = definition === null || definition === undefined ? undefined : definition.post;
|
|
12629
13702
|
if (dataType && post)
|
|
12630
13703
|
throw new Error('keyword with "post" flag cannot have "type"');
|
|
@@ -12650,7 +13723,7 @@ var require_core = __commonJS((exports) => {
|
|
|
12650
13723
|
else
|
|
12651
13724
|
ruleGroup.rules.push(rule);
|
|
12652
13725
|
RULES.all[keyword] = rule;
|
|
12653
|
-
(
|
|
13726
|
+
(_a2 = definition.implements) === null || _a2 === undefined || _a2.forEach((kwd) => this.addKeyword(kwd));
|
|
12654
13727
|
}
|
|
12655
13728
|
function addBeforeRule(ruleGroup, rule, before) {
|
|
12656
13729
|
const i = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before);
|
|
@@ -12778,10 +13851,10 @@ var require_ref = __commonJS((exports) => {
|
|
|
12778
13851
|
gen.assign(names_1.default.errors, (0, codegen_1._)`${names_1.default.vErrors}.length`);
|
|
12779
13852
|
}
|
|
12780
13853
|
function addEvaluatedFrom(source) {
|
|
12781
|
-
var
|
|
13854
|
+
var _a2;
|
|
12782
13855
|
if (!it.opts.unevaluated)
|
|
12783
13856
|
return;
|
|
12784
|
-
const schEvaluated = (
|
|
13857
|
+
const schEvaluated = (_a2 = sch === null || sch === undefined ? undefined : sch.validate) === null || _a2 === undefined ? undefined : _a2.evaluated;
|
|
12785
13858
|
if (it.props !== true) {
|
|
12786
13859
|
if (schEvaluated && !schEvaluated.dynamicProps) {
|
|
12787
13860
|
if (schEvaluated.props !== undefined) {
|
|
@@ -14308,7 +15381,7 @@ var require_discriminator = __commonJS((exports) => {
|
|
|
14308
15381
|
return _valid;
|
|
14309
15382
|
}
|
|
14310
15383
|
function getMapping() {
|
|
14311
|
-
var
|
|
15384
|
+
var _a2;
|
|
14312
15385
|
const oneOfMapping = {};
|
|
14313
15386
|
const topRequired = hasRequired(parentSchema);
|
|
14314
15387
|
let tagRequired = true;
|
|
@@ -14322,7 +15395,7 @@ var require_discriminator = __commonJS((exports) => {
|
|
|
14322
15395
|
if (sch === undefined)
|
|
14323
15396
|
throw new ref_error_1.default(it.opts.uriResolver, it.baseId, ref);
|
|
14324
15397
|
}
|
|
14325
|
-
const propSch = (
|
|
15398
|
+
const propSch = (_a2 = sch === null || sch === undefined ? undefined : sch.properties) === null || _a2 === undefined ? undefined : _a2[tagName];
|
|
14326
15399
|
if (typeof propSch != "object") {
|
|
14327
15400
|
throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${tagName}"`);
|
|
14328
15401
|
}
|
|
@@ -14855,9 +15928,9 @@ var require_dist = __commonJS((exports, module) => {
|
|
|
14855
15928
|
return f;
|
|
14856
15929
|
};
|
|
14857
15930
|
function addFormats(ajv, list, fs12, exportName) {
|
|
14858
|
-
var
|
|
15931
|
+
var _a2;
|
|
14859
15932
|
var _b;
|
|
14860
|
-
(
|
|
15933
|
+
(_a2 = (_b = ajv.opts.code).formats) !== null && _a2 !== undefined || (_b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`);
|
|
14861
15934
|
for (const f of list)
|
|
14862
15935
|
ajv.addFormat(f, fs12[f]);
|
|
14863
15936
|
}
|
|
@@ -15400,10 +16473,10 @@ var init_stdio = __esm(() => {
|
|
|
15400
16473
|
});
|
|
15401
16474
|
|
|
15402
16475
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
15403
|
-
import
|
|
16476
|
+
import process3 from "node:process";
|
|
15404
16477
|
|
|
15405
16478
|
class StdioServerTransport {
|
|
15406
|
-
constructor(_stdin =
|
|
16479
|
+
constructor(_stdin = process3.stdin, _stdout = process3.stdout) {
|
|
15407
16480
|
this._stdin = _stdin;
|
|
15408
16481
|
this._stdout = _stdout;
|
|
15409
16482
|
this._readBuffer = new ReadBuffer;
|
|
@@ -16039,7 +17112,7 @@ var init_server3 = __esm(() => {
|
|
|
16039
17112
|
source: process.env.VERBAL_SOURCE ?? "mcp",
|
|
16040
17113
|
batchSize: Number(process.env.VERBAL_BATCH_SIZE ?? "50"),
|
|
16041
17114
|
flushIntervalMs: Number(process.env.VERBAL_FLUSH_INTERVAL_MS ?? "5000"),
|
|
16042
|
-
httpTimeoutMs: Number(process.env.VERBAL_HTTP_TIMEOUT_MS ?? "
|
|
17115
|
+
httpTimeoutMs: Number(process.env.VERBAL_HTTP_TIMEOUT_MS ?? "15000"),
|
|
16043
17116
|
gitContextEnabled: process.env.VERBAL_GIT_CONTEXT_ENABLED !== "false",
|
|
16044
17117
|
costCalcEnabled: process.env.VERBAL_COST_CALC_ENABLED !== "false",
|
|
16045
17118
|
maxRetries: Number(process.env.VERBAL_MAX_RETRIES ?? "3"),
|
|
@@ -18132,7 +19205,7 @@ __export(exports_hooks, {
|
|
|
18132
19205
|
});
|
|
18133
19206
|
async function runHooks(args) {
|
|
18134
19207
|
const { main: hooksMain } = await Promise.resolve().then(() => (init_cli(), exports_cli));
|
|
18135
|
-
await hooksMain(args);
|
|
19208
|
+
await hooksMain(["node", "hooks", ...args]);
|
|
18136
19209
|
}
|
|
18137
19210
|
|
|
18138
19211
|
// src/update-check/notify.ts
|