react-luminus-components 1.3.39 → 1.3.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.vite/manifest.json +8 -8
- package/dist/contexts.cjs.js +1 -1
- package/dist/contexts.es.js +1 -1
- package/dist/{dateUtils-5HWb1Xp3.js → dateUtils-DrwxA2JS.js} +72 -71
- package/dist/{dateUtils-Nmx8eNt3.cjs → dateUtils-inGq3OTd.cjs} +1 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/useSearchQuery/useSearchQuery.d.ts +5 -0
- package/dist/hooks/useSearchQueryState/useSearchQueryState.d.ts +15 -0
- package/dist/hooks.cjs.js +1 -1
- package/dist/hooks.es.js +569 -538
- package/dist/main.cjs.js +1 -1
- package/dist/main.es.js +1 -1
- package/dist/models/types/ToLiteral.d.ts +5 -0
- package/dist/utils/text/string.d.ts +1 -0
- package/dist/utils.cjs.js +1 -1
- package/dist/utils.es.js +92 -76
- package/package.json +1 -1
package/dist/hooks.es.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { U as
|
|
2
|
-
import { aF as
|
|
3
|
-
import { c as
|
|
4
|
-
import { useContext as
|
|
5
|
-
import { i as Ke } from "./dateUtils-
|
|
1
|
+
import { U as Je, aD as Ye, a4 as Ge } from "./FromToDatePickerDropdownToggle-CzfOe1nC.js";
|
|
2
|
+
import { aF as vr, ae as gr, aE as xr } from "./FromToDatePickerDropdownToggle-CzfOe1nC.js";
|
|
3
|
+
import { c as kr, b as wr, a as Tr, u as Sr } from "./useLocalStorageState--QCnJ6Yt.js";
|
|
4
|
+
import { useContext as He, useState as Qe, useEffect as Xe, useCallback as Ae, useMemo as Fe } from "react";
|
|
5
|
+
import { i as Ke } from "./dateUtils-DrwxA2JS.js";
|
|
6
6
|
import "@azure/msal-browser";
|
|
7
7
|
import "@azure/msal-react";
|
|
8
|
-
import "react-router-dom";
|
|
8
|
+
import { useSearchParams as et } from "react-router-dom";
|
|
9
9
|
import "react-hook-form";
|
|
10
|
-
import { b as
|
|
11
|
-
import { u as
|
|
10
|
+
import { b as Cr, u as Nr, a as Or } from "./useFormControlType-oJGqgThz.js";
|
|
11
|
+
import { u as Rr } from "./usePermissions-D-_3huge.js";
|
|
12
12
|
var x;
|
|
13
13
|
(function(r) {
|
|
14
14
|
r.assertEqual = (s) => s;
|
|
@@ -20,39 +20,39 @@ var x;
|
|
|
20
20
|
}
|
|
21
21
|
r.assertNever = t, r.arrayToEnum = (s) => {
|
|
22
22
|
const a = {};
|
|
23
|
-
for (const
|
|
24
|
-
a[
|
|
23
|
+
for (const o of s)
|
|
24
|
+
a[o] = o;
|
|
25
25
|
return a;
|
|
26
26
|
}, r.getValidEnumValues = (s) => {
|
|
27
|
-
const a = r.objectKeys(s).filter((
|
|
28
|
-
for (const
|
|
29
|
-
i
|
|
30
|
-
return r.objectValues(
|
|
27
|
+
const a = r.objectKeys(s).filter((i) => typeof s[s[i]] != "number"), o = {};
|
|
28
|
+
for (const i of a)
|
|
29
|
+
o[i] = s[i];
|
|
30
|
+
return r.objectValues(o);
|
|
31
31
|
}, r.objectValues = (s) => r.objectKeys(s).map(function(a) {
|
|
32
32
|
return s[a];
|
|
33
33
|
}), r.objectKeys = typeof Object.keys == "function" ? (s) => Object.keys(s) : (s) => {
|
|
34
34
|
const a = [];
|
|
35
|
-
for (const
|
|
36
|
-
Object.prototype.hasOwnProperty.call(s,
|
|
35
|
+
for (const o in s)
|
|
36
|
+
Object.prototype.hasOwnProperty.call(s, o) && a.push(o);
|
|
37
37
|
return a;
|
|
38
38
|
}, r.find = (s, a) => {
|
|
39
|
-
for (const
|
|
40
|
-
if (a(
|
|
41
|
-
return
|
|
39
|
+
for (const o of s)
|
|
40
|
+
if (a(o))
|
|
41
|
+
return o;
|
|
42
42
|
}, r.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && isFinite(s) && Math.floor(s) === s;
|
|
43
43
|
function n(s, a = " | ") {
|
|
44
|
-
return s.map((
|
|
44
|
+
return s.map((o) => typeof o == "string" ? `'${o}'` : o).join(a);
|
|
45
45
|
}
|
|
46
46
|
r.joinValues = n, r.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a;
|
|
47
47
|
})(x || (x = {}));
|
|
48
|
-
var
|
|
48
|
+
var Ze;
|
|
49
49
|
(function(r) {
|
|
50
50
|
r.mergeShapes = (e, t) => ({
|
|
51
51
|
...e,
|
|
52
52
|
...t
|
|
53
53
|
// second overwrites first
|
|
54
54
|
});
|
|
55
|
-
})(
|
|
55
|
+
})(Ze || (Ze = {}));
|
|
56
56
|
const f = x.arrayToEnum([
|
|
57
57
|
"string",
|
|
58
58
|
"nan",
|
|
@@ -74,7 +74,7 @@ const f = x.arrayToEnum([
|
|
|
74
74
|
"never",
|
|
75
75
|
"map",
|
|
76
76
|
"set"
|
|
77
|
-
]),
|
|
77
|
+
]), z = (r) => {
|
|
78
78
|
switch (typeof r) {
|
|
79
79
|
case "undefined":
|
|
80
80
|
return f.undefined;
|
|
@@ -95,7 +95,7 @@ const f = x.arrayToEnum([
|
|
|
95
95
|
default:
|
|
96
96
|
return f.unknown;
|
|
97
97
|
}
|
|
98
|
-
},
|
|
98
|
+
}, c = x.arrayToEnum([
|
|
99
99
|
"invalid_type",
|
|
100
100
|
"invalid_literal",
|
|
101
101
|
"custom",
|
|
@@ -112,8 +112,8 @@ const f = x.arrayToEnum([
|
|
|
112
112
|
"invalid_intersection_types",
|
|
113
113
|
"not_multiple_of",
|
|
114
114
|
"not_finite"
|
|
115
|
-
]),
|
|
116
|
-
class
|
|
115
|
+
]), tt = (r) => JSON.stringify(r, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
116
|
+
class O extends Error {
|
|
117
117
|
constructor(e) {
|
|
118
118
|
super(), this.issues = [], this.addIssue = (n) => {
|
|
119
119
|
this.issues = [...this.issues, n];
|
|
@@ -130,27 +130,27 @@ class N extends Error {
|
|
|
130
130
|
const t = e || function(a) {
|
|
131
131
|
return a.message;
|
|
132
132
|
}, n = { _errors: [] }, s = (a) => {
|
|
133
|
-
for (const
|
|
134
|
-
if (
|
|
135
|
-
|
|
136
|
-
else if (
|
|
137
|
-
s(
|
|
138
|
-
else if (
|
|
139
|
-
s(
|
|
140
|
-
else if (
|
|
141
|
-
n._errors.push(t(
|
|
133
|
+
for (const o of a.issues)
|
|
134
|
+
if (o.code === "invalid_union")
|
|
135
|
+
o.unionErrors.map(s);
|
|
136
|
+
else if (o.code === "invalid_return_type")
|
|
137
|
+
s(o.returnTypeError);
|
|
138
|
+
else if (o.code === "invalid_arguments")
|
|
139
|
+
s(o.argumentsError);
|
|
140
|
+
else if (o.path.length === 0)
|
|
141
|
+
n._errors.push(t(o));
|
|
142
142
|
else {
|
|
143
|
-
let
|
|
144
|
-
for (;
|
|
145
|
-
const
|
|
146
|
-
|
|
143
|
+
let i = n, d = 0;
|
|
144
|
+
for (; d < o.path.length; ) {
|
|
145
|
+
const u = o.path[d];
|
|
146
|
+
d === o.path.length - 1 ? (i[u] = i[u] || { _errors: [] }, i[u]._errors.push(t(o))) : i[u] = i[u] || { _errors: [] }, i = i[u], d++;
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
};
|
|
150
150
|
return s(this), n;
|
|
151
151
|
}
|
|
152
152
|
static assert(e) {
|
|
153
|
-
if (!(e instanceof
|
|
153
|
+
if (!(e instanceof O))
|
|
154
154
|
throw new Error(`Not a ZodError: ${e}`);
|
|
155
155
|
}
|
|
156
156
|
toString() {
|
|
@@ -172,56 +172,56 @@ class N extends Error {
|
|
|
172
172
|
return this.flatten();
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
-
|
|
175
|
+
O.create = (r) => new O(r);
|
|
176
176
|
const H = (r, e) => {
|
|
177
177
|
let t;
|
|
178
178
|
switch (r.code) {
|
|
179
|
-
case
|
|
179
|
+
case c.invalid_type:
|
|
180
180
|
r.received === f.undefined ? t = "Required" : t = `Expected ${r.expected}, received ${r.received}`;
|
|
181
181
|
break;
|
|
182
|
-
case
|
|
182
|
+
case c.invalid_literal:
|
|
183
183
|
t = `Invalid literal value, expected ${JSON.stringify(r.expected, x.jsonStringifyReplacer)}`;
|
|
184
184
|
break;
|
|
185
|
-
case
|
|
185
|
+
case c.unrecognized_keys:
|
|
186
186
|
t = `Unrecognized key(s) in object: ${x.joinValues(r.keys, ", ")}`;
|
|
187
187
|
break;
|
|
188
|
-
case
|
|
188
|
+
case c.invalid_union:
|
|
189
189
|
t = "Invalid input";
|
|
190
190
|
break;
|
|
191
|
-
case
|
|
191
|
+
case c.invalid_union_discriminator:
|
|
192
192
|
t = `Invalid discriminator value. Expected ${x.joinValues(r.options)}`;
|
|
193
193
|
break;
|
|
194
|
-
case
|
|
194
|
+
case c.invalid_enum_value:
|
|
195
195
|
t = `Invalid enum value. Expected ${x.joinValues(r.options)}, received '${r.received}'`;
|
|
196
196
|
break;
|
|
197
|
-
case
|
|
197
|
+
case c.invalid_arguments:
|
|
198
198
|
t = "Invalid function arguments";
|
|
199
199
|
break;
|
|
200
|
-
case
|
|
200
|
+
case c.invalid_return_type:
|
|
201
201
|
t = "Invalid function return type";
|
|
202
202
|
break;
|
|
203
|
-
case
|
|
203
|
+
case c.invalid_date:
|
|
204
204
|
t = "Invalid date";
|
|
205
205
|
break;
|
|
206
|
-
case
|
|
206
|
+
case c.invalid_string:
|
|
207
207
|
typeof r.validation == "object" ? "includes" in r.validation ? (t = `Invalid input: must include "${r.validation.includes}"`, typeof r.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${r.validation.position}`)) : "startsWith" in r.validation ? t = `Invalid input: must start with "${r.validation.startsWith}"` : "endsWith" in r.validation ? t = `Invalid input: must end with "${r.validation.endsWith}"` : x.assertNever(r.validation) : r.validation !== "regex" ? t = `Invalid ${r.validation}` : t = "Invalid";
|
|
208
208
|
break;
|
|
209
|
-
case
|
|
209
|
+
case c.too_small:
|
|
210
210
|
r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "more than"} ${r.minimum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "over"} ${r.minimum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${r.minimum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(r.minimum))}` : t = "Invalid input";
|
|
211
211
|
break;
|
|
212
|
-
case
|
|
212
|
+
case c.too_big:
|
|
213
213
|
r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "less than"} ${r.maximum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "under"} ${r.maximum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "bigint" ? t = `BigInt must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly" : r.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(r.maximum))}` : t = "Invalid input";
|
|
214
214
|
break;
|
|
215
|
-
case
|
|
215
|
+
case c.custom:
|
|
216
216
|
t = "Invalid input";
|
|
217
217
|
break;
|
|
218
|
-
case
|
|
218
|
+
case c.invalid_intersection_types:
|
|
219
219
|
t = "Intersection results could not be merged";
|
|
220
220
|
break;
|
|
221
|
-
case
|
|
221
|
+
case c.not_multiple_of:
|
|
222
222
|
t = `Number must be a multiple of ${r.multipleOf}`;
|
|
223
223
|
break;
|
|
224
|
-
case
|
|
224
|
+
case c.not_finite:
|
|
225
225
|
t = "Number must be finite";
|
|
226
226
|
break;
|
|
227
227
|
default:
|
|
@@ -229,15 +229,15 @@ const H = (r, e) => {
|
|
|
229
229
|
}
|
|
230
230
|
return { message: t };
|
|
231
231
|
};
|
|
232
|
-
let
|
|
233
|
-
function
|
|
234
|
-
|
|
232
|
+
let Me = H;
|
|
233
|
+
function rt(r) {
|
|
234
|
+
Me = r;
|
|
235
235
|
}
|
|
236
236
|
function ye() {
|
|
237
|
-
return
|
|
237
|
+
return Me;
|
|
238
238
|
}
|
|
239
239
|
const _e = (r) => {
|
|
240
|
-
const { data: e, path: t, errorMaps: n, issueData: s } = r, a = [...t, ...s.path || []],
|
|
240
|
+
const { data: e, path: t, errorMaps: n, issueData: s } = r, a = [...t, ...s.path || []], o = {
|
|
241
241
|
...s,
|
|
242
242
|
path: a
|
|
243
243
|
};
|
|
@@ -247,16 +247,16 @@ const _e = (r) => {
|
|
|
247
247
|
path: a,
|
|
248
248
|
message: s.message
|
|
249
249
|
};
|
|
250
|
-
let
|
|
251
|
-
const
|
|
252
|
-
for (const
|
|
253
|
-
|
|
250
|
+
let i = "";
|
|
251
|
+
const d = n.filter((u) => !!u).slice().reverse();
|
|
252
|
+
for (const u of d)
|
|
253
|
+
i = u(o, { data: e, defaultError: i }).message;
|
|
254
254
|
return {
|
|
255
255
|
...s,
|
|
256
256
|
path: a,
|
|
257
|
-
message:
|
|
257
|
+
message: i
|
|
258
258
|
};
|
|
259
|
-
},
|
|
259
|
+
}, nt = [];
|
|
260
260
|
function l(r, e) {
|
|
261
261
|
const t = ye(), n = _e({
|
|
262
262
|
issueData: e,
|
|
@@ -272,7 +272,7 @@ function l(r, e) {
|
|
|
272
272
|
});
|
|
273
273
|
r.common.issues.push(n);
|
|
274
274
|
}
|
|
275
|
-
class
|
|
275
|
+
class S {
|
|
276
276
|
constructor() {
|
|
277
277
|
this.value = "valid";
|
|
278
278
|
}
|
|
@@ -294,33 +294,33 @@ class Z {
|
|
|
294
294
|
static async mergeObjectAsync(e, t) {
|
|
295
295
|
const n = [];
|
|
296
296
|
for (const s of t) {
|
|
297
|
-
const a = await s.key,
|
|
297
|
+
const a = await s.key, o = await s.value;
|
|
298
298
|
n.push({
|
|
299
299
|
key: a,
|
|
300
|
-
value:
|
|
300
|
+
value: o
|
|
301
301
|
});
|
|
302
302
|
}
|
|
303
|
-
return
|
|
303
|
+
return S.mergeObjectSync(e, n);
|
|
304
304
|
}
|
|
305
305
|
static mergeObjectSync(e, t) {
|
|
306
306
|
const n = {};
|
|
307
307
|
for (const s of t) {
|
|
308
|
-
const { key: a, value:
|
|
309
|
-
if (a.status === "aborted" ||
|
|
308
|
+
const { key: a, value: o } = s;
|
|
309
|
+
if (a.status === "aborted" || o.status === "aborted")
|
|
310
310
|
return p;
|
|
311
|
-
a.status === "dirty" && e.dirty(),
|
|
311
|
+
a.status === "dirty" && e.dirty(), o.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof o.value < "u" || s.alwaysSet) && (n[a.value] = o.value);
|
|
312
312
|
}
|
|
313
313
|
return { status: e.value, value: n };
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
const p = Object.freeze({
|
|
317
317
|
status: "aborted"
|
|
318
|
-
}),
|
|
318
|
+
}), Y = (r) => ({ status: "dirty", value: r }), Z = (r) => ({ status: "valid", value: r }), Ce = (r) => r.status === "aborted", Ne = (r) => r.status === "dirty", ee = (r) => r.status === "valid", te = (r) => typeof Promise < "u" && r instanceof Promise;
|
|
319
319
|
function ve(r, e, t, n) {
|
|
320
320
|
if (typeof e == "function" ? r !== e || !n : !e.has(r)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
321
321
|
return e.get(r);
|
|
322
322
|
}
|
|
323
|
-
function
|
|
323
|
+
function $e(r, e, t, n, s) {
|
|
324
324
|
if (typeof e == "function" ? r !== e || !s : !e.has(r)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
325
325
|
return e.set(r, t), t;
|
|
326
326
|
}
|
|
@@ -328,7 +328,7 @@ var h;
|
|
|
328
328
|
(function(r) {
|
|
329
329
|
r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
330
330
|
})(h || (h = {}));
|
|
331
|
-
var
|
|
331
|
+
var F, K;
|
|
332
332
|
class A {
|
|
333
333
|
constructor(e, t, n, s) {
|
|
334
334
|
this._cachedPath = [], this.parent = e, this.data = t, this._path = n, this._key = s;
|
|
@@ -347,7 +347,7 @@ const Ie = (r, e) => {
|
|
|
347
347
|
get error() {
|
|
348
348
|
if (this._error)
|
|
349
349
|
return this._error;
|
|
350
|
-
const t = new
|
|
350
|
+
const t = new O(r.common.issues);
|
|
351
351
|
return this._error = t, this._error;
|
|
352
352
|
}
|
|
353
353
|
};
|
|
@@ -358,10 +358,10 @@ function _(r) {
|
|
|
358
358
|
const { errorMap: e, invalid_type_error: t, required_error: n, description: s } = r;
|
|
359
359
|
if (e && (t || n))
|
|
360
360
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
361
|
-
return e ? { errorMap: e, description: s } : { errorMap: (
|
|
362
|
-
var
|
|
361
|
+
return e ? { errorMap: e, description: s } : { errorMap: (o, i) => {
|
|
362
|
+
var d, u;
|
|
363
363
|
const { message: y } = r;
|
|
364
|
-
return
|
|
364
|
+
return o.code === "invalid_enum_value" ? { message: y ?? i.defaultError } : typeof i.data > "u" ? { message: (d = y ?? n) !== null && d !== void 0 ? d : i.defaultError } : o.code !== "invalid_type" ? { message: i.defaultError } : { message: (u = y ?? t) !== null && u !== void 0 ? u : i.defaultError };
|
|
365
365
|
}, description: s };
|
|
366
366
|
}
|
|
367
367
|
class v {
|
|
@@ -372,13 +372,13 @@ class v {
|
|
|
372
372
|
return this._def.description;
|
|
373
373
|
}
|
|
374
374
|
_getType(e) {
|
|
375
|
-
return
|
|
375
|
+
return z(e.data);
|
|
376
376
|
}
|
|
377
377
|
_getOrReturnCtx(e, t) {
|
|
378
378
|
return t || {
|
|
379
379
|
common: e.parent.common,
|
|
380
380
|
data: e.data,
|
|
381
|
-
parsedType:
|
|
381
|
+
parsedType: z(e.data),
|
|
382
382
|
schemaErrorMap: this._def.errorMap,
|
|
383
383
|
path: e.path,
|
|
384
384
|
parent: e.parent
|
|
@@ -386,11 +386,11 @@ class v {
|
|
|
386
386
|
}
|
|
387
387
|
_processInputParams(e) {
|
|
388
388
|
return {
|
|
389
|
-
status: new
|
|
389
|
+
status: new S(),
|
|
390
390
|
ctx: {
|
|
391
391
|
common: e.parent.common,
|
|
392
392
|
data: e.data,
|
|
393
|
-
parsedType:
|
|
393
|
+
parsedType: z(e.data),
|
|
394
394
|
schemaErrorMap: this._def.errorMap,
|
|
395
395
|
path: e.path,
|
|
396
396
|
parent: e.parent
|
|
@@ -425,7 +425,7 @@ class v {
|
|
|
425
425
|
schemaErrorMap: this._def.errorMap,
|
|
426
426
|
parent: null,
|
|
427
427
|
data: e,
|
|
428
|
-
parsedType:
|
|
428
|
+
parsedType: z(e)
|
|
429
429
|
}, a = this._parseSync({ data: e, path: s.path, parent: s });
|
|
430
430
|
return Ie(s, a);
|
|
431
431
|
}
|
|
@@ -446,18 +446,18 @@ class v {
|
|
|
446
446
|
schemaErrorMap: this._def.errorMap,
|
|
447
447
|
parent: null,
|
|
448
448
|
data: e,
|
|
449
|
-
parsedType:
|
|
449
|
+
parsedType: z(e)
|
|
450
450
|
}, s = this._parse({ data: e, path: n.path, parent: n }), a = await (te(s) ? s : Promise.resolve(s));
|
|
451
451
|
return Ie(n, a);
|
|
452
452
|
}
|
|
453
453
|
refine(e, t) {
|
|
454
454
|
const n = (s) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(s) : t;
|
|
455
455
|
return this._refinement((s, a) => {
|
|
456
|
-
const
|
|
457
|
-
code:
|
|
456
|
+
const o = e(s), i = () => a.addIssue({
|
|
457
|
+
code: c.custom,
|
|
458
458
|
...n(s)
|
|
459
459
|
});
|
|
460
|
-
return typeof Promise < "u" &&
|
|
460
|
+
return typeof Promise < "u" && o instanceof Promise ? o.then((d) => d ? !0 : (i(), !1)) : o ? !0 : (i(), !1);
|
|
461
461
|
});
|
|
462
462
|
}
|
|
463
463
|
refinement(e, t) {
|
|
@@ -486,7 +486,7 @@ class v {
|
|
|
486
486
|
return R.create(this, this._def);
|
|
487
487
|
}
|
|
488
488
|
promise() {
|
|
489
|
-
return
|
|
489
|
+
return X.create(this, this._def);
|
|
490
490
|
}
|
|
491
491
|
or(e) {
|
|
492
492
|
return ae.create([this, e], this._def);
|
|
@@ -547,40 +547,40 @@ class v {
|
|
|
547
547
|
return this.safeParse(null).success;
|
|
548
548
|
}
|
|
549
549
|
}
|
|
550
|
-
const
|
|
551
|
-
let
|
|
552
|
-
const
|
|
550
|
+
const st = /^c[^\s-]{8,}$/i, at = /^[0-9a-z]+$/, it = /^[0-9A-HJKMNP-TV-Z]{26}$/, ot = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, ct = /^[a-z0-9_-]{21}$/i, dt = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, ut = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, lt = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
551
|
+
let Se;
|
|
552
|
+
const ft = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, ht = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/, mt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Pe = "((\\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])))", pt = new RegExp(`^${Pe}$`);
|
|
553
553
|
function ze(r) {
|
|
554
554
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
555
555
|
return r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
556
556
|
}
|
|
557
|
-
function
|
|
557
|
+
function yt(r) {
|
|
558
558
|
return new RegExp(`^${ze(r)}$`);
|
|
559
559
|
}
|
|
560
|
-
function
|
|
561
|
-
let e = `${
|
|
560
|
+
function Ve(r) {
|
|
561
|
+
let e = `${Pe}T${ze(r)}`;
|
|
562
562
|
const t = [];
|
|
563
563
|
return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
564
564
|
}
|
|
565
|
-
function
|
|
566
|
-
return !!((e === "v4" || !e) &&
|
|
565
|
+
function _t(r, e) {
|
|
566
|
+
return !!((e === "v4" || !e) && ft.test(r) || (e === "v6" || !e) && ht.test(r));
|
|
567
567
|
}
|
|
568
568
|
class E extends v {
|
|
569
569
|
_parse(e) {
|
|
570
570
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== f.string) {
|
|
571
571
|
const a = this._getOrReturnCtx(e);
|
|
572
572
|
return l(a, {
|
|
573
|
-
code:
|
|
573
|
+
code: c.invalid_type,
|
|
574
574
|
expected: f.string,
|
|
575
575
|
received: a.parsedType
|
|
576
576
|
}), p;
|
|
577
577
|
}
|
|
578
|
-
const n = new
|
|
578
|
+
const n = new S();
|
|
579
579
|
let s;
|
|
580
580
|
for (const a of this._def.checks)
|
|
581
581
|
if (a.kind === "min")
|
|
582
582
|
e.data.length < a.value && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
583
|
-
code:
|
|
583
|
+
code: c.too_small,
|
|
584
584
|
minimum: a.value,
|
|
585
585
|
type: "string",
|
|
586
586
|
inclusive: !0,
|
|
@@ -589,7 +589,7 @@ class E extends v {
|
|
|
589
589
|
}), n.dirty());
|
|
590
590
|
else if (a.kind === "max")
|
|
591
591
|
e.data.length > a.value && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
592
|
-
code:
|
|
592
|
+
code: c.too_big,
|
|
593
593
|
maximum: a.value,
|
|
594
594
|
type: "string",
|
|
595
595
|
inclusive: !0,
|
|
@@ -597,16 +597,16 @@ class E extends v {
|
|
|
597
597
|
message: a.message
|
|
598
598
|
}), n.dirty());
|
|
599
599
|
else if (a.kind === "length") {
|
|
600
|
-
const
|
|
601
|
-
(
|
|
602
|
-
code:
|
|
600
|
+
const o = e.data.length > a.value, i = e.data.length < a.value;
|
|
601
|
+
(o || i) && (s = this._getOrReturnCtx(e, s), o ? l(s, {
|
|
602
|
+
code: c.too_big,
|
|
603
603
|
maximum: a.value,
|
|
604
604
|
type: "string",
|
|
605
605
|
inclusive: !0,
|
|
606
606
|
exact: !0,
|
|
607
607
|
message: a.message
|
|
608
|
-
}) :
|
|
609
|
-
code:
|
|
608
|
+
}) : i && l(s, {
|
|
609
|
+
code: c.too_small,
|
|
610
610
|
minimum: a.value,
|
|
611
611
|
type: "string",
|
|
612
612
|
inclusive: !0,
|
|
@@ -614,45 +614,45 @@ class E extends v {
|
|
|
614
614
|
message: a.message
|
|
615
615
|
}), n.dirty());
|
|
616
616
|
} else if (a.kind === "email")
|
|
617
|
-
|
|
617
|
+
ut.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
618
618
|
validation: "email",
|
|
619
|
-
code:
|
|
619
|
+
code: c.invalid_string,
|
|
620
620
|
message: a.message
|
|
621
621
|
}), n.dirty());
|
|
622
622
|
else if (a.kind === "emoji")
|
|
623
|
-
|
|
623
|
+
Se || (Se = new RegExp(lt, "u")), Se.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
624
624
|
validation: "emoji",
|
|
625
|
-
code:
|
|
625
|
+
code: c.invalid_string,
|
|
626
626
|
message: a.message
|
|
627
627
|
}), n.dirty());
|
|
628
628
|
else if (a.kind === "uuid")
|
|
629
|
-
|
|
629
|
+
ot.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
630
630
|
validation: "uuid",
|
|
631
|
-
code:
|
|
631
|
+
code: c.invalid_string,
|
|
632
632
|
message: a.message
|
|
633
633
|
}), n.dirty());
|
|
634
634
|
else if (a.kind === "nanoid")
|
|
635
|
-
|
|
635
|
+
ct.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
636
636
|
validation: "nanoid",
|
|
637
|
-
code:
|
|
637
|
+
code: c.invalid_string,
|
|
638
638
|
message: a.message
|
|
639
639
|
}), n.dirty());
|
|
640
640
|
else if (a.kind === "cuid")
|
|
641
|
-
|
|
641
|
+
st.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
642
642
|
validation: "cuid",
|
|
643
|
-
code:
|
|
643
|
+
code: c.invalid_string,
|
|
644
644
|
message: a.message
|
|
645
645
|
}), n.dirty());
|
|
646
646
|
else if (a.kind === "cuid2")
|
|
647
|
-
|
|
647
|
+
at.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
648
648
|
validation: "cuid2",
|
|
649
|
-
code:
|
|
649
|
+
code: c.invalid_string,
|
|
650
650
|
message: a.message
|
|
651
651
|
}), n.dirty());
|
|
652
652
|
else if (a.kind === "ulid")
|
|
653
|
-
|
|
653
|
+
it.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
654
654
|
validation: "ulid",
|
|
655
|
-
code:
|
|
655
|
+
code: c.invalid_string,
|
|
656
656
|
message: a.message
|
|
657
657
|
}), n.dirty());
|
|
658
658
|
else if (a.kind === "url")
|
|
@@ -661,49 +661,49 @@ class E extends v {
|
|
|
661
661
|
} catch {
|
|
662
662
|
s = this._getOrReturnCtx(e, s), l(s, {
|
|
663
663
|
validation: "url",
|
|
664
|
-
code:
|
|
664
|
+
code: c.invalid_string,
|
|
665
665
|
message: a.message
|
|
666
666
|
}), n.dirty();
|
|
667
667
|
}
|
|
668
668
|
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
669
669
|
validation: "regex",
|
|
670
|
-
code:
|
|
670
|
+
code: c.invalid_string,
|
|
671
671
|
message: a.message
|
|
672
672
|
}), n.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
673
|
-
code:
|
|
673
|
+
code: c.invalid_string,
|
|
674
674
|
validation: { includes: a.value, position: a.position },
|
|
675
675
|
message: a.message
|
|
676
676
|
}), n.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
677
|
-
code:
|
|
677
|
+
code: c.invalid_string,
|
|
678
678
|
validation: { startsWith: a.value },
|
|
679
679
|
message: a.message
|
|
680
680
|
}), n.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
681
|
-
code:
|
|
681
|
+
code: c.invalid_string,
|
|
682
682
|
validation: { endsWith: a.value },
|
|
683
683
|
message: a.message
|
|
684
|
-
}), n.dirty()) : a.kind === "datetime" ?
|
|
685
|
-
code:
|
|
684
|
+
}), n.dirty()) : a.kind === "datetime" ? Ve(a).test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
685
|
+
code: c.invalid_string,
|
|
686
686
|
validation: "datetime",
|
|
687
687
|
message: a.message
|
|
688
|
-
}), n.dirty()) : a.kind === "date" ?
|
|
689
|
-
code:
|
|
688
|
+
}), n.dirty()) : a.kind === "date" ? pt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
689
|
+
code: c.invalid_string,
|
|
690
690
|
validation: "date",
|
|
691
691
|
message: a.message
|
|
692
|
-
}), n.dirty()) : a.kind === "time" ?
|
|
693
|
-
code:
|
|
692
|
+
}), n.dirty()) : a.kind === "time" ? yt(a).test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
693
|
+
code: c.invalid_string,
|
|
694
694
|
validation: "time",
|
|
695
695
|
message: a.message
|
|
696
|
-
}), n.dirty()) : a.kind === "duration" ?
|
|
696
|
+
}), n.dirty()) : a.kind === "duration" ? dt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
697
697
|
validation: "duration",
|
|
698
|
-
code:
|
|
698
|
+
code: c.invalid_string,
|
|
699
699
|
message: a.message
|
|
700
|
-
}), n.dirty()) : a.kind === "ip" ?
|
|
700
|
+
}), n.dirty()) : a.kind === "ip" ? _t(e.data, a.version) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
701
701
|
validation: "ip",
|
|
702
|
-
code:
|
|
702
|
+
code: c.invalid_string,
|
|
703
703
|
message: a.message
|
|
704
|
-
}), n.dirty()) : a.kind === "base64" ?
|
|
704
|
+
}), n.dirty()) : a.kind === "base64" ? mt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
705
705
|
validation: "base64",
|
|
706
|
-
code:
|
|
706
|
+
code: c.invalid_string,
|
|
707
707
|
message: a.message
|
|
708
708
|
}), n.dirty()) : x.assertNever(a);
|
|
709
709
|
return { status: n.value, value: e.data };
|
|
@@ -711,7 +711,7 @@ class E extends v {
|
|
|
711
711
|
_regex(e, t, n) {
|
|
712
712
|
return this.refinement((s) => e.test(s), {
|
|
713
713
|
validation: t,
|
|
714
|
-
code:
|
|
714
|
+
code: c.invalid_string,
|
|
715
715
|
...h.errToObj(n)
|
|
716
716
|
});
|
|
717
717
|
}
|
|
@@ -923,9 +923,9 @@ E.create = (r) => {
|
|
|
923
923
|
..._(r)
|
|
924
924
|
});
|
|
925
925
|
};
|
|
926
|
-
function
|
|
927
|
-
const t = (r.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = t > n ? t : n, a = parseInt(r.toFixed(s).replace(".", "")),
|
|
928
|
-
return a %
|
|
926
|
+
function vt(r, e) {
|
|
927
|
+
const t = (r.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = t > n ? t : n, a = parseInt(r.toFixed(s).replace(".", "")), o = parseInt(e.toFixed(s).replace(".", ""));
|
|
928
|
+
return a % o / Math.pow(10, s);
|
|
929
929
|
}
|
|
930
930
|
class V extends v {
|
|
931
931
|
constructor() {
|
|
@@ -935,39 +935,39 @@ class V extends v {
|
|
|
935
935
|
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== f.number) {
|
|
936
936
|
const a = this._getOrReturnCtx(e);
|
|
937
937
|
return l(a, {
|
|
938
|
-
code:
|
|
938
|
+
code: c.invalid_type,
|
|
939
939
|
expected: f.number,
|
|
940
940
|
received: a.parsedType
|
|
941
941
|
}), p;
|
|
942
942
|
}
|
|
943
943
|
let n;
|
|
944
|
-
const s = new
|
|
944
|
+
const s = new S();
|
|
945
945
|
for (const a of this._def.checks)
|
|
946
946
|
a.kind === "int" ? x.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
947
|
-
code:
|
|
947
|
+
code: c.invalid_type,
|
|
948
948
|
expected: "integer",
|
|
949
949
|
received: "float",
|
|
950
950
|
message: a.message
|
|
951
951
|
}), s.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
952
|
-
code:
|
|
952
|
+
code: c.too_small,
|
|
953
953
|
minimum: a.value,
|
|
954
954
|
type: "number",
|
|
955
955
|
inclusive: a.inclusive,
|
|
956
956
|
exact: !1,
|
|
957
957
|
message: a.message
|
|
958
958
|
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
959
|
-
code:
|
|
959
|
+
code: c.too_big,
|
|
960
960
|
maximum: a.value,
|
|
961
961
|
type: "number",
|
|
962
962
|
inclusive: a.inclusive,
|
|
963
963
|
exact: !1,
|
|
964
964
|
message: a.message
|
|
965
|
-
}), s.dirty()) : a.kind === "multipleOf" ?
|
|
966
|
-
code:
|
|
965
|
+
}), s.dirty()) : a.kind === "multipleOf" ? vt(e.data, a.value) !== 0 && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
966
|
+
code: c.not_multiple_of,
|
|
967
967
|
multipleOf: a.value,
|
|
968
968
|
message: a.message
|
|
969
969
|
}), s.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
970
|
-
code:
|
|
970
|
+
code: c.not_finite,
|
|
971
971
|
message: a.message
|
|
972
972
|
}), s.dirty()) : x.assertNever(a);
|
|
973
973
|
return { status: s.value, value: e.data };
|
|
@@ -1107,28 +1107,28 @@ class D extends v {
|
|
|
1107
1107
|
if (this._def.coerce && (e.data = BigInt(e.data)), this._getType(e) !== f.bigint) {
|
|
1108
1108
|
const a = this._getOrReturnCtx(e);
|
|
1109
1109
|
return l(a, {
|
|
1110
|
-
code:
|
|
1110
|
+
code: c.invalid_type,
|
|
1111
1111
|
expected: f.bigint,
|
|
1112
1112
|
received: a.parsedType
|
|
1113
1113
|
}), p;
|
|
1114
1114
|
}
|
|
1115
1115
|
let n;
|
|
1116
|
-
const s = new
|
|
1116
|
+
const s = new S();
|
|
1117
1117
|
for (const a of this._def.checks)
|
|
1118
1118
|
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1119
|
-
code:
|
|
1119
|
+
code: c.too_small,
|
|
1120
1120
|
type: "bigint",
|
|
1121
1121
|
minimum: a.value,
|
|
1122
1122
|
inclusive: a.inclusive,
|
|
1123
1123
|
message: a.message
|
|
1124
1124
|
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1125
|
-
code:
|
|
1125
|
+
code: c.too_big,
|
|
1126
1126
|
type: "bigint",
|
|
1127
1127
|
maximum: a.value,
|
|
1128
1128
|
inclusive: a.inclusive,
|
|
1129
1129
|
message: a.message
|
|
1130
1130
|
}), s.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1131
|
-
code:
|
|
1131
|
+
code: c.not_multiple_of,
|
|
1132
1132
|
multipleOf: a.value,
|
|
1133
1133
|
message: a.message
|
|
1134
1134
|
}), s.dirty()) : x.assertNever(a);
|
|
@@ -1232,12 +1232,12 @@ class re extends v {
|
|
|
1232
1232
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== f.boolean) {
|
|
1233
1233
|
const n = this._getOrReturnCtx(e);
|
|
1234
1234
|
return l(n, {
|
|
1235
|
-
code:
|
|
1235
|
+
code: c.invalid_type,
|
|
1236
1236
|
expected: f.boolean,
|
|
1237
1237
|
received: n.parsedType
|
|
1238
1238
|
}), p;
|
|
1239
1239
|
}
|
|
1240
|
-
return
|
|
1240
|
+
return Z(e.data);
|
|
1241
1241
|
}
|
|
1242
1242
|
}
|
|
1243
1243
|
re.create = (r) => new re({
|
|
@@ -1250,7 +1250,7 @@ class B extends v {
|
|
|
1250
1250
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== f.date) {
|
|
1251
1251
|
const a = this._getOrReturnCtx(e);
|
|
1252
1252
|
return l(a, {
|
|
1253
|
-
code:
|
|
1253
|
+
code: c.invalid_type,
|
|
1254
1254
|
expected: f.date,
|
|
1255
1255
|
received: a.parsedType
|
|
1256
1256
|
}), p;
|
|
@@ -1258,21 +1258,21 @@ class B extends v {
|
|
|
1258
1258
|
if (isNaN(e.data.getTime())) {
|
|
1259
1259
|
const a = this._getOrReturnCtx(e);
|
|
1260
1260
|
return l(a, {
|
|
1261
|
-
code:
|
|
1261
|
+
code: c.invalid_date
|
|
1262
1262
|
}), p;
|
|
1263
1263
|
}
|
|
1264
|
-
const n = new
|
|
1264
|
+
const n = new S();
|
|
1265
1265
|
let s;
|
|
1266
1266
|
for (const a of this._def.checks)
|
|
1267
1267
|
a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1268
|
-
code:
|
|
1268
|
+
code: c.too_small,
|
|
1269
1269
|
message: a.message,
|
|
1270
1270
|
inclusive: !0,
|
|
1271
1271
|
exact: !1,
|
|
1272
1272
|
minimum: a.value,
|
|
1273
1273
|
type: "date"
|
|
1274
1274
|
}), n.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1275
|
-
code:
|
|
1275
|
+
code: c.too_big,
|
|
1276
1276
|
message: a.message,
|
|
1277
1277
|
inclusive: !0,
|
|
1278
1278
|
exact: !1,
|
|
@@ -1328,12 +1328,12 @@ class ge extends v {
|
|
|
1328
1328
|
if (this._getType(e) !== f.symbol) {
|
|
1329
1329
|
const n = this._getOrReturnCtx(e);
|
|
1330
1330
|
return l(n, {
|
|
1331
|
-
code:
|
|
1331
|
+
code: c.invalid_type,
|
|
1332
1332
|
expected: f.symbol,
|
|
1333
1333
|
received: n.parsedType
|
|
1334
1334
|
}), p;
|
|
1335
1335
|
}
|
|
1336
|
-
return
|
|
1336
|
+
return Z(e.data);
|
|
1337
1337
|
}
|
|
1338
1338
|
}
|
|
1339
1339
|
ge.create = (r) => new ge({
|
|
@@ -1345,12 +1345,12 @@ class ne extends v {
|
|
|
1345
1345
|
if (this._getType(e) !== f.undefined) {
|
|
1346
1346
|
const n = this._getOrReturnCtx(e);
|
|
1347
1347
|
return l(n, {
|
|
1348
|
-
code:
|
|
1348
|
+
code: c.invalid_type,
|
|
1349
1349
|
expected: f.undefined,
|
|
1350
1350
|
received: n.parsedType
|
|
1351
1351
|
}), p;
|
|
1352
1352
|
}
|
|
1353
|
-
return
|
|
1353
|
+
return Z(e.data);
|
|
1354
1354
|
}
|
|
1355
1355
|
}
|
|
1356
1356
|
ne.create = (r) => new ne({
|
|
@@ -1362,27 +1362,27 @@ class se extends v {
|
|
|
1362
1362
|
if (this._getType(e) !== f.null) {
|
|
1363
1363
|
const n = this._getOrReturnCtx(e);
|
|
1364
1364
|
return l(n, {
|
|
1365
|
-
code:
|
|
1365
|
+
code: c.invalid_type,
|
|
1366
1366
|
expected: f.null,
|
|
1367
1367
|
received: n.parsedType
|
|
1368
1368
|
}), p;
|
|
1369
1369
|
}
|
|
1370
|
-
return
|
|
1370
|
+
return Z(e.data);
|
|
1371
1371
|
}
|
|
1372
1372
|
}
|
|
1373
1373
|
se.create = (r) => new se({
|
|
1374
1374
|
typeName: m.ZodNull,
|
|
1375
1375
|
..._(r)
|
|
1376
1376
|
});
|
|
1377
|
-
class
|
|
1377
|
+
class Q extends v {
|
|
1378
1378
|
constructor() {
|
|
1379
1379
|
super(...arguments), this._any = !0;
|
|
1380
1380
|
}
|
|
1381
1381
|
_parse(e) {
|
|
1382
|
-
return
|
|
1382
|
+
return Z(e.data);
|
|
1383
1383
|
}
|
|
1384
1384
|
}
|
|
1385
|
-
|
|
1385
|
+
Q.create = (r) => new Q({
|
|
1386
1386
|
typeName: m.ZodAny,
|
|
1387
1387
|
..._(r)
|
|
1388
1388
|
});
|
|
@@ -1391,24 +1391,24 @@ class U extends v {
|
|
|
1391
1391
|
super(...arguments), this._unknown = !0;
|
|
1392
1392
|
}
|
|
1393
1393
|
_parse(e) {
|
|
1394
|
-
return
|
|
1394
|
+
return Z(e.data);
|
|
1395
1395
|
}
|
|
1396
1396
|
}
|
|
1397
1397
|
U.create = (r) => new U({
|
|
1398
1398
|
typeName: m.ZodUnknown,
|
|
1399
1399
|
..._(r)
|
|
1400
1400
|
});
|
|
1401
|
-
class
|
|
1401
|
+
class P extends v {
|
|
1402
1402
|
_parse(e) {
|
|
1403
1403
|
const t = this._getOrReturnCtx(e);
|
|
1404
1404
|
return l(t, {
|
|
1405
|
-
code:
|
|
1405
|
+
code: c.invalid_type,
|
|
1406
1406
|
expected: f.never,
|
|
1407
1407
|
received: t.parsedType
|
|
1408
1408
|
}), p;
|
|
1409
1409
|
}
|
|
1410
1410
|
}
|
|
1411
|
-
|
|
1411
|
+
P.create = (r) => new P({
|
|
1412
1412
|
typeName: m.ZodNever,
|
|
1413
1413
|
..._(r)
|
|
1414
1414
|
});
|
|
@@ -1417,12 +1417,12 @@ class xe extends v {
|
|
|
1417
1417
|
if (this._getType(e) !== f.undefined) {
|
|
1418
1418
|
const n = this._getOrReturnCtx(e);
|
|
1419
1419
|
return l(n, {
|
|
1420
|
-
code:
|
|
1420
|
+
code: c.invalid_type,
|
|
1421
1421
|
expected: f.void,
|
|
1422
1422
|
received: n.parsedType
|
|
1423
1423
|
}), p;
|
|
1424
1424
|
}
|
|
1425
|
-
return
|
|
1425
|
+
return Z(e.data);
|
|
1426
1426
|
}
|
|
1427
1427
|
}
|
|
1428
1428
|
xe.create = (r) => new xe({
|
|
@@ -1434,16 +1434,16 @@ class R extends v {
|
|
|
1434
1434
|
const { ctx: t, status: n } = this._processInputParams(e), s = this._def;
|
|
1435
1435
|
if (t.parsedType !== f.array)
|
|
1436
1436
|
return l(t, {
|
|
1437
|
-
code:
|
|
1437
|
+
code: c.invalid_type,
|
|
1438
1438
|
expected: f.array,
|
|
1439
1439
|
received: t.parsedType
|
|
1440
1440
|
}), p;
|
|
1441
1441
|
if (s.exactLength !== null) {
|
|
1442
|
-
const
|
|
1443
|
-
(
|
|
1444
|
-
code:
|
|
1445
|
-
minimum:
|
|
1446
|
-
maximum:
|
|
1442
|
+
const o = t.data.length > s.exactLength.value, i = t.data.length < s.exactLength.value;
|
|
1443
|
+
(o || i) && (l(t, {
|
|
1444
|
+
code: o ? c.too_big : c.too_small,
|
|
1445
|
+
minimum: i ? s.exactLength.value : void 0,
|
|
1446
|
+
maximum: o ? s.exactLength.value : void 0,
|
|
1447
1447
|
type: "array",
|
|
1448
1448
|
inclusive: !0,
|
|
1449
1449
|
exact: !0,
|
|
@@ -1451,23 +1451,23 @@ class R extends v {
|
|
|
1451
1451
|
}), n.dirty());
|
|
1452
1452
|
}
|
|
1453
1453
|
if (s.minLength !== null && t.data.length < s.minLength.value && (l(t, {
|
|
1454
|
-
code:
|
|
1454
|
+
code: c.too_small,
|
|
1455
1455
|
minimum: s.minLength.value,
|
|
1456
1456
|
type: "array",
|
|
1457
1457
|
inclusive: !0,
|
|
1458
1458
|
exact: !1,
|
|
1459
1459
|
message: s.minLength.message
|
|
1460
1460
|
}), n.dirty()), s.maxLength !== null && t.data.length > s.maxLength.value && (l(t, {
|
|
1461
|
-
code:
|
|
1461
|
+
code: c.too_big,
|
|
1462
1462
|
maximum: s.maxLength.value,
|
|
1463
1463
|
type: "array",
|
|
1464
1464
|
inclusive: !0,
|
|
1465
1465
|
exact: !1,
|
|
1466
1466
|
message: s.maxLength.message
|
|
1467
1467
|
}), n.dirty()), t.common.async)
|
|
1468
|
-
return Promise.all([...t.data].map((
|
|
1469
|
-
const a = [...t.data].map((
|
|
1470
|
-
return
|
|
1468
|
+
return Promise.all([...t.data].map((o, i) => s.type._parseAsync(new A(t, o, t.path, i)))).then((o) => S.mergeArray(n, o));
|
|
1469
|
+
const a = [...t.data].map((o, i) => s.type._parseSync(new A(t, o, t.path, i)));
|
|
1470
|
+
return S.mergeArray(n, a);
|
|
1471
1471
|
}
|
|
1472
1472
|
get element() {
|
|
1473
1473
|
return this._def.type;
|
|
@@ -1502,23 +1502,23 @@ R.create = (r, e) => new R({
|
|
|
1502
1502
|
typeName: m.ZodArray,
|
|
1503
1503
|
..._(e)
|
|
1504
1504
|
});
|
|
1505
|
-
function
|
|
1506
|
-
if (r instanceof
|
|
1505
|
+
function J(r) {
|
|
1506
|
+
if (r instanceof b) {
|
|
1507
1507
|
const e = {};
|
|
1508
1508
|
for (const t in r.shape) {
|
|
1509
1509
|
const n = r.shape[t];
|
|
1510
|
-
e[t] = j.create(
|
|
1510
|
+
e[t] = j.create(J(n));
|
|
1511
1511
|
}
|
|
1512
|
-
return new
|
|
1512
|
+
return new b({
|
|
1513
1513
|
...r._def,
|
|
1514
1514
|
shape: () => e
|
|
1515
1515
|
});
|
|
1516
1516
|
} else return r instanceof R ? new R({
|
|
1517
1517
|
...r._def,
|
|
1518
|
-
type:
|
|
1519
|
-
}) : r instanceof j ? j.create(
|
|
1518
|
+
type: J(r.element)
|
|
1519
|
+
}) : r instanceof j ? j.create(J(r.unwrap())) : r instanceof q ? q.create(J(r.unwrap())) : r instanceof M ? M.create(r.items.map((e) => J(e))) : r;
|
|
1520
1520
|
}
|
|
1521
|
-
class
|
|
1521
|
+
class b extends v {
|
|
1522
1522
|
constructor() {
|
|
1523
1523
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
1524
1524
|
}
|
|
@@ -1530,48 +1530,48 @@ class k extends v {
|
|
|
1530
1530
|
}
|
|
1531
1531
|
_parse(e) {
|
|
1532
1532
|
if (this._getType(e) !== f.object) {
|
|
1533
|
-
const
|
|
1534
|
-
return l(
|
|
1535
|
-
code:
|
|
1533
|
+
const u = this._getOrReturnCtx(e);
|
|
1534
|
+
return l(u, {
|
|
1535
|
+
code: c.invalid_type,
|
|
1536
1536
|
expected: f.object,
|
|
1537
|
-
received:
|
|
1537
|
+
received: u.parsedType
|
|
1538
1538
|
}), p;
|
|
1539
1539
|
}
|
|
1540
|
-
const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys:
|
|
1541
|
-
if (!(this._def.catchall instanceof
|
|
1542
|
-
for (const
|
|
1543
|
-
|
|
1544
|
-
const
|
|
1545
|
-
for (const
|
|
1546
|
-
const y = a[
|
|
1547
|
-
|
|
1548
|
-
key: { status: "valid", value:
|
|
1549
|
-
value: y._parse(new A(s,
|
|
1550
|
-
alwaysSet:
|
|
1540
|
+
const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys: o } = this._getCached(), i = [];
|
|
1541
|
+
if (!(this._def.catchall instanceof P && this._def.unknownKeys === "strip"))
|
|
1542
|
+
for (const u in s.data)
|
|
1543
|
+
o.includes(u) || i.push(u);
|
|
1544
|
+
const d = [];
|
|
1545
|
+
for (const u of o) {
|
|
1546
|
+
const y = a[u], N = s.data[u];
|
|
1547
|
+
d.push({
|
|
1548
|
+
key: { status: "valid", value: u },
|
|
1549
|
+
value: y._parse(new A(s, N, s.path, u)),
|
|
1550
|
+
alwaysSet: u in s.data
|
|
1551
1551
|
});
|
|
1552
1552
|
}
|
|
1553
|
-
if (this._def.catchall instanceof
|
|
1554
|
-
const
|
|
1555
|
-
if (
|
|
1556
|
-
for (const y of
|
|
1557
|
-
|
|
1553
|
+
if (this._def.catchall instanceof P) {
|
|
1554
|
+
const u = this._def.unknownKeys;
|
|
1555
|
+
if (u === "passthrough")
|
|
1556
|
+
for (const y of i)
|
|
1557
|
+
d.push({
|
|
1558
1558
|
key: { status: "valid", value: y },
|
|
1559
1559
|
value: { status: "valid", value: s.data[y] }
|
|
1560
1560
|
});
|
|
1561
|
-
else if (
|
|
1562
|
-
|
|
1563
|
-
code:
|
|
1564
|
-
keys:
|
|
1561
|
+
else if (u === "strict")
|
|
1562
|
+
i.length > 0 && (l(s, {
|
|
1563
|
+
code: c.unrecognized_keys,
|
|
1564
|
+
keys: i
|
|
1565
1565
|
}), n.dirty());
|
|
1566
|
-
else if (
|
|
1566
|
+
else if (u !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
1567
1567
|
} else {
|
|
1568
|
-
const
|
|
1569
|
-
for (const y of
|
|
1570
|
-
const
|
|
1571
|
-
|
|
1568
|
+
const u = this._def.catchall;
|
|
1569
|
+
for (const y of i) {
|
|
1570
|
+
const N = s.data[y];
|
|
1571
|
+
d.push({
|
|
1572
1572
|
key: { status: "valid", value: y },
|
|
1573
|
-
value:
|
|
1574
|
-
new A(s,
|
|
1573
|
+
value: u._parse(
|
|
1574
|
+
new A(s, N, s.path, y)
|
|
1575
1575
|
//, ctx.child(key), value, getParsedType(value)
|
|
1576
1576
|
),
|
|
1577
1577
|
alwaysSet: y in s.data
|
|
@@ -1579,46 +1579,46 @@ class k extends v {
|
|
|
1579
1579
|
}
|
|
1580
1580
|
}
|
|
1581
1581
|
return s.common.async ? Promise.resolve().then(async () => {
|
|
1582
|
-
const
|
|
1583
|
-
for (const y of
|
|
1584
|
-
const
|
|
1585
|
-
|
|
1586
|
-
key:
|
|
1582
|
+
const u = [];
|
|
1583
|
+
for (const y of d) {
|
|
1584
|
+
const N = await y.key, Te = await y.value;
|
|
1585
|
+
u.push({
|
|
1586
|
+
key: N,
|
|
1587
1587
|
value: Te,
|
|
1588
1588
|
alwaysSet: y.alwaysSet
|
|
1589
1589
|
});
|
|
1590
1590
|
}
|
|
1591
|
-
return
|
|
1592
|
-
}).then((
|
|
1591
|
+
return u;
|
|
1592
|
+
}).then((u) => S.mergeObjectSync(n, u)) : S.mergeObjectSync(n, d);
|
|
1593
1593
|
}
|
|
1594
1594
|
get shape() {
|
|
1595
1595
|
return this._def.shape();
|
|
1596
1596
|
}
|
|
1597
1597
|
strict(e) {
|
|
1598
|
-
return h.errToObj, new
|
|
1598
|
+
return h.errToObj, new b({
|
|
1599
1599
|
...this._def,
|
|
1600
1600
|
unknownKeys: "strict",
|
|
1601
1601
|
...e !== void 0 ? {
|
|
1602
1602
|
errorMap: (t, n) => {
|
|
1603
|
-
var s, a,
|
|
1604
|
-
const
|
|
1603
|
+
var s, a, o, i;
|
|
1604
|
+
const d = (o = (a = (s = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(s, t, n).message) !== null && o !== void 0 ? o : n.defaultError;
|
|
1605
1605
|
return t.code === "unrecognized_keys" ? {
|
|
1606
|
-
message: (
|
|
1606
|
+
message: (i = h.errToObj(e).message) !== null && i !== void 0 ? i : d
|
|
1607
1607
|
} : {
|
|
1608
|
-
message:
|
|
1608
|
+
message: d
|
|
1609
1609
|
};
|
|
1610
1610
|
}
|
|
1611
1611
|
} : {}
|
|
1612
1612
|
});
|
|
1613
1613
|
}
|
|
1614
1614
|
strip() {
|
|
1615
|
-
return new
|
|
1615
|
+
return new b({
|
|
1616
1616
|
...this._def,
|
|
1617
1617
|
unknownKeys: "strip"
|
|
1618
1618
|
});
|
|
1619
1619
|
}
|
|
1620
1620
|
passthrough() {
|
|
1621
|
-
return new
|
|
1621
|
+
return new b({
|
|
1622
1622
|
...this._def,
|
|
1623
1623
|
unknownKeys: "passthrough"
|
|
1624
1624
|
});
|
|
@@ -1641,7 +1641,7 @@ class k extends v {
|
|
|
1641
1641
|
// }) as any;
|
|
1642
1642
|
// };
|
|
1643
1643
|
extend(e) {
|
|
1644
|
-
return new
|
|
1644
|
+
return new b({
|
|
1645
1645
|
...this._def,
|
|
1646
1646
|
shape: () => ({
|
|
1647
1647
|
...this._def.shape(),
|
|
@@ -1655,7 +1655,7 @@ class k extends v {
|
|
|
1655
1655
|
* upgrade if you are experiencing issues.
|
|
1656
1656
|
*/
|
|
1657
1657
|
merge(e) {
|
|
1658
|
-
return new
|
|
1658
|
+
return new b({
|
|
1659
1659
|
unknownKeys: e._def.unknownKeys,
|
|
1660
1660
|
catchall: e._def.catchall,
|
|
1661
1661
|
shape: () => ({
|
|
@@ -1725,7 +1725,7 @@ class k extends v {
|
|
|
1725
1725
|
// return merged;
|
|
1726
1726
|
// }
|
|
1727
1727
|
catchall(e) {
|
|
1728
|
-
return new
|
|
1728
|
+
return new b({
|
|
1729
1729
|
...this._def,
|
|
1730
1730
|
catchall: e
|
|
1731
1731
|
});
|
|
@@ -1734,7 +1734,7 @@ class k extends v {
|
|
|
1734
1734
|
const t = {};
|
|
1735
1735
|
return x.objectKeys(e).forEach((n) => {
|
|
1736
1736
|
e[n] && this.shape[n] && (t[n] = this.shape[n]);
|
|
1737
|
-
}), new
|
|
1737
|
+
}), new b({
|
|
1738
1738
|
...this._def,
|
|
1739
1739
|
shape: () => t
|
|
1740
1740
|
});
|
|
@@ -1743,7 +1743,7 @@ class k extends v {
|
|
|
1743
1743
|
const t = {};
|
|
1744
1744
|
return x.objectKeys(this.shape).forEach((n) => {
|
|
1745
1745
|
e[n] || (t[n] = this.shape[n]);
|
|
1746
|
-
}), new
|
|
1746
|
+
}), new b({
|
|
1747
1747
|
...this._def,
|
|
1748
1748
|
shape: () => t
|
|
1749
1749
|
});
|
|
@@ -1752,14 +1752,14 @@ class k extends v {
|
|
|
1752
1752
|
* @deprecated
|
|
1753
1753
|
*/
|
|
1754
1754
|
deepPartial() {
|
|
1755
|
-
return
|
|
1755
|
+
return J(this);
|
|
1756
1756
|
}
|
|
1757
1757
|
partial(e) {
|
|
1758
1758
|
const t = {};
|
|
1759
1759
|
return x.objectKeys(this.shape).forEach((n) => {
|
|
1760
1760
|
const s = this.shape[n];
|
|
1761
1761
|
e && !e[n] ? t[n] = s : t[n] = s.optional();
|
|
1762
|
-
}), new
|
|
1762
|
+
}), new b({
|
|
1763
1763
|
...this._def,
|
|
1764
1764
|
shape: () => t
|
|
1765
1765
|
});
|
|
@@ -1775,33 +1775,33 @@ class k extends v {
|
|
|
1775
1775
|
a = a._def.innerType;
|
|
1776
1776
|
t[n] = a;
|
|
1777
1777
|
}
|
|
1778
|
-
}), new
|
|
1778
|
+
}), new b({
|
|
1779
1779
|
...this._def,
|
|
1780
1780
|
shape: () => t
|
|
1781
1781
|
});
|
|
1782
1782
|
}
|
|
1783
1783
|
keyof() {
|
|
1784
|
-
return
|
|
1784
|
+
return De(x.objectKeys(this.shape));
|
|
1785
1785
|
}
|
|
1786
1786
|
}
|
|
1787
|
-
|
|
1787
|
+
b.create = (r, e) => new b({
|
|
1788
1788
|
shape: () => r,
|
|
1789
1789
|
unknownKeys: "strip",
|
|
1790
|
-
catchall:
|
|
1790
|
+
catchall: P.create(),
|
|
1791
1791
|
typeName: m.ZodObject,
|
|
1792
1792
|
..._(e)
|
|
1793
1793
|
});
|
|
1794
|
-
|
|
1794
|
+
b.strictCreate = (r, e) => new b({
|
|
1795
1795
|
shape: () => r,
|
|
1796
1796
|
unknownKeys: "strict",
|
|
1797
|
-
catchall:
|
|
1797
|
+
catchall: P.create(),
|
|
1798
1798
|
typeName: m.ZodObject,
|
|
1799
1799
|
..._(e)
|
|
1800
1800
|
});
|
|
1801
|
-
|
|
1801
|
+
b.lazycreate = (r, e) => new b({
|
|
1802
1802
|
shape: r,
|
|
1803
1803
|
unknownKeys: "strip",
|
|
1804
|
-
catchall:
|
|
1804
|
+
catchall: P.create(),
|
|
1805
1805
|
typeName: m.ZodObject,
|
|
1806
1806
|
..._(e)
|
|
1807
1807
|
});
|
|
@@ -1809,21 +1809,21 @@ class ae extends v {
|
|
|
1809
1809
|
_parse(e) {
|
|
1810
1810
|
const { ctx: t } = this._processInputParams(e), n = this._def.options;
|
|
1811
1811
|
function s(a) {
|
|
1812
|
-
for (const
|
|
1813
|
-
if (
|
|
1814
|
-
return
|
|
1815
|
-
for (const
|
|
1816
|
-
if (
|
|
1817
|
-
return t.common.issues.push(...
|
|
1818
|
-
const
|
|
1812
|
+
for (const i of a)
|
|
1813
|
+
if (i.result.status === "valid")
|
|
1814
|
+
return i.result;
|
|
1815
|
+
for (const i of a)
|
|
1816
|
+
if (i.result.status === "dirty")
|
|
1817
|
+
return t.common.issues.push(...i.ctx.common.issues), i.result;
|
|
1818
|
+
const o = a.map((i) => new O(i.ctx.common.issues));
|
|
1819
1819
|
return l(t, {
|
|
1820
|
-
code:
|
|
1821
|
-
unionErrors:
|
|
1820
|
+
code: c.invalid_union,
|
|
1821
|
+
unionErrors: o
|
|
1822
1822
|
}), p;
|
|
1823
1823
|
}
|
|
1824
1824
|
if (t.common.async)
|
|
1825
1825
|
return Promise.all(n.map(async (a) => {
|
|
1826
|
-
const
|
|
1826
|
+
const o = {
|
|
1827
1827
|
...t,
|
|
1828
1828
|
common: {
|
|
1829
1829
|
...t.common,
|
|
@@ -1835,37 +1835,37 @@ class ae extends v {
|
|
|
1835
1835
|
result: await a._parseAsync({
|
|
1836
1836
|
data: t.data,
|
|
1837
1837
|
path: t.path,
|
|
1838
|
-
parent:
|
|
1838
|
+
parent: o
|
|
1839
1839
|
}),
|
|
1840
|
-
ctx:
|
|
1840
|
+
ctx: o
|
|
1841
1841
|
};
|
|
1842
1842
|
})).then(s);
|
|
1843
1843
|
{
|
|
1844
1844
|
let a;
|
|
1845
|
-
const
|
|
1846
|
-
for (const
|
|
1847
|
-
const
|
|
1845
|
+
const o = [];
|
|
1846
|
+
for (const d of n) {
|
|
1847
|
+
const u = {
|
|
1848
1848
|
...t,
|
|
1849
1849
|
common: {
|
|
1850
1850
|
...t.common,
|
|
1851
1851
|
issues: []
|
|
1852
1852
|
},
|
|
1853
1853
|
parent: null
|
|
1854
|
-
}, y =
|
|
1854
|
+
}, y = d._parseSync({
|
|
1855
1855
|
data: t.data,
|
|
1856
1856
|
path: t.path,
|
|
1857
|
-
parent:
|
|
1857
|
+
parent: u
|
|
1858
1858
|
});
|
|
1859
1859
|
if (y.status === "valid")
|
|
1860
1860
|
return y;
|
|
1861
|
-
y.status === "dirty" && !a && (a = { result: y, ctx:
|
|
1861
|
+
y.status === "dirty" && !a && (a = { result: y, ctx: u }), u.common.issues.length && o.push(u.common.issues);
|
|
1862
1862
|
}
|
|
1863
1863
|
if (a)
|
|
1864
1864
|
return t.common.issues.push(...a.ctx.common.issues), a.result;
|
|
1865
|
-
const
|
|
1865
|
+
const i = o.map((d) => new O(d));
|
|
1866
1866
|
return l(t, {
|
|
1867
|
-
code:
|
|
1868
|
-
unionErrors:
|
|
1867
|
+
code: c.invalid_union,
|
|
1868
|
+
unionErrors: i
|
|
1869
1869
|
}), p;
|
|
1870
1870
|
}
|
|
1871
1871
|
}
|
|
@@ -1878,13 +1878,13 @@ ae.create = (r, e) => new ae({
|
|
|
1878
1878
|
typeName: m.ZodUnion,
|
|
1879
1879
|
..._(e)
|
|
1880
1880
|
});
|
|
1881
|
-
const $ = (r) => r instanceof
|
|
1881
|
+
const $ = (r) => r instanceof ce ? $(r.schema) : r instanceof I ? $(r.innerType()) : r instanceof de ? [r.value] : r instanceof L ? r.options : r instanceof ue ? x.objectValues(r.enum) : r instanceof le ? $(r._def.innerType) : r instanceof ne ? [void 0] : r instanceof se ? [null] : r instanceof j ? [void 0, ...$(r.unwrap())] : r instanceof q ? [null, ...$(r.unwrap())] : r instanceof Ee || r instanceof he ? $(r.unwrap()) : r instanceof fe ? $(r._def.innerType) : [];
|
|
1882
1882
|
class we extends v {
|
|
1883
1883
|
_parse(e) {
|
|
1884
1884
|
const { ctx: t } = this._processInputParams(e);
|
|
1885
1885
|
if (t.parsedType !== f.object)
|
|
1886
1886
|
return l(t, {
|
|
1887
|
-
code:
|
|
1887
|
+
code: c.invalid_type,
|
|
1888
1888
|
expected: f.object,
|
|
1889
1889
|
received: t.parsedType
|
|
1890
1890
|
}), p;
|
|
@@ -1898,7 +1898,7 @@ class we extends v {
|
|
|
1898
1898
|
path: t.path,
|
|
1899
1899
|
parent: t
|
|
1900
1900
|
}) : (l(t, {
|
|
1901
|
-
code:
|
|
1901
|
+
code: c.invalid_union_discriminator,
|
|
1902
1902
|
options: Array.from(this.optionsMap.keys()),
|
|
1903
1903
|
path: [n]
|
|
1904
1904
|
}), p);
|
|
@@ -1923,13 +1923,13 @@ class we extends v {
|
|
|
1923
1923
|
static create(e, t, n) {
|
|
1924
1924
|
const s = /* @__PURE__ */ new Map();
|
|
1925
1925
|
for (const a of t) {
|
|
1926
|
-
const
|
|
1927
|
-
if (!
|
|
1926
|
+
const o = $(a.shape[e]);
|
|
1927
|
+
if (!o.length)
|
|
1928
1928
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
1929
|
-
for (const
|
|
1930
|
-
if (s.has(
|
|
1931
|
-
throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(
|
|
1932
|
-
s.set(
|
|
1929
|
+
for (const i of o) {
|
|
1930
|
+
if (s.has(i))
|
|
1931
|
+
throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);
|
|
1932
|
+
s.set(i, a);
|
|
1933
1933
|
}
|
|
1934
1934
|
}
|
|
1935
1935
|
return new we({
|
|
@@ -1941,40 +1941,40 @@ class we extends v {
|
|
|
1941
1941
|
});
|
|
1942
1942
|
}
|
|
1943
1943
|
}
|
|
1944
|
-
function
|
|
1945
|
-
const t =
|
|
1944
|
+
function Oe(r, e) {
|
|
1945
|
+
const t = z(r), n = z(e);
|
|
1946
1946
|
if (r === e)
|
|
1947
1947
|
return { valid: !0, data: r };
|
|
1948
1948
|
if (t === f.object && n === f.object) {
|
|
1949
|
-
const s = x.objectKeys(e), a = x.objectKeys(r).filter((
|
|
1950
|
-
for (const
|
|
1951
|
-
const
|
|
1952
|
-
if (!
|
|
1949
|
+
const s = x.objectKeys(e), a = x.objectKeys(r).filter((i) => s.indexOf(i) !== -1), o = { ...r, ...e };
|
|
1950
|
+
for (const i of a) {
|
|
1951
|
+
const d = Oe(r[i], e[i]);
|
|
1952
|
+
if (!d.valid)
|
|
1953
1953
|
return { valid: !1 };
|
|
1954
|
-
i
|
|
1954
|
+
o[i] = d.data;
|
|
1955
1955
|
}
|
|
1956
|
-
return { valid: !0, data:
|
|
1956
|
+
return { valid: !0, data: o };
|
|
1957
1957
|
} else if (t === f.array && n === f.array) {
|
|
1958
1958
|
if (r.length !== e.length)
|
|
1959
1959
|
return { valid: !1 };
|
|
1960
1960
|
const s = [];
|
|
1961
1961
|
for (let a = 0; a < r.length; a++) {
|
|
1962
|
-
const
|
|
1963
|
-
if (!
|
|
1962
|
+
const o = r[a], i = e[a], d = Oe(o, i);
|
|
1963
|
+
if (!d.valid)
|
|
1964
1964
|
return { valid: !1 };
|
|
1965
|
-
s.push(
|
|
1965
|
+
s.push(d.data);
|
|
1966
1966
|
}
|
|
1967
1967
|
return { valid: !0, data: s };
|
|
1968
1968
|
} else return t === f.date && n === f.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
|
|
1969
1969
|
}
|
|
1970
1970
|
class ie extends v {
|
|
1971
1971
|
_parse(e) {
|
|
1972
|
-
const { status: t, ctx: n } = this._processInputParams(e), s = (a,
|
|
1973
|
-
if (Ce(a) || Ce(
|
|
1972
|
+
const { status: t, ctx: n } = this._processInputParams(e), s = (a, o) => {
|
|
1973
|
+
if (Ce(a) || Ce(o))
|
|
1974
1974
|
return p;
|
|
1975
|
-
const
|
|
1976
|
-
return
|
|
1977
|
-
code:
|
|
1975
|
+
const i = Oe(a.value, o.value);
|
|
1976
|
+
return i.valid ? ((Ne(a) || Ne(o)) && t.dirty(), { status: t.value, value: i.data }) : (l(n, {
|
|
1977
|
+
code: c.invalid_intersection_types
|
|
1978
1978
|
}), p);
|
|
1979
1979
|
};
|
|
1980
1980
|
return n.common.async ? Promise.all([
|
|
@@ -1988,7 +1988,7 @@ class ie extends v {
|
|
|
1988
1988
|
path: n.path,
|
|
1989
1989
|
parent: n
|
|
1990
1990
|
})
|
|
1991
|
-
]).then(([a,
|
|
1991
|
+
]).then(([a, o]) => s(a, o)) : s(this._def.left._parseSync({
|
|
1992
1992
|
data: n.data,
|
|
1993
1993
|
path: n.path,
|
|
1994
1994
|
parent: n
|
|
@@ -2010,30 +2010,30 @@ class M extends v {
|
|
|
2010
2010
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2011
2011
|
if (n.parsedType !== f.array)
|
|
2012
2012
|
return l(n, {
|
|
2013
|
-
code:
|
|
2013
|
+
code: c.invalid_type,
|
|
2014
2014
|
expected: f.array,
|
|
2015
2015
|
received: n.parsedType
|
|
2016
2016
|
}), p;
|
|
2017
2017
|
if (n.data.length < this._def.items.length)
|
|
2018
2018
|
return l(n, {
|
|
2019
|
-
code:
|
|
2019
|
+
code: c.too_small,
|
|
2020
2020
|
minimum: this._def.items.length,
|
|
2021
2021
|
inclusive: !0,
|
|
2022
2022
|
exact: !1,
|
|
2023
2023
|
type: "array"
|
|
2024
2024
|
}), p;
|
|
2025
2025
|
!this._def.rest && n.data.length > this._def.items.length && (l(n, {
|
|
2026
|
-
code:
|
|
2026
|
+
code: c.too_big,
|
|
2027
2027
|
maximum: this._def.items.length,
|
|
2028
2028
|
inclusive: !0,
|
|
2029
2029
|
exact: !1,
|
|
2030
2030
|
type: "array"
|
|
2031
2031
|
}), t.dirty());
|
|
2032
|
-
const a = [...n.data].map((
|
|
2033
|
-
const
|
|
2034
|
-
return
|
|
2035
|
-
}).filter((
|
|
2036
|
-
return n.common.async ? Promise.all(a).then((
|
|
2032
|
+
const a = [...n.data].map((o, i) => {
|
|
2033
|
+
const d = this._def.items[i] || this._def.rest;
|
|
2034
|
+
return d ? d._parse(new A(n, o, n.path, i)) : null;
|
|
2035
|
+
}).filter((o) => !!o);
|
|
2036
|
+
return n.common.async ? Promise.all(a).then((o) => S.mergeArray(t, o)) : S.mergeArray(t, a);
|
|
2037
2037
|
}
|
|
2038
2038
|
get items() {
|
|
2039
2039
|
return this._def.items;
|
|
@@ -2066,18 +2066,18 @@ class oe extends v {
|
|
|
2066
2066
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2067
2067
|
if (n.parsedType !== f.object)
|
|
2068
2068
|
return l(n, {
|
|
2069
|
-
code:
|
|
2069
|
+
code: c.invalid_type,
|
|
2070
2070
|
expected: f.object,
|
|
2071
2071
|
received: n.parsedType
|
|
2072
2072
|
}), p;
|
|
2073
|
-
const s = [], a = this._def.keyType,
|
|
2074
|
-
for (const
|
|
2073
|
+
const s = [], a = this._def.keyType, o = this._def.valueType;
|
|
2074
|
+
for (const i in n.data)
|
|
2075
2075
|
s.push({
|
|
2076
|
-
key: a._parse(new A(n,
|
|
2077
|
-
value:
|
|
2078
|
-
alwaysSet:
|
|
2076
|
+
key: a._parse(new A(n, i, n.path, i)),
|
|
2077
|
+
value: o._parse(new A(n, n.data[i], n.path, i)),
|
|
2078
|
+
alwaysSet: i in n.data
|
|
2079
2079
|
});
|
|
2080
|
-
return n.common.async ?
|
|
2080
|
+
return n.common.async ? S.mergeObjectAsync(t, s) : S.mergeObjectSync(t, s);
|
|
2081
2081
|
}
|
|
2082
2082
|
get element() {
|
|
2083
2083
|
return this._def.valueType;
|
|
@@ -2096,7 +2096,7 @@ class oe extends v {
|
|
|
2096
2096
|
});
|
|
2097
2097
|
}
|
|
2098
2098
|
}
|
|
2099
|
-
class
|
|
2099
|
+
class be extends v {
|
|
2100
2100
|
get keySchema() {
|
|
2101
2101
|
return this._def.keyType;
|
|
2102
2102
|
}
|
|
@@ -2107,38 +2107,38 @@ class ke extends v {
|
|
|
2107
2107
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2108
2108
|
if (n.parsedType !== f.map)
|
|
2109
2109
|
return l(n, {
|
|
2110
|
-
code:
|
|
2110
|
+
code: c.invalid_type,
|
|
2111
2111
|
expected: f.map,
|
|
2112
2112
|
received: n.parsedType
|
|
2113
2113
|
}), p;
|
|
2114
|
-
const s = this._def.keyType, a = this._def.valueType,
|
|
2115
|
-
key: s._parse(new A(n,
|
|
2116
|
-
value: a._parse(new A(n,
|
|
2114
|
+
const s = this._def.keyType, a = this._def.valueType, o = [...n.data.entries()].map(([i, d], u) => ({
|
|
2115
|
+
key: s._parse(new A(n, i, n.path, [u, "key"])),
|
|
2116
|
+
value: a._parse(new A(n, d, n.path, [u, "value"]))
|
|
2117
2117
|
}));
|
|
2118
2118
|
if (n.common.async) {
|
|
2119
|
-
const
|
|
2119
|
+
const i = /* @__PURE__ */ new Map();
|
|
2120
2120
|
return Promise.resolve().then(async () => {
|
|
2121
|
-
for (const
|
|
2122
|
-
const
|
|
2123
|
-
if (
|
|
2121
|
+
for (const d of o) {
|
|
2122
|
+
const u = await d.key, y = await d.value;
|
|
2123
|
+
if (u.status === "aborted" || y.status === "aborted")
|
|
2124
2124
|
return p;
|
|
2125
|
-
(
|
|
2125
|
+
(u.status === "dirty" || y.status === "dirty") && t.dirty(), i.set(u.value, y.value);
|
|
2126
2126
|
}
|
|
2127
|
-
return { status: t.value, value:
|
|
2127
|
+
return { status: t.value, value: i };
|
|
2128
2128
|
});
|
|
2129
2129
|
} else {
|
|
2130
|
-
const
|
|
2131
|
-
for (const
|
|
2132
|
-
const
|
|
2133
|
-
if (
|
|
2130
|
+
const i = /* @__PURE__ */ new Map();
|
|
2131
|
+
for (const d of o) {
|
|
2132
|
+
const u = d.key, y = d.value;
|
|
2133
|
+
if (u.status === "aborted" || y.status === "aborted")
|
|
2134
2134
|
return p;
|
|
2135
|
-
(
|
|
2135
|
+
(u.status === "dirty" || y.status === "dirty") && t.dirty(), i.set(u.value, y.value);
|
|
2136
2136
|
}
|
|
2137
|
-
return { status: t.value, value:
|
|
2137
|
+
return { status: t.value, value: i };
|
|
2138
2138
|
}
|
|
2139
2139
|
}
|
|
2140
2140
|
}
|
|
2141
|
-
|
|
2141
|
+
be.create = (r, e, t) => new be({
|
|
2142
2142
|
valueType: e,
|
|
2143
2143
|
keyType: r,
|
|
2144
2144
|
typeName: m.ZodMap,
|
|
@@ -2149,20 +2149,20 @@ class W extends v {
|
|
|
2149
2149
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2150
2150
|
if (n.parsedType !== f.set)
|
|
2151
2151
|
return l(n, {
|
|
2152
|
-
code:
|
|
2152
|
+
code: c.invalid_type,
|
|
2153
2153
|
expected: f.set,
|
|
2154
2154
|
received: n.parsedType
|
|
2155
2155
|
}), p;
|
|
2156
2156
|
const s = this._def;
|
|
2157
2157
|
s.minSize !== null && n.data.size < s.minSize.value && (l(n, {
|
|
2158
|
-
code:
|
|
2158
|
+
code: c.too_small,
|
|
2159
2159
|
minimum: s.minSize.value,
|
|
2160
2160
|
type: "set",
|
|
2161
2161
|
inclusive: !0,
|
|
2162
2162
|
exact: !1,
|
|
2163
2163
|
message: s.minSize.message
|
|
2164
2164
|
}), t.dirty()), s.maxSize !== null && n.data.size > s.maxSize.value && (l(n, {
|
|
2165
|
-
code:
|
|
2165
|
+
code: c.too_big,
|
|
2166
2166
|
maximum: s.maxSize.value,
|
|
2167
2167
|
type: "set",
|
|
2168
2168
|
inclusive: !0,
|
|
@@ -2170,17 +2170,17 @@ class W extends v {
|
|
|
2170
2170
|
message: s.maxSize.message
|
|
2171
2171
|
}), t.dirty());
|
|
2172
2172
|
const a = this._def.valueType;
|
|
2173
|
-
function
|
|
2174
|
-
const
|
|
2175
|
-
for (const y of
|
|
2173
|
+
function o(d) {
|
|
2174
|
+
const u = /* @__PURE__ */ new Set();
|
|
2175
|
+
for (const y of d) {
|
|
2176
2176
|
if (y.status === "aborted")
|
|
2177
2177
|
return p;
|
|
2178
|
-
y.status === "dirty" && t.dirty(),
|
|
2178
|
+
y.status === "dirty" && t.dirty(), u.add(y.value);
|
|
2179
2179
|
}
|
|
2180
|
-
return { status: t.value, value:
|
|
2180
|
+
return { status: t.value, value: u };
|
|
2181
2181
|
}
|
|
2182
|
-
const
|
|
2183
|
-
return n.common.async ? Promise.all(
|
|
2182
|
+
const i = [...n.data.values()].map((d, u) => a._parse(new A(n, d, n.path, u)));
|
|
2183
|
+
return n.common.async ? Promise.all(i).then((d) => o(d)) : o(i);
|
|
2184
2184
|
}
|
|
2185
2185
|
min(e, t) {
|
|
2186
2186
|
return new W({
|
|
@@ -2216,63 +2216,63 @@ class G extends v {
|
|
|
2216
2216
|
const { ctx: t } = this._processInputParams(e);
|
|
2217
2217
|
if (t.parsedType !== f.function)
|
|
2218
2218
|
return l(t, {
|
|
2219
|
-
code:
|
|
2219
|
+
code: c.invalid_type,
|
|
2220
2220
|
expected: f.function,
|
|
2221
2221
|
received: t.parsedType
|
|
2222
2222
|
}), p;
|
|
2223
|
-
function n(
|
|
2223
|
+
function n(i, d) {
|
|
2224
2224
|
return _e({
|
|
2225
|
-
data:
|
|
2225
|
+
data: i,
|
|
2226
2226
|
path: t.path,
|
|
2227
2227
|
errorMaps: [
|
|
2228
2228
|
t.common.contextualErrorMap,
|
|
2229
2229
|
t.schemaErrorMap,
|
|
2230
2230
|
ye(),
|
|
2231
2231
|
H
|
|
2232
|
-
].filter((
|
|
2232
|
+
].filter((u) => !!u),
|
|
2233
2233
|
issueData: {
|
|
2234
|
-
code:
|
|
2235
|
-
argumentsError:
|
|
2234
|
+
code: c.invalid_arguments,
|
|
2235
|
+
argumentsError: d
|
|
2236
2236
|
}
|
|
2237
2237
|
});
|
|
2238
2238
|
}
|
|
2239
|
-
function s(
|
|
2239
|
+
function s(i, d) {
|
|
2240
2240
|
return _e({
|
|
2241
|
-
data:
|
|
2241
|
+
data: i,
|
|
2242
2242
|
path: t.path,
|
|
2243
2243
|
errorMaps: [
|
|
2244
2244
|
t.common.contextualErrorMap,
|
|
2245
2245
|
t.schemaErrorMap,
|
|
2246
2246
|
ye(),
|
|
2247
2247
|
H
|
|
2248
|
-
].filter((
|
|
2248
|
+
].filter((u) => !!u),
|
|
2249
2249
|
issueData: {
|
|
2250
|
-
code:
|
|
2251
|
-
returnTypeError:
|
|
2250
|
+
code: c.invalid_return_type,
|
|
2251
|
+
returnTypeError: d
|
|
2252
2252
|
}
|
|
2253
2253
|
});
|
|
2254
2254
|
}
|
|
2255
|
-
const a = { errorMap: t.common.contextualErrorMap },
|
|
2256
|
-
if (this._def.returns instanceof
|
|
2257
|
-
const
|
|
2258
|
-
return
|
|
2259
|
-
const
|
|
2260
|
-
throw
|
|
2261
|
-
}),
|
|
2262
|
-
return await
|
|
2263
|
-
throw
|
|
2255
|
+
const a = { errorMap: t.common.contextualErrorMap }, o = t.data;
|
|
2256
|
+
if (this._def.returns instanceof X) {
|
|
2257
|
+
const i = this;
|
|
2258
|
+
return Z(async function(...d) {
|
|
2259
|
+
const u = new O([]), y = await i._def.args.parseAsync(d, a).catch((pe) => {
|
|
2260
|
+
throw u.addIssue(n(d, pe)), u;
|
|
2261
|
+
}), N = await Reflect.apply(o, this, y);
|
|
2262
|
+
return await i._def.returns._def.type.parseAsync(N, a).catch((pe) => {
|
|
2263
|
+
throw u.addIssue(s(N, pe)), u;
|
|
2264
2264
|
});
|
|
2265
2265
|
});
|
|
2266
2266
|
} else {
|
|
2267
|
-
const
|
|
2268
|
-
return
|
|
2269
|
-
const
|
|
2270
|
-
if (!
|
|
2271
|
-
throw new
|
|
2272
|
-
const y = Reflect.apply(
|
|
2273
|
-
if (!
|
|
2274
|
-
throw new
|
|
2275
|
-
return
|
|
2267
|
+
const i = this;
|
|
2268
|
+
return Z(function(...d) {
|
|
2269
|
+
const u = i._def.args.safeParse(d, a);
|
|
2270
|
+
if (!u.success)
|
|
2271
|
+
throw new O([n(d, u.error)]);
|
|
2272
|
+
const y = Reflect.apply(o, this, u.data), N = i._def.returns.safeParse(y, a);
|
|
2273
|
+
if (!N.success)
|
|
2274
|
+
throw new O([s(y, N.error)]);
|
|
2275
|
+
return N.data;
|
|
2276
2276
|
});
|
|
2277
2277
|
}
|
|
2278
2278
|
}
|
|
@@ -2309,7 +2309,7 @@ class G extends v {
|
|
|
2309
2309
|
});
|
|
2310
2310
|
}
|
|
2311
2311
|
}
|
|
2312
|
-
class
|
|
2312
|
+
class ce extends v {
|
|
2313
2313
|
get schema() {
|
|
2314
2314
|
return this._def.getter();
|
|
2315
2315
|
}
|
|
@@ -2318,18 +2318,18 @@ class de extends v {
|
|
|
2318
2318
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
2319
2319
|
}
|
|
2320
2320
|
}
|
|
2321
|
-
|
|
2321
|
+
ce.create = (r, e) => new ce({
|
|
2322
2322
|
getter: r,
|
|
2323
2323
|
typeName: m.ZodLazy,
|
|
2324
2324
|
..._(e)
|
|
2325
2325
|
});
|
|
2326
|
-
class
|
|
2326
|
+
class de extends v {
|
|
2327
2327
|
_parse(e) {
|
|
2328
2328
|
if (e.data !== this._def.value) {
|
|
2329
2329
|
const t = this._getOrReturnCtx(e);
|
|
2330
2330
|
return l(t, {
|
|
2331
2331
|
received: t.data,
|
|
2332
|
-
code:
|
|
2332
|
+
code: c.invalid_literal,
|
|
2333
2333
|
expected: this._def.value
|
|
2334
2334
|
}), p;
|
|
2335
2335
|
}
|
|
@@ -2339,12 +2339,12 @@ class ce extends v {
|
|
|
2339
2339
|
return this._def.value;
|
|
2340
2340
|
}
|
|
2341
2341
|
}
|
|
2342
|
-
|
|
2342
|
+
de.create = (r, e) => new de({
|
|
2343
2343
|
value: r,
|
|
2344
2344
|
typeName: m.ZodLiteral,
|
|
2345
2345
|
..._(e)
|
|
2346
2346
|
});
|
|
2347
|
-
function
|
|
2347
|
+
function De(r, e) {
|
|
2348
2348
|
return new L({
|
|
2349
2349
|
values: r,
|
|
2350
2350
|
typeName: m.ZodEnum,
|
|
@@ -2353,7 +2353,7 @@ function Ve(r, e) {
|
|
|
2353
2353
|
}
|
|
2354
2354
|
class L extends v {
|
|
2355
2355
|
constructor() {
|
|
2356
|
-
super(...arguments),
|
|
2356
|
+
super(...arguments), F.set(this, void 0);
|
|
2357
2357
|
}
|
|
2358
2358
|
_parse(e) {
|
|
2359
2359
|
if (typeof e.data != "string") {
|
|
@@ -2361,18 +2361,18 @@ class L extends v {
|
|
|
2361
2361
|
return l(t, {
|
|
2362
2362
|
expected: x.joinValues(n),
|
|
2363
2363
|
received: t.parsedType,
|
|
2364
|
-
code:
|
|
2364
|
+
code: c.invalid_type
|
|
2365
2365
|
}), p;
|
|
2366
2366
|
}
|
|
2367
|
-
if (ve(this,
|
|
2367
|
+
if (ve(this, F) || $e(this, F, new Set(this._def.values)), !ve(this, F).has(e.data)) {
|
|
2368
2368
|
const t = this._getOrReturnCtx(e), n = this._def.values;
|
|
2369
2369
|
return l(t, {
|
|
2370
2370
|
received: t.data,
|
|
2371
|
-
code:
|
|
2371
|
+
code: c.invalid_enum_value,
|
|
2372
2372
|
options: n
|
|
2373
2373
|
}), p;
|
|
2374
2374
|
}
|
|
2375
|
-
return
|
|
2375
|
+
return Z(e.data);
|
|
2376
2376
|
}
|
|
2377
2377
|
get options() {
|
|
2378
2378
|
return this._def.values;
|
|
@@ -2408,11 +2408,11 @@ class L extends v {
|
|
|
2408
2408
|
});
|
|
2409
2409
|
}
|
|
2410
2410
|
}
|
|
2411
|
-
|
|
2412
|
-
L.create =
|
|
2411
|
+
F = /* @__PURE__ */ new WeakMap();
|
|
2412
|
+
L.create = De;
|
|
2413
2413
|
class ue extends v {
|
|
2414
2414
|
constructor() {
|
|
2415
|
-
super(...arguments),
|
|
2415
|
+
super(...arguments), K.set(this, void 0);
|
|
2416
2416
|
}
|
|
2417
2417
|
_parse(e) {
|
|
2418
2418
|
const t = x.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
|
|
@@ -2421,30 +2421,30 @@ class ue extends v {
|
|
|
2421
2421
|
return l(n, {
|
|
2422
2422
|
expected: x.joinValues(s),
|
|
2423
2423
|
received: n.parsedType,
|
|
2424
|
-
code:
|
|
2424
|
+
code: c.invalid_type
|
|
2425
2425
|
}), p;
|
|
2426
2426
|
}
|
|
2427
|
-
if (ve(this,
|
|
2427
|
+
if (ve(this, K) || $e(this, K, new Set(x.getValidEnumValues(this._def.values))), !ve(this, K).has(e.data)) {
|
|
2428
2428
|
const s = x.objectValues(t);
|
|
2429
2429
|
return l(n, {
|
|
2430
2430
|
received: n.data,
|
|
2431
|
-
code:
|
|
2431
|
+
code: c.invalid_enum_value,
|
|
2432
2432
|
options: s
|
|
2433
2433
|
}), p;
|
|
2434
2434
|
}
|
|
2435
|
-
return
|
|
2435
|
+
return Z(e.data);
|
|
2436
2436
|
}
|
|
2437
2437
|
get enum() {
|
|
2438
2438
|
return this._def.values;
|
|
2439
2439
|
}
|
|
2440
2440
|
}
|
|
2441
|
-
|
|
2441
|
+
K = /* @__PURE__ */ new WeakMap();
|
|
2442
2442
|
ue.create = (r, e) => new ue({
|
|
2443
2443
|
values: r,
|
|
2444
2444
|
typeName: m.ZodNativeEnum,
|
|
2445
2445
|
..._(e)
|
|
2446
2446
|
});
|
|
2447
|
-
class
|
|
2447
|
+
class X extends v {
|
|
2448
2448
|
unwrap() {
|
|
2449
2449
|
return this._def.type;
|
|
2450
2450
|
}
|
|
@@ -2452,18 +2452,18 @@ class K extends v {
|
|
|
2452
2452
|
const { ctx: t } = this._processInputParams(e);
|
|
2453
2453
|
if (t.parsedType !== f.promise && t.common.async === !1)
|
|
2454
2454
|
return l(t, {
|
|
2455
|
-
code:
|
|
2455
|
+
code: c.invalid_type,
|
|
2456
2456
|
expected: f.promise,
|
|
2457
2457
|
received: t.parsedType
|
|
2458
2458
|
}), p;
|
|
2459
2459
|
const n = t.parsedType === f.promise ? t.data : Promise.resolve(t.data);
|
|
2460
|
-
return
|
|
2460
|
+
return Z(n.then((s) => this._def.type.parseAsync(s, {
|
|
2461
2461
|
path: t.path,
|
|
2462
2462
|
errorMap: t.common.contextualErrorMap
|
|
2463
2463
|
})));
|
|
2464
2464
|
}
|
|
2465
2465
|
}
|
|
2466
|
-
|
|
2466
|
+
X.create = (r, e) => new X({
|
|
2467
2467
|
type: r,
|
|
2468
2468
|
typeName: m.ZodPromise,
|
|
2469
2469
|
..._(e)
|
|
@@ -2477,71 +2477,71 @@ class I extends v {
|
|
|
2477
2477
|
}
|
|
2478
2478
|
_parse(e) {
|
|
2479
2479
|
const { status: t, ctx: n } = this._processInputParams(e), s = this._def.effect || null, a = {
|
|
2480
|
-
addIssue: (
|
|
2481
|
-
l(n,
|
|
2480
|
+
addIssue: (o) => {
|
|
2481
|
+
l(n, o), o.fatal ? t.abort() : t.dirty();
|
|
2482
2482
|
},
|
|
2483
2483
|
get path() {
|
|
2484
2484
|
return n.path;
|
|
2485
2485
|
}
|
|
2486
2486
|
};
|
|
2487
2487
|
if (a.addIssue = a.addIssue.bind(a), s.type === "preprocess") {
|
|
2488
|
-
const
|
|
2488
|
+
const o = s.transform(n.data, a);
|
|
2489
2489
|
if (n.common.async)
|
|
2490
|
-
return Promise.resolve(
|
|
2490
|
+
return Promise.resolve(o).then(async (i) => {
|
|
2491
2491
|
if (t.value === "aborted")
|
|
2492
2492
|
return p;
|
|
2493
|
-
const
|
|
2494
|
-
data:
|
|
2493
|
+
const d = await this._def.schema._parseAsync({
|
|
2494
|
+
data: i,
|
|
2495
2495
|
path: n.path,
|
|
2496
2496
|
parent: n
|
|
2497
2497
|
});
|
|
2498
|
-
return
|
|
2498
|
+
return d.status === "aborted" ? p : d.status === "dirty" || t.value === "dirty" ? Y(d.value) : d;
|
|
2499
2499
|
});
|
|
2500
2500
|
{
|
|
2501
2501
|
if (t.value === "aborted")
|
|
2502
2502
|
return p;
|
|
2503
|
-
const
|
|
2504
|
-
data:
|
|
2503
|
+
const i = this._def.schema._parseSync({
|
|
2504
|
+
data: o,
|
|
2505
2505
|
path: n.path,
|
|
2506
2506
|
parent: n
|
|
2507
2507
|
});
|
|
2508
|
-
return
|
|
2508
|
+
return i.status === "aborted" ? p : i.status === "dirty" || t.value === "dirty" ? Y(i.value) : i;
|
|
2509
2509
|
}
|
|
2510
2510
|
}
|
|
2511
2511
|
if (s.type === "refinement") {
|
|
2512
|
-
const
|
|
2513
|
-
const
|
|
2512
|
+
const o = (i) => {
|
|
2513
|
+
const d = s.refinement(i, a);
|
|
2514
2514
|
if (n.common.async)
|
|
2515
|
-
return Promise.resolve(
|
|
2516
|
-
if (
|
|
2515
|
+
return Promise.resolve(d);
|
|
2516
|
+
if (d instanceof Promise)
|
|
2517
2517
|
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2518
|
-
return
|
|
2518
|
+
return i;
|
|
2519
2519
|
};
|
|
2520
2520
|
if (n.common.async === !1) {
|
|
2521
|
-
const
|
|
2521
|
+
const i = this._def.schema._parseSync({
|
|
2522
2522
|
data: n.data,
|
|
2523
2523
|
path: n.path,
|
|
2524
2524
|
parent: n
|
|
2525
2525
|
});
|
|
2526
|
-
return
|
|
2526
|
+
return i.status === "aborted" ? p : (i.status === "dirty" && t.dirty(), o(i.value), { status: t.value, value: i.value });
|
|
2527
2527
|
} else
|
|
2528
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((
|
|
2528
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) => i.status === "aborted" ? p : (i.status === "dirty" && t.dirty(), o(i.value).then(() => ({ status: t.value, value: i.value }))));
|
|
2529
2529
|
}
|
|
2530
2530
|
if (s.type === "transform")
|
|
2531
2531
|
if (n.common.async === !1) {
|
|
2532
|
-
const
|
|
2532
|
+
const o = this._def.schema._parseSync({
|
|
2533
2533
|
data: n.data,
|
|
2534
2534
|
path: n.path,
|
|
2535
2535
|
parent: n
|
|
2536
2536
|
});
|
|
2537
|
-
if (!ee(
|
|
2538
|
-
return
|
|
2539
|
-
const
|
|
2540
|
-
if (
|
|
2537
|
+
if (!ee(o))
|
|
2538
|
+
return o;
|
|
2539
|
+
const i = s.transform(o.value, a);
|
|
2540
|
+
if (i instanceof Promise)
|
|
2541
2541
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2542
|
-
return { status: t.value, value:
|
|
2542
|
+
return { status: t.value, value: i };
|
|
2543
2543
|
} else
|
|
2544
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((
|
|
2544
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => ee(o) ? Promise.resolve(s.transform(o.value, a)).then((i) => ({ status: t.value, value: i })) : o);
|
|
2545
2545
|
x.assertNever(s);
|
|
2546
2546
|
}
|
|
2547
2547
|
}
|
|
@@ -2559,7 +2559,7 @@ I.createWithPreprocess = (r, e, t) => new I({
|
|
|
2559
2559
|
});
|
|
2560
2560
|
class j extends v {
|
|
2561
2561
|
_parse(e) {
|
|
2562
|
-
return this._getType(e) === f.undefined ?
|
|
2562
|
+
return this._getType(e) === f.undefined ? Z(void 0) : this._def.innerType._parse(e);
|
|
2563
2563
|
}
|
|
2564
2564
|
unwrap() {
|
|
2565
2565
|
return this._def.innerType;
|
|
@@ -2572,7 +2572,7 @@ j.create = (r, e) => new j({
|
|
|
2572
2572
|
});
|
|
2573
2573
|
class q extends v {
|
|
2574
2574
|
_parse(e) {
|
|
2575
|
-
return this._getType(e) === f.null ?
|
|
2575
|
+
return this._getType(e) === f.null ? Z(null) : this._def.innerType._parse(e);
|
|
2576
2576
|
}
|
|
2577
2577
|
unwrap() {
|
|
2578
2578
|
return this._def.innerType;
|
|
@@ -2622,7 +2622,7 @@ class fe extends v {
|
|
|
2622
2622
|
status: "valid",
|
|
2623
2623
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
2624
2624
|
get error() {
|
|
2625
|
-
return new
|
|
2625
|
+
return new O(n.common.issues);
|
|
2626
2626
|
},
|
|
2627
2627
|
input: n.data
|
|
2628
2628
|
})
|
|
@@ -2630,7 +2630,7 @@ class fe extends v {
|
|
|
2630
2630
|
status: "valid",
|
|
2631
2631
|
value: s.status === "valid" ? s.value : this._def.catchValue({
|
|
2632
2632
|
get error() {
|
|
2633
|
-
return new
|
|
2633
|
+
return new O(n.common.issues);
|
|
2634
2634
|
},
|
|
2635
2635
|
input: n.data
|
|
2636
2636
|
})
|
|
@@ -2646,12 +2646,12 @@ fe.create = (r, e) => new fe({
|
|
|
2646
2646
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2647
2647
|
..._(e)
|
|
2648
2648
|
});
|
|
2649
|
-
class
|
|
2649
|
+
class ke extends v {
|
|
2650
2650
|
_parse(e) {
|
|
2651
2651
|
if (this._getType(e) !== f.nan) {
|
|
2652
2652
|
const n = this._getOrReturnCtx(e);
|
|
2653
2653
|
return l(n, {
|
|
2654
|
-
code:
|
|
2654
|
+
code: c.invalid_type,
|
|
2655
2655
|
expected: f.nan,
|
|
2656
2656
|
received: n.parsedType
|
|
2657
2657
|
}), p;
|
|
@@ -2659,11 +2659,11 @@ class be extends v {
|
|
|
2659
2659
|
return { status: "valid", value: e.data };
|
|
2660
2660
|
}
|
|
2661
2661
|
}
|
|
2662
|
-
|
|
2662
|
+
ke.create = (r) => new ke({
|
|
2663
2663
|
typeName: m.ZodNaN,
|
|
2664
2664
|
..._(r)
|
|
2665
2665
|
});
|
|
2666
|
-
const
|
|
2666
|
+
const gt = Symbol("zod_brand");
|
|
2667
2667
|
class Ee extends v {
|
|
2668
2668
|
_parse(e) {
|
|
2669
2669
|
const { ctx: t } = this._processInputParams(e), n = t.data;
|
|
@@ -2687,7 +2687,7 @@ class me extends v {
|
|
|
2687
2687
|
path: n.path,
|
|
2688
2688
|
parent: n
|
|
2689
2689
|
});
|
|
2690
|
-
return a.status === "aborted" ? p : a.status === "dirty" ? (t.dirty(),
|
|
2690
|
+
return a.status === "aborted" ? p : a.status === "dirty" ? (t.dirty(), Y(a.value)) : this._def.out._parseAsync({
|
|
2691
2691
|
data: a.value,
|
|
2692
2692
|
path: n.path,
|
|
2693
2693
|
parent: n
|
|
@@ -2731,25 +2731,25 @@ he.create = (r, e) => new he({
|
|
|
2731
2731
|
typeName: m.ZodReadonly,
|
|
2732
2732
|
..._(e)
|
|
2733
2733
|
});
|
|
2734
|
-
function
|
|
2735
|
-
return r ?
|
|
2736
|
-
var a,
|
|
2734
|
+
function Le(r, e = {}, t) {
|
|
2735
|
+
return r ? Q.create().superRefine((n, s) => {
|
|
2736
|
+
var a, o;
|
|
2737
2737
|
if (!r(n)) {
|
|
2738
|
-
const
|
|
2739
|
-
s.addIssue({ code: "custom", ...
|
|
2738
|
+
const i = typeof e == "function" ? e(n) : typeof e == "string" ? { message: e } : e, d = (o = (a = i.fatal) !== null && a !== void 0 ? a : t) !== null && o !== void 0 ? o : !0, u = typeof i == "string" ? { message: i } : i;
|
|
2739
|
+
s.addIssue({ code: "custom", ...u, fatal: d });
|
|
2740
2740
|
}
|
|
2741
|
-
}) :
|
|
2741
|
+
}) : Q.create();
|
|
2742
2742
|
}
|
|
2743
|
-
const
|
|
2744
|
-
object:
|
|
2743
|
+
const xt = {
|
|
2744
|
+
object: b.lazycreate
|
|
2745
2745
|
};
|
|
2746
2746
|
var m;
|
|
2747
2747
|
(function(r) {
|
|
2748
2748
|
r.ZodString = "ZodString", r.ZodNumber = "ZodNumber", r.ZodNaN = "ZodNaN", r.ZodBigInt = "ZodBigInt", r.ZodBoolean = "ZodBoolean", r.ZodDate = "ZodDate", r.ZodSymbol = "ZodSymbol", r.ZodUndefined = "ZodUndefined", r.ZodNull = "ZodNull", r.ZodAny = "ZodAny", r.ZodUnknown = "ZodUnknown", r.ZodNever = "ZodNever", r.ZodVoid = "ZodVoid", r.ZodArray = "ZodArray", r.ZodObject = "ZodObject", r.ZodUnion = "ZodUnion", r.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", r.ZodIntersection = "ZodIntersection", r.ZodTuple = "ZodTuple", r.ZodRecord = "ZodRecord", r.ZodMap = "ZodMap", r.ZodSet = "ZodSet", r.ZodFunction = "ZodFunction", r.ZodLazy = "ZodLazy", r.ZodLiteral = "ZodLiteral", r.ZodEnum = "ZodEnum", r.ZodEffects = "ZodEffects", r.ZodNativeEnum = "ZodNativeEnum", r.ZodOptional = "ZodOptional", r.ZodNullable = "ZodNullable", r.ZodDefault = "ZodDefault", r.ZodCatch = "ZodCatch", r.ZodPromise = "ZodPromise", r.ZodBranded = "ZodBranded", r.ZodPipeline = "ZodPipeline", r.ZodReadonly = "ZodReadonly";
|
|
2749
2749
|
})(m || (m = {}));
|
|
2750
|
-
const
|
|
2750
|
+
const bt = (r, e = {
|
|
2751
2751
|
message: `Input not instance of ${r.name}`
|
|
2752
|
-
}) =>
|
|
2752
|
+
}) => Le((t) => t instanceof r, e), qe = E.create, Ue = V.create, kt = ke.create, wt = D.create, Be = re.create, Tt = B.create, St = ge.create, Zt = ne.create, Ct = se.create, Nt = Q.create, Ot = U.create, Et = P.create, Rt = xe.create, It = R.create, jt = b.create, At = b.strictCreate, Mt = ae.create, $t = we.create, Pt = ie.create, zt = M.create, Vt = oe.create, Dt = be.create, Lt = W.create, qt = G.create, Ut = ce.create, Bt = de.create, Wt = L.create, Jt = ue.create, Yt = X.create, je = I.create, Gt = j.create, Ht = q.create, Qt = I.createWithPreprocess, Xt = me.create, Ft = () => qe().optional(), Kt = () => Ue().optional(), er = () => Be().optional(), tr = {
|
|
2753
2753
|
string: (r) => E.create({ ...r, coerce: !0 }),
|
|
2754
2754
|
number: (r) => V.create({ ...r, coerce: !0 }),
|
|
2755
2755
|
boolean: (r) => re.create({
|
|
@@ -2758,33 +2758,33 @@ const vt = (r, e = {
|
|
|
2758
2758
|
}),
|
|
2759
2759
|
bigint: (r) => D.create({ ...r, coerce: !0 }),
|
|
2760
2760
|
date: (r) => B.create({ ...r, coerce: !0 })
|
|
2761
|
-
},
|
|
2761
|
+
}, rr = p;
|
|
2762
2762
|
var C = /* @__PURE__ */ Object.freeze({
|
|
2763
2763
|
__proto__: null,
|
|
2764
2764
|
defaultErrorMap: H,
|
|
2765
|
-
setErrorMap:
|
|
2765
|
+
setErrorMap: rt,
|
|
2766
2766
|
getErrorMap: ye,
|
|
2767
2767
|
makeIssue: _e,
|
|
2768
|
-
EMPTY_PATH:
|
|
2768
|
+
EMPTY_PATH: nt,
|
|
2769
2769
|
addIssueToContext: l,
|
|
2770
|
-
ParseStatus:
|
|
2770
|
+
ParseStatus: S,
|
|
2771
2771
|
INVALID: p,
|
|
2772
|
-
DIRTY:
|
|
2773
|
-
OK:
|
|
2772
|
+
DIRTY: Y,
|
|
2773
|
+
OK: Z,
|
|
2774
2774
|
isAborted: Ce,
|
|
2775
|
-
isDirty:
|
|
2775
|
+
isDirty: Ne,
|
|
2776
2776
|
isValid: ee,
|
|
2777
2777
|
isAsync: te,
|
|
2778
2778
|
get util() {
|
|
2779
2779
|
return x;
|
|
2780
2780
|
},
|
|
2781
2781
|
get objectUtil() {
|
|
2782
|
-
return
|
|
2782
|
+
return Ze;
|
|
2783
2783
|
},
|
|
2784
2784
|
ZodParsedType: f,
|
|
2785
|
-
getParsedType:
|
|
2785
|
+
getParsedType: z,
|
|
2786
2786
|
ZodType: v,
|
|
2787
|
-
datetimeRegex:
|
|
2787
|
+
datetimeRegex: Ve,
|
|
2788
2788
|
ZodString: E,
|
|
2789
2789
|
ZodNumber: V,
|
|
2790
2790
|
ZodBigInt: D,
|
|
@@ -2793,105 +2793,105 @@ var C = /* @__PURE__ */ Object.freeze({
|
|
|
2793
2793
|
ZodSymbol: ge,
|
|
2794
2794
|
ZodUndefined: ne,
|
|
2795
2795
|
ZodNull: se,
|
|
2796
|
-
ZodAny:
|
|
2796
|
+
ZodAny: Q,
|
|
2797
2797
|
ZodUnknown: U,
|
|
2798
|
-
ZodNever:
|
|
2798
|
+
ZodNever: P,
|
|
2799
2799
|
ZodVoid: xe,
|
|
2800
2800
|
ZodArray: R,
|
|
2801
|
-
ZodObject:
|
|
2801
|
+
ZodObject: b,
|
|
2802
2802
|
ZodUnion: ae,
|
|
2803
2803
|
ZodDiscriminatedUnion: we,
|
|
2804
2804
|
ZodIntersection: ie,
|
|
2805
2805
|
ZodTuple: M,
|
|
2806
2806
|
ZodRecord: oe,
|
|
2807
|
-
ZodMap:
|
|
2807
|
+
ZodMap: be,
|
|
2808
2808
|
ZodSet: W,
|
|
2809
2809
|
ZodFunction: G,
|
|
2810
|
-
ZodLazy:
|
|
2811
|
-
ZodLiteral:
|
|
2810
|
+
ZodLazy: ce,
|
|
2811
|
+
ZodLiteral: de,
|
|
2812
2812
|
ZodEnum: L,
|
|
2813
2813
|
ZodNativeEnum: ue,
|
|
2814
|
-
ZodPromise:
|
|
2814
|
+
ZodPromise: X,
|
|
2815
2815
|
ZodEffects: I,
|
|
2816
2816
|
ZodTransformer: I,
|
|
2817
2817
|
ZodOptional: j,
|
|
2818
2818
|
ZodNullable: q,
|
|
2819
2819
|
ZodDefault: le,
|
|
2820
2820
|
ZodCatch: fe,
|
|
2821
|
-
ZodNaN:
|
|
2822
|
-
BRAND:
|
|
2821
|
+
ZodNaN: ke,
|
|
2822
|
+
BRAND: gt,
|
|
2823
2823
|
ZodBranded: Ee,
|
|
2824
2824
|
ZodPipeline: me,
|
|
2825
2825
|
ZodReadonly: he,
|
|
2826
|
-
custom:
|
|
2826
|
+
custom: Le,
|
|
2827
2827
|
Schema: v,
|
|
2828
2828
|
ZodSchema: v,
|
|
2829
|
-
late:
|
|
2829
|
+
late: xt,
|
|
2830
2830
|
get ZodFirstPartyTypeKind() {
|
|
2831
2831
|
return m;
|
|
2832
2832
|
},
|
|
2833
|
-
coerce:
|
|
2834
|
-
any:
|
|
2835
|
-
array:
|
|
2836
|
-
bigint:
|
|
2837
|
-
boolean:
|
|
2838
|
-
date:
|
|
2839
|
-
discriminatedUnion:
|
|
2833
|
+
coerce: tr,
|
|
2834
|
+
any: Nt,
|
|
2835
|
+
array: It,
|
|
2836
|
+
bigint: wt,
|
|
2837
|
+
boolean: Be,
|
|
2838
|
+
date: Tt,
|
|
2839
|
+
discriminatedUnion: $t,
|
|
2840
2840
|
effect: je,
|
|
2841
|
-
enum:
|
|
2842
|
-
function:
|
|
2843
|
-
instanceof:
|
|
2844
|
-
intersection:
|
|
2845
|
-
lazy:
|
|
2846
|
-
literal:
|
|
2847
|
-
map:
|
|
2848
|
-
nan:
|
|
2849
|
-
nativeEnum:
|
|
2850
|
-
never:
|
|
2851
|
-
null:
|
|
2852
|
-
nullable:
|
|
2853
|
-
number:
|
|
2854
|
-
object:
|
|
2855
|
-
oboolean:
|
|
2856
|
-
onumber:
|
|
2857
|
-
optional:
|
|
2858
|
-
ostring:
|
|
2859
|
-
pipeline:
|
|
2860
|
-
preprocess:
|
|
2861
|
-
promise:
|
|
2862
|
-
record:
|
|
2863
|
-
set:
|
|
2864
|
-
strictObject:
|
|
2865
|
-
string:
|
|
2866
|
-
symbol:
|
|
2841
|
+
enum: Wt,
|
|
2842
|
+
function: qt,
|
|
2843
|
+
instanceof: bt,
|
|
2844
|
+
intersection: Pt,
|
|
2845
|
+
lazy: Ut,
|
|
2846
|
+
literal: Bt,
|
|
2847
|
+
map: Dt,
|
|
2848
|
+
nan: kt,
|
|
2849
|
+
nativeEnum: Jt,
|
|
2850
|
+
never: Et,
|
|
2851
|
+
null: Ct,
|
|
2852
|
+
nullable: Ht,
|
|
2853
|
+
number: Ue,
|
|
2854
|
+
object: jt,
|
|
2855
|
+
oboolean: er,
|
|
2856
|
+
onumber: Kt,
|
|
2857
|
+
optional: Gt,
|
|
2858
|
+
ostring: Ft,
|
|
2859
|
+
pipeline: Xt,
|
|
2860
|
+
preprocess: Qt,
|
|
2861
|
+
promise: Yt,
|
|
2862
|
+
record: Vt,
|
|
2863
|
+
set: Lt,
|
|
2864
|
+
strictObject: At,
|
|
2865
|
+
string: qe,
|
|
2866
|
+
symbol: St,
|
|
2867
2867
|
transformer: je,
|
|
2868
|
-
tuple:
|
|
2869
|
-
undefined:
|
|
2870
|
-
union:
|
|
2871
|
-
unknown:
|
|
2872
|
-
void:
|
|
2873
|
-
NEVER:
|
|
2874
|
-
ZodIssueCode:
|
|
2875
|
-
quotelessJson:
|
|
2876
|
-
ZodError:
|
|
2868
|
+
tuple: zt,
|
|
2869
|
+
undefined: Zt,
|
|
2870
|
+
union: Mt,
|
|
2871
|
+
unknown: Ot,
|
|
2872
|
+
void: Rt,
|
|
2873
|
+
NEVER: rr,
|
|
2874
|
+
ZodIssueCode: c,
|
|
2875
|
+
quotelessJson: tt,
|
|
2876
|
+
ZodError: O
|
|
2877
2877
|
});
|
|
2878
|
-
const
|
|
2879
|
-
const { texts: { formValidation: r } } =
|
|
2878
|
+
const hr = () => {
|
|
2879
|
+
const { texts: { formValidation: r } } = He(Je), e = (g) => (g != null && g.useCoerce ? C.coerce : C).string({
|
|
2880
2880
|
invalid_type_error: r.required,
|
|
2881
2881
|
required_error: r.required
|
|
2882
|
-
}).transform((w) => w ?? null), t = (g) => e(g).nullable().optional().transform((
|
|
2883
|
-
const
|
|
2882
|
+
}).transform((w) => w ?? null), t = (g) => e(g).nullable().optional().transform((k) => k ?? null), n = (g) => {
|
|
2883
|
+
const k = (g != null && g.useCoerce ? C.coerce : C).number({
|
|
2884
2884
|
invalid_type_error: r.required,
|
|
2885
2885
|
required_error: r.required
|
|
2886
2886
|
});
|
|
2887
|
-
return (g == null ? void 0 : g.min) !== void 0 &&
|
|
2888
|
-
}, s = (g) => n(g).nullable().optional().transform((
|
|
2887
|
+
return (g == null ? void 0 : g.min) !== void 0 && k.min(g.min), (g == null ? void 0 : g.max) !== void 0 && k.max(g.max), k.transform((w) => w ?? null);
|
|
2888
|
+
}, s = (g) => n(g).nullable().optional().transform((k) => k ?? null), a = (g) => (g != null && g.useCoerce ? C.coerce : C).boolean({
|
|
2889
2889
|
invalid_type_error: r.required,
|
|
2890
2890
|
required_error: r.required
|
|
2891
|
-
}).transform((
|
|
2891
|
+
}).transform((k) => k ?? null), o = (g) => (g != null && g.useCoerce ? C.coerce : C).string({
|
|
2892
2892
|
invalid_type_error: r.required,
|
|
2893
2893
|
required_error: r.required
|
|
2894
|
-
}).refine(Ke, { message: r.invalidDate }).transform((w) => w ?? null),
|
|
2894
|
+
}).refine(Ke, { message: r.invalidDate }).transform((w) => w ?? null), i = (g) => o(g).nullable().transform((k) => k ?? null), d = (g, k) => C.enum(g, {
|
|
2895
2895
|
invalid_type_error: r.required,
|
|
2896
2896
|
required_error: r.required
|
|
2897
2897
|
}).transform((Re) => Re ?? null);
|
|
@@ -2901,17 +2901,17 @@ const cr = () => {
|
|
|
2901
2901
|
zNumber: s,
|
|
2902
2902
|
zNumberRequired: n,
|
|
2903
2903
|
zBool: a,
|
|
2904
|
-
zDate:
|
|
2905
|
-
zDateRequired:
|
|
2906
|
-
zEnum: (g,
|
|
2907
|
-
zEnumRequired:
|
|
2904
|
+
zDate: i,
|
|
2905
|
+
zDateRequired: o,
|
|
2906
|
+
zEnum: (g, k) => d(g).nullable().transform((w) => w ?? null),
|
|
2907
|
+
zEnumRequired: d,
|
|
2908
2908
|
zObjectIdInt: (g) => C.object({ id: s({ useCoerce: !0 }) }).nullable().transform((w) => w ?? null),
|
|
2909
2909
|
zObjectIdIntRequired: (g) => C.object({ id: n() }).transform((w) => w ?? null),
|
|
2910
2910
|
zObjectIdStr: (g) => C.object({ id: t({ useCoerce: !0 }) }).nullable().transform((w) => w ?? null),
|
|
2911
2911
|
zObjectIdStrRequired: (g) => C.object({ id: e() }).transform((w) => w ?? null),
|
|
2912
|
-
zFile: ({ required: g, multiple:
|
|
2912
|
+
zFile: ({ required: g, multiple: k, maxFileSize: w }) => C.any().transform((T) => Array.from(T ?? [])).refine((T) => !g || (T == null ? void 0 : T.length) > 0, "File is required.").refine((T) => k || (T == null ? void 0 : T.length) <= 1, "Multiple files not allowed.").refine((T) => T.every((We) => We.size <= w), `Maximum file size is ${Ye(w)}.`).transform((T) => (k ? T : T == null ? void 0 : T[0]) ?? null)
|
|
2913
2913
|
};
|
|
2914
|
-
},
|
|
2914
|
+
}, nr = (r) => {
|
|
2915
2915
|
let e = "pending", t;
|
|
2916
2916
|
const n = r.then((s) => {
|
|
2917
2917
|
e = "success", t = s;
|
|
@@ -2931,28 +2931,59 @@ const cr = () => {
|
|
|
2931
2931
|
}
|
|
2932
2932
|
};
|
|
2933
2933
|
};
|
|
2934
|
-
function
|
|
2935
|
-
const e =
|
|
2934
|
+
function mr(r) {
|
|
2935
|
+
const e = Ge({ silent: !0 }), [t, n] = Qe(null);
|
|
2936
2936
|
return Xe(() => {
|
|
2937
2937
|
(async () => {
|
|
2938
|
-
const a = e.get(r).then((
|
|
2939
|
-
n(
|
|
2938
|
+
const a = e.get(r).then((o) => o.data);
|
|
2939
|
+
n(nr(a));
|
|
2940
2940
|
})();
|
|
2941
2941
|
}, [e, r]), t;
|
|
2942
2942
|
}
|
|
2943
|
+
const sr = () => {
|
|
2944
|
+
const [r, e] = et(), t = Ae((n, s) => {
|
|
2945
|
+
e((a) => (s === null && a.delete(n), a.get(n) === s || a.set(n, s ?? ""), a), { replace: !0 });
|
|
2946
|
+
}, [e]);
|
|
2947
|
+
return {
|
|
2948
|
+
searchParams: r,
|
|
2949
|
+
setSearch: t
|
|
2950
|
+
};
|
|
2951
|
+
}, pr = (r, e, t) => {
|
|
2952
|
+
const { searchParams: n, setSearch: s } = sr(), a = Fe(() => {
|
|
2953
|
+
const i = n.get(r), d = i ? Number(i) : e, u = Number.isNaN(d) ? typeof e : "number";
|
|
2954
|
+
switch (t ?? u) {
|
|
2955
|
+
case "number":
|
|
2956
|
+
return d;
|
|
2957
|
+
case "string":
|
|
2958
|
+
return i ?? e;
|
|
2959
|
+
case "boolean":
|
|
2960
|
+
return i === "true";
|
|
2961
|
+
case "object":
|
|
2962
|
+
return i ? JSON.parse(i) : e;
|
|
2963
|
+
default:
|
|
2964
|
+
throw console.error(t, u), new Error(`useSearchQueryState is not implemented for type ${typeof (t ?? u)}.`);
|
|
2965
|
+
}
|
|
2966
|
+
}, [e, t, r, n]), o = Ae((i) => {
|
|
2967
|
+
let d;
|
|
2968
|
+
typeof i == "function" ? d = i(a) : d = i, typeof d == "object" ? s(r, d === null ? null : JSON.stringify(d)) : s(r, d === null ? null : d.toString());
|
|
2969
|
+
}, [r, s, a]);
|
|
2970
|
+
return [a, o];
|
|
2971
|
+
};
|
|
2943
2972
|
export {
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2973
|
+
vr as cancelToken,
|
|
2974
|
+
gr as useAuth,
|
|
2975
|
+
Ge as useAxios,
|
|
2976
|
+
Cr as useClickOutside,
|
|
2977
|
+
kr as useConfirm,
|
|
2978
|
+
Nr as useFormControlType,
|
|
2979
|
+
wr as useGetApiData,
|
|
2980
|
+
mr as useGetDataBound,
|
|
2981
|
+
Or as useKeyPress,
|
|
2982
|
+
Tr as useLocalStorageState,
|
|
2983
|
+
xr as useNotifications,
|
|
2984
|
+
Rr as usePermissions,
|
|
2985
|
+
Sr as usePrompt,
|
|
2986
|
+
sr as useSearchQuery,
|
|
2987
|
+
pr as useSearchQueryState,
|
|
2988
|
+
hr as useZodSchemaTypes
|
|
2958
2989
|
};
|