@intlayer/ai 7.5.2 → 7.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/auditDictionaryMetadata/index.cjs +7 -7
- package/dist/cjs/auditDictionaryMetadata/index.cjs.map +1 -1
- package/dist/cjs/translateJSON/index.cjs +10 -10
- package/dist/cjs/translateJSON/index.cjs.map +1 -1
- package/dist/esm/auditDictionaryMetadata/index.mjs +7 -7
- package/dist/esm/auditDictionaryMetadata/index.mjs.map +1 -1
- package/dist/esm/translateJSON/index.mjs +10 -10
- package/dist/esm/translateJSON/index.mjs.map +1 -1
- package/package.json +7 -6
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/errors.cjs +0 -30
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/errors.cjs.map +0 -1
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/iso.cjs +0 -41
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/iso.cjs.map +0 -1
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/parse.cjs +0 -31
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/parse.cjs.map +0 -1
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/schemas.cjs +0 -577
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/schemas.cjs.map +0 -1
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/api.cjs +0 -535
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/api.cjs.map +0 -1
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/checks.cjs +0 -376
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/checks.cjs.map +0 -1
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/core.cjs +0 -67
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/core.cjs.map +0 -1
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/doc.cjs +0 -35
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/doc.cjs.map +0 -1
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/errors.cjs +0 -66
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/errors.cjs.map +0 -1
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/json-schema-processors.cjs +0 -239
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/json-schema-processors.cjs.map +0 -1
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/parse.cjs +0 -123
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/parse.cjs.map +0 -1
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/regexes.cjs +0 -88
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/regexes.cjs.map +0 -1
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/registries.cjs +0 -54
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/registries.cjs.map +0 -1
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/schemas.cjs +0 -1048
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/schemas.cjs.map +0 -1
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/to-json-schema.cjs +0 -263
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/to-json-schema.cjs.map +0 -1
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/util.cjs +0 -350
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/util.cjs.map +0 -1
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/versions.cjs +0 -11
- package/dist/cjs/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/versions.cjs.map +0 -1
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/errors.mjs +0 -30
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/errors.mjs.map +0 -1
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/iso.mjs +0 -38
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/iso.mjs.map +0 -1
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/parse.mjs +0 -20
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/parse.mjs.map +0 -1
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/schemas.mjs +0 -571
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/classic/schemas.mjs.map +0 -1
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/api.mjs +0 -478
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/api.mjs.map +0 -1
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/checks.mjs +0 -361
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/checks.mjs.map +0 -1
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/core.mjs +0 -62
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/core.mjs.map +0 -1
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/doc.mjs +0 -34
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/doc.mjs.map +0 -1
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/errors.mjs +0 -63
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/errors.mjs.map +0 -1
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/json-schema-processors.mjs +0 -219
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/json-schema-processors.mjs.map +0 -1
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/parse.mjs +0 -110
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/parse.mjs.map +0 -1
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/regexes.mjs +0 -61
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/regexes.mjs.map +0 -1
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/registries.mjs +0 -53
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/registries.mjs.map +0 -1
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/schemas.mjs +0 -1002
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/schemas.mjs.map +0 -1
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/to-json-schema.mjs +0 -261
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/to-json-schema.mjs.map +0 -1
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/util.mjs +0 -317
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/util.mjs.map +0 -1
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/versions.mjs +0 -10
- package/dist/esm/node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/versions.mjs.map +0 -1
|
@@ -1,1048 +0,0 @@
|
|
|
1
|
-
const require_core = require('./core.cjs');
|
|
2
|
-
const require_util = require('./util.cjs');
|
|
3
|
-
const require_parse = require('./parse.cjs');
|
|
4
|
-
const require_regexes = require('./regexes.cjs');
|
|
5
|
-
const require_checks = require('./checks.cjs');
|
|
6
|
-
const require_doc = require('./doc.cjs');
|
|
7
|
-
const require_versions = require('./versions.cjs');
|
|
8
|
-
|
|
9
|
-
//#region ../../../node_modules/.bun/zod@4.2.1/node_modules/zod/v4/core/schemas.js
|
|
10
|
-
const $ZodType = /* @__PURE__ */ require_core.$constructor("$ZodType", (inst, def) => {
|
|
11
|
-
var _a;
|
|
12
|
-
inst ?? (inst = {});
|
|
13
|
-
inst._zod.def = def;
|
|
14
|
-
inst._zod.bag = inst._zod.bag || {};
|
|
15
|
-
inst._zod.version = require_versions.version;
|
|
16
|
-
const checks = [...inst._zod.def.checks ?? []];
|
|
17
|
-
if (inst._zod.traits.has("$ZodCheck")) checks.unshift(inst);
|
|
18
|
-
for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
|
|
19
|
-
if (checks.length === 0) {
|
|
20
|
-
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
21
|
-
inst._zod.deferred?.push(() => {
|
|
22
|
-
inst._zod.run = inst._zod.parse;
|
|
23
|
-
});
|
|
24
|
-
} else {
|
|
25
|
-
const runChecks = (payload, checks$1, ctx) => {
|
|
26
|
-
let isAborted = require_util.aborted(payload);
|
|
27
|
-
let asyncResult;
|
|
28
|
-
for (const ch of checks$1) {
|
|
29
|
-
if (ch._zod.def.when) {
|
|
30
|
-
if (!ch._zod.def.when(payload)) continue;
|
|
31
|
-
} else if (isAborted) continue;
|
|
32
|
-
const currLen = payload.issues.length;
|
|
33
|
-
const _ = ch._zod.check(payload);
|
|
34
|
-
if (_ instanceof Promise && ctx?.async === false) throw new require_core.$ZodAsyncError();
|
|
35
|
-
if (asyncResult || _ instanceof Promise) asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
36
|
-
await _;
|
|
37
|
-
if (payload.issues.length === currLen) return;
|
|
38
|
-
if (!isAborted) isAborted = require_util.aborted(payload, currLen);
|
|
39
|
-
});
|
|
40
|
-
else {
|
|
41
|
-
if (payload.issues.length === currLen) continue;
|
|
42
|
-
if (!isAborted) isAborted = require_util.aborted(payload, currLen);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
if (asyncResult) return asyncResult.then(() => {
|
|
46
|
-
return payload;
|
|
47
|
-
});
|
|
48
|
-
return payload;
|
|
49
|
-
};
|
|
50
|
-
const handleCanaryResult = (canary, payload, ctx) => {
|
|
51
|
-
if (require_util.aborted(canary)) {
|
|
52
|
-
canary.aborted = true;
|
|
53
|
-
return canary;
|
|
54
|
-
}
|
|
55
|
-
const checkResult = runChecks(payload, checks, ctx);
|
|
56
|
-
if (checkResult instanceof Promise) {
|
|
57
|
-
if (ctx.async === false) throw new require_core.$ZodAsyncError();
|
|
58
|
-
return checkResult.then((checkResult$1) => inst._zod.parse(checkResult$1, ctx));
|
|
59
|
-
}
|
|
60
|
-
return inst._zod.parse(checkResult, ctx);
|
|
61
|
-
};
|
|
62
|
-
inst._zod.run = (payload, ctx) => {
|
|
63
|
-
if (ctx.skipChecks) return inst._zod.parse(payload, ctx);
|
|
64
|
-
if (ctx.direction === "backward") {
|
|
65
|
-
const canary = inst._zod.parse({
|
|
66
|
-
value: payload.value,
|
|
67
|
-
issues: []
|
|
68
|
-
}, {
|
|
69
|
-
...ctx,
|
|
70
|
-
skipChecks: true
|
|
71
|
-
});
|
|
72
|
-
if (canary instanceof Promise) return canary.then((canary$1) => {
|
|
73
|
-
return handleCanaryResult(canary$1, payload, ctx);
|
|
74
|
-
});
|
|
75
|
-
return handleCanaryResult(canary, payload, ctx);
|
|
76
|
-
}
|
|
77
|
-
const result = inst._zod.parse(payload, ctx);
|
|
78
|
-
if (result instanceof Promise) {
|
|
79
|
-
if (ctx.async === false) throw new require_core.$ZodAsyncError();
|
|
80
|
-
return result.then((result$1) => runChecks(result$1, checks, ctx));
|
|
81
|
-
}
|
|
82
|
-
return runChecks(result, checks, ctx);
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
inst["~standard"] = {
|
|
86
|
-
validate: (value) => {
|
|
87
|
-
try {
|
|
88
|
-
const r = require_parse.safeParse(inst, value);
|
|
89
|
-
return r.success ? { value: r.data } : { issues: r.error?.issues };
|
|
90
|
-
} catch (_) {
|
|
91
|
-
return require_parse.safeParseAsync(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
vendor: "zod",
|
|
95
|
-
version: 1
|
|
96
|
-
};
|
|
97
|
-
});
|
|
98
|
-
const $ZodString = /* @__PURE__ */ require_core.$constructor("$ZodString", (inst, def) => {
|
|
99
|
-
$ZodType.init(inst, def);
|
|
100
|
-
inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? require_regexes.string(inst._zod.bag);
|
|
101
|
-
inst._zod.parse = (payload, _) => {
|
|
102
|
-
if (def.coerce) try {
|
|
103
|
-
payload.value = String(payload.value);
|
|
104
|
-
} catch (_$1) {}
|
|
105
|
-
if (typeof payload.value === "string") return payload;
|
|
106
|
-
payload.issues.push({
|
|
107
|
-
expected: "string",
|
|
108
|
-
code: "invalid_type",
|
|
109
|
-
input: payload.value,
|
|
110
|
-
inst
|
|
111
|
-
});
|
|
112
|
-
return payload;
|
|
113
|
-
};
|
|
114
|
-
});
|
|
115
|
-
const $ZodStringFormat = /* @__PURE__ */ require_core.$constructor("$ZodStringFormat", (inst, def) => {
|
|
116
|
-
require_checks.$ZodCheckStringFormat.init(inst, def);
|
|
117
|
-
$ZodString.init(inst, def);
|
|
118
|
-
});
|
|
119
|
-
const $ZodGUID = /* @__PURE__ */ require_core.$constructor("$ZodGUID", (inst, def) => {
|
|
120
|
-
def.pattern ?? (def.pattern = require_regexes.guid);
|
|
121
|
-
$ZodStringFormat.init(inst, def);
|
|
122
|
-
});
|
|
123
|
-
const $ZodUUID = /* @__PURE__ */ require_core.$constructor("$ZodUUID", (inst, def) => {
|
|
124
|
-
if (def.version) {
|
|
125
|
-
const v = {
|
|
126
|
-
v1: 1,
|
|
127
|
-
v2: 2,
|
|
128
|
-
v3: 3,
|
|
129
|
-
v4: 4,
|
|
130
|
-
v5: 5,
|
|
131
|
-
v6: 6,
|
|
132
|
-
v7: 7,
|
|
133
|
-
v8: 8
|
|
134
|
-
}[def.version];
|
|
135
|
-
if (v === void 0) throw new Error(`Invalid UUID version: "${def.version}"`);
|
|
136
|
-
def.pattern ?? (def.pattern = require_regexes.uuid(v));
|
|
137
|
-
} else def.pattern ?? (def.pattern = require_regexes.uuid());
|
|
138
|
-
$ZodStringFormat.init(inst, def);
|
|
139
|
-
});
|
|
140
|
-
const $ZodEmail = /* @__PURE__ */ require_core.$constructor("$ZodEmail", (inst, def) => {
|
|
141
|
-
def.pattern ?? (def.pattern = require_regexes.email);
|
|
142
|
-
$ZodStringFormat.init(inst, def);
|
|
143
|
-
});
|
|
144
|
-
const $ZodURL = /* @__PURE__ */ require_core.$constructor("$ZodURL", (inst, def) => {
|
|
145
|
-
$ZodStringFormat.init(inst, def);
|
|
146
|
-
inst._zod.check = (payload) => {
|
|
147
|
-
try {
|
|
148
|
-
const trimmed = payload.value.trim();
|
|
149
|
-
const url = new URL(trimmed);
|
|
150
|
-
if (def.hostname) {
|
|
151
|
-
def.hostname.lastIndex = 0;
|
|
152
|
-
if (!def.hostname.test(url.hostname)) payload.issues.push({
|
|
153
|
-
code: "invalid_format",
|
|
154
|
-
format: "url",
|
|
155
|
-
note: "Invalid hostname",
|
|
156
|
-
pattern: def.hostname.source,
|
|
157
|
-
input: payload.value,
|
|
158
|
-
inst,
|
|
159
|
-
continue: !def.abort
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
if (def.protocol) {
|
|
163
|
-
def.protocol.lastIndex = 0;
|
|
164
|
-
if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) payload.issues.push({
|
|
165
|
-
code: "invalid_format",
|
|
166
|
-
format: "url",
|
|
167
|
-
note: "Invalid protocol",
|
|
168
|
-
pattern: def.protocol.source,
|
|
169
|
-
input: payload.value,
|
|
170
|
-
inst,
|
|
171
|
-
continue: !def.abort
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
if (def.normalize) payload.value = url.href;
|
|
175
|
-
else payload.value = trimmed;
|
|
176
|
-
return;
|
|
177
|
-
} catch (_) {
|
|
178
|
-
payload.issues.push({
|
|
179
|
-
code: "invalid_format",
|
|
180
|
-
format: "url",
|
|
181
|
-
input: payload.value,
|
|
182
|
-
inst,
|
|
183
|
-
continue: !def.abort
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
};
|
|
187
|
-
});
|
|
188
|
-
const $ZodEmoji = /* @__PURE__ */ require_core.$constructor("$ZodEmoji", (inst, def) => {
|
|
189
|
-
def.pattern ?? (def.pattern = require_regexes.emoji());
|
|
190
|
-
$ZodStringFormat.init(inst, def);
|
|
191
|
-
});
|
|
192
|
-
const $ZodNanoID = /* @__PURE__ */ require_core.$constructor("$ZodNanoID", (inst, def) => {
|
|
193
|
-
def.pattern ?? (def.pattern = require_regexes.nanoid);
|
|
194
|
-
$ZodStringFormat.init(inst, def);
|
|
195
|
-
});
|
|
196
|
-
const $ZodCUID = /* @__PURE__ */ require_core.$constructor("$ZodCUID", (inst, def) => {
|
|
197
|
-
def.pattern ?? (def.pattern = require_regexes.cuid);
|
|
198
|
-
$ZodStringFormat.init(inst, def);
|
|
199
|
-
});
|
|
200
|
-
const $ZodCUID2 = /* @__PURE__ */ require_core.$constructor("$ZodCUID2", (inst, def) => {
|
|
201
|
-
def.pattern ?? (def.pattern = require_regexes.cuid2);
|
|
202
|
-
$ZodStringFormat.init(inst, def);
|
|
203
|
-
});
|
|
204
|
-
const $ZodULID = /* @__PURE__ */ require_core.$constructor("$ZodULID", (inst, def) => {
|
|
205
|
-
def.pattern ?? (def.pattern = require_regexes.ulid);
|
|
206
|
-
$ZodStringFormat.init(inst, def);
|
|
207
|
-
});
|
|
208
|
-
const $ZodXID = /* @__PURE__ */ require_core.$constructor("$ZodXID", (inst, def) => {
|
|
209
|
-
def.pattern ?? (def.pattern = require_regexes.xid);
|
|
210
|
-
$ZodStringFormat.init(inst, def);
|
|
211
|
-
});
|
|
212
|
-
const $ZodKSUID = /* @__PURE__ */ require_core.$constructor("$ZodKSUID", (inst, def) => {
|
|
213
|
-
def.pattern ?? (def.pattern = require_regexes.ksuid);
|
|
214
|
-
$ZodStringFormat.init(inst, def);
|
|
215
|
-
});
|
|
216
|
-
const $ZodISODateTime = /* @__PURE__ */ require_core.$constructor("$ZodISODateTime", (inst, def) => {
|
|
217
|
-
def.pattern ?? (def.pattern = require_regexes.datetime(def));
|
|
218
|
-
$ZodStringFormat.init(inst, def);
|
|
219
|
-
});
|
|
220
|
-
const $ZodISODate = /* @__PURE__ */ require_core.$constructor("$ZodISODate", (inst, def) => {
|
|
221
|
-
def.pattern ?? (def.pattern = require_regexes.date);
|
|
222
|
-
$ZodStringFormat.init(inst, def);
|
|
223
|
-
});
|
|
224
|
-
const $ZodISOTime = /* @__PURE__ */ require_core.$constructor("$ZodISOTime", (inst, def) => {
|
|
225
|
-
def.pattern ?? (def.pattern = require_regexes.time(def));
|
|
226
|
-
$ZodStringFormat.init(inst, def);
|
|
227
|
-
});
|
|
228
|
-
const $ZodISODuration = /* @__PURE__ */ require_core.$constructor("$ZodISODuration", (inst, def) => {
|
|
229
|
-
def.pattern ?? (def.pattern = require_regexes.duration);
|
|
230
|
-
$ZodStringFormat.init(inst, def);
|
|
231
|
-
});
|
|
232
|
-
const $ZodIPv4 = /* @__PURE__ */ require_core.$constructor("$ZodIPv4", (inst, def) => {
|
|
233
|
-
def.pattern ?? (def.pattern = require_regexes.ipv4);
|
|
234
|
-
$ZodStringFormat.init(inst, def);
|
|
235
|
-
inst._zod.bag.format = `ipv4`;
|
|
236
|
-
});
|
|
237
|
-
const $ZodIPv6 = /* @__PURE__ */ require_core.$constructor("$ZodIPv6", (inst, def) => {
|
|
238
|
-
def.pattern ?? (def.pattern = require_regexes.ipv6);
|
|
239
|
-
$ZodStringFormat.init(inst, def);
|
|
240
|
-
inst._zod.bag.format = `ipv6`;
|
|
241
|
-
inst._zod.check = (payload) => {
|
|
242
|
-
try {
|
|
243
|
-
new URL(`http://[${payload.value}]`);
|
|
244
|
-
} catch {
|
|
245
|
-
payload.issues.push({
|
|
246
|
-
code: "invalid_format",
|
|
247
|
-
format: "ipv6",
|
|
248
|
-
input: payload.value,
|
|
249
|
-
inst,
|
|
250
|
-
continue: !def.abort
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
};
|
|
254
|
-
});
|
|
255
|
-
const $ZodCIDRv4 = /* @__PURE__ */ require_core.$constructor("$ZodCIDRv4", (inst, def) => {
|
|
256
|
-
def.pattern ?? (def.pattern = require_regexes.cidrv4);
|
|
257
|
-
$ZodStringFormat.init(inst, def);
|
|
258
|
-
});
|
|
259
|
-
const $ZodCIDRv6 = /* @__PURE__ */ require_core.$constructor("$ZodCIDRv6", (inst, def) => {
|
|
260
|
-
def.pattern ?? (def.pattern = require_regexes.cidrv6);
|
|
261
|
-
$ZodStringFormat.init(inst, def);
|
|
262
|
-
inst._zod.check = (payload) => {
|
|
263
|
-
const parts = payload.value.split("/");
|
|
264
|
-
try {
|
|
265
|
-
if (parts.length !== 2) throw new Error();
|
|
266
|
-
const [address, prefix] = parts;
|
|
267
|
-
if (!prefix) throw new Error();
|
|
268
|
-
const prefixNum = Number(prefix);
|
|
269
|
-
if (`${prefixNum}` !== prefix) throw new Error();
|
|
270
|
-
if (prefixNum < 0 || prefixNum > 128) throw new Error();
|
|
271
|
-
new URL(`http://[${address}]`);
|
|
272
|
-
} catch {
|
|
273
|
-
payload.issues.push({
|
|
274
|
-
code: "invalid_format",
|
|
275
|
-
format: "cidrv6",
|
|
276
|
-
input: payload.value,
|
|
277
|
-
inst,
|
|
278
|
-
continue: !def.abort
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
};
|
|
282
|
-
});
|
|
283
|
-
function isValidBase64(data) {
|
|
284
|
-
if (data === "") return true;
|
|
285
|
-
if (data.length % 4 !== 0) return false;
|
|
286
|
-
try {
|
|
287
|
-
atob(data);
|
|
288
|
-
return true;
|
|
289
|
-
} catch {
|
|
290
|
-
return false;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
const $ZodBase64 = /* @__PURE__ */ require_core.$constructor("$ZodBase64", (inst, def) => {
|
|
294
|
-
def.pattern ?? (def.pattern = require_regexes.base64);
|
|
295
|
-
$ZodStringFormat.init(inst, def);
|
|
296
|
-
inst._zod.bag.contentEncoding = "base64";
|
|
297
|
-
inst._zod.check = (payload) => {
|
|
298
|
-
if (isValidBase64(payload.value)) return;
|
|
299
|
-
payload.issues.push({
|
|
300
|
-
code: "invalid_format",
|
|
301
|
-
format: "base64",
|
|
302
|
-
input: payload.value,
|
|
303
|
-
inst,
|
|
304
|
-
continue: !def.abort
|
|
305
|
-
});
|
|
306
|
-
};
|
|
307
|
-
});
|
|
308
|
-
function isValidBase64URL(data) {
|
|
309
|
-
if (!require_regexes.base64url.test(data)) return false;
|
|
310
|
-
const base64$1 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
|
|
311
|
-
return isValidBase64(base64$1.padEnd(Math.ceil(base64$1.length / 4) * 4, "="));
|
|
312
|
-
}
|
|
313
|
-
const $ZodBase64URL = /* @__PURE__ */ require_core.$constructor("$ZodBase64URL", (inst, def) => {
|
|
314
|
-
def.pattern ?? (def.pattern = require_regexes.base64url);
|
|
315
|
-
$ZodStringFormat.init(inst, def);
|
|
316
|
-
inst._zod.bag.contentEncoding = "base64url";
|
|
317
|
-
inst._zod.check = (payload) => {
|
|
318
|
-
if (isValidBase64URL(payload.value)) return;
|
|
319
|
-
payload.issues.push({
|
|
320
|
-
code: "invalid_format",
|
|
321
|
-
format: "base64url",
|
|
322
|
-
input: payload.value,
|
|
323
|
-
inst,
|
|
324
|
-
continue: !def.abort
|
|
325
|
-
});
|
|
326
|
-
};
|
|
327
|
-
});
|
|
328
|
-
const $ZodE164 = /* @__PURE__ */ require_core.$constructor("$ZodE164", (inst, def) => {
|
|
329
|
-
def.pattern ?? (def.pattern = require_regexes.e164);
|
|
330
|
-
$ZodStringFormat.init(inst, def);
|
|
331
|
-
});
|
|
332
|
-
function isValidJWT(token, algorithm = null) {
|
|
333
|
-
try {
|
|
334
|
-
const tokensParts = token.split(".");
|
|
335
|
-
if (tokensParts.length !== 3) return false;
|
|
336
|
-
const [header] = tokensParts;
|
|
337
|
-
if (!header) return false;
|
|
338
|
-
const parsedHeader = JSON.parse(atob(header));
|
|
339
|
-
if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT") return false;
|
|
340
|
-
if (!parsedHeader.alg) return false;
|
|
341
|
-
if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm)) return false;
|
|
342
|
-
return true;
|
|
343
|
-
} catch {
|
|
344
|
-
return false;
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
const $ZodJWT = /* @__PURE__ */ require_core.$constructor("$ZodJWT", (inst, def) => {
|
|
348
|
-
$ZodStringFormat.init(inst, def);
|
|
349
|
-
inst._zod.check = (payload) => {
|
|
350
|
-
if (isValidJWT(payload.value, def.alg)) return;
|
|
351
|
-
payload.issues.push({
|
|
352
|
-
code: "invalid_format",
|
|
353
|
-
format: "jwt",
|
|
354
|
-
input: payload.value,
|
|
355
|
-
inst,
|
|
356
|
-
continue: !def.abort
|
|
357
|
-
});
|
|
358
|
-
};
|
|
359
|
-
});
|
|
360
|
-
const $ZodNumber = /* @__PURE__ */ require_core.$constructor("$ZodNumber", (inst, def) => {
|
|
361
|
-
$ZodType.init(inst, def);
|
|
362
|
-
inst._zod.pattern = inst._zod.bag.pattern ?? require_regexes.number;
|
|
363
|
-
inst._zod.parse = (payload, _ctx) => {
|
|
364
|
-
if (def.coerce) try {
|
|
365
|
-
payload.value = Number(payload.value);
|
|
366
|
-
} catch (_) {}
|
|
367
|
-
const input = payload.value;
|
|
368
|
-
if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) return payload;
|
|
369
|
-
const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0;
|
|
370
|
-
payload.issues.push({
|
|
371
|
-
expected: "number",
|
|
372
|
-
code: "invalid_type",
|
|
373
|
-
input,
|
|
374
|
-
inst,
|
|
375
|
-
...received ? { received } : {}
|
|
376
|
-
});
|
|
377
|
-
return payload;
|
|
378
|
-
};
|
|
379
|
-
});
|
|
380
|
-
const $ZodNumberFormat = /* @__PURE__ */ require_core.$constructor("$ZodNumberFormat", (inst, def) => {
|
|
381
|
-
require_checks.$ZodCheckNumberFormat.init(inst, def);
|
|
382
|
-
$ZodNumber.init(inst, def);
|
|
383
|
-
});
|
|
384
|
-
const $ZodBoolean = /* @__PURE__ */ require_core.$constructor("$ZodBoolean", (inst, def) => {
|
|
385
|
-
$ZodType.init(inst, def);
|
|
386
|
-
inst._zod.pattern = require_regexes.boolean;
|
|
387
|
-
inst._zod.parse = (payload, _ctx) => {
|
|
388
|
-
if (def.coerce) try {
|
|
389
|
-
payload.value = Boolean(payload.value);
|
|
390
|
-
} catch (_) {}
|
|
391
|
-
const input = payload.value;
|
|
392
|
-
if (typeof input === "boolean") return payload;
|
|
393
|
-
payload.issues.push({
|
|
394
|
-
expected: "boolean",
|
|
395
|
-
code: "invalid_type",
|
|
396
|
-
input,
|
|
397
|
-
inst
|
|
398
|
-
});
|
|
399
|
-
return payload;
|
|
400
|
-
};
|
|
401
|
-
});
|
|
402
|
-
const $ZodAny = /* @__PURE__ */ require_core.$constructor("$ZodAny", (inst, def) => {
|
|
403
|
-
$ZodType.init(inst, def);
|
|
404
|
-
inst._zod.parse = (payload) => payload;
|
|
405
|
-
});
|
|
406
|
-
const $ZodUnknown = /* @__PURE__ */ require_core.$constructor("$ZodUnknown", (inst, def) => {
|
|
407
|
-
$ZodType.init(inst, def);
|
|
408
|
-
inst._zod.parse = (payload) => payload;
|
|
409
|
-
});
|
|
410
|
-
const $ZodNever = /* @__PURE__ */ require_core.$constructor("$ZodNever", (inst, def) => {
|
|
411
|
-
$ZodType.init(inst, def);
|
|
412
|
-
inst._zod.parse = (payload, _ctx) => {
|
|
413
|
-
payload.issues.push({
|
|
414
|
-
expected: "never",
|
|
415
|
-
code: "invalid_type",
|
|
416
|
-
input: payload.value,
|
|
417
|
-
inst
|
|
418
|
-
});
|
|
419
|
-
return payload;
|
|
420
|
-
};
|
|
421
|
-
});
|
|
422
|
-
function handleArrayResult(result, final, index) {
|
|
423
|
-
if (result.issues.length) final.issues.push(...require_util.prefixIssues(index, result.issues));
|
|
424
|
-
final.value[index] = result.value;
|
|
425
|
-
}
|
|
426
|
-
const $ZodArray = /* @__PURE__ */ require_core.$constructor("$ZodArray", (inst, def) => {
|
|
427
|
-
$ZodType.init(inst, def);
|
|
428
|
-
inst._zod.parse = (payload, ctx) => {
|
|
429
|
-
const input = payload.value;
|
|
430
|
-
if (!Array.isArray(input)) {
|
|
431
|
-
payload.issues.push({
|
|
432
|
-
expected: "array",
|
|
433
|
-
code: "invalid_type",
|
|
434
|
-
input,
|
|
435
|
-
inst
|
|
436
|
-
});
|
|
437
|
-
return payload;
|
|
438
|
-
}
|
|
439
|
-
payload.value = Array(input.length);
|
|
440
|
-
const proms = [];
|
|
441
|
-
for (let i = 0; i < input.length; i++) {
|
|
442
|
-
const item = input[i];
|
|
443
|
-
const result = def.element._zod.run({
|
|
444
|
-
value: item,
|
|
445
|
-
issues: []
|
|
446
|
-
}, ctx);
|
|
447
|
-
if (result instanceof Promise) proms.push(result.then((result$1) => handleArrayResult(result$1, payload, i)));
|
|
448
|
-
else handleArrayResult(result, payload, i);
|
|
449
|
-
}
|
|
450
|
-
if (proms.length) return Promise.all(proms).then(() => payload);
|
|
451
|
-
return payload;
|
|
452
|
-
};
|
|
453
|
-
});
|
|
454
|
-
function handlePropertyResult(result, final, key, input) {
|
|
455
|
-
if (result.issues.length) final.issues.push(...require_util.prefixIssues(key, result.issues));
|
|
456
|
-
if (result.value === void 0) {
|
|
457
|
-
if (key in input) final.value[key] = void 0;
|
|
458
|
-
} else final.value[key] = result.value;
|
|
459
|
-
}
|
|
460
|
-
function normalizeDef(def) {
|
|
461
|
-
const keys = Object.keys(def.shape);
|
|
462
|
-
for (const k of keys) if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
|
|
463
|
-
const okeys = require_util.optionalKeys(def.shape);
|
|
464
|
-
return {
|
|
465
|
-
...def,
|
|
466
|
-
keys,
|
|
467
|
-
keySet: new Set(keys),
|
|
468
|
-
numKeys: keys.length,
|
|
469
|
-
optionalKeys: new Set(okeys)
|
|
470
|
-
};
|
|
471
|
-
}
|
|
472
|
-
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
473
|
-
const unrecognized = [];
|
|
474
|
-
const keySet = def.keySet;
|
|
475
|
-
const _catchall = def.catchall._zod;
|
|
476
|
-
const t = _catchall.def.type;
|
|
477
|
-
for (const key in input) {
|
|
478
|
-
if (keySet.has(key)) continue;
|
|
479
|
-
if (t === "never") {
|
|
480
|
-
unrecognized.push(key);
|
|
481
|
-
continue;
|
|
482
|
-
}
|
|
483
|
-
const r = _catchall.run({
|
|
484
|
-
value: input[key],
|
|
485
|
-
issues: []
|
|
486
|
-
}, ctx);
|
|
487
|
-
if (r instanceof Promise) proms.push(r.then((r$1) => handlePropertyResult(r$1, payload, key, input)));
|
|
488
|
-
else handlePropertyResult(r, payload, key, input);
|
|
489
|
-
}
|
|
490
|
-
if (unrecognized.length) payload.issues.push({
|
|
491
|
-
code: "unrecognized_keys",
|
|
492
|
-
keys: unrecognized,
|
|
493
|
-
input,
|
|
494
|
-
inst
|
|
495
|
-
});
|
|
496
|
-
if (!proms.length) return payload;
|
|
497
|
-
return Promise.all(proms).then(() => {
|
|
498
|
-
return payload;
|
|
499
|
-
});
|
|
500
|
-
}
|
|
501
|
-
const $ZodObject = /* @__PURE__ */ require_core.$constructor("$ZodObject", (inst, def) => {
|
|
502
|
-
$ZodType.init(inst, def);
|
|
503
|
-
if (!Object.getOwnPropertyDescriptor(def, "shape")?.get) {
|
|
504
|
-
const sh = def.shape;
|
|
505
|
-
Object.defineProperty(def, "shape", { get: () => {
|
|
506
|
-
const newSh = { ...sh };
|
|
507
|
-
Object.defineProperty(def, "shape", { value: newSh });
|
|
508
|
-
return newSh;
|
|
509
|
-
} });
|
|
510
|
-
}
|
|
511
|
-
const _normalized = require_util.cached(() => normalizeDef(def));
|
|
512
|
-
require_util.defineLazy(inst._zod, "propValues", () => {
|
|
513
|
-
const shape = def.shape;
|
|
514
|
-
const propValues = {};
|
|
515
|
-
for (const key in shape) {
|
|
516
|
-
const field = shape[key]._zod;
|
|
517
|
-
if (field.values) {
|
|
518
|
-
propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
|
|
519
|
-
for (const v of field.values) propValues[key].add(v);
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
return propValues;
|
|
523
|
-
});
|
|
524
|
-
const isObject$1 = require_util.isObject;
|
|
525
|
-
const catchall = def.catchall;
|
|
526
|
-
let value;
|
|
527
|
-
inst._zod.parse = (payload, ctx) => {
|
|
528
|
-
value ?? (value = _normalized.value);
|
|
529
|
-
const input = payload.value;
|
|
530
|
-
if (!isObject$1(input)) {
|
|
531
|
-
payload.issues.push({
|
|
532
|
-
expected: "object",
|
|
533
|
-
code: "invalid_type",
|
|
534
|
-
input,
|
|
535
|
-
inst
|
|
536
|
-
});
|
|
537
|
-
return payload;
|
|
538
|
-
}
|
|
539
|
-
payload.value = {};
|
|
540
|
-
const proms = [];
|
|
541
|
-
const shape = value.shape;
|
|
542
|
-
for (const key of value.keys) {
|
|
543
|
-
const r = shape[key]._zod.run({
|
|
544
|
-
value: input[key],
|
|
545
|
-
issues: []
|
|
546
|
-
}, ctx);
|
|
547
|
-
if (r instanceof Promise) proms.push(r.then((r$1) => handlePropertyResult(r$1, payload, key, input)));
|
|
548
|
-
else handlePropertyResult(r, payload, key, input);
|
|
549
|
-
}
|
|
550
|
-
if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
551
|
-
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
552
|
-
};
|
|
553
|
-
});
|
|
554
|
-
const $ZodObjectJIT = /* @__PURE__ */ require_core.$constructor("$ZodObjectJIT", (inst, def) => {
|
|
555
|
-
$ZodObject.init(inst, def);
|
|
556
|
-
const superParse = inst._zod.parse;
|
|
557
|
-
const _normalized = require_util.cached(() => normalizeDef(def));
|
|
558
|
-
const generateFastpass = (shape) => {
|
|
559
|
-
const doc = new require_doc.Doc([
|
|
560
|
-
"shape",
|
|
561
|
-
"payload",
|
|
562
|
-
"ctx"
|
|
563
|
-
]);
|
|
564
|
-
const normalized = _normalized.value;
|
|
565
|
-
const parseStr = (key) => {
|
|
566
|
-
const k = require_util.esc(key);
|
|
567
|
-
return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
568
|
-
};
|
|
569
|
-
doc.write(`const input = payload.value;`);
|
|
570
|
-
const ids = Object.create(null);
|
|
571
|
-
let counter = 0;
|
|
572
|
-
for (const key of normalized.keys) ids[key] = `key_${counter++}`;
|
|
573
|
-
doc.write(`const newResult = {};`);
|
|
574
|
-
for (const key of normalized.keys) {
|
|
575
|
-
const id = ids[key];
|
|
576
|
-
const k = require_util.esc(key);
|
|
577
|
-
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
578
|
-
doc.write(`
|
|
579
|
-
if (${id}.issues.length) {
|
|
580
|
-
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
581
|
-
...iss,
|
|
582
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
583
|
-
})));
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
if (${id}.value === undefined) {
|
|
588
|
-
if (${k} in input) {
|
|
589
|
-
newResult[${k}] = undefined;
|
|
590
|
-
}
|
|
591
|
-
} else {
|
|
592
|
-
newResult[${k}] = ${id}.value;
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
`);
|
|
596
|
-
}
|
|
597
|
-
doc.write(`payload.value = newResult;`);
|
|
598
|
-
doc.write(`return payload;`);
|
|
599
|
-
const fn = doc.compile();
|
|
600
|
-
return (payload, ctx) => fn(shape, payload, ctx);
|
|
601
|
-
};
|
|
602
|
-
let fastpass;
|
|
603
|
-
const isObject$1 = require_util.isObject;
|
|
604
|
-
const jit = !require_core.globalConfig.jitless;
|
|
605
|
-
const allowsEval$1 = require_util.allowsEval;
|
|
606
|
-
const fastEnabled = jit && allowsEval$1.value;
|
|
607
|
-
const catchall = def.catchall;
|
|
608
|
-
let value;
|
|
609
|
-
inst._zod.parse = (payload, ctx) => {
|
|
610
|
-
value ?? (value = _normalized.value);
|
|
611
|
-
const input = payload.value;
|
|
612
|
-
if (!isObject$1(input)) {
|
|
613
|
-
payload.issues.push({
|
|
614
|
-
expected: "object",
|
|
615
|
-
code: "invalid_type",
|
|
616
|
-
input,
|
|
617
|
-
inst
|
|
618
|
-
});
|
|
619
|
-
return payload;
|
|
620
|
-
}
|
|
621
|
-
if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
|
|
622
|
-
if (!fastpass) fastpass = generateFastpass(def.shape);
|
|
623
|
-
payload = fastpass(payload, ctx);
|
|
624
|
-
if (!catchall) return payload;
|
|
625
|
-
return handleCatchall([], input, payload, ctx, value, inst);
|
|
626
|
-
}
|
|
627
|
-
return superParse(payload, ctx);
|
|
628
|
-
};
|
|
629
|
-
});
|
|
630
|
-
function handleUnionResults(results, final, inst, ctx) {
|
|
631
|
-
for (const result of results) if (result.issues.length === 0) {
|
|
632
|
-
final.value = result.value;
|
|
633
|
-
return final;
|
|
634
|
-
}
|
|
635
|
-
const nonaborted = results.filter((r) => !require_util.aborted(r));
|
|
636
|
-
if (nonaborted.length === 1) {
|
|
637
|
-
final.value = nonaborted[0].value;
|
|
638
|
-
return nonaborted[0];
|
|
639
|
-
}
|
|
640
|
-
final.issues.push({
|
|
641
|
-
code: "invalid_union",
|
|
642
|
-
input: final.value,
|
|
643
|
-
inst,
|
|
644
|
-
errors: results.map((result) => result.issues.map((iss) => require_util.finalizeIssue(iss, ctx, require_core.config())))
|
|
645
|
-
});
|
|
646
|
-
return final;
|
|
647
|
-
}
|
|
648
|
-
const $ZodUnion = /* @__PURE__ */ require_core.$constructor("$ZodUnion", (inst, def) => {
|
|
649
|
-
$ZodType.init(inst, def);
|
|
650
|
-
require_util.defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
|
|
651
|
-
require_util.defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
|
|
652
|
-
require_util.defineLazy(inst._zod, "values", () => {
|
|
653
|
-
if (def.options.every((o) => o._zod.values)) return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
654
|
-
});
|
|
655
|
-
require_util.defineLazy(inst._zod, "pattern", () => {
|
|
656
|
-
if (def.options.every((o) => o._zod.pattern)) {
|
|
657
|
-
const patterns = def.options.map((o) => o._zod.pattern);
|
|
658
|
-
return /* @__PURE__ */ new RegExp(`^(${patterns.map((p) => require_util.cleanRegex(p.source)).join("|")})$`);
|
|
659
|
-
}
|
|
660
|
-
});
|
|
661
|
-
const single = def.options.length === 1;
|
|
662
|
-
const first = def.options[0]._zod.run;
|
|
663
|
-
inst._zod.parse = (payload, ctx) => {
|
|
664
|
-
if (single) return first(payload, ctx);
|
|
665
|
-
let async = false;
|
|
666
|
-
const results = [];
|
|
667
|
-
for (const option of def.options) {
|
|
668
|
-
const result = option._zod.run({
|
|
669
|
-
value: payload.value,
|
|
670
|
-
issues: []
|
|
671
|
-
}, ctx);
|
|
672
|
-
if (result instanceof Promise) {
|
|
673
|
-
results.push(result);
|
|
674
|
-
async = true;
|
|
675
|
-
} else {
|
|
676
|
-
if (result.issues.length === 0) return result;
|
|
677
|
-
results.push(result);
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
if (!async) return handleUnionResults(results, payload, inst, ctx);
|
|
681
|
-
return Promise.all(results).then((results$1) => {
|
|
682
|
-
return handleUnionResults(results$1, payload, inst, ctx);
|
|
683
|
-
});
|
|
684
|
-
};
|
|
685
|
-
});
|
|
686
|
-
const $ZodIntersection = /* @__PURE__ */ require_core.$constructor("$ZodIntersection", (inst, def) => {
|
|
687
|
-
$ZodType.init(inst, def);
|
|
688
|
-
inst._zod.parse = (payload, ctx) => {
|
|
689
|
-
const input = payload.value;
|
|
690
|
-
const left = def.left._zod.run({
|
|
691
|
-
value: input,
|
|
692
|
-
issues: []
|
|
693
|
-
}, ctx);
|
|
694
|
-
const right = def.right._zod.run({
|
|
695
|
-
value: input,
|
|
696
|
-
issues: []
|
|
697
|
-
}, ctx);
|
|
698
|
-
if (left instanceof Promise || right instanceof Promise) return Promise.all([left, right]).then(([left$1, right$1]) => {
|
|
699
|
-
return handleIntersectionResults(payload, left$1, right$1);
|
|
700
|
-
});
|
|
701
|
-
return handleIntersectionResults(payload, left, right);
|
|
702
|
-
};
|
|
703
|
-
});
|
|
704
|
-
function mergeValues(a, b) {
|
|
705
|
-
if (a === b) return {
|
|
706
|
-
valid: true,
|
|
707
|
-
data: a
|
|
708
|
-
};
|
|
709
|
-
if (a instanceof Date && b instanceof Date && +a === +b) return {
|
|
710
|
-
valid: true,
|
|
711
|
-
data: a
|
|
712
|
-
};
|
|
713
|
-
if (require_util.isPlainObject(a) && require_util.isPlainObject(b)) {
|
|
714
|
-
const bKeys = Object.keys(b);
|
|
715
|
-
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
716
|
-
const newObj = {
|
|
717
|
-
...a,
|
|
718
|
-
...b
|
|
719
|
-
};
|
|
720
|
-
for (const key of sharedKeys) {
|
|
721
|
-
const sharedValue = mergeValues(a[key], b[key]);
|
|
722
|
-
if (!sharedValue.valid) return {
|
|
723
|
-
valid: false,
|
|
724
|
-
mergeErrorPath: [key, ...sharedValue.mergeErrorPath]
|
|
725
|
-
};
|
|
726
|
-
newObj[key] = sharedValue.data;
|
|
727
|
-
}
|
|
728
|
-
return {
|
|
729
|
-
valid: true,
|
|
730
|
-
data: newObj
|
|
731
|
-
};
|
|
732
|
-
}
|
|
733
|
-
if (Array.isArray(a) && Array.isArray(b)) {
|
|
734
|
-
if (a.length !== b.length) return {
|
|
735
|
-
valid: false,
|
|
736
|
-
mergeErrorPath: []
|
|
737
|
-
};
|
|
738
|
-
const newArray = [];
|
|
739
|
-
for (let index = 0; index < a.length; index++) {
|
|
740
|
-
const itemA = a[index];
|
|
741
|
-
const itemB = b[index];
|
|
742
|
-
const sharedValue = mergeValues(itemA, itemB);
|
|
743
|
-
if (!sharedValue.valid) return {
|
|
744
|
-
valid: false,
|
|
745
|
-
mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
|
|
746
|
-
};
|
|
747
|
-
newArray.push(sharedValue.data);
|
|
748
|
-
}
|
|
749
|
-
return {
|
|
750
|
-
valid: true,
|
|
751
|
-
data: newArray
|
|
752
|
-
};
|
|
753
|
-
}
|
|
754
|
-
return {
|
|
755
|
-
valid: false,
|
|
756
|
-
mergeErrorPath: []
|
|
757
|
-
};
|
|
758
|
-
}
|
|
759
|
-
function handleIntersectionResults(result, left, right) {
|
|
760
|
-
if (left.issues.length) result.issues.push(...left.issues);
|
|
761
|
-
if (right.issues.length) result.issues.push(...right.issues);
|
|
762
|
-
if (require_util.aborted(result)) return result;
|
|
763
|
-
const merged = mergeValues(left.value, right.value);
|
|
764
|
-
if (!merged.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
|
|
765
|
-
result.value = merged.data;
|
|
766
|
-
return result;
|
|
767
|
-
}
|
|
768
|
-
const $ZodEnum = /* @__PURE__ */ require_core.$constructor("$ZodEnum", (inst, def) => {
|
|
769
|
-
$ZodType.init(inst, def);
|
|
770
|
-
const values = require_util.getEnumValues(def.entries);
|
|
771
|
-
const valuesSet = new Set(values);
|
|
772
|
-
inst._zod.values = valuesSet;
|
|
773
|
-
inst._zod.pattern = /* @__PURE__ */ new RegExp(`^(${values.filter((k) => require_util.propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? require_util.escapeRegex(o) : o.toString()).join("|")})$`);
|
|
774
|
-
inst._zod.parse = (payload, _ctx) => {
|
|
775
|
-
const input = payload.value;
|
|
776
|
-
if (valuesSet.has(input)) return payload;
|
|
777
|
-
payload.issues.push({
|
|
778
|
-
code: "invalid_value",
|
|
779
|
-
values,
|
|
780
|
-
input,
|
|
781
|
-
inst
|
|
782
|
-
});
|
|
783
|
-
return payload;
|
|
784
|
-
};
|
|
785
|
-
});
|
|
786
|
-
const $ZodTransform = /* @__PURE__ */ require_core.$constructor("$ZodTransform", (inst, def) => {
|
|
787
|
-
$ZodType.init(inst, def);
|
|
788
|
-
inst._zod.parse = (payload, ctx) => {
|
|
789
|
-
if (ctx.direction === "backward") throw new require_core.$ZodEncodeError(inst.constructor.name);
|
|
790
|
-
const _out = def.transform(payload.value, payload);
|
|
791
|
-
if (ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output) => {
|
|
792
|
-
payload.value = output;
|
|
793
|
-
return payload;
|
|
794
|
-
});
|
|
795
|
-
if (_out instanceof Promise) throw new require_core.$ZodAsyncError();
|
|
796
|
-
payload.value = _out;
|
|
797
|
-
return payload;
|
|
798
|
-
};
|
|
799
|
-
});
|
|
800
|
-
function handleOptionalResult(result, input) {
|
|
801
|
-
if (result.issues.length && input === void 0) return {
|
|
802
|
-
issues: [],
|
|
803
|
-
value: void 0
|
|
804
|
-
};
|
|
805
|
-
return result;
|
|
806
|
-
}
|
|
807
|
-
const $ZodOptional = /* @__PURE__ */ require_core.$constructor("$ZodOptional", (inst, def) => {
|
|
808
|
-
$ZodType.init(inst, def);
|
|
809
|
-
inst._zod.optin = "optional";
|
|
810
|
-
inst._zod.optout = "optional";
|
|
811
|
-
require_util.defineLazy(inst._zod, "values", () => {
|
|
812
|
-
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, void 0]) : void 0;
|
|
813
|
-
});
|
|
814
|
-
require_util.defineLazy(inst._zod, "pattern", () => {
|
|
815
|
-
const pattern = def.innerType._zod.pattern;
|
|
816
|
-
return pattern ? /* @__PURE__ */ new RegExp(`^(${require_util.cleanRegex(pattern.source)})?$`) : void 0;
|
|
817
|
-
});
|
|
818
|
-
inst._zod.parse = (payload, ctx) => {
|
|
819
|
-
if (def.innerType._zod.optin === "optional") {
|
|
820
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
821
|
-
if (result instanceof Promise) return result.then((r) => handleOptionalResult(r, payload.value));
|
|
822
|
-
return handleOptionalResult(result, payload.value);
|
|
823
|
-
}
|
|
824
|
-
if (payload.value === void 0) return payload;
|
|
825
|
-
return def.innerType._zod.run(payload, ctx);
|
|
826
|
-
};
|
|
827
|
-
});
|
|
828
|
-
const $ZodNullable = /* @__PURE__ */ require_core.$constructor("$ZodNullable", (inst, def) => {
|
|
829
|
-
$ZodType.init(inst, def);
|
|
830
|
-
require_util.defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
831
|
-
require_util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
832
|
-
require_util.defineLazy(inst._zod, "pattern", () => {
|
|
833
|
-
const pattern = def.innerType._zod.pattern;
|
|
834
|
-
return pattern ? /* @__PURE__ */ new RegExp(`^(${require_util.cleanRegex(pattern.source)}|null)$`) : void 0;
|
|
835
|
-
});
|
|
836
|
-
require_util.defineLazy(inst._zod, "values", () => {
|
|
837
|
-
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : void 0;
|
|
838
|
-
});
|
|
839
|
-
inst._zod.parse = (payload, ctx) => {
|
|
840
|
-
if (payload.value === null) return payload;
|
|
841
|
-
return def.innerType._zod.run(payload, ctx);
|
|
842
|
-
};
|
|
843
|
-
});
|
|
844
|
-
const $ZodDefault = /* @__PURE__ */ require_core.$constructor("$ZodDefault", (inst, def) => {
|
|
845
|
-
$ZodType.init(inst, def);
|
|
846
|
-
inst._zod.optin = "optional";
|
|
847
|
-
require_util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
848
|
-
inst._zod.parse = (payload, ctx) => {
|
|
849
|
-
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
850
|
-
if (payload.value === void 0) {
|
|
851
|
-
payload.value = def.defaultValue;
|
|
852
|
-
/**
|
|
853
|
-
* $ZodDefault returns the default value immediately in forward direction.
|
|
854
|
-
* It doesn't pass the default value into the validator ("prefault"). There's no reason to pass the default value through validation. The validity of the default is enforced by TypeScript statically. Otherwise, it's the responsibility of the user to ensure the default is valid. In the case of pipes with divergent in/out types, you can specify the default on the `in` schema of your ZodPipe to set a "prefault" for the pipe. */
|
|
855
|
-
return payload;
|
|
856
|
-
}
|
|
857
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
858
|
-
if (result instanceof Promise) return result.then((result$1) => handleDefaultResult(result$1, def));
|
|
859
|
-
return handleDefaultResult(result, def);
|
|
860
|
-
};
|
|
861
|
-
});
|
|
862
|
-
function handleDefaultResult(payload, def) {
|
|
863
|
-
if (payload.value === void 0) payload.value = def.defaultValue;
|
|
864
|
-
return payload;
|
|
865
|
-
}
|
|
866
|
-
const $ZodPrefault = /* @__PURE__ */ require_core.$constructor("$ZodPrefault", (inst, def) => {
|
|
867
|
-
$ZodType.init(inst, def);
|
|
868
|
-
inst._zod.optin = "optional";
|
|
869
|
-
require_util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
870
|
-
inst._zod.parse = (payload, ctx) => {
|
|
871
|
-
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
872
|
-
if (payload.value === void 0) payload.value = def.defaultValue;
|
|
873
|
-
return def.innerType._zod.run(payload, ctx);
|
|
874
|
-
};
|
|
875
|
-
});
|
|
876
|
-
const $ZodNonOptional = /* @__PURE__ */ require_core.$constructor("$ZodNonOptional", (inst, def) => {
|
|
877
|
-
$ZodType.init(inst, def);
|
|
878
|
-
require_util.defineLazy(inst._zod, "values", () => {
|
|
879
|
-
const v = def.innerType._zod.values;
|
|
880
|
-
return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
|
|
881
|
-
});
|
|
882
|
-
inst._zod.parse = (payload, ctx) => {
|
|
883
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
884
|
-
if (result instanceof Promise) return result.then((result$1) => handleNonOptionalResult(result$1, inst));
|
|
885
|
-
return handleNonOptionalResult(result, inst);
|
|
886
|
-
};
|
|
887
|
-
});
|
|
888
|
-
function handleNonOptionalResult(payload, inst) {
|
|
889
|
-
if (!payload.issues.length && payload.value === void 0) payload.issues.push({
|
|
890
|
-
code: "invalid_type",
|
|
891
|
-
expected: "nonoptional",
|
|
892
|
-
input: payload.value,
|
|
893
|
-
inst
|
|
894
|
-
});
|
|
895
|
-
return payload;
|
|
896
|
-
}
|
|
897
|
-
const $ZodCatch = /* @__PURE__ */ require_core.$constructor("$ZodCatch", (inst, def) => {
|
|
898
|
-
$ZodType.init(inst, def);
|
|
899
|
-
require_util.defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
900
|
-
require_util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
901
|
-
require_util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
902
|
-
inst._zod.parse = (payload, ctx) => {
|
|
903
|
-
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
904
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
905
|
-
if (result instanceof Promise) return result.then((result$1) => {
|
|
906
|
-
payload.value = result$1.value;
|
|
907
|
-
if (result$1.issues.length) {
|
|
908
|
-
payload.value = def.catchValue({
|
|
909
|
-
...payload,
|
|
910
|
-
error: { issues: result$1.issues.map((iss) => require_util.finalizeIssue(iss, ctx, require_core.config())) },
|
|
911
|
-
input: payload.value
|
|
912
|
-
});
|
|
913
|
-
payload.issues = [];
|
|
914
|
-
}
|
|
915
|
-
return payload;
|
|
916
|
-
});
|
|
917
|
-
payload.value = result.value;
|
|
918
|
-
if (result.issues.length) {
|
|
919
|
-
payload.value = def.catchValue({
|
|
920
|
-
...payload,
|
|
921
|
-
error: { issues: result.issues.map((iss) => require_util.finalizeIssue(iss, ctx, require_core.config())) },
|
|
922
|
-
input: payload.value
|
|
923
|
-
});
|
|
924
|
-
payload.issues = [];
|
|
925
|
-
}
|
|
926
|
-
return payload;
|
|
927
|
-
};
|
|
928
|
-
});
|
|
929
|
-
const $ZodPipe = /* @__PURE__ */ require_core.$constructor("$ZodPipe", (inst, def) => {
|
|
930
|
-
$ZodType.init(inst, def);
|
|
931
|
-
require_util.defineLazy(inst._zod, "values", () => def.in._zod.values);
|
|
932
|
-
require_util.defineLazy(inst._zod, "optin", () => def.in._zod.optin);
|
|
933
|
-
require_util.defineLazy(inst._zod, "optout", () => def.out._zod.optout);
|
|
934
|
-
require_util.defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
|
|
935
|
-
inst._zod.parse = (payload, ctx) => {
|
|
936
|
-
if (ctx.direction === "backward") {
|
|
937
|
-
const right = def.out._zod.run(payload, ctx);
|
|
938
|
-
if (right instanceof Promise) return right.then((right$1) => handlePipeResult(right$1, def.in, ctx));
|
|
939
|
-
return handlePipeResult(right, def.in, ctx);
|
|
940
|
-
}
|
|
941
|
-
const left = def.in._zod.run(payload, ctx);
|
|
942
|
-
if (left instanceof Promise) return left.then((left$1) => handlePipeResult(left$1, def.out, ctx));
|
|
943
|
-
return handlePipeResult(left, def.out, ctx);
|
|
944
|
-
};
|
|
945
|
-
});
|
|
946
|
-
function handlePipeResult(left, next, ctx) {
|
|
947
|
-
if (left.issues.length) {
|
|
948
|
-
left.aborted = true;
|
|
949
|
-
return left;
|
|
950
|
-
}
|
|
951
|
-
return next._zod.run({
|
|
952
|
-
value: left.value,
|
|
953
|
-
issues: left.issues
|
|
954
|
-
}, ctx);
|
|
955
|
-
}
|
|
956
|
-
const $ZodReadonly = /* @__PURE__ */ require_core.$constructor("$ZodReadonly", (inst, def) => {
|
|
957
|
-
$ZodType.init(inst, def);
|
|
958
|
-
require_util.defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
|
|
959
|
-
require_util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
960
|
-
require_util.defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
|
|
961
|
-
require_util.defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
|
|
962
|
-
inst._zod.parse = (payload, ctx) => {
|
|
963
|
-
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
964
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
965
|
-
if (result instanceof Promise) return result.then(handleReadonlyResult);
|
|
966
|
-
return handleReadonlyResult(result);
|
|
967
|
-
};
|
|
968
|
-
});
|
|
969
|
-
function handleReadonlyResult(payload) {
|
|
970
|
-
payload.value = Object.freeze(payload.value);
|
|
971
|
-
return payload;
|
|
972
|
-
}
|
|
973
|
-
const $ZodCustom = /* @__PURE__ */ require_core.$constructor("$ZodCustom", (inst, def) => {
|
|
974
|
-
require_checks.$ZodCheck.init(inst, def);
|
|
975
|
-
$ZodType.init(inst, def);
|
|
976
|
-
inst._zod.parse = (payload, _) => {
|
|
977
|
-
return payload;
|
|
978
|
-
};
|
|
979
|
-
inst._zod.check = (payload) => {
|
|
980
|
-
const input = payload.value;
|
|
981
|
-
const r = def.fn(input);
|
|
982
|
-
if (r instanceof Promise) return r.then((r$1) => handleRefineResult(r$1, payload, input, inst));
|
|
983
|
-
handleRefineResult(r, payload, input, inst);
|
|
984
|
-
};
|
|
985
|
-
});
|
|
986
|
-
function handleRefineResult(result, payload, input, inst) {
|
|
987
|
-
if (!result) {
|
|
988
|
-
const _iss = {
|
|
989
|
-
code: "custom",
|
|
990
|
-
input,
|
|
991
|
-
inst,
|
|
992
|
-
path: [...inst._zod.def.path ?? []],
|
|
993
|
-
continue: !inst._zod.def.abort
|
|
994
|
-
};
|
|
995
|
-
if (inst._zod.def.params) _iss.params = inst._zod.def.params;
|
|
996
|
-
payload.issues.push(require_util.issue(_iss));
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
|
-
//#endregion
|
|
1001
|
-
exports.$ZodAny = $ZodAny;
|
|
1002
|
-
exports.$ZodArray = $ZodArray;
|
|
1003
|
-
exports.$ZodBase64 = $ZodBase64;
|
|
1004
|
-
exports.$ZodBase64URL = $ZodBase64URL;
|
|
1005
|
-
exports.$ZodBoolean = $ZodBoolean;
|
|
1006
|
-
exports.$ZodCIDRv4 = $ZodCIDRv4;
|
|
1007
|
-
exports.$ZodCIDRv6 = $ZodCIDRv6;
|
|
1008
|
-
exports.$ZodCUID = $ZodCUID;
|
|
1009
|
-
exports.$ZodCUID2 = $ZodCUID2;
|
|
1010
|
-
exports.$ZodCatch = $ZodCatch;
|
|
1011
|
-
exports.$ZodCustom = $ZodCustom;
|
|
1012
|
-
exports.$ZodDefault = $ZodDefault;
|
|
1013
|
-
exports.$ZodE164 = $ZodE164;
|
|
1014
|
-
exports.$ZodEmail = $ZodEmail;
|
|
1015
|
-
exports.$ZodEmoji = $ZodEmoji;
|
|
1016
|
-
exports.$ZodEnum = $ZodEnum;
|
|
1017
|
-
exports.$ZodGUID = $ZodGUID;
|
|
1018
|
-
exports.$ZodIPv4 = $ZodIPv4;
|
|
1019
|
-
exports.$ZodIPv6 = $ZodIPv6;
|
|
1020
|
-
exports.$ZodISODate = $ZodISODate;
|
|
1021
|
-
exports.$ZodISODateTime = $ZodISODateTime;
|
|
1022
|
-
exports.$ZodISODuration = $ZodISODuration;
|
|
1023
|
-
exports.$ZodISOTime = $ZodISOTime;
|
|
1024
|
-
exports.$ZodIntersection = $ZodIntersection;
|
|
1025
|
-
exports.$ZodJWT = $ZodJWT;
|
|
1026
|
-
exports.$ZodKSUID = $ZodKSUID;
|
|
1027
|
-
exports.$ZodNanoID = $ZodNanoID;
|
|
1028
|
-
exports.$ZodNever = $ZodNever;
|
|
1029
|
-
exports.$ZodNonOptional = $ZodNonOptional;
|
|
1030
|
-
exports.$ZodNullable = $ZodNullable;
|
|
1031
|
-
exports.$ZodNumber = $ZodNumber;
|
|
1032
|
-
exports.$ZodNumberFormat = $ZodNumberFormat;
|
|
1033
|
-
exports.$ZodObjectJIT = $ZodObjectJIT;
|
|
1034
|
-
exports.$ZodOptional = $ZodOptional;
|
|
1035
|
-
exports.$ZodPipe = $ZodPipe;
|
|
1036
|
-
exports.$ZodPrefault = $ZodPrefault;
|
|
1037
|
-
exports.$ZodReadonly = $ZodReadonly;
|
|
1038
|
-
exports.$ZodString = $ZodString;
|
|
1039
|
-
exports.$ZodStringFormat = $ZodStringFormat;
|
|
1040
|
-
exports.$ZodTransform = $ZodTransform;
|
|
1041
|
-
exports.$ZodType = $ZodType;
|
|
1042
|
-
exports.$ZodULID = $ZodULID;
|
|
1043
|
-
exports.$ZodURL = $ZodURL;
|
|
1044
|
-
exports.$ZodUUID = $ZodUUID;
|
|
1045
|
-
exports.$ZodUnion = $ZodUnion;
|
|
1046
|
-
exports.$ZodUnknown = $ZodUnknown;
|
|
1047
|
-
exports.$ZodXID = $ZodXID;
|
|
1048
|
-
//# sourceMappingURL=schemas.cjs.map
|