@intlayer/design-system 6.0.2 → 6.1.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 +249 -56
- package/dist/.vite/manifest.json +42 -62
- package/dist/{better-auth.CMQ3rA-I-7umXOENE.js → better-auth.CiuwFiHM-7umXOENE.js} +1 -1
- package/dist/better-auth.CiuwFiHM-7umXOENE.js.map +1 -0
- package/dist/{better-auth.CMQ3rA-I-C2nBKRMa.cjs → better-auth.CiuwFiHM-C2nBKRMa.cjs} +1 -1
- package/dist/better-auth.CiuwFiHM-C2nBKRMa.cjs.map +1 -0
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +12 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +13 -2
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.mjs +1 -1
- package/dist/components/EditableField/EditableFieldTextArea.cjs +1 -1
- package/dist/components/EditableField/EditableFieldTextArea.mjs +1 -1
- package/dist/components/Form/FormBase.cjs +1 -1
- package/dist/components/Form/FormBase.mjs +1 -1
- package/dist/components/Form/elements/FormElementWrapper.cjs +2 -2
- package/dist/components/Form/elements/FormElementWrapper.mjs +2 -2
- package/dist/components/IDE/CodeContext.cjs +1 -1
- package/dist/components/IDE/CodeContext.mjs +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.cjs +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.cjs +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.mjs +1 -1
- package/dist/components/MarkDownRender/index.cjs +1 -1
- package/dist/components/MarkDownRender/index.cjs.map +1 -1
- package/dist/components/MarkDownRender/index.mjs +1 -1
- package/dist/components/MarkDownRender/index.mjs.map +1 -1
- package/dist/components/Modal/Modal.cjs +1 -1
- package/dist/components/Modal/Modal.mjs +1 -1
- package/dist/components/Navbar/DesktopNavbar.cjs +14 -16
- package/dist/components/Navbar/DesktopNavbar.cjs.map +1 -1
- package/dist/components/Navbar/DesktopNavbar.d.ts.map +1 -1
- package/dist/components/Navbar/DesktopNavbar.mjs +14 -16
- package/dist/components/Navbar/DesktopNavbar.mjs.map +1 -1
- package/dist/components/Navbar/MobileNavbar.cjs +1 -1
- package/dist/components/Navbar/MobileNavbar.mjs +1 -1
- package/dist/components/Navbar/index.cjs +1 -1
- package/dist/components/Navbar/index.mjs +1 -1
- package/dist/components/SwitchSelector/index.cjs +1 -1
- package/dist/components/SwitchSelector/index.mjs +1 -1
- package/dist/components/TabSelector/TabSelector.cjs +1 -1
- package/dist/components/TabSelector/TabSelector.mjs +1 -1
- package/dist/hooks/auth.cjs +13 -7
- package/dist/hooks/auth.cjs.map +1 -1
- package/dist/hooks/auth.mjs +12 -6
- package/dist/hooks/auth.mjs.map +1 -1
- package/dist/hooks/reactQuery.cjs +1 -1
- package/dist/hooks/reactQuery.d.ts +111 -43
- package/dist/hooks/reactQuery.d.ts.map +1 -1
- package/dist/hooks/reactQuery.mjs +1 -1
- package/dist/hooks/useAuth/useAuth.cjs.map +1 -1
- package/dist/hooks/useAuth/useAuth.d.ts +1 -0
- package/dist/hooks/useAuth/useAuth.d.ts.map +1 -1
- package/dist/hooks/useAuth/useAuth.mjs.map +1 -1
- package/dist/hooks/useAuth/useOAuth2.d.ts +1 -1
- package/dist/hooks/useAuth/useSession.d.ts +88 -1
- package/dist/hooks/useAuth/useSession.d.ts.map +1 -1
- package/dist/hooks/useUser/index.cjs +1 -1
- package/dist/hooks/useUser/index.d.ts +18 -2
- package/dist/hooks/useUser/index.d.ts.map +1 -1
- package/dist/hooks/useUser/index.mjs +1 -1
- package/dist/index-BCuMWKyy.js.map +1 -1
- package/dist/index-BYzBot7l.cjs.map +1 -1
- package/dist/{schemas-lh5OFOvX.cjs → schemas-0lUZlFWF.cjs} +703 -240
- package/dist/schemas-0lUZlFWF.cjs.map +1 -0
- package/dist/{schemas-DEXdAbCK.js → schemas-BG_GIt-j.js} +465 -2
- package/dist/schemas-BG_GIt-j.js.map +1 -0
- package/dist/zod-CCm3hUBS.js +210 -0
- package/dist/zod-CCm3hUBS.js.map +1 -0
- package/dist/zod-CvjrdkEg.cjs +209 -0
- package/dist/zod-CvjrdkEg.cjs.map +1 -0
- package/package.json +45 -43
- package/dist/better-auth.CMQ3rA-I-7umXOENE.js.map +0 -1
- package/dist/better-auth.CMQ3rA-I-C2nBKRMa.cjs.map +0 -1
- package/dist/parse-Ltyyb1op.cjs +0 -509
- package/dist/parse-Ltyyb1op.cjs.map +0 -1
- package/dist/parse-Vrm0h1r9.js +0 -510
- package/dist/parse-Vrm0h1r9.js.map +0 -1
- package/dist/schemas-DEXdAbCK.js.map +0 -1
- package/dist/schemas-lh5OFOvX.cjs.map +0 -1
- package/dist/zod-BvUVjPTw.cjs +0 -91
- package/dist/zod-BvUVjPTw.cjs.map +0 -1
- package/dist/zod-CJrbzxwg.js +0 -92
- package/dist/zod-CJrbzxwg.js.map +0 -1
|
@@ -1,5 +1,468 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
function $constructor(name, initializer2, params) {
|
|
3
|
+
function init(inst, def) {
|
|
4
|
+
var _a;
|
|
5
|
+
Object.defineProperty(inst, "_zod", {
|
|
6
|
+
value: inst._zod ?? {},
|
|
7
|
+
enumerable: false
|
|
8
|
+
});
|
|
9
|
+
(_a = inst._zod).traits ?? (_a.traits = /* @__PURE__ */ new Set());
|
|
10
|
+
inst._zod.traits.add(name);
|
|
11
|
+
initializer2(inst, def);
|
|
12
|
+
for (const k in _.prototype) {
|
|
13
|
+
if (!(k in inst))
|
|
14
|
+
Object.defineProperty(inst, k, { value: _.prototype[k].bind(inst) });
|
|
15
|
+
}
|
|
16
|
+
inst._zod.constr = _;
|
|
17
|
+
inst._zod.def = def;
|
|
18
|
+
}
|
|
19
|
+
const Parent = params?.Parent ?? Object;
|
|
20
|
+
class Definition extends Parent {
|
|
21
|
+
}
|
|
22
|
+
Object.defineProperty(Definition, "name", { value: name });
|
|
23
|
+
function _(def) {
|
|
24
|
+
var _a;
|
|
25
|
+
const inst = params?.Parent ? new Definition() : this;
|
|
26
|
+
init(inst, def);
|
|
27
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
28
|
+
for (const fn of inst._zod.deferred) {
|
|
29
|
+
fn();
|
|
30
|
+
}
|
|
31
|
+
return inst;
|
|
32
|
+
}
|
|
33
|
+
Object.defineProperty(_, "init", { value: init });
|
|
34
|
+
Object.defineProperty(_, Symbol.hasInstance, {
|
|
35
|
+
value: (inst) => {
|
|
36
|
+
if (params?.Parent && inst instanceof params.Parent)
|
|
37
|
+
return true;
|
|
38
|
+
return inst?._zod?.traits?.has(name);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
Object.defineProperty(_, "name", { value: name });
|
|
42
|
+
return _;
|
|
43
|
+
}
|
|
44
|
+
class $ZodAsyncError extends Error {
|
|
45
|
+
constructor() {
|
|
46
|
+
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const globalConfig = {};
|
|
50
|
+
function config(newConfig) {
|
|
51
|
+
return globalConfig;
|
|
52
|
+
}
|
|
53
|
+
function getEnumValues(entries) {
|
|
54
|
+
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
55
|
+
const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
56
|
+
return values;
|
|
57
|
+
}
|
|
58
|
+
function jsonStringifyReplacer(_, value) {
|
|
59
|
+
if (typeof value === "bigint")
|
|
60
|
+
return value.toString();
|
|
61
|
+
return value;
|
|
62
|
+
}
|
|
63
|
+
function cached(getter) {
|
|
64
|
+
return {
|
|
65
|
+
get value() {
|
|
66
|
+
{
|
|
67
|
+
const value = getter();
|
|
68
|
+
Object.defineProperty(this, "value", { value });
|
|
69
|
+
return value;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function nullish(input) {
|
|
75
|
+
return input === null || input === void 0;
|
|
76
|
+
}
|
|
77
|
+
function cleanRegex(source) {
|
|
78
|
+
const start = source.startsWith("^") ? 1 : 0;
|
|
79
|
+
const end = source.endsWith("$") ? source.length - 1 : source.length;
|
|
80
|
+
return source.slice(start, end);
|
|
81
|
+
}
|
|
82
|
+
function defineLazy(object2, key, getter) {
|
|
83
|
+
Object.defineProperty(object2, key, {
|
|
84
|
+
get() {
|
|
85
|
+
{
|
|
86
|
+
const value = getter();
|
|
87
|
+
object2[key] = value;
|
|
88
|
+
return value;
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
set(v) {
|
|
92
|
+
Object.defineProperty(object2, key, {
|
|
93
|
+
value: v
|
|
94
|
+
// configurable: true,
|
|
95
|
+
});
|
|
96
|
+
},
|
|
97
|
+
configurable: true
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function assignProp(target, prop, value) {
|
|
101
|
+
Object.defineProperty(target, prop, {
|
|
102
|
+
value,
|
|
103
|
+
writable: true,
|
|
104
|
+
enumerable: true,
|
|
105
|
+
configurable: true
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
function esc(str) {
|
|
109
|
+
return JSON.stringify(str);
|
|
110
|
+
}
|
|
111
|
+
const captureStackTrace = Error.captureStackTrace ? Error.captureStackTrace : (..._args) => {
|
|
112
|
+
};
|
|
113
|
+
function isObject(data) {
|
|
114
|
+
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
115
|
+
}
|
|
116
|
+
const allowsEval = cached(() => {
|
|
117
|
+
if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
try {
|
|
121
|
+
const F = Function;
|
|
122
|
+
new F("");
|
|
123
|
+
return true;
|
|
124
|
+
} catch (_) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
function isPlainObject(o) {
|
|
129
|
+
if (isObject(o) === false)
|
|
130
|
+
return false;
|
|
131
|
+
const ctor = o.constructor;
|
|
132
|
+
if (ctor === void 0)
|
|
133
|
+
return true;
|
|
134
|
+
const prot = ctor.prototype;
|
|
135
|
+
if (isObject(prot) === false)
|
|
136
|
+
return false;
|
|
137
|
+
if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) {
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
const propertyKeyTypes = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
|
|
143
|
+
function escapeRegex(str) {
|
|
144
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
145
|
+
}
|
|
146
|
+
function clone(inst, def, params) {
|
|
147
|
+
const cl = new inst._zod.constr(def ?? inst._zod.def);
|
|
148
|
+
if (!def || params?.parent)
|
|
149
|
+
cl._zod.parent = inst;
|
|
150
|
+
return cl;
|
|
151
|
+
}
|
|
152
|
+
function normalizeParams(_params) {
|
|
153
|
+
const params = _params;
|
|
154
|
+
if (!params)
|
|
155
|
+
return {};
|
|
156
|
+
if (typeof params === "string")
|
|
157
|
+
return { error: () => params };
|
|
158
|
+
if (params?.message !== void 0) {
|
|
159
|
+
if (params?.error !== void 0)
|
|
160
|
+
throw new Error("Cannot specify both `message` and `error` params");
|
|
161
|
+
params.error = params.message;
|
|
162
|
+
}
|
|
163
|
+
delete params.message;
|
|
164
|
+
if (typeof params.error === "string")
|
|
165
|
+
return { ...params, error: () => params.error };
|
|
166
|
+
return params;
|
|
167
|
+
}
|
|
168
|
+
function optionalKeys(shape) {
|
|
169
|
+
return Object.keys(shape).filter((k) => {
|
|
170
|
+
return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
function pick(schema, mask) {
|
|
174
|
+
const newShape = {};
|
|
175
|
+
const currDef = schema._zod.def;
|
|
176
|
+
for (const key in mask) {
|
|
177
|
+
if (!(key in currDef.shape)) {
|
|
178
|
+
throw new Error(`Unrecognized key: "${key}"`);
|
|
179
|
+
}
|
|
180
|
+
if (!mask[key])
|
|
181
|
+
continue;
|
|
182
|
+
newShape[key] = currDef.shape[key];
|
|
183
|
+
}
|
|
184
|
+
return clone(schema, {
|
|
185
|
+
...schema._zod.def,
|
|
186
|
+
shape: newShape,
|
|
187
|
+
checks: []
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
function omit(schema, mask) {
|
|
191
|
+
const newShape = { ...schema._zod.def.shape };
|
|
192
|
+
const currDef = schema._zod.def;
|
|
193
|
+
for (const key in mask) {
|
|
194
|
+
if (!(key in currDef.shape)) {
|
|
195
|
+
throw new Error(`Unrecognized key: "${key}"`);
|
|
196
|
+
}
|
|
197
|
+
if (!mask[key])
|
|
198
|
+
continue;
|
|
199
|
+
delete newShape[key];
|
|
200
|
+
}
|
|
201
|
+
return clone(schema, {
|
|
202
|
+
...schema._zod.def,
|
|
203
|
+
shape: newShape,
|
|
204
|
+
checks: []
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
function extend(schema, shape) {
|
|
208
|
+
if (!isPlainObject(shape)) {
|
|
209
|
+
throw new Error("Invalid input to extend: expected a plain object");
|
|
210
|
+
}
|
|
211
|
+
const def = {
|
|
212
|
+
...schema._zod.def,
|
|
213
|
+
get shape() {
|
|
214
|
+
const _shape = { ...schema._zod.def.shape, ...shape };
|
|
215
|
+
assignProp(this, "shape", _shape);
|
|
216
|
+
return _shape;
|
|
217
|
+
},
|
|
218
|
+
checks: []
|
|
219
|
+
// delete existing checks
|
|
220
|
+
};
|
|
221
|
+
return clone(schema, def);
|
|
222
|
+
}
|
|
223
|
+
function merge(a, b) {
|
|
224
|
+
return clone(a, {
|
|
225
|
+
...a._zod.def,
|
|
226
|
+
get shape() {
|
|
227
|
+
const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
|
|
228
|
+
assignProp(this, "shape", _shape);
|
|
229
|
+
return _shape;
|
|
230
|
+
},
|
|
231
|
+
catchall: b._zod.def.catchall,
|
|
232
|
+
checks: []
|
|
233
|
+
// delete existing checks
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
function partial(Class, schema, mask) {
|
|
237
|
+
const oldShape = schema._zod.def.shape;
|
|
238
|
+
const shape = { ...oldShape };
|
|
239
|
+
if (mask) {
|
|
240
|
+
for (const key in mask) {
|
|
241
|
+
if (!(key in oldShape)) {
|
|
242
|
+
throw new Error(`Unrecognized key: "${key}"`);
|
|
243
|
+
}
|
|
244
|
+
if (!mask[key])
|
|
245
|
+
continue;
|
|
246
|
+
shape[key] = Class ? new Class({
|
|
247
|
+
type: "optional",
|
|
248
|
+
innerType: oldShape[key]
|
|
249
|
+
}) : oldShape[key];
|
|
250
|
+
}
|
|
251
|
+
} else {
|
|
252
|
+
for (const key in oldShape) {
|
|
253
|
+
shape[key] = Class ? new Class({
|
|
254
|
+
type: "optional",
|
|
255
|
+
innerType: oldShape[key]
|
|
256
|
+
}) : oldShape[key];
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
return clone(schema, {
|
|
260
|
+
...schema._zod.def,
|
|
261
|
+
shape,
|
|
262
|
+
checks: []
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
function required(Class, schema, mask) {
|
|
266
|
+
const oldShape = schema._zod.def.shape;
|
|
267
|
+
const shape = { ...oldShape };
|
|
268
|
+
if (mask) {
|
|
269
|
+
for (const key in mask) {
|
|
270
|
+
if (!(key in shape)) {
|
|
271
|
+
throw new Error(`Unrecognized key: "${key}"`);
|
|
272
|
+
}
|
|
273
|
+
if (!mask[key])
|
|
274
|
+
continue;
|
|
275
|
+
shape[key] = new Class({
|
|
276
|
+
type: "nonoptional",
|
|
277
|
+
innerType: oldShape[key]
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
} else {
|
|
281
|
+
for (const key in oldShape) {
|
|
282
|
+
shape[key] = new Class({
|
|
283
|
+
type: "nonoptional",
|
|
284
|
+
innerType: oldShape[key]
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
return clone(schema, {
|
|
289
|
+
...schema._zod.def,
|
|
290
|
+
shape,
|
|
291
|
+
// optional: [],
|
|
292
|
+
checks: []
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
function aborted(x, startIndex = 0) {
|
|
296
|
+
for (let i = startIndex; i < x.issues.length; i++) {
|
|
297
|
+
if (x.issues[i]?.continue !== true)
|
|
298
|
+
return true;
|
|
299
|
+
}
|
|
300
|
+
return false;
|
|
301
|
+
}
|
|
302
|
+
function prefixIssues(path, issues) {
|
|
303
|
+
return issues.map((iss) => {
|
|
304
|
+
var _a;
|
|
305
|
+
(_a = iss).path ?? (_a.path = []);
|
|
306
|
+
iss.path.unshift(path);
|
|
307
|
+
return iss;
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
function unwrapMessage(message) {
|
|
311
|
+
return typeof message === "string" ? message : message?.message;
|
|
312
|
+
}
|
|
313
|
+
function finalizeIssue(iss, ctx, config2) {
|
|
314
|
+
const full = { ...iss, path: iss.path ?? [] };
|
|
315
|
+
if (!iss.message) {
|
|
316
|
+
const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
|
|
317
|
+
full.message = message;
|
|
318
|
+
}
|
|
319
|
+
delete full.inst;
|
|
320
|
+
delete full.continue;
|
|
321
|
+
if (!ctx?.reportInput) {
|
|
322
|
+
delete full.input;
|
|
323
|
+
}
|
|
324
|
+
return full;
|
|
325
|
+
}
|
|
326
|
+
function getLengthableOrigin(input) {
|
|
327
|
+
if (Array.isArray(input))
|
|
328
|
+
return "array";
|
|
329
|
+
if (typeof input === "string")
|
|
330
|
+
return "string";
|
|
331
|
+
return "unknown";
|
|
332
|
+
}
|
|
333
|
+
function issue(...args) {
|
|
334
|
+
const [iss, input, inst] = args;
|
|
335
|
+
if (typeof iss === "string") {
|
|
336
|
+
return {
|
|
337
|
+
message: iss,
|
|
338
|
+
code: "custom",
|
|
339
|
+
input,
|
|
340
|
+
inst
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
return { ...iss };
|
|
344
|
+
}
|
|
345
|
+
const initializer$1 = (inst, def) => {
|
|
346
|
+
inst.name = "$ZodError";
|
|
347
|
+
Object.defineProperty(inst, "_zod", {
|
|
348
|
+
value: inst._zod,
|
|
349
|
+
enumerable: false
|
|
350
|
+
});
|
|
351
|
+
Object.defineProperty(inst, "issues", {
|
|
352
|
+
value: def,
|
|
353
|
+
enumerable: false
|
|
354
|
+
});
|
|
355
|
+
Object.defineProperty(inst, "message", {
|
|
356
|
+
get() {
|
|
357
|
+
return JSON.stringify(def, jsonStringifyReplacer, 2);
|
|
358
|
+
},
|
|
359
|
+
enumerable: true
|
|
360
|
+
// configurable: false,
|
|
361
|
+
});
|
|
362
|
+
Object.defineProperty(inst, "toString", {
|
|
363
|
+
value: () => inst.message,
|
|
364
|
+
enumerable: false
|
|
365
|
+
});
|
|
366
|
+
};
|
|
367
|
+
const $ZodError = $constructor("$ZodError", initializer$1);
|
|
368
|
+
const $ZodRealError = $constructor("$ZodError", initializer$1, { Parent: Error });
|
|
369
|
+
function flattenError(error, mapper = (issue2) => issue2.message) {
|
|
370
|
+
const fieldErrors = {};
|
|
371
|
+
const formErrors = [];
|
|
372
|
+
for (const sub of error.issues) {
|
|
373
|
+
if (sub.path.length > 0) {
|
|
374
|
+
fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
|
|
375
|
+
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
376
|
+
} else {
|
|
377
|
+
formErrors.push(mapper(sub));
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
return { formErrors, fieldErrors };
|
|
381
|
+
}
|
|
382
|
+
function formatError(error, _mapper) {
|
|
383
|
+
const mapper = _mapper || function(issue2) {
|
|
384
|
+
return issue2.message;
|
|
385
|
+
};
|
|
386
|
+
const fieldErrors = { _errors: [] };
|
|
387
|
+
const processError = (error2) => {
|
|
388
|
+
for (const issue2 of error2.issues) {
|
|
389
|
+
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
390
|
+
issue2.errors.map((issues) => processError({ issues }));
|
|
391
|
+
} else if (issue2.code === "invalid_key") {
|
|
392
|
+
processError({ issues: issue2.issues });
|
|
393
|
+
} else if (issue2.code === "invalid_element") {
|
|
394
|
+
processError({ issues: issue2.issues });
|
|
395
|
+
} else if (issue2.path.length === 0) {
|
|
396
|
+
fieldErrors._errors.push(mapper(issue2));
|
|
397
|
+
} else {
|
|
398
|
+
let curr = fieldErrors;
|
|
399
|
+
let i = 0;
|
|
400
|
+
while (i < issue2.path.length) {
|
|
401
|
+
const el = issue2.path[i];
|
|
402
|
+
const terminal = i === issue2.path.length - 1;
|
|
403
|
+
if (!terminal) {
|
|
404
|
+
curr[el] = curr[el] || { _errors: [] };
|
|
405
|
+
} else {
|
|
406
|
+
curr[el] = curr[el] || { _errors: [] };
|
|
407
|
+
curr[el]._errors.push(mapper(issue2));
|
|
408
|
+
}
|
|
409
|
+
curr = curr[el];
|
|
410
|
+
i++;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
processError(error);
|
|
416
|
+
return fieldErrors;
|
|
417
|
+
}
|
|
418
|
+
const _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
419
|
+
const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
|
|
420
|
+
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
421
|
+
if (result instanceof Promise) {
|
|
422
|
+
throw new $ZodAsyncError();
|
|
423
|
+
}
|
|
424
|
+
if (result.issues.length) {
|
|
425
|
+
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
426
|
+
captureStackTrace(e, _params?.callee);
|
|
427
|
+
throw e;
|
|
428
|
+
}
|
|
429
|
+
return result.value;
|
|
430
|
+
};
|
|
431
|
+
const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
432
|
+
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
433
|
+
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
434
|
+
if (result instanceof Promise)
|
|
435
|
+
result = await result;
|
|
436
|
+
if (result.issues.length) {
|
|
437
|
+
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
438
|
+
captureStackTrace(e, params?.callee);
|
|
439
|
+
throw e;
|
|
440
|
+
}
|
|
441
|
+
return result.value;
|
|
442
|
+
};
|
|
443
|
+
const _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
444
|
+
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
445
|
+
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
446
|
+
if (result instanceof Promise) {
|
|
447
|
+
throw new $ZodAsyncError();
|
|
448
|
+
}
|
|
449
|
+
return result.issues.length ? {
|
|
450
|
+
success: false,
|
|
451
|
+
error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
452
|
+
} : { success: true, data: result.value };
|
|
453
|
+
};
|
|
454
|
+
const safeParse$1 = /* @__PURE__ */ _safeParse($ZodRealError);
|
|
455
|
+
const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
456
|
+
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
457
|
+
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
458
|
+
if (result instanceof Promise)
|
|
459
|
+
result = await result;
|
|
460
|
+
return result.issues.length ? {
|
|
461
|
+
success: false,
|
|
462
|
+
error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
463
|
+
} : { success: true, data: result.value };
|
|
464
|
+
};
|
|
465
|
+
const safeParseAsync$1 = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
3
466
|
const cuid = /^[cC][^\s-]{8,}$/;
|
|
4
467
|
const cuid2 = /^[0-9a-z]+$/;
|
|
5
468
|
const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
|
|
@@ -52,18 +515,18 @@ const string$1 = (params) => {
|
|
|
52
515
|
};
|
|
53
516
|
const lowercase = /^[^A-Z]*$/;
|
|
54
517
|
const uppercase = /^[^a-z]*$/;
|
|
55
|
-
const $ZodCheck = /* @__PURE__ */
|
|
518
|
+
const $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
56
519
|
var _a;
|
|
57
520
|
inst._zod ?? (inst._zod = {});
|
|
58
521
|
inst._zod.def = def;
|
|
59
522
|
(_a = inst._zod).onattach ?? (_a.onattach = []);
|
|
60
523
|
});
|
|
61
|
-
const $ZodCheckMaxLength = /* @__PURE__ */
|
|
524
|
+
const $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
62
525
|
var _a;
|
|
63
526
|
$ZodCheck.init(inst, def);
|
|
64
527
|
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
65
528
|
const val = payload.value;
|
|
66
|
-
return !
|
|
529
|
+
return !nullish(val) && val.length !== void 0;
|
|
67
530
|
});
|
|
68
531
|
inst._zod.onattach.push((inst2) => {
|
|
69
532
|
const curr = inst2._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
@@ -75,7 +538,7 @@ const $ZodCheckMaxLength = /* @__PURE__ */ parse$1.$constructor("$ZodCheckMaxLen
|
|
|
75
538
|
const length = input.length;
|
|
76
539
|
if (length <= def.maximum)
|
|
77
540
|
return;
|
|
78
|
-
const origin =
|
|
541
|
+
const origin = getLengthableOrigin(input);
|
|
79
542
|
payload.issues.push({
|
|
80
543
|
origin,
|
|
81
544
|
code: "too_big",
|
|
@@ -87,12 +550,12 @@ const $ZodCheckMaxLength = /* @__PURE__ */ parse$1.$constructor("$ZodCheckMaxLen
|
|
|
87
550
|
});
|
|
88
551
|
};
|
|
89
552
|
});
|
|
90
|
-
const $ZodCheckMinLength = /* @__PURE__ */
|
|
553
|
+
const $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
91
554
|
var _a;
|
|
92
555
|
$ZodCheck.init(inst, def);
|
|
93
556
|
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
94
557
|
const val = payload.value;
|
|
95
|
-
return !
|
|
558
|
+
return !nullish(val) && val.length !== void 0;
|
|
96
559
|
});
|
|
97
560
|
inst._zod.onattach.push((inst2) => {
|
|
98
561
|
const curr = inst2._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
@@ -104,7 +567,7 @@ const $ZodCheckMinLength = /* @__PURE__ */ parse$1.$constructor("$ZodCheckMinLen
|
|
|
104
567
|
const length = input.length;
|
|
105
568
|
if (length >= def.minimum)
|
|
106
569
|
return;
|
|
107
|
-
const origin =
|
|
570
|
+
const origin = getLengthableOrigin(input);
|
|
108
571
|
payload.issues.push({
|
|
109
572
|
origin,
|
|
110
573
|
code: "too_small",
|
|
@@ -116,12 +579,12 @@ const $ZodCheckMinLength = /* @__PURE__ */ parse$1.$constructor("$ZodCheckMinLen
|
|
|
116
579
|
});
|
|
117
580
|
};
|
|
118
581
|
});
|
|
119
|
-
const $ZodCheckLengthEquals = /* @__PURE__ */
|
|
582
|
+
const $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
120
583
|
var _a;
|
|
121
584
|
$ZodCheck.init(inst, def);
|
|
122
585
|
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
123
586
|
const val = payload.value;
|
|
124
|
-
return !
|
|
587
|
+
return !nullish(val) && val.length !== void 0;
|
|
125
588
|
});
|
|
126
589
|
inst._zod.onattach.push((inst2) => {
|
|
127
590
|
const bag = inst2._zod.bag;
|
|
@@ -134,7 +597,7 @@ const $ZodCheckLengthEquals = /* @__PURE__ */ parse$1.$constructor("$ZodCheckLen
|
|
|
134
597
|
const length = input.length;
|
|
135
598
|
if (length === def.length)
|
|
136
599
|
return;
|
|
137
|
-
const origin =
|
|
600
|
+
const origin = getLengthableOrigin(input);
|
|
138
601
|
const tooBig = length > def.length;
|
|
139
602
|
payload.issues.push({
|
|
140
603
|
origin,
|
|
@@ -147,7 +610,7 @@ const $ZodCheckLengthEquals = /* @__PURE__ */ parse$1.$constructor("$ZodCheckLen
|
|
|
147
610
|
});
|
|
148
611
|
};
|
|
149
612
|
});
|
|
150
|
-
const $ZodCheckStringFormat = /* @__PURE__ */
|
|
613
|
+
const $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
151
614
|
var _a, _b;
|
|
152
615
|
$ZodCheck.init(inst, def);
|
|
153
616
|
inst._zod.onattach.push((inst2) => {
|
|
@@ -177,7 +640,7 @@ const $ZodCheckStringFormat = /* @__PURE__ */ parse$1.$constructor("$ZodCheckStr
|
|
|
177
640
|
(_b = inst._zod).check ?? (_b.check = () => {
|
|
178
641
|
});
|
|
179
642
|
});
|
|
180
|
-
const $ZodCheckRegex = /* @__PURE__ */
|
|
643
|
+
const $ZodCheckRegex = /* @__PURE__ */ $constructor("$ZodCheckRegex", (inst, def) => {
|
|
181
644
|
$ZodCheckStringFormat.init(inst, def);
|
|
182
645
|
inst._zod.check = (payload) => {
|
|
183
646
|
def.pattern.lastIndex = 0;
|
|
@@ -194,17 +657,17 @@ const $ZodCheckRegex = /* @__PURE__ */ parse$1.$constructor("$ZodCheckRegex", (i
|
|
|
194
657
|
});
|
|
195
658
|
};
|
|
196
659
|
});
|
|
197
|
-
const $ZodCheckLowerCase = /* @__PURE__ */
|
|
660
|
+
const $ZodCheckLowerCase = /* @__PURE__ */ $constructor("$ZodCheckLowerCase", (inst, def) => {
|
|
198
661
|
def.pattern ?? (def.pattern = lowercase);
|
|
199
662
|
$ZodCheckStringFormat.init(inst, def);
|
|
200
663
|
});
|
|
201
|
-
const $ZodCheckUpperCase = /* @__PURE__ */
|
|
664
|
+
const $ZodCheckUpperCase = /* @__PURE__ */ $constructor("$ZodCheckUpperCase", (inst, def) => {
|
|
202
665
|
def.pattern ?? (def.pattern = uppercase);
|
|
203
666
|
$ZodCheckStringFormat.init(inst, def);
|
|
204
667
|
});
|
|
205
|
-
const $ZodCheckIncludes = /* @__PURE__ */
|
|
668
|
+
const $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst, def) => {
|
|
206
669
|
$ZodCheck.init(inst, def);
|
|
207
|
-
const escapedRegex =
|
|
670
|
+
const escapedRegex = escapeRegex(def.includes);
|
|
208
671
|
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
|
|
209
672
|
def.pattern = pattern;
|
|
210
673
|
inst._zod.onattach.push((inst2) => {
|
|
@@ -226,9 +689,9 @@ const $ZodCheckIncludes = /* @__PURE__ */ parse$1.$constructor("$ZodCheckInclude
|
|
|
226
689
|
});
|
|
227
690
|
};
|
|
228
691
|
});
|
|
229
|
-
const $ZodCheckStartsWith = /* @__PURE__ */
|
|
692
|
+
const $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (inst, def) => {
|
|
230
693
|
$ZodCheck.init(inst, def);
|
|
231
|
-
const pattern = new RegExp(`^${
|
|
694
|
+
const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
|
|
232
695
|
def.pattern ?? (def.pattern = pattern);
|
|
233
696
|
inst._zod.onattach.push((inst2) => {
|
|
234
697
|
const bag = inst2._zod.bag;
|
|
@@ -249,9 +712,9 @@ const $ZodCheckStartsWith = /* @__PURE__ */ parse$1.$constructor("$ZodCheckStart
|
|
|
249
712
|
});
|
|
250
713
|
};
|
|
251
714
|
});
|
|
252
|
-
const $ZodCheckEndsWith = /* @__PURE__ */
|
|
715
|
+
const $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst, def) => {
|
|
253
716
|
$ZodCheck.init(inst, def);
|
|
254
|
-
const pattern = new RegExp(`.*${
|
|
717
|
+
const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
|
|
255
718
|
def.pattern ?? (def.pattern = pattern);
|
|
256
719
|
inst._zod.onattach.push((inst2) => {
|
|
257
720
|
const bag = inst2._zod.bag;
|
|
@@ -272,7 +735,7 @@ const $ZodCheckEndsWith = /* @__PURE__ */ parse$1.$constructor("$ZodCheckEndsWit
|
|
|
272
735
|
});
|
|
273
736
|
};
|
|
274
737
|
});
|
|
275
|
-
const $ZodCheckOverwrite = /* @__PURE__ */
|
|
738
|
+
const $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (inst, def) => {
|
|
276
739
|
$ZodCheck.init(inst, def);
|
|
277
740
|
inst._zod.check = (payload) => {
|
|
278
741
|
payload.value = def.tx(payload.value);
|
|
@@ -317,7 +780,7 @@ const version = {
|
|
|
317
780
|
minor: 0,
|
|
318
781
|
patch: 0
|
|
319
782
|
};
|
|
320
|
-
const $ZodType = /* @__PURE__ */
|
|
783
|
+
const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
321
784
|
var _a;
|
|
322
785
|
inst ?? (inst = {});
|
|
323
786
|
inst._zod.def = def;
|
|
@@ -339,7 +802,7 @@ const $ZodType = /* @__PURE__ */ parse$1.$constructor("$ZodType", (inst, def) =>
|
|
|
339
802
|
});
|
|
340
803
|
} else {
|
|
341
804
|
const runChecks = (payload, checks2, ctx) => {
|
|
342
|
-
let isAborted =
|
|
805
|
+
let isAborted = aborted(payload);
|
|
343
806
|
let asyncResult;
|
|
344
807
|
for (const ch of checks2) {
|
|
345
808
|
if (ch._zod.def.when) {
|
|
@@ -352,7 +815,7 @@ const $ZodType = /* @__PURE__ */ parse$1.$constructor("$ZodType", (inst, def) =>
|
|
|
352
815
|
const currLen = payload.issues.length;
|
|
353
816
|
const _ = ch._zod.check(payload);
|
|
354
817
|
if (_ instanceof Promise && ctx?.async === false) {
|
|
355
|
-
throw new
|
|
818
|
+
throw new $ZodAsyncError();
|
|
356
819
|
}
|
|
357
820
|
if (asyncResult || _ instanceof Promise) {
|
|
358
821
|
asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
@@ -361,14 +824,14 @@ const $ZodType = /* @__PURE__ */ parse$1.$constructor("$ZodType", (inst, def) =>
|
|
|
361
824
|
if (nextLen === currLen)
|
|
362
825
|
return;
|
|
363
826
|
if (!isAborted)
|
|
364
|
-
isAborted =
|
|
827
|
+
isAborted = aborted(payload, currLen);
|
|
365
828
|
});
|
|
366
829
|
} else {
|
|
367
830
|
const nextLen = payload.issues.length;
|
|
368
831
|
if (nextLen === currLen)
|
|
369
832
|
continue;
|
|
370
833
|
if (!isAborted)
|
|
371
|
-
isAborted =
|
|
834
|
+
isAborted = aborted(payload, currLen);
|
|
372
835
|
}
|
|
373
836
|
}
|
|
374
837
|
if (asyncResult) {
|
|
@@ -382,7 +845,7 @@ const $ZodType = /* @__PURE__ */ parse$1.$constructor("$ZodType", (inst, def) =>
|
|
|
382
845
|
const result = inst._zod.parse(payload, ctx);
|
|
383
846
|
if (result instanceof Promise) {
|
|
384
847
|
if (ctx.async === false)
|
|
385
|
-
throw new
|
|
848
|
+
throw new $ZodAsyncError();
|
|
386
849
|
return result.then((result2) => runChecks(result2, checks, ctx));
|
|
387
850
|
}
|
|
388
851
|
return runChecks(result, checks, ctx);
|
|
@@ -391,17 +854,17 @@ const $ZodType = /* @__PURE__ */ parse$1.$constructor("$ZodType", (inst, def) =>
|
|
|
391
854
|
inst["~standard"] = {
|
|
392
855
|
validate: (value) => {
|
|
393
856
|
try {
|
|
394
|
-
const r =
|
|
857
|
+
const r = safeParse$1(inst, value);
|
|
395
858
|
return r.success ? { value: r.data } : { issues: r.error?.issues };
|
|
396
859
|
} catch (_) {
|
|
397
|
-
return
|
|
860
|
+
return safeParseAsync$1(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
|
|
398
861
|
}
|
|
399
862
|
},
|
|
400
863
|
vendor: "zod",
|
|
401
864
|
version: 1
|
|
402
865
|
};
|
|
403
866
|
});
|
|
404
|
-
const $ZodString = /* @__PURE__ */
|
|
867
|
+
const $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
|
|
405
868
|
$ZodType.init(inst, def);
|
|
406
869
|
inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$1(inst._zod.bag);
|
|
407
870
|
inst._zod.parse = (payload, _) => {
|
|
@@ -421,15 +884,15 @@ const $ZodString = /* @__PURE__ */ parse$1.$constructor("$ZodString", (inst, def
|
|
|
421
884
|
return payload;
|
|
422
885
|
};
|
|
423
886
|
});
|
|
424
|
-
const $ZodStringFormat = /* @__PURE__ */
|
|
887
|
+
const $ZodStringFormat = /* @__PURE__ */ $constructor("$ZodStringFormat", (inst, def) => {
|
|
425
888
|
$ZodCheckStringFormat.init(inst, def);
|
|
426
889
|
$ZodString.init(inst, def);
|
|
427
890
|
});
|
|
428
|
-
const $ZodGUID = /* @__PURE__ */
|
|
891
|
+
const $ZodGUID = /* @__PURE__ */ $constructor("$ZodGUID", (inst, def) => {
|
|
429
892
|
def.pattern ?? (def.pattern = guid);
|
|
430
893
|
$ZodStringFormat.init(inst, def);
|
|
431
894
|
});
|
|
432
|
-
const $ZodUUID = /* @__PURE__ */
|
|
895
|
+
const $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
|
|
433
896
|
if (def.version) {
|
|
434
897
|
const versionMap = {
|
|
435
898
|
v1: 1,
|
|
@@ -449,11 +912,11 @@ const $ZodUUID = /* @__PURE__ */ parse$1.$constructor("$ZodUUID", (inst, def) =>
|
|
|
449
912
|
def.pattern ?? (def.pattern = uuid());
|
|
450
913
|
$ZodStringFormat.init(inst, def);
|
|
451
914
|
});
|
|
452
|
-
const $ZodEmail = /* @__PURE__ */
|
|
915
|
+
const $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => {
|
|
453
916
|
def.pattern ?? (def.pattern = email);
|
|
454
917
|
$ZodStringFormat.init(inst, def);
|
|
455
918
|
});
|
|
456
|
-
const $ZodURL = /* @__PURE__ */
|
|
919
|
+
const $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
457
920
|
$ZodStringFormat.init(inst, def);
|
|
458
921
|
inst._zod.check = (payload) => {
|
|
459
922
|
try {
|
|
@@ -505,51 +968,51 @@ const $ZodURL = /* @__PURE__ */ parse$1.$constructor("$ZodURL", (inst, def) => {
|
|
|
505
968
|
}
|
|
506
969
|
};
|
|
507
970
|
});
|
|
508
|
-
const $ZodEmoji = /* @__PURE__ */
|
|
971
|
+
const $ZodEmoji = /* @__PURE__ */ $constructor("$ZodEmoji", (inst, def) => {
|
|
509
972
|
def.pattern ?? (def.pattern = emoji());
|
|
510
973
|
$ZodStringFormat.init(inst, def);
|
|
511
974
|
});
|
|
512
|
-
const $ZodNanoID = /* @__PURE__ */
|
|
975
|
+
const $ZodNanoID = /* @__PURE__ */ $constructor("$ZodNanoID", (inst, def) => {
|
|
513
976
|
def.pattern ?? (def.pattern = nanoid);
|
|
514
977
|
$ZodStringFormat.init(inst, def);
|
|
515
978
|
});
|
|
516
|
-
const $ZodCUID = /* @__PURE__ */
|
|
979
|
+
const $ZodCUID = /* @__PURE__ */ $constructor("$ZodCUID", (inst, def) => {
|
|
517
980
|
def.pattern ?? (def.pattern = cuid);
|
|
518
981
|
$ZodStringFormat.init(inst, def);
|
|
519
982
|
});
|
|
520
|
-
const $ZodCUID2 = /* @__PURE__ */
|
|
983
|
+
const $ZodCUID2 = /* @__PURE__ */ $constructor("$ZodCUID2", (inst, def) => {
|
|
521
984
|
def.pattern ?? (def.pattern = cuid2);
|
|
522
985
|
$ZodStringFormat.init(inst, def);
|
|
523
986
|
});
|
|
524
|
-
const $ZodULID = /* @__PURE__ */
|
|
987
|
+
const $ZodULID = /* @__PURE__ */ $constructor("$ZodULID", (inst, def) => {
|
|
525
988
|
def.pattern ?? (def.pattern = ulid);
|
|
526
989
|
$ZodStringFormat.init(inst, def);
|
|
527
990
|
});
|
|
528
|
-
const $ZodXID = /* @__PURE__ */
|
|
991
|
+
const $ZodXID = /* @__PURE__ */ $constructor("$ZodXID", (inst, def) => {
|
|
529
992
|
def.pattern ?? (def.pattern = xid);
|
|
530
993
|
$ZodStringFormat.init(inst, def);
|
|
531
994
|
});
|
|
532
|
-
const $ZodKSUID = /* @__PURE__ */
|
|
995
|
+
const $ZodKSUID = /* @__PURE__ */ $constructor("$ZodKSUID", (inst, def) => {
|
|
533
996
|
def.pattern ?? (def.pattern = ksuid);
|
|
534
997
|
$ZodStringFormat.init(inst, def);
|
|
535
998
|
});
|
|
536
|
-
const $ZodISODateTime = /* @__PURE__ */
|
|
999
|
+
const $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => {
|
|
537
1000
|
def.pattern ?? (def.pattern = datetime$1(def));
|
|
538
1001
|
$ZodStringFormat.init(inst, def);
|
|
539
1002
|
});
|
|
540
|
-
const $ZodISODate = /* @__PURE__ */
|
|
1003
|
+
const $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {
|
|
541
1004
|
def.pattern ?? (def.pattern = date$1);
|
|
542
1005
|
$ZodStringFormat.init(inst, def);
|
|
543
1006
|
});
|
|
544
|
-
const $ZodISOTime = /* @__PURE__ */
|
|
1007
|
+
const $ZodISOTime = /* @__PURE__ */ $constructor("$ZodISOTime", (inst, def) => {
|
|
545
1008
|
def.pattern ?? (def.pattern = time$1(def));
|
|
546
1009
|
$ZodStringFormat.init(inst, def);
|
|
547
1010
|
});
|
|
548
|
-
const $ZodISODuration = /* @__PURE__ */
|
|
1011
|
+
const $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def) => {
|
|
549
1012
|
def.pattern ?? (def.pattern = duration$1);
|
|
550
1013
|
$ZodStringFormat.init(inst, def);
|
|
551
1014
|
});
|
|
552
|
-
const $ZodIPv4 = /* @__PURE__ */
|
|
1015
|
+
const $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
|
|
553
1016
|
def.pattern ?? (def.pattern = ipv4);
|
|
554
1017
|
$ZodStringFormat.init(inst, def);
|
|
555
1018
|
inst._zod.onattach.push((inst2) => {
|
|
@@ -557,7 +1020,7 @@ const $ZodIPv4 = /* @__PURE__ */ parse$1.$constructor("$ZodIPv4", (inst, def) =>
|
|
|
557
1020
|
bag.format = `ipv4`;
|
|
558
1021
|
});
|
|
559
1022
|
});
|
|
560
|
-
const $ZodIPv6 = /* @__PURE__ */
|
|
1023
|
+
const $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
|
|
561
1024
|
def.pattern ?? (def.pattern = ipv6);
|
|
562
1025
|
$ZodStringFormat.init(inst, def);
|
|
563
1026
|
inst._zod.onattach.push((inst2) => {
|
|
@@ -578,11 +1041,11 @@ const $ZodIPv6 = /* @__PURE__ */ parse$1.$constructor("$ZodIPv6", (inst, def) =>
|
|
|
578
1041
|
}
|
|
579
1042
|
};
|
|
580
1043
|
});
|
|
581
|
-
const $ZodCIDRv4 = /* @__PURE__ */
|
|
1044
|
+
const $ZodCIDRv4 = /* @__PURE__ */ $constructor("$ZodCIDRv4", (inst, def) => {
|
|
582
1045
|
def.pattern ?? (def.pattern = cidrv4);
|
|
583
1046
|
$ZodStringFormat.init(inst, def);
|
|
584
1047
|
});
|
|
585
|
-
const $ZodCIDRv6 = /* @__PURE__ */
|
|
1048
|
+
const $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
|
|
586
1049
|
def.pattern ?? (def.pattern = cidrv6);
|
|
587
1050
|
$ZodStringFormat.init(inst, def);
|
|
588
1051
|
inst._zod.check = (payload) => {
|
|
@@ -619,7 +1082,7 @@ function isValidBase64(data) {
|
|
|
619
1082
|
return false;
|
|
620
1083
|
}
|
|
621
1084
|
}
|
|
622
|
-
const $ZodBase64 = /* @__PURE__ */
|
|
1085
|
+
const $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
623
1086
|
def.pattern ?? (def.pattern = base64);
|
|
624
1087
|
$ZodStringFormat.init(inst, def);
|
|
625
1088
|
inst._zod.onattach.push((inst2) => {
|
|
@@ -644,7 +1107,7 @@ function isValidBase64URL(data) {
|
|
|
644
1107
|
const padded = base642.padEnd(Math.ceil(base642.length / 4) * 4, "=");
|
|
645
1108
|
return isValidBase64(padded);
|
|
646
1109
|
}
|
|
647
|
-
const $ZodBase64URL = /* @__PURE__ */
|
|
1110
|
+
const $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
|
|
648
1111
|
def.pattern ?? (def.pattern = base64url);
|
|
649
1112
|
$ZodStringFormat.init(inst, def);
|
|
650
1113
|
inst._zod.onattach.push((inst2) => {
|
|
@@ -662,7 +1125,7 @@ const $ZodBase64URL = /* @__PURE__ */ parse$1.$constructor("$ZodBase64URL", (ins
|
|
|
662
1125
|
});
|
|
663
1126
|
};
|
|
664
1127
|
});
|
|
665
|
-
const $ZodE164 = /* @__PURE__ */
|
|
1128
|
+
const $ZodE164 = /* @__PURE__ */ $constructor("$ZodE164", (inst, def) => {
|
|
666
1129
|
def.pattern ?? (def.pattern = e164);
|
|
667
1130
|
$ZodStringFormat.init(inst, def);
|
|
668
1131
|
});
|
|
@@ -686,7 +1149,7 @@ function isValidJWT(token, algorithm = null) {
|
|
|
686
1149
|
return false;
|
|
687
1150
|
}
|
|
688
1151
|
}
|
|
689
|
-
const $ZodJWT = /* @__PURE__ */
|
|
1152
|
+
const $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
|
|
690
1153
|
$ZodStringFormat.init(inst, def);
|
|
691
1154
|
inst._zod.check = (payload) => {
|
|
692
1155
|
if (isValidJWT(payload.value, def.alg))
|
|
@@ -700,11 +1163,11 @@ const $ZodJWT = /* @__PURE__ */ parse$1.$constructor("$ZodJWT", (inst, def) => {
|
|
|
700
1163
|
});
|
|
701
1164
|
};
|
|
702
1165
|
});
|
|
703
|
-
const $ZodUnknown = /* @__PURE__ */
|
|
1166
|
+
const $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
|
|
704
1167
|
$ZodType.init(inst, def);
|
|
705
1168
|
inst._zod.parse = (payload) => payload;
|
|
706
1169
|
});
|
|
707
|
-
const $ZodNever = /* @__PURE__ */
|
|
1170
|
+
const $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
|
|
708
1171
|
$ZodType.init(inst, def);
|
|
709
1172
|
inst._zod.parse = (payload, _ctx) => {
|
|
710
1173
|
payload.issues.push({
|
|
@@ -718,11 +1181,11 @@ const $ZodNever = /* @__PURE__ */ parse$1.$constructor("$ZodNever", (inst, def)
|
|
|
718
1181
|
});
|
|
719
1182
|
function handleArrayResult(result, final, index) {
|
|
720
1183
|
if (result.issues.length) {
|
|
721
|
-
final.issues.push(...
|
|
1184
|
+
final.issues.push(...prefixIssues(index, result.issues));
|
|
722
1185
|
}
|
|
723
1186
|
final.value[index] = result.value;
|
|
724
1187
|
}
|
|
725
|
-
const $ZodArray = /* @__PURE__ */
|
|
1188
|
+
const $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
726
1189
|
$ZodType.init(inst, def);
|
|
727
1190
|
inst._zod.parse = (payload, ctx) => {
|
|
728
1191
|
const input = payload.value;
|
|
@@ -757,7 +1220,7 @@ const $ZodArray = /* @__PURE__ */ parse$1.$constructor("$ZodArray", (inst, def)
|
|
|
757
1220
|
});
|
|
758
1221
|
function handleObjectResult(result, final, key) {
|
|
759
1222
|
if (result.issues.length) {
|
|
760
|
-
final.issues.push(...
|
|
1223
|
+
final.issues.push(...prefixIssues(key, result.issues));
|
|
761
1224
|
}
|
|
762
1225
|
final.value[key] = result.value;
|
|
763
1226
|
}
|
|
@@ -770,7 +1233,7 @@ function handleOptionalObjectResult(result, final, key, input) {
|
|
|
770
1233
|
final.value[key] = result.value;
|
|
771
1234
|
}
|
|
772
1235
|
} else {
|
|
773
|
-
final.issues.push(...
|
|
1236
|
+
final.issues.push(...prefixIssues(key, result.issues));
|
|
774
1237
|
}
|
|
775
1238
|
} else if (result.value === void 0) {
|
|
776
1239
|
if (key in input)
|
|
@@ -779,16 +1242,16 @@ function handleOptionalObjectResult(result, final, key, input) {
|
|
|
779
1242
|
final.value[key] = result.value;
|
|
780
1243
|
}
|
|
781
1244
|
}
|
|
782
|
-
const $ZodObject = /* @__PURE__ */
|
|
1245
|
+
const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
783
1246
|
$ZodType.init(inst, def);
|
|
784
|
-
const _normalized =
|
|
1247
|
+
const _normalized = cached(() => {
|
|
785
1248
|
const keys = Object.keys(def.shape);
|
|
786
1249
|
for (const k of keys) {
|
|
787
1250
|
if (!(def.shape[k] instanceof $ZodType)) {
|
|
788
1251
|
throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
|
|
789
1252
|
}
|
|
790
1253
|
}
|
|
791
|
-
const okeys =
|
|
1254
|
+
const okeys = optionalKeys(def.shape);
|
|
792
1255
|
return {
|
|
793
1256
|
shape: def.shape,
|
|
794
1257
|
keys,
|
|
@@ -797,7 +1260,7 @@ const $ZodObject = /* @__PURE__ */ parse$1.$constructor("$ZodObject", (inst, def
|
|
|
797
1260
|
optionalKeys: new Set(okeys)
|
|
798
1261
|
};
|
|
799
1262
|
});
|
|
800
|
-
|
|
1263
|
+
defineLazy(inst._zod, "propValues", () => {
|
|
801
1264
|
const shape = def.shape;
|
|
802
1265
|
const propValues = {};
|
|
803
1266
|
for (const key in shape) {
|
|
@@ -814,7 +1277,7 @@ const $ZodObject = /* @__PURE__ */ parse$1.$constructor("$ZodObject", (inst, def
|
|
|
814
1277
|
const doc = new Doc(["shape", "payload", "ctx"]);
|
|
815
1278
|
const normalized = _normalized.value;
|
|
816
1279
|
const parseStr = (key) => {
|
|
817
|
-
const k =
|
|
1280
|
+
const k = esc(key);
|
|
818
1281
|
return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
819
1282
|
};
|
|
820
1283
|
doc.write(`const input = payload.value;`);
|
|
@@ -828,7 +1291,7 @@ const $ZodObject = /* @__PURE__ */ parse$1.$constructor("$ZodObject", (inst, def
|
|
|
828
1291
|
if (normalized.optionalKeys.has(key)) {
|
|
829
1292
|
const id = ids[key];
|
|
830
1293
|
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
831
|
-
const k =
|
|
1294
|
+
const k = esc(key);
|
|
832
1295
|
doc.write(`
|
|
833
1296
|
if (${id}.issues.length) {
|
|
834
1297
|
if (input[${k}] === undefined) {
|
|
@@ -855,9 +1318,9 @@ const $ZodObject = /* @__PURE__ */ parse$1.$constructor("$ZodObject", (inst, def
|
|
|
855
1318
|
doc.write(`
|
|
856
1319
|
if (${id}.issues.length) payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
857
1320
|
...iss,
|
|
858
|
-
path: iss.path ? [${
|
|
1321
|
+
path: iss.path ? [${esc(key)}, ...iss.path] : [${esc(key)}]
|
|
859
1322
|
})));`);
|
|
860
|
-
doc.write(`newResult[${
|
|
1323
|
+
doc.write(`newResult[${esc(key)}] = ${id}.value`);
|
|
861
1324
|
}
|
|
862
1325
|
}
|
|
863
1326
|
doc.write(`payload.value = newResult;`);
|
|
@@ -866,16 +1329,16 @@ const $ZodObject = /* @__PURE__ */ parse$1.$constructor("$ZodObject", (inst, def
|
|
|
866
1329
|
return (payload, ctx) => fn(shape, payload, ctx);
|
|
867
1330
|
};
|
|
868
1331
|
let fastpass;
|
|
869
|
-
const isObject =
|
|
870
|
-
const jit = !
|
|
871
|
-
const allowsEval =
|
|
872
|
-
const fastEnabled = jit && allowsEval.value;
|
|
1332
|
+
const isObject$1 = isObject;
|
|
1333
|
+
const jit = !globalConfig.jitless;
|
|
1334
|
+
const allowsEval$1 = allowsEval;
|
|
1335
|
+
const fastEnabled = jit && allowsEval$1.value;
|
|
873
1336
|
const catchall = def.catchall;
|
|
874
1337
|
let value;
|
|
875
1338
|
inst._zod.parse = (payload, ctx) => {
|
|
876
1339
|
value ?? (value = _normalized.value);
|
|
877
1340
|
const input = payload.value;
|
|
878
|
-
if (!isObject(input)) {
|
|
1341
|
+
if (!isObject$1(input)) {
|
|
879
1342
|
payload.issues.push({
|
|
880
1343
|
expected: "object",
|
|
881
1344
|
code: "invalid_type",
|
|
@@ -952,24 +1415,24 @@ function handleUnionResults(results, final, inst, ctx) {
|
|
|
952
1415
|
code: "invalid_union",
|
|
953
1416
|
input: final.value,
|
|
954
1417
|
inst,
|
|
955
|
-
errors: results.map((result) => result.issues.map((iss) =>
|
|
1418
|
+
errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
956
1419
|
});
|
|
957
1420
|
return final;
|
|
958
1421
|
}
|
|
959
|
-
const $ZodUnion = /* @__PURE__ */
|
|
1422
|
+
const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
960
1423
|
$ZodType.init(inst, def);
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
1424
|
+
defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
|
|
1425
|
+
defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
|
|
1426
|
+
defineLazy(inst._zod, "values", () => {
|
|
964
1427
|
if (def.options.every((o) => o._zod.values)) {
|
|
965
1428
|
return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
966
1429
|
}
|
|
967
1430
|
return void 0;
|
|
968
1431
|
});
|
|
969
|
-
|
|
1432
|
+
defineLazy(inst._zod, "pattern", () => {
|
|
970
1433
|
if (def.options.every((o) => o._zod.pattern)) {
|
|
971
1434
|
const patterns = def.options.map((o) => o._zod.pattern);
|
|
972
|
-
return new RegExp(`^(${patterns.map((p) =>
|
|
1435
|
+
return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
|
|
973
1436
|
}
|
|
974
1437
|
return void 0;
|
|
975
1438
|
});
|
|
@@ -997,7 +1460,7 @@ const $ZodUnion = /* @__PURE__ */ parse$1.$constructor("$ZodUnion", (inst, def)
|
|
|
997
1460
|
});
|
|
998
1461
|
};
|
|
999
1462
|
});
|
|
1000
|
-
const $ZodIntersection = /* @__PURE__ */
|
|
1463
|
+
const $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
|
|
1001
1464
|
$ZodType.init(inst, def);
|
|
1002
1465
|
inst._zod.parse = (payload, ctx) => {
|
|
1003
1466
|
const input = payload.value;
|
|
@@ -1019,7 +1482,7 @@ function mergeValues(a, b) {
|
|
|
1019
1482
|
if (a instanceof Date && b instanceof Date && +a === +b) {
|
|
1020
1483
|
return { valid: true, data: a };
|
|
1021
1484
|
}
|
|
1022
|
-
if (
|
|
1485
|
+
if (isPlainObject(a) && isPlainObject(b)) {
|
|
1023
1486
|
const bKeys = Object.keys(b);
|
|
1024
1487
|
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
1025
1488
|
const newObj = { ...a, ...b };
|
|
@@ -1063,7 +1526,7 @@ function handleIntersectionResults(result, left, right) {
|
|
|
1063
1526
|
if (right.issues.length) {
|
|
1064
1527
|
result.issues.push(...right.issues);
|
|
1065
1528
|
}
|
|
1066
|
-
if (
|
|
1529
|
+
if (aborted(result))
|
|
1067
1530
|
return result;
|
|
1068
1531
|
const merged = mergeValues(left.value, right.value);
|
|
1069
1532
|
if (!merged.valid) {
|
|
@@ -1072,11 +1535,11 @@ function handleIntersectionResults(result, left, right) {
|
|
|
1072
1535
|
result.value = merged.data;
|
|
1073
1536
|
return result;
|
|
1074
1537
|
}
|
|
1075
|
-
const $ZodEnum = /* @__PURE__ */
|
|
1538
|
+
const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
1076
1539
|
$ZodType.init(inst, def);
|
|
1077
|
-
const values =
|
|
1540
|
+
const values = getEnumValues(def.entries);
|
|
1078
1541
|
inst._zod.values = new Set(values);
|
|
1079
|
-
inst._zod.pattern = new RegExp(`^(${values.filter((k) =>
|
|
1542
|
+
inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
|
|
1080
1543
|
inst._zod.parse = (payload, _ctx) => {
|
|
1081
1544
|
const input = payload.value;
|
|
1082
1545
|
if (inst._zod.values.has(input)) {
|
|
@@ -1091,7 +1554,7 @@ const $ZodEnum = /* @__PURE__ */ parse$1.$constructor("$ZodEnum", (inst, def) =>
|
|
|
1091
1554
|
return payload;
|
|
1092
1555
|
};
|
|
1093
1556
|
});
|
|
1094
|
-
const $ZodTransform = /* @__PURE__ */
|
|
1557
|
+
const $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
|
|
1095
1558
|
$ZodType.init(inst, def);
|
|
1096
1559
|
inst._zod.parse = (payload, _ctx) => {
|
|
1097
1560
|
const _out = def.transform(payload.value, payload);
|
|
@@ -1103,22 +1566,22 @@ const $ZodTransform = /* @__PURE__ */ parse$1.$constructor("$ZodTransform", (ins
|
|
|
1103
1566
|
});
|
|
1104
1567
|
}
|
|
1105
1568
|
if (_out instanceof Promise) {
|
|
1106
|
-
throw new
|
|
1569
|
+
throw new $ZodAsyncError();
|
|
1107
1570
|
}
|
|
1108
1571
|
payload.value = _out;
|
|
1109
1572
|
return payload;
|
|
1110
1573
|
};
|
|
1111
1574
|
});
|
|
1112
|
-
const $ZodOptional = /* @__PURE__ */
|
|
1575
|
+
const $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
|
|
1113
1576
|
$ZodType.init(inst, def);
|
|
1114
1577
|
inst._zod.optin = "optional";
|
|
1115
1578
|
inst._zod.optout = "optional";
|
|
1116
|
-
|
|
1579
|
+
defineLazy(inst._zod, "values", () => {
|
|
1117
1580
|
return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, void 0]) : void 0;
|
|
1118
1581
|
});
|
|
1119
|
-
|
|
1582
|
+
defineLazy(inst._zod, "pattern", () => {
|
|
1120
1583
|
const pattern = def.innerType._zod.pattern;
|
|
1121
|
-
return pattern ? new RegExp(`^(${
|
|
1584
|
+
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
|
|
1122
1585
|
});
|
|
1123
1586
|
inst._zod.parse = (payload, ctx) => {
|
|
1124
1587
|
if (def.innerType._zod.optin === "optional") {
|
|
@@ -1130,15 +1593,15 @@ const $ZodOptional = /* @__PURE__ */ parse$1.$constructor("$ZodOptional", (inst,
|
|
|
1130
1593
|
return def.innerType._zod.run(payload, ctx);
|
|
1131
1594
|
};
|
|
1132
1595
|
});
|
|
1133
|
-
const $ZodNullable = /* @__PURE__ */
|
|
1596
|
+
const $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
|
|
1134
1597
|
$ZodType.init(inst, def);
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1598
|
+
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
1599
|
+
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
1600
|
+
defineLazy(inst._zod, "pattern", () => {
|
|
1138
1601
|
const pattern = def.innerType._zod.pattern;
|
|
1139
|
-
return pattern ? new RegExp(`^(${
|
|
1602
|
+
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
|
|
1140
1603
|
});
|
|
1141
|
-
|
|
1604
|
+
defineLazy(inst._zod, "values", () => {
|
|
1142
1605
|
return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, null]) : void 0;
|
|
1143
1606
|
});
|
|
1144
1607
|
inst._zod.parse = (payload, ctx) => {
|
|
@@ -1147,10 +1610,10 @@ const $ZodNullable = /* @__PURE__ */ parse$1.$constructor("$ZodNullable", (inst,
|
|
|
1147
1610
|
return def.innerType._zod.run(payload, ctx);
|
|
1148
1611
|
};
|
|
1149
1612
|
});
|
|
1150
|
-
const $ZodDefault = /* @__PURE__ */
|
|
1613
|
+
const $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
|
|
1151
1614
|
$ZodType.init(inst, def);
|
|
1152
1615
|
inst._zod.optin = "optional";
|
|
1153
|
-
|
|
1616
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
1154
1617
|
inst._zod.parse = (payload, ctx) => {
|
|
1155
1618
|
if (payload.value === void 0) {
|
|
1156
1619
|
payload.value = def.defaultValue;
|
|
@@ -1169,10 +1632,10 @@ function handleDefaultResult(payload, def) {
|
|
|
1169
1632
|
}
|
|
1170
1633
|
return payload;
|
|
1171
1634
|
}
|
|
1172
|
-
const $ZodPrefault = /* @__PURE__ */
|
|
1635
|
+
const $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
|
|
1173
1636
|
$ZodType.init(inst, def);
|
|
1174
1637
|
inst._zod.optin = "optional";
|
|
1175
|
-
|
|
1638
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
1176
1639
|
inst._zod.parse = (payload, ctx) => {
|
|
1177
1640
|
if (payload.value === void 0) {
|
|
1178
1641
|
payload.value = def.defaultValue;
|
|
@@ -1180,9 +1643,9 @@ const $ZodPrefault = /* @__PURE__ */ parse$1.$constructor("$ZodPrefault", (inst,
|
|
|
1180
1643
|
return def.innerType._zod.run(payload, ctx);
|
|
1181
1644
|
};
|
|
1182
1645
|
});
|
|
1183
|
-
const $ZodNonOptional = /* @__PURE__ */
|
|
1646
|
+
const $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
|
|
1184
1647
|
$ZodType.init(inst, def);
|
|
1185
|
-
|
|
1648
|
+
defineLazy(inst._zod, "values", () => {
|
|
1186
1649
|
const v = def.innerType._zod.values;
|
|
1187
1650
|
return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
|
|
1188
1651
|
});
|
|
@@ -1205,11 +1668,11 @@ function handleNonOptionalResult(payload, inst) {
|
|
|
1205
1668
|
}
|
|
1206
1669
|
return payload;
|
|
1207
1670
|
}
|
|
1208
|
-
const $ZodCatch = /* @__PURE__ */
|
|
1671
|
+
const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
1209
1672
|
$ZodType.init(inst, def);
|
|
1210
1673
|
inst._zod.optin = "optional";
|
|
1211
|
-
|
|
1212
|
-
|
|
1674
|
+
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
1675
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
1213
1676
|
inst._zod.parse = (payload, ctx) => {
|
|
1214
1677
|
const result = def.innerType._zod.run(payload, ctx);
|
|
1215
1678
|
if (result instanceof Promise) {
|
|
@@ -1219,7 +1682,7 @@ const $ZodCatch = /* @__PURE__ */ parse$1.$constructor("$ZodCatch", (inst, def)
|
|
|
1219
1682
|
payload.value = def.catchValue({
|
|
1220
1683
|
...payload,
|
|
1221
1684
|
error: {
|
|
1222
|
-
issues: result2.issues.map((iss) =>
|
|
1685
|
+
issues: result2.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
1223
1686
|
},
|
|
1224
1687
|
input: payload.value
|
|
1225
1688
|
});
|
|
@@ -1233,7 +1696,7 @@ const $ZodCatch = /* @__PURE__ */ parse$1.$constructor("$ZodCatch", (inst, def)
|
|
|
1233
1696
|
payload.value = def.catchValue({
|
|
1234
1697
|
...payload,
|
|
1235
1698
|
error: {
|
|
1236
|
-
issues: result.issues.map((iss) =>
|
|
1699
|
+
issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
1237
1700
|
},
|
|
1238
1701
|
input: payload.value
|
|
1239
1702
|
});
|
|
@@ -1242,11 +1705,11 @@ const $ZodCatch = /* @__PURE__ */ parse$1.$constructor("$ZodCatch", (inst, def)
|
|
|
1242
1705
|
return payload;
|
|
1243
1706
|
};
|
|
1244
1707
|
});
|
|
1245
|
-
const $ZodPipe = /* @__PURE__ */
|
|
1708
|
+
const $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
|
|
1246
1709
|
$ZodType.init(inst, def);
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1710
|
+
defineLazy(inst._zod, "values", () => def.in._zod.values);
|
|
1711
|
+
defineLazy(inst._zod, "optin", () => def.in._zod.optin);
|
|
1712
|
+
defineLazy(inst._zod, "optout", () => def.out._zod.optout);
|
|
1250
1713
|
inst._zod.parse = (payload, ctx) => {
|
|
1251
1714
|
const left = def.in._zod.run(payload, ctx);
|
|
1252
1715
|
if (left instanceof Promise) {
|
|
@@ -1256,17 +1719,17 @@ const $ZodPipe = /* @__PURE__ */ parse$1.$constructor("$ZodPipe", (inst, def) =>
|
|
|
1256
1719
|
};
|
|
1257
1720
|
});
|
|
1258
1721
|
function handlePipeResult(left, def, ctx) {
|
|
1259
|
-
if (
|
|
1722
|
+
if (aborted(left)) {
|
|
1260
1723
|
return left;
|
|
1261
1724
|
}
|
|
1262
1725
|
return def.out._zod.run({ value: left.value, issues: left.issues }, ctx);
|
|
1263
1726
|
}
|
|
1264
|
-
const $ZodReadonly = /* @__PURE__ */
|
|
1727
|
+
const $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
|
|
1265
1728
|
$ZodType.init(inst, def);
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1729
|
+
defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
|
|
1730
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
1731
|
+
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
1732
|
+
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
1270
1733
|
inst._zod.parse = (payload, ctx) => {
|
|
1271
1734
|
const result = def.innerType._zod.run(payload, ctx);
|
|
1272
1735
|
if (result instanceof Promise) {
|
|
@@ -1279,7 +1742,7 @@ function handleReadonlyResult(payload) {
|
|
|
1279
1742
|
payload.value = Object.freeze(payload.value);
|
|
1280
1743
|
return payload;
|
|
1281
1744
|
}
|
|
1282
|
-
const $ZodCustom = /* @__PURE__ */
|
|
1745
|
+
const $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
|
|
1283
1746
|
$ZodCheck.init(inst, def);
|
|
1284
1747
|
$ZodType.init(inst, def);
|
|
1285
1748
|
inst._zod.parse = (payload, _) => {
|
|
@@ -1309,7 +1772,7 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
1309
1772
|
};
|
|
1310
1773
|
if (inst._zod.def.params)
|
|
1311
1774
|
_iss.params = inst._zod.def.params;
|
|
1312
|
-
payload.issues.push(
|
|
1775
|
+
payload.issues.push(issue(_iss));
|
|
1313
1776
|
}
|
|
1314
1777
|
}
|
|
1315
1778
|
class $ZodRegistry {
|
|
@@ -1361,7 +1824,7 @@ const globalRegistry = /* @__PURE__ */ registry();
|
|
|
1361
1824
|
function _string(Class, params) {
|
|
1362
1825
|
return new Class({
|
|
1363
1826
|
type: "string",
|
|
1364
|
-
...
|
|
1827
|
+
...normalizeParams(params)
|
|
1365
1828
|
});
|
|
1366
1829
|
}
|
|
1367
1830
|
function _email(Class, params) {
|
|
@@ -1370,7 +1833,7 @@ function _email(Class, params) {
|
|
|
1370
1833
|
format: "email",
|
|
1371
1834
|
check: "string_format",
|
|
1372
1835
|
abort: false,
|
|
1373
|
-
...
|
|
1836
|
+
...normalizeParams(params)
|
|
1374
1837
|
});
|
|
1375
1838
|
}
|
|
1376
1839
|
function _guid(Class, params) {
|
|
@@ -1379,7 +1842,7 @@ function _guid(Class, params) {
|
|
|
1379
1842
|
format: "guid",
|
|
1380
1843
|
check: "string_format",
|
|
1381
1844
|
abort: false,
|
|
1382
|
-
...
|
|
1845
|
+
...normalizeParams(params)
|
|
1383
1846
|
});
|
|
1384
1847
|
}
|
|
1385
1848
|
function _uuid(Class, params) {
|
|
@@ -1388,7 +1851,7 @@ function _uuid(Class, params) {
|
|
|
1388
1851
|
format: "uuid",
|
|
1389
1852
|
check: "string_format",
|
|
1390
1853
|
abort: false,
|
|
1391
|
-
...
|
|
1854
|
+
...normalizeParams(params)
|
|
1392
1855
|
});
|
|
1393
1856
|
}
|
|
1394
1857
|
function _uuidv4(Class, params) {
|
|
@@ -1398,7 +1861,7 @@ function _uuidv4(Class, params) {
|
|
|
1398
1861
|
check: "string_format",
|
|
1399
1862
|
abort: false,
|
|
1400
1863
|
version: "v4",
|
|
1401
|
-
...
|
|
1864
|
+
...normalizeParams(params)
|
|
1402
1865
|
});
|
|
1403
1866
|
}
|
|
1404
1867
|
function _uuidv6(Class, params) {
|
|
@@ -1408,7 +1871,7 @@ function _uuidv6(Class, params) {
|
|
|
1408
1871
|
check: "string_format",
|
|
1409
1872
|
abort: false,
|
|
1410
1873
|
version: "v6",
|
|
1411
|
-
...
|
|
1874
|
+
...normalizeParams(params)
|
|
1412
1875
|
});
|
|
1413
1876
|
}
|
|
1414
1877
|
function _uuidv7(Class, params) {
|
|
@@ -1418,7 +1881,7 @@ function _uuidv7(Class, params) {
|
|
|
1418
1881
|
check: "string_format",
|
|
1419
1882
|
abort: false,
|
|
1420
1883
|
version: "v7",
|
|
1421
|
-
...
|
|
1884
|
+
...normalizeParams(params)
|
|
1422
1885
|
});
|
|
1423
1886
|
}
|
|
1424
1887
|
function _url(Class, params) {
|
|
@@ -1427,7 +1890,7 @@ function _url(Class, params) {
|
|
|
1427
1890
|
format: "url",
|
|
1428
1891
|
check: "string_format",
|
|
1429
1892
|
abort: false,
|
|
1430
|
-
...
|
|
1893
|
+
...normalizeParams(params)
|
|
1431
1894
|
});
|
|
1432
1895
|
}
|
|
1433
1896
|
function _emoji(Class, params) {
|
|
@@ -1436,7 +1899,7 @@ function _emoji(Class, params) {
|
|
|
1436
1899
|
format: "emoji",
|
|
1437
1900
|
check: "string_format",
|
|
1438
1901
|
abort: false,
|
|
1439
|
-
...
|
|
1902
|
+
...normalizeParams(params)
|
|
1440
1903
|
});
|
|
1441
1904
|
}
|
|
1442
1905
|
function _nanoid(Class, params) {
|
|
@@ -1445,7 +1908,7 @@ function _nanoid(Class, params) {
|
|
|
1445
1908
|
format: "nanoid",
|
|
1446
1909
|
check: "string_format",
|
|
1447
1910
|
abort: false,
|
|
1448
|
-
...
|
|
1911
|
+
...normalizeParams(params)
|
|
1449
1912
|
});
|
|
1450
1913
|
}
|
|
1451
1914
|
function _cuid(Class, params) {
|
|
@@ -1454,7 +1917,7 @@ function _cuid(Class, params) {
|
|
|
1454
1917
|
format: "cuid",
|
|
1455
1918
|
check: "string_format",
|
|
1456
1919
|
abort: false,
|
|
1457
|
-
...
|
|
1920
|
+
...normalizeParams(params)
|
|
1458
1921
|
});
|
|
1459
1922
|
}
|
|
1460
1923
|
function _cuid2(Class, params) {
|
|
@@ -1463,7 +1926,7 @@ function _cuid2(Class, params) {
|
|
|
1463
1926
|
format: "cuid2",
|
|
1464
1927
|
check: "string_format",
|
|
1465
1928
|
abort: false,
|
|
1466
|
-
...
|
|
1929
|
+
...normalizeParams(params)
|
|
1467
1930
|
});
|
|
1468
1931
|
}
|
|
1469
1932
|
function _ulid(Class, params) {
|
|
@@ -1472,7 +1935,7 @@ function _ulid(Class, params) {
|
|
|
1472
1935
|
format: "ulid",
|
|
1473
1936
|
check: "string_format",
|
|
1474
1937
|
abort: false,
|
|
1475
|
-
...
|
|
1938
|
+
...normalizeParams(params)
|
|
1476
1939
|
});
|
|
1477
1940
|
}
|
|
1478
1941
|
function _xid(Class, params) {
|
|
@@ -1481,7 +1944,7 @@ function _xid(Class, params) {
|
|
|
1481
1944
|
format: "xid",
|
|
1482
1945
|
check: "string_format",
|
|
1483
1946
|
abort: false,
|
|
1484
|
-
...
|
|
1947
|
+
...normalizeParams(params)
|
|
1485
1948
|
});
|
|
1486
1949
|
}
|
|
1487
1950
|
function _ksuid(Class, params) {
|
|
@@ -1490,7 +1953,7 @@ function _ksuid(Class, params) {
|
|
|
1490
1953
|
format: "ksuid",
|
|
1491
1954
|
check: "string_format",
|
|
1492
1955
|
abort: false,
|
|
1493
|
-
...
|
|
1956
|
+
...normalizeParams(params)
|
|
1494
1957
|
});
|
|
1495
1958
|
}
|
|
1496
1959
|
function _ipv4(Class, params) {
|
|
@@ -1499,7 +1962,7 @@ function _ipv4(Class, params) {
|
|
|
1499
1962
|
format: "ipv4",
|
|
1500
1963
|
check: "string_format",
|
|
1501
1964
|
abort: false,
|
|
1502
|
-
...
|
|
1965
|
+
...normalizeParams(params)
|
|
1503
1966
|
});
|
|
1504
1967
|
}
|
|
1505
1968
|
function _ipv6(Class, params) {
|
|
@@ -1508,7 +1971,7 @@ function _ipv6(Class, params) {
|
|
|
1508
1971
|
format: "ipv6",
|
|
1509
1972
|
check: "string_format",
|
|
1510
1973
|
abort: false,
|
|
1511
|
-
...
|
|
1974
|
+
...normalizeParams(params)
|
|
1512
1975
|
});
|
|
1513
1976
|
}
|
|
1514
1977
|
function _cidrv4(Class, params) {
|
|
@@ -1517,7 +1980,7 @@ function _cidrv4(Class, params) {
|
|
|
1517
1980
|
format: "cidrv4",
|
|
1518
1981
|
check: "string_format",
|
|
1519
1982
|
abort: false,
|
|
1520
|
-
...
|
|
1983
|
+
...normalizeParams(params)
|
|
1521
1984
|
});
|
|
1522
1985
|
}
|
|
1523
1986
|
function _cidrv6(Class, params) {
|
|
@@ -1526,7 +1989,7 @@ function _cidrv6(Class, params) {
|
|
|
1526
1989
|
format: "cidrv6",
|
|
1527
1990
|
check: "string_format",
|
|
1528
1991
|
abort: false,
|
|
1529
|
-
...
|
|
1992
|
+
...normalizeParams(params)
|
|
1530
1993
|
});
|
|
1531
1994
|
}
|
|
1532
1995
|
function _base64(Class, params) {
|
|
@@ -1535,7 +1998,7 @@ function _base64(Class, params) {
|
|
|
1535
1998
|
format: "base64",
|
|
1536
1999
|
check: "string_format",
|
|
1537
2000
|
abort: false,
|
|
1538
|
-
...
|
|
2001
|
+
...normalizeParams(params)
|
|
1539
2002
|
});
|
|
1540
2003
|
}
|
|
1541
2004
|
function _base64url(Class, params) {
|
|
@@ -1544,7 +2007,7 @@ function _base64url(Class, params) {
|
|
|
1544
2007
|
format: "base64url",
|
|
1545
2008
|
check: "string_format",
|
|
1546
2009
|
abort: false,
|
|
1547
|
-
...
|
|
2010
|
+
...normalizeParams(params)
|
|
1548
2011
|
});
|
|
1549
2012
|
}
|
|
1550
2013
|
function _e164(Class, params) {
|
|
@@ -1553,7 +2016,7 @@ function _e164(Class, params) {
|
|
|
1553
2016
|
format: "e164",
|
|
1554
2017
|
check: "string_format",
|
|
1555
2018
|
abort: false,
|
|
1556
|
-
...
|
|
2019
|
+
...normalizeParams(params)
|
|
1557
2020
|
});
|
|
1558
2021
|
}
|
|
1559
2022
|
function _jwt(Class, params) {
|
|
@@ -1562,7 +2025,7 @@ function _jwt(Class, params) {
|
|
|
1562
2025
|
format: "jwt",
|
|
1563
2026
|
check: "string_format",
|
|
1564
2027
|
abort: false,
|
|
1565
|
-
...
|
|
2028
|
+
...normalizeParams(params)
|
|
1566
2029
|
});
|
|
1567
2030
|
}
|
|
1568
2031
|
function _isoDateTime(Class, params) {
|
|
@@ -1573,7 +2036,7 @@ function _isoDateTime(Class, params) {
|
|
|
1573
2036
|
offset: false,
|
|
1574
2037
|
local: false,
|
|
1575
2038
|
precision: null,
|
|
1576
|
-
...
|
|
2039
|
+
...normalizeParams(params)
|
|
1577
2040
|
});
|
|
1578
2041
|
}
|
|
1579
2042
|
function _isoDate(Class, params) {
|
|
@@ -1581,7 +2044,7 @@ function _isoDate(Class, params) {
|
|
|
1581
2044
|
type: "string",
|
|
1582
2045
|
format: "date",
|
|
1583
2046
|
check: "string_format",
|
|
1584
|
-
...
|
|
2047
|
+
...normalizeParams(params)
|
|
1585
2048
|
});
|
|
1586
2049
|
}
|
|
1587
2050
|
function _isoTime(Class, params) {
|
|
@@ -1590,7 +2053,7 @@ function _isoTime(Class, params) {
|
|
|
1590
2053
|
format: "time",
|
|
1591
2054
|
check: "string_format",
|
|
1592
2055
|
precision: null,
|
|
1593
|
-
...
|
|
2056
|
+
...normalizeParams(params)
|
|
1594
2057
|
});
|
|
1595
2058
|
}
|
|
1596
2059
|
function _isoDuration(Class, params) {
|
|
@@ -1598,7 +2061,7 @@ function _isoDuration(Class, params) {
|
|
|
1598
2061
|
type: "string",
|
|
1599
2062
|
format: "duration",
|
|
1600
2063
|
check: "string_format",
|
|
1601
|
-
...
|
|
2064
|
+
...normalizeParams(params)
|
|
1602
2065
|
});
|
|
1603
2066
|
}
|
|
1604
2067
|
function _unknown(Class) {
|
|
@@ -1609,13 +2072,13 @@ function _unknown(Class) {
|
|
|
1609
2072
|
function _never(Class, params) {
|
|
1610
2073
|
return new Class({
|
|
1611
2074
|
type: "never",
|
|
1612
|
-
...
|
|
2075
|
+
...normalizeParams(params)
|
|
1613
2076
|
});
|
|
1614
2077
|
}
|
|
1615
2078
|
function _maxLength(maximum, params) {
|
|
1616
2079
|
const ch = new $ZodCheckMaxLength({
|
|
1617
2080
|
check: "max_length",
|
|
1618
|
-
...
|
|
2081
|
+
...normalizeParams(params),
|
|
1619
2082
|
maximum
|
|
1620
2083
|
});
|
|
1621
2084
|
return ch;
|
|
@@ -1623,14 +2086,14 @@ function _maxLength(maximum, params) {
|
|
|
1623
2086
|
function _minLength(minimum, params) {
|
|
1624
2087
|
return new $ZodCheckMinLength({
|
|
1625
2088
|
check: "min_length",
|
|
1626
|
-
...
|
|
2089
|
+
...normalizeParams(params),
|
|
1627
2090
|
minimum
|
|
1628
2091
|
});
|
|
1629
2092
|
}
|
|
1630
2093
|
function _length(length, params) {
|
|
1631
2094
|
return new $ZodCheckLengthEquals({
|
|
1632
2095
|
check: "length_equals",
|
|
1633
|
-
...
|
|
2096
|
+
...normalizeParams(params),
|
|
1634
2097
|
length
|
|
1635
2098
|
});
|
|
1636
2099
|
}
|
|
@@ -1638,7 +2101,7 @@ function _regex(pattern, params) {
|
|
|
1638
2101
|
return new $ZodCheckRegex({
|
|
1639
2102
|
check: "string_format",
|
|
1640
2103
|
format: "regex",
|
|
1641
|
-
...
|
|
2104
|
+
...normalizeParams(params),
|
|
1642
2105
|
pattern
|
|
1643
2106
|
});
|
|
1644
2107
|
}
|
|
@@ -1646,21 +2109,21 @@ function _lowercase(params) {
|
|
|
1646
2109
|
return new $ZodCheckLowerCase({
|
|
1647
2110
|
check: "string_format",
|
|
1648
2111
|
format: "lowercase",
|
|
1649
|
-
...
|
|
2112
|
+
...normalizeParams(params)
|
|
1650
2113
|
});
|
|
1651
2114
|
}
|
|
1652
2115
|
function _uppercase(params) {
|
|
1653
2116
|
return new $ZodCheckUpperCase({
|
|
1654
2117
|
check: "string_format",
|
|
1655
2118
|
format: "uppercase",
|
|
1656
|
-
...
|
|
2119
|
+
...normalizeParams(params)
|
|
1657
2120
|
});
|
|
1658
2121
|
}
|
|
1659
2122
|
function _includes(includes, params) {
|
|
1660
2123
|
return new $ZodCheckIncludes({
|
|
1661
2124
|
check: "string_format",
|
|
1662
2125
|
format: "includes",
|
|
1663
|
-
...
|
|
2126
|
+
...normalizeParams(params),
|
|
1664
2127
|
includes
|
|
1665
2128
|
});
|
|
1666
2129
|
}
|
|
@@ -1668,7 +2131,7 @@ function _startsWith(prefix, params) {
|
|
|
1668
2131
|
return new $ZodCheckStartsWith({
|
|
1669
2132
|
check: "string_format",
|
|
1670
2133
|
format: "starts_with",
|
|
1671
|
-
...
|
|
2134
|
+
...normalizeParams(params),
|
|
1672
2135
|
prefix
|
|
1673
2136
|
});
|
|
1674
2137
|
}
|
|
@@ -1676,7 +2139,7 @@ function _endsWith(suffix, params) {
|
|
|
1676
2139
|
return new $ZodCheckEndsWith({
|
|
1677
2140
|
check: "string_format",
|
|
1678
2141
|
format: "ends_with",
|
|
1679
|
-
...
|
|
2142
|
+
...normalizeParams(params),
|
|
1680
2143
|
suffix
|
|
1681
2144
|
});
|
|
1682
2145
|
}
|
|
@@ -1705,7 +2168,7 @@ function _array(Class, element, params) {
|
|
|
1705
2168
|
// get element() {
|
|
1706
2169
|
// return element;
|
|
1707
2170
|
// },
|
|
1708
|
-
...
|
|
2171
|
+
...normalizeParams(params)
|
|
1709
2172
|
});
|
|
1710
2173
|
}
|
|
1711
2174
|
function _refine(Class, fn, _params) {
|
|
@@ -1713,32 +2176,32 @@ function _refine(Class, fn, _params) {
|
|
|
1713
2176
|
type: "custom",
|
|
1714
2177
|
check: "custom",
|
|
1715
2178
|
fn,
|
|
1716
|
-
...
|
|
2179
|
+
...normalizeParams(_params)
|
|
1717
2180
|
});
|
|
1718
2181
|
return schema;
|
|
1719
2182
|
}
|
|
1720
|
-
const ZodISODateTime = /* @__PURE__ */
|
|
2183
|
+
const ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
|
|
1721
2184
|
$ZodISODateTime.init(inst, def);
|
|
1722
2185
|
ZodStringFormat.init(inst, def);
|
|
1723
2186
|
});
|
|
1724
2187
|
function datetime(params) {
|
|
1725
2188
|
return _isoDateTime(ZodISODateTime, params);
|
|
1726
2189
|
}
|
|
1727
|
-
const ZodISODate = /* @__PURE__ */
|
|
2190
|
+
const ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => {
|
|
1728
2191
|
$ZodISODate.init(inst, def);
|
|
1729
2192
|
ZodStringFormat.init(inst, def);
|
|
1730
2193
|
});
|
|
1731
2194
|
function date(params) {
|
|
1732
2195
|
return _isoDate(ZodISODate, params);
|
|
1733
2196
|
}
|
|
1734
|
-
const ZodISOTime = /* @__PURE__ */
|
|
2197
|
+
const ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => {
|
|
1735
2198
|
$ZodISOTime.init(inst, def);
|
|
1736
2199
|
ZodStringFormat.init(inst, def);
|
|
1737
2200
|
});
|
|
1738
2201
|
function time(params) {
|
|
1739
2202
|
return _isoTime(ZodISOTime, params);
|
|
1740
2203
|
}
|
|
1741
|
-
const ZodISODuration = /* @__PURE__ */
|
|
2204
|
+
const ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def) => {
|
|
1742
2205
|
$ZodISODuration.init(inst, def);
|
|
1743
2206
|
ZodStringFormat.init(inst, def);
|
|
1744
2207
|
});
|
|
@@ -1746,19 +2209,19 @@ function duration(params) {
|
|
|
1746
2209
|
return _isoDuration(ZodISODuration, params);
|
|
1747
2210
|
}
|
|
1748
2211
|
const initializer = (inst, issues) => {
|
|
1749
|
-
|
|
2212
|
+
$ZodError.init(inst, issues);
|
|
1750
2213
|
inst.name = "ZodError";
|
|
1751
2214
|
Object.defineProperties(inst, {
|
|
1752
2215
|
format: {
|
|
1753
|
-
value: (mapper) =>
|
|
2216
|
+
value: (mapper) => formatError(inst, mapper)
|
|
1754
2217
|
// enumerable: false,
|
|
1755
2218
|
},
|
|
1756
2219
|
flatten: {
|
|
1757
|
-
value: (mapper) =>
|
|
2220
|
+
value: (mapper) => flattenError(inst, mapper)
|
|
1758
2221
|
// enumerable: false,
|
|
1759
2222
|
},
|
|
1760
2223
|
addIssue: {
|
|
1761
|
-
value: (
|
|
2224
|
+
value: (issue2) => inst.issues.push(issue2)
|
|
1762
2225
|
// enumerable: false,
|
|
1763
2226
|
},
|
|
1764
2227
|
addIssues: {
|
|
@@ -1773,14 +2236,14 @@ const initializer = (inst, issues) => {
|
|
|
1773
2236
|
}
|
|
1774
2237
|
});
|
|
1775
2238
|
};
|
|
1776
|
-
const ZodRealError =
|
|
2239
|
+
const ZodRealError = $constructor("ZodError", initializer, {
|
|
1777
2240
|
Parent: Error
|
|
1778
2241
|
});
|
|
1779
|
-
const parse = /* @__PURE__ */
|
|
1780
|
-
const parseAsync = /* @__PURE__ */
|
|
1781
|
-
const safeParse = /* @__PURE__ */
|
|
1782
|
-
const safeParseAsync = /* @__PURE__ */
|
|
1783
|
-
const ZodType = /* @__PURE__ */
|
|
2242
|
+
const parse = /* @__PURE__ */ _parse(ZodRealError);
|
|
2243
|
+
const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
2244
|
+
const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
2245
|
+
const safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError);
|
|
2246
|
+
const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
1784
2247
|
$ZodType.init(inst, def);
|
|
1785
2248
|
inst.def = def;
|
|
1786
2249
|
Object.defineProperty(inst, "_def", { value: def });
|
|
@@ -1796,7 +2259,7 @@ const ZodType = /* @__PURE__ */ parse$1.$constructor("ZodType", (inst, def) => {
|
|
|
1796
2259
|
// { parent: true }
|
|
1797
2260
|
);
|
|
1798
2261
|
};
|
|
1799
|
-
inst.clone = (def2, params) =>
|
|
2262
|
+
inst.clone = (def2, params) => clone(inst, def2, params);
|
|
1800
2263
|
inst.brand = () => inst;
|
|
1801
2264
|
inst.register = ((reg, meta) => {
|
|
1802
2265
|
reg.add(inst, meta);
|
|
@@ -1846,7 +2309,7 @@ const ZodType = /* @__PURE__ */ parse$1.$constructor("ZodType", (inst, def) => {
|
|
|
1846
2309
|
inst.isNullable = () => inst.safeParse(null).success;
|
|
1847
2310
|
return inst;
|
|
1848
2311
|
});
|
|
1849
|
-
const _ZodString = /* @__PURE__ */
|
|
2312
|
+
const _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
|
|
1850
2313
|
$ZodString.init(inst, def);
|
|
1851
2314
|
ZodType.init(inst, def);
|
|
1852
2315
|
const bag = inst._zod.bag;
|
|
@@ -1868,7 +2331,7 @@ const _ZodString = /* @__PURE__ */ parse$1.$constructor("_ZodString", (inst, def
|
|
|
1868
2331
|
inst.toLowerCase = () => inst.check(_toLowerCase());
|
|
1869
2332
|
inst.toUpperCase = () => inst.check(_toUpperCase());
|
|
1870
2333
|
});
|
|
1871
|
-
const ZodString = /* @__PURE__ */
|
|
2334
|
+
const ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
|
|
1872
2335
|
$ZodString.init(inst, def);
|
|
1873
2336
|
_ZodString.init(inst, def);
|
|
1874
2337
|
inst.email = (params) => inst.check(_email(ZodEmail, params));
|
|
@@ -1902,101 +2365,101 @@ const ZodString = /* @__PURE__ */ parse$1.$constructor("ZodString", (inst, def)
|
|
|
1902
2365
|
function string(params) {
|
|
1903
2366
|
return _string(ZodString, params);
|
|
1904
2367
|
}
|
|
1905
|
-
const ZodStringFormat = /* @__PURE__ */
|
|
2368
|
+
const ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (inst, def) => {
|
|
1906
2369
|
$ZodStringFormat.init(inst, def);
|
|
1907
2370
|
_ZodString.init(inst, def);
|
|
1908
2371
|
});
|
|
1909
|
-
const ZodEmail = /* @__PURE__ */
|
|
2372
|
+
const ZodEmail = /* @__PURE__ */ $constructor("ZodEmail", (inst, def) => {
|
|
1910
2373
|
$ZodEmail.init(inst, def);
|
|
1911
2374
|
ZodStringFormat.init(inst, def);
|
|
1912
2375
|
});
|
|
1913
|
-
const ZodGUID = /* @__PURE__ */
|
|
2376
|
+
const ZodGUID = /* @__PURE__ */ $constructor("ZodGUID", (inst, def) => {
|
|
1914
2377
|
$ZodGUID.init(inst, def);
|
|
1915
2378
|
ZodStringFormat.init(inst, def);
|
|
1916
2379
|
});
|
|
1917
|
-
const ZodUUID = /* @__PURE__ */
|
|
2380
|
+
const ZodUUID = /* @__PURE__ */ $constructor("ZodUUID", (inst, def) => {
|
|
1918
2381
|
$ZodUUID.init(inst, def);
|
|
1919
2382
|
ZodStringFormat.init(inst, def);
|
|
1920
2383
|
});
|
|
1921
|
-
const ZodURL = /* @__PURE__ */
|
|
2384
|
+
const ZodURL = /* @__PURE__ */ $constructor("ZodURL", (inst, def) => {
|
|
1922
2385
|
$ZodURL.init(inst, def);
|
|
1923
2386
|
ZodStringFormat.init(inst, def);
|
|
1924
2387
|
});
|
|
1925
|
-
const ZodEmoji = /* @__PURE__ */
|
|
2388
|
+
const ZodEmoji = /* @__PURE__ */ $constructor("ZodEmoji", (inst, def) => {
|
|
1926
2389
|
$ZodEmoji.init(inst, def);
|
|
1927
2390
|
ZodStringFormat.init(inst, def);
|
|
1928
2391
|
});
|
|
1929
|
-
const ZodNanoID = /* @__PURE__ */
|
|
2392
|
+
const ZodNanoID = /* @__PURE__ */ $constructor("ZodNanoID", (inst, def) => {
|
|
1930
2393
|
$ZodNanoID.init(inst, def);
|
|
1931
2394
|
ZodStringFormat.init(inst, def);
|
|
1932
2395
|
});
|
|
1933
|
-
const ZodCUID = /* @__PURE__ */
|
|
2396
|
+
const ZodCUID = /* @__PURE__ */ $constructor("ZodCUID", (inst, def) => {
|
|
1934
2397
|
$ZodCUID.init(inst, def);
|
|
1935
2398
|
ZodStringFormat.init(inst, def);
|
|
1936
2399
|
});
|
|
1937
|
-
const ZodCUID2 = /* @__PURE__ */
|
|
2400
|
+
const ZodCUID2 = /* @__PURE__ */ $constructor("ZodCUID2", (inst, def) => {
|
|
1938
2401
|
$ZodCUID2.init(inst, def);
|
|
1939
2402
|
ZodStringFormat.init(inst, def);
|
|
1940
2403
|
});
|
|
1941
|
-
const ZodULID = /* @__PURE__ */
|
|
2404
|
+
const ZodULID = /* @__PURE__ */ $constructor("ZodULID", (inst, def) => {
|
|
1942
2405
|
$ZodULID.init(inst, def);
|
|
1943
2406
|
ZodStringFormat.init(inst, def);
|
|
1944
2407
|
});
|
|
1945
|
-
const ZodXID = /* @__PURE__ */
|
|
2408
|
+
const ZodXID = /* @__PURE__ */ $constructor("ZodXID", (inst, def) => {
|
|
1946
2409
|
$ZodXID.init(inst, def);
|
|
1947
2410
|
ZodStringFormat.init(inst, def);
|
|
1948
2411
|
});
|
|
1949
|
-
const ZodKSUID = /* @__PURE__ */
|
|
2412
|
+
const ZodKSUID = /* @__PURE__ */ $constructor("ZodKSUID", (inst, def) => {
|
|
1950
2413
|
$ZodKSUID.init(inst, def);
|
|
1951
2414
|
ZodStringFormat.init(inst, def);
|
|
1952
2415
|
});
|
|
1953
|
-
const ZodIPv4 = /* @__PURE__ */
|
|
2416
|
+
const ZodIPv4 = /* @__PURE__ */ $constructor("ZodIPv4", (inst, def) => {
|
|
1954
2417
|
$ZodIPv4.init(inst, def);
|
|
1955
2418
|
ZodStringFormat.init(inst, def);
|
|
1956
2419
|
});
|
|
1957
|
-
const ZodIPv6 = /* @__PURE__ */
|
|
2420
|
+
const ZodIPv6 = /* @__PURE__ */ $constructor("ZodIPv6", (inst, def) => {
|
|
1958
2421
|
$ZodIPv6.init(inst, def);
|
|
1959
2422
|
ZodStringFormat.init(inst, def);
|
|
1960
2423
|
});
|
|
1961
|
-
const ZodCIDRv4 = /* @__PURE__ */
|
|
2424
|
+
const ZodCIDRv4 = /* @__PURE__ */ $constructor("ZodCIDRv4", (inst, def) => {
|
|
1962
2425
|
$ZodCIDRv4.init(inst, def);
|
|
1963
2426
|
ZodStringFormat.init(inst, def);
|
|
1964
2427
|
});
|
|
1965
|
-
const ZodCIDRv6 = /* @__PURE__ */
|
|
2428
|
+
const ZodCIDRv6 = /* @__PURE__ */ $constructor("ZodCIDRv6", (inst, def) => {
|
|
1966
2429
|
$ZodCIDRv6.init(inst, def);
|
|
1967
2430
|
ZodStringFormat.init(inst, def);
|
|
1968
2431
|
});
|
|
1969
|
-
const ZodBase64 = /* @__PURE__ */
|
|
2432
|
+
const ZodBase64 = /* @__PURE__ */ $constructor("ZodBase64", (inst, def) => {
|
|
1970
2433
|
$ZodBase64.init(inst, def);
|
|
1971
2434
|
ZodStringFormat.init(inst, def);
|
|
1972
2435
|
});
|
|
1973
|
-
const ZodBase64URL = /* @__PURE__ */
|
|
2436
|
+
const ZodBase64URL = /* @__PURE__ */ $constructor("ZodBase64URL", (inst, def) => {
|
|
1974
2437
|
$ZodBase64URL.init(inst, def);
|
|
1975
2438
|
ZodStringFormat.init(inst, def);
|
|
1976
2439
|
});
|
|
1977
|
-
const ZodE164 = /* @__PURE__ */
|
|
2440
|
+
const ZodE164 = /* @__PURE__ */ $constructor("ZodE164", (inst, def) => {
|
|
1978
2441
|
$ZodE164.init(inst, def);
|
|
1979
2442
|
ZodStringFormat.init(inst, def);
|
|
1980
2443
|
});
|
|
1981
|
-
const ZodJWT = /* @__PURE__ */
|
|
2444
|
+
const ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
|
|
1982
2445
|
$ZodJWT.init(inst, def);
|
|
1983
2446
|
ZodStringFormat.init(inst, def);
|
|
1984
2447
|
});
|
|
1985
|
-
const ZodUnknown = /* @__PURE__ */
|
|
2448
|
+
const ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
1986
2449
|
$ZodUnknown.init(inst, def);
|
|
1987
2450
|
ZodType.init(inst, def);
|
|
1988
2451
|
});
|
|
1989
2452
|
function unknown() {
|
|
1990
2453
|
return _unknown(ZodUnknown);
|
|
1991
2454
|
}
|
|
1992
|
-
const ZodNever = /* @__PURE__ */
|
|
2455
|
+
const ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
|
|
1993
2456
|
$ZodNever.init(inst, def);
|
|
1994
2457
|
ZodType.init(inst, def);
|
|
1995
2458
|
});
|
|
1996
2459
|
function never(params) {
|
|
1997
2460
|
return _never(ZodNever, params);
|
|
1998
2461
|
}
|
|
1999
|
-
const ZodArray = /* @__PURE__ */
|
|
2462
|
+
const ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
|
|
2000
2463
|
$ZodArray.init(inst, def);
|
|
2001
2464
|
ZodType.init(inst, def);
|
|
2002
2465
|
inst.element = def.element;
|
|
@@ -2009,10 +2472,10 @@ const ZodArray = /* @__PURE__ */ parse$1.$constructor("ZodArray", (inst, def) =>
|
|
|
2009
2472
|
function array(element, params) {
|
|
2010
2473
|
return _array(ZodArray, element, params);
|
|
2011
2474
|
}
|
|
2012
|
-
const ZodObject = /* @__PURE__ */
|
|
2475
|
+
const ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
2013
2476
|
$ZodObject.init(inst, def);
|
|
2014
2477
|
ZodType.init(inst, def);
|
|
2015
|
-
|
|
2478
|
+
defineLazy(inst, "shape", () => def.shape);
|
|
2016
2479
|
inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
|
|
2017
2480
|
inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall });
|
|
2018
2481
|
inst.passthrough = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
|
|
@@ -2020,26 +2483,26 @@ const ZodObject = /* @__PURE__ */ parse$1.$constructor("ZodObject", (inst, def)
|
|
|
2020
2483
|
inst.strict = () => inst.clone({ ...inst._zod.def, catchall: never() });
|
|
2021
2484
|
inst.strip = () => inst.clone({ ...inst._zod.def, catchall: void 0 });
|
|
2022
2485
|
inst.extend = (incoming) => {
|
|
2023
|
-
return
|
|
2486
|
+
return extend(inst, incoming);
|
|
2024
2487
|
};
|
|
2025
|
-
inst.merge = (other) =>
|
|
2026
|
-
inst.pick = (mask) =>
|
|
2027
|
-
inst.omit = (mask) =>
|
|
2028
|
-
inst.partial = (...args) =>
|
|
2029
|
-
inst.required = (...args) =>
|
|
2488
|
+
inst.merge = (other) => merge(inst, other);
|
|
2489
|
+
inst.pick = (mask) => pick(inst, mask);
|
|
2490
|
+
inst.omit = (mask) => omit(inst, mask);
|
|
2491
|
+
inst.partial = (...args) => partial(ZodOptional, inst, args[0]);
|
|
2492
|
+
inst.required = (...args) => required(ZodNonOptional, inst, args[0]);
|
|
2030
2493
|
});
|
|
2031
2494
|
function object(shape, params) {
|
|
2032
2495
|
const def = {
|
|
2033
2496
|
type: "object",
|
|
2034
2497
|
get shape() {
|
|
2035
|
-
|
|
2498
|
+
assignProp(this, "shape", { ...shape });
|
|
2036
2499
|
return this.shape;
|
|
2037
2500
|
},
|
|
2038
|
-
...
|
|
2501
|
+
...normalizeParams(params)
|
|
2039
2502
|
};
|
|
2040
2503
|
return new ZodObject(def);
|
|
2041
2504
|
}
|
|
2042
|
-
const ZodUnion = /* @__PURE__ */
|
|
2505
|
+
const ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
|
|
2043
2506
|
$ZodUnion.init(inst, def);
|
|
2044
2507
|
ZodType.init(inst, def);
|
|
2045
2508
|
inst.options = def.options;
|
|
@@ -2048,10 +2511,10 @@ function union(options, params) {
|
|
|
2048
2511
|
return new ZodUnion({
|
|
2049
2512
|
type: "union",
|
|
2050
2513
|
options,
|
|
2051
|
-
...
|
|
2514
|
+
...normalizeParams(params)
|
|
2052
2515
|
});
|
|
2053
2516
|
}
|
|
2054
|
-
const ZodIntersection = /* @__PURE__ */
|
|
2517
|
+
const ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
|
|
2055
2518
|
$ZodIntersection.init(inst, def);
|
|
2056
2519
|
ZodType.init(inst, def);
|
|
2057
2520
|
});
|
|
@@ -2062,7 +2525,7 @@ function intersection(left, right) {
|
|
|
2062
2525
|
right
|
|
2063
2526
|
});
|
|
2064
2527
|
}
|
|
2065
|
-
const ZodEnum = /* @__PURE__ */
|
|
2528
|
+
const ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
2066
2529
|
$ZodEnum.init(inst, def);
|
|
2067
2530
|
ZodType.init(inst, def);
|
|
2068
2531
|
inst.enum = def.entries;
|
|
@@ -2079,7 +2542,7 @@ const ZodEnum = /* @__PURE__ */ parse$1.$constructor("ZodEnum", (inst, def) => {
|
|
|
2079
2542
|
return new ZodEnum({
|
|
2080
2543
|
...def,
|
|
2081
2544
|
checks: [],
|
|
2082
|
-
...
|
|
2545
|
+
...normalizeParams(params),
|
|
2083
2546
|
entries: newEntries
|
|
2084
2547
|
});
|
|
2085
2548
|
};
|
|
@@ -2094,7 +2557,7 @@ const ZodEnum = /* @__PURE__ */ parse$1.$constructor("ZodEnum", (inst, def) => {
|
|
|
2094
2557
|
return new ZodEnum({
|
|
2095
2558
|
...def,
|
|
2096
2559
|
checks: [],
|
|
2097
|
-
...
|
|
2560
|
+
...normalizeParams(params),
|
|
2098
2561
|
entries: newEntries
|
|
2099
2562
|
});
|
|
2100
2563
|
};
|
|
@@ -2104,25 +2567,25 @@ function _enum(values, params) {
|
|
|
2104
2567
|
return new ZodEnum({
|
|
2105
2568
|
type: "enum",
|
|
2106
2569
|
entries,
|
|
2107
|
-
...
|
|
2570
|
+
...normalizeParams(params)
|
|
2108
2571
|
});
|
|
2109
2572
|
}
|
|
2110
|
-
const ZodTransform = /* @__PURE__ */
|
|
2573
|
+
const ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
2111
2574
|
$ZodTransform.init(inst, def);
|
|
2112
2575
|
ZodType.init(inst, def);
|
|
2113
2576
|
inst._zod.parse = (payload, _ctx) => {
|
|
2114
|
-
payload.addIssue = (issue) => {
|
|
2115
|
-
if (typeof issue === "string") {
|
|
2116
|
-
payload.issues.push(
|
|
2577
|
+
payload.addIssue = (issue$1) => {
|
|
2578
|
+
if (typeof issue$1 === "string") {
|
|
2579
|
+
payload.issues.push(issue(issue$1, payload.value, def));
|
|
2117
2580
|
} else {
|
|
2118
|
-
const _issue = issue;
|
|
2581
|
+
const _issue = issue$1;
|
|
2119
2582
|
if (_issue.fatal)
|
|
2120
2583
|
_issue.continue = false;
|
|
2121
2584
|
_issue.code ?? (_issue.code = "custom");
|
|
2122
2585
|
_issue.input ?? (_issue.input = payload.value);
|
|
2123
2586
|
_issue.inst ?? (_issue.inst = inst);
|
|
2124
2587
|
_issue.continue ?? (_issue.continue = true);
|
|
2125
|
-
payload.issues.push(
|
|
2588
|
+
payload.issues.push(issue(_issue));
|
|
2126
2589
|
}
|
|
2127
2590
|
};
|
|
2128
2591
|
const output = def.transform(payload.value, payload);
|
|
@@ -2142,7 +2605,7 @@ function transform(fn) {
|
|
|
2142
2605
|
transform: fn
|
|
2143
2606
|
});
|
|
2144
2607
|
}
|
|
2145
|
-
const ZodOptional = /* @__PURE__ */
|
|
2608
|
+
const ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
|
|
2146
2609
|
$ZodOptional.init(inst, def);
|
|
2147
2610
|
ZodType.init(inst, def);
|
|
2148
2611
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
@@ -2153,7 +2616,7 @@ function optional(innerType) {
|
|
|
2153
2616
|
innerType
|
|
2154
2617
|
});
|
|
2155
2618
|
}
|
|
2156
|
-
const ZodNullable = /* @__PURE__ */
|
|
2619
|
+
const ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
|
|
2157
2620
|
$ZodNullable.init(inst, def);
|
|
2158
2621
|
ZodType.init(inst, def);
|
|
2159
2622
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
@@ -2164,7 +2627,7 @@ function nullable(innerType) {
|
|
|
2164
2627
|
innerType
|
|
2165
2628
|
});
|
|
2166
2629
|
}
|
|
2167
|
-
const ZodDefault = /* @__PURE__ */
|
|
2630
|
+
const ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
|
|
2168
2631
|
$ZodDefault.init(inst, def);
|
|
2169
2632
|
ZodType.init(inst, def);
|
|
2170
2633
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
@@ -2179,7 +2642,7 @@ function _default(innerType, defaultValue) {
|
|
|
2179
2642
|
}
|
|
2180
2643
|
});
|
|
2181
2644
|
}
|
|
2182
|
-
const ZodPrefault = /* @__PURE__ */
|
|
2645
|
+
const ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
|
|
2183
2646
|
$ZodPrefault.init(inst, def);
|
|
2184
2647
|
ZodType.init(inst, def);
|
|
2185
2648
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
@@ -2193,7 +2656,7 @@ function prefault(innerType, defaultValue) {
|
|
|
2193
2656
|
}
|
|
2194
2657
|
});
|
|
2195
2658
|
}
|
|
2196
|
-
const ZodNonOptional = /* @__PURE__ */
|
|
2659
|
+
const ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
|
|
2197
2660
|
$ZodNonOptional.init(inst, def);
|
|
2198
2661
|
ZodType.init(inst, def);
|
|
2199
2662
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
@@ -2202,10 +2665,10 @@ function nonoptional(innerType, params) {
|
|
|
2202
2665
|
return new ZodNonOptional({
|
|
2203
2666
|
type: "nonoptional",
|
|
2204
2667
|
innerType,
|
|
2205
|
-
...
|
|
2668
|
+
...normalizeParams(params)
|
|
2206
2669
|
});
|
|
2207
2670
|
}
|
|
2208
|
-
const ZodCatch = /* @__PURE__ */
|
|
2671
|
+
const ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
|
|
2209
2672
|
$ZodCatch.init(inst, def);
|
|
2210
2673
|
ZodType.init(inst, def);
|
|
2211
2674
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
@@ -2218,7 +2681,7 @@ function _catch(innerType, catchValue) {
|
|
|
2218
2681
|
catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
|
|
2219
2682
|
});
|
|
2220
2683
|
}
|
|
2221
|
-
const ZodPipe = /* @__PURE__ */
|
|
2684
|
+
const ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
|
|
2222
2685
|
$ZodPipe.init(inst, def);
|
|
2223
2686
|
ZodType.init(inst, def);
|
|
2224
2687
|
inst.in = def.in;
|
|
@@ -2232,7 +2695,7 @@ function pipe(in_, out) {
|
|
|
2232
2695
|
// ...util.normalizeParams(params),
|
|
2233
2696
|
});
|
|
2234
2697
|
}
|
|
2235
|
-
const ZodReadonly = /* @__PURE__ */
|
|
2698
|
+
const ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
|
|
2236
2699
|
$ZodReadonly.init(inst, def);
|
|
2237
2700
|
ZodType.init(inst, def);
|
|
2238
2701
|
});
|
|
@@ -2242,7 +2705,7 @@ function readonly(innerType) {
|
|
|
2242
2705
|
innerType
|
|
2243
2706
|
});
|
|
2244
2707
|
}
|
|
2245
|
-
const ZodCustom = /* @__PURE__ */
|
|
2708
|
+
const ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
|
|
2246
2709
|
$ZodCustom.init(inst, def);
|
|
2247
2710
|
ZodType.init(inst, def);
|
|
2248
2711
|
});
|
|
@@ -2259,18 +2722,18 @@ function refine(fn, _params = {}) {
|
|
|
2259
2722
|
}
|
|
2260
2723
|
function superRefine(fn) {
|
|
2261
2724
|
const ch = check((payload) => {
|
|
2262
|
-
payload.addIssue = (issue) => {
|
|
2263
|
-
if (typeof issue === "string") {
|
|
2264
|
-
payload.issues.push(
|
|
2725
|
+
payload.addIssue = (issue$1) => {
|
|
2726
|
+
if (typeof issue$1 === "string") {
|
|
2727
|
+
payload.issues.push(issue(issue$1, payload.value, ch._zod.def));
|
|
2265
2728
|
} else {
|
|
2266
|
-
const _issue = issue;
|
|
2729
|
+
const _issue = issue$1;
|
|
2267
2730
|
if (_issue.fatal)
|
|
2268
2731
|
_issue.continue = false;
|
|
2269
2732
|
_issue.code ?? (_issue.code = "custom");
|
|
2270
2733
|
_issue.input ?? (_issue.input = payload.value);
|
|
2271
2734
|
_issue.inst ?? (_issue.inst = ch);
|
|
2272
2735
|
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
|
|
2273
|
-
payload.issues.push(
|
|
2736
|
+
payload.issues.push(issue(_issue));
|
|
2274
2737
|
}
|
|
2275
2738
|
};
|
|
2276
2739
|
return fn(payload.value, payload);
|
|
@@ -2280,4 +2743,4 @@ function superRefine(fn) {
|
|
|
2280
2743
|
exports.array = array;
|
|
2281
2744
|
exports.object = object;
|
|
2282
2745
|
exports.string = string;
|
|
2283
|
-
//# sourceMappingURL=schemas-
|
|
2746
|
+
//# sourceMappingURL=schemas-0lUZlFWF.cjs.map
|