@fdcn/sourcefed 0.3.7 → 0.4.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/README.md +36 -1
- package/dist/{chunk-E6J3BAXP.js → chunk-L4SMC2NT.js} +1165 -251
- package/dist/cli.js +12578 -8814
- package/dist/daemon.js +1025 -107
- package/dist/data/core/SKILL.md +9 -4
- package/dist/data/core/references/commands.md +6 -1
- package/dist/data/sourcefed/SKILL.md +3 -2
- package/dist/guidance.md +6 -2
- package/dist/mcp.js +2286 -1106
- package/dist/opencode.js +6 -2
- package/dist/pi.js +161 -39
- package/dist/tui-compiled.mjs +306 -166
- package/dist.dts/adapters/opencode/bridge.d.ts +1 -1
- package/dist.dts/adapters/opencode/subscriptions.d.ts +2 -2
- package/dist.dts/adapters/opencode/tools/monitor_create.d.ts +16 -0
- package/dist.dts/adapters/opencode/tui/sidebar.d.ts +1 -1
- package/dist.dts/adapters/pi/src/dialog.d.ts +1 -2
- package/dist.dts/adapters/pi/src/monitors-dialog.d.ts +32 -0
- package/dist.dts/adapters/pi/src/monitors-dialog.test.d.ts +1 -0
- package/dist.dts/packages/cli/src/commands/monitor/index.d.ts +1 -1
- package/dist.dts/packages/cli/src/utils/daemon.d.ts +1 -1
- package/dist.dts/packages/cli/src/utils/format.d.ts +1 -1
- package/dist.dts/packages/cli/src/utils/webhooks.d.ts +1 -1
- package/dist.dts/packages/core/src/events.d.ts +2 -2
- package/dist.dts/packages/core/src/index.d.ts +4 -4
- package/dist.dts/packages/core/src/monitors/index.d.ts +3 -3
- package/dist.dts/packages/core/src/monitors/monitor.d.ts +6 -6
- package/dist.dts/packages/core/src/monitors/poll/monitor.d.ts +5 -5
- package/dist.dts/packages/core/src/monitors/poll/types/poll-monitor-options.d.ts +1 -1
- package/dist.dts/packages/core/src/monitors/poll/types/poll-runner.d.ts +2 -2
- package/dist.dts/packages/core/src/monitors/poll/utils/event-delivery-id.d.ts +1 -1
- package/dist.dts/packages/core/src/monitors/poll/utils/tick.d.ts +1 -1
- package/dist.dts/packages/core/src/monitors/service.d.ts +3 -3
- package/dist.dts/packages/core/src/monitors/utils/monitor-identity.d.ts +3 -3
- package/dist.dts/packages/core/src/monitors/webhook/monitor.d.ts +5 -5
- package/dist.dts/packages/core/src/monitors/webhook/types/pending-webhook-event.d.ts +1 -1
- package/dist.dts/packages/core/src/monitors/webhook/types/webhook-monitor-options.d.ts +1 -1
- package/dist.dts/packages/core/src/monitors/webhook/utils/deliver-webhook.d.ts +2 -2
- package/dist.dts/packages/core/src/monitors/webhook/utils/handle-webhook.d.ts +1 -1
- package/dist.dts/packages/core/src/monitors/webhook/utils/heartbeat-webhooks.d.ts +2 -2
- package/dist.dts/packages/core/src/runtime.d.ts +3 -3
- package/dist.dts/packages/core/src/sources/index.d.ts +1 -1
- package/dist.dts/packages/core/src/sources/types/source-registry.d.ts +1 -1
- package/dist.dts/packages/core/src/storage/json.d.ts +2 -2
- package/dist.dts/packages/core/src/types/monitor-context.d.ts +2 -2
- package/dist.dts/packages/core/src/types/monitor-create-input.d.ts +4 -0
- package/dist.dts/packages/core/src/types/monitor-options.d.ts +1 -1
- package/dist.dts/packages/core/src/utils/event-to-text.d.ts +1 -1
- package/dist.dts/packages/core/src/utils/to-monitor-event.d.ts +2 -2
- package/dist.dts/packages/daemon/src/client.d.ts +1 -1
- package/dist.dts/packages/daemon/src/daemon.d.ts +3 -3
- package/dist.dts/packages/daemon/src/event-stream.d.ts +1 -1
- package/dist.dts/packages/daemon/src/event-transport.d.ts +4 -0
- package/dist.dts/packages/daemon/src/event-transport.test.d.ts +1 -0
- package/dist.dts/packages/daemon/src/fetch-isolation.test.d.ts +1 -0
- package/dist.dts/packages/daemon/src/index.d.ts +3 -3
- package/dist.dts/packages/daemon/src/registry.d.ts +6 -4
- package/dist.dts/packages/daemon/src/types/client.d.ts +1 -1
- package/dist.dts/packages/daemon/src/types/daemon.d.ts +5 -1
- package/dist.dts/packages/daemon/src/types/protocol.d.ts +1 -1
- package/dist.dts/packages/daemon/src/utils/sink.d.ts +2 -2
- package/dist.dts/packages/daemon/src/utils/target.d.ts +1 -1
- package/dist.dts/packages/mcp/src/server.d.ts +1 -1
- package/dist.dts/packages/mcp/src/uris.d.ts +2 -2
- package/dist.dts/providers/github/src/index.d.ts +1 -1
- package/dist.dts/providers/github/src/monitor.d.ts +6 -6
- package/dist.dts/providers/github/src/poll/index.d.ts +1 -1
- package/dist.dts/providers/github/src/poll/monitor.d.ts +2 -2
- package/dist.dts/providers/github/src/poll/utils/append-comments.d.ts +1 -1
- package/dist.dts/providers/github/src/poll/utils/append-github-ci-event.d.ts +1 -1
- package/dist.dts/providers/github/src/poll/utils/append-github-conflict-event.d.ts +1 -1
- package/dist.dts/providers/github/src/poll/utils/append-github-reviews.d.ts +1 -1
- package/dist.dts/providers/github/src/poll/utils/append-github-state-event.d.ts +1 -1
- package/dist.dts/providers/github/src/poll/utils/empty-cursor.d.ts +1 -1
- package/dist.dts/providers/github/src/poll/utils/poll-github.d.ts +1 -1
- package/dist.dts/providers/github/src/webhook/index.d.ts +2 -2
- package/dist.dts/providers/github/src/webhook/monitor.d.ts +2 -2
- package/dist.dts/providers/github/src/webhook/utils/github-event-handlers.d.ts +1 -1
- package/dist.dts/providers/github/src/webhook/utils/parse-github-webhook.d.ts +1 -1
- package/dist.dts/providers/github/src/webhook/utils/update-github-cursor.d.ts +2 -2
- package/dist.dts/providers/jira/src/index.d.ts +1 -1
- package/dist.dts/providers/jira/src/monitor.d.ts +5 -5
- package/dist.dts/providers/jira/src/poll/index.d.ts +1 -1
- package/dist.dts/providers/jira/src/poll/monitor.d.ts +2 -2
- package/dist.dts/providers/jira/src/poll/utils/append-jira-changelog.d.ts +1 -1
- package/dist.dts/providers/jira/src/poll/utils/append-jira-comments.d.ts +1 -1
- package/dist.dts/providers/jira/src/poll/utils/append-jira-description.d.ts +1 -1
- package/dist.dts/providers/jira/src/poll/utils/empty-cursor.d.ts +1 -1
- package/dist.dts/providers/jira/src/poll/utils/jira-changelog-event.d.ts +1 -1
- package/dist.dts/providers/jira/src/poll/utils/poll-jira.d.ts +1 -1
- package/dist.dts/providers/slack/src/index.d.ts +1 -1
- package/dist.dts/providers/slack/src/monitor.d.ts +6 -6
- package/dist.dts/providers/slack/src/poll/index.d.ts +1 -1
- package/dist.dts/providers/slack/src/poll/monitor.d.ts +2 -2
- package/dist.dts/providers/slack/src/poll/utils/parse-slack-read-result.d.ts +1 -1
- package/dist.dts/providers/slack/src/poll/utils/poll-slack.d.ts +1 -1
- package/dist.dts/providers/slack/src/webhook/index.d.ts +1 -1
- package/dist.dts/providers/slack/src/webhook/monitor.d.ts +2 -2
- package/dist.dts/providers/slack/src/webhook/utils/parse-slack-webhook.d.ts +1 -1
- package/dist.dts/providers/slack/src/webhook/utils/update-slack-cursor.d.ts +2 -2
- package/dist.dts/providers/yab/src/index.d.ts +2 -0
- package/dist.dts/providers/yab/src/monitor.d.ts +14 -0
- package/dist.dts/providers/yab/src/poll/index.d.ts +2 -0
- package/dist.dts/providers/yab/src/poll/monitor.d.ts +3 -0
- package/dist.dts/providers/yab/src/poll/utils/feed-events.d.ts +5 -0
- package/dist.dts/providers/yab/src/poll/utils/index.d.ts +4 -0
- package/dist.dts/providers/yab/src/poll/utils/parse-feed.d.ts +3 -0
- package/dist.dts/providers/yab/src/poll/utils/poll-yab.d.ts +7 -0
- package/dist.dts/providers/yab/src/poll/utils/yab-mcp.d.ts +10 -0
- package/dist.dts/providers/yab/src/schema.d.ts +12 -0
- package/dist.dts/providers/yab/src/types/cursor.d.ts +4 -0
- package/dist.dts/providers/yab/src/types/event.d.ts +8 -0
- package/dist.dts/providers/yab/src/types/feed-entry.d.ts +8 -0
- package/dist.dts/providers/yab/src/types/index.d.ts +5 -0
- package/dist.dts/providers/yab/src/types/page.d.ts +6 -0
- package/dist.dts/providers/yab/src/types/source-record.d.ts +7 -0
- package/dist.dts/providers/yab/src/yab.test.d.ts +1 -0
- package/package.json +27 -9
package/dist/mcp.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
decodeTarget,
|
|
3
3
|
encodeTarget
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-L4SMC2NT.js";
|
|
5
5
|
import {
|
|
6
6
|
__export
|
|
7
7
|
} from "./chunk-MLKGABMK.js";
|
|
@@ -9,84 +9,11 @@ import {
|
|
|
9
9
|
// packages/mcp/src/server.ts
|
|
10
10
|
import { createMcpHandler, McpServer, ResourceTemplate } from "@modelcontextprotocol/server";
|
|
11
11
|
|
|
12
|
-
// node_modules/zod/v4/core/core.js
|
|
13
|
-
var _a;
|
|
14
|
-
// @__NO_SIDE_EFFECTS__
|
|
15
|
-
function $constructor(name, initializer3, params) {
|
|
16
|
-
function init(inst, def) {
|
|
17
|
-
if (!inst._zod) {
|
|
18
|
-
Object.defineProperty(inst, "_zod", {
|
|
19
|
-
value: {
|
|
20
|
-
def,
|
|
21
|
-
constr: _,
|
|
22
|
-
traits: /* @__PURE__ */ new Set()
|
|
23
|
-
},
|
|
24
|
-
enumerable: false
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
if (inst._zod.traits.has(name)) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
inst._zod.traits.add(name);
|
|
31
|
-
initializer3(inst, def);
|
|
32
|
-
const proto = _.prototype;
|
|
33
|
-
const keys = Object.keys(proto);
|
|
34
|
-
for (let i = 0; i < keys.length; i++) {
|
|
35
|
-
const k = keys[i];
|
|
36
|
-
if (!(k in inst)) {
|
|
37
|
-
inst[k] = proto[k].bind(inst);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
const Parent = params?.Parent ?? Object;
|
|
42
|
-
class Definition extends Parent {
|
|
43
|
-
}
|
|
44
|
-
Object.defineProperty(Definition, "name", { value: name });
|
|
45
|
-
function _(def) {
|
|
46
|
-
var _a3;
|
|
47
|
-
const inst = params?.Parent ? new Definition() : this;
|
|
48
|
-
init(inst, def);
|
|
49
|
-
(_a3 = inst._zod).deferred ?? (_a3.deferred = []);
|
|
50
|
-
for (const fn of inst._zod.deferred) {
|
|
51
|
-
fn();
|
|
52
|
-
}
|
|
53
|
-
return inst;
|
|
54
|
-
}
|
|
55
|
-
Object.defineProperty(_, "init", { value: init });
|
|
56
|
-
Object.defineProperty(_, Symbol.hasInstance, {
|
|
57
|
-
value: (inst) => {
|
|
58
|
-
if (params?.Parent && inst instanceof params.Parent)
|
|
59
|
-
return true;
|
|
60
|
-
return inst?._zod?.traits?.has(name);
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
Object.defineProperty(_, "name", { value: name });
|
|
64
|
-
return _;
|
|
65
|
-
}
|
|
66
|
-
var $brand = Symbol("zod_brand");
|
|
67
|
-
var $ZodAsyncError = class extends Error {
|
|
68
|
-
constructor() {
|
|
69
|
-
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
var $ZodEncodeError = class extends Error {
|
|
73
|
-
constructor(name) {
|
|
74
|
-
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
75
|
-
this.name = "ZodEncodeError";
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
(_a = globalThis).__zod_globalConfig ?? (_a.__zod_globalConfig = {});
|
|
79
|
-
var globalConfig = globalThis.__zod_globalConfig;
|
|
80
|
-
function config(newConfig) {
|
|
81
|
-
if (newConfig)
|
|
82
|
-
Object.assign(globalConfig, newConfig);
|
|
83
|
-
return globalConfig;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
12
|
// node_modules/zod/v4/core/util.js
|
|
87
13
|
var util_exports = {};
|
|
88
14
|
__export(util_exports, {
|
|
89
15
|
BIGINT_FORMAT_RANGES: () => BIGINT_FORMAT_RANGES,
|
|
16
|
+
CONSTANT_CATCH: () => CONSTANT_CATCH,
|
|
90
17
|
Class: () => Class,
|
|
91
18
|
NUMBER_FORMAT_RANGES: () => NUMBER_FORMAT_RANGES,
|
|
92
19
|
aborted: () => aborted,
|
|
@@ -97,6 +24,7 @@ __export(util_exports, {
|
|
|
97
24
|
assertNever: () => assertNever,
|
|
98
25
|
assertNotEqual: () => assertNotEqual,
|
|
99
26
|
assignProp: () => assignProp,
|
|
27
|
+
attachSchema: () => attachSchema,
|
|
100
28
|
base64ToUint8Array: () => base64ToUint8Array,
|
|
101
29
|
base64urlToUint8Array: () => base64urlToUint8Array,
|
|
102
30
|
cached: () => cached,
|
|
@@ -105,8 +33,12 @@ __export(util_exports, {
|
|
|
105
33
|
cleanRegex: () => cleanRegex,
|
|
106
34
|
clone: () => clone,
|
|
107
35
|
cloneDef: () => cloneDef,
|
|
36
|
+
codePointLength: () => codePointLength,
|
|
37
|
+
constantCatch: () => constantCatch,
|
|
108
38
|
createTransparentProxy: () => createTransparentProxy,
|
|
109
39
|
defineLazy: () => defineLazy,
|
|
40
|
+
defineLazyInternal: () => defineLazyInternal,
|
|
41
|
+
derived: () => derived,
|
|
110
42
|
esc: () => esc,
|
|
111
43
|
escapeRegex: () => escapeRegex,
|
|
112
44
|
explicitlyAborted: () => explicitlyAborted,
|
|
@@ -119,11 +51,14 @@ __export(util_exports, {
|
|
|
119
51
|
getParsedType: () => getParsedType,
|
|
120
52
|
getSizableOrigin: () => getSizableOrigin,
|
|
121
53
|
hexToUint8Array: () => hexToUint8Array,
|
|
54
|
+
hide: () => hide,
|
|
55
|
+
installLazyProp: () => installLazyProp,
|
|
122
56
|
isObject: () => isObject,
|
|
123
57
|
isPlainObject: () => isPlainObject,
|
|
124
58
|
issue: () => issue,
|
|
125
59
|
joinValues: () => joinValues,
|
|
126
60
|
jsonStringifyReplacer: () => jsonStringifyReplacer,
|
|
61
|
+
members: () => members,
|
|
127
62
|
merge: () => merge,
|
|
128
63
|
mergeDefs: () => mergeDefs,
|
|
129
64
|
normalizeParams: () => normalizeParams,
|
|
@@ -132,6 +67,7 @@ __export(util_exports, {
|
|
|
132
67
|
objectClone: () => objectClone,
|
|
133
68
|
omit: () => omit,
|
|
134
69
|
optionalKeys: () => optionalKeys,
|
|
70
|
+
own: () => own,
|
|
135
71
|
parsedType: () => parsedType,
|
|
136
72
|
partial: () => partial,
|
|
137
73
|
pick: () => pick,
|
|
@@ -140,11 +76,14 @@ __export(util_exports, {
|
|
|
140
76
|
promiseAllObject: () => promiseAllObject,
|
|
141
77
|
propertyKeyTypes: () => propertyKeyTypes,
|
|
142
78
|
randomString: () => randomString,
|
|
79
|
+
rawShape: () => rawShape,
|
|
143
80
|
required: () => required,
|
|
144
81
|
safeExtend: () => safeExtend,
|
|
145
82
|
shallowClone: () => shallowClone,
|
|
83
|
+
sizeCaps: () => sizeCaps,
|
|
146
84
|
slugify: () => slugify,
|
|
147
85
|
stringifyPrimitive: () => stringifyPrimitive,
|
|
86
|
+
toZod: () => toZod,
|
|
148
87
|
uint8ArrayToBase64: () => uint8ArrayToBase64,
|
|
149
88
|
uint8ArrayToBase64url: () => uint8ArrayToBase64url,
|
|
150
89
|
uint8ArrayToHex: () => uint8ArrayToHex,
|
|
@@ -156,6 +95,9 @@ function assertEqual(val) {
|
|
|
156
95
|
function assertNotEqual(val) {
|
|
157
96
|
return val;
|
|
158
97
|
}
|
|
98
|
+
function toZod() {
|
|
99
|
+
return (schema) => schema;
|
|
100
|
+
}
|
|
159
101
|
function assertIs(_arg) {
|
|
160
102
|
}
|
|
161
103
|
function assertNever(_x) {
|
|
@@ -176,18 +118,22 @@ function jsonStringifyReplacer(_, value) {
|
|
|
176
118
|
return value.toString();
|
|
177
119
|
return value;
|
|
178
120
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
121
|
+
var Cached = class {
|
|
122
|
+
constructor(getter) {
|
|
123
|
+
this._getter = getter;
|
|
124
|
+
this._value = void 0;
|
|
125
|
+
}
|
|
126
|
+
get value() {
|
|
127
|
+
const getter = this._getter;
|
|
128
|
+
if (getter !== void 0) {
|
|
129
|
+
this._value = getter();
|
|
130
|
+
this._getter = void 0;
|
|
189
131
|
}
|
|
190
|
-
|
|
132
|
+
return this._value;
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
function cached(getter) {
|
|
136
|
+
return new Cached(getter);
|
|
191
137
|
}
|
|
192
138
|
function nullish(input) {
|
|
193
139
|
return input === null || input === void 0;
|
|
@@ -200,7 +146,7 @@ function cleanRegex(source) {
|
|
|
200
146
|
function floatSafeRemainder(val, step) {
|
|
201
147
|
const ratio = val / step;
|
|
202
148
|
const roundedRatio = Math.round(ratio);
|
|
203
|
-
const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1);
|
|
149
|
+
const tolerance = 4 * Number.EPSILON * Math.max(Math.abs(ratio), 1);
|
|
204
150
|
if (Math.abs(ratio - roundedRatio) < tolerance)
|
|
205
151
|
return 0;
|
|
206
152
|
return ratio - roundedRatio;
|
|
@@ -239,6 +185,56 @@ function assignProp(target, prop, value) {
|
|
|
239
185
|
configurable: true
|
|
240
186
|
});
|
|
241
187
|
}
|
|
188
|
+
function rawShape(def) {
|
|
189
|
+
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
190
|
+
return desc?.get ? desc.get.raw : desc?.value;
|
|
191
|
+
}
|
|
192
|
+
function sourceShape(schema) {
|
|
193
|
+
return rawShape(schema._zod.def) ?? schema._zod.def.shape;
|
|
194
|
+
}
|
|
195
|
+
function deferProp(target, key, getter) {
|
|
196
|
+
Object.defineProperty(target, key, {
|
|
197
|
+
get() {
|
|
198
|
+
const value = getter();
|
|
199
|
+
assignProp(this, key, value);
|
|
200
|
+
return value;
|
|
201
|
+
},
|
|
202
|
+
enumerable: true,
|
|
203
|
+
configurable: true
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
function putProp(target, key, value) {
|
|
207
|
+
if (key in target)
|
|
208
|
+
assignProp(target, key, value);
|
|
209
|
+
else
|
|
210
|
+
target[key] = value;
|
|
211
|
+
}
|
|
212
|
+
function mirrorShape(target, source, keys, wrap) {
|
|
213
|
+
const raw = sourceShape(source);
|
|
214
|
+
for (const key of keys) {
|
|
215
|
+
const desc = Object.getOwnPropertyDescriptor(raw, key);
|
|
216
|
+
if (!desc.enumerable)
|
|
217
|
+
continue;
|
|
218
|
+
if (desc.get) {
|
|
219
|
+
deferProp(target, key, () => {
|
|
220
|
+
const value = source._zod.def.shape[key];
|
|
221
|
+
return wrap ? wrap(value, key) : value;
|
|
222
|
+
});
|
|
223
|
+
} else
|
|
224
|
+
putProp(target, key, wrap ? wrap(desc.value, key) : desc.value);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
function mirrorProps(target, source) {
|
|
228
|
+
for (const key of Reflect.ownKeys(source)) {
|
|
229
|
+
const desc = Object.getOwnPropertyDescriptor(source, key);
|
|
230
|
+
if (!desc.enumerable)
|
|
231
|
+
continue;
|
|
232
|
+
if (desc.get)
|
|
233
|
+
deferProp(target, key, () => source[key]);
|
|
234
|
+
else
|
|
235
|
+
putProp(target, key, desc.value);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
242
238
|
function mergeDefs(...defs) {
|
|
243
239
|
const mergedDescriptors = {};
|
|
244
240
|
for (const def of defs) {
|
|
@@ -456,16 +452,16 @@ function stringifyPrimitive(value) {
|
|
|
456
452
|
}
|
|
457
453
|
function optionalKeys(shape) {
|
|
458
454
|
return Object.keys(shape).filter((k) => {
|
|
459
|
-
return shape[k]._zod.optin
|
|
455
|
+
return shape[k]._zod.optin !== void 0 && shape[k]._zod.optout === "optional";
|
|
460
456
|
});
|
|
461
457
|
}
|
|
462
|
-
var NUMBER_FORMAT_RANGES = {
|
|
458
|
+
var NUMBER_FORMAT_RANGES = /* @__PURE__ */ (() => ({
|
|
463
459
|
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
464
460
|
int32: [-2147483648, 2147483647],
|
|
465
461
|
uint32: [0, 4294967295],
|
|
466
462
|
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
467
463
|
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
468
|
-
};
|
|
464
|
+
}))();
|
|
469
465
|
var BIGINT_FORMAT_RANGES = {
|
|
470
466
|
int64: [/* @__PURE__ */ BigInt("-9223372036854775808"), /* @__PURE__ */ BigInt("9223372036854775807")],
|
|
471
467
|
uint64: [/* @__PURE__ */ BigInt(0), /* @__PURE__ */ BigInt("18446744073709551615")]
|
|
@@ -477,23 +473,21 @@ function pick(schema, mask) {
|
|
|
477
473
|
if (hasChecks) {
|
|
478
474
|
throw new Error(".pick() cannot be used on object schemas containing refinements");
|
|
479
475
|
}
|
|
480
|
-
const
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
});
|
|
496
|
-
return clone(schema, def);
|
|
476
|
+
const newShape = {};
|
|
477
|
+
mirrorShape(newShape, schema, maskedKeys(schema, mask));
|
|
478
|
+
return clone(schema, mergeDefs(currDef, { shape: newShape, checks: [] }));
|
|
479
|
+
}
|
|
480
|
+
function maskedKeys(schema, mask) {
|
|
481
|
+
const raw = sourceShape(schema);
|
|
482
|
+
const keys = [];
|
|
483
|
+
for (const key of Reflect.ownKeys(mask)) {
|
|
484
|
+
if (!Object.getOwnPropertyDescriptor(raw, key)?.enumerable) {
|
|
485
|
+
throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
486
|
+
}
|
|
487
|
+
if (mask[key])
|
|
488
|
+
keys.push(key);
|
|
489
|
+
}
|
|
490
|
+
return keys;
|
|
497
491
|
}
|
|
498
492
|
function omit(schema, mask) {
|
|
499
493
|
const currDef = schema._zod.def;
|
|
@@ -502,23 +496,10 @@ function omit(schema, mask) {
|
|
|
502
496
|
if (hasChecks) {
|
|
503
497
|
throw new Error(".omit() cannot be used on object schemas containing refinements");
|
|
504
498
|
}
|
|
505
|
-
const
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
if (!(key in currDef.shape)) {
|
|
510
|
-
throw new Error(`Unrecognized key: "${key}"`);
|
|
511
|
-
}
|
|
512
|
-
if (!mask[key])
|
|
513
|
-
continue;
|
|
514
|
-
delete newShape[key];
|
|
515
|
-
}
|
|
516
|
-
assignProp(this, "shape", newShape);
|
|
517
|
-
return newShape;
|
|
518
|
-
},
|
|
519
|
-
checks: []
|
|
520
|
-
});
|
|
521
|
-
return clone(schema, def);
|
|
499
|
+
const omitted = new Set(maskedKeys(schema, mask));
|
|
500
|
+
const newShape = {};
|
|
501
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)).filter((key) => !omitted.has(key)));
|
|
502
|
+
return clone(schema, mergeDefs(currDef, { shape: newShape, checks: [] }));
|
|
522
503
|
}
|
|
523
504
|
function extend(schema, shape) {
|
|
524
505
|
if (!isPlainObject(shape)) {
|
|
@@ -527,45 +508,39 @@ function extend(schema, shape) {
|
|
|
527
508
|
const checks = schema._zod.def.checks;
|
|
528
509
|
const hasChecks = checks && checks.length > 0;
|
|
529
510
|
if (hasChecks) {
|
|
530
|
-
const existingShape = schema
|
|
531
|
-
for (const key
|
|
511
|
+
const existingShape = sourceShape(schema);
|
|
512
|
+
for (const key of Reflect.ownKeys(shape)) {
|
|
532
513
|
if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) {
|
|
533
514
|
throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
534
515
|
}
|
|
535
516
|
}
|
|
536
517
|
}
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
return clone(schema, def);
|
|
518
|
+
return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
|
|
519
|
+
}
|
|
520
|
+
function extended(schema, shape) {
|
|
521
|
+
const newShape = {};
|
|
522
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)));
|
|
523
|
+
mirrorProps(newShape, shape);
|
|
524
|
+
return newShape;
|
|
545
525
|
}
|
|
546
526
|
function safeExtend(schema, shape) {
|
|
547
527
|
if (!isPlainObject(shape)) {
|
|
548
528
|
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
549
529
|
}
|
|
550
|
-
|
|
551
|
-
get shape() {
|
|
552
|
-
const _shape = { ...schema._zod.def.shape, ...shape };
|
|
553
|
-
assignProp(this, "shape", _shape);
|
|
554
|
-
return _shape;
|
|
555
|
-
}
|
|
556
|
-
});
|
|
557
|
-
return clone(schema, def);
|
|
530
|
+
return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
|
|
558
531
|
}
|
|
559
532
|
function merge(a, b) {
|
|
533
|
+
if (!b?._zod?.def) {
|
|
534
|
+
throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");
|
|
535
|
+
}
|
|
560
536
|
if (a._zod.def.checks?.length) {
|
|
561
537
|
throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
|
|
562
538
|
}
|
|
539
|
+
const newShape = {};
|
|
540
|
+
mirrorShape(newShape, a, Reflect.ownKeys(sourceShape(a)));
|
|
541
|
+
mirrorShape(newShape, b, Reflect.ownKeys(sourceShape(b)));
|
|
563
542
|
const def = mergeDefs(a._zod.def, {
|
|
564
|
-
|
|
565
|
-
const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
|
|
566
|
-
assignProp(this, "shape", _shape);
|
|
567
|
-
return _shape;
|
|
568
|
-
},
|
|
543
|
+
shape: newShape,
|
|
569
544
|
get catchall() {
|
|
570
545
|
return b._zod.def.catchall;
|
|
571
546
|
},
|
|
@@ -573,74 +548,26 @@ function merge(a, b) {
|
|
|
573
548
|
});
|
|
574
549
|
return clone(a, def);
|
|
575
550
|
}
|
|
576
|
-
function partial(Class2, schema, mask) {
|
|
551
|
+
function partial(Class2, schema, mask, name = "partial") {
|
|
577
552
|
const currDef = schema._zod.def;
|
|
578
553
|
const checks = currDef.checks;
|
|
579
554
|
const hasChecks = checks && checks.length > 0;
|
|
580
555
|
if (hasChecks) {
|
|
581
|
-
throw new Error(
|
|
582
|
-
}
|
|
583
|
-
const
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
if (mask) {
|
|
588
|
-
for (const key in mask) {
|
|
589
|
-
if (!(key in oldShape)) {
|
|
590
|
-
throw new Error(`Unrecognized key: "${key}"`);
|
|
591
|
-
}
|
|
592
|
-
if (!mask[key])
|
|
593
|
-
continue;
|
|
594
|
-
shape[key] = Class2 ? new Class2({
|
|
595
|
-
type: "optional",
|
|
596
|
-
innerType: oldShape[key]
|
|
597
|
-
}) : oldShape[key];
|
|
598
|
-
}
|
|
599
|
-
} else {
|
|
600
|
-
for (const key in oldShape) {
|
|
601
|
-
shape[key] = Class2 ? new Class2({
|
|
602
|
-
type: "optional",
|
|
603
|
-
innerType: oldShape[key]
|
|
604
|
-
}) : oldShape[key];
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
assignProp(this, "shape", shape);
|
|
608
|
-
return shape;
|
|
609
|
-
},
|
|
610
|
-
checks: []
|
|
611
|
-
});
|
|
612
|
-
return clone(schema, def);
|
|
556
|
+
throw new Error(`.${name}() cannot be used on object schemas containing refinements`);
|
|
557
|
+
}
|
|
558
|
+
const selected = mask ? new Set(maskedKeys(schema, mask)) : void 0;
|
|
559
|
+
const newShape = {};
|
|
560
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), Class2 && ((value, key) => selected && !selected.has(key) ? value : new Class2({ type: "optional", innerType: value })));
|
|
561
|
+
return clone(schema, mergeDefs(schema._zod.def, { shape: newShape, checks: [] }));
|
|
613
562
|
}
|
|
614
563
|
function required(Class2, schema, mask) {
|
|
615
|
-
const
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
throw new Error(`Unrecognized key: "${key}"`);
|
|
623
|
-
}
|
|
624
|
-
if (!mask[key])
|
|
625
|
-
continue;
|
|
626
|
-
shape[key] = new Class2({
|
|
627
|
-
type: "nonoptional",
|
|
628
|
-
innerType: oldShape[key]
|
|
629
|
-
});
|
|
630
|
-
}
|
|
631
|
-
} else {
|
|
632
|
-
for (const key in oldShape) {
|
|
633
|
-
shape[key] = new Class2({
|
|
634
|
-
type: "nonoptional",
|
|
635
|
-
innerType: oldShape[key]
|
|
636
|
-
});
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
assignProp(this, "shape", shape);
|
|
640
|
-
return shape;
|
|
641
|
-
}
|
|
642
|
-
});
|
|
643
|
-
return clone(schema, def);
|
|
564
|
+
const selected = mask ? new Set(maskedKeys(schema, mask)) : void 0;
|
|
565
|
+
const newShape = {};
|
|
566
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), (value, key) => (
|
|
567
|
+
// overwrite with non-optional
|
|
568
|
+
selected && !selected.has(key) ? value : new Class2({ type: "nonoptional", innerType: value })
|
|
569
|
+
));
|
|
570
|
+
return clone(schema, mergeDefs(schema._zod.def, { shape: newShape }));
|
|
644
571
|
}
|
|
645
572
|
function aborted(x, startIndex = 0) {
|
|
646
573
|
if (x.aborted === true)
|
|
@@ -673,15 +600,47 @@ function prefixIssues(path, issues) {
|
|
|
673
600
|
function unwrapMessage(message) {
|
|
674
601
|
return typeof message === "string" ? message : message?.message;
|
|
675
602
|
}
|
|
603
|
+
function sizeCaps(defChecks) {
|
|
604
|
+
const caps = [];
|
|
605
|
+
for (const ch of defChecks ?? []) {
|
|
606
|
+
const d = ch._zod.def;
|
|
607
|
+
if (!/_(length|size)$|_equals$/.test(d.check))
|
|
608
|
+
break;
|
|
609
|
+
const max = d.maximum ?? d.length ?? d.size;
|
|
610
|
+
if (max >= 0)
|
|
611
|
+
caps.push([max, ch]);
|
|
612
|
+
}
|
|
613
|
+
return caps;
|
|
614
|
+
}
|
|
615
|
+
function attachSchema(issues, start, inst) {
|
|
616
|
+
var _a3;
|
|
617
|
+
for (let i = start; i < issues.length; i++) {
|
|
618
|
+
(_a3 = issues[i]).schema ?? (_a3.schema = inst);
|
|
619
|
+
}
|
|
620
|
+
}
|
|
676
621
|
function finalizeIssue(iss, ctx, config2) {
|
|
677
|
-
|
|
678
|
-
const
|
|
679
|
-
|
|
680
|
-
|
|
622
|
+
var _a3;
|
|
623
|
+
const traits = iss.inst?._zod?.traits;
|
|
624
|
+
if (traits?.has("$ZodType")) {
|
|
625
|
+
if (traits.has("$ZodCheck"))
|
|
626
|
+
(_a3 = iss).schema ?? (_a3.schema = iss.inst);
|
|
627
|
+
else
|
|
628
|
+
iss.schema = iss.inst;
|
|
629
|
+
}
|
|
630
|
+
const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : void 0;
|
|
631
|
+
const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(schemaError?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
|
|
632
|
+
const full = {};
|
|
633
|
+
for (const k of Object.keys(iss)) {
|
|
634
|
+
if (k === "inst" || k === "schema" || k === "continue" || k === "input" || k === "__proto__")
|
|
635
|
+
continue;
|
|
636
|
+
full[k] = iss[k];
|
|
637
|
+
}
|
|
638
|
+
full.path ?? (full.path = []);
|
|
639
|
+
full.message = message;
|
|
681
640
|
if (ctx?.reportInput) {
|
|
682
|
-
|
|
641
|
+
full.input = iss.input;
|
|
683
642
|
}
|
|
684
|
-
return
|
|
643
|
+
return full;
|
|
685
644
|
}
|
|
686
645
|
function getSizableOrigin(input) {
|
|
687
646
|
if (input instanceof Set)
|
|
@@ -692,6 +651,20 @@ function getSizableOrigin(input) {
|
|
|
692
651
|
return "file";
|
|
693
652
|
return "unknown";
|
|
694
653
|
}
|
|
654
|
+
var highSurrogate = /[\uD800-\uDBFF]/;
|
|
655
|
+
function codePointLength(str) {
|
|
656
|
+
const units = str.length;
|
|
657
|
+
if (!highSurrogate.test(str))
|
|
658
|
+
return units;
|
|
659
|
+
let count = units;
|
|
660
|
+
for (let i = 0; i < units - 1; i++) {
|
|
661
|
+
if ((str.charCodeAt(i) & 64512) === 55296 && (str.charCodeAt(i + 1) & 64512) === 56320) {
|
|
662
|
+
count--;
|
|
663
|
+
i++;
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
return count;
|
|
667
|
+
}
|
|
695
668
|
function getLengthableOrigin(input) {
|
|
696
669
|
if (Array.isArray(input))
|
|
697
670
|
return "array";
|
|
@@ -778,43 +751,308 @@ var Class = class {
|
|
|
778
751
|
constructor(..._args) {
|
|
779
752
|
}
|
|
780
753
|
};
|
|
754
|
+
function members(proto, table) {
|
|
755
|
+
for (const key in table) {
|
|
756
|
+
const desc = Object.getOwnPropertyDescriptor(table, key);
|
|
757
|
+
if (desc.get)
|
|
758
|
+
Object.defineProperty(proto, key, { ...desc, enumerable: false });
|
|
759
|
+
else
|
|
760
|
+
defineBound(proto, key, desc.value);
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
function own(inst, key, value, enumerable = true) {
|
|
764
|
+
Object.defineProperty(inst, key, { configurable: true, writable: true, enumerable, value });
|
|
765
|
+
return value;
|
|
766
|
+
}
|
|
767
|
+
function hide(inst, key, value) {
|
|
768
|
+
return own(inst, key, value, false);
|
|
769
|
+
}
|
|
770
|
+
// @__NO_SIDE_EFFECTS__
|
|
771
|
+
function derived(computes, table) {
|
|
772
|
+
for (const key in computes) {
|
|
773
|
+
const compute = computes[key];
|
|
774
|
+
Object.defineProperty(table, key, {
|
|
775
|
+
configurable: true,
|
|
776
|
+
enumerable: true,
|
|
777
|
+
get() {
|
|
778
|
+
return own(this, key, compute(this));
|
|
779
|
+
},
|
|
780
|
+
set(value) {
|
|
781
|
+
own(this, key, value);
|
|
782
|
+
}
|
|
783
|
+
});
|
|
784
|
+
}
|
|
785
|
+
return table;
|
|
786
|
+
}
|
|
787
|
+
function defineBound(proto, key, fn) {
|
|
788
|
+
Object.defineProperty(proto, key, {
|
|
789
|
+
configurable: true,
|
|
790
|
+
get() {
|
|
791
|
+
return this == null ? fn : own(this, key, fn.bind(this));
|
|
792
|
+
},
|
|
793
|
+
set(value) {
|
|
794
|
+
own(this, key, value);
|
|
795
|
+
}
|
|
796
|
+
});
|
|
797
|
+
}
|
|
798
|
+
function claim(inst, sentinel) {
|
|
799
|
+
const proto = Object.getPrototypeOf(inst);
|
|
800
|
+
return sentinel in proto ? void 0 : proto;
|
|
801
|
+
}
|
|
802
|
+
var installing;
|
|
803
|
+
var broke = false;
|
|
804
|
+
var breaker = {
|
|
805
|
+
configurable: true,
|
|
806
|
+
get() {
|
|
807
|
+
broke = true;
|
|
808
|
+
return void 0;
|
|
809
|
+
}
|
|
810
|
+
};
|
|
811
|
+
function defineLazyInternal(inst, key, compute) {
|
|
812
|
+
const proto = Object.getPrototypeOf(inst._zod);
|
|
813
|
+
if (key in proto && installing !== inst._zod) {
|
|
814
|
+
installing = void 0;
|
|
815
|
+
return;
|
|
816
|
+
}
|
|
817
|
+
installing = inst._zod;
|
|
818
|
+
Object.defineProperty(proto, key, {
|
|
819
|
+
configurable: true,
|
|
820
|
+
get() {
|
|
821
|
+
Object.defineProperty(this, key, breaker);
|
|
822
|
+
const outer = broke;
|
|
823
|
+
broke = false;
|
|
824
|
+
try {
|
|
825
|
+
const value = compute(this);
|
|
826
|
+
if (broke)
|
|
827
|
+
delete this[key];
|
|
828
|
+
else
|
|
829
|
+
Object.defineProperty(this, key, { configurable: true, writable: true, value });
|
|
830
|
+
broke = broke || outer;
|
|
831
|
+
return value;
|
|
832
|
+
} catch (err) {
|
|
833
|
+
delete this[key];
|
|
834
|
+
broke = broke || outer;
|
|
835
|
+
throw err;
|
|
836
|
+
}
|
|
837
|
+
},
|
|
838
|
+
set(value) {
|
|
839
|
+
Object.defineProperty(this, key, { configurable: true, writable: true, value });
|
|
840
|
+
}
|
|
841
|
+
});
|
|
842
|
+
}
|
|
843
|
+
function installLazyProp(inst, key, make, enumerable) {
|
|
844
|
+
const proto = claim(inst, key);
|
|
845
|
+
if (!proto)
|
|
846
|
+
return;
|
|
847
|
+
Object.defineProperty(proto, key, {
|
|
848
|
+
configurable: true,
|
|
849
|
+
get() {
|
|
850
|
+
const desc = { configurable: true, writable: true, enumerable, value: void 0 };
|
|
851
|
+
Object.defineProperty(this, key, desc);
|
|
852
|
+
desc.value = make(this);
|
|
853
|
+
Object.defineProperty(this, key, desc);
|
|
854
|
+
return desc.value;
|
|
855
|
+
},
|
|
856
|
+
set(value) {
|
|
857
|
+
Object.defineProperty(this, key, { configurable: true, writable: true, enumerable, value });
|
|
858
|
+
}
|
|
859
|
+
});
|
|
860
|
+
}
|
|
861
|
+
var CONSTANT_CATCH = "~constantCatch";
|
|
862
|
+
function constantCatch(value) {
|
|
863
|
+
const fn = () => value;
|
|
864
|
+
fn[CONSTANT_CATCH] = true;
|
|
865
|
+
return fn;
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
// node_modules/zod/v4/core/core.js
|
|
869
|
+
var _a;
|
|
870
|
+
var _zodDesc = { value: void 0, enumerable: false };
|
|
871
|
+
var _E = "captureStackTrace" in Error ? Error : null;
|
|
872
|
+
function newError(Definition) {
|
|
873
|
+
const E = _E;
|
|
874
|
+
if (E) {
|
|
875
|
+
const saved = E.stackTraceLimit;
|
|
876
|
+
if (typeof saved === "number") {
|
|
877
|
+
try {
|
|
878
|
+
E.stackTraceLimit = 0;
|
|
879
|
+
} catch {
|
|
880
|
+
_E = null;
|
|
881
|
+
return new Definition();
|
|
882
|
+
}
|
|
883
|
+
try {
|
|
884
|
+
return new Definition();
|
|
885
|
+
} finally {
|
|
886
|
+
E.stackTraceLimit = saved;
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
return new Definition();
|
|
891
|
+
}
|
|
892
|
+
// @__NO_SIDE_EFFECTS__
|
|
893
|
+
function $constructor(name, initializer3, proto, params) {
|
|
894
|
+
const zodProto = {};
|
|
895
|
+
function Internals(def) {
|
|
896
|
+
this.def = def;
|
|
897
|
+
this.constr = _;
|
|
898
|
+
this.traits = /* @__PURE__ */ new Set();
|
|
899
|
+
}
|
|
900
|
+
Internals.prototype = zodProto;
|
|
901
|
+
const protoMembers = proto;
|
|
902
|
+
const initialized = protoMembers && /* @__PURE__ */ new WeakSet();
|
|
903
|
+
function init(inst, def) {
|
|
904
|
+
if (!inst._zod) {
|
|
905
|
+
_zodDesc.value = new Internals(def);
|
|
906
|
+
try {
|
|
907
|
+
Object.defineProperty(inst, "_zod", _zodDesc);
|
|
908
|
+
} finally {
|
|
909
|
+
_zodDesc.value = void 0;
|
|
910
|
+
}
|
|
911
|
+
} else if (inst._zod.traits.has(name)) {
|
|
912
|
+
return;
|
|
913
|
+
}
|
|
914
|
+
inst._zod.traits.add(name);
|
|
915
|
+
initializer3(inst, def);
|
|
916
|
+
if (initialized) {
|
|
917
|
+
const own2 = Object.getPrototypeOf(inst);
|
|
918
|
+
const ctorProto = inst._zod.constr.prototype;
|
|
919
|
+
let up = own2;
|
|
920
|
+
while (up && up !== ctorProto)
|
|
921
|
+
up = Object.getPrototypeOf(up);
|
|
922
|
+
const target = up ?? own2;
|
|
923
|
+
if (!initialized.has(target)) {
|
|
924
|
+
initialized.add(target);
|
|
925
|
+
members(target, protoMembers);
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
const proto2 = _.prototype;
|
|
929
|
+
for (const k in proto2) {
|
|
930
|
+
if (!Object.prototype.hasOwnProperty.call(proto2, k))
|
|
931
|
+
continue;
|
|
932
|
+
if (!(k in inst)) {
|
|
933
|
+
inst[k] = proto2[k].bind(inst);
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
const Parent = params?.Parent ?? Object;
|
|
938
|
+
class Definition extends Parent {
|
|
939
|
+
}
|
|
940
|
+
Object.defineProperty(Definition, "name", { value: name });
|
|
941
|
+
function _(def) {
|
|
942
|
+
const inst = params?.Parent ? newError(Definition) : this;
|
|
943
|
+
init(inst, def);
|
|
944
|
+
const deferred = inst._zod.deferred;
|
|
945
|
+
if (deferred) {
|
|
946
|
+
for (const fn of deferred) {
|
|
947
|
+
fn();
|
|
948
|
+
}
|
|
949
|
+
inst._zod.deferred = void 0;
|
|
950
|
+
}
|
|
951
|
+
const pp = globalThis.__zod_globalConfig?.postProcessor;
|
|
952
|
+
if (pp)
|
|
953
|
+
pp(inst);
|
|
954
|
+
return inst;
|
|
955
|
+
}
|
|
956
|
+
Object.defineProperty(_, "init", { value: init });
|
|
957
|
+
Object.defineProperty(_, Symbol.hasInstance, {
|
|
958
|
+
value: (inst) => {
|
|
959
|
+
if (params?.Parent && inst instanceof params.Parent)
|
|
960
|
+
return true;
|
|
961
|
+
return inst?._zod?.traits?.has(name);
|
|
962
|
+
}
|
|
963
|
+
});
|
|
964
|
+
Object.defineProperty(_, "name", { value: name });
|
|
965
|
+
return _;
|
|
966
|
+
}
|
|
967
|
+
var $ZodAsyncError = class extends Error {
|
|
968
|
+
constructor() {
|
|
969
|
+
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
970
|
+
}
|
|
971
|
+
};
|
|
972
|
+
var $ZodEncodeError = class extends Error {
|
|
973
|
+
constructor(name) {
|
|
974
|
+
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
975
|
+
this.name = "ZodEncodeError";
|
|
976
|
+
}
|
|
977
|
+
};
|
|
978
|
+
(_a = globalThis).__zod_globalConfig ?? (_a.__zod_globalConfig = {});
|
|
979
|
+
var globalConfig = globalThis.__zod_globalConfig;
|
|
980
|
+
function config(newConfig) {
|
|
981
|
+
if (newConfig)
|
|
982
|
+
Object.assign(globalConfig, newConfig);
|
|
983
|
+
return globalConfig;
|
|
984
|
+
}
|
|
781
985
|
|
|
782
986
|
// node_modules/zod/v4/core/errors.js
|
|
987
|
+
function _getMessage() {
|
|
988
|
+
const internals = this._zod;
|
|
989
|
+
internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
|
|
990
|
+
return internals.message;
|
|
991
|
+
}
|
|
992
|
+
function _setMessage(value) {
|
|
993
|
+
this._zod.message = value;
|
|
994
|
+
}
|
|
995
|
+
var _messageDesc = {
|
|
996
|
+
get: _getMessage,
|
|
997
|
+
set: _setMessage,
|
|
998
|
+
enumerable: true,
|
|
999
|
+
configurable: true
|
|
1000
|
+
};
|
|
1001
|
+
var _issuesDesc = { value: void 0, enumerable: false };
|
|
1002
|
+
var _installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
|
|
783
1003
|
var initializer = (inst, def) => {
|
|
784
1004
|
inst.name = "$ZodError";
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
Object.
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
1005
|
+
_issuesDesc.value = def;
|
|
1006
|
+
Object.defineProperty(inst, "issues", _issuesDesc);
|
|
1007
|
+
_issuesDesc.value = void 0;
|
|
1008
|
+
Object.defineProperty(inst, "message", _messageDesc);
|
|
1009
|
+
const proto = Object.getPrototypeOf(inst);
|
|
1010
|
+
if (!_installedToString.has(proto)) {
|
|
1011
|
+
_installedToString.add(proto);
|
|
1012
|
+
Object.defineProperty(proto, "toString", {
|
|
1013
|
+
configurable: true,
|
|
1014
|
+
enumerable: false,
|
|
1015
|
+
get() {
|
|
1016
|
+
const value = () => this.message;
|
|
1017
|
+
Object.defineProperty(this, "toString", { value, configurable: true, writable: true });
|
|
1018
|
+
return value;
|
|
1019
|
+
},
|
|
1020
|
+
set(value) {
|
|
1021
|
+
Object.defineProperty(this, "toString", { value, configurable: true, writable: true });
|
|
1022
|
+
}
|
|
1023
|
+
});
|
|
1024
|
+
}
|
|
798
1025
|
};
|
|
799
1026
|
var $ZodError = $constructor("$ZodError", initializer);
|
|
800
|
-
var $ZodRealError = $constructor("$ZodError", initializer,
|
|
801
|
-
|
|
1027
|
+
var $ZodRealError = $constructor("$ZodError", initializer, void 0, {
|
|
1028
|
+
Parent: Error
|
|
1029
|
+
});
|
|
1030
|
+
function node(obj, key, make) {
|
|
1031
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
1032
|
+
if (key === "__proto__") {
|
|
1033
|
+
Object.defineProperty(obj, key, { value: make(), writable: true, enumerable: true, configurable: true });
|
|
1034
|
+
} else {
|
|
1035
|
+
obj[key] = make();
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
return obj[key];
|
|
1039
|
+
}
|
|
1040
|
+
function flattenError(error2, mapper = (issue2) => issue2.message) {
|
|
802
1041
|
const fieldErrors = {};
|
|
803
1042
|
const formErrors = [];
|
|
804
|
-
for (const sub of
|
|
1043
|
+
for (const sub of error2.issues) {
|
|
805
1044
|
if (sub.path.length > 0) {
|
|
806
|
-
fieldErrors
|
|
807
|
-
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
1045
|
+
node(fieldErrors, sub.path[0], () => []).push(mapper(sub));
|
|
808
1046
|
} else {
|
|
809
1047
|
formErrors.push(mapper(sub));
|
|
810
1048
|
}
|
|
811
1049
|
}
|
|
812
1050
|
return { formErrors, fieldErrors };
|
|
813
1051
|
}
|
|
814
|
-
function formatError(
|
|
1052
|
+
function formatError(error2, mapper = (issue2) => issue2.message) {
|
|
815
1053
|
const fieldErrors = { _errors: [] };
|
|
816
|
-
const processError = (
|
|
817
|
-
for (const issue2 of
|
|
1054
|
+
const processError = (error3, path = []) => {
|
|
1055
|
+
for (const issue2 of error3.issues) {
|
|
818
1056
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
819
1057
|
issue2.errors.map((issues) => processError({ issues }, [...path, ...issue2.path]));
|
|
820
1058
|
} else if (issue2.code === "invalid_key") {
|
|
@@ -831,48 +1069,69 @@ function formatError(error, mapper = (issue2) => issue2.message) {
|
|
|
831
1069
|
while (i < fullpath.length) {
|
|
832
1070
|
const el = fullpath[i];
|
|
833
1071
|
const terminal = i === fullpath.length - 1;
|
|
834
|
-
if (
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
1072
|
+
if (el === "_errors") {
|
|
1073
|
+
if (terminal)
|
|
1074
|
+
curr._errors.push(mapper(issue2));
|
|
1075
|
+
i++;
|
|
1076
|
+
continue;
|
|
1077
|
+
}
|
|
1078
|
+
if (!Object.prototype.hasOwnProperty.call(curr, el)) {
|
|
1079
|
+
Object.defineProperty(curr, el, {
|
|
1080
|
+
value: { _errors: [] },
|
|
1081
|
+
enumerable: true,
|
|
1082
|
+
writable: true,
|
|
1083
|
+
configurable: true
|
|
1084
|
+
});
|
|
1085
|
+
}
|
|
1086
|
+
const node2 = curr[el];
|
|
1087
|
+
if (terminal) {
|
|
1088
|
+
node2._errors.push(mapper(issue2));
|
|
839
1089
|
}
|
|
840
|
-
curr =
|
|
1090
|
+
curr = node2;
|
|
841
1091
|
i++;
|
|
842
1092
|
}
|
|
843
1093
|
}
|
|
844
1094
|
}
|
|
845
1095
|
}
|
|
846
1096
|
};
|
|
847
|
-
processError(
|
|
1097
|
+
processError(error2);
|
|
848
1098
|
return fieldErrors;
|
|
849
1099
|
}
|
|
850
1100
|
|
|
851
1101
|
// node_modules/zod/v4/core/parse.js
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
1102
|
+
function finalizeParams(callee, params) {
|
|
1103
|
+
return { callee: params?.callee ?? callee, Err: params?.Err };
|
|
1104
|
+
}
|
|
1105
|
+
var _parse = (_Err) => {
|
|
1106
|
+
const fn = (schema, value, _ctx, _params) => {
|
|
1107
|
+
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
1108
|
+
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
1109
|
+
if (result instanceof Promise) {
|
|
1110
|
+
throw new $ZodAsyncError();
|
|
1111
|
+
}
|
|
1112
|
+
if (result.issues.length) {
|
|
1113
|
+
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
1114
|
+
captureStackTrace(e, _params?.callee ?? fn);
|
|
1115
|
+
throw e;
|
|
1116
|
+
}
|
|
1117
|
+
return result.value;
|
|
1118
|
+
};
|
|
1119
|
+
return fn;
|
|
864
1120
|
};
|
|
865
|
-
var _parseAsync = (_Err) =>
|
|
866
|
-
const
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
result
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
1121
|
+
var _parseAsync = (_Err) => {
|
|
1122
|
+
const fn = async (schema, value, _ctx, params) => {
|
|
1123
|
+
const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
|
|
1124
|
+
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
1125
|
+
if (result instanceof Promise)
|
|
1126
|
+
result = await result;
|
|
1127
|
+
if (result.issues.length) {
|
|
1128
|
+
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
1129
|
+
captureStackTrace(e, params?.callee ?? fn);
|
|
1130
|
+
throw e;
|
|
1131
|
+
}
|
|
1132
|
+
return result.value;
|
|
1133
|
+
};
|
|
1134
|
+
return fn;
|
|
876
1135
|
};
|
|
877
1136
|
var _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
878
1137
|
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
@@ -880,36 +1139,97 @@ var _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
|
880
1139
|
if (result instanceof Promise) {
|
|
881
1140
|
throw new $ZodAsyncError();
|
|
882
1141
|
}
|
|
883
|
-
return result.issues.length ? {
|
|
884
|
-
success: false,
|
|
885
|
-
error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
886
|
-
} : { success: true, data: result.value };
|
|
1142
|
+
return result.issues.length ? failure(_Err, result.issues, ctx) : { success: true, data: result.value };
|
|
887
1143
|
};
|
|
888
|
-
|
|
1144
|
+
function failure(Err, issues, ctx) {
|
|
1145
|
+
let error2;
|
|
1146
|
+
return {
|
|
1147
|
+
success: false,
|
|
1148
|
+
get error() {
|
|
1149
|
+
if (!error2) {
|
|
1150
|
+
error2 = new Err(issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
1151
|
+
issues = void 0;
|
|
1152
|
+
ctx = void 0;
|
|
1153
|
+
}
|
|
1154
|
+
return error2;
|
|
1155
|
+
},
|
|
1156
|
+
set error(e) {
|
|
1157
|
+
error2 = e;
|
|
1158
|
+
issues = void 0;
|
|
1159
|
+
ctx = void 0;
|
|
1160
|
+
}
|
|
1161
|
+
};
|
|
1162
|
+
}
|
|
889
1163
|
var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
890
1164
|
const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
|
|
891
1165
|
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
892
1166
|
if (result instanceof Promise)
|
|
893
1167
|
result = await result;
|
|
894
|
-
return result.issues.length ? {
|
|
895
|
-
success: false,
|
|
896
|
-
error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
897
|
-
} : { success: true, data: result.value };
|
|
1168
|
+
return result.issues.length ? failure(_Err, result.issues, ctx) : { success: true, data: result.value };
|
|
898
1169
|
};
|
|
899
|
-
var
|
|
900
|
-
var
|
|
901
|
-
|
|
902
|
-
|
|
1170
|
+
var COMPILE_INVALID = /* @__PURE__ */ Symbol.for("zod.compile.invalid");
|
|
1171
|
+
var COMPILE_FALLBACK = /* @__PURE__ */ Symbol.for("zod.compile.fallback");
|
|
1172
|
+
var validate = ((schema, value, _ctx) => {
|
|
1173
|
+
const validator = schema._zod.bag.validator;
|
|
1174
|
+
if (validator !== void 0) {
|
|
1175
|
+
if (validator(value) !== COMPILE_INVALID)
|
|
1176
|
+
return true;
|
|
1177
|
+
if (validator.definite === true && _ctx === void 0)
|
|
1178
|
+
return false;
|
|
1179
|
+
}
|
|
1180
|
+
return validateFallback(schema, value, _ctx);
|
|
1181
|
+
});
|
|
1182
|
+
function validateFallback(schema, value, _ctx) {
|
|
1183
|
+
const ctx = _ctx ? { ..._ctx, async: false, abortEarly: true } : { async: false, abortEarly: true };
|
|
1184
|
+
const fallbackRun = schema._zod.bag.fallbackRun;
|
|
1185
|
+
let result;
|
|
1186
|
+
if (fallbackRun) {
|
|
1187
|
+
ctx[COMPILE_FALLBACK] = true;
|
|
1188
|
+
result = fallbackRun({ value, issues: [] }, ctx);
|
|
1189
|
+
} else {
|
|
1190
|
+
result = schema._zod.run({ value, issues: [] }, ctx);
|
|
1191
|
+
}
|
|
1192
|
+
if (result instanceof Promise) {
|
|
1193
|
+
throw new $ZodAsyncError();
|
|
1194
|
+
}
|
|
1195
|
+
return result.issues.length === 0;
|
|
1196
|
+
}
|
|
1197
|
+
var validateAsync = async (schema, value, _ctx) => {
|
|
1198
|
+
const ctx = _ctx ? { ..._ctx, async: true, abortEarly: true } : { async: true, abortEarly: true };
|
|
1199
|
+
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
1200
|
+
if (result instanceof Promise)
|
|
1201
|
+
result = await result;
|
|
1202
|
+
return result.issues.length === 0;
|
|
1203
|
+
};
|
|
1204
|
+
var _encode = (_Err) => {
|
|
1205
|
+
const parse2 = _parse(_Err);
|
|
1206
|
+
const fn = (schema, value, _ctx, _params) => {
|
|
1207
|
+
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
1208
|
+
return parse2(schema, value, ctx, finalizeParams(fn, _params));
|
|
1209
|
+
};
|
|
1210
|
+
return fn;
|
|
903
1211
|
};
|
|
904
|
-
var _decode = (_Err) =>
|
|
905
|
-
|
|
1212
|
+
var _decode = (_Err) => {
|
|
1213
|
+
const parse2 = _parse(_Err);
|
|
1214
|
+
const fn = (schema, value, _ctx, _params) => {
|
|
1215
|
+
return parse2(schema, value, _ctx, finalizeParams(fn, _params));
|
|
1216
|
+
};
|
|
1217
|
+
return fn;
|
|
906
1218
|
};
|
|
907
|
-
var _encodeAsync = (_Err) =>
|
|
908
|
-
const
|
|
909
|
-
|
|
1219
|
+
var _encodeAsync = (_Err) => {
|
|
1220
|
+
const parseAsync2 = _parseAsync(_Err);
|
|
1221
|
+
const fn = async (schema, value, _ctx, _params) => {
|
|
1222
|
+
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
1223
|
+
return await parseAsync2(schema, value, ctx, finalizeParams(fn, _params));
|
|
1224
|
+
};
|
|
1225
|
+
return fn;
|
|
910
1226
|
};
|
|
911
|
-
var _decodeAsync = (_Err) =>
|
|
912
|
-
|
|
1227
|
+
var _decodeAsync = (_Err) => {
|
|
1228
|
+
const parseAsync2 = _parseAsync(_Err);
|
|
1229
|
+
const fn = async (schema, value, _ctx, _params) => {
|
|
1230
|
+
return await parseAsync2(schema, value, _ctx, finalizeParams(fn, _params));
|
|
1231
|
+
};
|
|
1232
|
+
return fn;
|
|
913
1233
|
};
|
|
914
1234
|
var _safeEncode = (_Err) => (schema, value, _ctx) => {
|
|
915
1235
|
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
@@ -929,10 +1249,13 @@ var _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
929
1249
|
// node_modules/zod/v4/core/regexes.js
|
|
930
1250
|
var cuid = /^[cC][0-9a-z]{6,}$/;
|
|
931
1251
|
var cuid2 = /^[0-9a-z]+$/;
|
|
932
|
-
var ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{
|
|
1252
|
+
var ulid = /^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/;
|
|
933
1253
|
var xid = /^[0-9a-vA-V]{20}$/;
|
|
934
1254
|
var ksuid = /^[A-Za-z0-9]{27}$/;
|
|
935
1255
|
var nanoid = /^[a-zA-Z0-9_-]{21}$/;
|
|
1256
|
+
function nanoidOfLength(length) {
|
|
1257
|
+
return new RegExp(`^[a-zA-Z0-9_-]{${length}}$`);
|
|
1258
|
+
}
|
|
936
1259
|
var duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
|
|
937
1260
|
var 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})$/;
|
|
938
1261
|
var uuid = (version2) => {
|
|
@@ -940,44 +1263,41 @@ var uuid = (version2) => {
|
|
|
940
1263
|
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)$/;
|
|
941
1264
|
return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version2}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
|
|
942
1265
|
};
|
|
943
|
-
var email = /^(
|
|
944
|
-
var _emoji = `^(\\p{Extended_Pictographic}
|
|
1266
|
+
var email = /^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
|
1267
|
+
var _emoji = `^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
|
|
945
1268
|
function emoji() {
|
|
946
1269
|
return new RegExp(_emoji, "u");
|
|
947
1270
|
}
|
|
948
1271
|
var 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])$/;
|
|
949
1272
|
var 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}|:))$/;
|
|
950
1273
|
var 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])$/;
|
|
951
|
-
var cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}
|
|
1274
|
+
var cidrv6 = /^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
952
1275
|
var base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
953
|
-
var base64url = /^[A-Za-z0-9_-]
|
|
1276
|
+
var base64url = /^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;
|
|
954
1277
|
var httpProtocol = /^https?$/;
|
|
955
1278
|
var e164 = /^\+[1-9]\d{6,14}$/;
|
|
956
1279
|
var 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])))`;
|
|
957
|
-
|
|
1280
|
+
function anchor(source) {
|
|
1281
|
+
return new RegExp(`^${source}$`);
|
|
1282
|
+
}
|
|
1283
|
+
var date = /* @__PURE__ */ anchor(dateSource);
|
|
958
1284
|
function timeSource(args) {
|
|
959
1285
|
const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
|
|
960
|
-
const regex = typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
1286
|
+
const regex = typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : args.seconds ? `${hhmm}:[0-5]\\d(?:\\.\\d+)?` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
961
1287
|
return regex;
|
|
962
1288
|
}
|
|
963
1289
|
function time(args) {
|
|
964
1290
|
return new RegExp(`^${timeSource(args)}$`);
|
|
965
1291
|
}
|
|
966
1292
|
function datetime(args) {
|
|
967
|
-
const time3 = timeSource({ precision: args.precision });
|
|
968
1293
|
const opts = ["Z"];
|
|
969
|
-
if (args.local)
|
|
970
|
-
opts.push("");
|
|
971
1294
|
if (args.offset)
|
|
972
1295
|
opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
|
|
973
|
-
const
|
|
1296
|
+
const qualified = `${timeSource({ precision: args.precision, seconds: true })}(?:${opts.join("|")})`;
|
|
1297
|
+
const timeRegex = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified;
|
|
974
1298
|
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
975
1299
|
}
|
|
976
|
-
var
|
|
977
|
-
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
978
|
-
return new RegExp(`^${regex}$`);
|
|
979
|
-
};
|
|
980
|
-
var integer = /^-?\d+$/;
|
|
1300
|
+
var anyString = /^[\s\S]{0,}$/;
|
|
981
1301
|
var number = /^-?\d+(?:\.\d+)?$/;
|
|
982
1302
|
var lowercase = /^[^A-Z]*$/;
|
|
983
1303
|
var uppercase = /^[^a-z]*$/;
|
|
@@ -989,6 +1309,10 @@ var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
|
989
1309
|
inst._zod.def = def;
|
|
990
1310
|
(_a3 = inst._zod).onattach ?? (_a3.onattach = []);
|
|
991
1311
|
});
|
|
1312
|
+
var _whenHasLength = (payload) => {
|
|
1313
|
+
const val = payload.value;
|
|
1314
|
+
return !nullish(val) && val.length !== void 0;
|
|
1315
|
+
};
|
|
992
1316
|
var numericOriginMap = {
|
|
993
1317
|
number: "number",
|
|
994
1318
|
bigint: "bigint",
|
|
@@ -997,22 +1321,12 @@ var numericOriginMap = {
|
|
|
997
1321
|
var $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst, def) => {
|
|
998
1322
|
$ZodCheck.init(inst, def);
|
|
999
1323
|
const origin = numericOriginMap[typeof def.value];
|
|
1000
|
-
inst._zod.onattach.push((inst2) => {
|
|
1001
|
-
const bag = inst2._zod.bag;
|
|
1002
|
-
const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
|
1003
|
-
if (def.value < curr) {
|
|
1004
|
-
if (def.inclusive)
|
|
1005
|
-
bag.maximum = def.value;
|
|
1006
|
-
else
|
|
1007
|
-
bag.exclusiveMaximum = def.value;
|
|
1008
|
-
}
|
|
1009
|
-
});
|
|
1010
1324
|
inst._zod.check = (payload) => {
|
|
1011
1325
|
if (def.inclusive ? payload.value <= def.value : payload.value < def.value) {
|
|
1012
1326
|
return;
|
|
1013
1327
|
}
|
|
1014
1328
|
payload.issues.push({
|
|
1015
|
-
origin,
|
|
1329
|
+
origin: numericOriginMap[typeof payload.value] ?? origin,
|
|
1016
1330
|
code: "too_big",
|
|
1017
1331
|
maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
1018
1332
|
input: payload.value,
|
|
@@ -1025,22 +1339,12 @@ var $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst,
|
|
|
1025
1339
|
var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan", (inst, def) => {
|
|
1026
1340
|
$ZodCheck.init(inst, def);
|
|
1027
1341
|
const origin = numericOriginMap[typeof def.value];
|
|
1028
|
-
inst._zod.onattach.push((inst2) => {
|
|
1029
|
-
const bag = inst2._zod.bag;
|
|
1030
|
-
const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
|
1031
|
-
if (def.value > curr) {
|
|
1032
|
-
if (def.inclusive)
|
|
1033
|
-
bag.minimum = def.value;
|
|
1034
|
-
else
|
|
1035
|
-
bag.exclusiveMinimum = def.value;
|
|
1036
|
-
}
|
|
1037
|
-
});
|
|
1038
1342
|
inst._zod.check = (payload) => {
|
|
1039
1343
|
if (def.inclusive ? payload.value >= def.value : payload.value > def.value) {
|
|
1040
1344
|
return;
|
|
1041
1345
|
}
|
|
1042
1346
|
payload.issues.push({
|
|
1043
|
-
origin,
|
|
1347
|
+
origin: numericOriginMap[typeof payload.value] ?? origin,
|
|
1044
1348
|
code: "too_small",
|
|
1045
1349
|
minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
1046
1350
|
input: payload.value,
|
|
@@ -1052,14 +1356,13 @@ var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan",
|
|
|
1052
1356
|
});
|
|
1053
1357
|
var $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
|
|
1054
1358
|
$ZodCheck.init(inst, def);
|
|
1055
|
-
inst._zod.onattach.push((inst2) => {
|
|
1056
|
-
var _a3;
|
|
1057
|
-
(_a3 = inst2._zod.bag).multipleOf ?? (_a3.multipleOf = def.value);
|
|
1058
|
-
});
|
|
1059
1359
|
inst._zod.check = (payload) => {
|
|
1060
1360
|
if (typeof payload.value !== typeof def.value)
|
|
1061
1361
|
throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
1062
|
-
const isMultiple = typeof payload.value === "bigint" ?
|
|
1362
|
+
const isMultiple = typeof payload.value === "bigint" ? (
|
|
1363
|
+
// `value % 0n` throws, and nothing is a multiple of zero — the number branch already fails this way via NaN
|
|
1364
|
+
def.value !== BigInt(0) && payload.value % def.value === BigInt(0)
|
|
1365
|
+
) : floatSafeRemainder(payload.value, def.value) === 0;
|
|
1063
1366
|
if (isMultiple)
|
|
1064
1367
|
return;
|
|
1065
1368
|
payload.issues.push({
|
|
@@ -1078,14 +1381,6 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
1078
1381
|
const isInt = def.format?.includes("int");
|
|
1079
1382
|
const origin = isInt ? "int" : "number";
|
|
1080
1383
|
const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
|
|
1081
|
-
inst._zod.onattach.push((inst2) => {
|
|
1082
|
-
const bag = inst2._zod.bag;
|
|
1083
|
-
bag.format = def.format;
|
|
1084
|
-
bag.minimum = minimum;
|
|
1085
|
-
bag.maximum = maximum;
|
|
1086
|
-
if (isInt)
|
|
1087
|
-
bag.pattern = integer;
|
|
1088
|
-
});
|
|
1089
1384
|
inst._zod.check = (payload) => {
|
|
1090
1385
|
const input = payload.value;
|
|
1091
1386
|
if (isInt) {
|
|
@@ -1154,18 +1449,11 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
1154
1449
|
var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
1155
1450
|
var _a3;
|
|
1156
1451
|
$ZodCheck.init(inst, def);
|
|
1157
|
-
(_a3 = inst._zod.def).when ?? (_a3.when =
|
|
1158
|
-
const val = payload.value;
|
|
1159
|
-
return !nullish(val) && val.length !== void 0;
|
|
1160
|
-
});
|
|
1161
|
-
inst._zod.onattach.push((inst2) => {
|
|
1162
|
-
const curr = inst2._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
1163
|
-
if (def.maximum < curr)
|
|
1164
|
-
inst2._zod.bag.maximum = def.maximum;
|
|
1165
|
-
});
|
|
1452
|
+
(_a3 = inst._zod.def).when ?? (_a3.when = _whenHasLength);
|
|
1166
1453
|
inst._zod.check = (payload) => {
|
|
1167
1454
|
const input = payload.value;
|
|
1168
|
-
const
|
|
1455
|
+
const units = input.length;
|
|
1456
|
+
const length = typeof input === "string" && units > def.maximum ? codePointLength(input) : units;
|
|
1169
1457
|
if (length <= def.maximum)
|
|
1170
1458
|
return;
|
|
1171
1459
|
const origin = getLengthableOrigin(input);
|
|
@@ -1183,18 +1471,11 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
|
|
|
1183
1471
|
var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
1184
1472
|
var _a3;
|
|
1185
1473
|
$ZodCheck.init(inst, def);
|
|
1186
|
-
(_a3 = inst._zod.def).when ?? (_a3.when =
|
|
1187
|
-
const val = payload.value;
|
|
1188
|
-
return !nullish(val) && val.length !== void 0;
|
|
1189
|
-
});
|
|
1190
|
-
inst._zod.onattach.push((inst2) => {
|
|
1191
|
-
const curr = inst2._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
1192
|
-
if (def.minimum > curr)
|
|
1193
|
-
inst2._zod.bag.minimum = def.minimum;
|
|
1194
|
-
});
|
|
1474
|
+
(_a3 = inst._zod.def).when ?? (_a3.when = _whenHasLength);
|
|
1195
1475
|
inst._zod.check = (payload) => {
|
|
1196
1476
|
const input = payload.value;
|
|
1197
|
-
const
|
|
1477
|
+
const units = input.length;
|
|
1478
|
+
const length = typeof input === "string" && units >= def.minimum && units < def.minimum * 2 ? codePointLength(input) : units;
|
|
1198
1479
|
if (length >= def.minimum)
|
|
1199
1480
|
return;
|
|
1200
1481
|
const origin = getLengthableOrigin(input);
|
|
@@ -1212,19 +1493,11 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
|
|
|
1212
1493
|
var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
1213
1494
|
var _a3;
|
|
1214
1495
|
$ZodCheck.init(inst, def);
|
|
1215
|
-
(_a3 = inst._zod.def).when ?? (_a3.when =
|
|
1216
|
-
const val = payload.value;
|
|
1217
|
-
return !nullish(val) && val.length !== void 0;
|
|
1218
|
-
});
|
|
1219
|
-
inst._zod.onattach.push((inst2) => {
|
|
1220
|
-
const bag = inst2._zod.bag;
|
|
1221
|
-
bag.minimum = def.length;
|
|
1222
|
-
bag.maximum = def.length;
|
|
1223
|
-
bag.length = def.length;
|
|
1224
|
-
});
|
|
1496
|
+
(_a3 = inst._zod.def).when ?? (_a3.when = _whenHasLength);
|
|
1225
1497
|
inst._zod.check = (payload) => {
|
|
1226
1498
|
const input = payload.value;
|
|
1227
|
-
const
|
|
1499
|
+
const units = input.length;
|
|
1500
|
+
const length = typeof input === "string" && units >= def.length && units <= def.length * 2 ? codePointLength(input) : units;
|
|
1228
1501
|
if (length === def.length)
|
|
1229
1502
|
return;
|
|
1230
1503
|
const origin = getLengthableOrigin(input);
|
|
@@ -1243,14 +1516,6 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
|
|
|
1243
1516
|
var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
1244
1517
|
var _a3, _b;
|
|
1245
1518
|
$ZodCheck.init(inst, def);
|
|
1246
|
-
inst._zod.onattach.push((inst2) => {
|
|
1247
|
-
const bag = inst2._zod.bag;
|
|
1248
|
-
bag.format = def.format;
|
|
1249
|
-
if (def.pattern) {
|
|
1250
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1251
|
-
bag.patterns.add(def.pattern);
|
|
1252
|
-
}
|
|
1253
|
-
});
|
|
1254
1519
|
if (def.pattern)
|
|
1255
1520
|
(_a3 = inst._zod).check ?? (_a3.check = (payload) => {
|
|
1256
1521
|
def.pattern.lastIndex = 0;
|
|
@@ -1298,13 +1563,8 @@ var $ZodCheckUpperCase = /* @__PURE__ */ $constructor("$ZodCheckUpperCase", (ins
|
|
|
1298
1563
|
var $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst, def) => {
|
|
1299
1564
|
$ZodCheck.init(inst, def);
|
|
1300
1565
|
const escapedRegex = escapeRegex(def.includes);
|
|
1301
|
-
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
|
|
1566
|
+
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position},}${escapedRegex}` : escapedRegex);
|
|
1302
1567
|
def.pattern = pattern;
|
|
1303
|
-
inst._zod.onattach.push((inst2) => {
|
|
1304
|
-
const bag = inst2._zod.bag;
|
|
1305
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1306
|
-
bag.patterns.add(pattern);
|
|
1307
|
-
});
|
|
1308
1568
|
inst._zod.check = (payload) => {
|
|
1309
1569
|
if (payload.value.includes(def.includes, def.position))
|
|
1310
1570
|
return;
|
|
@@ -1323,11 +1583,6 @@ var $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (i
|
|
|
1323
1583
|
$ZodCheck.init(inst, def);
|
|
1324
1584
|
const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
|
|
1325
1585
|
def.pattern ?? (def.pattern = pattern);
|
|
1326
|
-
inst._zod.onattach.push((inst2) => {
|
|
1327
|
-
const bag = inst2._zod.bag;
|
|
1328
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1329
|
-
bag.patterns.add(pattern);
|
|
1330
|
-
});
|
|
1331
1586
|
inst._zod.check = (payload) => {
|
|
1332
1587
|
if (payload.value.startsWith(def.prefix))
|
|
1333
1588
|
return;
|
|
@@ -1346,11 +1601,6 @@ var $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst,
|
|
|
1346
1601
|
$ZodCheck.init(inst, def);
|
|
1347
1602
|
const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
|
|
1348
1603
|
def.pattern ?? (def.pattern = pattern);
|
|
1349
|
-
inst._zod.onattach.push((inst2) => {
|
|
1350
|
-
const bag = inst2._zod.bag;
|
|
1351
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1352
|
-
bag.patterns.add(pattern);
|
|
1353
|
-
});
|
|
1354
1604
|
inst._zod.check = (payload) => {
|
|
1355
1605
|
if (payload.value.endsWith(def.suffix))
|
|
1356
1606
|
return;
|
|
@@ -1374,16 +1624,20 @@ var $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (ins
|
|
|
1374
1624
|
|
|
1375
1625
|
// node_modules/zod/v4/core/doc.js
|
|
1376
1626
|
var Doc = class {
|
|
1377
|
-
constructor(args = []) {
|
|
1627
|
+
constructor(args = [], closed = {}) {
|
|
1378
1628
|
this.content = [];
|
|
1379
1629
|
this.indent = 0;
|
|
1380
|
-
|
|
1381
|
-
|
|
1630
|
+
this.args = args;
|
|
1631
|
+
this.closed = closed;
|
|
1382
1632
|
}
|
|
1633
|
+
// the compiler catches a child's throw and keeps writing into this doc, so the indent has to unwind with it
|
|
1383
1634
|
indented(fn) {
|
|
1384
1635
|
this.indent += 1;
|
|
1385
|
-
|
|
1386
|
-
|
|
1636
|
+
try {
|
|
1637
|
+
fn(this);
|
|
1638
|
+
} finally {
|
|
1639
|
+
this.indent -= 1;
|
|
1640
|
+
}
|
|
1387
1641
|
}
|
|
1388
1642
|
write(arg) {
|
|
1389
1643
|
if (typeof arg === "function") {
|
|
@@ -1401,18 +1655,19 @@ var Doc = class {
|
|
|
1401
1655
|
}
|
|
1402
1656
|
compile() {
|
|
1403
1657
|
const F = Function;
|
|
1404
|
-
const args = this?.args;
|
|
1405
1658
|
const content = this?.content ?? [``];
|
|
1406
|
-
const
|
|
1407
|
-
|
|
1659
|
+
const factory = new F(...Object.keys(this.closed), `return function (${this.args.join(", ")}) {
|
|
1660
|
+
${content.join("\n")}
|
|
1661
|
+
};`);
|
|
1662
|
+
return factory(...Object.values(this.closed));
|
|
1408
1663
|
}
|
|
1409
1664
|
};
|
|
1410
1665
|
|
|
1411
1666
|
// node_modules/zod/v4/core/versions.js
|
|
1412
1667
|
var version = {
|
|
1413
1668
|
major: 4,
|
|
1414
|
-
minor:
|
|
1415
|
-
patch:
|
|
1669
|
+
minor: 6,
|
|
1670
|
+
patch: 7
|
|
1416
1671
|
};
|
|
1417
1672
|
|
|
1418
1673
|
// node_modules/zod/v4/core/schemas.js
|
|
@@ -1422,10 +1677,8 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
1422
1677
|
inst._zod.def = def;
|
|
1423
1678
|
inst._zod.bag = inst._zod.bag || {};
|
|
1424
1679
|
inst._zod.version = version;
|
|
1425
|
-
const
|
|
1426
|
-
|
|
1427
|
-
checks.unshift(inst);
|
|
1428
|
-
}
|
|
1680
|
+
const defChecks = inst._zod.def.checks;
|
|
1681
|
+
const checks = inst._zod.traits.has("$ZodCheck") ? [inst, ...defChecks ?? []] : defChecks?.length ? [...defChecks] : [];
|
|
1429
1682
|
for (const ch of checks) {
|
|
1430
1683
|
for (const fn of ch._zod.onattach) {
|
|
1431
1684
|
fn(inst);
|
|
@@ -1438,6 +1691,8 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
1438
1691
|
});
|
|
1439
1692
|
} else {
|
|
1440
1693
|
const runChecks = (payload, checks2, ctx) => {
|
|
1694
|
+
if (payload.memo)
|
|
1695
|
+
return payload;
|
|
1441
1696
|
let isAborted = aborted(payload);
|
|
1442
1697
|
let asyncResult;
|
|
1443
1698
|
for (const ch of checks2) {
|
|
@@ -1461,6 +1716,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
1461
1716
|
const nextLen = payload.issues.length;
|
|
1462
1717
|
if (nextLen === currLen)
|
|
1463
1718
|
return;
|
|
1719
|
+
attachSchema(payload.issues, currLen, inst);
|
|
1464
1720
|
if (!isAborted)
|
|
1465
1721
|
isAborted = aborted(payload, currLen);
|
|
1466
1722
|
});
|
|
@@ -1468,6 +1724,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
1468
1724
|
const nextLen = payload.issues.length;
|
|
1469
1725
|
if (nextLen === currLen)
|
|
1470
1726
|
continue;
|
|
1727
|
+
attachSchema(payload.issues, currLen, inst);
|
|
1471
1728
|
if (!isAborted)
|
|
1472
1729
|
isAborted = aborted(payload, currLen);
|
|
1473
1730
|
}
|
|
@@ -1514,22 +1771,39 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
1514
1771
|
return runChecks(result, checks, ctx);
|
|
1515
1772
|
};
|
|
1516
1773
|
}
|
|
1517
|
-
|
|
1774
|
+
}, {
|
|
1775
|
+
// Wrappers extend this by installing a richer factory over it; reading it eagerly would defeat the laziness.
|
|
1776
|
+
get "~standard"() {
|
|
1777
|
+
return hide(this, "~standard", standardProps(this));
|
|
1778
|
+
},
|
|
1779
|
+
set "~standard"(value) {
|
|
1780
|
+
own(this, "~standard", value);
|
|
1781
|
+
}
|
|
1782
|
+
});
|
|
1783
|
+
var toStandardResult = (r, ctx) => r.issues.length ? { issues: r.issues.map((iss) => finalizeIssue(iss, ctx, config())) } : { value: r.value };
|
|
1784
|
+
async function validateAsync2(inst, value) {
|
|
1785
|
+
const ctx = { async: true };
|
|
1786
|
+
return toStandardResult(await inst._zod.run({ value, issues: [] }, ctx), ctx);
|
|
1787
|
+
}
|
|
1788
|
+
function standardProps(inst) {
|
|
1789
|
+
return {
|
|
1518
1790
|
validate: (value) => {
|
|
1791
|
+
const ctx = { async: false };
|
|
1519
1792
|
try {
|
|
1520
|
-
const r =
|
|
1521
|
-
|
|
1793
|
+
const r = inst._zod.run({ value, issues: [] }, ctx);
|
|
1794
|
+
if (!(r instanceof Promise))
|
|
1795
|
+
return toStandardResult(r, ctx);
|
|
1522
1796
|
} catch (_) {
|
|
1523
|
-
return safeParseAsync(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
|
|
1524
1797
|
}
|
|
1798
|
+
return validateAsync2(inst, value);
|
|
1525
1799
|
},
|
|
1526
1800
|
vendor: "zod",
|
|
1527
1801
|
version: 1
|
|
1528
|
-
}
|
|
1529
|
-
}
|
|
1802
|
+
};
|
|
1803
|
+
}
|
|
1530
1804
|
var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
|
|
1531
1805
|
$ZodType.init(inst, def);
|
|
1532
|
-
inst._zod.pattern =
|
|
1806
|
+
inst._zod.pattern = def.pattern ?? anyString;
|
|
1533
1807
|
inst._zod.parse = (payload, _) => {
|
|
1534
1808
|
if (def.coerce)
|
|
1535
1809
|
try {
|
|
@@ -1579,58 +1853,105 @@ var $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => {
|
|
|
1579
1853
|
def.pattern ?? (def.pattern = email);
|
|
1580
1854
|
$ZodStringFormat.init(inst, def);
|
|
1581
1855
|
});
|
|
1856
|
+
var URL_BAD_FORMAT = 1;
|
|
1857
|
+
var URL_UNPARSEABLE = 2;
|
|
1858
|
+
function canParseURL(input) {
|
|
1859
|
+
try {
|
|
1860
|
+
if (typeof URL !== "undefined" && typeof URL.canParse === "function")
|
|
1861
|
+
return URL.canParse(input);
|
|
1862
|
+
new URL(input);
|
|
1863
|
+
return true;
|
|
1864
|
+
} catch {
|
|
1865
|
+
return false;
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1868
|
+
function validateURL(trimmed, def) {
|
|
1869
|
+
if (!("normalize" in def) && !("hostname" in def) && !("protocol" in def)) {
|
|
1870
|
+
return canParseURL(trimmed) || URL_UNPARSEABLE;
|
|
1871
|
+
}
|
|
1872
|
+
return parseURLObject(trimmed, def);
|
|
1873
|
+
}
|
|
1874
|
+
function parseURLObject(trimmed, def) {
|
|
1875
|
+
if (!def.normalize && def.protocol?.source === httpProtocol.source && !/^https?:\/\//i.test(trimmed)) {
|
|
1876
|
+
return URL_BAD_FORMAT;
|
|
1877
|
+
}
|
|
1878
|
+
try {
|
|
1879
|
+
if (typeof URL !== "undefined") {
|
|
1880
|
+
const URLStatic = URL;
|
|
1881
|
+
if (typeof URLStatic.parse === "function")
|
|
1882
|
+
return URLStatic.parse(trimmed) ?? URL_UNPARSEABLE;
|
|
1883
|
+
}
|
|
1884
|
+
return new URL(trimmed);
|
|
1885
|
+
} catch {
|
|
1886
|
+
return URL_UNPARSEABLE;
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1889
|
+
var asciiTabOrNewline = /[\t\n\r]/g;
|
|
1890
|
+
function stripTabAndNewline(value) {
|
|
1891
|
+
return value.replace(asciiTabOrNewline, "");
|
|
1892
|
+
}
|
|
1893
|
+
function urlHostnameOk(url, hostname) {
|
|
1894
|
+
hostname.lastIndex = 0;
|
|
1895
|
+
return hostname.test(url.hostname);
|
|
1896
|
+
}
|
|
1897
|
+
function urlProtocolOk(url, protocol) {
|
|
1898
|
+
protocol.lastIndex = 0;
|
|
1899
|
+
return protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol);
|
|
1900
|
+
}
|
|
1582
1901
|
var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
1583
1902
|
$ZodStringFormat.init(inst, def);
|
|
1584
1903
|
inst._zod.check = (payload) => {
|
|
1585
1904
|
try {
|
|
1586
1905
|
const trimmed = payload.value.trim();
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
}
|
|
1906
|
+
const url = validateURL(trimmed, def);
|
|
1907
|
+
if (url === URL_BAD_FORMAT) {
|
|
1908
|
+
payload.issues.push({
|
|
1909
|
+
code: "invalid_format",
|
|
1910
|
+
format: "url",
|
|
1911
|
+
note: "Invalid URL format",
|
|
1912
|
+
input: payload.value,
|
|
1913
|
+
inst,
|
|
1914
|
+
continue: !def.abort
|
|
1915
|
+
});
|
|
1916
|
+
return;
|
|
1599
1917
|
}
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
payload.
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
input: payload.value,
|
|
1610
|
-
inst,
|
|
1611
|
-
continue: !def.abort
|
|
1612
|
-
});
|
|
1613
|
-
}
|
|
1918
|
+
if (url === URL_UNPARSEABLE) {
|
|
1919
|
+
payload.issues.push({
|
|
1920
|
+
code: "invalid_format",
|
|
1921
|
+
format: "url",
|
|
1922
|
+
input: payload.value,
|
|
1923
|
+
inst,
|
|
1924
|
+
continue: !def.abort
|
|
1925
|
+
});
|
|
1926
|
+
return;
|
|
1614
1927
|
}
|
|
1615
|
-
if (
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
payload.issues.push({
|
|
1619
|
-
code: "invalid_format",
|
|
1620
|
-
format: "url",
|
|
1621
|
-
note: "Invalid protocol",
|
|
1622
|
-
pattern: def.protocol.source,
|
|
1623
|
-
input: payload.value,
|
|
1624
|
-
inst,
|
|
1625
|
-
continue: !def.abort
|
|
1626
|
-
});
|
|
1627
|
-
}
|
|
1928
|
+
if (url === true) {
|
|
1929
|
+
payload.value = stripTabAndNewline(trimmed);
|
|
1930
|
+
return;
|
|
1628
1931
|
}
|
|
1629
|
-
if (def.
|
|
1630
|
-
payload.
|
|
1631
|
-
|
|
1632
|
-
|
|
1932
|
+
if (def.hostname && !urlHostnameOk(url, def.hostname)) {
|
|
1933
|
+
payload.issues.push({
|
|
1934
|
+
code: "invalid_format",
|
|
1935
|
+
format: "url",
|
|
1936
|
+
note: "Invalid hostname",
|
|
1937
|
+
pattern: def.hostname.source,
|
|
1938
|
+
input: payload.value,
|
|
1939
|
+
inst,
|
|
1940
|
+
continue: !def.abort
|
|
1941
|
+
});
|
|
1942
|
+
}
|
|
1943
|
+
if (def.protocol && !urlProtocolOk(url, def.protocol)) {
|
|
1944
|
+
payload.issues.push({
|
|
1945
|
+
code: "invalid_format",
|
|
1946
|
+
format: "url",
|
|
1947
|
+
note: "Invalid protocol",
|
|
1948
|
+
pattern: def.protocol.source,
|
|
1949
|
+
input: payload.value,
|
|
1950
|
+
inst,
|
|
1951
|
+
continue: !def.abort
|
|
1952
|
+
});
|
|
1633
1953
|
}
|
|
1954
|
+
payload.value = def.normalize ? url.href : stripTabAndNewline(trimmed);
|
|
1634
1955
|
return;
|
|
1635
1956
|
} catch (_) {
|
|
1636
1957
|
payload.issues.push({
|
|
@@ -1648,7 +1969,9 @@ var $ZodEmoji = /* @__PURE__ */ $constructor("$ZodEmoji", (inst, def) => {
|
|
|
1648
1969
|
$ZodStringFormat.init(inst, def);
|
|
1649
1970
|
});
|
|
1650
1971
|
var $ZodNanoID = /* @__PURE__ */ $constructor("$ZodNanoID", (inst, def) => {
|
|
1651
|
-
def.
|
|
1972
|
+
if (def.length !== void 0 && (!Number.isInteger(def.length) || def.length < 1))
|
|
1973
|
+
throw new Error(`Invalid nanoid length: ${def.length}`);
|
|
1974
|
+
def.pattern ?? (def.pattern = def.length === void 0 ? nanoid : nanoidOfLength(def.length));
|
|
1652
1975
|
$ZodStringFormat.init(inst, def);
|
|
1653
1976
|
});
|
|
1654
1977
|
var $ZodCUID = /* @__PURE__ */ $constructor("$ZodCUID", (inst, def) => {
|
|
@@ -1690,16 +2013,18 @@ var $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def
|
|
|
1690
2013
|
var $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
|
|
1691
2014
|
def.pattern ?? (def.pattern = ipv4);
|
|
1692
2015
|
$ZodStringFormat.init(inst, def);
|
|
1693
|
-
inst._zod.bag.format = `ipv4`;
|
|
1694
2016
|
});
|
|
2017
|
+
var ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
|
|
2018
|
+
function isValidIPv6(value) {
|
|
2019
|
+
if (!ipv6Alphabet.test(value))
|
|
2020
|
+
return false;
|
|
2021
|
+
return canParseURL(`http://[${value}]`);
|
|
2022
|
+
}
|
|
1695
2023
|
var $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
|
|
1696
2024
|
def.pattern ?? (def.pattern = ipv6);
|
|
1697
2025
|
$ZodStringFormat.init(inst, def);
|
|
1698
|
-
inst._zod.bag.format = `ipv6`;
|
|
1699
2026
|
inst._zod.check = (payload) => {
|
|
1700
|
-
|
|
1701
|
-
new URL(`http://[${payload.value}]`);
|
|
1702
|
-
} catch {
|
|
2027
|
+
if (!isValidIPv6(payload.value)) {
|
|
1703
2028
|
payload.issues.push({
|
|
1704
2029
|
code: "invalid_format",
|
|
1705
2030
|
format: "ipv6",
|
|
@@ -1714,24 +2039,25 @@ var $ZodCIDRv4 = /* @__PURE__ */ $constructor("$ZodCIDRv4", (inst, def) => {
|
|
|
1714
2039
|
def.pattern ?? (def.pattern = cidrv4);
|
|
1715
2040
|
$ZodStringFormat.init(inst, def);
|
|
1716
2041
|
});
|
|
2042
|
+
function isValidCIDRv6(value) {
|
|
2043
|
+
const parts = value.split("/");
|
|
2044
|
+
if (parts.length !== 2)
|
|
2045
|
+
return false;
|
|
2046
|
+
const [address, prefix] = parts;
|
|
2047
|
+
if (!prefix)
|
|
2048
|
+
return false;
|
|
2049
|
+
const prefixNum = Number(prefix);
|
|
2050
|
+
if (`${prefixNum}` !== prefix)
|
|
2051
|
+
return false;
|
|
2052
|
+
if (prefixNum < 0 || prefixNum > 128)
|
|
2053
|
+
return false;
|
|
2054
|
+
return isValidIPv6(address);
|
|
2055
|
+
}
|
|
1717
2056
|
var $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
|
|
1718
2057
|
def.pattern ?? (def.pattern = cidrv6);
|
|
1719
2058
|
$ZodStringFormat.init(inst, def);
|
|
1720
2059
|
inst._zod.check = (payload) => {
|
|
1721
|
-
|
|
1722
|
-
try {
|
|
1723
|
-
if (parts.length !== 2)
|
|
1724
|
-
throw new Error();
|
|
1725
|
-
const [address, prefix] = parts;
|
|
1726
|
-
if (!prefix)
|
|
1727
|
-
throw new Error();
|
|
1728
|
-
const prefixNum = Number(prefix);
|
|
1729
|
-
if (`${prefixNum}` !== prefix)
|
|
1730
|
-
throw new Error();
|
|
1731
|
-
if (prefixNum < 0 || prefixNum > 128)
|
|
1732
|
-
throw new Error();
|
|
1733
|
-
new URL(`http://[${address}]`);
|
|
1734
|
-
} catch {
|
|
2060
|
+
if (!isValidCIDRv6(payload.value)) {
|
|
1735
2061
|
payload.issues.push({
|
|
1736
2062
|
code: "invalid_format",
|
|
1737
2063
|
format: "cidrv6",
|
|
@@ -1756,10 +2082,10 @@ function isValidBase64(data) {
|
|
|
1756
2082
|
return false;
|
|
1757
2083
|
}
|
|
1758
2084
|
}
|
|
2085
|
+
var base64Charset = /^[0-9a-zA-Z+/]*={0,2}$/;
|
|
1759
2086
|
var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
1760
|
-
def.pattern ?? (def.pattern =
|
|
2087
|
+
def.pattern ?? (def.pattern = base64Charset);
|
|
1761
2088
|
$ZodStringFormat.init(inst, def);
|
|
1762
|
-
inst._zod.bag.contentEncoding = "base64";
|
|
1763
2089
|
inst._zod.check = (payload) => {
|
|
1764
2090
|
if (isValidBase64(payload.value))
|
|
1765
2091
|
return;
|
|
@@ -1772,17 +2098,17 @@ var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
|
1772
2098
|
});
|
|
1773
2099
|
};
|
|
1774
2100
|
});
|
|
2101
|
+
var base64urlCharset = /^[A-Za-z0-9_-]*$/;
|
|
1775
2102
|
function isValidBase64URL(data) {
|
|
1776
|
-
if (!
|
|
2103
|
+
if (!base64urlCharset.test(data))
|
|
1777
2104
|
return false;
|
|
1778
2105
|
const base642 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
|
|
1779
2106
|
const padded = base642.padEnd(Math.ceil(base642.length / 4) * 4, "=");
|
|
1780
2107
|
return isValidBase64(padded);
|
|
1781
2108
|
}
|
|
1782
2109
|
var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
|
|
1783
|
-
def.pattern ?? (def.pattern =
|
|
2110
|
+
def.pattern ?? (def.pattern = base64urlCharset);
|
|
1784
2111
|
$ZodStringFormat.init(inst, def);
|
|
1785
|
-
inst._zod.bag.contentEncoding = "base64url";
|
|
1786
2112
|
inst._zod.check = (payload) => {
|
|
1787
2113
|
if (isValidBase64URL(payload.value))
|
|
1788
2114
|
return;
|
|
@@ -1835,7 +2161,7 @@ var $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
|
|
|
1835
2161
|
});
|
|
1836
2162
|
var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
1837
2163
|
$ZodType.init(inst, def);
|
|
1838
|
-
inst._zod.pattern =
|
|
2164
|
+
inst._zod.pattern = number;
|
|
1839
2165
|
inst._zod.parse = (payload, _ctx) => {
|
|
1840
2166
|
if (def.coerce)
|
|
1841
2167
|
try {
|
|
@@ -1846,7 +2172,7 @@ var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
|
1846
2172
|
if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
|
|
1847
2173
|
return payload;
|
|
1848
2174
|
}
|
|
1849
|
-
const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ?
|
|
2175
|
+
const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? String(input) : void 0 : void 0;
|
|
1850
2176
|
payload.issues.push({
|
|
1851
2177
|
expected: "number",
|
|
1852
2178
|
code: "invalid_type",
|
|
@@ -1877,6 +2203,29 @@ var $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
|
|
|
1877
2203
|
return payload;
|
|
1878
2204
|
};
|
|
1879
2205
|
});
|
|
2206
|
+
function capSize(inst, size) {
|
|
2207
|
+
const caps = sizeCaps(inst._zod.def.checks);
|
|
2208
|
+
if (!caps.length)
|
|
2209
|
+
return;
|
|
2210
|
+
const cap = Math.min(...caps.map((c) => c[0]));
|
|
2211
|
+
const parse2 = inst._zod.parse;
|
|
2212
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2213
|
+
const n = size(payload.value);
|
|
2214
|
+
if (n > cap && !ctx?.skipChecks && ctx?.direction !== "backward") {
|
|
2215
|
+
for (const [max, ch] of sizeCaps(inst._zod.def.checks)) {
|
|
2216
|
+
if (n > max && ch._zod.def.when(payload)) {
|
|
2217
|
+
const start = payload.issues.length;
|
|
2218
|
+
ch._zod.check(payload);
|
|
2219
|
+
payload.issues[start].continue = false;
|
|
2220
|
+
attachSchema(payload.issues, start, inst);
|
|
2221
|
+
return payload;
|
|
2222
|
+
}
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2225
|
+
return parse2(payload, ctx);
|
|
2226
|
+
};
|
|
2227
|
+
}
|
|
2228
|
+
var arraySize = (input) => Array.isArray(input) ? input.length : -1;
|
|
1880
2229
|
function handleArrayResult(result, final, index) {
|
|
1881
2230
|
if (result.issues.length) {
|
|
1882
2231
|
final.issues.push(...prefixIssues(index, result.issues));
|
|
@@ -1885,6 +2234,8 @@ function handleArrayResult(result, final, index) {
|
|
|
1885
2234
|
}
|
|
1886
2235
|
var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
1887
2236
|
$ZodType.init(inst, def);
|
|
2237
|
+
const memo2 = globalConfig.memoizer;
|
|
2238
|
+
memo2?.attach(inst);
|
|
1888
2239
|
inst._zod.parse = (payload, ctx) => {
|
|
1889
2240
|
const input = payload.value;
|
|
1890
2241
|
if (!Array.isArray(input)) {
|
|
@@ -1896,8 +2247,9 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
1896
2247
|
});
|
|
1897
2248
|
return payload;
|
|
1898
2249
|
}
|
|
1899
|
-
payload.value = Array(input.length);
|
|
2250
|
+
payload.value = memo2 ? memo2.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
|
|
1900
2251
|
const proms = [];
|
|
2252
|
+
const abortEarly = ctx?.abortEarly;
|
|
1901
2253
|
for (let i = 0; i < input.length; i++) {
|
|
1902
2254
|
const item = input[i];
|
|
1903
2255
|
const result = def.element._zod.run({
|
|
@@ -1908,6 +2260,8 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
1908
2260
|
proms.push(result.then((result2) => handleArrayResult(result2, payload, i)));
|
|
1909
2261
|
} else {
|
|
1910
2262
|
handleArrayResult(result, payload, i);
|
|
2263
|
+
if (abortEarly && result.issues.length !== 0 && aborted(result))
|
|
2264
|
+
break;
|
|
1911
2265
|
}
|
|
1912
2266
|
}
|
|
1913
2267
|
if (proms.length) {
|
|
@@ -1915,16 +2269,21 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
1915
2269
|
}
|
|
1916
2270
|
return payload;
|
|
1917
2271
|
};
|
|
2272
|
+
capSize(inst, arraySize);
|
|
1918
2273
|
});
|
|
1919
|
-
function handlePropertyResult(result, final, key, input,
|
|
2274
|
+
function handlePropertyResult(result, final, key, input, optin, optout) {
|
|
1920
2275
|
const isPresent = key in input;
|
|
2276
|
+
const isOptionalOut = optout === "optional";
|
|
2277
|
+
if (!isPresent && isOptionalOut && optin === "optional") {
|
|
2278
|
+
return;
|
|
2279
|
+
}
|
|
1921
2280
|
if (result.issues.length) {
|
|
1922
|
-
if (
|
|
2281
|
+
if (optin !== void 0 && isOptionalOut && !isPresent) {
|
|
1923
2282
|
return;
|
|
1924
2283
|
}
|
|
1925
2284
|
final.issues.push(...prefixIssues(key, result.issues));
|
|
1926
2285
|
}
|
|
1927
|
-
if (!isPresent &&
|
|
2286
|
+
if (!isPresent && optin === void 0) {
|
|
1928
2287
|
if (!result.issues.length) {
|
|
1929
2288
|
final.issues.push({
|
|
1930
2289
|
code: "invalid_type",
|
|
@@ -1936,50 +2295,65 @@ function handlePropertyResult(result, final, key, input, isOptionalIn, isOptiona
|
|
|
1936
2295
|
return;
|
|
1937
2296
|
}
|
|
1938
2297
|
if (result.value === void 0) {
|
|
1939
|
-
if (isPresent) {
|
|
2298
|
+
if (isPresent || optin === "defaulted" && !isOptionalOut) {
|
|
1940
2299
|
final.value[key] = void 0;
|
|
1941
2300
|
}
|
|
1942
2301
|
} else {
|
|
1943
2302
|
final.value[key] = result.value;
|
|
1944
2303
|
}
|
|
1945
2304
|
}
|
|
2305
|
+
var NO_SYMBOL_KEYS = [];
|
|
1946
2306
|
function normalizeDef(def) {
|
|
1947
2307
|
const keys = Object.keys(def.shape);
|
|
1948
|
-
|
|
2308
|
+
const ownSymbols = Object.getOwnPropertySymbols(def.shape);
|
|
2309
|
+
const symbolKeys = ownSymbols.length ? ownSymbols : NO_SYMBOL_KEYS;
|
|
2310
|
+
const allKeys = symbolKeys.length ? [...keys, ...symbolKeys] : keys;
|
|
2311
|
+
for (const k of allKeys) {
|
|
1949
2312
|
if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) {
|
|
1950
|
-
throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
|
|
2313
|
+
throw new Error(`Invalid element at key "${String(k)}": expected a Zod schema`);
|
|
1951
2314
|
}
|
|
1952
2315
|
}
|
|
1953
2316
|
const okeys = optionalKeys(def.shape);
|
|
1954
2317
|
return {
|
|
1955
2318
|
...def,
|
|
1956
|
-
|
|
2319
|
+
allKeys,
|
|
2320
|
+
symbolKeys,
|
|
2321
|
+
// string-only: handleCatchall matches it against `for...in`, which never yields a symbol
|
|
1957
2322
|
keySet: new Set(keys),
|
|
1958
2323
|
numKeys: keys.length,
|
|
1959
2324
|
optionalKeys: new Set(okeys)
|
|
1960
2325
|
};
|
|
1961
2326
|
}
|
|
1962
|
-
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
2327
|
+
function handleCatchall(proms, input, payload, ctx, def, inst, abortEarly) {
|
|
1963
2328
|
const unrecognized = [];
|
|
1964
2329
|
const keySet = def.keySet;
|
|
1965
2330
|
const _catchall = def.catchall._zod;
|
|
1966
2331
|
const t = _catchall.def.type;
|
|
1967
|
-
const
|
|
1968
|
-
const
|
|
2332
|
+
const optin = _catchall.optin;
|
|
2333
|
+
const optout = _catchall.optout;
|
|
2334
|
+
let seen = 0;
|
|
1969
2335
|
for (const key in input) {
|
|
1970
|
-
if (
|
|
1971
|
-
|
|
2336
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
2337
|
+
if (aborted(payload, seen))
|
|
2338
|
+
break;
|
|
2339
|
+
seen = payload.issues.length;
|
|
2340
|
+
}
|
|
1972
2341
|
if (keySet.has(key))
|
|
1973
2342
|
continue;
|
|
2343
|
+
if (key === "__proto__") {
|
|
2344
|
+
if (t === "never")
|
|
2345
|
+
unrecognized.push(key);
|
|
2346
|
+
continue;
|
|
2347
|
+
}
|
|
1974
2348
|
if (t === "never") {
|
|
1975
2349
|
unrecognized.push(key);
|
|
1976
2350
|
continue;
|
|
1977
2351
|
}
|
|
1978
2352
|
const r = _catchall.run({ value: input[key], issues: [] }, ctx);
|
|
1979
2353
|
if (r instanceof Promise) {
|
|
1980
|
-
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input,
|
|
2354
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, optin, optout)));
|
|
1981
2355
|
} else {
|
|
1982
|
-
handlePropertyResult(r, payload, key, input,
|
|
2356
|
+
handlePropertyResult(r, payload, key, input, optin, optout);
|
|
1983
2357
|
}
|
|
1984
2358
|
}
|
|
1985
2359
|
if (unrecognized.length) {
|
|
@@ -1987,7 +2361,9 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
1987
2361
|
code: "unrecognized_keys",
|
|
1988
2362
|
keys: unrecognized,
|
|
1989
2363
|
input,
|
|
1990
|
-
inst
|
|
2364
|
+
inst,
|
|
2365
|
+
// Describes the shape of the input, not the validity of the parsed value, so it never aborts. The parse still fails; the schema's own checks just get to run first, and an enclosing intersection can reconcile the key against a sibling operand.
|
|
2366
|
+
continue: true
|
|
1991
2367
|
});
|
|
1992
2368
|
}
|
|
1993
2369
|
if (!proms.length)
|
|
@@ -1999,28 +2375,31 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
1999
2375
|
var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
2000
2376
|
$ZodType.init(inst, def);
|
|
2001
2377
|
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
});
|
|
2378
|
+
const sh = desc?.get ? desc.get.raw : def.shape ?? {};
|
|
2379
|
+
if (sh) {
|
|
2380
|
+
const get = () => {
|
|
2381
|
+
const newSh = { ...sh };
|
|
2382
|
+
Object.defineProperty(def, "shape", { value: newSh });
|
|
2383
|
+
get.raw = newSh;
|
|
2384
|
+
return newSh;
|
|
2385
|
+
};
|
|
2386
|
+
get.raw = sh;
|
|
2387
|
+
Object.defineProperty(def, "shape", { get });
|
|
2013
2388
|
}
|
|
2014
2389
|
const _normalized = cached(() => normalizeDef(def));
|
|
2015
|
-
|
|
2016
|
-
const shape = def.shape;
|
|
2390
|
+
defineLazyInternal(inst, "propValues", (zod) => {
|
|
2391
|
+
const shape = zod.def.shape;
|
|
2017
2392
|
const propValues = {};
|
|
2018
2393
|
for (const key in shape) {
|
|
2019
2394
|
const field = shape[key]._zod;
|
|
2020
2395
|
if (field.values) {
|
|
2021
|
-
|
|
2396
|
+
if (!Object.prototype.hasOwnProperty.call(propValues, key)) {
|
|
2397
|
+
assignProp(propValues, key, /* @__PURE__ */ new Set());
|
|
2398
|
+
}
|
|
2022
2399
|
for (const v of field.values)
|
|
2023
2400
|
propValues[key].add(v);
|
|
2401
|
+
if (field.optin !== void 0)
|
|
2402
|
+
propValues[key].add(void 0);
|
|
2024
2403
|
}
|
|
2025
2404
|
}
|
|
2026
2405
|
return propValues;
|
|
@@ -2028,6 +2407,8 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
2028
2407
|
const isObject2 = isObject;
|
|
2029
2408
|
const catchall = def.catchall;
|
|
2030
2409
|
let value;
|
|
2410
|
+
const memo2 = globalConfig.memoizer;
|
|
2411
|
+
memo2?.attach(inst);
|
|
2031
2412
|
inst._zod.parse = (payload, ctx) => {
|
|
2032
2413
|
value ?? (value = _normalized.value);
|
|
2033
2414
|
const input = payload.value;
|
|
@@ -2040,79 +2421,93 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
2040
2421
|
});
|
|
2041
2422
|
return payload;
|
|
2042
2423
|
}
|
|
2043
|
-
payload.value = {};
|
|
2424
|
+
payload.value = memo2 ? memo2.alloc(inst, payload, {}, ctx) : {};
|
|
2044
2425
|
const proms = [];
|
|
2045
2426
|
const shape = value.shape;
|
|
2046
|
-
|
|
2427
|
+
const abortEarly = ctx?.abortEarly;
|
|
2428
|
+
let seen = payload.issues.length;
|
|
2429
|
+
for (const key of value.allKeys) {
|
|
2430
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
2431
|
+
if (aborted(payload, seen))
|
|
2432
|
+
break;
|
|
2433
|
+
seen = payload.issues.length;
|
|
2434
|
+
}
|
|
2435
|
+
if (key === "__proto__")
|
|
2436
|
+
continue;
|
|
2047
2437
|
const el = shape[key];
|
|
2048
|
-
const
|
|
2049
|
-
const
|
|
2438
|
+
const optin = el._zod.optin;
|
|
2439
|
+
const optout = el._zod.optout;
|
|
2050
2440
|
const r = el._zod.run({ value: input[key], issues: [] }, ctx);
|
|
2051
2441
|
if (r instanceof Promise) {
|
|
2052
|
-
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input,
|
|
2442
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, optin, optout)));
|
|
2053
2443
|
} else {
|
|
2054
|
-
handlePropertyResult(r, payload, key, input,
|
|
2444
|
+
handlePropertyResult(r, payload, key, input, optin, optout);
|
|
2055
2445
|
}
|
|
2056
2446
|
}
|
|
2057
2447
|
if (!catchall) {
|
|
2058
2448
|
return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
2059
2449
|
}
|
|
2060
|
-
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
2450
|
+
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst, abortEarly === true);
|
|
2061
2451
|
};
|
|
2062
2452
|
});
|
|
2063
2453
|
var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
|
|
2064
2454
|
$ZodObject.init(inst, def);
|
|
2065
2455
|
const superParse = inst._zod.parse;
|
|
2066
2456
|
const _normalized = cached(() => normalizeDef(def));
|
|
2457
|
+
const memo2 = globalConfig.memoizer;
|
|
2067
2458
|
const generateFastpass = (shape) => {
|
|
2068
|
-
const doc = new Doc(["shape", "payload", "ctx"]);
|
|
2069
2459
|
const normalized = _normalized.value;
|
|
2070
|
-
const
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2460
|
+
const syms = normalized.symbolKeys;
|
|
2461
|
+
const doc = new Doc(["payload", "ctx"], { shape, inst, memo: memo2, syms });
|
|
2462
|
+
const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
2463
|
+
const prefixStr = (id, k) => `
|
|
2464
|
+
let ${id}_ab = false;
|
|
2465
|
+
for (let i = 0; i < ${id}.issues.length; i++) {
|
|
2466
|
+
const iss = ${id}.issues[i];
|
|
2467
|
+
iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
|
|
2468
|
+
payload.issues.push(iss);
|
|
2469
|
+
if (iss.continue !== true) ${id}_ab = true;
|
|
2470
|
+
}
|
|
2471
|
+
if (${id}_ab && ctx && ctx.abortEarly) {
|
|
2472
|
+
payload.value = newResult;
|
|
2473
|
+
return payload;
|
|
2474
|
+
}`;
|
|
2074
2475
|
doc.write(`const input = payload.value;`);
|
|
2075
2476
|
const ids = /* @__PURE__ */ Object.create(null);
|
|
2076
2477
|
let counter = 0;
|
|
2077
|
-
for (const key of normalized.
|
|
2478
|
+
for (const key of normalized.allKeys) {
|
|
2078
2479
|
ids[key] = `key_${counter++}`;
|
|
2079
2480
|
}
|
|
2080
|
-
doc.write(`const newResult = {};`);
|
|
2081
|
-
for (const key of normalized.
|
|
2481
|
+
doc.write(memo2 ? `const newResult = memo.alloc(inst, payload, {}, ctx);` : `const newResult = {};`);
|
|
2482
|
+
for (const key of normalized.allKeys) {
|
|
2483
|
+
if (key === "__proto__")
|
|
2484
|
+
continue;
|
|
2082
2485
|
const id = ids[key];
|
|
2083
|
-
const k = esc(key);
|
|
2486
|
+
const k = typeof key === "symbol" ? `syms[${syms.indexOf(key)}]` : esc(key);
|
|
2487
|
+
const isPresent = `${k} in input`;
|
|
2084
2488
|
const schema = shape[key];
|
|
2085
|
-
const
|
|
2489
|
+
const optin = schema?._zod?.optin;
|
|
2490
|
+
const isOptionalIn = optin !== void 0;
|
|
2086
2491
|
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
2087
|
-
doc.write(`const ${id} = ${parseStr(
|
|
2492
|
+
doc.write(`const ${id} = ${parseStr(k)};`);
|
|
2088
2493
|
if (isOptionalIn && isOptionalOut) {
|
|
2494
|
+
const assign = optin === "optional" ? `${id}_present` : `${id}.value !== undefined || ${id}_present`;
|
|
2089
2495
|
doc.write(`
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
...iss,
|
|
2094
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
2095
|
-
})));
|
|
2496
|
+
const ${id}_present = ${isPresent};
|
|
2497
|
+
if (!${id}.issues.length || ${id}_present) {
|
|
2498
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
2096
2499
|
}
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
if (${k} in input) {
|
|
2101
|
-
newResult[${k}] = undefined;
|
|
2500
|
+
|
|
2501
|
+
if (${assign}) {
|
|
2502
|
+
newResult[${k}] = ${id}.value;
|
|
2102
2503
|
}
|
|
2103
|
-
} else {
|
|
2104
|
-
newResult[${k}] = ${id}.value;
|
|
2105
2504
|
}
|
|
2106
|
-
|
|
2505
|
+
|
|
2107
2506
|
`);
|
|
2108
2507
|
} else if (!isOptionalIn) {
|
|
2109
2508
|
doc.write(`
|
|
2110
|
-
const ${id}_present = ${
|
|
2111
|
-
if (${id}.issues.length) {
|
|
2112
|
-
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
2113
|
-
...iss,
|
|
2114
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
2115
|
-
})));
|
|
2509
|
+
const ${id}_present = ${isPresent};
|
|
2510
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
2116
2511
|
}
|
|
2117
2512
|
if (!${id}_present && !${id}.issues.length) {
|
|
2118
2513
|
payload.issues.push({
|
|
@@ -2121,41 +2516,36 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
2121
2516
|
input: undefined,
|
|
2122
2517
|
path: [${k}]
|
|
2123
2518
|
});
|
|
2519
|
+
if (ctx && ctx.abortEarly) {
|
|
2520
|
+
payload.value = newResult;
|
|
2521
|
+
return payload;
|
|
2522
|
+
}
|
|
2124
2523
|
}
|
|
2125
2524
|
|
|
2126
2525
|
if (${id}_present) {
|
|
2127
|
-
|
|
2128
|
-
newResult[${k}] = undefined;
|
|
2129
|
-
} else {
|
|
2130
|
-
newResult[${k}] = ${id}.value;
|
|
2131
|
-
}
|
|
2526
|
+
newResult[${k}] = ${id}.value;
|
|
2132
2527
|
}
|
|
2133
2528
|
|
|
2134
2529
|
`);
|
|
2135
2530
|
} else {
|
|
2136
2531
|
doc.write(`
|
|
2137
|
-
if (${id}.issues.length) {
|
|
2138
|
-
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
2139
|
-
...iss,
|
|
2140
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
2141
|
-
})));
|
|
2532
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
2142
2533
|
}
|
|
2143
|
-
|
|
2144
|
-
if (
|
|
2145
|
-
|
|
2146
|
-
newResult[${k}] = undefined;
|
|
2147
|
-
}
|
|
2534
|
+
`);
|
|
2535
|
+
if (optin === "defaulted") {
|
|
2536
|
+
doc.write(`newResult[${k}] = ${id}.value;`);
|
|
2148
2537
|
} else {
|
|
2538
|
+
doc.write(`
|
|
2539
|
+
if (${id}.value !== undefined || ${isPresent}) {
|
|
2149
2540
|
newResult[${k}] = ${id}.value;
|
|
2150
2541
|
}
|
|
2151
|
-
|
|
2152
2542
|
`);
|
|
2543
|
+
}
|
|
2153
2544
|
}
|
|
2154
2545
|
}
|
|
2155
2546
|
doc.write(`payload.value = newResult;`);
|
|
2156
2547
|
doc.write(`return payload;`);
|
|
2157
|
-
|
|
2158
|
-
return (payload, ctx) => fn(shape, payload, ctx);
|
|
2548
|
+
return doc.compile();
|
|
2159
2549
|
};
|
|
2160
2550
|
let fastpass;
|
|
2161
2551
|
const isObject2 = isObject;
|
|
@@ -2182,7 +2572,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
2182
2572
|
payload = fastpass(payload, ctx);
|
|
2183
2573
|
if (!catchall)
|
|
2184
2574
|
return payload;
|
|
2185
|
-
return handleCatchall([], input, payload, ctx, value, inst);
|
|
2575
|
+
return handleCatchall([], input, payload, ctx, value, inst, ctx?.abortEarly === true);
|
|
2186
2576
|
}
|
|
2187
2577
|
return superParse(payload, ctx);
|
|
2188
2578
|
};
|
|
@@ -2209,17 +2599,17 @@ function handleUnionResults(results, final, inst, ctx) {
|
|
|
2209
2599
|
}
|
|
2210
2600
|
var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
2211
2601
|
$ZodType.init(inst, def);
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
if (def.options.every((o) => o._zod.values)) {
|
|
2216
|
-
return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
2602
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.options.some((o) => o._zod.optin === "defaulted") ? "defaulted" : zod.def.options.some((o) => o._zod.optin !== void 0) ? "optional" : void 0);
|
|
2603
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
|
|
2604
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
2605
|
+
if (zod.def.options.every((o) => o._zod.values)) {
|
|
2606
|
+
return new Set(zod.def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
2217
2607
|
}
|
|
2218
2608
|
return void 0;
|
|
2219
2609
|
});
|
|
2220
|
-
|
|
2221
|
-
if (def.options.every((o) => o._zod.pattern)) {
|
|
2222
|
-
const patterns = def.options.map((o) => o._zod.pattern);
|
|
2610
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
2611
|
+
if (zod.def.options.every((o) => o._zod.pattern)) {
|
|
2612
|
+
const patterns = zod.def.options.map((o) => o._zod.pattern);
|
|
2223
2613
|
return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
|
|
2224
2614
|
}
|
|
2225
2615
|
return void 0;
|
|
@@ -2278,7 +2668,11 @@ function mergeValues(a, b) {
|
|
|
2278
2668
|
const bKeys = Object.keys(b);
|
|
2279
2669
|
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
2280
2670
|
const newObj = { ...a, ...b };
|
|
2671
|
+
if (Object.prototype.hasOwnProperty.call(newObj, "__proto__"))
|
|
2672
|
+
delete newObj.__proto__;
|
|
2281
2673
|
for (const key of sharedKeys) {
|
|
2674
|
+
if (key === "__proto__")
|
|
2675
|
+
continue;
|
|
2282
2676
|
const sharedValue = mergeValues(a[key], b[key]);
|
|
2283
2677
|
if (!sharedValue.valid) {
|
|
2284
2678
|
return {
|
|
@@ -2314,37 +2708,49 @@ function mergeValues(a, b) {
|
|
|
2314
2708
|
function handleIntersectionResults(result, left, right) {
|
|
2315
2709
|
const unrecKeys = /* @__PURE__ */ new Map();
|
|
2316
2710
|
let unrecIssue;
|
|
2317
|
-
|
|
2318
|
-
|
|
2711
|
+
const keyIssues = /* @__PURE__ */ new Map();
|
|
2712
|
+
const collect = (iss, side) => {
|
|
2713
|
+
let keys;
|
|
2714
|
+
if (iss.code === "unrecognized_keys" && !iss.path?.length) {
|
|
2319
2715
|
unrecIssue ?? (unrecIssue = iss);
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2716
|
+
keys = iss.keys;
|
|
2717
|
+
} else if (iss.code === "invalid_key" && iss.origin === "record" && iss.path?.length === 1) {
|
|
2718
|
+
const k = String(iss.path[0]);
|
|
2719
|
+
if (!keyIssues.has(k))
|
|
2720
|
+
keyIssues.set(k, iss);
|
|
2721
|
+
keys = [k];
|
|
2325
2722
|
} else {
|
|
2326
|
-
|
|
2723
|
+
return false;
|
|
2327
2724
|
}
|
|
2725
|
+
for (const k of keys) {
|
|
2726
|
+
if (!unrecKeys.has(k))
|
|
2727
|
+
unrecKeys.set(k, {});
|
|
2728
|
+
unrecKeys.get(k)[side] = true;
|
|
2729
|
+
}
|
|
2730
|
+
return true;
|
|
2731
|
+
};
|
|
2732
|
+
for (const iss of left.issues) {
|
|
2733
|
+
if (!collect(iss, "l"))
|
|
2734
|
+
result.issues.push(iss);
|
|
2328
2735
|
}
|
|
2329
2736
|
for (const iss of right.issues) {
|
|
2330
|
-
if (iss
|
|
2331
|
-
for (const k of iss.keys) {
|
|
2332
|
-
if (!unrecKeys.has(k))
|
|
2333
|
-
unrecKeys.set(k, {});
|
|
2334
|
-
unrecKeys.get(k).r = true;
|
|
2335
|
-
}
|
|
2336
|
-
} else {
|
|
2737
|
+
if (!collect(iss, "r"))
|
|
2337
2738
|
result.issues.push(iss);
|
|
2338
|
-
}
|
|
2339
2739
|
}
|
|
2340
2740
|
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
2341
|
-
if (bothKeys.length
|
|
2342
|
-
|
|
2741
|
+
if (bothKeys.length) {
|
|
2742
|
+
const aggregated = unrecIssue ? bothKeys.filter((k) => unrecIssue.keys.includes(k)) : [];
|
|
2743
|
+
if (aggregated.length)
|
|
2744
|
+
result.issues.push({ ...unrecIssue, keys: aggregated });
|
|
2745
|
+
for (const k of bothKeys) {
|
|
2746
|
+
if (!aggregated.includes(k) && keyIssues.has(k))
|
|
2747
|
+
result.issues.push(keyIssues.get(k));
|
|
2748
|
+
}
|
|
2343
2749
|
}
|
|
2344
|
-
if (aborted(result))
|
|
2345
|
-
return result;
|
|
2346
2750
|
const merged = mergeValues(left.value, right.value);
|
|
2347
2751
|
if (!merged.valid) {
|
|
2752
|
+
if (aborted(result))
|
|
2753
|
+
return result;
|
|
2348
2754
|
throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
|
|
2349
2755
|
}
|
|
2350
2756
|
result.value = merged.data;
|
|
@@ -2355,7 +2761,10 @@ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
|
2355
2761
|
const values = getEnumValues(def.entries);
|
|
2356
2762
|
const valuesSet = new Set(values);
|
|
2357
2763
|
inst._zod.values = valuesSet;
|
|
2358
|
-
inst
|
|
2764
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
2765
|
+
const patternValues = getEnumValues(zod.def.entries).filter((k) => propertyKeyTypes.has(typeof k));
|
|
2766
|
+
return new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
|
|
2767
|
+
});
|
|
2359
2768
|
inst._zod.parse = (payload, _ctx) => {
|
|
2360
2769
|
const input = payload.value;
|
|
2361
2770
|
if (valuesSet.has(input)) {
|
|
@@ -2373,6 +2782,7 @@ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
|
2373
2782
|
var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
|
|
2374
2783
|
$ZodType.init(inst, def);
|
|
2375
2784
|
inst._zod.optin = "optional";
|
|
2785
|
+
globalConfig.memoizer?.guard(inst);
|
|
2376
2786
|
inst._zod.parse = (payload, ctx) => {
|
|
2377
2787
|
if (ctx.direction === "backward") {
|
|
2378
2788
|
throw new $ZodEncodeError(inst.constructor.name);
|
|
@@ -2382,7 +2792,6 @@ var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) =>
|
|
|
2382
2792
|
const output = _out instanceof Promise ? _out : Promise.resolve(_out);
|
|
2383
2793
|
return output.then((output2) => {
|
|
2384
2794
|
payload.value = output2;
|
|
2385
|
-
payload.fallback = true;
|
|
2386
2795
|
return payload;
|
|
2387
2796
|
});
|
|
2388
2797
|
}
|
|
@@ -2390,59 +2799,55 @@ var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) =>
|
|
|
2390
2799
|
throw new $ZodAsyncError();
|
|
2391
2800
|
}
|
|
2392
2801
|
payload.value = _out;
|
|
2393
|
-
payload.fallback = true;
|
|
2394
2802
|
return payload;
|
|
2395
2803
|
};
|
|
2396
2804
|
});
|
|
2397
|
-
function handleOptionalResult(
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
}
|
|
2401
|
-
return result;
|
|
2805
|
+
function handleOptionalResult(payload, result) {
|
|
2806
|
+
payload.value = result.issues.length ? void 0 : result.value;
|
|
2807
|
+
return payload;
|
|
2402
2808
|
}
|
|
2403
2809
|
var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
|
|
2404
2810
|
$ZodType.init(inst, def);
|
|
2405
|
-
inst._zod.optin
|
|
2811
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
|
|
2406
2812
|
inst._zod.optout = "optional";
|
|
2407
|
-
|
|
2408
|
-
|
|
2813
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
2814
|
+
const values = zod.def.innerType._zod.values;
|
|
2815
|
+
return values ? /* @__PURE__ */ new Set([...values, void 0]) : void 0;
|
|
2409
2816
|
});
|
|
2410
|
-
|
|
2411
|
-
const pattern = def.innerType._zod.pattern;
|
|
2817
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
2818
|
+
const pattern = zod.def.innerType._zod.pattern;
|
|
2412
2819
|
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
|
|
2413
2820
|
});
|
|
2414
2821
|
inst._zod.parse = (payload, ctx) => {
|
|
2415
|
-
if (def.innerType._zod.optin === "optional") {
|
|
2416
|
-
const input = payload.value;
|
|
2417
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
2418
|
-
if (result instanceof Promise)
|
|
2419
|
-
return result.then((r) => handleOptionalResult(r, input));
|
|
2420
|
-
return handleOptionalResult(result, input);
|
|
2421
|
-
}
|
|
2422
2822
|
if (payload.value === void 0) {
|
|
2423
|
-
|
|
2823
|
+
if (def.innerType._zod.optin !== "defaulted")
|
|
2824
|
+
return payload;
|
|
2825
|
+
const result = def.innerType._zod.run({ value: payload.value, issues: [] }, ctx);
|
|
2826
|
+
if (result instanceof Promise)
|
|
2827
|
+
return result.then((result2) => handleOptionalResult(payload, result2));
|
|
2828
|
+
return handleOptionalResult(payload, result);
|
|
2424
2829
|
}
|
|
2425
2830
|
return def.innerType._zod.run(payload, ctx);
|
|
2426
2831
|
};
|
|
2427
2832
|
});
|
|
2428
2833
|
var $ZodExactOptional = /* @__PURE__ */ $constructor("$ZodExactOptional", (inst, def) => {
|
|
2429
2834
|
$ZodOptional.init(inst, def);
|
|
2430
|
-
|
|
2431
|
-
|
|
2835
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2836
|
+
defineLazyInternal(inst, "pattern", (zod) => zod.def.innerType._zod.pattern);
|
|
2432
2837
|
inst._zod.parse = (payload, ctx) => {
|
|
2433
2838
|
return def.innerType._zod.run(payload, ctx);
|
|
2434
2839
|
};
|
|
2435
2840
|
});
|
|
2436
2841
|
var $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
|
|
2437
2842
|
$ZodType.init(inst, def);
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
const pattern = def.innerType._zod.pattern;
|
|
2843
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin);
|
|
2844
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
|
|
2845
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
2846
|
+
const pattern = zod.def.innerType._zod.pattern;
|
|
2442
2847
|
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
|
|
2443
2848
|
});
|
|
2444
|
-
|
|
2445
|
-
return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, null]) : void 0;
|
|
2849
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
2850
|
+
return zod.def.innerType._zod.values ? /* @__PURE__ */ new Set([...zod.def.innerType._zod.values, null]) : void 0;
|
|
2446
2851
|
});
|
|
2447
2852
|
inst._zod.parse = (payload, ctx) => {
|
|
2448
2853
|
if (payload.value === null)
|
|
@@ -2452,8 +2857,8 @@ var $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
|
|
|
2452
2857
|
});
|
|
2453
2858
|
var $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
|
|
2454
2859
|
$ZodType.init(inst, def);
|
|
2455
|
-
inst._zod.optin = "
|
|
2456
|
-
|
|
2860
|
+
inst._zod.optin = "defaulted";
|
|
2861
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2457
2862
|
inst._zod.parse = (payload, ctx) => {
|
|
2458
2863
|
if (ctx.direction === "backward") {
|
|
2459
2864
|
return def.innerType._zod.run(payload, ctx);
|
|
@@ -2477,8 +2882,8 @@ function handleDefaultResult(payload, def) {
|
|
|
2477
2882
|
}
|
|
2478
2883
|
var $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
|
|
2479
2884
|
$ZodType.init(inst, def);
|
|
2480
|
-
inst._zod.optin = "
|
|
2481
|
-
|
|
2885
|
+
inst._zod.optin = "defaulted";
|
|
2886
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2482
2887
|
inst._zod.parse = (payload, ctx) => {
|
|
2483
2888
|
if (ctx.direction === "backward") {
|
|
2484
2889
|
return def.innerType._zod.run(payload, ctx);
|
|
@@ -2491,8 +2896,8 @@ var $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
|
|
|
2491
2896
|
});
|
|
2492
2897
|
var $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
|
|
2493
2898
|
$ZodType.init(inst, def);
|
|
2494
|
-
|
|
2495
|
-
const v = def.innerType._zod.values;
|
|
2899
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
2900
|
+
const v = zod.def.innerType._zod.values;
|
|
2496
2901
|
return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
|
|
2497
2902
|
});
|
|
2498
2903
|
inst._zod.parse = (payload, ctx) => {
|
|
@@ -2514,54 +2919,45 @@ function handleNonOptionalResult(payload, inst) {
|
|
|
2514
2919
|
}
|
|
2515
2920
|
return payload;
|
|
2516
2921
|
}
|
|
2922
|
+
function handleCatchResult(payload, result, def, ctx) {
|
|
2923
|
+
if (!result.issues.length) {
|
|
2924
|
+
payload.value = result.value;
|
|
2925
|
+
if (result.memo)
|
|
2926
|
+
payload.memo = true;
|
|
2927
|
+
return payload;
|
|
2928
|
+
}
|
|
2929
|
+
payload.value = def.catchValue({
|
|
2930
|
+
...result,
|
|
2931
|
+
value: payload.value,
|
|
2932
|
+
error: {
|
|
2933
|
+
issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
2934
|
+
},
|
|
2935
|
+
input: payload.value
|
|
2936
|
+
});
|
|
2937
|
+
return payload;
|
|
2938
|
+
}
|
|
2517
2939
|
var $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
2518
2940
|
$ZodType.init(inst, def);
|
|
2519
|
-
inst._zod.optin
|
|
2520
|
-
|
|
2521
|
-
|
|
2941
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
|
|
2942
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
|
|
2943
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2522
2944
|
inst._zod.parse = (payload, ctx) => {
|
|
2523
2945
|
if (ctx.direction === "backward") {
|
|
2524
2946
|
return def.innerType._zod.run(payload, ctx);
|
|
2525
2947
|
}
|
|
2526
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
2948
|
+
const result = def.innerType._zod.run({ value: payload.value, issues: [] }, ctx);
|
|
2527
2949
|
if (result instanceof Promise) {
|
|
2528
|
-
return result.then((result2) =>
|
|
2529
|
-
payload.value = result2.value;
|
|
2530
|
-
if (result2.issues.length) {
|
|
2531
|
-
payload.value = def.catchValue({
|
|
2532
|
-
...payload,
|
|
2533
|
-
error: {
|
|
2534
|
-
issues: result2.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
2535
|
-
},
|
|
2536
|
-
input: payload.value
|
|
2537
|
-
});
|
|
2538
|
-
payload.issues = [];
|
|
2539
|
-
payload.fallback = true;
|
|
2540
|
-
}
|
|
2541
|
-
return payload;
|
|
2542
|
-
});
|
|
2950
|
+
return result.then((result2) => handleCatchResult(payload, result2, def, ctx));
|
|
2543
2951
|
}
|
|
2544
|
-
payload
|
|
2545
|
-
if (result.issues.length) {
|
|
2546
|
-
payload.value = def.catchValue({
|
|
2547
|
-
...payload,
|
|
2548
|
-
error: {
|
|
2549
|
-
issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
2550
|
-
},
|
|
2551
|
-
input: payload.value
|
|
2552
|
-
});
|
|
2553
|
-
payload.issues = [];
|
|
2554
|
-
payload.fallback = true;
|
|
2555
|
-
}
|
|
2556
|
-
return payload;
|
|
2952
|
+
return handleCatchResult(payload, result, def, ctx);
|
|
2557
2953
|
};
|
|
2558
2954
|
});
|
|
2559
2955
|
var $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
|
|
2560
2956
|
$ZodType.init(inst, def);
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2957
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.in._zod.values);
|
|
2958
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.in._zod.optin);
|
|
2959
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.out._zod.optout);
|
|
2960
|
+
defineLazyInternal(inst, "propValues", (zod) => zod.def.in._zod.propValues);
|
|
2565
2961
|
inst._zod.parse = (payload, ctx) => {
|
|
2566
2962
|
if (ctx.direction === "backward") {
|
|
2567
2963
|
const right = def.out._zod.run(payload, ctx);
|
|
@@ -2578,18 +2974,18 @@ var $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
|
|
|
2578
2974
|
};
|
|
2579
2975
|
});
|
|
2580
2976
|
function handlePipeResult(left, next, ctx) {
|
|
2581
|
-
if (left.issues.
|
|
2977
|
+
if (left.issues.some((iss) => iss.code !== "unrecognized_keys")) {
|
|
2582
2978
|
left.aborted = true;
|
|
2583
2979
|
return left;
|
|
2584
2980
|
}
|
|
2585
|
-
return next._zod.run({ value: left.value, issues: left.issues
|
|
2981
|
+
return next._zod.run({ value: left.value, issues: left.issues }, ctx);
|
|
2586
2982
|
}
|
|
2587
2983
|
var $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
|
|
2588
2984
|
$ZodType.init(inst, def);
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2985
|
+
defineLazyInternal(inst, "propValues", (zod) => zod.def.innerType._zod.propValues);
|
|
2986
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2987
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType?._zod?.optin);
|
|
2988
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.innerType?._zod?.optout);
|
|
2593
2989
|
inst._zod.parse = (payload, ctx) => {
|
|
2594
2990
|
if (ctx.direction === "backward") {
|
|
2595
2991
|
return def.innerType._zod.run(payload, ctx);
|
|
@@ -2602,7 +2998,8 @@ var $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
|
|
|
2602
2998
|
};
|
|
2603
2999
|
});
|
|
2604
3000
|
function handleReadonlyResult(payload) {
|
|
2605
|
-
|
|
3001
|
+
if (!payload.memo)
|
|
3002
|
+
payload.value = Object.freeze(payload.value);
|
|
2606
3003
|
return payload;
|
|
2607
3004
|
}
|
|
2608
3005
|
var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
|
|
@@ -2639,10 +3036,407 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
2639
3036
|
}
|
|
2640
3037
|
}
|
|
2641
3038
|
|
|
3039
|
+
// node_modules/zod/v4/core/memoizer.js
|
|
3040
|
+
var $ZodCyclicError = class extends Error {
|
|
3041
|
+
constructor() {
|
|
3042
|
+
super(`Cannot parse a reference cycle that closes through a transform`);
|
|
3043
|
+
this.name = "ZodCyclicError";
|
|
3044
|
+
}
|
|
3045
|
+
};
|
|
3046
|
+
var STATE = "~memo";
|
|
3047
|
+
var NO_ISSUES = [];
|
|
3048
|
+
function isRef(value) {
|
|
3049
|
+
return value !== null && typeof value === "object";
|
|
3050
|
+
}
|
|
3051
|
+
function cloneIssues(issues) {
|
|
3052
|
+
return issues.map((iss) => iss.path ? { ...iss, path: iss.path.slice() } : { ...iss });
|
|
3053
|
+
}
|
|
3054
|
+
var recursive = /* @__PURE__ */ new WeakMap();
|
|
3055
|
+
var NONE = 0;
|
|
3056
|
+
var ASSUMED = 1;
|
|
3057
|
+
var PROVEN = 2;
|
|
3058
|
+
function isRecursive(inst, stack, resolve) {
|
|
3059
|
+
const cached2 = recursive.get(inst);
|
|
3060
|
+
if (cached2 !== void 0)
|
|
3061
|
+
return cached2 ? PROVEN : NONE;
|
|
3062
|
+
if (stack.has(inst))
|
|
3063
|
+
return PROVEN;
|
|
3064
|
+
stack.add(inst);
|
|
3065
|
+
let result = NONE;
|
|
3066
|
+
const check = (child) => {
|
|
3067
|
+
if (result !== PROVEN && child?._zod) {
|
|
3068
|
+
const answer = isRecursive(child, stack, resolve);
|
|
3069
|
+
if (answer > result)
|
|
3070
|
+
result = answer;
|
|
3071
|
+
}
|
|
3072
|
+
};
|
|
3073
|
+
const shape = (sh, spread) => {
|
|
3074
|
+
let answer = NONE;
|
|
3075
|
+
for (const key of Reflect.ownKeys(sh)) {
|
|
3076
|
+
const desc = Object.getOwnPropertyDescriptor(sh, key);
|
|
3077
|
+
if (spread && !desc.enumerable)
|
|
3078
|
+
continue;
|
|
3079
|
+
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve) : NONE;
|
|
3080
|
+
if (child > answer)
|
|
3081
|
+
answer = child;
|
|
3082
|
+
}
|
|
3083
|
+
return answer;
|
|
3084
|
+
};
|
|
3085
|
+
const merge2 = (answer) => {
|
|
3086
|
+
if (answer > result)
|
|
3087
|
+
result = answer;
|
|
3088
|
+
};
|
|
3089
|
+
const def = inst._zod.def;
|
|
3090
|
+
const kind = def.type;
|
|
3091
|
+
switch (kind) {
|
|
3092
|
+
case "object": {
|
|
3093
|
+
const raw = rawShape(def);
|
|
3094
|
+
merge2(raw ? shape(raw, true) : ASSUMED);
|
|
3095
|
+
check(def.catchall);
|
|
3096
|
+
break;
|
|
3097
|
+
}
|
|
3098
|
+
case "array":
|
|
3099
|
+
check(def.element);
|
|
3100
|
+
break;
|
|
3101
|
+
case "tuple":
|
|
3102
|
+
for (const el of def.items)
|
|
3103
|
+
check(el);
|
|
3104
|
+
check(def.rest);
|
|
3105
|
+
break;
|
|
3106
|
+
case "record":
|
|
3107
|
+
case "map":
|
|
3108
|
+
check(def.keyType);
|
|
3109
|
+
check(def.valueType);
|
|
3110
|
+
break;
|
|
3111
|
+
case "set":
|
|
3112
|
+
check(def.valueType);
|
|
3113
|
+
break;
|
|
3114
|
+
case "union":
|
|
3115
|
+
for (const el of def.options)
|
|
3116
|
+
check(el);
|
|
3117
|
+
break;
|
|
3118
|
+
case "intersection":
|
|
3119
|
+
check(def.left);
|
|
3120
|
+
check(def.right);
|
|
3121
|
+
break;
|
|
3122
|
+
case "optional":
|
|
3123
|
+
case "nullable":
|
|
3124
|
+
case "default":
|
|
3125
|
+
case "prefault":
|
|
3126
|
+
case "catch":
|
|
3127
|
+
case "readonly":
|
|
3128
|
+
case "nonoptional":
|
|
3129
|
+
case "promise":
|
|
3130
|
+
case "success":
|
|
3131
|
+
check(def.innerType);
|
|
3132
|
+
break;
|
|
3133
|
+
case "pipe":
|
|
3134
|
+
check(def.in);
|
|
3135
|
+
check(def.out);
|
|
3136
|
+
break;
|
|
3137
|
+
case "function":
|
|
3138
|
+
check(def.input);
|
|
3139
|
+
check(def.output);
|
|
3140
|
+
break;
|
|
3141
|
+
// `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
|
|
3142
|
+
case "lazy": {
|
|
3143
|
+
const inner = def._cachedInner ?? (resolve ? inst._zod.innerType : void 0);
|
|
3144
|
+
merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
3145
|
+
break;
|
|
3146
|
+
}
|
|
3147
|
+
// a leaf by choice: `parts` are regex fragments, not data positions
|
|
3148
|
+
case "template_literal":
|
|
3149
|
+
// leaves
|
|
3150
|
+
case "string":
|
|
3151
|
+
case "number":
|
|
3152
|
+
case "int":
|
|
3153
|
+
case "boolean":
|
|
3154
|
+
case "bigint":
|
|
3155
|
+
case "symbol":
|
|
3156
|
+
case "undefined":
|
|
3157
|
+
case "null":
|
|
3158
|
+
case "void":
|
|
3159
|
+
case "never":
|
|
3160
|
+
case "any":
|
|
3161
|
+
case "unknown":
|
|
3162
|
+
case "date":
|
|
3163
|
+
case "nan":
|
|
3164
|
+
case "enum":
|
|
3165
|
+
case "literal":
|
|
3166
|
+
case "file":
|
|
3167
|
+
case "transform":
|
|
3168
|
+
case "custom":
|
|
3169
|
+
break;
|
|
3170
|
+
default: {
|
|
3171
|
+
kind;
|
|
3172
|
+
for (const key in def) {
|
|
3173
|
+
const desc = Object.getOwnPropertyDescriptor(def, key);
|
|
3174
|
+
if (!desc || desc.get)
|
|
3175
|
+
continue;
|
|
3176
|
+
const value = desc.value;
|
|
3177
|
+
if (!value || typeof value !== "object")
|
|
3178
|
+
continue;
|
|
3179
|
+
if (value._zod)
|
|
3180
|
+
check(value);
|
|
3181
|
+
else if (Array.isArray(value))
|
|
3182
|
+
for (const el of value)
|
|
3183
|
+
check(el);
|
|
3184
|
+
}
|
|
3185
|
+
}
|
|
3186
|
+
}
|
|
3187
|
+
stack.delete(inst);
|
|
3188
|
+
return settle(inst, result);
|
|
3189
|
+
}
|
|
3190
|
+
function settle(inst, answer) {
|
|
3191
|
+
if (answer !== ASSUMED)
|
|
3192
|
+
recursive.set(inst, answer === PROVEN);
|
|
3193
|
+
return answer;
|
|
3194
|
+
}
|
|
3195
|
+
function bucketFor(state, inst) {
|
|
3196
|
+
let bucket = state.buckets.get(inst);
|
|
3197
|
+
if (!bucket) {
|
|
3198
|
+
bucket = /* @__PURE__ */ new WeakMap();
|
|
3199
|
+
state.buckets.set(inst, bucket);
|
|
3200
|
+
}
|
|
3201
|
+
return bucket;
|
|
3202
|
+
}
|
|
3203
|
+
var handoff;
|
|
3204
|
+
var open = [];
|
|
3205
|
+
var memo = {
|
|
3206
|
+
alloc(_inst, payload, empty) {
|
|
3207
|
+
const bucket = handoff;
|
|
3208
|
+
if (!bucket)
|
|
3209
|
+
return empty;
|
|
3210
|
+
handoff = void 0;
|
|
3211
|
+
const entry = { value: empty, issues: null };
|
|
3212
|
+
bucket.set(payload.value, entry);
|
|
3213
|
+
open.push(entry);
|
|
3214
|
+
return empty;
|
|
3215
|
+
},
|
|
3216
|
+
guard(inst) {
|
|
3217
|
+
var _a3;
|
|
3218
|
+
(_a3 = inst._zod).deferred ?? (_a3.deferred = []);
|
|
3219
|
+
inst._zod.deferred.push(() => {
|
|
3220
|
+
const base = inst._zod.parse;
|
|
3221
|
+
const wrapped = (payload, ctx) => {
|
|
3222
|
+
if (ctx.direction !== "backward" && isBackEdge(ctx, payload.value))
|
|
3223
|
+
throw new $ZodCyclicError();
|
|
3224
|
+
return base(payload, ctx);
|
|
3225
|
+
};
|
|
3226
|
+
inst._zod.parse = wrapped;
|
|
3227
|
+
if (inst._zod.run === base)
|
|
3228
|
+
inst._zod.run = wrapped;
|
|
3229
|
+
});
|
|
3230
|
+
},
|
|
3231
|
+
attach(inst) {
|
|
3232
|
+
var _a3;
|
|
3233
|
+
let isRecursiveInst;
|
|
3234
|
+
let rechecked = false;
|
|
3235
|
+
let lastCtx;
|
|
3236
|
+
let lastBucket;
|
|
3237
|
+
(_a3 = inst._zod).deferred ?? (_a3.deferred = []);
|
|
3238
|
+
inst._zod.deferred.push(() => {
|
|
3239
|
+
const base = inst._zod.parse;
|
|
3240
|
+
const wrapped = (payload, ctx) => {
|
|
3241
|
+
if (isRecursiveInst === void 0) {
|
|
3242
|
+
const walked = isRecursive(inst, /* @__PURE__ */ new Set(), false);
|
|
3243
|
+
if (walked === NONE) {
|
|
3244
|
+
inst._zod.parse = base;
|
|
3245
|
+
if (inst._zod.run === wrapped)
|
|
3246
|
+
inst._zod.run = base;
|
|
3247
|
+
return base(payload, ctx);
|
|
3248
|
+
}
|
|
3249
|
+
if (walked === PROVEN || rechecked)
|
|
3250
|
+
isRecursiveInst = true;
|
|
3251
|
+
else
|
|
3252
|
+
rechecked = true;
|
|
3253
|
+
}
|
|
3254
|
+
const input = payload.value;
|
|
3255
|
+
if (!isRef(input))
|
|
3256
|
+
return base(payload, ctx);
|
|
3257
|
+
let state = ctx[STATE];
|
|
3258
|
+
if (!state) {
|
|
3259
|
+
state = { buckets: /* @__PURE__ */ new WeakMap(), backEdges: void 0 };
|
|
3260
|
+
ctx[STATE] = state;
|
|
3261
|
+
}
|
|
3262
|
+
let bucket;
|
|
3263
|
+
if (lastCtx === ctx) {
|
|
3264
|
+
bucket = lastBucket;
|
|
3265
|
+
} else {
|
|
3266
|
+
bucket = bucketFor(state, inst);
|
|
3267
|
+
lastCtx = ctx;
|
|
3268
|
+
lastBucket = bucket;
|
|
3269
|
+
}
|
|
3270
|
+
const hit = bucket.get(input);
|
|
3271
|
+
if (hit) {
|
|
3272
|
+
payload.value = hit.value;
|
|
3273
|
+
if (hit.issues) {
|
|
3274
|
+
if (hit.issues.length)
|
|
3275
|
+
payload.issues.push(...cloneIssues(hit.issues));
|
|
3276
|
+
} else {
|
|
3277
|
+
payload.memo = true;
|
|
3278
|
+
state.backEdges ?? (state.backEdges = /* @__PURE__ */ new WeakSet());
|
|
3279
|
+
state.backEdges.add(hit.value);
|
|
3280
|
+
}
|
|
3281
|
+
return payload;
|
|
3282
|
+
}
|
|
3283
|
+
handoff = bucket;
|
|
3284
|
+
const depth = open.length;
|
|
3285
|
+
const result = base(payload, ctx);
|
|
3286
|
+
handoff = void 0;
|
|
3287
|
+
const entry = open.length > depth ? open.pop() : void 0;
|
|
3288
|
+
if (result instanceof Promise) {
|
|
3289
|
+
return result.then((r) => {
|
|
3290
|
+
if (entry)
|
|
3291
|
+
entry.issues = r.issues.length ? cloneIssues(r.issues) : NO_ISSUES;
|
|
3292
|
+
return r;
|
|
3293
|
+
});
|
|
3294
|
+
}
|
|
3295
|
+
if (entry)
|
|
3296
|
+
entry.issues = result.issues.length ? cloneIssues(result.issues) : NO_ISSUES;
|
|
3297
|
+
return result;
|
|
3298
|
+
};
|
|
3299
|
+
inst._zod.parse = wrapped;
|
|
3300
|
+
if (inst._zod.run === base)
|
|
3301
|
+
inst._zod.run = wrapped;
|
|
3302
|
+
});
|
|
3303
|
+
}
|
|
3304
|
+
};
|
|
3305
|
+
function memoizer() {
|
|
3306
|
+
return memo;
|
|
3307
|
+
}
|
|
3308
|
+
function isBackEdge(ctx, value) {
|
|
3309
|
+
const backEdges = ctx[STATE]?.backEdges;
|
|
3310
|
+
return backEdges !== void 0 && isRef(value) && backEdges.has(value);
|
|
3311
|
+
}
|
|
3312
|
+
|
|
3313
|
+
// node_modules/zod/v4/locales/en.js
|
|
3314
|
+
var error = () => {
|
|
3315
|
+
const Sizable = {
|
|
3316
|
+
string: { unit: "characters", verb: "to have" },
|
|
3317
|
+
file: { unit: "bytes", verb: "to have" },
|
|
3318
|
+
array: { unit: "items", verb: "to have" },
|
|
3319
|
+
set: { unit: "items", verb: "to have" },
|
|
3320
|
+
map: { unit: "entries", verb: "to have" }
|
|
3321
|
+
};
|
|
3322
|
+
function getSizing(origin) {
|
|
3323
|
+
return Sizable[origin] ?? null;
|
|
3324
|
+
}
|
|
3325
|
+
const FormatDictionary = {
|
|
3326
|
+
regex: "input",
|
|
3327
|
+
email: "email address",
|
|
3328
|
+
url: "URL",
|
|
3329
|
+
emoji: "emoji",
|
|
3330
|
+
uuid: "UUID",
|
|
3331
|
+
uuidv4: "UUIDv4",
|
|
3332
|
+
uuidv6: "UUIDv6",
|
|
3333
|
+
nanoid: "nanoid",
|
|
3334
|
+
guid: "GUID",
|
|
3335
|
+
cuid: "cuid",
|
|
3336
|
+
cuid2: "cuid2",
|
|
3337
|
+
ulid: "ULID",
|
|
3338
|
+
xid: "XID",
|
|
3339
|
+
ksuid: "KSUID",
|
|
3340
|
+
datetime: "ISO datetime",
|
|
3341
|
+
date: "ISO date",
|
|
3342
|
+
time: "ISO time",
|
|
3343
|
+
duration: "ISO duration",
|
|
3344
|
+
ipv4: "IPv4 address",
|
|
3345
|
+
ipv6: "IPv6 address",
|
|
3346
|
+
mac: "MAC address",
|
|
3347
|
+
cidrv4: "IPv4 range",
|
|
3348
|
+
cidrv6: "IPv6 range",
|
|
3349
|
+
base64: "base64-encoded string",
|
|
3350
|
+
base64url: "base64url-encoded string",
|
|
3351
|
+
json_string: "JSON string",
|
|
3352
|
+
e164: "E.164 number",
|
|
3353
|
+
currency_code: "currency code",
|
|
3354
|
+
credit_card: "credit card number",
|
|
3355
|
+
iban: "IBAN",
|
|
3356
|
+
jwt: "JWT",
|
|
3357
|
+
template_literal: "input"
|
|
3358
|
+
};
|
|
3359
|
+
const TypeDictionary = {
|
|
3360
|
+
// Compatibility: "nan" -> "NaN" for display
|
|
3361
|
+
nan: "NaN"
|
|
3362
|
+
// All other type names omitted - they fall back to raw values via ?? operator
|
|
3363
|
+
};
|
|
3364
|
+
function getTypeName(type, input) {
|
|
3365
|
+
if (type === "number" && typeof input === "number" && !Number.isFinite(input)) {
|
|
3366
|
+
return String(input);
|
|
3367
|
+
}
|
|
3368
|
+
return TypeDictionary[type] ?? type;
|
|
3369
|
+
}
|
|
3370
|
+
return (issue2) => {
|
|
3371
|
+
switch (issue2.code) {
|
|
3372
|
+
case "invalid_type": {
|
|
3373
|
+
const expected = getTypeName(issue2.expected);
|
|
3374
|
+
const receivedType = parsedType(issue2.input);
|
|
3375
|
+
const received = getTypeName(receivedType, issue2.input);
|
|
3376
|
+
return `Invalid input: expected ${expected}, received ${received}`;
|
|
3377
|
+
}
|
|
3378
|
+
case "invalid_value":
|
|
3379
|
+
if (issue2.values.length === 1)
|
|
3380
|
+
return `Invalid input: expected ${stringifyPrimitive(issue2.values[0])}`;
|
|
3381
|
+
return `Invalid option: expected one of ${joinValues(issue2.values, "|")}`;
|
|
3382
|
+
case "too_big": {
|
|
3383
|
+
const adj = issue2.exact ? "exactly " : issue2.inclusive ? "<=" : "<";
|
|
3384
|
+
const sizing = getSizing(issue2.origin);
|
|
3385
|
+
if (sizing)
|
|
3386
|
+
return `Too big: expected ${issue2.origin ?? "value"} to have ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elements"}`;
|
|
3387
|
+
return `Too big: expected ${issue2.origin ?? "value"} to be ${adj}${issue2.maximum.toString()}`;
|
|
3388
|
+
}
|
|
3389
|
+
case "too_small": {
|
|
3390
|
+
const adj = issue2.exact ? "exactly " : issue2.inclusive ? ">=" : ">";
|
|
3391
|
+
const sizing = getSizing(issue2.origin);
|
|
3392
|
+
if (sizing) {
|
|
3393
|
+
return `Too small: expected ${issue2.origin} to have ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
|
|
3394
|
+
}
|
|
3395
|
+
return `Too small: expected ${issue2.origin} to be ${adj}${issue2.minimum.toString()}`;
|
|
3396
|
+
}
|
|
3397
|
+
case "invalid_format": {
|
|
3398
|
+
const _issue = issue2;
|
|
3399
|
+
if (_issue.format === "starts_with") {
|
|
3400
|
+
return `Invalid string: must start with "${_issue.prefix}"`;
|
|
3401
|
+
}
|
|
3402
|
+
if (_issue.format === "ends_with")
|
|
3403
|
+
return `Invalid string: must end with "${_issue.suffix}"`;
|
|
3404
|
+
if (_issue.format === "includes")
|
|
3405
|
+
return `Invalid string: must include "${_issue.includes}"`;
|
|
3406
|
+
if (_issue.format === "regex")
|
|
3407
|
+
return `Invalid string: must match pattern ${_issue.pattern}`;
|
|
3408
|
+
return `Invalid ${FormatDictionary[_issue.format] ?? issue2.format}`;
|
|
3409
|
+
}
|
|
3410
|
+
case "not_multiple_of":
|
|
3411
|
+
return `Invalid number: must be a multiple of ${issue2.divisor}`;
|
|
3412
|
+
case "unrecognized_keys":
|
|
3413
|
+
return `Unrecognized key${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`;
|
|
3414
|
+
case "invalid_key":
|
|
3415
|
+
return `Invalid key in ${issue2.origin}`;
|
|
3416
|
+
case "invalid_union":
|
|
3417
|
+
if (issue2.options && Array.isArray(issue2.options) && issue2.options.length > 0) {
|
|
3418
|
+
const opts = issue2.options.map((o) => `'${o}'`).join(" | ");
|
|
3419
|
+
return `Invalid discriminator value. Expected ${opts}`;
|
|
3420
|
+
}
|
|
3421
|
+
if (issue2.inclusive === false) {
|
|
3422
|
+
return "Invalid input: more than one option matched";
|
|
3423
|
+
}
|
|
3424
|
+
return "Invalid input";
|
|
3425
|
+
case "invalid_element":
|
|
3426
|
+
return `Invalid value in ${issue2.origin}`;
|
|
3427
|
+
default:
|
|
3428
|
+
return `Invalid input`;
|
|
3429
|
+
}
|
|
3430
|
+
};
|
|
3431
|
+
};
|
|
3432
|
+
function en_default() {
|
|
3433
|
+
return {
|
|
3434
|
+
localeError: error()
|
|
3435
|
+
};
|
|
3436
|
+
}
|
|
3437
|
+
|
|
2642
3438
|
// node_modules/zod/v4/core/registries.js
|
|
2643
3439
|
var _a2;
|
|
2644
|
-
var $output = Symbol("ZodOutput");
|
|
2645
|
-
var $input = Symbol("ZodInput");
|
|
2646
3440
|
var $ZodRegistry = class {
|
|
2647
3441
|
constructor() {
|
|
2648
3442
|
this._map = /* @__PURE__ */ new WeakMap();
|
|
@@ -2690,12 +3484,14 @@ function registry() {
|
|
|
2690
3484
|
var globalRegistry = globalThis.__zod_globalRegistry;
|
|
2691
3485
|
|
|
2692
3486
|
// node_modules/zod/v4/core/api.js
|
|
3487
|
+
function snapshotChecks(def) {
|
|
3488
|
+
if (def.checks)
|
|
3489
|
+
def.checks = [...def.checks];
|
|
3490
|
+
return def;
|
|
3491
|
+
}
|
|
2693
3492
|
// @__NO_SIDE_EFFECTS__
|
|
2694
3493
|
function _string(Class2, params) {
|
|
2695
|
-
return new Class2({
|
|
2696
|
-
type: "string",
|
|
2697
|
-
...normalizeParams(params)
|
|
2698
|
-
});
|
|
3494
|
+
return new Class2(snapshotChecks({ type: "string", ...normalizeParams(params) }));
|
|
2699
3495
|
}
|
|
2700
3496
|
// @__NO_SIDE_EFFECTS__
|
|
2701
3497
|
function _email(Class2, params) {
|
|
@@ -2962,11 +3758,7 @@ function _isoDuration(Class2, params) {
|
|
|
2962
3758
|
}
|
|
2963
3759
|
// @__NO_SIDE_EFFECTS__
|
|
2964
3760
|
function _number(Class2, params) {
|
|
2965
|
-
return new Class2({
|
|
2966
|
-
type: "number",
|
|
2967
|
-
checks: [],
|
|
2968
|
-
...normalizeParams(params)
|
|
2969
|
-
});
|
|
3761
|
+
return new Class2(snapshotChecks({ type: "number", checks: [], ...normalizeParams(params) }));
|
|
2970
3762
|
}
|
|
2971
3763
|
// @__NO_SIDE_EFFECTS__
|
|
2972
3764
|
function _int(Class2, params) {
|
|
@@ -3171,7 +3963,8 @@ function _superRefine(fn, params) {
|
|
|
3171
3963
|
if (_issue.fatal)
|
|
3172
3964
|
_issue.continue = false;
|
|
3173
3965
|
_issue.code ?? (_issue.code = "custom");
|
|
3174
|
-
|
|
3966
|
+
if (!("input" in _issue))
|
|
3967
|
+
_issue.input = payload.value;
|
|
3175
3968
|
_issue.inst ?? (_issue.inst = ch);
|
|
3176
3969
|
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
|
|
3177
3970
|
payload.issues.push(issue(_issue));
|
|
@@ -3192,6 +3985,16 @@ function _check(fn, params) {
|
|
|
3192
3985
|
}
|
|
3193
3986
|
|
|
3194
3987
|
// node_modules/zod/v4/core/to-json-schema.js
|
|
3988
|
+
function assignProps(target, ...sources) {
|
|
3989
|
+
for (const source of sources) {
|
|
3990
|
+
for (const key of Reflect.ownKeys(source)) {
|
|
3991
|
+
if (Object.prototype.propertyIsEnumerable.call(source, key)) {
|
|
3992
|
+
assignProp(target, key, source[key]);
|
|
3993
|
+
}
|
|
3994
|
+
}
|
|
3995
|
+
}
|
|
3996
|
+
return target;
|
|
3997
|
+
}
|
|
3195
3998
|
function initializeContext(params) {
|
|
3196
3999
|
let target = params?.target ?? "draft-2020-12";
|
|
3197
4000
|
if (target === "draft-4")
|
|
@@ -3208,12 +4011,25 @@ function initializeContext(params) {
|
|
|
3208
4011
|
io: params?.io ?? "output",
|
|
3209
4012
|
counter: 0,
|
|
3210
4013
|
seen: /* @__PURE__ */ new Map(),
|
|
4014
|
+
sharedDefsExtractedFor: void 0,
|
|
4015
|
+
sharedEmitDoneFor: void 0,
|
|
3211
4016
|
cycles: params?.cycles ?? "ref",
|
|
3212
4017
|
reused: params?.reused ?? "inline",
|
|
4018
|
+
intersections: [],
|
|
4019
|
+
deferred: [],
|
|
3213
4020
|
external: params?.external ?? void 0
|
|
3214
4021
|
};
|
|
3215
4022
|
}
|
|
3216
|
-
function
|
|
4023
|
+
function handleUnrepresentable(schema, ctx, json, params, message) {
|
|
4024
|
+
const result = typeof ctx.unrepresentable === "function" ? ctx.unrepresentable({ zodSchema: schema, path: params.path, message }) : ctx.unrepresentable;
|
|
4025
|
+
if (result === "any")
|
|
4026
|
+
return false;
|
|
4027
|
+
if (result === void 0 || result === "throw")
|
|
4028
|
+
throw new Error(message);
|
|
4029
|
+
Object.assign(json, result);
|
|
4030
|
+
return true;
|
|
4031
|
+
}
|
|
4032
|
+
function processSchema(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
3217
4033
|
var _a3;
|
|
3218
4034
|
const def = schema._zod.def;
|
|
3219
4035
|
const seen = ctx.seen.get(schema);
|
|
@@ -3227,6 +4043,8 @@ function process(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
3227
4043
|
}
|
|
3228
4044
|
const result = { schema: {}, count: 1, cycle: void 0, path: _params.path };
|
|
3229
4045
|
ctx.seen.set(schema, result);
|
|
4046
|
+
ctx.sharedDefsExtractedFor = void 0;
|
|
4047
|
+
ctx.sharedEmitDoneFor = void 0;
|
|
3230
4048
|
const overrideSchema = schema._zod.toJSONSchema?.();
|
|
3231
4049
|
if (overrideSchema) {
|
|
3232
4050
|
result.schema = overrideSchema;
|
|
@@ -3250,13 +4068,13 @@ function process(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
3250
4068
|
if (parent) {
|
|
3251
4069
|
if (!result.ref)
|
|
3252
4070
|
result.ref = parent;
|
|
3253
|
-
|
|
4071
|
+
processSchema(parent, ctx, params);
|
|
3254
4072
|
ctx.seen.get(parent).isParent = true;
|
|
3255
4073
|
}
|
|
3256
4074
|
}
|
|
3257
4075
|
const meta2 = ctx.metadataRegistry.get(schema);
|
|
3258
4076
|
if (meta2)
|
|
3259
|
-
|
|
4077
|
+
assignProps(result.schema, meta2);
|
|
3260
4078
|
if (ctx.io === "input" && isTransforming(schema)) {
|
|
3261
4079
|
delete result.schema.examples;
|
|
3262
4080
|
delete result.schema.default;
|
|
@@ -3267,10 +4085,15 @@ function process(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
3267
4085
|
const _result = ctx.seen.get(schema);
|
|
3268
4086
|
return _result.schema;
|
|
3269
4087
|
}
|
|
4088
|
+
function encodeJSONPointerSegment(segment) {
|
|
4089
|
+
return segment.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
4090
|
+
}
|
|
3270
4091
|
function extractDefs(ctx, schema) {
|
|
3271
4092
|
const root = ctx.seen.get(schema);
|
|
3272
4093
|
if (!root)
|
|
3273
4094
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
4095
|
+
if (ctx.external && ctx.sharedDefsExtractedFor === ctx.external)
|
|
4096
|
+
return;
|
|
3274
4097
|
const idToSchema = /* @__PURE__ */ new Map();
|
|
3275
4098
|
for (const entry of ctx.seen.entries()) {
|
|
3276
4099
|
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
@@ -3292,15 +4115,15 @@ function extractDefs(ctx, schema) {
|
|
|
3292
4115
|
}
|
|
3293
4116
|
const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
3294
4117
|
entry[1].defId = id;
|
|
3295
|
-
return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` };
|
|
3296
|
-
}
|
|
3297
|
-
if (entry[1] === root) {
|
|
3298
|
-
return { ref: "#" };
|
|
4118
|
+
return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${encodeJSONPointerSegment(id)}` };
|
|
3299
4119
|
}
|
|
3300
4120
|
const uriPrefix = `#`;
|
|
3301
4121
|
const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
|
|
4122
|
+
if (entry[1] === root && !entry[1].schema.id) {
|
|
4123
|
+
return { ref: uriPrefix };
|
|
4124
|
+
}
|
|
3302
4125
|
const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
|
|
3303
|
-
return { defId, ref: defUriPrefix + defId };
|
|
4126
|
+
return { defId, ref: defUriPrefix + encodeJSONPointerSegment(defId) };
|
|
3304
4127
|
};
|
|
3305
4128
|
const extractToDef = (entry) => {
|
|
3306
4129
|
if (entry[1].schema.$ref) {
|
|
@@ -3352,10 +4175,119 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3352
4175
|
if (seen.count > 1) {
|
|
3353
4176
|
if (ctx.reused === "ref") {
|
|
3354
4177
|
extractToDef(entry);
|
|
4178
|
+
}
|
|
4179
|
+
}
|
|
4180
|
+
}
|
|
4181
|
+
if (ctx.external)
|
|
4182
|
+
ctx.sharedDefsExtractedFor = ctx.external;
|
|
4183
|
+
}
|
|
4184
|
+
function compactTypeUnion(schema) {
|
|
4185
|
+
const options = schema.anyOf;
|
|
4186
|
+
if (!Array.isArray(options) || options.length === 0 || schema.type !== void 0)
|
|
4187
|
+
return;
|
|
4188
|
+
const types = [];
|
|
4189
|
+
for (const option of options) {
|
|
4190
|
+
if (!option || typeof option !== "object")
|
|
4191
|
+
return;
|
|
4192
|
+
compactTypeUnion(option);
|
|
4193
|
+
const keys = Object.keys(option);
|
|
4194
|
+
if (keys.length !== 1 || keys[0] !== "type")
|
|
4195
|
+
return;
|
|
4196
|
+
const type = option.type;
|
|
4197
|
+
for (const member of Array.isArray(type) ? type : [type]) {
|
|
4198
|
+
if (typeof member !== "string")
|
|
4199
|
+
return;
|
|
4200
|
+
if (!types.includes(member))
|
|
4201
|
+
types.push(member);
|
|
4202
|
+
}
|
|
4203
|
+
}
|
|
4204
|
+
delete schema.anyOf;
|
|
4205
|
+
schema.type = types.length === 1 ? types[0] : types;
|
|
4206
|
+
}
|
|
4207
|
+
var FOLDABLE_KEYS = /* @__PURE__ */ new Set(["type", "properties", "required", "additionalProperties"]);
|
|
4208
|
+
var UNION_KEYS = ["oneOf", "anyOf"];
|
|
4209
|
+
function undeclaredConstraint(member) {
|
|
4210
|
+
const extra = member.additionalProperties;
|
|
4211
|
+
if (extra === void 0 || extra === false || typeof extra !== "object" || extra === null)
|
|
4212
|
+
return null;
|
|
4213
|
+
return Object.keys(extra).length ? extra : null;
|
|
4214
|
+
}
|
|
4215
|
+
function foldObjects(members2) {
|
|
4216
|
+
const objects = [];
|
|
4217
|
+
for (const member of members2) {
|
|
4218
|
+
if (typeof member !== "object" || member.type !== "object")
|
|
4219
|
+
return null;
|
|
4220
|
+
for (const key in member) {
|
|
4221
|
+
if (!FOLDABLE_KEYS.has(key))
|
|
4222
|
+
return null;
|
|
4223
|
+
}
|
|
4224
|
+
objects.push(member);
|
|
4225
|
+
}
|
|
4226
|
+
const properties = {};
|
|
4227
|
+
const required2 = /* @__PURE__ */ new Set();
|
|
4228
|
+
for (const object2 of objects) {
|
|
4229
|
+
for (const key in object2.properties) {
|
|
4230
|
+
if (Object.prototype.hasOwnProperty.call(properties, key))
|
|
3355
4231
|
continue;
|
|
4232
|
+
const parts = [];
|
|
4233
|
+
for (const other of objects) {
|
|
4234
|
+
const part = other.properties?.[key] ?? undeclaredConstraint(other);
|
|
4235
|
+
if (part === null || part === void 0)
|
|
4236
|
+
continue;
|
|
4237
|
+
if (!parts.some((seen) => JSON.stringify(seen) === JSON.stringify(part)))
|
|
4238
|
+
parts.push(part);
|
|
3356
4239
|
}
|
|
4240
|
+
const merged = parts.length === 1 ? parts[0] : foldObjects(parts) ?? { allOf: parts };
|
|
4241
|
+
assignProp(properties, key, merged);
|
|
3357
4242
|
}
|
|
4243
|
+
for (const key of object2.required ?? [])
|
|
4244
|
+
required2.add(key);
|
|
4245
|
+
}
|
|
4246
|
+
const folded = { type: "object", properties };
|
|
4247
|
+
if (required2.size)
|
|
4248
|
+
folded.required = [...required2];
|
|
4249
|
+
if (objects.every((object2) => object2.additionalProperties === false)) {
|
|
4250
|
+
folded.additionalProperties = false;
|
|
4251
|
+
} else {
|
|
4252
|
+
const constraints = [];
|
|
4253
|
+
for (const object2 of objects) {
|
|
4254
|
+
const constraint = undeclaredConstraint(object2);
|
|
4255
|
+
if (constraint && !constraints.some((seen) => JSON.stringify(seen) === JSON.stringify(constraint)))
|
|
4256
|
+
constraints.push(constraint);
|
|
4257
|
+
}
|
|
4258
|
+
if (constraints.length === 1)
|
|
4259
|
+
folded.additionalProperties = constraints[0];
|
|
4260
|
+
else if (constraints.length > 1)
|
|
4261
|
+
folded.additionalProperties = { allOf: constraints };
|
|
4262
|
+
}
|
|
4263
|
+
return folded;
|
|
4264
|
+
}
|
|
4265
|
+
function foldIntersection(json) {
|
|
4266
|
+
const allOf = json.allOf;
|
|
4267
|
+
if (!Array.isArray(allOf) || allOf.length < 2)
|
|
4268
|
+
return;
|
|
4269
|
+
for (const key of FOLDABLE_KEYS)
|
|
4270
|
+
if (key in json)
|
|
4271
|
+
return;
|
|
4272
|
+
const unions = allOf.filter((m) => UNION_KEYS.some((k) => Array.isArray(m[k])));
|
|
4273
|
+
let folded = null;
|
|
4274
|
+
if (!unions.length) {
|
|
4275
|
+
folded = foldObjects(allOf);
|
|
4276
|
+
} else {
|
|
4277
|
+
const union2 = unions[0];
|
|
4278
|
+
const keyword = UNION_KEYS.find((k) => Array.isArray(union2[k]));
|
|
4279
|
+
if (Object.keys(union2).length !== 1)
|
|
4280
|
+
return;
|
|
4281
|
+
const rest = allOf.filter((m) => m !== union2);
|
|
4282
|
+
const branches = union2[keyword].map((branch) => foldObjects([...rest, branch]));
|
|
4283
|
+
if (branches.some((b) => !b))
|
|
4284
|
+
return;
|
|
4285
|
+
folded = { [keyword]: branches };
|
|
3358
4286
|
}
|
|
4287
|
+
if (!folded)
|
|
4288
|
+
return;
|
|
4289
|
+
delete json.allOf;
|
|
4290
|
+
assignProps(json, folded);
|
|
3359
4291
|
}
|
|
3360
4292
|
function finalize(ctx, schema) {
|
|
3361
4293
|
const root = ctx.seen.get(schema);
|
|
@@ -3377,9 +4309,9 @@ function finalize(ctx, schema) {
|
|
|
3377
4309
|
schema2.allOf = schema2.allOf ?? [];
|
|
3378
4310
|
schema2.allOf.push(refSchema);
|
|
3379
4311
|
} else {
|
|
3380
|
-
|
|
4312
|
+
assignProps(schema2, refSchema);
|
|
3381
4313
|
}
|
|
3382
|
-
|
|
4314
|
+
assignProps(schema2, _cached);
|
|
3383
4315
|
const isParentRef = zodSchema._zod.parent === ref;
|
|
3384
4316
|
if (isParentRef) {
|
|
3385
4317
|
for (const key in schema2) {
|
|
@@ -3423,8 +4355,36 @@ function finalize(ctx, schema) {
|
|
|
3423
4355
|
path: seen.path ?? []
|
|
3424
4356
|
});
|
|
3425
4357
|
};
|
|
3426
|
-
|
|
3427
|
-
|
|
4358
|
+
if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) {
|
|
4359
|
+
for (const entry of [...ctx.seen.entries()].reverse()) {
|
|
4360
|
+
flattenRef(entry[0]);
|
|
4361
|
+
}
|
|
4362
|
+
if (ctx.target !== "openapi-3.0") {
|
|
4363
|
+
for (const entry of ctx.seen.entries()) {
|
|
4364
|
+
compactTypeUnion(entry[1].def ?? entry[1].schema);
|
|
4365
|
+
}
|
|
4366
|
+
}
|
|
4367
|
+
for (const rewrite of ctx.deferred)
|
|
4368
|
+
rewrite();
|
|
4369
|
+
if (ctx.intersections.length) {
|
|
4370
|
+
const carriers = /* @__PURE__ */ new Map();
|
|
4371
|
+
for (const seen of ctx.seen.values()) {
|
|
4372
|
+
for (const json of [seen.schema, seen.def]) {
|
|
4373
|
+
const allOf = json?.allOf;
|
|
4374
|
+
if (!Array.isArray(allOf))
|
|
4375
|
+
continue;
|
|
4376
|
+
const existing = carriers.get(allOf);
|
|
4377
|
+
if (existing)
|
|
4378
|
+
existing.push(json);
|
|
4379
|
+
else
|
|
4380
|
+
carriers.set(allOf, [json]);
|
|
4381
|
+
}
|
|
4382
|
+
}
|
|
4383
|
+
for (const allOf of ctx.intersections) {
|
|
4384
|
+
for (const json of carriers.get(allOf) ?? [])
|
|
4385
|
+
foldIntersection(json);
|
|
4386
|
+
}
|
|
4387
|
+
}
|
|
3428
4388
|
}
|
|
3429
4389
|
const result = {};
|
|
3430
4390
|
if (ctx.target === "draft-2020-12") {
|
|
@@ -3442,19 +4402,23 @@ function finalize(ctx, schema) {
|
|
|
3442
4402
|
throw new Error("Schema is missing an `id` property");
|
|
3443
4403
|
result.$id = ctx.external.uri(id);
|
|
3444
4404
|
}
|
|
3445
|
-
|
|
4405
|
+
assignProps(result, root.defId ? root.schema : root.def ?? root.schema);
|
|
3446
4406
|
const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
|
|
3447
4407
|
if (rootMetaId !== void 0 && result.id === rootMetaId)
|
|
3448
4408
|
delete result.id;
|
|
3449
4409
|
const defs = ctx.external?.defs ?? {};
|
|
3450
|
-
|
|
3451
|
-
const seen
|
|
3452
|
-
|
|
3453
|
-
if (seen.def
|
|
3454
|
-
|
|
3455
|
-
|
|
4410
|
+
if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) {
|
|
4411
|
+
for (const entry of ctx.seen.entries()) {
|
|
4412
|
+
const seen = entry[1];
|
|
4413
|
+
if (seen.def && seen.defId) {
|
|
4414
|
+
if (seen.def.id === seen.defId)
|
|
4415
|
+
delete seen.def.id;
|
|
4416
|
+
assignProp(defs, seen.defId, seen.def);
|
|
4417
|
+
}
|
|
3456
4418
|
}
|
|
3457
4419
|
}
|
|
4420
|
+
if (ctx.external)
|
|
4421
|
+
ctx.sharedEmitDoneFor = ctx.external;
|
|
3458
4422
|
if (ctx.external) {
|
|
3459
4423
|
} else {
|
|
3460
4424
|
if (Object.keys(defs).length > 0) {
|
|
@@ -3497,7 +4461,7 @@ function isTransforming(_schema, _ctx) {
|
|
|
3497
4461
|
return isTransforming(def.valueType, ctx);
|
|
3498
4462
|
if (def.type === "lazy")
|
|
3499
4463
|
return isTransforming(def.getter(), ctx);
|
|
3500
|
-
if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault") {
|
|
4464
|
+
if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault" || def.type === "catch") {
|
|
3501
4465
|
return isTransforming(def.innerType, ctx);
|
|
3502
4466
|
}
|
|
3503
4467
|
if (def.type === "intersection") {
|
|
@@ -3538,19 +4502,107 @@ function isTransforming(_schema, _ctx) {
|
|
|
3538
4502
|
}
|
|
3539
4503
|
var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
3540
4504
|
const ctx = initializeContext({ ...params, processors });
|
|
3541
|
-
|
|
4505
|
+
processSchema(schema, ctx);
|
|
3542
4506
|
extractDefs(ctx, schema);
|
|
3543
4507
|
return finalize(ctx, schema);
|
|
3544
4508
|
};
|
|
3545
4509
|
var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
|
|
3546
4510
|
const { libraryOptions, target } = params ?? {};
|
|
3547
4511
|
const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
|
|
3548
|
-
|
|
4512
|
+
processSchema(schema, ctx);
|
|
3549
4513
|
extractDefs(ctx, schema);
|
|
3550
4514
|
return finalize(ctx, schema);
|
|
3551
4515
|
};
|
|
3552
4516
|
|
|
3553
4517
|
// node_modules/zod/v4/core/json-schema-processors.js
|
|
4518
|
+
var narrowMin = (agg, key, value) => {
|
|
4519
|
+
if (agg[key] === void 0 || value > agg[key])
|
|
4520
|
+
agg[key] = value;
|
|
4521
|
+
};
|
|
4522
|
+
var narrowMax = (agg, key, value) => {
|
|
4523
|
+
if (agg[key] === void 0 || value < agg[key])
|
|
4524
|
+
agg[key] = value;
|
|
4525
|
+
};
|
|
4526
|
+
var narrowBoth = (agg, value) => {
|
|
4527
|
+
narrowMin(agg, "minimum", value);
|
|
4528
|
+
narrowMax(agg, "maximum", value);
|
|
4529
|
+
};
|
|
4530
|
+
var addDivisor = (agg, value) => {
|
|
4531
|
+
agg.multipleOf ?? (agg.multipleOf = []);
|
|
4532
|
+
if (!agg.multipleOf.includes(value))
|
|
4533
|
+
agg.multipleOf.push(value);
|
|
4534
|
+
};
|
|
4535
|
+
var addPattern = (agg, pattern) => {
|
|
4536
|
+
agg.patterns ?? (agg.patterns = /* @__PURE__ */ new Set());
|
|
4537
|
+
agg.patterns.add(pattern);
|
|
4538
|
+
};
|
|
4539
|
+
var intersectMime = (agg, mime) => {
|
|
4540
|
+
agg.mime = agg.mime ? agg.mime.filter((m) => mime.includes(m)) : [...mime];
|
|
4541
|
+
};
|
|
4542
|
+
var setFormat = (agg, format) => {
|
|
4543
|
+
agg.format = format;
|
|
4544
|
+
if (format.includes("int"))
|
|
4545
|
+
agg.isInt = true;
|
|
4546
|
+
};
|
|
4547
|
+
var minContributor = (agg, def) => narrowMin(agg, "minimum", def.minimum);
|
|
4548
|
+
var maxContributor = (agg, def) => narrowMax(agg, "maximum", def.maximum);
|
|
4549
|
+
var formatContributor = (ranges) => (agg, def) => {
|
|
4550
|
+
setFormat(agg, def.format);
|
|
4551
|
+
const [minimum, maximum] = ranges[def.format];
|
|
4552
|
+
narrowMin(agg, "minimum", minimum);
|
|
4553
|
+
narrowMax(agg, "maximum", maximum);
|
|
4554
|
+
};
|
|
4555
|
+
var contributors = {
|
|
4556
|
+
greater_than: (agg, def) => narrowMin(agg, def.inclusive ? "minimum" : "exclusiveMinimum", def.value),
|
|
4557
|
+
less_than: (agg, def) => narrowMax(agg, def.inclusive ? "maximum" : "exclusiveMaximum", def.value),
|
|
4558
|
+
multiple_of: (agg, def) => addDivisor(agg, def.value),
|
|
4559
|
+
number_format: formatContributor(NUMBER_FORMAT_RANGES),
|
|
4560
|
+
bigint_format: formatContributor(BIGINT_FORMAT_RANGES),
|
|
4561
|
+
min_length: minContributor,
|
|
4562
|
+
max_length: maxContributor,
|
|
4563
|
+
length_equals: (agg, def) => narrowBoth(agg, def.length),
|
|
4564
|
+
min_size: minContributor,
|
|
4565
|
+
max_size: maxContributor,
|
|
4566
|
+
size_equals: (agg, def) => narrowBoth(agg, def.size),
|
|
4567
|
+
string_format: (agg, def) => {
|
|
4568
|
+
setFormat(agg, def.format);
|
|
4569
|
+
if (def.pattern)
|
|
4570
|
+
addPattern(agg, def.pattern);
|
|
4571
|
+
if (def.format === "base64" || def.format === "base64url")
|
|
4572
|
+
agg.contentEncoding = def.format;
|
|
4573
|
+
if (def.local || def.precision === -1)
|
|
4574
|
+
agg.laxFormat = true;
|
|
4575
|
+
},
|
|
4576
|
+
mime_type: (agg, def) => intersectMime(agg, def.mime)
|
|
4577
|
+
};
|
|
4578
|
+
function aggregateChecks(schema) {
|
|
4579
|
+
const agg = {};
|
|
4580
|
+
const def = schema._zod.def;
|
|
4581
|
+
const list = schema._zod.traits.has("$ZodCheck") ? [schema, ...def.checks ?? []] : def.checks ?? [];
|
|
4582
|
+
for (const ch of list)
|
|
4583
|
+
contributors[ch._zod.def.check]?.(agg, ch._zod.def);
|
|
4584
|
+
const bag = schema._zod.bag;
|
|
4585
|
+
if (bag.minimum !== void 0)
|
|
4586
|
+
narrowMin(agg, "minimum", bag.minimum);
|
|
4587
|
+
if (bag.exclusiveMinimum !== void 0)
|
|
4588
|
+
narrowMin(agg, "exclusiveMinimum", bag.exclusiveMinimum);
|
|
4589
|
+
if (bag.maximum !== void 0)
|
|
4590
|
+
narrowMax(agg, "maximum", bag.maximum);
|
|
4591
|
+
if (bag.exclusiveMaximum !== void 0)
|
|
4592
|
+
narrowMax(agg, "exclusiveMaximum", bag.exclusiveMaximum);
|
|
4593
|
+
if (bag.multipleOf !== void 0)
|
|
4594
|
+
addDivisor(agg, bag.multipleOf);
|
|
4595
|
+
if (bag.format !== void 0) {
|
|
4596
|
+
agg.format ?? (agg.format = bag.format);
|
|
4597
|
+
if (bag.format.includes("int"))
|
|
4598
|
+
agg.isInt = true;
|
|
4599
|
+
}
|
|
4600
|
+
if (bag.mime)
|
|
4601
|
+
intersectMime(agg, bag.mime);
|
|
4602
|
+
for (const pattern of bag.patterns ?? [])
|
|
4603
|
+
addPattern(agg, pattern);
|
|
4604
|
+
return agg;
|
|
4605
|
+
}
|
|
3554
4606
|
var formatMap = {
|
|
3555
4607
|
guid: "uuid",
|
|
3556
4608
|
url: "uri",
|
|
@@ -3559,10 +4611,15 @@ var formatMap = {
|
|
|
3559
4611
|
regex: ""
|
|
3560
4612
|
// do not set
|
|
3561
4613
|
};
|
|
4614
|
+
var exactPatterns = /* @__PURE__ */ new Map([
|
|
4615
|
+
[base64Charset, base64],
|
|
4616
|
+
[base64urlCharset, base64url]
|
|
4617
|
+
]);
|
|
4618
|
+
var exactPattern = (p) => exactPatterns.get(p) ?? p;
|
|
3562
4619
|
var stringProcessor = (schema, ctx, _json, _params) => {
|
|
3563
4620
|
const json = _json;
|
|
3564
4621
|
json.type = "string";
|
|
3565
|
-
const { minimum, maximum, format, patterns, contentEncoding } = schema
|
|
4622
|
+
const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = aggregateChecks(schema);
|
|
3566
4623
|
if (typeof minimum === "number")
|
|
3567
4624
|
json.minLength = minimum;
|
|
3568
4625
|
if (typeof maximum === "number")
|
|
@@ -3571,19 +4628,19 @@ var stringProcessor = (schema, ctx, _json, _params) => {
|
|
|
3571
4628
|
json.format = formatMap[format] ?? format;
|
|
3572
4629
|
if (json.format === "")
|
|
3573
4630
|
delete json.format;
|
|
3574
|
-
if (format === "time") {
|
|
4631
|
+
if (format === "time" || laxFormat) {
|
|
3575
4632
|
delete json.format;
|
|
3576
4633
|
}
|
|
3577
4634
|
}
|
|
3578
4635
|
if (contentEncoding)
|
|
3579
4636
|
json.contentEncoding = contentEncoding;
|
|
3580
4637
|
if (patterns && patterns.size > 0) {
|
|
3581
|
-
const
|
|
3582
|
-
if (
|
|
3583
|
-
json.pattern =
|
|
3584
|
-
else if (
|
|
4638
|
+
const patternList = [...patterns].map(exactPattern);
|
|
4639
|
+
if (patternList.length === 1)
|
|
4640
|
+
json.pattern = patternList[0].source;
|
|
4641
|
+
else if (patternList.length > 1) {
|
|
3585
4642
|
json.allOf = [
|
|
3586
|
-
...
|
|
4643
|
+
...patternList.map((regex) => ({
|
|
3587
4644
|
...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
|
|
3588
4645
|
pattern: regex.source
|
|
3589
4646
|
}))
|
|
@@ -3591,13 +4648,10 @@ var stringProcessor = (schema, ctx, _json, _params) => {
|
|
|
3591
4648
|
}
|
|
3592
4649
|
}
|
|
3593
4650
|
};
|
|
3594
|
-
var numberProcessor = (schema, ctx, _json,
|
|
4651
|
+
var numberProcessor = (schema, ctx, _json, params) => {
|
|
3595
4652
|
const json = _json;
|
|
3596
|
-
const { minimum, maximum,
|
|
3597
|
-
|
|
3598
|
-
json.type = "integer";
|
|
3599
|
-
else
|
|
3600
|
-
json.type = "number";
|
|
4653
|
+
const { minimum, maximum, multipleOf, exclusiveMaximum, exclusiveMinimum, isInt } = aggregateChecks(schema);
|
|
4654
|
+
json.type = isInt ? "integer" : "number";
|
|
3601
4655
|
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
|
|
3602
4656
|
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
|
|
3603
4657
|
const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
|
|
@@ -3621,8 +4675,20 @@ var numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
3621
4675
|
} else if (typeof maximum === "number") {
|
|
3622
4676
|
json.maximum = maximum;
|
|
3623
4677
|
}
|
|
3624
|
-
if (
|
|
3625
|
-
|
|
4678
|
+
if (multipleOf) {
|
|
4679
|
+
const divisors = /* @__PURE__ */ new Set();
|
|
4680
|
+
for (const divisor of multipleOf) {
|
|
4681
|
+
if (Number.isFinite(divisor) && divisor !== 0)
|
|
4682
|
+
divisors.add(Math.abs(divisor));
|
|
4683
|
+
else
|
|
4684
|
+
handleUnrepresentable(schema, ctx, json, params, `A multipleOf divisor of ${divisor} cannot be represented in JSON Schema`);
|
|
4685
|
+
}
|
|
4686
|
+
const [first, ...rest] = divisors;
|
|
4687
|
+
if (first !== void 0)
|
|
4688
|
+
json.multipleOf = first;
|
|
4689
|
+
if (rest.length)
|
|
4690
|
+
json.allOf = [...json.allOf ?? [], ...rest.map((m) => ({ multipleOf: m }))];
|
|
4691
|
+
}
|
|
3626
4692
|
};
|
|
3627
4693
|
var neverProcessor = (_schema, _ctx, json, _params) => {
|
|
3628
4694
|
json.not = {};
|
|
@@ -3632,59 +4698,71 @@ var unknownProcessor = (_schema, _ctx, _json, _params) => {
|
|
|
3632
4698
|
var enumProcessor = (schema, _ctx, json, _params) => {
|
|
3633
4699
|
const def = schema._zod.def;
|
|
3634
4700
|
const values = getEnumValues(def.entries);
|
|
4701
|
+
if (values.length === 0) {
|
|
4702
|
+
json.not = {};
|
|
4703
|
+
return;
|
|
4704
|
+
}
|
|
3635
4705
|
if (values.every((v) => typeof v === "number"))
|
|
3636
4706
|
json.type = "number";
|
|
3637
4707
|
if (values.every((v) => typeof v === "string"))
|
|
3638
4708
|
json.type = "string";
|
|
3639
4709
|
json.enum = values;
|
|
3640
4710
|
};
|
|
3641
|
-
var customProcessor = (
|
|
3642
|
-
|
|
3643
|
-
throw new Error("Custom types cannot be represented in JSON Schema");
|
|
3644
|
-
}
|
|
4711
|
+
var customProcessor = (schema, ctx, json, params) => {
|
|
4712
|
+
handleUnrepresentable(schema, ctx, json, params, "Custom types cannot be represented in JSON Schema");
|
|
3645
4713
|
};
|
|
3646
|
-
var transformProcessor = (
|
|
3647
|
-
|
|
3648
|
-
throw new Error("Transforms cannot be represented in JSON Schema");
|
|
3649
|
-
}
|
|
4714
|
+
var transformProcessor = (schema, ctx, json, params) => {
|
|
4715
|
+
handleUnrepresentable(schema, ctx, json, params, "Transforms cannot be represented in JSON Schema");
|
|
3650
4716
|
};
|
|
3651
4717
|
var arrayProcessor = (schema, ctx, _json, params) => {
|
|
3652
4718
|
const json = _json;
|
|
3653
4719
|
const def = schema._zod.def;
|
|
3654
|
-
const { minimum, maximum } = schema
|
|
4720
|
+
const { minimum, maximum } = aggregateChecks(schema);
|
|
3655
4721
|
if (typeof minimum === "number")
|
|
3656
4722
|
json.minItems = minimum;
|
|
3657
4723
|
if (typeof maximum === "number")
|
|
3658
4724
|
json.maxItems = maximum;
|
|
3659
4725
|
json.type = "array";
|
|
3660
|
-
json.items =
|
|
4726
|
+
json.items = processSchema(def.element, ctx, {
|
|
3661
4727
|
...params,
|
|
3662
4728
|
path: [...params.path, "items"]
|
|
3663
4729
|
});
|
|
3664
4730
|
};
|
|
4731
|
+
function inputOptin(schema) {
|
|
4732
|
+
const def = schema._zod.def;
|
|
4733
|
+
if (def.type === "pipe" && def.in._zod.traits.has("$ZodTransform")) {
|
|
4734
|
+
return inputOptin(def.out);
|
|
4735
|
+
}
|
|
4736
|
+
if (def.type === "catch") {
|
|
4737
|
+
return inputOptin(def.innerType);
|
|
4738
|
+
}
|
|
4739
|
+
return schema._zod.optin;
|
|
4740
|
+
}
|
|
3665
4741
|
var objectProcessor = (schema, ctx, _json, params) => {
|
|
3666
4742
|
const json = _json;
|
|
3667
4743
|
const def = schema._zod.def;
|
|
4744
|
+
const shape = def.shape;
|
|
4745
|
+
const symbolKeys = Object.getOwnPropertySymbols(shape);
|
|
4746
|
+
if (symbolKeys.length && handleUnrepresentable(schema, ctx, json, params, "Symbol keys cannot be represented in JSON Schema")) {
|
|
4747
|
+
return;
|
|
4748
|
+
}
|
|
3668
4749
|
json.type = "object";
|
|
3669
4750
|
json.properties = {};
|
|
3670
|
-
const shape = def.shape;
|
|
3671
4751
|
for (const key in shape) {
|
|
3672
|
-
json.properties
|
|
4752
|
+
assignProp(json.properties, key, processSchema(shape[key], ctx, {
|
|
3673
4753
|
...params,
|
|
3674
4754
|
path: [...params.path, "properties", key]
|
|
3675
|
-
});
|
|
4755
|
+
}));
|
|
3676
4756
|
}
|
|
3677
|
-
const
|
|
3678
|
-
const
|
|
3679
|
-
const
|
|
3680
|
-
if (ctx.io === "input") {
|
|
3681
|
-
|
|
3682
|
-
} else {
|
|
3683
|
-
return v.optout === void 0;
|
|
4757
|
+
const requiredKeys = [];
|
|
4758
|
+
for (const key of Object.keys(shape)) {
|
|
4759
|
+
const field = def.shape[key];
|
|
4760
|
+
if (ctx.io === "input" ? inputOptin(field) === void 0 : field._zod.optout === void 0) {
|
|
4761
|
+
requiredKeys.push(key);
|
|
3684
4762
|
}
|
|
3685
|
-
}
|
|
3686
|
-
if (requiredKeys.
|
|
3687
|
-
json.required =
|
|
4763
|
+
}
|
|
4764
|
+
if (requiredKeys.length > 0) {
|
|
4765
|
+
json.required = requiredKeys;
|
|
3688
4766
|
}
|
|
3689
4767
|
if (def.catchall?._zod.def.type === "never") {
|
|
3690
4768
|
json.additionalProperties = false;
|
|
@@ -3692,7 +4770,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
3692
4770
|
if (ctx.io === "output")
|
|
3693
4771
|
json.additionalProperties = false;
|
|
3694
4772
|
} else if (def.catchall) {
|
|
3695
|
-
json.additionalProperties =
|
|
4773
|
+
json.additionalProperties = processSchema(def.catchall, ctx, {
|
|
3696
4774
|
...params,
|
|
3697
4775
|
path: [...params.path, "additionalProperties"]
|
|
3698
4776
|
});
|
|
@@ -3701,7 +4779,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
|
|
|
3701
4779
|
var unionProcessor = (schema, ctx, json, params) => {
|
|
3702
4780
|
const def = schema._zod.def;
|
|
3703
4781
|
const isExclusive = def.inclusive === false;
|
|
3704
|
-
const options = def.options.map((x, i) =>
|
|
4782
|
+
const options = def.options.map((x, i) => processSchema(x, ctx, {
|
|
3705
4783
|
...params,
|
|
3706
4784
|
path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
|
|
3707
4785
|
}));
|
|
@@ -3713,11 +4791,11 @@ var unionProcessor = (schema, ctx, json, params) => {
|
|
|
3713
4791
|
};
|
|
3714
4792
|
var intersectionProcessor = (schema, ctx, json, params) => {
|
|
3715
4793
|
const def = schema._zod.def;
|
|
3716
|
-
const a =
|
|
4794
|
+
const a = processSchema(def.left, ctx, {
|
|
3717
4795
|
...params,
|
|
3718
4796
|
path: [...params.path, "allOf", 0]
|
|
3719
4797
|
});
|
|
3720
|
-
const b =
|
|
4798
|
+
const b = processSchema(def.right, ctx, {
|
|
3721
4799
|
...params,
|
|
3722
4800
|
path: [...params.path, "allOf", 1]
|
|
3723
4801
|
});
|
|
@@ -3727,10 +4805,11 @@ var intersectionProcessor = (schema, ctx, json, params) => {
|
|
|
3727
4805
|
...isSimpleIntersection(b) ? b.allOf : [b]
|
|
3728
4806
|
];
|
|
3729
4807
|
json.allOf = allOf;
|
|
4808
|
+
ctx.intersections.push(allOf);
|
|
3730
4809
|
};
|
|
3731
4810
|
var nullableProcessor = (schema, ctx, json, params) => {
|
|
3732
4811
|
const def = schema._zod.def;
|
|
3733
|
-
const inner =
|
|
4812
|
+
const inner = processSchema(def.innerType, ctx, params);
|
|
3734
4813
|
const seen = ctx.seen.get(schema);
|
|
3735
4814
|
if (ctx.target === "openapi-3.0") {
|
|
3736
4815
|
seen.ref = def.innerType;
|
|
@@ -3741,35 +4820,55 @@ var nullableProcessor = (schema, ctx, json, params) => {
|
|
|
3741
4820
|
};
|
|
3742
4821
|
var nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
3743
4822
|
const def = schema._zod.def;
|
|
3744
|
-
|
|
4823
|
+
processSchema(def.innerType, ctx, params);
|
|
3745
4824
|
const seen = ctx.seen.get(schema);
|
|
3746
4825
|
seen.ref = def.innerType;
|
|
3747
4826
|
};
|
|
4827
|
+
var UNREPRESENTABLE_DEFAULT = Symbol();
|
|
4828
|
+
function serializeDefaultValue(value, schema, ctx, json, params) {
|
|
4829
|
+
let unrepresentable = false;
|
|
4830
|
+
const serialized = JSON.stringify(value, (_, val) => {
|
|
4831
|
+
if (typeof val !== "bigint")
|
|
4832
|
+
return val;
|
|
4833
|
+
unrepresentable = true;
|
|
4834
|
+
return null;
|
|
4835
|
+
});
|
|
4836
|
+
if (!unrepresentable)
|
|
4837
|
+
return JSON.parse(serialized);
|
|
4838
|
+
handleUnrepresentable(schema, ctx, json, params, "BigInt defaults cannot be represented in JSON Schema");
|
|
4839
|
+
return UNREPRESENTABLE_DEFAULT;
|
|
4840
|
+
}
|
|
3748
4841
|
var defaultProcessor = (schema, ctx, json, params) => {
|
|
3749
4842
|
const def = schema._zod.def;
|
|
3750
|
-
|
|
4843
|
+
processSchema(def.innerType, ctx, params);
|
|
3751
4844
|
const seen = ctx.seen.get(schema);
|
|
3752
4845
|
seen.ref = def.innerType;
|
|
3753
|
-
|
|
4846
|
+
const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
|
|
4847
|
+
if (value !== UNREPRESENTABLE_DEFAULT)
|
|
4848
|
+
json.default = value;
|
|
3754
4849
|
};
|
|
3755
4850
|
var prefaultProcessor = (schema, ctx, json, params) => {
|
|
3756
4851
|
const def = schema._zod.def;
|
|
3757
|
-
|
|
4852
|
+
processSchema(def.innerType, ctx, params);
|
|
3758
4853
|
const seen = ctx.seen.get(schema);
|
|
3759
4854
|
seen.ref = def.innerType;
|
|
3760
|
-
if (ctx.io
|
|
3761
|
-
|
|
4855
|
+
if (ctx.io !== "input")
|
|
4856
|
+
return;
|
|
4857
|
+
const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
|
|
4858
|
+
if (value !== UNREPRESENTABLE_DEFAULT)
|
|
4859
|
+
json._prefault = value;
|
|
3762
4860
|
};
|
|
3763
4861
|
var catchProcessor = (schema, ctx, json, params) => {
|
|
3764
4862
|
const def = schema._zod.def;
|
|
3765
|
-
|
|
4863
|
+
processSchema(def.innerType, ctx, params);
|
|
3766
4864
|
const seen = ctx.seen.get(schema);
|
|
3767
4865
|
seen.ref = def.innerType;
|
|
3768
4866
|
let catchValue;
|
|
3769
4867
|
try {
|
|
3770
4868
|
catchValue = def.catchValue(void 0);
|
|
3771
4869
|
} catch {
|
|
3772
|
-
|
|
4870
|
+
handleUnrepresentable(schema, ctx, json, params, "Dynamic catch values are not supported in JSON Schema");
|
|
4871
|
+
return;
|
|
3773
4872
|
}
|
|
3774
4873
|
json.default = catchValue;
|
|
3775
4874
|
};
|
|
@@ -3777,98 +4876,74 @@ var pipeProcessor = (schema, ctx, _json, params) => {
|
|
|
3777
4876
|
const def = schema._zod.def;
|
|
3778
4877
|
const inIsTransform = def.in._zod.traits.has("$ZodTransform");
|
|
3779
4878
|
const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
|
|
3780
|
-
|
|
4879
|
+
processSchema(innerType, ctx, params);
|
|
3781
4880
|
const seen = ctx.seen.get(schema);
|
|
3782
4881
|
seen.ref = innerType;
|
|
3783
4882
|
};
|
|
3784
4883
|
var readonlyProcessor = (schema, ctx, json, params) => {
|
|
3785
4884
|
const def = schema._zod.def;
|
|
3786
|
-
|
|
4885
|
+
processSchema(def.innerType, ctx, params);
|
|
3787
4886
|
const seen = ctx.seen.get(schema);
|
|
3788
4887
|
seen.ref = def.innerType;
|
|
3789
4888
|
json.readOnly = true;
|
|
3790
4889
|
};
|
|
3791
4890
|
var optionalProcessor = (schema, ctx, _json, params) => {
|
|
3792
4891
|
const def = schema._zod.def;
|
|
3793
|
-
|
|
4892
|
+
processSchema(def.innerType, ctx, params);
|
|
3794
4893
|
const seen = ctx.seen.get(schema);
|
|
3795
4894
|
seen.ref = def.innerType;
|
|
3796
4895
|
};
|
|
3797
4896
|
|
|
3798
|
-
// node_modules/zod/v4/classic/iso.js
|
|
3799
|
-
var ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
|
|
3800
|
-
$ZodISODateTime.init(inst, def);
|
|
3801
|
-
ZodStringFormat.init(inst, def);
|
|
3802
|
-
});
|
|
3803
|
-
function datetime2(params) {
|
|
3804
|
-
return _isoDateTime(ZodISODateTime, params);
|
|
3805
|
-
}
|
|
3806
|
-
var ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => {
|
|
3807
|
-
$ZodISODate.init(inst, def);
|
|
3808
|
-
ZodStringFormat.init(inst, def);
|
|
3809
|
-
});
|
|
3810
|
-
function date2(params) {
|
|
3811
|
-
return _isoDate(ZodISODate, params);
|
|
3812
|
-
}
|
|
3813
|
-
var ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => {
|
|
3814
|
-
$ZodISOTime.init(inst, def);
|
|
3815
|
-
ZodStringFormat.init(inst, def);
|
|
3816
|
-
});
|
|
3817
|
-
function time2(params) {
|
|
3818
|
-
return _isoTime(ZodISOTime, params);
|
|
3819
|
-
}
|
|
3820
|
-
var ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def) => {
|
|
3821
|
-
$ZodISODuration.init(inst, def);
|
|
3822
|
-
ZodStringFormat.init(inst, def);
|
|
3823
|
-
});
|
|
3824
|
-
function duration2(params) {
|
|
3825
|
-
return _isoDuration(ZodISODuration, params);
|
|
3826
|
-
}
|
|
3827
|
-
|
|
3828
4897
|
// node_modules/zod/v4/classic/errors.js
|
|
4898
|
+
var _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
|
|
4899
|
+
function _lazyMethod(proto, key, make) {
|
|
4900
|
+
Object.defineProperty(proto, key, {
|
|
4901
|
+
configurable: true,
|
|
4902
|
+
enumerable: false,
|
|
4903
|
+
get() {
|
|
4904
|
+
const value = make(this);
|
|
4905
|
+
Object.defineProperty(this, key, { value, configurable: true, writable: true });
|
|
4906
|
+
return value;
|
|
4907
|
+
},
|
|
4908
|
+
set(value) {
|
|
4909
|
+
Object.defineProperty(this, key, { value, configurable: true, writable: true });
|
|
4910
|
+
}
|
|
4911
|
+
});
|
|
4912
|
+
}
|
|
3829
4913
|
var initializer2 = (inst, issues) => {
|
|
3830
4914
|
$ZodError.init(inst, issues);
|
|
3831
4915
|
inst.name = "ZodError";
|
|
3832
|
-
Object.
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
3852
|
-
}
|
|
3853
|
-
// enumerable: false,
|
|
3854
|
-
},
|
|
3855
|
-
isEmpty: {
|
|
3856
|
-
get() {
|
|
3857
|
-
return inst.issues.length === 0;
|
|
3858
|
-
}
|
|
3859
|
-
// enumerable: false,
|
|
4916
|
+
const proto = Object.getPrototypeOf(inst);
|
|
4917
|
+
if (_installedErrorProtos.has(proto))
|
|
4918
|
+
return;
|
|
4919
|
+
_installedErrorProtos.add(proto);
|
|
4920
|
+
_lazyMethod(proto, "format", (self) => (mapper) => formatError(self, mapper));
|
|
4921
|
+
_lazyMethod(proto, "flatten", (self) => (mapper) => flattenError(self, mapper));
|
|
4922
|
+
_lazyMethod(proto, "addIssue", (self) => (issue2) => {
|
|
4923
|
+
self.issues.push(issue2);
|
|
4924
|
+
self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2);
|
|
4925
|
+
});
|
|
4926
|
+
_lazyMethod(proto, "addIssues", (self) => (issues2) => {
|
|
4927
|
+
self.issues.push(...issues2);
|
|
4928
|
+
self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2);
|
|
4929
|
+
});
|
|
4930
|
+
Object.defineProperty(proto, "isEmpty", {
|
|
4931
|
+
configurable: true,
|
|
4932
|
+
enumerable: false,
|
|
4933
|
+
get() {
|
|
4934
|
+
return this.issues.length === 0;
|
|
3860
4935
|
}
|
|
3861
4936
|
});
|
|
3862
4937
|
};
|
|
3863
|
-
var ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer2, {
|
|
4938
|
+
var ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer2, void 0, {
|
|
3864
4939
|
Parent: Error
|
|
3865
4940
|
});
|
|
3866
4941
|
|
|
3867
4942
|
// node_modules/zod/v4/classic/parse.js
|
|
3868
|
-
var
|
|
3869
|
-
var
|
|
3870
|
-
var
|
|
3871
|
-
var
|
|
4943
|
+
var parse = /* @__PURE__ */ _parse(ZodRealError);
|
|
4944
|
+
var parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
4945
|
+
var safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
4946
|
+
var safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError);
|
|
3872
4947
|
var encode = /* @__PURE__ */ _encode(ZodRealError);
|
|
3873
4948
|
var decode = /* @__PURE__ */ _decode(ZodRealError);
|
|
3874
4949
|
var encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
|
|
@@ -3879,181 +4954,201 @@ var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
|
3879
4954
|
var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
3880
4955
|
|
|
3881
4956
|
// node_modules/zod/v4/classic/schemas.js
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
}
|
|
3890
|
-
if (installed.has(group))
|
|
3891
|
-
return;
|
|
3892
|
-
installed.add(group);
|
|
3893
|
-
for (const key in methods) {
|
|
3894
|
-
const fn = methods[key];
|
|
3895
|
-
Object.defineProperty(proto, key, {
|
|
3896
|
-
configurable: true,
|
|
3897
|
-
enumerable: false,
|
|
3898
|
-
get() {
|
|
3899
|
-
const bound = fn.bind(this);
|
|
3900
|
-
Object.defineProperty(this, key, {
|
|
3901
|
-
configurable: true,
|
|
3902
|
-
writable: true,
|
|
3903
|
-
enumerable: true,
|
|
3904
|
-
value: bound
|
|
3905
|
-
});
|
|
3906
|
-
return bound;
|
|
3907
|
-
},
|
|
3908
|
-
set(v) {
|
|
3909
|
-
Object.defineProperty(this, key, {
|
|
3910
|
-
configurable: true,
|
|
3911
|
-
writable: true,
|
|
3912
|
-
enumerable: true,
|
|
3913
|
-
value: v
|
|
3914
|
-
});
|
|
3915
|
-
}
|
|
3916
|
-
});
|
|
3917
|
-
}
|
|
4957
|
+
function _ensureDefaultLocale() {
|
|
4958
|
+
if (!globalConfig.localeError)
|
|
4959
|
+
config(en_default());
|
|
4960
|
+
}
|
|
4961
|
+
function _ensureDefaultMemoizer() {
|
|
4962
|
+
if (!globalConfig.memoizer)
|
|
4963
|
+
config({ memoizer: memoizer() });
|
|
3918
4964
|
}
|
|
3919
4965
|
var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
4966
|
+
_ensureDefaultLocale();
|
|
3920
4967
|
$ZodType.init(inst, def);
|
|
3921
|
-
Object.assign(inst["~standard"], {
|
|
3922
|
-
jsonSchema: {
|
|
3923
|
-
input: createStandardJSONSchemaMethod(inst, "input"),
|
|
3924
|
-
output: createStandardJSONSchemaMethod(inst, "output")
|
|
3925
|
-
}
|
|
3926
|
-
});
|
|
3927
|
-
inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
|
|
3928
4968
|
inst.def = def;
|
|
3929
4969
|
inst.type = def.type;
|
|
3930
|
-
Object.defineProperty(inst, "_def", { value: def });
|
|
3931
|
-
inst.parse = (data, params) => parse2(inst, data, params, { callee: inst.parse });
|
|
3932
|
-
inst.safeParse = (data, params) => safeParse2(inst, data, params);
|
|
3933
|
-
inst.parseAsync = async (data, params) => parseAsync2(inst, data, params, { callee: inst.parseAsync });
|
|
3934
|
-
inst.safeParseAsync = async (data, params) => safeParseAsync2(inst, data, params);
|
|
3935
|
-
inst.spa = inst.safeParseAsync;
|
|
3936
|
-
inst.encode = (data, params) => encode(inst, data, params);
|
|
3937
|
-
inst.decode = (data, params) => decode(inst, data, params);
|
|
3938
|
-
inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
|
|
3939
|
-
inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
|
|
3940
|
-
inst.safeEncode = (data, params) => safeEncode(inst, data, params);
|
|
3941
|
-
inst.safeDecode = (data, params) => safeDecode(inst, data, params);
|
|
3942
|
-
inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
|
|
3943
|
-
inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
|
|
3944
|
-
_installLazyMethods(inst, "ZodType", {
|
|
3945
|
-
check(...chks) {
|
|
3946
|
-
const def2 = this.def;
|
|
3947
|
-
return this.clone(util_exports.mergeDefs(def2, {
|
|
3948
|
-
checks: [
|
|
3949
|
-
...def2.checks ?? [],
|
|
3950
|
-
...chks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
|
|
3951
|
-
]
|
|
3952
|
-
}), { parent: true });
|
|
3953
|
-
},
|
|
3954
|
-
with(...chks) {
|
|
3955
|
-
return this.check(...chks);
|
|
3956
|
-
},
|
|
3957
|
-
clone(def2, params) {
|
|
3958
|
-
return clone(this, def2, params);
|
|
3959
|
-
},
|
|
3960
|
-
brand() {
|
|
3961
|
-
return this;
|
|
3962
|
-
},
|
|
3963
|
-
register(reg, meta2) {
|
|
3964
|
-
reg.add(this, meta2);
|
|
3965
|
-
return this;
|
|
3966
|
-
},
|
|
3967
|
-
refine(check, params) {
|
|
3968
|
-
return this.check(refine(check, params));
|
|
3969
|
-
},
|
|
3970
|
-
superRefine(refinement, params) {
|
|
3971
|
-
return this.check(superRefine(refinement, params));
|
|
3972
|
-
},
|
|
3973
|
-
overwrite(fn) {
|
|
3974
|
-
return this.check(_overwrite(fn));
|
|
3975
|
-
},
|
|
3976
|
-
optional() {
|
|
3977
|
-
return optional(this);
|
|
3978
|
-
},
|
|
3979
|
-
exactOptional() {
|
|
3980
|
-
return exactOptional(this);
|
|
3981
|
-
},
|
|
3982
|
-
nullable() {
|
|
3983
|
-
return nullable(this);
|
|
3984
|
-
},
|
|
3985
|
-
nullish() {
|
|
3986
|
-
return optional(nullable(this));
|
|
3987
|
-
},
|
|
3988
|
-
nonoptional(params) {
|
|
3989
|
-
return nonoptional(this, params);
|
|
3990
|
-
},
|
|
3991
|
-
array() {
|
|
3992
|
-
return array(this);
|
|
3993
|
-
},
|
|
3994
|
-
or(arg) {
|
|
3995
|
-
return union([this, arg]);
|
|
3996
|
-
},
|
|
3997
|
-
and(arg) {
|
|
3998
|
-
return intersection(this, arg);
|
|
3999
|
-
},
|
|
4000
|
-
transform(tx) {
|
|
4001
|
-
return pipe(this, transform(tx));
|
|
4002
|
-
},
|
|
4003
|
-
default(d) {
|
|
4004
|
-
return _default(this, d);
|
|
4005
|
-
},
|
|
4006
|
-
prefault(d) {
|
|
4007
|
-
return prefault(this, d);
|
|
4008
|
-
},
|
|
4009
|
-
catch(params) {
|
|
4010
|
-
return _catch(this, params);
|
|
4011
|
-
},
|
|
4012
|
-
pipe(target) {
|
|
4013
|
-
return pipe(this, target);
|
|
4014
|
-
},
|
|
4015
|
-
readonly() {
|
|
4016
|
-
return readonly(this);
|
|
4017
|
-
},
|
|
4018
|
-
describe(description) {
|
|
4019
|
-
const cl = this.clone();
|
|
4020
|
-
globalRegistry.add(cl, { description });
|
|
4021
|
-
return cl;
|
|
4022
|
-
},
|
|
4023
|
-
meta(...args) {
|
|
4024
|
-
if (args.length === 0)
|
|
4025
|
-
return globalRegistry.get(this);
|
|
4026
|
-
const cl = this.clone();
|
|
4027
|
-
globalRegistry.add(cl, args[0]);
|
|
4028
|
-
return cl;
|
|
4029
|
-
},
|
|
4030
|
-
isOptional() {
|
|
4031
|
-
return this.safeParse(void 0).success;
|
|
4032
|
-
},
|
|
4033
|
-
isNullable() {
|
|
4034
|
-
return this.safeParse(null).success;
|
|
4035
|
-
},
|
|
4036
|
-
apply(fn) {
|
|
4037
|
-
return fn(this);
|
|
4038
|
-
}
|
|
4039
|
-
});
|
|
4040
|
-
Object.defineProperty(inst, "description", {
|
|
4041
|
-
get() {
|
|
4042
|
-
return globalRegistry.get(inst)?.description;
|
|
4043
|
-
},
|
|
4044
|
-
configurable: true
|
|
4045
|
-
});
|
|
4046
4970
|
return inst;
|
|
4971
|
+
}, {
|
|
4972
|
+
check(...chks) {
|
|
4973
|
+
const def = this.def;
|
|
4974
|
+
return this.clone(util_exports.mergeDefs(def, {
|
|
4975
|
+
checks: [
|
|
4976
|
+
...def.checks ?? [],
|
|
4977
|
+
...chks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
|
|
4978
|
+
]
|
|
4979
|
+
}), { parent: true });
|
|
4980
|
+
},
|
|
4981
|
+
with(...chks) {
|
|
4982
|
+
return this.check(...chks);
|
|
4983
|
+
},
|
|
4984
|
+
clone(def, params) {
|
|
4985
|
+
return clone(this, def, params);
|
|
4986
|
+
},
|
|
4987
|
+
brand() {
|
|
4988
|
+
return this;
|
|
4989
|
+
},
|
|
4990
|
+
register(reg, meta2) {
|
|
4991
|
+
reg.add(this, meta2);
|
|
4992
|
+
return this;
|
|
4993
|
+
},
|
|
4994
|
+
refine(check, params) {
|
|
4995
|
+
return this.check(refine(check, params));
|
|
4996
|
+
},
|
|
4997
|
+
superRefine(refinement, params) {
|
|
4998
|
+
return this.check(superRefine(refinement, params));
|
|
4999
|
+
},
|
|
5000
|
+
overwrite(fn) {
|
|
5001
|
+
return this.check(_overwrite(fn));
|
|
5002
|
+
},
|
|
5003
|
+
optional() {
|
|
5004
|
+
return optional(this);
|
|
5005
|
+
},
|
|
5006
|
+
exactOptional() {
|
|
5007
|
+
return exactOptional(this);
|
|
5008
|
+
},
|
|
5009
|
+
nullable() {
|
|
5010
|
+
return nullable(this);
|
|
5011
|
+
},
|
|
5012
|
+
nullish() {
|
|
5013
|
+
return optional(nullable(this));
|
|
5014
|
+
},
|
|
5015
|
+
nonoptional(params) {
|
|
5016
|
+
return nonoptional(this, params);
|
|
5017
|
+
},
|
|
5018
|
+
array() {
|
|
5019
|
+
return array(this);
|
|
5020
|
+
},
|
|
5021
|
+
or(arg) {
|
|
5022
|
+
return union([this, arg]);
|
|
5023
|
+
},
|
|
5024
|
+
and(arg) {
|
|
5025
|
+
return intersection(this, arg);
|
|
5026
|
+
},
|
|
5027
|
+
transform(tx) {
|
|
5028
|
+
return pipe(this, transform(tx));
|
|
5029
|
+
},
|
|
5030
|
+
default(d) {
|
|
5031
|
+
return _default(this, d);
|
|
5032
|
+
},
|
|
5033
|
+
prefault(d) {
|
|
5034
|
+
return prefault(this, d);
|
|
5035
|
+
},
|
|
5036
|
+
catch(params) {
|
|
5037
|
+
return _catch(this, params);
|
|
5038
|
+
},
|
|
5039
|
+
pipe(target) {
|
|
5040
|
+
return pipe(this, target);
|
|
5041
|
+
},
|
|
5042
|
+
readonly() {
|
|
5043
|
+
return readonly(this);
|
|
5044
|
+
},
|
|
5045
|
+
describe(description) {
|
|
5046
|
+
const cl = this.clone();
|
|
5047
|
+
globalRegistry.add(cl, { description });
|
|
5048
|
+
return cl;
|
|
5049
|
+
},
|
|
5050
|
+
meta(...args) {
|
|
5051
|
+
if (args.length === 0)
|
|
5052
|
+
return globalRegistry.get(this);
|
|
5053
|
+
const cl = this.clone();
|
|
5054
|
+
globalRegistry.add(cl, args[0]);
|
|
5055
|
+
return cl;
|
|
5056
|
+
},
|
|
5057
|
+
isOptional() {
|
|
5058
|
+
return this.safeParse(void 0).success;
|
|
5059
|
+
},
|
|
5060
|
+
isNullable() {
|
|
5061
|
+
return this.safeParse(null).success;
|
|
5062
|
+
},
|
|
5063
|
+
apply(fn, ...args) {
|
|
5064
|
+
return args.length === 0 ? fn(this) : fn(this, ...args);
|
|
5065
|
+
},
|
|
5066
|
+
// Overrides core's `~standard` to add `jsonSchema`. Must stay a prototype entry: redefining it per instance demotes instances to dictionary mode.
|
|
5067
|
+
get "~standard"() {
|
|
5068
|
+
return util_exports.hide(this, "~standard", {
|
|
5069
|
+
...standardProps(this),
|
|
5070
|
+
jsonSchema: {
|
|
5071
|
+
input: createStandardJSONSchemaMethod(this, "input"),
|
|
5072
|
+
output: createStandardJSONSchemaMethod(this, "output")
|
|
5073
|
+
}
|
|
5074
|
+
});
|
|
5075
|
+
},
|
|
5076
|
+
set "~standard"(value) {
|
|
5077
|
+
util_exports.own(this, "~standard", value);
|
|
5078
|
+
},
|
|
5079
|
+
parse: function _parse2(data, params) {
|
|
5080
|
+
return parse(this, data, params, { callee: _parse2 });
|
|
5081
|
+
},
|
|
5082
|
+
parseAsync: async function _parseAsync2(data, params) {
|
|
5083
|
+
return await parseAsync(this, data, params, { callee: _parseAsync2 });
|
|
5084
|
+
},
|
|
5085
|
+
safeParse(data, params) {
|
|
5086
|
+
return safeParse(this, data, params);
|
|
5087
|
+
},
|
|
5088
|
+
async safeParseAsync(data, params) {
|
|
5089
|
+
return safeParseAsync(this, data, params);
|
|
5090
|
+
},
|
|
5091
|
+
// `spa` is an alias: same function object as `safeParseAsync`, as before.
|
|
5092
|
+
get spa() {
|
|
5093
|
+
return this?.safeParseAsync;
|
|
5094
|
+
},
|
|
5095
|
+
set spa(value) {
|
|
5096
|
+
util_exports.own(this, "spa", value);
|
|
5097
|
+
},
|
|
5098
|
+
validate(data, params) {
|
|
5099
|
+
return validate(this, data, params);
|
|
5100
|
+
},
|
|
5101
|
+
validateAsync(data, params) {
|
|
5102
|
+
return validateAsync(this, data, params);
|
|
5103
|
+
},
|
|
5104
|
+
encode: function _encode2(data, params) {
|
|
5105
|
+
return encode(this, data, params, { callee: _encode2 });
|
|
5106
|
+
},
|
|
5107
|
+
decode: function _decode2(data, params) {
|
|
5108
|
+
return decode(this, data, params, { callee: _decode2 });
|
|
5109
|
+
},
|
|
5110
|
+
encodeAsync: async function _encodeAsync2(data, params) {
|
|
5111
|
+
return await encodeAsync(this, data, params, { callee: _encodeAsync2 });
|
|
5112
|
+
},
|
|
5113
|
+
decodeAsync: async function _decodeAsync2(data, params) {
|
|
5114
|
+
return await decodeAsync(this, data, params, { callee: _decodeAsync2 });
|
|
5115
|
+
},
|
|
5116
|
+
safeEncode(data, params) {
|
|
5117
|
+
return safeEncode(this, data, params);
|
|
5118
|
+
},
|
|
5119
|
+
safeDecode(data, params) {
|
|
5120
|
+
return safeDecode(this, data, params);
|
|
5121
|
+
},
|
|
5122
|
+
async safeEncodeAsync(data, params) {
|
|
5123
|
+
return safeEncodeAsync(this, data, params);
|
|
5124
|
+
},
|
|
5125
|
+
async safeDecodeAsync(data, params) {
|
|
5126
|
+
return safeDecodeAsync(this, data, params);
|
|
5127
|
+
},
|
|
5128
|
+
toJSONSchema(params) {
|
|
5129
|
+
return createToJSONSchemaMethod(this, {})(params);
|
|
5130
|
+
},
|
|
5131
|
+
// Reads through to the registry on every access, so it must not cache.
|
|
5132
|
+
get description() {
|
|
5133
|
+
return globalRegistry.get(this)?.description;
|
|
5134
|
+
},
|
|
5135
|
+
// No setter: `schema._def = x` throws, as it did when `_def` was a non-writable own property.
|
|
5136
|
+
get _def() {
|
|
5137
|
+
return this._zod.def;
|
|
5138
|
+
}
|
|
4047
5139
|
});
|
|
4048
|
-
var _ZodString = /* @__PURE__ */ $constructor(
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
5140
|
+
var _ZodString = /* @__PURE__ */ $constructor(
|
|
5141
|
+
"_ZodString",
|
|
5142
|
+
(inst, def) => {
|
|
5143
|
+
$ZodString.init(inst, def);
|
|
5144
|
+
ZodType.init(inst, def);
|
|
5145
|
+
inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
|
|
5146
|
+
},
|
|
5147
|
+
/* @__PURE__ */ util_exports.derived({
|
|
5148
|
+
format: (inst) => aggregateChecks(inst).format ?? null,
|
|
5149
|
+
minLength: (inst) => aggregateChecks(inst).minimum ?? null,
|
|
5150
|
+
maxLength: (inst) => aggregateChecks(inst).maximum ?? null
|
|
5151
|
+
}, {
|
|
4057
5152
|
regex(...args) {
|
|
4058
5153
|
return this.check(_regex(...args));
|
|
4059
5154
|
},
|
|
@@ -4099,38 +5194,90 @@ var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
|
|
|
4099
5194
|
slugify() {
|
|
4100
5195
|
return this.check(_slugify());
|
|
4101
5196
|
}
|
|
4102
|
-
})
|
|
4103
|
-
|
|
5197
|
+
})
|
|
5198
|
+
);
|
|
4104
5199
|
var ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
|
|
4105
5200
|
$ZodString.init(inst, def);
|
|
4106
5201
|
_ZodString.init(inst, def);
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
5202
|
+
}, {
|
|
5203
|
+
email(params) {
|
|
5204
|
+
return this.check(_email(ZodEmail, params));
|
|
5205
|
+
},
|
|
5206
|
+
url(params) {
|
|
5207
|
+
return this.check(_url(ZodURL, params));
|
|
5208
|
+
},
|
|
5209
|
+
jwt(params) {
|
|
5210
|
+
return this.check(_jwt(ZodJWT, params));
|
|
5211
|
+
},
|
|
5212
|
+
emoji(params) {
|
|
5213
|
+
return this.check(_emoji2(ZodEmoji, params));
|
|
5214
|
+
},
|
|
5215
|
+
guid(params) {
|
|
5216
|
+
return this.check(_guid(ZodGUID, params));
|
|
5217
|
+
},
|
|
5218
|
+
uuid(params) {
|
|
5219
|
+
return this.check(_uuid(ZodUUID, params));
|
|
5220
|
+
},
|
|
5221
|
+
uuidv4(params) {
|
|
5222
|
+
return this.check(_uuidv4(ZodUUID, params));
|
|
5223
|
+
},
|
|
5224
|
+
uuidv6(params) {
|
|
5225
|
+
return this.check(_uuidv6(ZodUUID, params));
|
|
5226
|
+
},
|
|
5227
|
+
uuidv7(params) {
|
|
5228
|
+
return this.check(_uuidv7(ZodUUID, params));
|
|
5229
|
+
},
|
|
5230
|
+
nanoid(params) {
|
|
5231
|
+
return this.check(_nanoid(ZodNanoID, params));
|
|
5232
|
+
},
|
|
5233
|
+
cuid(params) {
|
|
5234
|
+
return this.check(_cuid(ZodCUID, params));
|
|
5235
|
+
},
|
|
5236
|
+
cuid2(params) {
|
|
5237
|
+
return this.check(_cuid2(ZodCUID2, params));
|
|
5238
|
+
},
|
|
5239
|
+
ulid(params) {
|
|
5240
|
+
return this.check(_ulid(ZodULID, params));
|
|
5241
|
+
},
|
|
5242
|
+
base64(params) {
|
|
5243
|
+
return this.check(_base64(ZodBase64, params));
|
|
5244
|
+
},
|
|
5245
|
+
base64url(params) {
|
|
5246
|
+
return this.check(_base64url(ZodBase64URL, params));
|
|
5247
|
+
},
|
|
5248
|
+
xid(params) {
|
|
5249
|
+
return this.check(_xid(ZodXID, params));
|
|
5250
|
+
},
|
|
5251
|
+
ksuid(params) {
|
|
5252
|
+
return this.check(_ksuid(ZodKSUID, params));
|
|
5253
|
+
},
|
|
5254
|
+
ipv4(params) {
|
|
5255
|
+
return this.check(_ipv4(ZodIPv4, params));
|
|
5256
|
+
},
|
|
5257
|
+
ipv6(params) {
|
|
5258
|
+
return this.check(_ipv6(ZodIPv6, params));
|
|
5259
|
+
},
|
|
5260
|
+
cidrv4(params) {
|
|
5261
|
+
return this.check(_cidrv4(ZodCIDRv4, params));
|
|
5262
|
+
},
|
|
5263
|
+
cidrv6(params) {
|
|
5264
|
+
return this.check(_cidrv6(ZodCIDRv6, params));
|
|
5265
|
+
},
|
|
5266
|
+
e164(params) {
|
|
5267
|
+
return this.check(_e164(ZodE164, params));
|
|
5268
|
+
},
|
|
5269
|
+
datetime(params) {
|
|
5270
|
+
return this.check(_isoDateTime(ZodISODateTime, params));
|
|
5271
|
+
},
|
|
5272
|
+
date(params) {
|
|
5273
|
+
return this.check(_isoDate(ZodISODate, params));
|
|
5274
|
+
},
|
|
5275
|
+
time(params) {
|
|
5276
|
+
return this.check(_isoTime(ZodISOTime, params));
|
|
5277
|
+
},
|
|
5278
|
+
duration(params) {
|
|
5279
|
+
return this.check(_isoDuration(ZodISODuration, params));
|
|
5280
|
+
}
|
|
4134
5281
|
});
|
|
4135
5282
|
function string2(params) {
|
|
4136
5283
|
return _string(ZodString, params);
|
|
@@ -4139,6 +5286,22 @@ var ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (inst, def
|
|
|
4139
5286
|
$ZodStringFormat.init(inst, def);
|
|
4140
5287
|
_ZodString.init(inst, def);
|
|
4141
5288
|
});
|
|
5289
|
+
var ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
|
|
5290
|
+
$ZodISODateTime.init(inst, def);
|
|
5291
|
+
ZodStringFormat.init(inst, def);
|
|
5292
|
+
});
|
|
5293
|
+
var ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => {
|
|
5294
|
+
$ZodISODate.init(inst, def);
|
|
5295
|
+
ZodStringFormat.init(inst, def);
|
|
5296
|
+
});
|
|
5297
|
+
var ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => {
|
|
5298
|
+
$ZodISOTime.init(inst, def);
|
|
5299
|
+
ZodStringFormat.init(inst, def);
|
|
5300
|
+
});
|
|
5301
|
+
var ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def) => {
|
|
5302
|
+
$ZodISODuration.init(inst, def);
|
|
5303
|
+
ZodStringFormat.init(inst, def);
|
|
5304
|
+
});
|
|
4142
5305
|
var ZodEmail = /* @__PURE__ */ $constructor("ZodEmail", (inst, def) => {
|
|
4143
5306
|
$ZodEmail.init(inst, def);
|
|
4144
5307
|
ZodStringFormat.init(inst, def);
|
|
@@ -4215,11 +5378,29 @@ var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
|
|
|
4215
5378
|
$ZodJWT.init(inst, def);
|
|
4216
5379
|
ZodStringFormat.init(inst, def);
|
|
4217
5380
|
});
|
|
4218
|
-
var ZodNumber = /* @__PURE__ */ $constructor(
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
5381
|
+
var ZodNumber = /* @__PURE__ */ $constructor(
|
|
5382
|
+
"ZodNumber",
|
|
5383
|
+
(inst, def) => {
|
|
5384
|
+
$ZodNumber.init(inst, def);
|
|
5385
|
+
ZodType.init(inst, def);
|
|
5386
|
+
inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
|
|
5387
|
+
inst.isFinite = true;
|
|
5388
|
+
},
|
|
5389
|
+
/* @__PURE__ */ util_exports.derived({
|
|
5390
|
+
minValue: (inst) => {
|
|
5391
|
+
const { minimum, exclusiveMinimum } = aggregateChecks(inst);
|
|
5392
|
+
return Math.max(minimum ?? Number.NEGATIVE_INFINITY, exclusiveMinimum ?? Number.NEGATIVE_INFINITY);
|
|
5393
|
+
},
|
|
5394
|
+
maxValue: (inst) => {
|
|
5395
|
+
const { maximum, exclusiveMaximum } = aggregateChecks(inst);
|
|
5396
|
+
return Math.min(maximum ?? Number.POSITIVE_INFINITY, exclusiveMaximum ?? Number.POSITIVE_INFINITY);
|
|
5397
|
+
},
|
|
5398
|
+
isInt: (inst) => {
|
|
5399
|
+
const { isInt, multipleOf } = aggregateChecks(inst);
|
|
5400
|
+
return !!isInt || !!multipleOf?.some(Number.isSafeInteger);
|
|
5401
|
+
},
|
|
5402
|
+
format: (inst) => aggregateChecks(inst).format ?? null
|
|
5403
|
+
}, {
|
|
4223
5404
|
gt(value, params) {
|
|
4224
5405
|
return this.check(_gt(value, params));
|
|
4225
5406
|
},
|
|
@@ -4265,14 +5446,8 @@ var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
|
|
|
4265
5446
|
finite() {
|
|
4266
5447
|
return this;
|
|
4267
5448
|
}
|
|
4268
|
-
})
|
|
4269
|
-
|
|
4270
|
-
inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
|
|
4271
|
-
inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
|
|
4272
|
-
inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? 0.5);
|
|
4273
|
-
inst.isFinite = true;
|
|
4274
|
-
inst.format = bag.format ?? null;
|
|
4275
|
-
});
|
|
5449
|
+
})
|
|
5450
|
+
);
|
|
4276
5451
|
function number2(params) {
|
|
4277
5452
|
return _number(ZodNumber, params);
|
|
4278
5453
|
}
|
|
@@ -4300,79 +5475,80 @@ function never(params) {
|
|
|
4300
5475
|
return _never(ZodNever, params);
|
|
4301
5476
|
}
|
|
4302
5477
|
var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
|
|
5478
|
+
_ensureDefaultMemoizer();
|
|
4303
5479
|
$ZodArray.init(inst, def);
|
|
4304
5480
|
ZodType.init(inst, def);
|
|
4305
5481
|
inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
|
|
4306
5482
|
inst.element = def.element;
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
});
|
|
5483
|
+
}, {
|
|
5484
|
+
min(n, params) {
|
|
5485
|
+
return this.check(_minLength(n, params));
|
|
5486
|
+
},
|
|
5487
|
+
nonempty(params) {
|
|
5488
|
+
return this.check(_minLength(1, params));
|
|
5489
|
+
},
|
|
5490
|
+
max(n, params) {
|
|
5491
|
+
return this.check(_maxLength(n, params));
|
|
5492
|
+
},
|
|
5493
|
+
length(n, params) {
|
|
5494
|
+
return this.check(_length(n, params));
|
|
5495
|
+
},
|
|
5496
|
+
unwrap() {
|
|
5497
|
+
return this.element;
|
|
5498
|
+
}
|
|
4324
5499
|
});
|
|
4325
5500
|
function array(element, params) {
|
|
4326
5501
|
return _array(ZodArray, element, params);
|
|
4327
5502
|
}
|
|
4328
5503
|
var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
5504
|
+
_ensureDefaultMemoizer();
|
|
4329
5505
|
$ZodObjectJIT.init(inst, def);
|
|
4330
5506
|
ZodType.init(inst, def);
|
|
4331
5507
|
inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
|
|
4332
|
-
util_exports.
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
}
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
}
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
}
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
}
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
}
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
}
|
|
5508
|
+
util_exports.installLazyProp(inst, "shape", (self) => self._zod.def.shape, false);
|
|
5509
|
+
}, {
|
|
5510
|
+
keyof() {
|
|
5511
|
+
return _enum(Object.keys(this._zod.def.shape));
|
|
5512
|
+
},
|
|
5513
|
+
catchall(catchall) {
|
|
5514
|
+
return this.clone(util_exports.mergeDefs(this._zod.def, { catchall }));
|
|
5515
|
+
},
|
|
5516
|
+
passthrough() {
|
|
5517
|
+
return this.clone(util_exports.mergeDefs(this._zod.def, { catchall: unknown() }));
|
|
5518
|
+
},
|
|
5519
|
+
loose() {
|
|
5520
|
+
return this.clone(util_exports.mergeDefs(this._zod.def, { catchall: unknown() }));
|
|
5521
|
+
},
|
|
5522
|
+
strict() {
|
|
5523
|
+
return this.clone(util_exports.mergeDefs(this._zod.def, { catchall: never() }));
|
|
5524
|
+
},
|
|
5525
|
+
strip() {
|
|
5526
|
+
return this.clone(util_exports.mergeDefs(this._zod.def, { catchall: void 0 }));
|
|
5527
|
+
},
|
|
5528
|
+
extend(incoming) {
|
|
5529
|
+
return util_exports.extend(this, incoming);
|
|
5530
|
+
},
|
|
5531
|
+
safeExtend(incoming) {
|
|
5532
|
+
return util_exports.safeExtend(this, incoming);
|
|
5533
|
+
},
|
|
5534
|
+
merge(other) {
|
|
5535
|
+
return util_exports.merge(this, other);
|
|
5536
|
+
},
|
|
5537
|
+
pick(mask) {
|
|
5538
|
+
return util_exports.pick(this, mask);
|
|
5539
|
+
},
|
|
5540
|
+
omit(mask) {
|
|
5541
|
+
return util_exports.omit(this, mask);
|
|
5542
|
+
},
|
|
5543
|
+
partial(...args) {
|
|
5544
|
+
return util_exports.partial(ZodOptional, this, args[0]);
|
|
5545
|
+
},
|
|
5546
|
+
exactPartial(...args) {
|
|
5547
|
+
return util_exports.partial(ZodExactOptional, this, args[0], "exactPartial");
|
|
5548
|
+
},
|
|
5549
|
+
required(...args) {
|
|
5550
|
+
return util_exports.required(ZodNonOptional, this, args[0]);
|
|
5551
|
+
}
|
|
4376
5552
|
});
|
|
4377
5553
|
function object(shape, params) {
|
|
4378
5554
|
const def = {
|
|
@@ -4412,7 +5588,7 @@ var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
|
4412
5588
|
ZodType.init(inst, def);
|
|
4413
5589
|
inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
|
|
4414
5590
|
inst.enum = def.entries;
|
|
4415
|
-
inst.options =
|
|
5591
|
+
inst.options = [...inst._zod.values];
|
|
4416
5592
|
const keys = new Set(Object.keys(def.entries));
|
|
4417
5593
|
inst.extract = (values, params) => {
|
|
4418
5594
|
const newEntries = {};
|
|
@@ -4454,6 +5630,7 @@ function _enum(values, params) {
|
|
|
4454
5630
|
});
|
|
4455
5631
|
}
|
|
4456
5632
|
var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
5633
|
+
_ensureDefaultMemoizer();
|
|
4457
5634
|
$ZodTransform.init(inst, def);
|
|
4458
5635
|
ZodType.init(inst, def);
|
|
4459
5636
|
inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
|
|
@@ -4469,7 +5646,8 @@ var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
|
4469
5646
|
if (_issue.fatal)
|
|
4470
5647
|
_issue.continue = false;
|
|
4471
5648
|
_issue.code ?? (_issue.code = "custom");
|
|
4472
|
-
|
|
5649
|
+
if (!("input" in _issue))
|
|
5650
|
+
_issue.input = payload.value;
|
|
4473
5651
|
_issue.inst ?? (_issue.inst = inst);
|
|
4474
5652
|
payload.issues.push(util_exports.issue(_issue));
|
|
4475
5653
|
}
|
|
@@ -4478,12 +5656,10 @@ var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
|
4478
5656
|
if (output instanceof Promise) {
|
|
4479
5657
|
return output.then((output2) => {
|
|
4480
5658
|
payload.value = output2;
|
|
4481
|
-
payload.fallback = true;
|
|
4482
5659
|
return payload;
|
|
4483
5660
|
});
|
|
4484
5661
|
}
|
|
4485
5662
|
payload.value = output;
|
|
4486
|
-
payload.fallback = true;
|
|
4487
5663
|
return payload;
|
|
4488
5664
|
};
|
|
4489
5665
|
});
|
|
@@ -4584,7 +5760,7 @@ function _catch(innerType, catchValue) {
|
|
|
4584
5760
|
return new ZodCatch({
|
|
4585
5761
|
type: "catch",
|
|
4586
5762
|
innerType,
|
|
4587
|
-
catchValue: typeof catchValue === "function" ? catchValue : ()
|
|
5763
|
+
catchValue: typeof catchValue === "function" ? catchValue : util_exports.constantCatch(catchValue)
|
|
4588
5764
|
});
|
|
4589
5765
|
}
|
|
4590
5766
|
var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
|
|
@@ -4680,6 +5856,10 @@ function buildServer(daemon) {
|
|
|
4680
5856
|
channelId: string2().optional(),
|
|
4681
5857
|
threadTs: string2().optional(),
|
|
4682
5858
|
threadUrl: string2().optional(),
|
|
5859
|
+
url: string2().optional(),
|
|
5860
|
+
space: string2().optional(),
|
|
5861
|
+
match: string2().optional(),
|
|
5862
|
+
exclude: string2().optional(),
|
|
4683
5863
|
pollIntervalSec: number2().min(15).optional(),
|
|
4684
5864
|
target: targetSchema
|
|
4685
5865
|
});
|
|
@@ -4693,7 +5873,7 @@ function buildServer(daemon) {
|
|
|
4693
5873
|
server.registerTool(
|
|
4694
5874
|
"monitor_create",
|
|
4695
5875
|
{
|
|
4696
|
-
description: "Create or reuse a monitor for a Jira issue, GitHub pull request, Slack thread, or
|
|
5876
|
+
description: "Create or reuse a monitor for a Jira issue, GitHub pull request, Slack thread, Slack DM, or a feed read through Yab.",
|
|
4697
5877
|
inputSchema: createSchema,
|
|
4698
5878
|
annotations: { idempotentHint: true, readOnlyHint: false }
|
|
4699
5879
|
},
|
|
@@ -4788,8 +5968,8 @@ function buildServer(daemon) {
|
|
|
4788
5968
|
function jsonResult(value) {
|
|
4789
5969
|
return { content: [{ type: "text", text: JSON.stringify(value) }], structuredContent: value };
|
|
4790
5970
|
}
|
|
4791
|
-
function errorResult(
|
|
4792
|
-
return { content: [{ type: "text", text:
|
|
5971
|
+
function errorResult(error2) {
|
|
5972
|
+
return { content: [{ type: "text", text: error2 }], isError: true };
|
|
4793
5973
|
}
|
|
4794
5974
|
export {
|
|
4795
5975
|
createSourcefedMcp,
|