@intlayer/design-system 5.5.9 → 5.5.10
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 +43 -27
- 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/useAuth/useCSRF.d.ts +1 -1
- package/dist/components/Auth/useAuth/useOAuth2.d.ts +1 -1
- package/dist/components/Command/index.d.ts +83 -0
- package/dist/components/Command/index.d.ts.map +1 -0
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.cjs +1 -1
- 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 +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.mjs.map +1 -1
- 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/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/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/MarkDownRender/index.cjs +1 -1
- package/dist/components/MarkDownRender/index.cjs.map +1 -1
- package/dist/components/MarkDownRender/index.mjs +1 -1
- package/dist/components/MarkDownRender/index.mjs.map +1 -1
- package/dist/components/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/hooks/intlayerAPIHooks.d.ts +54 -54
- package/dist/hooks/intlayerAPIHooks.d.ts.map +1 -1
- package/dist/hooks/useIntlayerAPI.d.ts +65 -65
- package/dist/hooks/useIntlayerAPI.d.ts.map +1 -1
- 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 +15 -15
- 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,463 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
function init(inst, def) {
|
|
3
|
-
var _a;
|
|
4
|
-
Object.defineProperty(inst, "_zod", {
|
|
5
|
-
value: inst._zod ?? {},
|
|
6
|
-
enumerable: false
|
|
7
|
-
});
|
|
8
|
-
(_a = inst._zod).traits ?? (_a.traits = /* @__PURE__ */ new Set());
|
|
9
|
-
inst._zod.traits.add(name);
|
|
10
|
-
initializer2(inst, def);
|
|
11
|
-
for (const k in _.prototype) {
|
|
12
|
-
if (!(k in inst))
|
|
13
|
-
Object.defineProperty(inst, k, { value: _.prototype[k].bind(inst) });
|
|
14
|
-
}
|
|
15
|
-
inst._zod.constr = _;
|
|
16
|
-
inst._zod.def = def;
|
|
17
|
-
}
|
|
18
|
-
const Parent = params?.Parent ?? Object;
|
|
19
|
-
class Definition extends Parent {
|
|
20
|
-
}
|
|
21
|
-
Object.defineProperty(Definition, "name", { value: name });
|
|
22
|
-
function _(def) {
|
|
23
|
-
var _a;
|
|
24
|
-
const inst = params?.Parent ? new Definition() : this;
|
|
25
|
-
init(inst, def);
|
|
26
|
-
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
27
|
-
for (const fn of inst._zod.deferred) {
|
|
28
|
-
fn();
|
|
29
|
-
}
|
|
30
|
-
return inst;
|
|
31
|
-
}
|
|
32
|
-
Object.defineProperty(_, "init", { value: init });
|
|
33
|
-
Object.defineProperty(_, Symbol.hasInstance, {
|
|
34
|
-
value: (inst) => {
|
|
35
|
-
if (params?.Parent && inst instanceof params.Parent)
|
|
36
|
-
return true;
|
|
37
|
-
return inst?._zod?.traits?.has(name);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
Object.defineProperty(_, "name", { value: name });
|
|
41
|
-
return _;
|
|
42
|
-
}
|
|
43
|
-
class $ZodAsyncError extends Error {
|
|
44
|
-
constructor() {
|
|
45
|
-
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
const globalConfig = {};
|
|
49
|
-
function config(newConfig) {
|
|
50
|
-
return globalConfig;
|
|
51
|
-
}
|
|
52
|
-
function getEnumValues(entries) {
|
|
53
|
-
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
54
|
-
const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
55
|
-
return values;
|
|
56
|
-
}
|
|
57
|
-
function jsonStringifyReplacer(_, value) {
|
|
58
|
-
if (typeof value === "bigint")
|
|
59
|
-
return value.toString();
|
|
60
|
-
return value;
|
|
61
|
-
}
|
|
62
|
-
function cached(getter) {
|
|
63
|
-
return {
|
|
64
|
-
get value() {
|
|
65
|
-
{
|
|
66
|
-
const value = getter();
|
|
67
|
-
Object.defineProperty(this, "value", { value });
|
|
68
|
-
return value;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
function nullish(input) {
|
|
74
|
-
return input === null || input === void 0;
|
|
75
|
-
}
|
|
76
|
-
function cleanRegex(source) {
|
|
77
|
-
const start = source.startsWith("^") ? 1 : 0;
|
|
78
|
-
const end = source.endsWith("$") ? source.length - 1 : source.length;
|
|
79
|
-
return source.slice(start, end);
|
|
80
|
-
}
|
|
81
|
-
function defineLazy(object2, key, getter) {
|
|
82
|
-
Object.defineProperty(object2, key, {
|
|
83
|
-
get() {
|
|
84
|
-
{
|
|
85
|
-
const value = getter();
|
|
86
|
-
object2[key] = value;
|
|
87
|
-
return value;
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
set(v) {
|
|
91
|
-
Object.defineProperty(object2, key, {
|
|
92
|
-
value: v
|
|
93
|
-
// configurable: true,
|
|
94
|
-
});
|
|
95
|
-
},
|
|
96
|
-
configurable: true
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
function assignProp(target, prop, value) {
|
|
100
|
-
Object.defineProperty(target, prop, {
|
|
101
|
-
value,
|
|
102
|
-
writable: true,
|
|
103
|
-
enumerable: true,
|
|
104
|
-
configurable: true
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
function randomString(length = 10) {
|
|
108
|
-
const chars = "abcdefghijklmnopqrstuvwxyz";
|
|
109
|
-
let str = "";
|
|
110
|
-
for (let i = 0; i < length; i++) {
|
|
111
|
-
str += chars[Math.floor(Math.random() * chars.length)];
|
|
112
|
-
}
|
|
113
|
-
return str;
|
|
114
|
-
}
|
|
115
|
-
function esc(str) {
|
|
116
|
-
return JSON.stringify(str);
|
|
117
|
-
}
|
|
118
|
-
function isObject(data) {
|
|
119
|
-
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
120
|
-
}
|
|
121
|
-
const allowsEval = cached(() => {
|
|
122
|
-
try {
|
|
123
|
-
const F = Function;
|
|
124
|
-
new F("");
|
|
125
|
-
return true;
|
|
126
|
-
} catch (_) {
|
|
127
|
-
return false;
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
function isPlainObject(o) {
|
|
131
|
-
if (isObject(o) === false)
|
|
132
|
-
return false;
|
|
133
|
-
const ctor = o.constructor;
|
|
134
|
-
if (ctor === void 0)
|
|
135
|
-
return true;
|
|
136
|
-
const prot = ctor.prototype;
|
|
137
|
-
if (isObject(prot) === false)
|
|
138
|
-
return false;
|
|
139
|
-
if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) {
|
|
140
|
-
return false;
|
|
141
|
-
}
|
|
142
|
-
return true;
|
|
143
|
-
}
|
|
144
|
-
const propertyKeyTypes = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
|
|
145
|
-
function escapeRegex(str) {
|
|
146
|
-
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
147
|
-
}
|
|
148
|
-
function clone(inst, def, params) {
|
|
149
|
-
const cl = new inst._zod.constr(def ?? inst._zod.def);
|
|
150
|
-
if (!def || params?.parent)
|
|
151
|
-
cl._zod.parent = inst;
|
|
152
|
-
return cl;
|
|
153
|
-
}
|
|
154
|
-
function normalizeParams(_params) {
|
|
155
|
-
const params = _params;
|
|
156
|
-
if (!params)
|
|
157
|
-
return {};
|
|
158
|
-
if (typeof params === "string")
|
|
159
|
-
return { error: () => params };
|
|
160
|
-
if (params?.message !== void 0) {
|
|
161
|
-
if (params?.error !== void 0)
|
|
162
|
-
throw new Error("Cannot specify both `message` and `error` params");
|
|
163
|
-
params.error = params.message;
|
|
164
|
-
}
|
|
165
|
-
delete params.message;
|
|
166
|
-
if (typeof params.error === "string")
|
|
167
|
-
return { ...params, error: () => params.error };
|
|
168
|
-
return params;
|
|
169
|
-
}
|
|
170
|
-
function optionalKeys(shape) {
|
|
171
|
-
return Object.keys(shape).filter((k) => {
|
|
172
|
-
return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
function pick(schema, mask) {
|
|
176
|
-
const newShape = {};
|
|
177
|
-
const currDef = schema._zod.def;
|
|
178
|
-
for (const key in mask) {
|
|
179
|
-
if (!(key in currDef.shape)) {
|
|
180
|
-
throw new Error(`Unrecognized key: "${key}"`);
|
|
181
|
-
}
|
|
182
|
-
if (!mask[key])
|
|
183
|
-
continue;
|
|
184
|
-
newShape[key] = currDef.shape[key];
|
|
185
|
-
}
|
|
186
|
-
return clone(schema, {
|
|
187
|
-
...schema._zod.def,
|
|
188
|
-
shape: newShape,
|
|
189
|
-
checks: []
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
function omit(schema, mask) {
|
|
193
|
-
const newShape = { ...schema._zod.def.shape };
|
|
194
|
-
const currDef = schema._zod.def;
|
|
195
|
-
for (const key in mask) {
|
|
196
|
-
if (!(key in currDef.shape)) {
|
|
197
|
-
throw new Error(`Unrecognized key: "${key}"`);
|
|
198
|
-
}
|
|
199
|
-
if (!mask[key])
|
|
200
|
-
continue;
|
|
201
|
-
delete newShape[key];
|
|
202
|
-
}
|
|
203
|
-
return clone(schema, {
|
|
204
|
-
...schema._zod.def,
|
|
205
|
-
shape: newShape,
|
|
206
|
-
checks: []
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
function extend(schema, shape) {
|
|
210
|
-
const def = {
|
|
211
|
-
...schema._zod.def,
|
|
212
|
-
get shape() {
|
|
213
|
-
const _shape = { ...schema._zod.def.shape, ...shape };
|
|
214
|
-
assignProp(this, "shape", _shape);
|
|
215
|
-
return _shape;
|
|
216
|
-
},
|
|
217
|
-
checks: []
|
|
218
|
-
// delete existing checks
|
|
219
|
-
};
|
|
220
|
-
return clone(schema, def);
|
|
221
|
-
}
|
|
222
|
-
function merge(a, b) {
|
|
223
|
-
return clone(a, {
|
|
224
|
-
...a._zod.def,
|
|
225
|
-
get shape() {
|
|
226
|
-
const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
|
|
227
|
-
assignProp(this, "shape", _shape);
|
|
228
|
-
return _shape;
|
|
229
|
-
},
|
|
230
|
-
catchall: b._zod.def.catchall,
|
|
231
|
-
checks: []
|
|
232
|
-
// delete existing checks
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
function partial(Class, schema, mask) {
|
|
236
|
-
const oldShape = schema._zod.def.shape;
|
|
237
|
-
const shape = { ...oldShape };
|
|
238
|
-
if (mask) {
|
|
239
|
-
for (const key in mask) {
|
|
240
|
-
if (!(key in oldShape)) {
|
|
241
|
-
throw new Error(`Unrecognized key: "${key}"`);
|
|
242
|
-
}
|
|
243
|
-
if (!mask[key])
|
|
244
|
-
continue;
|
|
245
|
-
shape[key] = Class ? new Class({
|
|
246
|
-
type: "optional",
|
|
247
|
-
innerType: oldShape[key]
|
|
248
|
-
}) : oldShape[key];
|
|
249
|
-
}
|
|
250
|
-
} else {
|
|
251
|
-
for (const key in oldShape) {
|
|
252
|
-
shape[key] = Class ? new Class({
|
|
253
|
-
type: "optional",
|
|
254
|
-
innerType: oldShape[key]
|
|
255
|
-
}) : oldShape[key];
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
return clone(schema, {
|
|
259
|
-
...schema._zod.def,
|
|
260
|
-
shape,
|
|
261
|
-
checks: []
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
function required(Class, schema, mask) {
|
|
265
|
-
const oldShape = schema._zod.def.shape;
|
|
266
|
-
const shape = { ...oldShape };
|
|
267
|
-
if (mask) {
|
|
268
|
-
for (const key in mask) {
|
|
269
|
-
if (!(key in shape)) {
|
|
270
|
-
throw new Error(`Unrecognized key: "${key}"`);
|
|
271
|
-
}
|
|
272
|
-
if (!mask[key])
|
|
273
|
-
continue;
|
|
274
|
-
shape[key] = new Class({
|
|
275
|
-
type: "nonoptional",
|
|
276
|
-
innerType: oldShape[key]
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
|
-
} else {
|
|
280
|
-
for (const key in oldShape) {
|
|
281
|
-
shape[key] = new Class({
|
|
282
|
-
type: "nonoptional",
|
|
283
|
-
innerType: oldShape[key]
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
return clone(schema, {
|
|
288
|
-
...schema._zod.def,
|
|
289
|
-
shape,
|
|
290
|
-
// optional: [],
|
|
291
|
-
checks: []
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
function aborted(x, startIndex = 0) {
|
|
295
|
-
for (let i = startIndex; i < x.issues.length; i++) {
|
|
296
|
-
if (x.issues[i].continue !== true)
|
|
297
|
-
return true;
|
|
298
|
-
}
|
|
299
|
-
return false;
|
|
300
|
-
}
|
|
301
|
-
function prefixIssues(path, issues) {
|
|
302
|
-
return issues.map((iss) => {
|
|
303
|
-
var _a;
|
|
304
|
-
(_a = iss).path ?? (_a.path = []);
|
|
305
|
-
iss.path.unshift(path);
|
|
306
|
-
return iss;
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
function unwrapMessage(message) {
|
|
310
|
-
return typeof message === "string" ? message : message?.message;
|
|
311
|
-
}
|
|
312
|
-
function finalizeIssue(iss, ctx, config2) {
|
|
313
|
-
const full = { ...iss, path: iss.path ?? [] };
|
|
314
|
-
if (!iss.message) {
|
|
315
|
-
const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
|
|
316
|
-
full.message = message;
|
|
317
|
-
}
|
|
318
|
-
delete full.inst;
|
|
319
|
-
delete full.continue;
|
|
320
|
-
if (!ctx?.reportInput) {
|
|
321
|
-
delete full.input;
|
|
322
|
-
}
|
|
323
|
-
return full;
|
|
324
|
-
}
|
|
325
|
-
function getLengthableOrigin(input) {
|
|
326
|
-
if (Array.isArray(input))
|
|
327
|
-
return "array";
|
|
328
|
-
if (typeof input === "string")
|
|
329
|
-
return "string";
|
|
330
|
-
return "unknown";
|
|
331
|
-
}
|
|
332
|
-
function issue(...args) {
|
|
333
|
-
const [iss, input, inst] = args;
|
|
334
|
-
if (typeof iss === "string") {
|
|
335
|
-
return {
|
|
336
|
-
message: iss,
|
|
337
|
-
code: "custom",
|
|
338
|
-
input,
|
|
339
|
-
inst
|
|
340
|
-
};
|
|
341
|
-
}
|
|
342
|
-
return { ...iss };
|
|
343
|
-
}
|
|
344
|
-
const initializer$1 = (inst, def) => {
|
|
345
|
-
inst.name = "$ZodError";
|
|
346
|
-
Object.defineProperty(inst, "_zod", {
|
|
347
|
-
value: inst._zod,
|
|
348
|
-
enumerable: false
|
|
349
|
-
});
|
|
350
|
-
Object.defineProperty(inst, "issues", {
|
|
351
|
-
value: def,
|
|
352
|
-
enumerable: false
|
|
353
|
-
});
|
|
354
|
-
Object.defineProperty(inst, "message", {
|
|
355
|
-
get() {
|
|
356
|
-
return JSON.stringify(def, jsonStringifyReplacer, 2);
|
|
357
|
-
},
|
|
358
|
-
enumerable: true
|
|
359
|
-
// configurable: false,
|
|
360
|
-
});
|
|
361
|
-
};
|
|
362
|
-
const $ZodError = $constructor("$ZodError", initializer$1);
|
|
363
|
-
const $ZodRealError = $constructor("$ZodError", initializer$1, { Parent: Error });
|
|
364
|
-
function flattenError(error, mapper = (issue2) => issue2.message) {
|
|
365
|
-
const fieldErrors = {};
|
|
366
|
-
const formErrors = [];
|
|
367
|
-
for (const sub of error.issues) {
|
|
368
|
-
if (sub.path.length > 0) {
|
|
369
|
-
fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
|
|
370
|
-
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
371
|
-
} else {
|
|
372
|
-
formErrors.push(mapper(sub));
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
return { formErrors, fieldErrors };
|
|
376
|
-
}
|
|
377
|
-
function formatError(error, _mapper) {
|
|
378
|
-
const mapper = _mapper || function(issue2) {
|
|
379
|
-
return issue2.message;
|
|
380
|
-
};
|
|
381
|
-
const fieldErrors = { _errors: [] };
|
|
382
|
-
const processError = (error2) => {
|
|
383
|
-
for (const issue2 of error2.issues) {
|
|
384
|
-
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
385
|
-
issue2.errors.map((issues) => processError({ issues }));
|
|
386
|
-
} else if (issue2.code === "invalid_key") {
|
|
387
|
-
processError({ issues: issue2.issues });
|
|
388
|
-
} else if (issue2.code === "invalid_element") {
|
|
389
|
-
processError({ issues: issue2.issues });
|
|
390
|
-
} else if (issue2.path.length === 0) {
|
|
391
|
-
fieldErrors._errors.push(mapper(issue2));
|
|
392
|
-
} else {
|
|
393
|
-
let curr = fieldErrors;
|
|
394
|
-
let i = 0;
|
|
395
|
-
while (i < issue2.path.length) {
|
|
396
|
-
const el = issue2.path[i];
|
|
397
|
-
const terminal = i === issue2.path.length - 1;
|
|
398
|
-
if (!terminal) {
|
|
399
|
-
curr[el] = curr[el] || { _errors: [] };
|
|
400
|
-
} else {
|
|
401
|
-
curr[el] = curr[el] || { _errors: [] };
|
|
402
|
-
curr[el]._errors.push(mapper(issue2));
|
|
403
|
-
}
|
|
404
|
-
curr = curr[el];
|
|
405
|
-
i++;
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
};
|
|
410
|
-
processError(error);
|
|
411
|
-
return fieldErrors;
|
|
412
|
-
}
|
|
413
|
-
const _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
414
|
-
const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
|
|
415
|
-
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
416
|
-
if (result instanceof Promise) {
|
|
417
|
-
throw new $ZodAsyncError();
|
|
418
|
-
}
|
|
419
|
-
if (result.issues.length) {
|
|
420
|
-
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
421
|
-
Error.captureStackTrace(e, _params?.callee);
|
|
422
|
-
throw e;
|
|
423
|
-
}
|
|
424
|
-
return result.value;
|
|
425
|
-
};
|
|
426
|
-
const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
427
|
-
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
428
|
-
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
429
|
-
if (result instanceof Promise)
|
|
430
|
-
result = await result;
|
|
431
|
-
if (result.issues.length) {
|
|
432
|
-
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
433
|
-
Error.captureStackTrace(e, params?.callee);
|
|
434
|
-
throw e;
|
|
435
|
-
}
|
|
436
|
-
return result.value;
|
|
437
|
-
};
|
|
438
|
-
const _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
439
|
-
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
440
|
-
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
441
|
-
if (result instanceof Promise) {
|
|
442
|
-
throw new $ZodAsyncError();
|
|
443
|
-
}
|
|
444
|
-
return result.issues.length ? {
|
|
445
|
-
success: false,
|
|
446
|
-
error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
447
|
-
} : { success: true, data: result.value };
|
|
448
|
-
};
|
|
449
|
-
const safeParse$1 = /* @__PURE__ */ _safeParse($ZodRealError);
|
|
450
|
-
const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
451
|
-
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
452
|
-
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
453
|
-
if (result instanceof Promise)
|
|
454
|
-
result = await result;
|
|
455
|
-
return result.issues.length ? {
|
|
456
|
-
success: false,
|
|
457
|
-
error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
458
|
-
} : { success: true, data: result.value };
|
|
459
|
-
};
|
|
460
|
-
const safeParseAsync$1 = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
1
|
+
import { b as $constructor, n as nullish, g as getLengthableOrigin, e as escapeRegex, d as defineLazy, c as globalConfig, f as allowsEval, h as cached, i as isObject, r as randomString, j as esc, k as cleanRegex, l as $ZodAsyncError, s as safeParse$1, m as safeParseAsync$1, o as aborted, q as optionalKeys, t as prefixIssues, u as getEnumValues, v as propertyKeyTypes, w as finalizeIssue, x as config, y as isPlainObject, z as issue, A as normalizeParams, $ as $ZodError, B as flattenError, C as formatError, _ as _parse, D as _safeParse, E as _parseAsync, F as _safeParseAsync, G as assignProp, H as extend, I as merge, J as pick, K as omit, L as partial, M as required, N as clone } from "./parse-pnJgclyf.js";
|
|
461
2
|
const cuid = /^[cC][^\s-]{8,}$/;
|
|
462
3
|
const cuid2 = /^[0-9a-z]+$/;
|
|
463
4
|
const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
|
|
@@ -484,28 +25,25 @@ const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z
|
|
|
484
25
|
const base64url = /^[A-Za-z0-9_-]*$/;
|
|
485
26
|
const hostname = /^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;
|
|
486
27
|
const e164 = /^\+(?:[0-9]){6,14}[0-9]$/;
|
|
487
|
-
const dateSource = `((
|
|
28
|
+
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])))`;
|
|
488
29
|
const date$1 = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
|
|
489
30
|
function timeSource(args) {
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
regex = `${regex}\\.\\d{${args.precision}}`;
|
|
493
|
-
} else if (args.precision == null) {
|
|
494
|
-
regex = `${regex}(\\.\\d+)?`;
|
|
495
|
-
}
|
|
31
|
+
const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
|
|
32
|
+
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+)?)?`;
|
|
496
33
|
return regex;
|
|
497
34
|
}
|
|
498
35
|
function time$1(args) {
|
|
499
36
|
return new RegExp(`^${timeSource(args)}$`);
|
|
500
37
|
}
|
|
501
38
|
function datetime$1(args) {
|
|
502
|
-
|
|
503
|
-
const opts = [];
|
|
504
|
-
|
|
39
|
+
const time2 = timeSource({ precision: args.precision });
|
|
40
|
+
const opts = ["Z"];
|
|
41
|
+
if (args.local)
|
|
42
|
+
opts.push("");
|
|
505
43
|
if (args.offset)
|
|
506
|
-
opts.push(`([+-]\\d{2}
|
|
507
|
-
|
|
508
|
-
return new RegExp(`^${
|
|
44
|
+
opts.push(`([+-]\\d{2}:\\d{2})`);
|
|
45
|
+
const timeRegex = `${time2}(?:${opts.join("|")})`;
|
|
46
|
+
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
509
47
|
}
|
|
510
48
|
const string$1 = (params) => {
|
|
511
49
|
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
@@ -774,7 +312,7 @@ const version = {
|
|
|
774
312
|
const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
775
313
|
var _a;
|
|
776
314
|
inst ?? (inst = {});
|
|
777
|
-
inst._zod
|
|
315
|
+
defineLazy(inst._zod, "id", () => def.type + "_" + randomString(10));
|
|
778
316
|
inst._zod.def = def;
|
|
779
317
|
inst._zod.bag = inst._zod.bag || {};
|
|
780
318
|
inst._zod.version = version;
|
|
@@ -801,10 +339,8 @@ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
801
339
|
const shouldRun = ch._zod.when(payload);
|
|
802
340
|
if (!shouldRun)
|
|
803
341
|
continue;
|
|
804
|
-
} else {
|
|
805
|
-
|
|
806
|
-
continue;
|
|
807
|
-
}
|
|
342
|
+
} else if (isAborted) {
|
|
343
|
+
continue;
|
|
808
344
|
}
|
|
809
345
|
const currLen = payload.issues.length;
|
|
810
346
|
const _ = ch._zod.check(payload);
|
|
@@ -986,6 +522,7 @@ const $ZodKSUID = /* @__PURE__ */ $constructor("$ZodKSUID", (inst, def) => {
|
|
|
986
522
|
const $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => {
|
|
987
523
|
def.pattern ?? (def.pattern = datetime$1(def));
|
|
988
524
|
$ZodStringFormat.init(inst, def);
|
|
525
|
+
inst._zod.check;
|
|
989
526
|
});
|
|
990
527
|
const $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {
|
|
991
528
|
def.pattern ?? (def.pattern = date$1);
|
|
@@ -994,6 +531,7 @@ const $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {
|
|
|
994
531
|
const $ZodISOTime = /* @__PURE__ */ $constructor("$ZodISOTime", (inst, def) => {
|
|
995
532
|
def.pattern ?? (def.pattern = time$1(def));
|
|
996
533
|
$ZodStringFormat.init(inst, def);
|
|
534
|
+
inst._zod.check;
|
|
997
535
|
});
|
|
998
536
|
const $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def) => {
|
|
999
537
|
def.pattern ?? (def.pattern = duration$1);
|
|
@@ -1345,12 +883,10 @@ const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
1345
883
|
const isOptional = el._zod.optin === "optional" && el._zod.optout === "optional";
|
|
1346
884
|
if (r instanceof Promise) {
|
|
1347
885
|
proms.push(r.then((r2) => isOptional ? handleOptionalObjectResult(r2, payload, key, input) : handleObjectResult(r2, payload, key)));
|
|
886
|
+
} else if (isOptional) {
|
|
887
|
+
handleOptionalObjectResult(r, payload, key, input);
|
|
1348
888
|
} else {
|
|
1349
|
-
|
|
1350
|
-
handleOptionalObjectResult(r, payload, key, input);
|
|
1351
|
-
} else {
|
|
1352
|
-
handleObjectResult(r, payload, key);
|
|
1353
|
-
}
|
|
889
|
+
handleObjectResult(r, payload, key);
|
|
1354
890
|
}
|
|
1355
891
|
}
|
|
1356
892
|
}
|
|
@@ -2449,9 +1985,7 @@ function array(element, params) {
|
|
|
2449
1985
|
const ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
2450
1986
|
$ZodObject.init(inst, def);
|
|
2451
1987
|
ZodType.init(inst, def);
|
|
2452
|
-
defineLazy(inst, "shape", () =>
|
|
2453
|
-
return Object.fromEntries(Object.entries(inst._zod.def.shape));
|
|
2454
|
-
});
|
|
1988
|
+
defineLazy(inst, "shape", () => def.shape);
|
|
2455
1989
|
inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
|
|
2456
1990
|
inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall });
|
|
2457
1991
|
inst.passthrough = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
|
|
@@ -2722,4 +2256,4 @@ export {
|
|
|
2722
2256
|
object as o,
|
|
2723
2257
|
string as s
|
|
2724
2258
|
};
|
|
2725
|
-
//# sourceMappingURL=schemas-
|
|
2259
|
+
//# sourceMappingURL=schemas-itjzX6bG.js.map
|