@intlayer/design-system 5.5.9 → 5.5.11
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 +42 -9
- package/dist/.vite/manifest.json +91 -68
- package/dist/components/Auth/AuthModal/index.cjs +2 -2
- package/dist/components/Auth/AuthModal/index.mjs +2 -2
- package/dist/components/Auth/ChangePasswordForm/useChangePasswordSchema.cjs +1 -1
- package/dist/components/Auth/ChangePasswordForm/useChangePasswordSchema.mjs +1 -1
- package/dist/components/Auth/DefineNewPasswordForm/useDefineNewPasswordSchema.cjs +1 -1
- package/dist/components/Auth/DefineNewPasswordForm/useDefineNewPasswordSchema.mjs +1 -1
- package/dist/components/Auth/ResetPasswordForm/useResetPasswordSchema.cjs +1 -1
- package/dist/components/Auth/ResetPasswordForm/useResetPasswordSchema.mjs +1 -1
- package/dist/components/Auth/SignInForm/useSignInSchema.cjs +1 -1
- package/dist/components/Auth/SignInForm/useSignInSchema.mjs +1 -1
- package/dist/components/Auth/SignUpForm/useSignUpSchema.cjs +1 -1
- package/dist/components/Auth/SignUpForm/useSignUpSchema.mjs +1 -1
- package/dist/components/Auth/VerifyEmailForm/VerifyEmailSchema.cjs +1 -1
- package/dist/components/Auth/VerifyEmailForm/VerifyEmailSchema.mjs +1 -1
- package/dist/components/Auth/useUser/index.cjs +2 -2
- package/dist/components/Auth/useUser/index.mjs +2 -2
- package/dist/components/Command/index.d.ts +83 -0
- package/dist/components/Command/index.d.ts.map +1 -0
- package/dist/components/ContentEditor/ContentEditorTextArea.cjs +2 -2
- package/dist/components/ContentEditor/ContentEditorTextArea.mjs +2 -2
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.cjs +2 -2
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs +2 -2
- 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 +2 -2
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +2 -2
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs +2 -2
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +2 -2
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +2 -2
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +2 -2
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.cjs +3 -3
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.d.ts +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.mjs +3 -3
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.cjs +2 -2
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.mjs +2 -2
- package/dist/components/DropDown/index.cjs +1 -13
- package/dist/components/DropDown/index.cjs.map +1 -1
- package/dist/components/DropDown/index.d.ts.map +1 -1
- package/dist/components/DropDown/index.mjs +1 -13
- package/dist/components/DropDown/index.mjs.map +1 -1
- package/dist/components/EditableField/EditableFieldTextArea.cjs +2 -2
- package/dist/components/EditableField/EditableFieldTextArea.mjs +2 -2
- package/dist/components/Form/FormBase.cjs +2 -2
- package/dist/components/Form/FormBase.mjs +2 -2
- package/dist/components/Form/elements/FormElementWrapper.cjs +3 -3
- package/dist/components/Form/elements/FormElementWrapper.mjs +3 -3
- package/dist/components/IDE/CodeContext.cjs +2 -2
- package/dist/components/IDE/CodeContext.mjs +2 -2
- package/dist/components/IDE/FileList.cjs +1 -1
- package/dist/components/IDE/FileList.cjs.map +1 -1
- package/dist/components/IDE/FileList.d.ts +1 -1
- package/dist/components/IDE/FileList.d.ts.map +1 -1
- package/dist/components/IDE/FileList.mjs +1 -1
- package/dist/components/IDE/FileList.mjs.map +1 -1
- package/dist/components/KeyboardScreenAdapter/index.cjs +1 -1
- package/dist/components/KeyboardScreenAdapter/index.cjs.map +1 -1
- package/dist/components/KeyboardScreenAdapter/index.mjs +1 -1
- package/dist/components/KeyboardScreenAdapter/index.mjs.map +1 -1
- package/dist/components/Link/Link.cjs.map +1 -1
- package/dist/components/Link/Link.d.ts.map +1 -1
- package/dist/components/Link/Link.mjs.map +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.cjs +2 -2
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs +2 -2
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.cjs +2 -2
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.mjs +2 -2
- package/dist/components/MarkDownRender/index.cjs +28 -2
- package/dist/components/MarkDownRender/index.cjs.map +1 -1
- package/dist/components/MarkDownRender/index.d.ts +2 -2
- package/dist/components/MarkDownRender/index.d.ts.map +1 -1
- package/dist/components/MarkDownRender/index.mjs +28 -2
- package/dist/components/MarkDownRender/index.mjs.map +1 -1
- package/dist/components/Modal/Modal.cjs +4 -4
- package/dist/components/Modal/Modal.mjs +4 -4
- package/dist/components/Navbar/MobileNavbar.cjs +3 -3
- package/dist/components/Navbar/MobileNavbar.mjs +3 -3
- package/dist/components/Navbar/index.cjs +5 -5
- package/dist/components/Navbar/index.mjs +5 -5
- package/dist/components/SwitchSelector/index.cjs +3 -3
- package/dist/components/SwitchSelector/index.mjs +3 -3
- package/dist/components/TabSelector/TabSelector.cjs +3 -3
- package/dist/components/TabSelector/TabSelector.mjs +3 -3
- package/dist/components/TextArea/AutoSizeTextArea.cjs +1 -1
- package/dist/components/TextArea/AutoSizeTextArea.cjs.map +1 -1
- package/dist/components/TextArea/AutoSizeTextArea.mjs +1 -1
- package/dist/components/TextArea/AutoSizeTextArea.mjs.map +1 -1
- package/dist/components/TextArea/AutocompleteTextArea.cjs +2 -2
- package/dist/components/TextArea/AutocompleteTextArea.mjs +2 -2
- package/dist/hooks/index.cjs +25 -23
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.ts +8 -7
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.mjs +10 -8
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/hooks/useAsync/useAsync.cjs +10 -11
- package/dist/hooks/useAsync/useAsync.cjs.map +1 -1
- package/dist/hooks/useAsync/useAsync.mjs +10 -11
- package/dist/hooks/useAsync/useAsync.mjs.map +1 -1
- package/dist/hooks/useIntlayerAPI.cjs +5 -4
- package/dist/hooks/useIntlayerAPI.cjs.map +1 -1
- package/dist/hooks/useIntlayerAPI.d.ts +1 -0
- package/dist/hooks/useIntlayerAPI.d.ts.map +1 -1
- package/dist/hooks/useIntlayerAPI.mjs +5 -4
- package/dist/hooks/useIntlayerAPI.mjs.map +1 -1
- package/dist/hooks/useScreenWidth.cjs +18 -0
- package/dist/hooks/useScreenWidth.cjs.map +1 -0
- package/dist/hooks/useScreenWidth.d.ts +4 -0
- package/dist/hooks/useScreenWidth.d.ts.map +1 -0
- package/dist/hooks/useScreenWidth.mjs +18 -0
- package/dist/hooks/useScreenWidth.mjs.map +1 -0
- package/dist/index-BCuMWKyy.js.map +1 -1
- package/dist/index-BYzBot7l.cjs.map +1 -1
- package/dist/parse-BJVwmz92.cjs +511 -0
- package/dist/parse-BJVwmz92.cjs.map +1 -0
- package/dist/parse-pnJgclyf.js +512 -0
- package/dist/parse-pnJgclyf.js.map +1 -0
- package/dist/{schemas-DJhUvjsx.cjs → schemas-DlCjM5d_.cjs} +260 -726
- package/dist/schemas-DlCjM5d_.cjs.map +1 -0
- package/dist/{schemas-7jC6hy_u.js → schemas-itjzX6bG.js} +21 -487
- package/dist/schemas-itjzX6bG.js.map +1 -0
- package/dist/tailwind.css +2 -2
- package/dist/zod-D4WapgbL.js +92 -0
- package/dist/zod-D4WapgbL.js.map +1 -0
- package/dist/zod-K7y5gPX4.cjs +91 -0
- package/dist/zod-K7y5gPX4.cjs.map +1 -0
- package/package.json +16 -16
- package/dist/schemas-7jC6hy_u.js.map +0 -1
- package/dist/schemas-DJhUvjsx.cjs.map +0 -1
- package/dist/zod-DIGMabE8.js +0 -48
- package/dist/zod-DIGMabE8.js.map +0 -1
- package/dist/zod-DpajDxlG.cjs +0 -47
- package/dist/zod-DpajDxlG.cjs.map +0 -1
|
@@ -1,464 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
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 randomString(length = 10) {
|
|
109
|
-
const chars = "abcdefghijklmnopqrstuvwxyz";
|
|
110
|
-
let str = "";
|
|
111
|
-
for (let i = 0; i < length; i++) {
|
|
112
|
-
str += chars[Math.floor(Math.random() * chars.length)];
|
|
113
|
-
}
|
|
114
|
-
return str;
|
|
115
|
-
}
|
|
116
|
-
function esc(str) {
|
|
117
|
-
return JSON.stringify(str);
|
|
118
|
-
}
|
|
119
|
-
function isObject(data) {
|
|
120
|
-
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
121
|
-
}
|
|
122
|
-
const allowsEval = cached(() => {
|
|
123
|
-
try {
|
|
124
|
-
const F = Function;
|
|
125
|
-
new F("");
|
|
126
|
-
return true;
|
|
127
|
-
} catch (_) {
|
|
128
|
-
return false;
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
function isPlainObject(o) {
|
|
132
|
-
if (isObject(o) === false)
|
|
133
|
-
return false;
|
|
134
|
-
const ctor = o.constructor;
|
|
135
|
-
if (ctor === void 0)
|
|
136
|
-
return true;
|
|
137
|
-
const prot = ctor.prototype;
|
|
138
|
-
if (isObject(prot) === false)
|
|
139
|
-
return false;
|
|
140
|
-
if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) {
|
|
141
|
-
return false;
|
|
142
|
-
}
|
|
143
|
-
return true;
|
|
144
|
-
}
|
|
145
|
-
const propertyKeyTypes = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
|
|
146
|
-
function escapeRegex(str) {
|
|
147
|
-
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
148
|
-
}
|
|
149
|
-
function clone(inst, def, params) {
|
|
150
|
-
const cl = new inst._zod.constr(def ?? inst._zod.def);
|
|
151
|
-
if (!def || params?.parent)
|
|
152
|
-
cl._zod.parent = inst;
|
|
153
|
-
return cl;
|
|
154
|
-
}
|
|
155
|
-
function normalizeParams(_params) {
|
|
156
|
-
const params = _params;
|
|
157
|
-
if (!params)
|
|
158
|
-
return {};
|
|
159
|
-
if (typeof params === "string")
|
|
160
|
-
return { error: () => params };
|
|
161
|
-
if (params?.message !== void 0) {
|
|
162
|
-
if (params?.error !== void 0)
|
|
163
|
-
throw new Error("Cannot specify both `message` and `error` params");
|
|
164
|
-
params.error = params.message;
|
|
165
|
-
}
|
|
166
|
-
delete params.message;
|
|
167
|
-
if (typeof params.error === "string")
|
|
168
|
-
return { ...params, error: () => params.error };
|
|
169
|
-
return params;
|
|
170
|
-
}
|
|
171
|
-
function optionalKeys(shape) {
|
|
172
|
-
return Object.keys(shape).filter((k) => {
|
|
173
|
-
return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
function pick(schema, mask) {
|
|
177
|
-
const newShape = {};
|
|
178
|
-
const currDef = schema._zod.def;
|
|
179
|
-
for (const key in mask) {
|
|
180
|
-
if (!(key in currDef.shape)) {
|
|
181
|
-
throw new Error(`Unrecognized key: "${key}"`);
|
|
182
|
-
}
|
|
183
|
-
if (!mask[key])
|
|
184
|
-
continue;
|
|
185
|
-
newShape[key] = currDef.shape[key];
|
|
186
|
-
}
|
|
187
|
-
return clone(schema, {
|
|
188
|
-
...schema._zod.def,
|
|
189
|
-
shape: newShape,
|
|
190
|
-
checks: []
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
function omit(schema, mask) {
|
|
194
|
-
const newShape = { ...schema._zod.def.shape };
|
|
195
|
-
const currDef = schema._zod.def;
|
|
196
|
-
for (const key in mask) {
|
|
197
|
-
if (!(key in currDef.shape)) {
|
|
198
|
-
throw new Error(`Unrecognized key: "${key}"`);
|
|
199
|
-
}
|
|
200
|
-
if (!mask[key])
|
|
201
|
-
continue;
|
|
202
|
-
delete newShape[key];
|
|
203
|
-
}
|
|
204
|
-
return clone(schema, {
|
|
205
|
-
...schema._zod.def,
|
|
206
|
-
shape: newShape,
|
|
207
|
-
checks: []
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
function extend(schema, shape) {
|
|
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
|
-
};
|
|
363
|
-
const $ZodError = $constructor("$ZodError", initializer$1);
|
|
364
|
-
const $ZodRealError = $constructor("$ZodError", initializer$1, { Parent: Error });
|
|
365
|
-
function flattenError(error, mapper = (issue2) => issue2.message) {
|
|
366
|
-
const fieldErrors = {};
|
|
367
|
-
const formErrors = [];
|
|
368
|
-
for (const sub of error.issues) {
|
|
369
|
-
if (sub.path.length > 0) {
|
|
370
|
-
fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
|
|
371
|
-
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
372
|
-
} else {
|
|
373
|
-
formErrors.push(mapper(sub));
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
return { formErrors, fieldErrors };
|
|
377
|
-
}
|
|
378
|
-
function formatError(error, _mapper) {
|
|
379
|
-
const mapper = _mapper || function(issue2) {
|
|
380
|
-
return issue2.message;
|
|
381
|
-
};
|
|
382
|
-
const fieldErrors = { _errors: [] };
|
|
383
|
-
const processError = (error2) => {
|
|
384
|
-
for (const issue2 of error2.issues) {
|
|
385
|
-
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
386
|
-
issue2.errors.map((issues) => processError({ issues }));
|
|
387
|
-
} else if (issue2.code === "invalid_key") {
|
|
388
|
-
processError({ issues: issue2.issues });
|
|
389
|
-
} else if (issue2.code === "invalid_element") {
|
|
390
|
-
processError({ issues: issue2.issues });
|
|
391
|
-
} else if (issue2.path.length === 0) {
|
|
392
|
-
fieldErrors._errors.push(mapper(issue2));
|
|
393
|
-
} else {
|
|
394
|
-
let curr = fieldErrors;
|
|
395
|
-
let i = 0;
|
|
396
|
-
while (i < issue2.path.length) {
|
|
397
|
-
const el = issue2.path[i];
|
|
398
|
-
const terminal = i === issue2.path.length - 1;
|
|
399
|
-
if (!terminal) {
|
|
400
|
-
curr[el] = curr[el] || { _errors: [] };
|
|
401
|
-
} else {
|
|
402
|
-
curr[el] = curr[el] || { _errors: [] };
|
|
403
|
-
curr[el]._errors.push(mapper(issue2));
|
|
404
|
-
}
|
|
405
|
-
curr = curr[el];
|
|
406
|
-
i++;
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
};
|
|
411
|
-
processError(error);
|
|
412
|
-
return fieldErrors;
|
|
413
|
-
}
|
|
414
|
-
const _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
415
|
-
const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
|
|
416
|
-
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
417
|
-
if (result instanceof Promise) {
|
|
418
|
-
throw new $ZodAsyncError();
|
|
419
|
-
}
|
|
420
|
-
if (result.issues.length) {
|
|
421
|
-
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
422
|
-
Error.captureStackTrace(e, _params?.callee);
|
|
423
|
-
throw e;
|
|
424
|
-
}
|
|
425
|
-
return result.value;
|
|
426
|
-
};
|
|
427
|
-
const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
428
|
-
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
429
|
-
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
430
|
-
if (result instanceof Promise)
|
|
431
|
-
result = await result;
|
|
432
|
-
if (result.issues.length) {
|
|
433
|
-
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
434
|
-
Error.captureStackTrace(e, params?.callee);
|
|
435
|
-
throw e;
|
|
436
|
-
}
|
|
437
|
-
return result.value;
|
|
438
|
-
};
|
|
439
|
-
const _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
440
|
-
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
441
|
-
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
442
|
-
if (result instanceof Promise) {
|
|
443
|
-
throw new $ZodAsyncError();
|
|
444
|
-
}
|
|
445
|
-
return result.issues.length ? {
|
|
446
|
-
success: false,
|
|
447
|
-
error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
448
|
-
} : { success: true, data: result.value };
|
|
449
|
-
};
|
|
450
|
-
const safeParse$1 = /* @__PURE__ */ _safeParse($ZodRealError);
|
|
451
|
-
const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
452
|
-
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
453
|
-
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
454
|
-
if (result instanceof Promise)
|
|
455
|
-
result = await result;
|
|
456
|
-
return result.issues.length ? {
|
|
457
|
-
success: false,
|
|
458
|
-
error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
459
|
-
} : { success: true, data: result.value };
|
|
460
|
-
};
|
|
461
|
-
const safeParseAsync$1 = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
2
|
+
const parse$1 = require("./parse-BJVwmz92.cjs");
|
|
462
3
|
const cuid = /^[cC][^\s-]{8,}$/;
|
|
463
4
|
const cuid2 = /^[0-9a-z]+$/;
|
|
464
5
|
const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
|
|
@@ -485,28 +26,25 @@ const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z
|
|
|
485
26
|
const base64url = /^[A-Za-z0-9_-]*$/;
|
|
486
27
|
const hostname = /^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;
|
|
487
28
|
const e164 = /^\+(?:[0-9]){6,14}[0-9]$/;
|
|
488
|
-
const dateSource = `((
|
|
29
|
+
const dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
|
|
489
30
|
const date$1 = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
|
|
490
31
|
function timeSource(args) {
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
regex = `${regex}\\.\\d{${args.precision}}`;
|
|
494
|
-
} else if (args.precision == null) {
|
|
495
|
-
regex = `${regex}(\\.\\d+)?`;
|
|
496
|
-
}
|
|
32
|
+
const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
|
|
33
|
+
const regex = typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
497
34
|
return regex;
|
|
498
35
|
}
|
|
499
36
|
function time$1(args) {
|
|
500
37
|
return new RegExp(`^${timeSource(args)}$`);
|
|
501
38
|
}
|
|
502
39
|
function datetime$1(args) {
|
|
503
|
-
|
|
504
|
-
const opts = [];
|
|
505
|
-
|
|
40
|
+
const time2 = timeSource({ precision: args.precision });
|
|
41
|
+
const opts = ["Z"];
|
|
42
|
+
if (args.local)
|
|
43
|
+
opts.push("");
|
|
506
44
|
if (args.offset)
|
|
507
|
-
opts.push(`([+-]\\d{2}
|
|
508
|
-
|
|
509
|
-
return new RegExp(`^${
|
|
45
|
+
opts.push(`([+-]\\d{2}:\\d{2})`);
|
|
46
|
+
const timeRegex = `${time2}(?:${opts.join("|")})`;
|
|
47
|
+
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
510
48
|
}
|
|
511
49
|
const string$1 = (params) => {
|
|
512
50
|
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
@@ -514,17 +52,17 @@ const string$1 = (params) => {
|
|
|
514
52
|
};
|
|
515
53
|
const lowercase = /^[^A-Z]*$/;
|
|
516
54
|
const uppercase = /^[^a-z]*$/;
|
|
517
|
-
const $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
55
|
+
const $ZodCheck = /* @__PURE__ */ parse$1.$constructor("$ZodCheck", (inst, def) => {
|
|
518
56
|
var _a;
|
|
519
57
|
inst._zod ?? (inst._zod = {});
|
|
520
58
|
inst._zod.def = def;
|
|
521
59
|
(_a = inst._zod).onattach ?? (_a.onattach = []);
|
|
522
60
|
});
|
|
523
|
-
const $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
61
|
+
const $ZodCheckMaxLength = /* @__PURE__ */ parse$1.$constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
524
62
|
$ZodCheck.init(inst, def);
|
|
525
63
|
inst._zod.when = (payload) => {
|
|
526
64
|
const val = payload.value;
|
|
527
|
-
return !nullish(val) && val.length !== void 0;
|
|
65
|
+
return !parse$1.nullish(val) && val.length !== void 0;
|
|
528
66
|
};
|
|
529
67
|
inst._zod.onattach.push((inst2) => {
|
|
530
68
|
const curr = inst2._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
@@ -536,7 +74,7 @@ const $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (i
|
|
|
536
74
|
const length = input.length;
|
|
537
75
|
if (length <= def.maximum)
|
|
538
76
|
return;
|
|
539
|
-
const origin = getLengthableOrigin(input);
|
|
77
|
+
const origin = parse$1.getLengthableOrigin(input);
|
|
540
78
|
payload.issues.push({
|
|
541
79
|
origin,
|
|
542
80
|
code: "too_big",
|
|
@@ -548,11 +86,11 @@ const $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (i
|
|
|
548
86
|
});
|
|
549
87
|
};
|
|
550
88
|
});
|
|
551
|
-
const $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
89
|
+
const $ZodCheckMinLength = /* @__PURE__ */ parse$1.$constructor("$ZodCheckMinLength", (inst, def) => {
|
|
552
90
|
$ZodCheck.init(inst, def);
|
|
553
91
|
inst._zod.when = (payload) => {
|
|
554
92
|
const val = payload.value;
|
|
555
|
-
return !nullish(val) && val.length !== void 0;
|
|
93
|
+
return !parse$1.nullish(val) && val.length !== void 0;
|
|
556
94
|
};
|
|
557
95
|
inst._zod.onattach.push((inst2) => {
|
|
558
96
|
const curr = inst2._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
@@ -564,7 +102,7 @@ const $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (i
|
|
|
564
102
|
const length = input.length;
|
|
565
103
|
if (length >= def.minimum)
|
|
566
104
|
return;
|
|
567
|
-
const origin = getLengthableOrigin(input);
|
|
105
|
+
const origin = parse$1.getLengthableOrigin(input);
|
|
568
106
|
payload.issues.push({
|
|
569
107
|
origin,
|
|
570
108
|
code: "too_small",
|
|
@@ -576,11 +114,11 @@ const $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (i
|
|
|
576
114
|
});
|
|
577
115
|
};
|
|
578
116
|
});
|
|
579
|
-
const $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
117
|
+
const $ZodCheckLengthEquals = /* @__PURE__ */ parse$1.$constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
580
118
|
$ZodCheck.init(inst, def);
|
|
581
119
|
inst._zod.when = (payload) => {
|
|
582
120
|
const val = payload.value;
|
|
583
|
-
return !nullish(val) && val.length !== void 0;
|
|
121
|
+
return !parse$1.nullish(val) && val.length !== void 0;
|
|
584
122
|
};
|
|
585
123
|
inst._zod.onattach.push((inst2) => {
|
|
586
124
|
const bag = inst2._zod.bag;
|
|
@@ -593,7 +131,7 @@ const $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEqual
|
|
|
593
131
|
const length = input.length;
|
|
594
132
|
if (length === def.length)
|
|
595
133
|
return;
|
|
596
|
-
const origin = getLengthableOrigin(input);
|
|
134
|
+
const origin = parse$1.getLengthableOrigin(input);
|
|
597
135
|
const tooBig = length > def.length;
|
|
598
136
|
payload.issues.push({
|
|
599
137
|
origin,
|
|
@@ -604,7 +142,7 @@ const $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEqual
|
|
|
604
142
|
});
|
|
605
143
|
};
|
|
606
144
|
});
|
|
607
|
-
const $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
145
|
+
const $ZodCheckStringFormat = /* @__PURE__ */ parse$1.$constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
608
146
|
var _a;
|
|
609
147
|
$ZodCheck.init(inst, def);
|
|
610
148
|
inst._zod.onattach.push((inst2) => {
|
|
@@ -632,7 +170,7 @@ const $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringForma
|
|
|
632
170
|
});
|
|
633
171
|
});
|
|
634
172
|
});
|
|
635
|
-
const $ZodCheckRegex = /* @__PURE__ */ $constructor("$ZodCheckRegex", (inst, def) => {
|
|
173
|
+
const $ZodCheckRegex = /* @__PURE__ */ parse$1.$constructor("$ZodCheckRegex", (inst, def) => {
|
|
636
174
|
$ZodCheckStringFormat.init(inst, def);
|
|
637
175
|
inst._zod.check = (payload) => {
|
|
638
176
|
def.pattern.lastIndex = 0;
|
|
@@ -649,17 +187,17 @@ const $ZodCheckRegex = /* @__PURE__ */ $constructor("$ZodCheckRegex", (inst, def
|
|
|
649
187
|
});
|
|
650
188
|
};
|
|
651
189
|
});
|
|
652
|
-
const $ZodCheckLowerCase = /* @__PURE__ */ $constructor("$ZodCheckLowerCase", (inst, def) => {
|
|
190
|
+
const $ZodCheckLowerCase = /* @__PURE__ */ parse$1.$constructor("$ZodCheckLowerCase", (inst, def) => {
|
|
653
191
|
def.pattern ?? (def.pattern = lowercase);
|
|
654
192
|
$ZodCheckStringFormat.init(inst, def);
|
|
655
193
|
});
|
|
656
|
-
const $ZodCheckUpperCase = /* @__PURE__ */ $constructor("$ZodCheckUpperCase", (inst, def) => {
|
|
194
|
+
const $ZodCheckUpperCase = /* @__PURE__ */ parse$1.$constructor("$ZodCheckUpperCase", (inst, def) => {
|
|
657
195
|
def.pattern ?? (def.pattern = uppercase);
|
|
658
196
|
$ZodCheckStringFormat.init(inst, def);
|
|
659
197
|
});
|
|
660
|
-
const $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst, def) => {
|
|
198
|
+
const $ZodCheckIncludes = /* @__PURE__ */ parse$1.$constructor("$ZodCheckIncludes", (inst, def) => {
|
|
661
199
|
$ZodCheck.init(inst, def);
|
|
662
|
-
const escapedRegex = escapeRegex(def.includes);
|
|
200
|
+
const escapedRegex = parse$1.escapeRegex(def.includes);
|
|
663
201
|
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
|
|
664
202
|
def.pattern = pattern;
|
|
665
203
|
inst._zod.onattach.push((inst2) => {
|
|
@@ -681,9 +219,9 @@ const $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (ins
|
|
|
681
219
|
});
|
|
682
220
|
};
|
|
683
221
|
});
|
|
684
|
-
const $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (inst, def) => {
|
|
222
|
+
const $ZodCheckStartsWith = /* @__PURE__ */ parse$1.$constructor("$ZodCheckStartsWith", (inst, def) => {
|
|
685
223
|
$ZodCheck.init(inst, def);
|
|
686
|
-
const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
|
|
224
|
+
const pattern = new RegExp(`^${parse$1.escapeRegex(def.prefix)}.*`);
|
|
687
225
|
def.pattern ?? (def.pattern = pattern);
|
|
688
226
|
inst._zod.onattach.push((inst2) => {
|
|
689
227
|
const bag = inst2._zod.bag;
|
|
@@ -704,9 +242,9 @@ const $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith",
|
|
|
704
242
|
});
|
|
705
243
|
};
|
|
706
244
|
});
|
|
707
|
-
const $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst, def) => {
|
|
245
|
+
const $ZodCheckEndsWith = /* @__PURE__ */ parse$1.$constructor("$ZodCheckEndsWith", (inst, def) => {
|
|
708
246
|
$ZodCheck.init(inst, def);
|
|
709
|
-
const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
|
|
247
|
+
const pattern = new RegExp(`.*${parse$1.escapeRegex(def.suffix)}$`);
|
|
710
248
|
def.pattern ?? (def.pattern = pattern);
|
|
711
249
|
inst._zod.onattach.push((inst2) => {
|
|
712
250
|
const bag = inst2._zod.bag;
|
|
@@ -727,7 +265,7 @@ const $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (ins
|
|
|
727
265
|
});
|
|
728
266
|
};
|
|
729
267
|
});
|
|
730
|
-
const $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (inst, def) => {
|
|
268
|
+
const $ZodCheckOverwrite = /* @__PURE__ */ parse$1.$constructor("$ZodCheckOverwrite", (inst, def) => {
|
|
731
269
|
$ZodCheck.init(inst, def);
|
|
732
270
|
inst._zod.check = (payload) => {
|
|
733
271
|
payload.value = def.tx(payload.value);
|
|
@@ -772,10 +310,10 @@ const version = {
|
|
|
772
310
|
minor: 0,
|
|
773
311
|
patch: 0
|
|
774
312
|
};
|
|
775
|
-
const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
313
|
+
const $ZodType = /* @__PURE__ */ parse$1.$constructor("$ZodType", (inst, def) => {
|
|
776
314
|
var _a;
|
|
777
315
|
inst ?? (inst = {});
|
|
778
|
-
inst._zod
|
|
316
|
+
parse$1.defineLazy(inst._zod, "id", () => def.type + "_" + parse$1.randomString(10));
|
|
779
317
|
inst._zod.def = def;
|
|
780
318
|
inst._zod.bag = inst._zod.bag || {};
|
|
781
319
|
inst._zod.version = version;
|
|
@@ -795,22 +333,20 @@ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
795
333
|
});
|
|
796
334
|
} else {
|
|
797
335
|
const runChecks = (payload, checks2, ctx) => {
|
|
798
|
-
let isAborted = aborted(payload);
|
|
336
|
+
let isAborted = parse$1.aborted(payload);
|
|
799
337
|
let asyncResult;
|
|
800
338
|
for (const ch of checks2) {
|
|
801
339
|
if (ch._zod.when) {
|
|
802
340
|
const shouldRun = ch._zod.when(payload);
|
|
803
341
|
if (!shouldRun)
|
|
804
342
|
continue;
|
|
805
|
-
} else {
|
|
806
|
-
|
|
807
|
-
continue;
|
|
808
|
-
}
|
|
343
|
+
} else if (isAborted) {
|
|
344
|
+
continue;
|
|
809
345
|
}
|
|
810
346
|
const currLen = payload.issues.length;
|
|
811
347
|
const _ = ch._zod.check(payload);
|
|
812
348
|
if (_ instanceof Promise && ctx?.async === false) {
|
|
813
|
-
throw new $ZodAsyncError();
|
|
349
|
+
throw new parse$1.$ZodAsyncError();
|
|
814
350
|
}
|
|
815
351
|
if (asyncResult || _ instanceof Promise) {
|
|
816
352
|
asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
@@ -819,14 +355,14 @@ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
819
355
|
if (nextLen === currLen)
|
|
820
356
|
return;
|
|
821
357
|
if (!isAborted)
|
|
822
|
-
isAborted = aborted(payload, currLen);
|
|
358
|
+
isAborted = parse$1.aborted(payload, currLen);
|
|
823
359
|
});
|
|
824
360
|
} else {
|
|
825
361
|
const nextLen = payload.issues.length;
|
|
826
362
|
if (nextLen === currLen)
|
|
827
363
|
continue;
|
|
828
364
|
if (!isAborted)
|
|
829
|
-
isAborted = aborted(payload, currLen);
|
|
365
|
+
isAborted = parse$1.aborted(payload, currLen);
|
|
830
366
|
}
|
|
831
367
|
}
|
|
832
368
|
if (asyncResult) {
|
|
@@ -840,7 +376,7 @@ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
840
376
|
const result = inst._zod.parse(payload, ctx);
|
|
841
377
|
if (result instanceof Promise) {
|
|
842
378
|
if (ctx.async === false)
|
|
843
|
-
throw new $ZodAsyncError();
|
|
379
|
+
throw new parse$1.$ZodAsyncError();
|
|
844
380
|
return result.then((result2) => runChecks(result2, checks, ctx));
|
|
845
381
|
}
|
|
846
382
|
return runChecks(result, checks, ctx);
|
|
@@ -849,17 +385,17 @@ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
849
385
|
inst["~standard"] = {
|
|
850
386
|
validate: (value) => {
|
|
851
387
|
try {
|
|
852
|
-
const r =
|
|
388
|
+
const r = parse$1.safeParse(inst, value);
|
|
853
389
|
return r.success ? { value: r.data } : { issues: r.error?.issues };
|
|
854
390
|
} catch (_) {
|
|
855
|
-
return
|
|
391
|
+
return parse$1.safeParseAsync(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
|
|
856
392
|
}
|
|
857
393
|
},
|
|
858
394
|
vendor: "zod",
|
|
859
395
|
version: 1
|
|
860
396
|
};
|
|
861
397
|
});
|
|
862
|
-
const $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
|
|
398
|
+
const $ZodString = /* @__PURE__ */ parse$1.$constructor("$ZodString", (inst, def) => {
|
|
863
399
|
$ZodType.init(inst, def);
|
|
864
400
|
inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$1(inst._zod.bag);
|
|
865
401
|
inst._zod.parse = (payload, _) => {
|
|
@@ -879,15 +415,15 @@ const $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
|
|
|
879
415
|
return payload;
|
|
880
416
|
};
|
|
881
417
|
});
|
|
882
|
-
const $ZodStringFormat = /* @__PURE__ */ $constructor("$ZodStringFormat", (inst, def) => {
|
|
418
|
+
const $ZodStringFormat = /* @__PURE__ */ parse$1.$constructor("$ZodStringFormat", (inst, def) => {
|
|
883
419
|
$ZodCheckStringFormat.init(inst, def);
|
|
884
420
|
$ZodString.init(inst, def);
|
|
885
421
|
});
|
|
886
|
-
const $ZodGUID = /* @__PURE__ */ $constructor("$ZodGUID", (inst, def) => {
|
|
422
|
+
const $ZodGUID = /* @__PURE__ */ parse$1.$constructor("$ZodGUID", (inst, def) => {
|
|
887
423
|
def.pattern ?? (def.pattern = guid);
|
|
888
424
|
$ZodStringFormat.init(inst, def);
|
|
889
425
|
});
|
|
890
|
-
const $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
|
|
426
|
+
const $ZodUUID = /* @__PURE__ */ parse$1.$constructor("$ZodUUID", (inst, def) => {
|
|
891
427
|
if (def.version) {
|
|
892
428
|
const versionMap = {
|
|
893
429
|
v1: 1,
|
|
@@ -907,11 +443,11 @@ const $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
|
|
|
907
443
|
def.pattern ?? (def.pattern = uuid());
|
|
908
444
|
$ZodStringFormat.init(inst, def);
|
|
909
445
|
});
|
|
910
|
-
const $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => {
|
|
446
|
+
const $ZodEmail = /* @__PURE__ */ parse$1.$constructor("$ZodEmail", (inst, def) => {
|
|
911
447
|
def.pattern ?? (def.pattern = email$1);
|
|
912
448
|
$ZodStringFormat.init(inst, def);
|
|
913
449
|
});
|
|
914
|
-
const $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
450
|
+
const $ZodURL = /* @__PURE__ */ parse$1.$constructor("$ZodURL", (inst, def) => {
|
|
915
451
|
$ZodStringFormat.init(inst, def);
|
|
916
452
|
inst._zod.check = (payload) => {
|
|
917
453
|
try {
|
|
@@ -956,51 +492,53 @@ const $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
|
956
492
|
}
|
|
957
493
|
};
|
|
958
494
|
});
|
|
959
|
-
const $ZodEmoji = /* @__PURE__ */ $constructor("$ZodEmoji", (inst, def) => {
|
|
495
|
+
const $ZodEmoji = /* @__PURE__ */ parse$1.$constructor("$ZodEmoji", (inst, def) => {
|
|
960
496
|
def.pattern ?? (def.pattern = emoji());
|
|
961
497
|
$ZodStringFormat.init(inst, def);
|
|
962
498
|
});
|
|
963
|
-
const $ZodNanoID = /* @__PURE__ */ $constructor("$ZodNanoID", (inst, def) => {
|
|
499
|
+
const $ZodNanoID = /* @__PURE__ */ parse$1.$constructor("$ZodNanoID", (inst, def) => {
|
|
964
500
|
def.pattern ?? (def.pattern = nanoid);
|
|
965
501
|
$ZodStringFormat.init(inst, def);
|
|
966
502
|
});
|
|
967
|
-
const $ZodCUID = /* @__PURE__ */ $constructor("$ZodCUID", (inst, def) => {
|
|
503
|
+
const $ZodCUID = /* @__PURE__ */ parse$1.$constructor("$ZodCUID", (inst, def) => {
|
|
968
504
|
def.pattern ?? (def.pattern = cuid);
|
|
969
505
|
$ZodStringFormat.init(inst, def);
|
|
970
506
|
});
|
|
971
|
-
const $ZodCUID2 = /* @__PURE__ */ $constructor("$ZodCUID2", (inst, def) => {
|
|
507
|
+
const $ZodCUID2 = /* @__PURE__ */ parse$1.$constructor("$ZodCUID2", (inst, def) => {
|
|
972
508
|
def.pattern ?? (def.pattern = cuid2);
|
|
973
509
|
$ZodStringFormat.init(inst, def);
|
|
974
510
|
});
|
|
975
|
-
const $ZodULID = /* @__PURE__ */ $constructor("$ZodULID", (inst, def) => {
|
|
511
|
+
const $ZodULID = /* @__PURE__ */ parse$1.$constructor("$ZodULID", (inst, def) => {
|
|
976
512
|
def.pattern ?? (def.pattern = ulid);
|
|
977
513
|
$ZodStringFormat.init(inst, def);
|
|
978
514
|
});
|
|
979
|
-
const $ZodXID = /* @__PURE__ */ $constructor("$ZodXID", (inst, def) => {
|
|
515
|
+
const $ZodXID = /* @__PURE__ */ parse$1.$constructor("$ZodXID", (inst, def) => {
|
|
980
516
|
def.pattern ?? (def.pattern = xid);
|
|
981
517
|
$ZodStringFormat.init(inst, def);
|
|
982
518
|
});
|
|
983
|
-
const $ZodKSUID = /* @__PURE__ */ $constructor("$ZodKSUID", (inst, def) => {
|
|
519
|
+
const $ZodKSUID = /* @__PURE__ */ parse$1.$constructor("$ZodKSUID", (inst, def) => {
|
|
984
520
|
def.pattern ?? (def.pattern = ksuid);
|
|
985
521
|
$ZodStringFormat.init(inst, def);
|
|
986
522
|
});
|
|
987
|
-
const $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => {
|
|
523
|
+
const $ZodISODateTime = /* @__PURE__ */ parse$1.$constructor("$ZodISODateTime", (inst, def) => {
|
|
988
524
|
def.pattern ?? (def.pattern = datetime$1(def));
|
|
989
525
|
$ZodStringFormat.init(inst, def);
|
|
526
|
+
inst._zod.check;
|
|
990
527
|
});
|
|
991
|
-
const $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {
|
|
528
|
+
const $ZodISODate = /* @__PURE__ */ parse$1.$constructor("$ZodISODate", (inst, def) => {
|
|
992
529
|
def.pattern ?? (def.pattern = date$1);
|
|
993
530
|
$ZodStringFormat.init(inst, def);
|
|
994
531
|
});
|
|
995
|
-
const $ZodISOTime = /* @__PURE__ */ $constructor("$ZodISOTime", (inst, def) => {
|
|
532
|
+
const $ZodISOTime = /* @__PURE__ */ parse$1.$constructor("$ZodISOTime", (inst, def) => {
|
|
996
533
|
def.pattern ?? (def.pattern = time$1(def));
|
|
997
534
|
$ZodStringFormat.init(inst, def);
|
|
535
|
+
inst._zod.check;
|
|
998
536
|
});
|
|
999
|
-
const $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def) => {
|
|
537
|
+
const $ZodISODuration = /* @__PURE__ */ parse$1.$constructor("$ZodISODuration", (inst, def) => {
|
|
1000
538
|
def.pattern ?? (def.pattern = duration$1);
|
|
1001
539
|
$ZodStringFormat.init(inst, def);
|
|
1002
540
|
});
|
|
1003
|
-
const $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
|
|
541
|
+
const $ZodIPv4 = /* @__PURE__ */ parse$1.$constructor("$ZodIPv4", (inst, def) => {
|
|
1004
542
|
def.pattern ?? (def.pattern = ipv4);
|
|
1005
543
|
$ZodStringFormat.init(inst, def);
|
|
1006
544
|
inst._zod.onattach.push((inst2) => {
|
|
@@ -1008,7 +546,7 @@ const $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
|
|
|
1008
546
|
bag.format = `ipv4`;
|
|
1009
547
|
});
|
|
1010
548
|
});
|
|
1011
|
-
const $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
|
|
549
|
+
const $ZodIPv6 = /* @__PURE__ */ parse$1.$constructor("$ZodIPv6", (inst, def) => {
|
|
1012
550
|
def.pattern ?? (def.pattern = ipv6);
|
|
1013
551
|
$ZodStringFormat.init(inst, def);
|
|
1014
552
|
inst._zod.onattach.push((inst2) => {
|
|
@@ -1029,11 +567,11 @@ const $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
|
|
|
1029
567
|
}
|
|
1030
568
|
};
|
|
1031
569
|
});
|
|
1032
|
-
const $ZodCIDRv4 = /* @__PURE__ */ $constructor("$ZodCIDRv4", (inst, def) => {
|
|
570
|
+
const $ZodCIDRv4 = /* @__PURE__ */ parse$1.$constructor("$ZodCIDRv4", (inst, def) => {
|
|
1033
571
|
def.pattern ?? (def.pattern = cidrv4);
|
|
1034
572
|
$ZodStringFormat.init(inst, def);
|
|
1035
573
|
});
|
|
1036
|
-
const $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
|
|
574
|
+
const $ZodCIDRv6 = /* @__PURE__ */ parse$1.$constructor("$ZodCIDRv6", (inst, def) => {
|
|
1037
575
|
def.pattern ?? (def.pattern = cidrv6);
|
|
1038
576
|
$ZodStringFormat.init(inst, def);
|
|
1039
577
|
inst._zod.check = (payload) => {
|
|
@@ -1070,7 +608,7 @@ function isValidBase64(data) {
|
|
|
1070
608
|
return false;
|
|
1071
609
|
}
|
|
1072
610
|
}
|
|
1073
|
-
const $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
611
|
+
const $ZodBase64 = /* @__PURE__ */ parse$1.$constructor("$ZodBase64", (inst, def) => {
|
|
1074
612
|
def.pattern ?? (def.pattern = base64);
|
|
1075
613
|
$ZodStringFormat.init(inst, def);
|
|
1076
614
|
inst._zod.onattach.push((inst2) => {
|
|
@@ -1095,7 +633,7 @@ function isValidBase64URL(data) {
|
|
|
1095
633
|
const padded = base642.padEnd(Math.ceil(base642.length / 4) * 4, "=");
|
|
1096
634
|
return isValidBase64(padded);
|
|
1097
635
|
}
|
|
1098
|
-
const $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
|
|
636
|
+
const $ZodBase64URL = /* @__PURE__ */ parse$1.$constructor("$ZodBase64URL", (inst, def) => {
|
|
1099
637
|
def.pattern ?? (def.pattern = base64url);
|
|
1100
638
|
$ZodStringFormat.init(inst, def);
|
|
1101
639
|
inst._zod.onattach.push((inst2) => {
|
|
@@ -1113,7 +651,7 @@ const $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def)
|
|
|
1113
651
|
});
|
|
1114
652
|
};
|
|
1115
653
|
});
|
|
1116
|
-
const $ZodE164 = /* @__PURE__ */ $constructor("$ZodE164", (inst, def) => {
|
|
654
|
+
const $ZodE164 = /* @__PURE__ */ parse$1.$constructor("$ZodE164", (inst, def) => {
|
|
1117
655
|
def.pattern ?? (def.pattern = e164);
|
|
1118
656
|
$ZodStringFormat.init(inst, def);
|
|
1119
657
|
});
|
|
@@ -1135,7 +673,7 @@ function isValidJWT(token, algorithm = null) {
|
|
|
1135
673
|
return false;
|
|
1136
674
|
}
|
|
1137
675
|
}
|
|
1138
|
-
const $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
|
|
676
|
+
const $ZodJWT = /* @__PURE__ */ parse$1.$constructor("$ZodJWT", (inst, def) => {
|
|
1139
677
|
$ZodStringFormat.init(inst, def);
|
|
1140
678
|
inst._zod.check = (payload) => {
|
|
1141
679
|
if (isValidJWT(payload.value, def.alg))
|
|
@@ -1149,11 +687,11 @@ const $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
|
|
|
1149
687
|
});
|
|
1150
688
|
};
|
|
1151
689
|
});
|
|
1152
|
-
const $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
|
|
690
|
+
const $ZodUnknown = /* @__PURE__ */ parse$1.$constructor("$ZodUnknown", (inst, def) => {
|
|
1153
691
|
$ZodType.init(inst, def);
|
|
1154
692
|
inst._zod.parse = (payload) => payload;
|
|
1155
693
|
});
|
|
1156
|
-
const $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
|
|
694
|
+
const $ZodNever = /* @__PURE__ */ parse$1.$constructor("$ZodNever", (inst, def) => {
|
|
1157
695
|
$ZodType.init(inst, def);
|
|
1158
696
|
inst._zod.parse = (payload, _ctx) => {
|
|
1159
697
|
payload.issues.push({
|
|
@@ -1167,11 +705,11 @@ const $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
|
|
|
1167
705
|
});
|
|
1168
706
|
function handleArrayResult(result, final, index) {
|
|
1169
707
|
if (result.issues.length) {
|
|
1170
|
-
final.issues.push(...prefixIssues(index, result.issues));
|
|
708
|
+
final.issues.push(...parse$1.prefixIssues(index, result.issues));
|
|
1171
709
|
}
|
|
1172
710
|
final.value[index] = result.value;
|
|
1173
711
|
}
|
|
1174
|
-
const $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
712
|
+
const $ZodArray = /* @__PURE__ */ parse$1.$constructor("$ZodArray", (inst, def) => {
|
|
1175
713
|
$ZodType.init(inst, def);
|
|
1176
714
|
inst._zod.parse = (payload, ctx) => {
|
|
1177
715
|
const input = payload.value;
|
|
@@ -1206,7 +744,7 @@ const $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
1206
744
|
});
|
|
1207
745
|
function handleObjectResult(result, final, key) {
|
|
1208
746
|
if (result.issues.length) {
|
|
1209
|
-
final.issues.push(...prefixIssues(key, result.issues));
|
|
747
|
+
final.issues.push(...parse$1.prefixIssues(key, result.issues));
|
|
1210
748
|
}
|
|
1211
749
|
final.value[key] = result.value;
|
|
1212
750
|
}
|
|
@@ -1219,7 +757,7 @@ function handleOptionalObjectResult(result, final, key, input) {
|
|
|
1219
757
|
final.value[key] = result.value;
|
|
1220
758
|
}
|
|
1221
759
|
} else {
|
|
1222
|
-
final.issues.push(...prefixIssues(key, result.issues));
|
|
760
|
+
final.issues.push(...parse$1.prefixIssues(key, result.issues));
|
|
1223
761
|
}
|
|
1224
762
|
} else if (result.value === void 0) {
|
|
1225
763
|
if (key in input)
|
|
@@ -1228,16 +766,16 @@ function handleOptionalObjectResult(result, final, key, input) {
|
|
|
1228
766
|
final.value[key] = result.value;
|
|
1229
767
|
}
|
|
1230
768
|
}
|
|
1231
|
-
const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
769
|
+
const $ZodObject = /* @__PURE__ */ parse$1.$constructor("$ZodObject", (inst, def) => {
|
|
1232
770
|
$ZodType.init(inst, def);
|
|
1233
|
-
const _normalized = cached(() => {
|
|
771
|
+
const _normalized = parse$1.cached(() => {
|
|
1234
772
|
const keys = Object.keys(def.shape);
|
|
1235
773
|
for (const k of keys) {
|
|
1236
774
|
if (!(def.shape[k] instanceof $ZodType)) {
|
|
1237
775
|
throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
|
|
1238
776
|
}
|
|
1239
777
|
}
|
|
1240
|
-
const okeys = optionalKeys(def.shape);
|
|
778
|
+
const okeys = parse$1.optionalKeys(def.shape);
|
|
1241
779
|
return {
|
|
1242
780
|
shape: def.shape,
|
|
1243
781
|
keys,
|
|
@@ -1246,7 +784,7 @@ const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
1246
784
|
optionalKeys: new Set(okeys)
|
|
1247
785
|
};
|
|
1248
786
|
});
|
|
1249
|
-
defineLazy(inst._zod, "propValues", () => {
|
|
787
|
+
parse$1.defineLazy(inst._zod, "propValues", () => {
|
|
1250
788
|
const shape = def.shape;
|
|
1251
789
|
const propValues = {};
|
|
1252
790
|
for (const key in shape) {
|
|
@@ -1261,22 +799,22 @@ const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
1261
799
|
});
|
|
1262
800
|
const generateFastpass = (shape) => {
|
|
1263
801
|
const doc = new Doc(["shape", "payload", "ctx"]);
|
|
1264
|
-
const { keys, optionalKeys
|
|
802
|
+
const { keys, optionalKeys } = _normalized.value;
|
|
1265
803
|
const parseStr = (key) => {
|
|
1266
|
-
const k = esc(key);
|
|
804
|
+
const k = parse$1.esc(key);
|
|
1267
805
|
return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
1268
806
|
};
|
|
1269
807
|
doc.write(`const input = payload.value;`);
|
|
1270
808
|
const ids = /* @__PURE__ */ Object.create(null);
|
|
1271
809
|
for (const key of keys) {
|
|
1272
|
-
ids[key] = randomString(15);
|
|
810
|
+
ids[key] = parse$1.randomString(15);
|
|
1273
811
|
}
|
|
1274
812
|
doc.write(`const newResult = {}`);
|
|
1275
813
|
for (const key of keys) {
|
|
1276
|
-
if (
|
|
814
|
+
if (optionalKeys.has(key)) {
|
|
1277
815
|
const id = ids[key];
|
|
1278
816
|
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
1279
|
-
const k = esc(key);
|
|
817
|
+
const k = parse$1.esc(key);
|
|
1280
818
|
doc.write(`
|
|
1281
819
|
if (${id}.issues.length) {
|
|
1282
820
|
if (input[${k}] === undefined) {
|
|
@@ -1303,9 +841,9 @@ const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
1303
841
|
doc.write(`
|
|
1304
842
|
if (${id}.issues.length) payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
1305
843
|
...iss,
|
|
1306
|
-
path: iss.path ? [${esc(key)}, ...iss.path] : [${esc(key)}]
|
|
844
|
+
path: iss.path ? [${parse$1.esc(key)}, ...iss.path] : [${parse$1.esc(key)}]
|
|
1307
845
|
})));`);
|
|
1308
|
-
doc.write(`newResult[${esc(key)}] = ${id}.value`);
|
|
846
|
+
doc.write(`newResult[${parse$1.esc(key)}] = ${id}.value`);
|
|
1309
847
|
}
|
|
1310
848
|
}
|
|
1311
849
|
doc.write(`payload.value = newResult;`);
|
|
@@ -1314,16 +852,16 @@ const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
1314
852
|
return (payload, ctx) => fn(shape, payload, ctx);
|
|
1315
853
|
};
|
|
1316
854
|
let fastpass;
|
|
1317
|
-
const isObject
|
|
1318
|
-
const jit = !globalConfig.jitless;
|
|
1319
|
-
const allowsEval
|
|
1320
|
-
const fastEnabled = jit && allowsEval
|
|
855
|
+
const isObject = parse$1.isObject;
|
|
856
|
+
const jit = !parse$1.globalConfig.jitless;
|
|
857
|
+
const allowsEval = parse$1.allowsEval;
|
|
858
|
+
const fastEnabled = jit && allowsEval.value;
|
|
1321
859
|
const { catchall } = def;
|
|
1322
860
|
let value;
|
|
1323
861
|
inst._zod.parse = (payload, ctx) => {
|
|
1324
862
|
value ?? (value = _normalized.value);
|
|
1325
863
|
const input = payload.value;
|
|
1326
|
-
if (!isObject
|
|
864
|
+
if (!isObject(input)) {
|
|
1327
865
|
payload.issues.push({
|
|
1328
866
|
expected: "object",
|
|
1329
867
|
code: "invalid_type",
|
|
@@ -1346,12 +884,10 @@ const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
1346
884
|
const isOptional = el._zod.optin === "optional" && el._zod.optout === "optional";
|
|
1347
885
|
if (r instanceof Promise) {
|
|
1348
886
|
proms.push(r.then((r2) => isOptional ? handleOptionalObjectResult(r2, payload, key, input) : handleObjectResult(r2, payload, key)));
|
|
887
|
+
} else if (isOptional) {
|
|
888
|
+
handleOptionalObjectResult(r, payload, key, input);
|
|
1349
889
|
} else {
|
|
1350
|
-
|
|
1351
|
-
handleOptionalObjectResult(r, payload, key, input);
|
|
1352
|
-
} else {
|
|
1353
|
-
handleObjectResult(r, payload, key);
|
|
1354
|
-
}
|
|
890
|
+
handleObjectResult(r, payload, key);
|
|
1355
891
|
}
|
|
1356
892
|
}
|
|
1357
893
|
}
|
|
@@ -1402,22 +938,22 @@ function handleUnionResults(results, final, inst, ctx) {
|
|
|
1402
938
|
code: "invalid_union",
|
|
1403
939
|
input: final.value,
|
|
1404
940
|
inst,
|
|
1405
|
-
errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
941
|
+
errors: results.map((result) => result.issues.map((iss) => parse$1.finalizeIssue(iss, ctx, parse$1.config())))
|
|
1406
942
|
});
|
|
1407
943
|
return final;
|
|
1408
944
|
}
|
|
1409
|
-
const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
945
|
+
const $ZodUnion = /* @__PURE__ */ parse$1.$constructor("$ZodUnion", (inst, def) => {
|
|
1410
946
|
$ZodType.init(inst, def);
|
|
1411
|
-
defineLazy(inst._zod, "values", () => {
|
|
947
|
+
parse$1.defineLazy(inst._zod, "values", () => {
|
|
1412
948
|
if (def.options.every((o) => o._zod.values)) {
|
|
1413
949
|
return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
1414
950
|
}
|
|
1415
951
|
return void 0;
|
|
1416
952
|
});
|
|
1417
|
-
defineLazy(inst._zod, "pattern", () => {
|
|
953
|
+
parse$1.defineLazy(inst._zod, "pattern", () => {
|
|
1418
954
|
if (def.options.every((o) => o._zod.pattern)) {
|
|
1419
955
|
const patterns = def.options.map((o) => o._zod.pattern);
|
|
1420
|
-
return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
|
|
956
|
+
return new RegExp(`^(${patterns.map((p) => parse$1.cleanRegex(p.source)).join("|")})$`);
|
|
1421
957
|
}
|
|
1422
958
|
return void 0;
|
|
1423
959
|
});
|
|
@@ -1445,7 +981,7 @@ const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
|
1445
981
|
});
|
|
1446
982
|
};
|
|
1447
983
|
});
|
|
1448
|
-
const $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
|
|
984
|
+
const $ZodIntersection = /* @__PURE__ */ parse$1.$constructor("$ZodIntersection", (inst, def) => {
|
|
1449
985
|
$ZodType.init(inst, def);
|
|
1450
986
|
inst._zod.parse = (payload, ctx) => {
|
|
1451
987
|
const { value: input } = payload;
|
|
@@ -1467,7 +1003,7 @@ function mergeValues(a, b) {
|
|
|
1467
1003
|
if (a instanceof Date && b instanceof Date && +a === +b) {
|
|
1468
1004
|
return { valid: true, data: a };
|
|
1469
1005
|
}
|
|
1470
|
-
if (isPlainObject(a) && isPlainObject(b)) {
|
|
1006
|
+
if (parse$1.isPlainObject(a) && parse$1.isPlainObject(b)) {
|
|
1471
1007
|
const bKeys = Object.keys(b);
|
|
1472
1008
|
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
1473
1009
|
const newObj = { ...a, ...b };
|
|
@@ -1511,7 +1047,7 @@ function handleIntersectionResults(result, left, right) {
|
|
|
1511
1047
|
if (right.issues.length) {
|
|
1512
1048
|
result.issues.push(...right.issues);
|
|
1513
1049
|
}
|
|
1514
|
-
if (aborted(result))
|
|
1050
|
+
if (parse$1.aborted(result))
|
|
1515
1051
|
return result;
|
|
1516
1052
|
const merged = mergeValues(left.value, right.value);
|
|
1517
1053
|
if (!merged.valid) {
|
|
@@ -1520,11 +1056,11 @@ function handleIntersectionResults(result, left, right) {
|
|
|
1520
1056
|
result.value = merged.data;
|
|
1521
1057
|
return result;
|
|
1522
1058
|
}
|
|
1523
|
-
const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
1059
|
+
const $ZodEnum = /* @__PURE__ */ parse$1.$constructor("$ZodEnum", (inst, def) => {
|
|
1524
1060
|
$ZodType.init(inst, def);
|
|
1525
|
-
const values = getEnumValues(def.entries);
|
|
1061
|
+
const values = parse$1.getEnumValues(def.entries);
|
|
1526
1062
|
inst._zod.values = new Set(values);
|
|
1527
|
-
inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
|
|
1063
|
+
inst._zod.pattern = new RegExp(`^(${values.filter((k) => parse$1.propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? parse$1.escapeRegex(o) : o.toString()).join("|")})$`);
|
|
1528
1064
|
inst._zod.parse = (payload, _ctx) => {
|
|
1529
1065
|
const input = payload.value;
|
|
1530
1066
|
if (inst._zod.values.has(input)) {
|
|
@@ -1539,7 +1075,7 @@ const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
|
1539
1075
|
return payload;
|
|
1540
1076
|
};
|
|
1541
1077
|
});
|
|
1542
|
-
const $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
|
|
1078
|
+
const $ZodTransform = /* @__PURE__ */ parse$1.$constructor("$ZodTransform", (inst, def) => {
|
|
1543
1079
|
$ZodType.init(inst, def);
|
|
1544
1080
|
inst._zod.parse = (payload, _ctx) => {
|
|
1545
1081
|
const _out = def.transform(payload.value, payload);
|
|
@@ -1551,22 +1087,22 @@ const $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def)
|
|
|
1551
1087
|
});
|
|
1552
1088
|
}
|
|
1553
1089
|
if (_out instanceof Promise) {
|
|
1554
|
-
throw new $ZodAsyncError();
|
|
1090
|
+
throw new parse$1.$ZodAsyncError();
|
|
1555
1091
|
}
|
|
1556
1092
|
payload.value = _out;
|
|
1557
1093
|
return payload;
|
|
1558
1094
|
};
|
|
1559
1095
|
});
|
|
1560
|
-
const $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
|
|
1096
|
+
const $ZodOptional = /* @__PURE__ */ parse$1.$constructor("$ZodOptional", (inst, def) => {
|
|
1561
1097
|
$ZodType.init(inst, def);
|
|
1562
1098
|
inst._zod.optin = "optional";
|
|
1563
1099
|
inst._zod.optout = "optional";
|
|
1564
|
-
defineLazy(inst._zod, "values", () => {
|
|
1100
|
+
parse$1.defineLazy(inst._zod, "values", () => {
|
|
1565
1101
|
return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, void 0]) : void 0;
|
|
1566
1102
|
});
|
|
1567
|
-
defineLazy(inst._zod, "pattern", () => {
|
|
1103
|
+
parse$1.defineLazy(inst._zod, "pattern", () => {
|
|
1568
1104
|
const pattern = def.innerType._zod.pattern;
|
|
1569
|
-
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
|
|
1105
|
+
return pattern ? new RegExp(`^(${parse$1.cleanRegex(pattern.source)})?$`) : void 0;
|
|
1570
1106
|
});
|
|
1571
1107
|
inst._zod.parse = (payload, ctx) => {
|
|
1572
1108
|
if (payload.value === void 0) {
|
|
@@ -1575,15 +1111,15 @@ const $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) =>
|
|
|
1575
1111
|
return def.innerType._zod.run(payload, ctx);
|
|
1576
1112
|
};
|
|
1577
1113
|
});
|
|
1578
|
-
const $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
|
|
1114
|
+
const $ZodNullable = /* @__PURE__ */ parse$1.$constructor("$ZodNullable", (inst, def) => {
|
|
1579
1115
|
$ZodType.init(inst, def);
|
|
1580
|
-
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
1581
|
-
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
1582
|
-
defineLazy(inst._zod, "pattern", () => {
|
|
1116
|
+
parse$1.defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
1117
|
+
parse$1.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
1118
|
+
parse$1.defineLazy(inst._zod, "pattern", () => {
|
|
1583
1119
|
const pattern = def.innerType._zod.pattern;
|
|
1584
|
-
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
|
|
1120
|
+
return pattern ? new RegExp(`^(${parse$1.cleanRegex(pattern.source)}|null)$`) : void 0;
|
|
1585
1121
|
});
|
|
1586
|
-
defineLazy(inst._zod, "values", () => {
|
|
1122
|
+
parse$1.defineLazy(inst._zod, "values", () => {
|
|
1587
1123
|
return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, null]) : void 0;
|
|
1588
1124
|
});
|
|
1589
1125
|
inst._zod.parse = (payload, ctx) => {
|
|
@@ -1592,10 +1128,10 @@ const $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) =>
|
|
|
1592
1128
|
return def.innerType._zod.run(payload, ctx);
|
|
1593
1129
|
};
|
|
1594
1130
|
});
|
|
1595
|
-
const $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
|
|
1131
|
+
const $ZodDefault = /* @__PURE__ */ parse$1.$constructor("$ZodDefault", (inst, def) => {
|
|
1596
1132
|
$ZodType.init(inst, def);
|
|
1597
1133
|
inst._zod.optin = "optional";
|
|
1598
|
-
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
1134
|
+
parse$1.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
1599
1135
|
inst._zod.parse = (payload, ctx) => {
|
|
1600
1136
|
if (payload.value === void 0) {
|
|
1601
1137
|
payload.value = def.defaultValue;
|
|
@@ -1614,10 +1150,10 @@ function handleDefaultResult(payload, def) {
|
|
|
1614
1150
|
}
|
|
1615
1151
|
return payload;
|
|
1616
1152
|
}
|
|
1617
|
-
const $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
|
|
1153
|
+
const $ZodPrefault = /* @__PURE__ */ parse$1.$constructor("$ZodPrefault", (inst, def) => {
|
|
1618
1154
|
$ZodType.init(inst, def);
|
|
1619
1155
|
inst._zod.optin = "optional";
|
|
1620
|
-
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
1156
|
+
parse$1.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
1621
1157
|
inst._zod.parse = (payload, ctx) => {
|
|
1622
1158
|
if (payload.value === void 0) {
|
|
1623
1159
|
payload.value = def.defaultValue;
|
|
@@ -1625,9 +1161,9 @@ const $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) =>
|
|
|
1625
1161
|
return def.innerType._zod.run(payload, ctx);
|
|
1626
1162
|
};
|
|
1627
1163
|
});
|
|
1628
|
-
const $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
|
|
1164
|
+
const $ZodNonOptional = /* @__PURE__ */ parse$1.$constructor("$ZodNonOptional", (inst, def) => {
|
|
1629
1165
|
$ZodType.init(inst, def);
|
|
1630
|
-
defineLazy(inst._zod, "values", () => {
|
|
1166
|
+
parse$1.defineLazy(inst._zod, "values", () => {
|
|
1631
1167
|
const v = def.innerType._zod.values;
|
|
1632
1168
|
return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
|
|
1633
1169
|
});
|
|
@@ -1650,11 +1186,11 @@ function handleNonOptionalResult(payload, inst) {
|
|
|
1650
1186
|
}
|
|
1651
1187
|
return payload;
|
|
1652
1188
|
}
|
|
1653
|
-
const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
1189
|
+
const $ZodCatch = /* @__PURE__ */ parse$1.$constructor("$ZodCatch", (inst, def) => {
|
|
1654
1190
|
$ZodType.init(inst, def);
|
|
1655
|
-
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
1656
|
-
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
1657
|
-
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
1191
|
+
parse$1.defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
1192
|
+
parse$1.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
1193
|
+
parse$1.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
1658
1194
|
inst._zod.parse = (payload, ctx) => {
|
|
1659
1195
|
const result = def.innerType._zod.run(payload, ctx);
|
|
1660
1196
|
if (result instanceof Promise) {
|
|
@@ -1664,7 +1200,7 @@ const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
|
1664
1200
|
payload.value = def.catchValue({
|
|
1665
1201
|
...payload,
|
|
1666
1202
|
error: {
|
|
1667
|
-
issues: result2.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
1203
|
+
issues: result2.issues.map((iss) => parse$1.finalizeIssue(iss, ctx, parse$1.config()))
|
|
1668
1204
|
},
|
|
1669
1205
|
input: payload.value
|
|
1670
1206
|
});
|
|
@@ -1678,7 +1214,7 @@ const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
|
1678
1214
|
payload.value = def.catchValue({
|
|
1679
1215
|
...payload,
|
|
1680
1216
|
error: {
|
|
1681
|
-
issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
1217
|
+
issues: result.issues.map((iss) => parse$1.finalizeIssue(iss, ctx, parse$1.config()))
|
|
1682
1218
|
},
|
|
1683
1219
|
input: payload.value
|
|
1684
1220
|
});
|
|
@@ -1687,11 +1223,11 @@ const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
|
1687
1223
|
return payload;
|
|
1688
1224
|
};
|
|
1689
1225
|
});
|
|
1690
|
-
const $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
|
|
1226
|
+
const $ZodPipe = /* @__PURE__ */ parse$1.$constructor("$ZodPipe", (inst, def) => {
|
|
1691
1227
|
$ZodType.init(inst, def);
|
|
1692
|
-
defineLazy(inst._zod, "values", () => def.in._zod.values);
|
|
1693
|
-
defineLazy(inst._zod, "optin", () => def.in._zod.optin);
|
|
1694
|
-
defineLazy(inst._zod, "optout", () => def.out._zod.optout);
|
|
1228
|
+
parse$1.defineLazy(inst._zod, "values", () => def.in._zod.values);
|
|
1229
|
+
parse$1.defineLazy(inst._zod, "optin", () => def.in._zod.optin);
|
|
1230
|
+
parse$1.defineLazy(inst._zod, "optout", () => def.out._zod.optout);
|
|
1695
1231
|
inst._zod.parse = (payload, ctx) => {
|
|
1696
1232
|
const left = def.in._zod.run(payload, ctx);
|
|
1697
1233
|
if (left instanceof Promise) {
|
|
@@ -1701,16 +1237,16 @@ const $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
|
|
|
1701
1237
|
};
|
|
1702
1238
|
});
|
|
1703
1239
|
function handlePipeResult(left, def, ctx) {
|
|
1704
|
-
if (aborted(left)) {
|
|
1240
|
+
if (parse$1.aborted(left)) {
|
|
1705
1241
|
return left;
|
|
1706
1242
|
}
|
|
1707
1243
|
return def.out._zod.run({ value: left.value, issues: left.issues }, ctx);
|
|
1708
1244
|
}
|
|
1709
|
-
const $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
|
|
1245
|
+
const $ZodReadonly = /* @__PURE__ */ parse$1.$constructor("$ZodReadonly", (inst, def) => {
|
|
1710
1246
|
$ZodType.init(inst, def);
|
|
1711
|
-
defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
|
|
1712
|
-
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
1713
|
-
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
1247
|
+
parse$1.defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
|
|
1248
|
+
parse$1.defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
1249
|
+
parse$1.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
1714
1250
|
inst._zod.parse = (payload, ctx) => {
|
|
1715
1251
|
const result = def.innerType._zod.run(payload, ctx);
|
|
1716
1252
|
if (result instanceof Promise) {
|
|
@@ -1723,7 +1259,7 @@ function handleReadonlyResult(payload) {
|
|
|
1723
1259
|
payload.value = Object.freeze(payload.value);
|
|
1724
1260
|
return payload;
|
|
1725
1261
|
}
|
|
1726
|
-
const $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
|
|
1262
|
+
const $ZodCustom = /* @__PURE__ */ parse$1.$constructor("$ZodCustom", (inst, def) => {
|
|
1727
1263
|
$ZodCheck.init(inst, def);
|
|
1728
1264
|
$ZodType.init(inst, def);
|
|
1729
1265
|
inst._zod.parse = (payload, _) => {
|
|
@@ -1753,7 +1289,7 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
1753
1289
|
};
|
|
1754
1290
|
if (inst._zod.def.params)
|
|
1755
1291
|
_iss.params = inst._zod.def.params;
|
|
1756
|
-
payload.issues.push(issue(_iss));
|
|
1292
|
+
payload.issues.push(parse$1.issue(_iss));
|
|
1757
1293
|
}
|
|
1758
1294
|
}
|
|
1759
1295
|
class $ZodRegistry {
|
|
@@ -1796,7 +1332,7 @@ const globalRegistry = /* @__PURE__ */ registry();
|
|
|
1796
1332
|
function _string(Class, params) {
|
|
1797
1333
|
return new Class({
|
|
1798
1334
|
type: "string",
|
|
1799
|
-
...normalizeParams(params)
|
|
1335
|
+
...parse$1.normalizeParams(params)
|
|
1800
1336
|
});
|
|
1801
1337
|
}
|
|
1802
1338
|
function _email(Class, params) {
|
|
@@ -1805,7 +1341,7 @@ function _email(Class, params) {
|
|
|
1805
1341
|
format: "email",
|
|
1806
1342
|
check: "string_format",
|
|
1807
1343
|
abort: false,
|
|
1808
|
-
...normalizeParams(params)
|
|
1344
|
+
...parse$1.normalizeParams(params)
|
|
1809
1345
|
});
|
|
1810
1346
|
}
|
|
1811
1347
|
function _guid(Class, params) {
|
|
@@ -1814,7 +1350,7 @@ function _guid(Class, params) {
|
|
|
1814
1350
|
format: "guid",
|
|
1815
1351
|
check: "string_format",
|
|
1816
1352
|
abort: false,
|
|
1817
|
-
...normalizeParams(params)
|
|
1353
|
+
...parse$1.normalizeParams(params)
|
|
1818
1354
|
});
|
|
1819
1355
|
}
|
|
1820
1356
|
function _uuid(Class, params) {
|
|
@@ -1823,7 +1359,7 @@ function _uuid(Class, params) {
|
|
|
1823
1359
|
format: "uuid",
|
|
1824
1360
|
check: "string_format",
|
|
1825
1361
|
abort: false,
|
|
1826
|
-
...normalizeParams(params)
|
|
1362
|
+
...parse$1.normalizeParams(params)
|
|
1827
1363
|
});
|
|
1828
1364
|
}
|
|
1829
1365
|
function _uuidv4(Class, params) {
|
|
@@ -1833,7 +1369,7 @@ function _uuidv4(Class, params) {
|
|
|
1833
1369
|
check: "string_format",
|
|
1834
1370
|
abort: false,
|
|
1835
1371
|
version: "v4",
|
|
1836
|
-
...normalizeParams(params)
|
|
1372
|
+
...parse$1.normalizeParams(params)
|
|
1837
1373
|
});
|
|
1838
1374
|
}
|
|
1839
1375
|
function _uuidv6(Class, params) {
|
|
@@ -1843,7 +1379,7 @@ function _uuidv6(Class, params) {
|
|
|
1843
1379
|
check: "string_format",
|
|
1844
1380
|
abort: false,
|
|
1845
1381
|
version: "v6",
|
|
1846
|
-
...normalizeParams(params)
|
|
1382
|
+
...parse$1.normalizeParams(params)
|
|
1847
1383
|
});
|
|
1848
1384
|
}
|
|
1849
1385
|
function _uuidv7(Class, params) {
|
|
@@ -1853,7 +1389,7 @@ function _uuidv7(Class, params) {
|
|
|
1853
1389
|
check: "string_format",
|
|
1854
1390
|
abort: false,
|
|
1855
1391
|
version: "v7",
|
|
1856
|
-
...normalizeParams(params)
|
|
1392
|
+
...parse$1.normalizeParams(params)
|
|
1857
1393
|
});
|
|
1858
1394
|
}
|
|
1859
1395
|
function _url(Class, params) {
|
|
@@ -1862,7 +1398,7 @@ function _url(Class, params) {
|
|
|
1862
1398
|
format: "url",
|
|
1863
1399
|
check: "string_format",
|
|
1864
1400
|
abort: false,
|
|
1865
|
-
...normalizeParams(params)
|
|
1401
|
+
...parse$1.normalizeParams(params)
|
|
1866
1402
|
});
|
|
1867
1403
|
}
|
|
1868
1404
|
function _emoji(Class, params) {
|
|
@@ -1871,7 +1407,7 @@ function _emoji(Class, params) {
|
|
|
1871
1407
|
format: "emoji",
|
|
1872
1408
|
check: "string_format",
|
|
1873
1409
|
abort: false,
|
|
1874
|
-
...normalizeParams(params)
|
|
1410
|
+
...parse$1.normalizeParams(params)
|
|
1875
1411
|
});
|
|
1876
1412
|
}
|
|
1877
1413
|
function _nanoid(Class, params) {
|
|
@@ -1880,7 +1416,7 @@ function _nanoid(Class, params) {
|
|
|
1880
1416
|
format: "nanoid",
|
|
1881
1417
|
check: "string_format",
|
|
1882
1418
|
abort: false,
|
|
1883
|
-
...normalizeParams(params)
|
|
1419
|
+
...parse$1.normalizeParams(params)
|
|
1884
1420
|
});
|
|
1885
1421
|
}
|
|
1886
1422
|
function _cuid(Class, params) {
|
|
@@ -1889,7 +1425,7 @@ function _cuid(Class, params) {
|
|
|
1889
1425
|
format: "cuid",
|
|
1890
1426
|
check: "string_format",
|
|
1891
1427
|
abort: false,
|
|
1892
|
-
...normalizeParams(params)
|
|
1428
|
+
...parse$1.normalizeParams(params)
|
|
1893
1429
|
});
|
|
1894
1430
|
}
|
|
1895
1431
|
function _cuid2(Class, params) {
|
|
@@ -1898,7 +1434,7 @@ function _cuid2(Class, params) {
|
|
|
1898
1434
|
format: "cuid2",
|
|
1899
1435
|
check: "string_format",
|
|
1900
1436
|
abort: false,
|
|
1901
|
-
...normalizeParams(params)
|
|
1437
|
+
...parse$1.normalizeParams(params)
|
|
1902
1438
|
});
|
|
1903
1439
|
}
|
|
1904
1440
|
function _ulid(Class, params) {
|
|
@@ -1907,7 +1443,7 @@ function _ulid(Class, params) {
|
|
|
1907
1443
|
format: "ulid",
|
|
1908
1444
|
check: "string_format",
|
|
1909
1445
|
abort: false,
|
|
1910
|
-
...normalizeParams(params)
|
|
1446
|
+
...parse$1.normalizeParams(params)
|
|
1911
1447
|
});
|
|
1912
1448
|
}
|
|
1913
1449
|
function _xid(Class, params) {
|
|
@@ -1916,7 +1452,7 @@ function _xid(Class, params) {
|
|
|
1916
1452
|
format: "xid",
|
|
1917
1453
|
check: "string_format",
|
|
1918
1454
|
abort: false,
|
|
1919
|
-
...normalizeParams(params)
|
|
1455
|
+
...parse$1.normalizeParams(params)
|
|
1920
1456
|
});
|
|
1921
1457
|
}
|
|
1922
1458
|
function _ksuid(Class, params) {
|
|
@@ -1925,7 +1461,7 @@ function _ksuid(Class, params) {
|
|
|
1925
1461
|
format: "ksuid",
|
|
1926
1462
|
check: "string_format",
|
|
1927
1463
|
abort: false,
|
|
1928
|
-
...normalizeParams(params)
|
|
1464
|
+
...parse$1.normalizeParams(params)
|
|
1929
1465
|
});
|
|
1930
1466
|
}
|
|
1931
1467
|
function _ipv4(Class, params) {
|
|
@@ -1934,7 +1470,7 @@ function _ipv4(Class, params) {
|
|
|
1934
1470
|
format: "ipv4",
|
|
1935
1471
|
check: "string_format",
|
|
1936
1472
|
abort: false,
|
|
1937
|
-
...normalizeParams(params)
|
|
1473
|
+
...parse$1.normalizeParams(params)
|
|
1938
1474
|
});
|
|
1939
1475
|
}
|
|
1940
1476
|
function _ipv6(Class, params) {
|
|
@@ -1943,7 +1479,7 @@ function _ipv6(Class, params) {
|
|
|
1943
1479
|
format: "ipv6",
|
|
1944
1480
|
check: "string_format",
|
|
1945
1481
|
abort: false,
|
|
1946
|
-
...normalizeParams(params)
|
|
1482
|
+
...parse$1.normalizeParams(params)
|
|
1947
1483
|
});
|
|
1948
1484
|
}
|
|
1949
1485
|
function _cidrv4(Class, params) {
|
|
@@ -1952,7 +1488,7 @@ function _cidrv4(Class, params) {
|
|
|
1952
1488
|
format: "cidrv4",
|
|
1953
1489
|
check: "string_format",
|
|
1954
1490
|
abort: false,
|
|
1955
|
-
...normalizeParams(params)
|
|
1491
|
+
...parse$1.normalizeParams(params)
|
|
1956
1492
|
});
|
|
1957
1493
|
}
|
|
1958
1494
|
function _cidrv6(Class, params) {
|
|
@@ -1961,7 +1497,7 @@ function _cidrv6(Class, params) {
|
|
|
1961
1497
|
format: "cidrv6",
|
|
1962
1498
|
check: "string_format",
|
|
1963
1499
|
abort: false,
|
|
1964
|
-
...normalizeParams(params)
|
|
1500
|
+
...parse$1.normalizeParams(params)
|
|
1965
1501
|
});
|
|
1966
1502
|
}
|
|
1967
1503
|
function _base64(Class, params) {
|
|
@@ -1970,7 +1506,7 @@ function _base64(Class, params) {
|
|
|
1970
1506
|
format: "base64",
|
|
1971
1507
|
check: "string_format",
|
|
1972
1508
|
abort: false,
|
|
1973
|
-
...normalizeParams(params)
|
|
1509
|
+
...parse$1.normalizeParams(params)
|
|
1974
1510
|
});
|
|
1975
1511
|
}
|
|
1976
1512
|
function _base64url(Class, params) {
|
|
@@ -1979,7 +1515,7 @@ function _base64url(Class, params) {
|
|
|
1979
1515
|
format: "base64url",
|
|
1980
1516
|
check: "string_format",
|
|
1981
1517
|
abort: false,
|
|
1982
|
-
...normalizeParams(params)
|
|
1518
|
+
...parse$1.normalizeParams(params)
|
|
1983
1519
|
});
|
|
1984
1520
|
}
|
|
1985
1521
|
function _e164(Class, params) {
|
|
@@ -1988,7 +1524,7 @@ function _e164(Class, params) {
|
|
|
1988
1524
|
format: "e164",
|
|
1989
1525
|
check: "string_format",
|
|
1990
1526
|
abort: false,
|
|
1991
|
-
...normalizeParams(params)
|
|
1527
|
+
...parse$1.normalizeParams(params)
|
|
1992
1528
|
});
|
|
1993
1529
|
}
|
|
1994
1530
|
function _jwt(Class, params) {
|
|
@@ -1997,7 +1533,7 @@ function _jwt(Class, params) {
|
|
|
1997
1533
|
format: "jwt",
|
|
1998
1534
|
check: "string_format",
|
|
1999
1535
|
abort: false,
|
|
2000
|
-
...normalizeParams(params)
|
|
1536
|
+
...parse$1.normalizeParams(params)
|
|
2001
1537
|
});
|
|
2002
1538
|
}
|
|
2003
1539
|
function _isoDateTime(Class, params) {
|
|
@@ -2008,7 +1544,7 @@ function _isoDateTime(Class, params) {
|
|
|
2008
1544
|
offset: false,
|
|
2009
1545
|
local: false,
|
|
2010
1546
|
precision: null,
|
|
2011
|
-
...normalizeParams(params)
|
|
1547
|
+
...parse$1.normalizeParams(params)
|
|
2012
1548
|
});
|
|
2013
1549
|
}
|
|
2014
1550
|
function _isoDate(Class, params) {
|
|
@@ -2016,7 +1552,7 @@ function _isoDate(Class, params) {
|
|
|
2016
1552
|
type: "string",
|
|
2017
1553
|
format: "date",
|
|
2018
1554
|
check: "string_format",
|
|
2019
|
-
...normalizeParams(params)
|
|
1555
|
+
...parse$1.normalizeParams(params)
|
|
2020
1556
|
});
|
|
2021
1557
|
}
|
|
2022
1558
|
function _isoTime(Class, params) {
|
|
@@ -2025,7 +1561,7 @@ function _isoTime(Class, params) {
|
|
|
2025
1561
|
format: "time",
|
|
2026
1562
|
check: "string_format",
|
|
2027
1563
|
precision: null,
|
|
2028
|
-
...normalizeParams(params)
|
|
1564
|
+
...parse$1.normalizeParams(params)
|
|
2029
1565
|
});
|
|
2030
1566
|
}
|
|
2031
1567
|
function _isoDuration(Class, params) {
|
|
@@ -2033,7 +1569,7 @@ function _isoDuration(Class, params) {
|
|
|
2033
1569
|
type: "string",
|
|
2034
1570
|
format: "duration",
|
|
2035
1571
|
check: "string_format",
|
|
2036
|
-
...normalizeParams(params)
|
|
1572
|
+
...parse$1.normalizeParams(params)
|
|
2037
1573
|
});
|
|
2038
1574
|
}
|
|
2039
1575
|
function _unknown(Class) {
|
|
@@ -2044,13 +1580,13 @@ function _unknown(Class) {
|
|
|
2044
1580
|
function _never(Class, params) {
|
|
2045
1581
|
return new Class({
|
|
2046
1582
|
type: "never",
|
|
2047
|
-
...normalizeParams(params)
|
|
1583
|
+
...parse$1.normalizeParams(params)
|
|
2048
1584
|
});
|
|
2049
1585
|
}
|
|
2050
1586
|
function _maxLength(maximum, params) {
|
|
2051
1587
|
const ch = new $ZodCheckMaxLength({
|
|
2052
1588
|
check: "max_length",
|
|
2053
|
-
...normalizeParams(params),
|
|
1589
|
+
...parse$1.normalizeParams(params),
|
|
2054
1590
|
maximum
|
|
2055
1591
|
});
|
|
2056
1592
|
return ch;
|
|
@@ -2058,14 +1594,14 @@ function _maxLength(maximum, params) {
|
|
|
2058
1594
|
function _minLength(minimum, params) {
|
|
2059
1595
|
return new $ZodCheckMinLength({
|
|
2060
1596
|
check: "min_length",
|
|
2061
|
-
...normalizeParams(params),
|
|
1597
|
+
...parse$1.normalizeParams(params),
|
|
2062
1598
|
minimum
|
|
2063
1599
|
});
|
|
2064
1600
|
}
|
|
2065
1601
|
function _length(length, params) {
|
|
2066
1602
|
return new $ZodCheckLengthEquals({
|
|
2067
1603
|
check: "length_equals",
|
|
2068
|
-
...normalizeParams(params),
|
|
1604
|
+
...parse$1.normalizeParams(params),
|
|
2069
1605
|
length
|
|
2070
1606
|
});
|
|
2071
1607
|
}
|
|
@@ -2073,7 +1609,7 @@ function _regex(pattern, params) {
|
|
|
2073
1609
|
return new $ZodCheckRegex({
|
|
2074
1610
|
check: "string_format",
|
|
2075
1611
|
format: "regex",
|
|
2076
|
-
...normalizeParams(params),
|
|
1612
|
+
...parse$1.normalizeParams(params),
|
|
2077
1613
|
pattern
|
|
2078
1614
|
});
|
|
2079
1615
|
}
|
|
@@ -2081,21 +1617,21 @@ function _lowercase(params) {
|
|
|
2081
1617
|
return new $ZodCheckLowerCase({
|
|
2082
1618
|
check: "string_format",
|
|
2083
1619
|
format: "lowercase",
|
|
2084
|
-
...normalizeParams(params)
|
|
1620
|
+
...parse$1.normalizeParams(params)
|
|
2085
1621
|
});
|
|
2086
1622
|
}
|
|
2087
1623
|
function _uppercase(params) {
|
|
2088
1624
|
return new $ZodCheckUpperCase({
|
|
2089
1625
|
check: "string_format",
|
|
2090
1626
|
format: "uppercase",
|
|
2091
|
-
...normalizeParams(params)
|
|
1627
|
+
...parse$1.normalizeParams(params)
|
|
2092
1628
|
});
|
|
2093
1629
|
}
|
|
2094
1630
|
function _includes(includes, params) {
|
|
2095
1631
|
return new $ZodCheckIncludes({
|
|
2096
1632
|
check: "string_format",
|
|
2097
1633
|
format: "includes",
|
|
2098
|
-
...normalizeParams(params),
|
|
1634
|
+
...parse$1.normalizeParams(params),
|
|
2099
1635
|
includes
|
|
2100
1636
|
});
|
|
2101
1637
|
}
|
|
@@ -2103,7 +1639,7 @@ function _startsWith(prefix, params) {
|
|
|
2103
1639
|
return new $ZodCheckStartsWith({
|
|
2104
1640
|
check: "string_format",
|
|
2105
1641
|
format: "starts_with",
|
|
2106
|
-
...normalizeParams(params),
|
|
1642
|
+
...parse$1.normalizeParams(params),
|
|
2107
1643
|
prefix
|
|
2108
1644
|
});
|
|
2109
1645
|
}
|
|
@@ -2111,7 +1647,7 @@ function _endsWith(suffix, params) {
|
|
|
2111
1647
|
return new $ZodCheckEndsWith({
|
|
2112
1648
|
check: "string_format",
|
|
2113
1649
|
format: "ends_with",
|
|
2114
|
-
...normalizeParams(params),
|
|
1650
|
+
...parse$1.normalizeParams(params),
|
|
2115
1651
|
suffix
|
|
2116
1652
|
});
|
|
2117
1653
|
}
|
|
@@ -2140,7 +1676,7 @@ function _array(Class, element, params) {
|
|
|
2140
1676
|
// get element() {
|
|
2141
1677
|
// return element;
|
|
2142
1678
|
// },
|
|
2143
|
-
...normalizeParams(params)
|
|
1679
|
+
...parse$1.normalizeParams(params)
|
|
2144
1680
|
});
|
|
2145
1681
|
}
|
|
2146
1682
|
function _refine(Class, fn, _params) {
|
|
@@ -2148,32 +1684,32 @@ function _refine(Class, fn, _params) {
|
|
|
2148
1684
|
type: "custom",
|
|
2149
1685
|
check: "custom",
|
|
2150
1686
|
fn,
|
|
2151
|
-
...normalizeParams(_params)
|
|
1687
|
+
...parse$1.normalizeParams(_params)
|
|
2152
1688
|
});
|
|
2153
1689
|
return schema;
|
|
2154
1690
|
}
|
|
2155
|
-
const ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
|
|
1691
|
+
const ZodISODateTime = /* @__PURE__ */ parse$1.$constructor("ZodISODateTime", (inst, def) => {
|
|
2156
1692
|
$ZodISODateTime.init(inst, def);
|
|
2157
1693
|
ZodStringFormat.init(inst, def);
|
|
2158
1694
|
});
|
|
2159
1695
|
function datetime(params) {
|
|
2160
1696
|
return _isoDateTime(ZodISODateTime, params);
|
|
2161
1697
|
}
|
|
2162
|
-
const ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => {
|
|
1698
|
+
const ZodISODate = /* @__PURE__ */ parse$1.$constructor("ZodISODate", (inst, def) => {
|
|
2163
1699
|
$ZodISODate.init(inst, def);
|
|
2164
1700
|
ZodStringFormat.init(inst, def);
|
|
2165
1701
|
});
|
|
2166
1702
|
function date(params) {
|
|
2167
1703
|
return _isoDate(ZodISODate, params);
|
|
2168
1704
|
}
|
|
2169
|
-
const ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => {
|
|
1705
|
+
const ZodISOTime = /* @__PURE__ */ parse$1.$constructor("ZodISOTime", (inst, def) => {
|
|
2170
1706
|
$ZodISOTime.init(inst, def);
|
|
2171
1707
|
ZodStringFormat.init(inst, def);
|
|
2172
1708
|
});
|
|
2173
1709
|
function time(params) {
|
|
2174
1710
|
return _isoTime(ZodISOTime, params);
|
|
2175
1711
|
}
|
|
2176
|
-
const ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def) => {
|
|
1712
|
+
const ZodISODuration = /* @__PURE__ */ parse$1.$constructor("ZodISODuration", (inst, def) => {
|
|
2177
1713
|
$ZodISODuration.init(inst, def);
|
|
2178
1714
|
ZodStringFormat.init(inst, def);
|
|
2179
1715
|
});
|
|
@@ -2181,19 +1717,19 @@ function duration(params) {
|
|
|
2181
1717
|
return _isoDuration(ZodISODuration, params);
|
|
2182
1718
|
}
|
|
2183
1719
|
const initializer = (inst, issues) => {
|
|
2184
|
-
$ZodError.init(inst, issues);
|
|
1720
|
+
parse$1.$ZodError.init(inst, issues);
|
|
2185
1721
|
inst.name = "ZodError";
|
|
2186
1722
|
Object.defineProperties(inst, {
|
|
2187
1723
|
format: {
|
|
2188
|
-
value: (mapper) => formatError(inst, mapper)
|
|
1724
|
+
value: (mapper) => parse$1.formatError(inst, mapper)
|
|
2189
1725
|
// enumerable: false,
|
|
2190
1726
|
},
|
|
2191
1727
|
flatten: {
|
|
2192
|
-
value: (mapper) => flattenError(inst, mapper)
|
|
1728
|
+
value: (mapper) => parse$1.flattenError(inst, mapper)
|
|
2193
1729
|
// enumerable: false,
|
|
2194
1730
|
},
|
|
2195
1731
|
addIssue: {
|
|
2196
|
-
value: (
|
|
1732
|
+
value: (issue) => inst.issues.push(issue)
|
|
2197
1733
|
// enumerable: false,
|
|
2198
1734
|
},
|
|
2199
1735
|
addIssues: {
|
|
@@ -2208,14 +1744,14 @@ const initializer = (inst, issues) => {
|
|
|
2208
1744
|
}
|
|
2209
1745
|
});
|
|
2210
1746
|
};
|
|
2211
|
-
const ZodRealError = $constructor("ZodError", initializer, {
|
|
1747
|
+
const ZodRealError = parse$1.$constructor("ZodError", initializer, {
|
|
2212
1748
|
Parent: Error
|
|
2213
1749
|
});
|
|
2214
|
-
const parse = /* @__PURE__ */ _parse(ZodRealError);
|
|
2215
|
-
const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
2216
|
-
const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
2217
|
-
const safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError);
|
|
2218
|
-
const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
1750
|
+
const parse = /* @__PURE__ */ parse$1._parse(ZodRealError);
|
|
1751
|
+
const parseAsync = /* @__PURE__ */ parse$1._parseAsync(ZodRealError);
|
|
1752
|
+
const safeParse = /* @__PURE__ */ parse$1._safeParse(ZodRealError);
|
|
1753
|
+
const safeParseAsync = /* @__PURE__ */ parse$1._safeParseAsync(ZodRealError);
|
|
1754
|
+
const ZodType = /* @__PURE__ */ parse$1.$constructor("ZodType", (inst, def) => {
|
|
2219
1755
|
$ZodType.init(inst, def);
|
|
2220
1756
|
inst.def = def;
|
|
2221
1757
|
Object.defineProperty(inst, "_def", { value: def });
|
|
@@ -2231,7 +1767,7 @@ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
2231
1767
|
// { parent: true }
|
|
2232
1768
|
);
|
|
2233
1769
|
};
|
|
2234
|
-
inst.clone = (def2, params) => clone(inst, def2, params);
|
|
1770
|
+
inst.clone = (def2, params) => parse$1.clone(inst, def2, params);
|
|
2235
1771
|
inst.brand = () => inst;
|
|
2236
1772
|
inst.register = (reg, meta) => {
|
|
2237
1773
|
reg.add(inst, meta);
|
|
@@ -2281,7 +1817,7 @@ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
2281
1817
|
inst.isNullable = () => inst.safeParse(null).success;
|
|
2282
1818
|
return inst;
|
|
2283
1819
|
});
|
|
2284
|
-
const _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
|
|
1820
|
+
const _ZodString = /* @__PURE__ */ parse$1.$constructor("_ZodString", (inst, def) => {
|
|
2285
1821
|
$ZodString.init(inst, def);
|
|
2286
1822
|
ZodType.init(inst, def);
|
|
2287
1823
|
const bag = inst._zod.bag;
|
|
@@ -2303,7 +1839,7 @@ const _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
|
|
|
2303
1839
|
inst.toLowerCase = () => inst.check(_toLowerCase());
|
|
2304
1840
|
inst.toUpperCase = () => inst.check(_toUpperCase());
|
|
2305
1841
|
});
|
|
2306
|
-
const ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
|
|
1842
|
+
const ZodString = /* @__PURE__ */ parse$1.$constructor("ZodString", (inst, def) => {
|
|
2307
1843
|
$ZodString.init(inst, def);
|
|
2308
1844
|
_ZodString.init(inst, def);
|
|
2309
1845
|
inst.email = (params) => inst.check(_email(ZodEmail, params));
|
|
@@ -2337,104 +1873,104 @@ const ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
|
|
|
2337
1873
|
function string(params) {
|
|
2338
1874
|
return _string(ZodString, params);
|
|
2339
1875
|
}
|
|
2340
|
-
const ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (inst, def) => {
|
|
1876
|
+
const ZodStringFormat = /* @__PURE__ */ parse$1.$constructor("ZodStringFormat", (inst, def) => {
|
|
2341
1877
|
$ZodStringFormat.init(inst, def);
|
|
2342
1878
|
_ZodString.init(inst, def);
|
|
2343
1879
|
});
|
|
2344
|
-
const ZodEmail = /* @__PURE__ */ $constructor("ZodEmail", (inst, def) => {
|
|
1880
|
+
const ZodEmail = /* @__PURE__ */ parse$1.$constructor("ZodEmail", (inst, def) => {
|
|
2345
1881
|
$ZodEmail.init(inst, def);
|
|
2346
1882
|
ZodStringFormat.init(inst, def);
|
|
2347
1883
|
});
|
|
2348
1884
|
function email(params) {
|
|
2349
1885
|
return _email(ZodEmail, params);
|
|
2350
1886
|
}
|
|
2351
|
-
const ZodGUID = /* @__PURE__ */ $constructor("ZodGUID", (inst, def) => {
|
|
1887
|
+
const ZodGUID = /* @__PURE__ */ parse$1.$constructor("ZodGUID", (inst, def) => {
|
|
2352
1888
|
$ZodGUID.init(inst, def);
|
|
2353
1889
|
ZodStringFormat.init(inst, def);
|
|
2354
1890
|
});
|
|
2355
|
-
const ZodUUID = /* @__PURE__ */ $constructor("ZodUUID", (inst, def) => {
|
|
1891
|
+
const ZodUUID = /* @__PURE__ */ parse$1.$constructor("ZodUUID", (inst, def) => {
|
|
2356
1892
|
$ZodUUID.init(inst, def);
|
|
2357
1893
|
ZodStringFormat.init(inst, def);
|
|
2358
1894
|
});
|
|
2359
|
-
const ZodURL = /* @__PURE__ */ $constructor("ZodURL", (inst, def) => {
|
|
1895
|
+
const ZodURL = /* @__PURE__ */ parse$1.$constructor("ZodURL", (inst, def) => {
|
|
2360
1896
|
$ZodURL.init(inst, def);
|
|
2361
1897
|
ZodStringFormat.init(inst, def);
|
|
2362
1898
|
});
|
|
2363
|
-
const ZodEmoji = /* @__PURE__ */ $constructor("ZodEmoji", (inst, def) => {
|
|
1899
|
+
const ZodEmoji = /* @__PURE__ */ parse$1.$constructor("ZodEmoji", (inst, def) => {
|
|
2364
1900
|
$ZodEmoji.init(inst, def);
|
|
2365
1901
|
ZodStringFormat.init(inst, def);
|
|
2366
1902
|
});
|
|
2367
|
-
const ZodNanoID = /* @__PURE__ */ $constructor("ZodNanoID", (inst, def) => {
|
|
1903
|
+
const ZodNanoID = /* @__PURE__ */ parse$1.$constructor("ZodNanoID", (inst, def) => {
|
|
2368
1904
|
$ZodNanoID.init(inst, def);
|
|
2369
1905
|
ZodStringFormat.init(inst, def);
|
|
2370
1906
|
});
|
|
2371
|
-
const ZodCUID = /* @__PURE__ */ $constructor("ZodCUID", (inst, def) => {
|
|
1907
|
+
const ZodCUID = /* @__PURE__ */ parse$1.$constructor("ZodCUID", (inst, def) => {
|
|
2372
1908
|
$ZodCUID.init(inst, def);
|
|
2373
1909
|
ZodStringFormat.init(inst, def);
|
|
2374
1910
|
});
|
|
2375
|
-
const ZodCUID2 = /* @__PURE__ */ $constructor("ZodCUID2", (inst, def) => {
|
|
1911
|
+
const ZodCUID2 = /* @__PURE__ */ parse$1.$constructor("ZodCUID2", (inst, def) => {
|
|
2376
1912
|
$ZodCUID2.init(inst, def);
|
|
2377
1913
|
ZodStringFormat.init(inst, def);
|
|
2378
1914
|
});
|
|
2379
|
-
const ZodULID = /* @__PURE__ */ $constructor("ZodULID", (inst, def) => {
|
|
1915
|
+
const ZodULID = /* @__PURE__ */ parse$1.$constructor("ZodULID", (inst, def) => {
|
|
2380
1916
|
$ZodULID.init(inst, def);
|
|
2381
1917
|
ZodStringFormat.init(inst, def);
|
|
2382
1918
|
});
|
|
2383
|
-
const ZodXID = /* @__PURE__ */ $constructor("ZodXID", (inst, def) => {
|
|
1919
|
+
const ZodXID = /* @__PURE__ */ parse$1.$constructor("ZodXID", (inst, def) => {
|
|
2384
1920
|
$ZodXID.init(inst, def);
|
|
2385
1921
|
ZodStringFormat.init(inst, def);
|
|
2386
1922
|
});
|
|
2387
|
-
const ZodKSUID = /* @__PURE__ */ $constructor("ZodKSUID", (inst, def) => {
|
|
1923
|
+
const ZodKSUID = /* @__PURE__ */ parse$1.$constructor("ZodKSUID", (inst, def) => {
|
|
2388
1924
|
$ZodKSUID.init(inst, def);
|
|
2389
1925
|
ZodStringFormat.init(inst, def);
|
|
2390
1926
|
});
|
|
2391
|
-
const ZodIPv4 = /* @__PURE__ */ $constructor("ZodIPv4", (inst, def) => {
|
|
1927
|
+
const ZodIPv4 = /* @__PURE__ */ parse$1.$constructor("ZodIPv4", (inst, def) => {
|
|
2392
1928
|
$ZodIPv4.init(inst, def);
|
|
2393
1929
|
ZodStringFormat.init(inst, def);
|
|
2394
1930
|
});
|
|
2395
|
-
const ZodIPv6 = /* @__PURE__ */ $constructor("ZodIPv6", (inst, def) => {
|
|
1931
|
+
const ZodIPv6 = /* @__PURE__ */ parse$1.$constructor("ZodIPv6", (inst, def) => {
|
|
2396
1932
|
$ZodIPv6.init(inst, def);
|
|
2397
1933
|
ZodStringFormat.init(inst, def);
|
|
2398
1934
|
});
|
|
2399
|
-
const ZodCIDRv4 = /* @__PURE__ */ $constructor("ZodCIDRv4", (inst, def) => {
|
|
1935
|
+
const ZodCIDRv4 = /* @__PURE__ */ parse$1.$constructor("ZodCIDRv4", (inst, def) => {
|
|
2400
1936
|
$ZodCIDRv4.init(inst, def);
|
|
2401
1937
|
ZodStringFormat.init(inst, def);
|
|
2402
1938
|
});
|
|
2403
|
-
const ZodCIDRv6 = /* @__PURE__ */ $constructor("ZodCIDRv6", (inst, def) => {
|
|
1939
|
+
const ZodCIDRv6 = /* @__PURE__ */ parse$1.$constructor("ZodCIDRv6", (inst, def) => {
|
|
2404
1940
|
$ZodCIDRv6.init(inst, def);
|
|
2405
1941
|
ZodStringFormat.init(inst, def);
|
|
2406
1942
|
});
|
|
2407
|
-
const ZodBase64 = /* @__PURE__ */ $constructor("ZodBase64", (inst, def) => {
|
|
1943
|
+
const ZodBase64 = /* @__PURE__ */ parse$1.$constructor("ZodBase64", (inst, def) => {
|
|
2408
1944
|
$ZodBase64.init(inst, def);
|
|
2409
1945
|
ZodStringFormat.init(inst, def);
|
|
2410
1946
|
});
|
|
2411
|
-
const ZodBase64URL = /* @__PURE__ */ $constructor("ZodBase64URL", (inst, def) => {
|
|
1947
|
+
const ZodBase64URL = /* @__PURE__ */ parse$1.$constructor("ZodBase64URL", (inst, def) => {
|
|
2412
1948
|
$ZodBase64URL.init(inst, def);
|
|
2413
1949
|
ZodStringFormat.init(inst, def);
|
|
2414
1950
|
});
|
|
2415
|
-
const ZodE164 = /* @__PURE__ */ $constructor("ZodE164", (inst, def) => {
|
|
1951
|
+
const ZodE164 = /* @__PURE__ */ parse$1.$constructor("ZodE164", (inst, def) => {
|
|
2416
1952
|
$ZodE164.init(inst, def);
|
|
2417
1953
|
ZodStringFormat.init(inst, def);
|
|
2418
1954
|
});
|
|
2419
|
-
const ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
|
|
1955
|
+
const ZodJWT = /* @__PURE__ */ parse$1.$constructor("ZodJWT", (inst, def) => {
|
|
2420
1956
|
$ZodJWT.init(inst, def);
|
|
2421
1957
|
ZodStringFormat.init(inst, def);
|
|
2422
1958
|
});
|
|
2423
|
-
const ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
1959
|
+
const ZodUnknown = /* @__PURE__ */ parse$1.$constructor("ZodUnknown", (inst, def) => {
|
|
2424
1960
|
$ZodUnknown.init(inst, def);
|
|
2425
1961
|
ZodType.init(inst, def);
|
|
2426
1962
|
});
|
|
2427
1963
|
function unknown() {
|
|
2428
1964
|
return _unknown(ZodUnknown);
|
|
2429
1965
|
}
|
|
2430
|
-
const ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
|
|
1966
|
+
const ZodNever = /* @__PURE__ */ parse$1.$constructor("ZodNever", (inst, def) => {
|
|
2431
1967
|
$ZodNever.init(inst, def);
|
|
2432
1968
|
ZodType.init(inst, def);
|
|
2433
1969
|
});
|
|
2434
1970
|
function never(params) {
|
|
2435
1971
|
return _never(ZodNever, params);
|
|
2436
1972
|
}
|
|
2437
|
-
const ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
|
|
1973
|
+
const ZodArray = /* @__PURE__ */ parse$1.$constructor("ZodArray", (inst, def) => {
|
|
2438
1974
|
$ZodArray.init(inst, def);
|
|
2439
1975
|
ZodType.init(inst, def);
|
|
2440
1976
|
inst.element = def.element;
|
|
@@ -2447,12 +1983,10 @@ const ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
|
|
|
2447
1983
|
function array(element, params) {
|
|
2448
1984
|
return _array(ZodArray, element, params);
|
|
2449
1985
|
}
|
|
2450
|
-
const ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
1986
|
+
const ZodObject = /* @__PURE__ */ parse$1.$constructor("ZodObject", (inst, def) => {
|
|
2451
1987
|
$ZodObject.init(inst, def);
|
|
2452
1988
|
ZodType.init(inst, def);
|
|
2453
|
-
defineLazy(inst, "shape", () =>
|
|
2454
|
-
return Object.fromEntries(Object.entries(inst._zod.def.shape));
|
|
2455
|
-
});
|
|
1989
|
+
parse$1.defineLazy(inst, "shape", () => def.shape);
|
|
2456
1990
|
inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
|
|
2457
1991
|
inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall });
|
|
2458
1992
|
inst.passthrough = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
|
|
@@ -2460,26 +1994,26 @@ const ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
|
2460
1994
|
inst.strict = () => inst.clone({ ...inst._zod.def, catchall: never() });
|
|
2461
1995
|
inst.strip = () => inst.clone({ ...inst._zod.def, catchall: void 0 });
|
|
2462
1996
|
inst.extend = (incoming) => {
|
|
2463
|
-
return extend(inst, incoming);
|
|
1997
|
+
return parse$1.extend(inst, incoming);
|
|
2464
1998
|
};
|
|
2465
|
-
inst.merge = (other) => merge(inst, other);
|
|
2466
|
-
inst.pick = (mask) => pick(inst, mask);
|
|
2467
|
-
inst.omit = (mask) => omit(inst, mask);
|
|
2468
|
-
inst.partial = (...args) => partial(ZodOptional, inst, args[0]);
|
|
2469
|
-
inst.required = (...args) => required(ZodNonOptional, inst, args[0]);
|
|
1999
|
+
inst.merge = (other) => parse$1.merge(inst, other);
|
|
2000
|
+
inst.pick = (mask) => parse$1.pick(inst, mask);
|
|
2001
|
+
inst.omit = (mask) => parse$1.omit(inst, mask);
|
|
2002
|
+
inst.partial = (...args) => parse$1.partial(ZodOptional, inst, args[0]);
|
|
2003
|
+
inst.required = (...args) => parse$1.required(ZodNonOptional, inst, args[0]);
|
|
2470
2004
|
});
|
|
2471
2005
|
function object(shape, params) {
|
|
2472
2006
|
const def = {
|
|
2473
2007
|
type: "object",
|
|
2474
2008
|
get shape() {
|
|
2475
|
-
assignProp(this, "shape", { ...shape });
|
|
2009
|
+
parse$1.assignProp(this, "shape", { ...shape });
|
|
2476
2010
|
return this.shape;
|
|
2477
2011
|
},
|
|
2478
|
-
...normalizeParams(params)
|
|
2012
|
+
...parse$1.normalizeParams(params)
|
|
2479
2013
|
};
|
|
2480
2014
|
return new ZodObject(def);
|
|
2481
2015
|
}
|
|
2482
|
-
const ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
|
|
2016
|
+
const ZodUnion = /* @__PURE__ */ parse$1.$constructor("ZodUnion", (inst, def) => {
|
|
2483
2017
|
$ZodUnion.init(inst, def);
|
|
2484
2018
|
ZodType.init(inst, def);
|
|
2485
2019
|
inst.options = def.options;
|
|
@@ -2488,10 +2022,10 @@ function union(options, params) {
|
|
|
2488
2022
|
return new ZodUnion({
|
|
2489
2023
|
type: "union",
|
|
2490
2024
|
options,
|
|
2491
|
-
...normalizeParams(params)
|
|
2025
|
+
...parse$1.normalizeParams(params)
|
|
2492
2026
|
});
|
|
2493
2027
|
}
|
|
2494
|
-
const ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
|
|
2028
|
+
const ZodIntersection = /* @__PURE__ */ parse$1.$constructor("ZodIntersection", (inst, def) => {
|
|
2495
2029
|
$ZodIntersection.init(inst, def);
|
|
2496
2030
|
ZodType.init(inst, def);
|
|
2497
2031
|
});
|
|
@@ -2502,7 +2036,7 @@ function intersection(left, right) {
|
|
|
2502
2036
|
right
|
|
2503
2037
|
});
|
|
2504
2038
|
}
|
|
2505
|
-
const ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
2039
|
+
const ZodEnum = /* @__PURE__ */ parse$1.$constructor("ZodEnum", (inst, def) => {
|
|
2506
2040
|
$ZodEnum.init(inst, def);
|
|
2507
2041
|
ZodType.init(inst, def);
|
|
2508
2042
|
inst.enum = def.entries;
|
|
@@ -2519,7 +2053,7 @@ const ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
|
2519
2053
|
return new ZodEnum({
|
|
2520
2054
|
...def,
|
|
2521
2055
|
checks: [],
|
|
2522
|
-
...normalizeParams(params),
|
|
2056
|
+
...parse$1.normalizeParams(params),
|
|
2523
2057
|
entries: newEntries
|
|
2524
2058
|
});
|
|
2525
2059
|
};
|
|
@@ -2534,7 +2068,7 @@ const ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
|
2534
2068
|
return new ZodEnum({
|
|
2535
2069
|
...def,
|
|
2536
2070
|
checks: [],
|
|
2537
|
-
...normalizeParams(params),
|
|
2071
|
+
...parse$1.normalizeParams(params),
|
|
2538
2072
|
entries: newEntries
|
|
2539
2073
|
});
|
|
2540
2074
|
};
|
|
@@ -2544,25 +2078,25 @@ function _enum(values, params) {
|
|
|
2544
2078
|
return new ZodEnum({
|
|
2545
2079
|
type: "enum",
|
|
2546
2080
|
entries,
|
|
2547
|
-
...normalizeParams(params)
|
|
2081
|
+
...parse$1.normalizeParams(params)
|
|
2548
2082
|
});
|
|
2549
2083
|
}
|
|
2550
|
-
const ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
2084
|
+
const ZodTransform = /* @__PURE__ */ parse$1.$constructor("ZodTransform", (inst, def) => {
|
|
2551
2085
|
$ZodTransform.init(inst, def);
|
|
2552
2086
|
ZodType.init(inst, def);
|
|
2553
2087
|
inst._zod.parse = (payload, _ctx) => {
|
|
2554
|
-
payload.addIssue = (issue
|
|
2555
|
-
if (typeof issue
|
|
2556
|
-
payload.issues.push(issue(issue
|
|
2088
|
+
payload.addIssue = (issue) => {
|
|
2089
|
+
if (typeof issue === "string") {
|
|
2090
|
+
payload.issues.push(parse$1.issue(issue, payload.value, def));
|
|
2557
2091
|
} else {
|
|
2558
|
-
const _issue = issue
|
|
2092
|
+
const _issue = issue;
|
|
2559
2093
|
if (_issue.fatal)
|
|
2560
2094
|
_issue.continue = false;
|
|
2561
2095
|
_issue.code ?? (_issue.code = "custom");
|
|
2562
2096
|
_issue.input ?? (_issue.input = payload.value);
|
|
2563
2097
|
_issue.inst ?? (_issue.inst = inst);
|
|
2564
2098
|
_issue.continue ?? (_issue.continue = true);
|
|
2565
|
-
payload.issues.push(issue(_issue));
|
|
2099
|
+
payload.issues.push(parse$1.issue(_issue));
|
|
2566
2100
|
}
|
|
2567
2101
|
};
|
|
2568
2102
|
const output = def.transform(payload.value, payload);
|
|
@@ -2582,7 +2116,7 @@ function transform(fn) {
|
|
|
2582
2116
|
transform: fn
|
|
2583
2117
|
});
|
|
2584
2118
|
}
|
|
2585
|
-
const ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
|
|
2119
|
+
const ZodOptional = /* @__PURE__ */ parse$1.$constructor("ZodOptional", (inst, def) => {
|
|
2586
2120
|
$ZodOptional.init(inst, def);
|
|
2587
2121
|
ZodType.init(inst, def);
|
|
2588
2122
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
@@ -2593,7 +2127,7 @@ function optional(innerType) {
|
|
|
2593
2127
|
innerType
|
|
2594
2128
|
});
|
|
2595
2129
|
}
|
|
2596
|
-
const ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
|
|
2130
|
+
const ZodNullable = /* @__PURE__ */ parse$1.$constructor("ZodNullable", (inst, def) => {
|
|
2597
2131
|
$ZodNullable.init(inst, def);
|
|
2598
2132
|
ZodType.init(inst, def);
|
|
2599
2133
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
@@ -2604,7 +2138,7 @@ function nullable(innerType) {
|
|
|
2604
2138
|
innerType
|
|
2605
2139
|
});
|
|
2606
2140
|
}
|
|
2607
|
-
const ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
|
|
2141
|
+
const ZodDefault = /* @__PURE__ */ parse$1.$constructor("ZodDefault", (inst, def) => {
|
|
2608
2142
|
$ZodDefault.init(inst, def);
|
|
2609
2143
|
ZodType.init(inst, def);
|
|
2610
2144
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
@@ -2619,7 +2153,7 @@ function _default(innerType, defaultValue) {
|
|
|
2619
2153
|
}
|
|
2620
2154
|
});
|
|
2621
2155
|
}
|
|
2622
|
-
const ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
|
|
2156
|
+
const ZodPrefault = /* @__PURE__ */ parse$1.$constructor("ZodPrefault", (inst, def) => {
|
|
2623
2157
|
$ZodPrefault.init(inst, def);
|
|
2624
2158
|
ZodType.init(inst, def);
|
|
2625
2159
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
@@ -2633,7 +2167,7 @@ function prefault(innerType, defaultValue) {
|
|
|
2633
2167
|
}
|
|
2634
2168
|
});
|
|
2635
2169
|
}
|
|
2636
|
-
const ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
|
|
2170
|
+
const ZodNonOptional = /* @__PURE__ */ parse$1.$constructor("ZodNonOptional", (inst, def) => {
|
|
2637
2171
|
$ZodNonOptional.init(inst, def);
|
|
2638
2172
|
ZodType.init(inst, def);
|
|
2639
2173
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
@@ -2642,10 +2176,10 @@ function nonoptional(innerType, params) {
|
|
|
2642
2176
|
return new ZodNonOptional({
|
|
2643
2177
|
type: "nonoptional",
|
|
2644
2178
|
innerType,
|
|
2645
|
-
...normalizeParams(params)
|
|
2179
|
+
...parse$1.normalizeParams(params)
|
|
2646
2180
|
});
|
|
2647
2181
|
}
|
|
2648
|
-
const ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
|
|
2182
|
+
const ZodCatch = /* @__PURE__ */ parse$1.$constructor("ZodCatch", (inst, def) => {
|
|
2649
2183
|
$ZodCatch.init(inst, def);
|
|
2650
2184
|
ZodType.init(inst, def);
|
|
2651
2185
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
@@ -2658,7 +2192,7 @@ function _catch(innerType, catchValue) {
|
|
|
2658
2192
|
catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
|
|
2659
2193
|
});
|
|
2660
2194
|
}
|
|
2661
|
-
const ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
|
|
2195
|
+
const ZodPipe = /* @__PURE__ */ parse$1.$constructor("ZodPipe", (inst, def) => {
|
|
2662
2196
|
$ZodPipe.init(inst, def);
|
|
2663
2197
|
ZodType.init(inst, def);
|
|
2664
2198
|
inst.in = def.in;
|
|
@@ -2672,7 +2206,7 @@ function pipe(in_, out) {
|
|
|
2672
2206
|
// ...util.normalizeParams(params),
|
|
2673
2207
|
});
|
|
2674
2208
|
}
|
|
2675
|
-
const ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
|
|
2209
|
+
const ZodReadonly = /* @__PURE__ */ parse$1.$constructor("ZodReadonly", (inst, def) => {
|
|
2676
2210
|
$ZodReadonly.init(inst, def);
|
|
2677
2211
|
ZodType.init(inst, def);
|
|
2678
2212
|
});
|
|
@@ -2682,14 +2216,14 @@ function readonly(innerType) {
|
|
|
2682
2216
|
innerType
|
|
2683
2217
|
});
|
|
2684
2218
|
}
|
|
2685
|
-
const ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
|
|
2219
|
+
const ZodCustom = /* @__PURE__ */ parse$1.$constructor("ZodCustom", (inst, def) => {
|
|
2686
2220
|
$ZodCustom.init(inst, def);
|
|
2687
2221
|
ZodType.init(inst, def);
|
|
2688
2222
|
});
|
|
2689
2223
|
function check(fn, params) {
|
|
2690
2224
|
const ch = new $ZodCheck({
|
|
2691
2225
|
check: "custom",
|
|
2692
|
-
...normalizeParams(params)
|
|
2226
|
+
...parse$1.normalizeParams(params)
|
|
2693
2227
|
});
|
|
2694
2228
|
ch._zod.check = fn;
|
|
2695
2229
|
return ch;
|
|
@@ -2699,18 +2233,18 @@ function refine(fn, _params = {}) {
|
|
|
2699
2233
|
}
|
|
2700
2234
|
function superRefine(fn, params) {
|
|
2701
2235
|
const ch = check((payload) => {
|
|
2702
|
-
payload.addIssue = (issue
|
|
2703
|
-
if (typeof issue
|
|
2704
|
-
payload.issues.push(issue(issue
|
|
2236
|
+
payload.addIssue = (issue) => {
|
|
2237
|
+
if (typeof issue === "string") {
|
|
2238
|
+
payload.issues.push(parse$1.issue(issue, payload.value, ch._zod.def));
|
|
2705
2239
|
} else {
|
|
2706
|
-
const _issue = issue
|
|
2240
|
+
const _issue = issue;
|
|
2707
2241
|
if (_issue.fatal)
|
|
2708
2242
|
_issue.continue = false;
|
|
2709
2243
|
_issue.code ?? (_issue.code = "custom");
|
|
2710
2244
|
_issue.input ?? (_issue.input = payload.value);
|
|
2711
2245
|
_issue.inst ?? (_issue.inst = ch);
|
|
2712
2246
|
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
|
|
2713
|
-
payload.issues.push(issue(_issue));
|
|
2247
|
+
payload.issues.push(parse$1.issue(_issue));
|
|
2714
2248
|
}
|
|
2715
2249
|
};
|
|
2716
2250
|
return fn(payload.value, payload);
|
|
@@ -2721,4 +2255,4 @@ exports.array = array;
|
|
|
2721
2255
|
exports.email = email;
|
|
2722
2256
|
exports.object = object;
|
|
2723
2257
|
exports.string = string;
|
|
2724
|
-
//# sourceMappingURL=schemas-
|
|
2258
|
+
//# sourceMappingURL=schemas-DlCjM5d_.cjs.map
|