@jsdev_ninja/core 0.11.1 → 0.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.cjs.js +1 -1
- package/dist/core.cjs.js.map +1 -1
- package/dist/core.es.js +974 -877
- package/dist/core.es.js.map +1 -1
- package/dist/core.umd.js +1 -1
- package/dist/core.umd.js.map +1 -1
- package/dist/entities/Cart.d.ts +1 -2
- package/dist/entities/Cart.d.ts.map +1 -1
- package/dist/entities/Cart.js +1 -1
- package/dist/entities/Order.d.ts +21 -0
- package/dist/entities/Order.d.ts.map +1 -1
- package/dist/entities/Order.js +2 -2
- package/dist/entities/Store.d.ts +3 -0
- package/dist/entities/Store.d.ts.map +1 -1
- package/dist/entities/Store.js +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/lib/entities/Store.ts +2 -0
- package/lib/index.tsx +1 -0
- package/package.json +1 -1
package/dist/core.es.js
CHANGED
|
@@ -9,39 +9,39 @@ var b;
|
|
|
9
9
|
}
|
|
10
10
|
r.assertNever = t, r.arrayToEnum = (s) => {
|
|
11
11
|
const a = {};
|
|
12
|
-
for (const
|
|
13
|
-
a[
|
|
12
|
+
for (const c of s)
|
|
13
|
+
a[c] = c;
|
|
14
14
|
return a;
|
|
15
15
|
}, r.getValidEnumValues = (s) => {
|
|
16
|
-
const a = r.objectKeys(s).filter((
|
|
17
|
-
for (const
|
|
18
|
-
|
|
19
|
-
return r.objectValues(
|
|
16
|
+
const a = r.objectKeys(s).filter((i) => typeof s[s[i]] != "number"), c = {};
|
|
17
|
+
for (const i of a)
|
|
18
|
+
c[i] = s[i];
|
|
19
|
+
return r.objectValues(c);
|
|
20
20
|
}, r.objectValues = (s) => r.objectKeys(s).map(function(a) {
|
|
21
21
|
return s[a];
|
|
22
22
|
}), r.objectKeys = typeof Object.keys == "function" ? (s) => Object.keys(s) : (s) => {
|
|
23
23
|
const a = [];
|
|
24
|
-
for (const
|
|
25
|
-
Object.prototype.hasOwnProperty.call(s,
|
|
24
|
+
for (const c in s)
|
|
25
|
+
Object.prototype.hasOwnProperty.call(s, c) && a.push(c);
|
|
26
26
|
return a;
|
|
27
27
|
}, r.find = (s, a) => {
|
|
28
|
-
for (const
|
|
29
|
-
if (a(
|
|
30
|
-
return
|
|
28
|
+
for (const c of s)
|
|
29
|
+
if (a(c))
|
|
30
|
+
return c;
|
|
31
31
|
}, r.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && isFinite(s) && Math.floor(s) === s;
|
|
32
32
|
function n(s, a = " | ") {
|
|
33
|
-
return s.map((
|
|
33
|
+
return s.map((c) => typeof c == "string" ? `'${c}'` : c).join(a);
|
|
34
34
|
}
|
|
35
35
|
r.joinValues = n, r.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a;
|
|
36
36
|
})(b || (b = {}));
|
|
37
|
-
var
|
|
37
|
+
var Ne;
|
|
38
38
|
(function(r) {
|
|
39
39
|
r.mergeShapes = (e, t) => ({
|
|
40
40
|
...e,
|
|
41
41
|
...t
|
|
42
42
|
// second overwrites first
|
|
43
43
|
});
|
|
44
|
-
})(
|
|
44
|
+
})(Ne || (Ne = {}));
|
|
45
45
|
const h = b.arrayToEnum([
|
|
46
46
|
"string",
|
|
47
47
|
"nan",
|
|
@@ -63,7 +63,7 @@ const h = b.arrayToEnum([
|
|
|
63
63
|
"never",
|
|
64
64
|
"map",
|
|
65
65
|
"set"
|
|
66
|
-
]),
|
|
66
|
+
]), V = (r) => {
|
|
67
67
|
switch (typeof r) {
|
|
68
68
|
case "undefined":
|
|
69
69
|
return h.undefined;
|
|
@@ -84,7 +84,7 @@ const h = b.arrayToEnum([
|
|
|
84
84
|
default:
|
|
85
85
|
return h.unknown;
|
|
86
86
|
}
|
|
87
|
-
},
|
|
87
|
+
}, d = b.arrayToEnum([
|
|
88
88
|
"invalid_type",
|
|
89
89
|
"invalid_literal",
|
|
90
90
|
"custom",
|
|
@@ -101,7 +101,7 @@ const h = b.arrayToEnum([
|
|
|
101
101
|
"invalid_intersection_types",
|
|
102
102
|
"not_multiple_of",
|
|
103
103
|
"not_finite"
|
|
104
|
-
]),
|
|
104
|
+
]), it = (r) => JSON.stringify(r, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
105
105
|
class Z extends Error {
|
|
106
106
|
get errors() {
|
|
107
107
|
return this.issues;
|
|
@@ -119,20 +119,20 @@ class Z extends Error {
|
|
|
119
119
|
const t = e || function(a) {
|
|
120
120
|
return a.message;
|
|
121
121
|
}, n = { _errors: [] }, s = (a) => {
|
|
122
|
-
for (const
|
|
123
|
-
if (
|
|
124
|
-
|
|
125
|
-
else if (
|
|
126
|
-
s(
|
|
127
|
-
else if (
|
|
128
|
-
s(
|
|
129
|
-
else if (
|
|
130
|
-
n._errors.push(t(
|
|
122
|
+
for (const c of a.issues)
|
|
123
|
+
if (c.code === "invalid_union")
|
|
124
|
+
c.unionErrors.map(s);
|
|
125
|
+
else if (c.code === "invalid_return_type")
|
|
126
|
+
s(c.returnTypeError);
|
|
127
|
+
else if (c.code === "invalid_arguments")
|
|
128
|
+
s(c.argumentsError);
|
|
129
|
+
else if (c.path.length === 0)
|
|
130
|
+
n._errors.push(t(c));
|
|
131
131
|
else {
|
|
132
|
-
let
|
|
133
|
-
for (;
|
|
134
|
-
const u =
|
|
135
|
-
|
|
132
|
+
let i = n, l = 0;
|
|
133
|
+
for (; l < c.path.length; ) {
|
|
134
|
+
const u = c.path[l];
|
|
135
|
+
l === c.path.length - 1 ? (i[u] = i[u] || { _errors: [] }, i[u]._errors.push(t(c))) : i[u] = i[u] || { _errors: [] }, i = i[u], l++;
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
};
|
|
@@ -162,55 +162,55 @@ class Z extends Error {
|
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
Z.create = (r) => new Z(r);
|
|
165
|
-
const
|
|
165
|
+
const G = (r, e) => {
|
|
166
166
|
let t;
|
|
167
167
|
switch (r.code) {
|
|
168
|
-
case
|
|
168
|
+
case d.invalid_type:
|
|
169
169
|
r.received === h.undefined ? t = "Required" : t = `Expected ${r.expected}, received ${r.received}`;
|
|
170
170
|
break;
|
|
171
|
-
case
|
|
171
|
+
case d.invalid_literal:
|
|
172
172
|
t = `Invalid literal value, expected ${JSON.stringify(r.expected, b.jsonStringifyReplacer)}`;
|
|
173
173
|
break;
|
|
174
|
-
case
|
|
174
|
+
case d.unrecognized_keys:
|
|
175
175
|
t = `Unrecognized key(s) in object: ${b.joinValues(r.keys, ", ")}`;
|
|
176
176
|
break;
|
|
177
|
-
case
|
|
177
|
+
case d.invalid_union:
|
|
178
178
|
t = "Invalid input";
|
|
179
179
|
break;
|
|
180
|
-
case
|
|
180
|
+
case d.invalid_union_discriminator:
|
|
181
181
|
t = `Invalid discriminator value. Expected ${b.joinValues(r.options)}`;
|
|
182
182
|
break;
|
|
183
|
-
case
|
|
183
|
+
case d.invalid_enum_value:
|
|
184
184
|
t = `Invalid enum value. Expected ${b.joinValues(r.options)}, received '${r.received}'`;
|
|
185
185
|
break;
|
|
186
|
-
case
|
|
186
|
+
case d.invalid_arguments:
|
|
187
187
|
t = "Invalid function arguments";
|
|
188
188
|
break;
|
|
189
|
-
case
|
|
189
|
+
case d.invalid_return_type:
|
|
190
190
|
t = "Invalid function return type";
|
|
191
191
|
break;
|
|
192
|
-
case
|
|
192
|
+
case d.invalid_date:
|
|
193
193
|
t = "Invalid date";
|
|
194
194
|
break;
|
|
195
|
-
case
|
|
195
|
+
case d.invalid_string:
|
|
196
196
|
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}"` : b.assertNever(r.validation) : r.validation !== "regex" ? t = `Invalid ${r.validation}` : t = "Invalid";
|
|
197
197
|
break;
|
|
198
|
-
case
|
|
198
|
+
case d.too_small:
|
|
199
199
|
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";
|
|
200
200
|
break;
|
|
201
|
-
case
|
|
201
|
+
case d.too_big:
|
|
202
202
|
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";
|
|
203
203
|
break;
|
|
204
|
-
case
|
|
204
|
+
case d.custom:
|
|
205
205
|
t = "Invalid input";
|
|
206
206
|
break;
|
|
207
|
-
case
|
|
207
|
+
case d.invalid_intersection_types:
|
|
208
208
|
t = "Intersection results could not be merged";
|
|
209
209
|
break;
|
|
210
|
-
case
|
|
210
|
+
case d.not_multiple_of:
|
|
211
211
|
t = `Number must be a multiple of ${r.multipleOf}`;
|
|
212
212
|
break;
|
|
213
|
-
case
|
|
213
|
+
case d.not_finite:
|
|
214
214
|
t = "Number must be finite";
|
|
215
215
|
break;
|
|
216
216
|
default:
|
|
@@ -218,15 +218,15 @@ const Y = (r, e) => {
|
|
|
218
218
|
}
|
|
219
219
|
return { message: t };
|
|
220
220
|
};
|
|
221
|
-
let
|
|
222
|
-
function
|
|
223
|
-
|
|
221
|
+
let Ue = G;
|
|
222
|
+
function ot(r) {
|
|
223
|
+
Ue = r;
|
|
224
224
|
}
|
|
225
|
-
function
|
|
226
|
-
return
|
|
225
|
+
function _e() {
|
|
226
|
+
return Ue;
|
|
227
227
|
}
|
|
228
|
-
const
|
|
229
|
-
const { data: e, path: t, errorMaps: n, issueData: s } = r, a = [...t, ...s.path || []],
|
|
228
|
+
const be = (r) => {
|
|
229
|
+
const { data: e, path: t, errorMaps: n, issueData: s } = r, a = [...t, ...s.path || []], c = {
|
|
230
230
|
...s,
|
|
231
231
|
path: a
|
|
232
232
|
};
|
|
@@ -236,18 +236,18 @@ const ye = (r) => {
|
|
|
236
236
|
path: a,
|
|
237
237
|
message: s.message
|
|
238
238
|
};
|
|
239
|
-
let
|
|
240
|
-
const
|
|
241
|
-
for (const u of
|
|
242
|
-
|
|
239
|
+
let i = "";
|
|
240
|
+
const l = n.filter((u) => !!u).slice().reverse();
|
|
241
|
+
for (const u of l)
|
|
242
|
+
i = u(c, { data: e, defaultError: i }).message;
|
|
243
243
|
return {
|
|
244
244
|
...s,
|
|
245
245
|
path: a,
|
|
246
|
-
message:
|
|
246
|
+
message: i
|
|
247
247
|
};
|
|
248
|
-
},
|
|
249
|
-
function
|
|
250
|
-
const t =
|
|
248
|
+
}, ct = [];
|
|
249
|
+
function f(r, e) {
|
|
250
|
+
const t = _e(), n = be({
|
|
251
251
|
issueData: e,
|
|
252
252
|
data: r.data,
|
|
253
253
|
path: r.path,
|
|
@@ -258,13 +258,13 @@ function l(r, e) {
|
|
|
258
258
|
// then schema-bound map if available
|
|
259
259
|
t,
|
|
260
260
|
// then global override map
|
|
261
|
-
t ===
|
|
261
|
+
t === G ? void 0 : G
|
|
262
262
|
// then global default map
|
|
263
263
|
].filter((s) => !!s)
|
|
264
264
|
});
|
|
265
265
|
r.common.issues.push(n);
|
|
266
266
|
}
|
|
267
|
-
class
|
|
267
|
+
class C {
|
|
268
268
|
constructor() {
|
|
269
269
|
this.value = "valid";
|
|
270
270
|
}
|
|
@@ -286,33 +286,33 @@ class w {
|
|
|
286
286
|
static async mergeObjectAsync(e, t) {
|
|
287
287
|
const n = [];
|
|
288
288
|
for (const s of t) {
|
|
289
|
-
const a = await s.key,
|
|
289
|
+
const a = await s.key, c = await s.value;
|
|
290
290
|
n.push({
|
|
291
291
|
key: a,
|
|
292
|
-
value:
|
|
292
|
+
value: c
|
|
293
293
|
});
|
|
294
294
|
}
|
|
295
|
-
return
|
|
295
|
+
return C.mergeObjectSync(e, n);
|
|
296
296
|
}
|
|
297
297
|
static mergeObjectSync(e, t) {
|
|
298
298
|
const n = {};
|
|
299
299
|
for (const s of t) {
|
|
300
|
-
const { key: a, value:
|
|
301
|
-
if (a.status === "aborted" ||
|
|
300
|
+
const { key: a, value: c } = s;
|
|
301
|
+
if (a.status === "aborted" || c.status === "aborted")
|
|
302
302
|
return g;
|
|
303
|
-
a.status === "dirty" && e.dirty(),
|
|
303
|
+
a.status === "dirty" && e.dirty(), c.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof c.value < "u" || s.alwaysSet) && (n[a.value] = c.value);
|
|
304
304
|
}
|
|
305
305
|
return { status: e.value, value: n };
|
|
306
306
|
}
|
|
307
307
|
}
|
|
308
308
|
const g = Object.freeze({
|
|
309
309
|
status: "aborted"
|
|
310
|
-
}),
|
|
311
|
-
function
|
|
310
|
+
}), Q = (r) => ({ status: "dirty", value: r }), S = (r) => ({ status: "valid", value: r }), Oe = (r) => r.status === "aborted", je = (r) => r.status === "dirty", B = (r) => r.status === "valid", ne = (r) => typeof Promise < "u" && r instanceof Promise;
|
|
311
|
+
function xe(r, e, t, n) {
|
|
312
312
|
if (typeof e == "function" ? r !== e || !0 : !e.has(r)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
313
313
|
return e.get(r);
|
|
314
314
|
}
|
|
315
|
-
function
|
|
315
|
+
function Be(r, e, t, n, s) {
|
|
316
316
|
if (typeof e == "function" ? r !== e || !0 : !e.has(r)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
317
317
|
return e.set(r, t), t;
|
|
318
318
|
}
|
|
@@ -320,8 +320,8 @@ var m;
|
|
|
320
320
|
(function(r) {
|
|
321
321
|
r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
322
322
|
})(m || (m = {}));
|
|
323
|
-
var
|
|
324
|
-
class
|
|
323
|
+
var te, re;
|
|
324
|
+
class R {
|
|
325
325
|
constructor(e, t, n, s) {
|
|
326
326
|
this._cachedPath = [], this.parent = e, this.data = t, this._path = n, this._key = s;
|
|
327
327
|
}
|
|
@@ -329,8 +329,8 @@ class O {
|
|
|
329
329
|
return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
330
330
|
}
|
|
331
331
|
}
|
|
332
|
-
const
|
|
333
|
-
if (
|
|
332
|
+
const Le = (r, e) => {
|
|
333
|
+
if (B(e))
|
|
334
334
|
return { success: !0, data: e.value };
|
|
335
335
|
if (!r.common.issues.length)
|
|
336
336
|
throw new Error("Validation failed but no issues detected.");
|
|
@@ -350,10 +350,10 @@ function v(r) {
|
|
|
350
350
|
const { errorMap: e, invalid_type_error: t, required_error: n, description: s } = r;
|
|
351
351
|
if (e && (t || n))
|
|
352
352
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
353
|
-
return e ? { errorMap: e, description: s } : { errorMap: (
|
|
354
|
-
var
|
|
353
|
+
return e ? { errorMap: e, description: s } : { errorMap: (c, i) => {
|
|
354
|
+
var l, u;
|
|
355
355
|
const { message: p } = r;
|
|
356
|
-
return
|
|
356
|
+
return c.code === "invalid_enum_value" ? { message: p ?? i.defaultError } : typeof i.data > "u" ? { message: (l = p ?? n) !== null && l !== void 0 ? l : i.defaultError } : c.code !== "invalid_type" ? { message: i.defaultError } : { message: (u = p ?? t) !== null && u !== void 0 ? u : i.defaultError };
|
|
357
357
|
}, description: s };
|
|
358
358
|
}
|
|
359
359
|
class _ {
|
|
@@ -361,13 +361,13 @@ class _ {
|
|
|
361
361
|
return this._def.description;
|
|
362
362
|
}
|
|
363
363
|
_getType(e) {
|
|
364
|
-
return
|
|
364
|
+
return V(e.data);
|
|
365
365
|
}
|
|
366
366
|
_getOrReturnCtx(e, t) {
|
|
367
367
|
return t || {
|
|
368
368
|
common: e.parent.common,
|
|
369
369
|
data: e.data,
|
|
370
|
-
parsedType:
|
|
370
|
+
parsedType: V(e.data),
|
|
371
371
|
schemaErrorMap: this._def.errorMap,
|
|
372
372
|
path: e.path,
|
|
373
373
|
parent: e.parent
|
|
@@ -375,11 +375,11 @@ class _ {
|
|
|
375
375
|
}
|
|
376
376
|
_processInputParams(e) {
|
|
377
377
|
return {
|
|
378
|
-
status: new
|
|
378
|
+
status: new C(),
|
|
379
379
|
ctx: {
|
|
380
380
|
common: e.parent.common,
|
|
381
381
|
data: e.data,
|
|
382
|
-
parsedType:
|
|
382
|
+
parsedType: V(e.data),
|
|
383
383
|
schemaErrorMap: this._def.errorMap,
|
|
384
384
|
path: e.path,
|
|
385
385
|
parent: e.parent
|
|
@@ -388,7 +388,7 @@ class _ {
|
|
|
388
388
|
}
|
|
389
389
|
_parseSync(e) {
|
|
390
390
|
const t = this._parse(e);
|
|
391
|
-
if (
|
|
391
|
+
if (ne(t))
|
|
392
392
|
throw new Error("Synchronous parse encountered promise.");
|
|
393
393
|
return t;
|
|
394
394
|
}
|
|
@@ -414,9 +414,9 @@ class _ {
|
|
|
414
414
|
schemaErrorMap: this._def.errorMap,
|
|
415
415
|
parent: null,
|
|
416
416
|
data: e,
|
|
417
|
-
parsedType:
|
|
417
|
+
parsedType: V(e)
|
|
418
418
|
}, a = this._parseSync({ data: e, path: s.path, parent: s });
|
|
419
|
-
return
|
|
419
|
+
return Le(s, a);
|
|
420
420
|
}
|
|
421
421
|
"~validate"(e) {
|
|
422
422
|
var t, n;
|
|
@@ -429,12 +429,12 @@ class _ {
|
|
|
429
429
|
schemaErrorMap: this._def.errorMap,
|
|
430
430
|
parent: null,
|
|
431
431
|
data: e,
|
|
432
|
-
parsedType:
|
|
432
|
+
parsedType: V(e)
|
|
433
433
|
};
|
|
434
434
|
if (!this["~standard"].async)
|
|
435
435
|
try {
|
|
436
436
|
const a = this._parseSync({ data: e, path: [], parent: s });
|
|
437
|
-
return
|
|
437
|
+
return B(a) ? {
|
|
438
438
|
value: a.value
|
|
439
439
|
} : {
|
|
440
440
|
issues: s.common.issues
|
|
@@ -445,7 +445,7 @@ class _ {
|
|
|
445
445
|
async: !0
|
|
446
446
|
};
|
|
447
447
|
}
|
|
448
|
-
return this._parseAsync({ data: e, path: [], parent: s }).then((a) =>
|
|
448
|
+
return this._parseAsync({ data: e, path: [], parent: s }).then((a) => B(a) ? {
|
|
449
449
|
value: a.value
|
|
450
450
|
} : {
|
|
451
451
|
issues: s.common.issues
|
|
@@ -468,25 +468,25 @@ class _ {
|
|
|
468
468
|
schemaErrorMap: this._def.errorMap,
|
|
469
469
|
parent: null,
|
|
470
470
|
data: e,
|
|
471
|
-
parsedType:
|
|
472
|
-
}, s = this._parse({ data: e, path: n.path, parent: n }), a = await (
|
|
473
|
-
return
|
|
471
|
+
parsedType: V(e)
|
|
472
|
+
}, s = this._parse({ data: e, path: n.path, parent: n }), a = await (ne(s) ? s : Promise.resolve(s));
|
|
473
|
+
return Le(n, a);
|
|
474
474
|
}
|
|
475
475
|
refine(e, t) {
|
|
476
476
|
const n = (s) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(s) : t;
|
|
477
477
|
return this._refinement((s, a) => {
|
|
478
|
-
const
|
|
479
|
-
code:
|
|
478
|
+
const c = e(s), i = () => a.addIssue({
|
|
479
|
+
code: d.custom,
|
|
480
480
|
...n(s)
|
|
481
481
|
});
|
|
482
|
-
return typeof Promise < "u" &&
|
|
482
|
+
return typeof Promise < "u" && c instanceof Promise ? c.then((l) => l ? !0 : (i(), !1)) : c ? !0 : (i(), !1);
|
|
483
483
|
});
|
|
484
484
|
}
|
|
485
485
|
refinement(e, t) {
|
|
486
486
|
return this._refinement((n, s) => e(n) ? !0 : (s.addIssue(typeof t == "function" ? t(n, s) : t), !1));
|
|
487
487
|
}
|
|
488
488
|
_refinement(e) {
|
|
489
|
-
return new
|
|
489
|
+
return new j({
|
|
490
490
|
schema: this,
|
|
491
491
|
typeName: y.ZodEffects,
|
|
492
492
|
effect: { type: "refinement", refinement: e }
|
|
@@ -503,28 +503,28 @@ class _ {
|
|
|
503
503
|
};
|
|
504
504
|
}
|
|
505
505
|
optional() {
|
|
506
|
-
return
|
|
506
|
+
return E.create(this, this._def);
|
|
507
507
|
}
|
|
508
508
|
nullable() {
|
|
509
|
-
return
|
|
509
|
+
return F.create(this, this._def);
|
|
510
510
|
}
|
|
511
511
|
nullish() {
|
|
512
512
|
return this.nullable().optional();
|
|
513
513
|
}
|
|
514
514
|
array() {
|
|
515
|
-
return
|
|
515
|
+
return O.create(this);
|
|
516
516
|
}
|
|
517
517
|
promise() {
|
|
518
|
-
return
|
|
518
|
+
return K.create(this, this._def);
|
|
519
519
|
}
|
|
520
520
|
or(e) {
|
|
521
|
-
return
|
|
521
|
+
return oe.create([this, e], this._def);
|
|
522
522
|
}
|
|
523
523
|
and(e) {
|
|
524
|
-
return
|
|
524
|
+
return ce.create(this, e, this._def);
|
|
525
525
|
}
|
|
526
526
|
transform(e) {
|
|
527
|
-
return new
|
|
527
|
+
return new j({
|
|
528
528
|
...v(this._def),
|
|
529
529
|
schema: this,
|
|
530
530
|
typeName: y.ZodEffects,
|
|
@@ -533,7 +533,7 @@ class _ {
|
|
|
533
533
|
}
|
|
534
534
|
default(e) {
|
|
535
535
|
const t = typeof e == "function" ? e : () => e;
|
|
536
|
-
return new
|
|
536
|
+
return new he({
|
|
537
537
|
...v(this._def),
|
|
538
538
|
innerType: this,
|
|
539
539
|
defaultValue: t,
|
|
@@ -541,7 +541,7 @@ class _ {
|
|
|
541
541
|
});
|
|
542
542
|
}
|
|
543
543
|
brand() {
|
|
544
|
-
return new
|
|
544
|
+
return new Re({
|
|
545
545
|
typeName: y.ZodBranded,
|
|
546
546
|
type: this,
|
|
547
547
|
...v(this._def)
|
|
@@ -549,7 +549,7 @@ class _ {
|
|
|
549
549
|
}
|
|
550
550
|
catch(e) {
|
|
551
551
|
const t = typeof e == "function" ? e : () => e;
|
|
552
|
-
return new
|
|
552
|
+
return new pe({
|
|
553
553
|
...v(this._def),
|
|
554
554
|
innerType: this,
|
|
555
555
|
catchValue: t,
|
|
@@ -564,10 +564,10 @@ class _ {
|
|
|
564
564
|
});
|
|
565
565
|
}
|
|
566
566
|
pipe(e) {
|
|
567
|
-
return
|
|
567
|
+
return ye.create(this, e);
|
|
568
568
|
}
|
|
569
569
|
readonly() {
|
|
570
|
-
return
|
|
570
|
+
return me.create(this);
|
|
571
571
|
}
|
|
572
572
|
isOptional() {
|
|
573
573
|
return this.safeParse(void 0).success;
|
|
@@ -576,26 +576,26 @@ class _ {
|
|
|
576
576
|
return this.safeParse(null).success;
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
|
-
const
|
|
580
|
-
let
|
|
581
|
-
const
|
|
582
|
-
function
|
|
579
|
+
const dt = /^c[^\s-]{8,}$/i, ut = /^[0-9a-z]+$/, lt = /^[0-9A-HJKMNP-TV-Z]{26}$/i, ft = /^[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, ht = /^[a-z0-9_-]{21}$/i, pt = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, mt = /^[-+]?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)?)??$/, yt = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, gt = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
580
|
+
let Ie;
|
|
581
|
+
const vt = /^(?:(?: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])$/, _t = /^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/, bt = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, xt = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, kt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, wt = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, qe = "((\\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])))", Tt = new RegExp(`^${qe}$`);
|
|
582
|
+
function We(r) {
|
|
583
583
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
584
584
|
return r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
585
585
|
}
|
|
586
|
-
function
|
|
587
|
-
return new RegExp(`^${
|
|
586
|
+
function Ct(r) {
|
|
587
|
+
return new RegExp(`^${We(r)}$`);
|
|
588
588
|
}
|
|
589
|
-
function
|
|
590
|
-
let e = `${
|
|
589
|
+
function Je(r) {
|
|
590
|
+
let e = `${qe}T${We(r)}`;
|
|
591
591
|
const t = [];
|
|
592
592
|
return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
593
593
|
}
|
|
594
|
-
function
|
|
595
|
-
return !!((e === "v4" || !e) &&
|
|
594
|
+
function St(r, e) {
|
|
595
|
+
return !!((e === "v4" || !e) && vt.test(r) || (e === "v6" || !e) && bt.test(r));
|
|
596
596
|
}
|
|
597
|
-
function
|
|
598
|
-
if (!
|
|
597
|
+
function Zt(r, e) {
|
|
598
|
+
if (!pt.test(r))
|
|
599
599
|
return !1;
|
|
600
600
|
try {
|
|
601
601
|
const [t] = r.split("."), n = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), s = JSON.parse(atob(n));
|
|
@@ -604,25 +604,25 @@ function pt(r, e) {
|
|
|
604
604
|
return !1;
|
|
605
605
|
}
|
|
606
606
|
}
|
|
607
|
-
function
|
|
608
|
-
return !!((e === "v4" || !e) &&
|
|
607
|
+
function It(r, e) {
|
|
608
|
+
return !!((e === "v4" || !e) && _t.test(r) || (e === "v6" || !e) && xt.test(r));
|
|
609
609
|
}
|
|
610
|
-
class
|
|
610
|
+
class N extends _ {
|
|
611
611
|
_parse(e) {
|
|
612
612
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== h.string) {
|
|
613
613
|
const a = this._getOrReturnCtx(e);
|
|
614
|
-
return
|
|
615
|
-
code:
|
|
614
|
+
return f(a, {
|
|
615
|
+
code: d.invalid_type,
|
|
616
616
|
expected: h.string,
|
|
617
617
|
received: a.parsedType
|
|
618
618
|
}), g;
|
|
619
619
|
}
|
|
620
|
-
const n = new
|
|
620
|
+
const n = new C();
|
|
621
621
|
let s;
|
|
622
622
|
for (const a of this._def.checks)
|
|
623
623
|
if (a.kind === "min")
|
|
624
|
-
e.data.length < a.value && (s = this._getOrReturnCtx(e, s),
|
|
625
|
-
code:
|
|
624
|
+
e.data.length < a.value && (s = this._getOrReturnCtx(e, s), f(s, {
|
|
625
|
+
code: d.too_small,
|
|
626
626
|
minimum: a.value,
|
|
627
627
|
type: "string",
|
|
628
628
|
inclusive: !0,
|
|
@@ -630,8 +630,8 @@ class C extends _ {
|
|
|
630
630
|
message: a.message
|
|
631
631
|
}), n.dirty());
|
|
632
632
|
else if (a.kind === "max")
|
|
633
|
-
e.data.length > a.value && (s = this._getOrReturnCtx(e, s),
|
|
634
|
-
code:
|
|
633
|
+
e.data.length > a.value && (s = this._getOrReturnCtx(e, s), f(s, {
|
|
634
|
+
code: d.too_big,
|
|
635
635
|
maximum: a.value,
|
|
636
636
|
type: "string",
|
|
637
637
|
inclusive: !0,
|
|
@@ -639,16 +639,16 @@ class C extends _ {
|
|
|
639
639
|
message: a.message
|
|
640
640
|
}), n.dirty());
|
|
641
641
|
else if (a.kind === "length") {
|
|
642
|
-
const
|
|
643
|
-
(
|
|
644
|
-
code:
|
|
642
|
+
const c = e.data.length > a.value, i = e.data.length < a.value;
|
|
643
|
+
(c || i) && (s = this._getOrReturnCtx(e, s), c ? f(s, {
|
|
644
|
+
code: d.too_big,
|
|
645
645
|
maximum: a.value,
|
|
646
646
|
type: "string",
|
|
647
647
|
inclusive: !0,
|
|
648
648
|
exact: !0,
|
|
649
649
|
message: a.message
|
|
650
|
-
}) :
|
|
651
|
-
code:
|
|
650
|
+
}) : i && f(s, {
|
|
651
|
+
code: d.too_small,
|
|
652
652
|
minimum: a.value,
|
|
653
653
|
type: "string",
|
|
654
654
|
inclusive: !0,
|
|
@@ -656,108 +656,108 @@ class C extends _ {
|
|
|
656
656
|
message: a.message
|
|
657
657
|
}), n.dirty());
|
|
658
658
|
} else if (a.kind === "email")
|
|
659
|
-
|
|
659
|
+
yt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
660
660
|
validation: "email",
|
|
661
|
-
code:
|
|
661
|
+
code: d.invalid_string,
|
|
662
662
|
message: a.message
|
|
663
663
|
}), n.dirty());
|
|
664
664
|
else if (a.kind === "emoji")
|
|
665
|
-
|
|
665
|
+
Ie || (Ie = new RegExp(gt, "u")), Ie.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
666
666
|
validation: "emoji",
|
|
667
|
-
code:
|
|
667
|
+
code: d.invalid_string,
|
|
668
668
|
message: a.message
|
|
669
669
|
}), n.dirty());
|
|
670
670
|
else if (a.kind === "uuid")
|
|
671
|
-
|
|
671
|
+
ft.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
672
672
|
validation: "uuid",
|
|
673
|
-
code:
|
|
673
|
+
code: d.invalid_string,
|
|
674
674
|
message: a.message
|
|
675
675
|
}), n.dirty());
|
|
676
676
|
else if (a.kind === "nanoid")
|
|
677
|
-
|
|
677
|
+
ht.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
678
678
|
validation: "nanoid",
|
|
679
|
-
code:
|
|
679
|
+
code: d.invalid_string,
|
|
680
680
|
message: a.message
|
|
681
681
|
}), n.dirty());
|
|
682
682
|
else if (a.kind === "cuid")
|
|
683
|
-
|
|
683
|
+
dt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
684
684
|
validation: "cuid",
|
|
685
|
-
code:
|
|
685
|
+
code: d.invalid_string,
|
|
686
686
|
message: a.message
|
|
687
687
|
}), n.dirty());
|
|
688
688
|
else if (a.kind === "cuid2")
|
|
689
|
-
|
|
689
|
+
ut.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
690
690
|
validation: "cuid2",
|
|
691
|
-
code:
|
|
691
|
+
code: d.invalid_string,
|
|
692
692
|
message: a.message
|
|
693
693
|
}), n.dirty());
|
|
694
694
|
else if (a.kind === "ulid")
|
|
695
|
-
|
|
695
|
+
lt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
696
696
|
validation: "ulid",
|
|
697
|
-
code:
|
|
697
|
+
code: d.invalid_string,
|
|
698
698
|
message: a.message
|
|
699
699
|
}), n.dirty());
|
|
700
700
|
else if (a.kind === "url")
|
|
701
701
|
try {
|
|
702
702
|
new URL(e.data);
|
|
703
703
|
} catch {
|
|
704
|
-
s = this._getOrReturnCtx(e, s),
|
|
704
|
+
s = this._getOrReturnCtx(e, s), f(s, {
|
|
705
705
|
validation: "url",
|
|
706
|
-
code:
|
|
706
|
+
code: d.invalid_string,
|
|
707
707
|
message: a.message
|
|
708
708
|
}), n.dirty();
|
|
709
709
|
}
|
|
710
|
-
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
710
|
+
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
711
711
|
validation: "regex",
|
|
712
|
-
code:
|
|
712
|
+
code: d.invalid_string,
|
|
713
713
|
message: a.message
|
|
714
|
-
}), 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),
|
|
715
|
-
code:
|
|
714
|
+
}), 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), f(s, {
|
|
715
|
+
code: d.invalid_string,
|
|
716
716
|
validation: { includes: a.value, position: a.position },
|
|
717
717
|
message: a.message
|
|
718
|
-
}), 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),
|
|
719
|
-
code:
|
|
718
|
+
}), 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), f(s, {
|
|
719
|
+
code: d.invalid_string,
|
|
720
720
|
validation: { startsWith: a.value },
|
|
721
721
|
message: a.message
|
|
722
|
-
}), n.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (s = this._getOrReturnCtx(e, s),
|
|
723
|
-
code:
|
|
722
|
+
}), n.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
723
|
+
code: d.invalid_string,
|
|
724
724
|
validation: { endsWith: a.value },
|
|
725
725
|
message: a.message
|
|
726
|
-
}), n.dirty()) : a.kind === "datetime" ?
|
|
727
|
-
code:
|
|
726
|
+
}), n.dirty()) : a.kind === "datetime" ? Je(a).test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
727
|
+
code: d.invalid_string,
|
|
728
728
|
validation: "datetime",
|
|
729
729
|
message: a.message
|
|
730
|
-
}), n.dirty()) : a.kind === "date" ?
|
|
731
|
-
code:
|
|
730
|
+
}), n.dirty()) : a.kind === "date" ? Tt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
731
|
+
code: d.invalid_string,
|
|
732
732
|
validation: "date",
|
|
733
733
|
message: a.message
|
|
734
|
-
}), n.dirty()) : a.kind === "time" ?
|
|
735
|
-
code:
|
|
734
|
+
}), n.dirty()) : a.kind === "time" ? Ct(a).test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
735
|
+
code: d.invalid_string,
|
|
736
736
|
validation: "time",
|
|
737
737
|
message: a.message
|
|
738
|
-
}), n.dirty()) : a.kind === "duration" ?
|
|
738
|
+
}), n.dirty()) : a.kind === "duration" ? mt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
739
739
|
validation: "duration",
|
|
740
|
-
code:
|
|
740
|
+
code: d.invalid_string,
|
|
741
741
|
message: a.message
|
|
742
|
-
}), n.dirty()) : a.kind === "ip" ?
|
|
742
|
+
}), n.dirty()) : a.kind === "ip" ? St(e.data, a.version) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
743
743
|
validation: "ip",
|
|
744
|
-
code:
|
|
744
|
+
code: d.invalid_string,
|
|
745
745
|
message: a.message
|
|
746
|
-
}), n.dirty()) : a.kind === "jwt" ?
|
|
746
|
+
}), n.dirty()) : a.kind === "jwt" ? Zt(e.data, a.alg) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
747
747
|
validation: "jwt",
|
|
748
|
-
code:
|
|
748
|
+
code: d.invalid_string,
|
|
749
749
|
message: a.message
|
|
750
|
-
}), n.dirty()) : a.kind === "cidr" ?
|
|
750
|
+
}), n.dirty()) : a.kind === "cidr" ? It(e.data, a.version) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
751
751
|
validation: "cidr",
|
|
752
|
-
code:
|
|
752
|
+
code: d.invalid_string,
|
|
753
753
|
message: a.message
|
|
754
|
-
}), n.dirty()) : a.kind === "base64" ?
|
|
754
|
+
}), n.dirty()) : a.kind === "base64" ? kt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
755
755
|
validation: "base64",
|
|
756
|
-
code:
|
|
756
|
+
code: d.invalid_string,
|
|
757
757
|
message: a.message
|
|
758
|
-
}), n.dirty()) : a.kind === "base64url" ?
|
|
758
|
+
}), n.dirty()) : a.kind === "base64url" ? wt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
759
759
|
validation: "base64url",
|
|
760
|
-
code:
|
|
760
|
+
code: d.invalid_string,
|
|
761
761
|
message: a.message
|
|
762
762
|
}), n.dirty()) : b.assertNever(a);
|
|
763
763
|
return { status: n.value, value: e.data };
|
|
@@ -765,12 +765,12 @@ class C extends _ {
|
|
|
765
765
|
_regex(e, t, n) {
|
|
766
766
|
return this.refinement((s) => e.test(s), {
|
|
767
767
|
validation: t,
|
|
768
|
-
code:
|
|
768
|
+
code: d.invalid_string,
|
|
769
769
|
...m.errToObj(n)
|
|
770
770
|
});
|
|
771
771
|
}
|
|
772
772
|
_addCheck(e) {
|
|
773
|
-
return new
|
|
773
|
+
return new N({
|
|
774
774
|
...this._def,
|
|
775
775
|
checks: [...this._def.checks, e]
|
|
776
776
|
});
|
|
@@ -907,19 +907,19 @@ class C extends _ {
|
|
|
907
907
|
return this.min(1, m.errToObj(e));
|
|
908
908
|
}
|
|
909
909
|
trim() {
|
|
910
|
-
return new
|
|
910
|
+
return new N({
|
|
911
911
|
...this._def,
|
|
912
912
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
913
913
|
});
|
|
914
914
|
}
|
|
915
915
|
toLowerCase() {
|
|
916
|
-
return new
|
|
916
|
+
return new N({
|
|
917
917
|
...this._def,
|
|
918
918
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
919
919
|
});
|
|
920
920
|
}
|
|
921
921
|
toUpperCase() {
|
|
922
|
-
return new
|
|
922
|
+
return new N({
|
|
923
923
|
...this._def,
|
|
924
924
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
925
925
|
});
|
|
@@ -985,60 +985,60 @@ class C extends _ {
|
|
|
985
985
|
return e;
|
|
986
986
|
}
|
|
987
987
|
}
|
|
988
|
-
|
|
988
|
+
N.create = (r) => {
|
|
989
989
|
var e;
|
|
990
|
-
return new
|
|
990
|
+
return new N({
|
|
991
991
|
checks: [],
|
|
992
992
|
typeName: y.ZodString,
|
|
993
993
|
coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
|
|
994
994
|
...v(r)
|
|
995
995
|
});
|
|
996
996
|
};
|
|
997
|
-
function
|
|
998
|
-
const t = (r.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = t > n ? t : n, a = parseInt(r.toFixed(s).replace(".", "")),
|
|
999
|
-
return a %
|
|
997
|
+
function At(r, e) {
|
|
998
|
+
const t = (r.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = t > n ? t : n, a = parseInt(r.toFixed(s).replace(".", "")), c = parseInt(e.toFixed(s).replace(".", ""));
|
|
999
|
+
return a % c / Math.pow(10, s);
|
|
1000
1000
|
}
|
|
1001
|
-
class
|
|
1001
|
+
class M extends _ {
|
|
1002
1002
|
constructor() {
|
|
1003
1003
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1004
1004
|
}
|
|
1005
1005
|
_parse(e) {
|
|
1006
1006
|
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== h.number) {
|
|
1007
1007
|
const a = this._getOrReturnCtx(e);
|
|
1008
|
-
return
|
|
1009
|
-
code:
|
|
1008
|
+
return f(a, {
|
|
1009
|
+
code: d.invalid_type,
|
|
1010
1010
|
expected: h.number,
|
|
1011
1011
|
received: a.parsedType
|
|
1012
1012
|
}), g;
|
|
1013
1013
|
}
|
|
1014
1014
|
let n;
|
|
1015
|
-
const s = new
|
|
1015
|
+
const s = new C();
|
|
1016
1016
|
for (const a of this._def.checks)
|
|
1017
|
-
a.kind === "int" ? b.isInteger(e.data) || (n = this._getOrReturnCtx(e, n),
|
|
1018
|
-
code:
|
|
1017
|
+
a.kind === "int" ? b.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), f(n, {
|
|
1018
|
+
code: d.invalid_type,
|
|
1019
1019
|
expected: "integer",
|
|
1020
1020
|
received: "float",
|
|
1021
1021
|
message: a.message
|
|
1022
|
-
}), s.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n),
|
|
1023
|
-
code:
|
|
1022
|
+
}), s.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), f(n, {
|
|
1023
|
+
code: d.too_small,
|
|
1024
1024
|
minimum: a.value,
|
|
1025
1025
|
type: "number",
|
|
1026
1026
|
inclusive: a.inclusive,
|
|
1027
1027
|
exact: !1,
|
|
1028
1028
|
message: a.message
|
|
1029
|
-
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n),
|
|
1030
|
-
code:
|
|
1029
|
+
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), f(n, {
|
|
1030
|
+
code: d.too_big,
|
|
1031
1031
|
maximum: a.value,
|
|
1032
1032
|
type: "number",
|
|
1033
1033
|
inclusive: a.inclusive,
|
|
1034
1034
|
exact: !1,
|
|
1035
1035
|
message: a.message
|
|
1036
|
-
}), s.dirty()) : a.kind === "multipleOf" ?
|
|
1037
|
-
code:
|
|
1036
|
+
}), s.dirty()) : a.kind === "multipleOf" ? At(e.data, a.value) !== 0 && (n = this._getOrReturnCtx(e, n), f(n, {
|
|
1037
|
+
code: d.not_multiple_of,
|
|
1038
1038
|
multipleOf: a.value,
|
|
1039
1039
|
message: a.message
|
|
1040
|
-
}), s.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n),
|
|
1041
|
-
code:
|
|
1040
|
+
}), s.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), f(n, {
|
|
1041
|
+
code: d.not_finite,
|
|
1042
1042
|
message: a.message
|
|
1043
1043
|
}), s.dirty()) : b.assertNever(a);
|
|
1044
1044
|
return { status: s.value, value: e.data };
|
|
@@ -1056,7 +1056,7 @@ class $ extends _ {
|
|
|
1056
1056
|
return this.setLimit("max", e, !1, m.toString(t));
|
|
1057
1057
|
}
|
|
1058
1058
|
setLimit(e, t, n, s) {
|
|
1059
|
-
return new
|
|
1059
|
+
return new M({
|
|
1060
1060
|
...this._def,
|
|
1061
1061
|
checks: [
|
|
1062
1062
|
...this._def.checks,
|
|
@@ -1070,7 +1070,7 @@ class $ extends _ {
|
|
|
1070
1070
|
});
|
|
1071
1071
|
}
|
|
1072
1072
|
_addCheck(e) {
|
|
1073
|
-
return new
|
|
1073
|
+
return new M({
|
|
1074
1074
|
...this._def,
|
|
1075
1075
|
checks: [...this._def.checks, e]
|
|
1076
1076
|
});
|
|
@@ -1164,13 +1164,13 @@ class $ extends _ {
|
|
|
1164
1164
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
1165
1165
|
}
|
|
1166
1166
|
}
|
|
1167
|
-
|
|
1167
|
+
M.create = (r) => new M({
|
|
1168
1168
|
checks: [],
|
|
1169
1169
|
typeName: y.ZodNumber,
|
|
1170
1170
|
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1171
1171
|
...v(r)
|
|
1172
1172
|
});
|
|
1173
|
-
class
|
|
1173
|
+
class L extends _ {
|
|
1174
1174
|
constructor() {
|
|
1175
1175
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1176
1176
|
}
|
|
@@ -1184,22 +1184,22 @@ class M extends _ {
|
|
|
1184
1184
|
if (this._getType(e) !== h.bigint)
|
|
1185
1185
|
return this._getInvalidInput(e);
|
|
1186
1186
|
let n;
|
|
1187
|
-
const s = new
|
|
1187
|
+
const s = new C();
|
|
1188
1188
|
for (const a of this._def.checks)
|
|
1189
|
-
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n),
|
|
1190
|
-
code:
|
|
1189
|
+
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), f(n, {
|
|
1190
|
+
code: d.too_small,
|
|
1191
1191
|
type: "bigint",
|
|
1192
1192
|
minimum: a.value,
|
|
1193
1193
|
inclusive: a.inclusive,
|
|
1194
1194
|
message: a.message
|
|
1195
|
-
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n),
|
|
1196
|
-
code:
|
|
1195
|
+
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), f(n, {
|
|
1196
|
+
code: d.too_big,
|
|
1197
1197
|
type: "bigint",
|
|
1198
1198
|
maximum: a.value,
|
|
1199
1199
|
inclusive: a.inclusive,
|
|
1200
1200
|
message: a.message
|
|
1201
|
-
}), s.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n),
|
|
1202
|
-
code:
|
|
1201
|
+
}), s.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n), f(n, {
|
|
1202
|
+
code: d.not_multiple_of,
|
|
1203
1203
|
multipleOf: a.value,
|
|
1204
1204
|
message: a.message
|
|
1205
1205
|
}), s.dirty()) : b.assertNever(a);
|
|
@@ -1207,8 +1207,8 @@ class M extends _ {
|
|
|
1207
1207
|
}
|
|
1208
1208
|
_getInvalidInput(e) {
|
|
1209
1209
|
const t = this._getOrReturnCtx(e);
|
|
1210
|
-
return
|
|
1211
|
-
code:
|
|
1210
|
+
return f(t, {
|
|
1211
|
+
code: d.invalid_type,
|
|
1212
1212
|
expected: h.bigint,
|
|
1213
1213
|
received: t.parsedType
|
|
1214
1214
|
}), g;
|
|
@@ -1226,7 +1226,7 @@ class M extends _ {
|
|
|
1226
1226
|
return this.setLimit("max", e, !1, m.toString(t));
|
|
1227
1227
|
}
|
|
1228
1228
|
setLimit(e, t, n, s) {
|
|
1229
|
-
return new
|
|
1229
|
+
return new L({
|
|
1230
1230
|
...this._def,
|
|
1231
1231
|
checks: [
|
|
1232
1232
|
...this._def.checks,
|
|
@@ -1240,7 +1240,7 @@ class M extends _ {
|
|
|
1240
1240
|
});
|
|
1241
1241
|
}
|
|
1242
1242
|
_addCheck(e) {
|
|
1243
|
-
return new
|
|
1243
|
+
return new L({
|
|
1244
1244
|
...this._def,
|
|
1245
1245
|
checks: [...this._def.checks, e]
|
|
1246
1246
|
});
|
|
@@ -1297,21 +1297,21 @@ class M extends _ {
|
|
|
1297
1297
|
return e;
|
|
1298
1298
|
}
|
|
1299
1299
|
}
|
|
1300
|
-
|
|
1300
|
+
L.create = (r) => {
|
|
1301
1301
|
var e;
|
|
1302
|
-
return new
|
|
1302
|
+
return new L({
|
|
1303
1303
|
checks: [],
|
|
1304
1304
|
typeName: y.ZodBigInt,
|
|
1305
1305
|
coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
|
|
1306
1306
|
...v(r)
|
|
1307
1307
|
});
|
|
1308
1308
|
};
|
|
1309
|
-
class
|
|
1309
|
+
class se extends _ {
|
|
1310
1310
|
_parse(e) {
|
|
1311
1311
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== h.boolean) {
|
|
1312
1312
|
const n = this._getOrReturnCtx(e);
|
|
1313
|
-
return
|
|
1314
|
-
code:
|
|
1313
|
+
return f(n, {
|
|
1314
|
+
code: d.invalid_type,
|
|
1315
1315
|
expected: h.boolean,
|
|
1316
1316
|
received: n.parsedType
|
|
1317
1317
|
}), g;
|
|
@@ -1319,39 +1319,39 @@ class te extends _ {
|
|
|
1319
1319
|
return S(e.data);
|
|
1320
1320
|
}
|
|
1321
1321
|
}
|
|
1322
|
-
|
|
1322
|
+
se.create = (r) => new se({
|
|
1323
1323
|
typeName: y.ZodBoolean,
|
|
1324
1324
|
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1325
1325
|
...v(r)
|
|
1326
1326
|
});
|
|
1327
|
-
class
|
|
1327
|
+
class q extends _ {
|
|
1328
1328
|
_parse(e) {
|
|
1329
1329
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== h.date) {
|
|
1330
1330
|
const a = this._getOrReturnCtx(e);
|
|
1331
|
-
return
|
|
1332
|
-
code:
|
|
1331
|
+
return f(a, {
|
|
1332
|
+
code: d.invalid_type,
|
|
1333
1333
|
expected: h.date,
|
|
1334
1334
|
received: a.parsedType
|
|
1335
1335
|
}), g;
|
|
1336
1336
|
}
|
|
1337
1337
|
if (isNaN(e.data.getTime())) {
|
|
1338
1338
|
const a = this._getOrReturnCtx(e);
|
|
1339
|
-
return
|
|
1340
|
-
code:
|
|
1339
|
+
return f(a, {
|
|
1340
|
+
code: d.invalid_date
|
|
1341
1341
|
}), g;
|
|
1342
1342
|
}
|
|
1343
|
-
const n = new
|
|
1343
|
+
const n = new C();
|
|
1344
1344
|
let s;
|
|
1345
1345
|
for (const a of this._def.checks)
|
|
1346
|
-
a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s),
|
|
1347
|
-
code:
|
|
1346
|
+
a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s), f(s, {
|
|
1347
|
+
code: d.too_small,
|
|
1348
1348
|
message: a.message,
|
|
1349
1349
|
inclusive: !0,
|
|
1350
1350
|
exact: !1,
|
|
1351
1351
|
minimum: a.value,
|
|
1352
1352
|
type: "date"
|
|
1353
|
-
}), n.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (s = this._getOrReturnCtx(e, s),
|
|
1354
|
-
code:
|
|
1353
|
+
}), n.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (s = this._getOrReturnCtx(e, s), f(s, {
|
|
1354
|
+
code: d.too_big,
|
|
1355
1355
|
message: a.message,
|
|
1356
1356
|
inclusive: !0,
|
|
1357
1357
|
exact: !1,
|
|
@@ -1364,7 +1364,7 @@ class U extends _ {
|
|
|
1364
1364
|
};
|
|
1365
1365
|
}
|
|
1366
1366
|
_addCheck(e) {
|
|
1367
|
-
return new
|
|
1367
|
+
return new q({
|
|
1368
1368
|
...this._def,
|
|
1369
1369
|
checks: [...this._def.checks, e]
|
|
1370
1370
|
});
|
|
@@ -1396,18 +1396,18 @@ class U extends _ {
|
|
|
1396
1396
|
return e != null ? new Date(e) : null;
|
|
1397
1397
|
}
|
|
1398
1398
|
}
|
|
1399
|
-
|
|
1399
|
+
q.create = (r) => new q({
|
|
1400
1400
|
checks: [],
|
|
1401
1401
|
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1402
1402
|
typeName: y.ZodDate,
|
|
1403
1403
|
...v(r)
|
|
1404
1404
|
});
|
|
1405
|
-
class
|
|
1405
|
+
class ke extends _ {
|
|
1406
1406
|
_parse(e) {
|
|
1407
1407
|
if (this._getType(e) !== h.symbol) {
|
|
1408
1408
|
const n = this._getOrReturnCtx(e);
|
|
1409
|
-
return
|
|
1410
|
-
code:
|
|
1409
|
+
return f(n, {
|
|
1410
|
+
code: d.invalid_type,
|
|
1411
1411
|
expected: h.symbol,
|
|
1412
1412
|
received: n.parsedType
|
|
1413
1413
|
}), g;
|
|
@@ -1415,16 +1415,16 @@ class ve extends _ {
|
|
|
1415
1415
|
return S(e.data);
|
|
1416
1416
|
}
|
|
1417
1417
|
}
|
|
1418
|
-
|
|
1418
|
+
ke.create = (r) => new ke({
|
|
1419
1419
|
typeName: y.ZodSymbol,
|
|
1420
1420
|
...v(r)
|
|
1421
1421
|
});
|
|
1422
|
-
class
|
|
1422
|
+
class ae extends _ {
|
|
1423
1423
|
_parse(e) {
|
|
1424
1424
|
if (this._getType(e) !== h.undefined) {
|
|
1425
1425
|
const n = this._getOrReturnCtx(e);
|
|
1426
|
-
return
|
|
1427
|
-
code:
|
|
1426
|
+
return f(n, {
|
|
1427
|
+
code: d.invalid_type,
|
|
1428
1428
|
expected: h.undefined,
|
|
1429
1429
|
received: n.parsedType
|
|
1430
1430
|
}), g;
|
|
@@ -1432,16 +1432,16 @@ class re extends _ {
|
|
|
1432
1432
|
return S(e.data);
|
|
1433
1433
|
}
|
|
1434
1434
|
}
|
|
1435
|
-
|
|
1435
|
+
ae.create = (r) => new ae({
|
|
1436
1436
|
typeName: y.ZodUndefined,
|
|
1437
1437
|
...v(r)
|
|
1438
1438
|
});
|
|
1439
|
-
class
|
|
1439
|
+
class ie extends _ {
|
|
1440
1440
|
_parse(e) {
|
|
1441
1441
|
if (this._getType(e) !== h.null) {
|
|
1442
1442
|
const n = this._getOrReturnCtx(e);
|
|
1443
|
-
return
|
|
1444
|
-
code:
|
|
1443
|
+
return f(n, {
|
|
1444
|
+
code: d.invalid_type,
|
|
1445
1445
|
expected: h.null,
|
|
1446
1446
|
received: n.parsedType
|
|
1447
1447
|
}), g;
|
|
@@ -1449,11 +1449,11 @@ class ne extends _ {
|
|
|
1449
1449
|
return S(e.data);
|
|
1450
1450
|
}
|
|
1451
1451
|
}
|
|
1452
|
-
|
|
1452
|
+
ie.create = (r) => new ie({
|
|
1453
1453
|
typeName: y.ZodNull,
|
|
1454
1454
|
...v(r)
|
|
1455
1455
|
});
|
|
1456
|
-
class
|
|
1456
|
+
class X extends _ {
|
|
1457
1457
|
constructor() {
|
|
1458
1458
|
super(...arguments), this._any = !0;
|
|
1459
1459
|
}
|
|
@@ -1461,11 +1461,11 @@ class H extends _ {
|
|
|
1461
1461
|
return S(e.data);
|
|
1462
1462
|
}
|
|
1463
1463
|
}
|
|
1464
|
-
|
|
1464
|
+
X.create = (r) => new X({
|
|
1465
1465
|
typeName: y.ZodAny,
|
|
1466
1466
|
...v(r)
|
|
1467
1467
|
});
|
|
1468
|
-
class
|
|
1468
|
+
class U extends _ {
|
|
1469
1469
|
constructor() {
|
|
1470
1470
|
super(...arguments), this._unknown = !0;
|
|
1471
1471
|
}
|
|
@@ -1473,30 +1473,30 @@ class L extends _ {
|
|
|
1473
1473
|
return S(e.data);
|
|
1474
1474
|
}
|
|
1475
1475
|
}
|
|
1476
|
-
|
|
1476
|
+
U.create = (r) => new U({
|
|
1477
1477
|
typeName: y.ZodUnknown,
|
|
1478
1478
|
...v(r)
|
|
1479
1479
|
});
|
|
1480
|
-
class
|
|
1480
|
+
class D extends _ {
|
|
1481
1481
|
_parse(e) {
|
|
1482
1482
|
const t = this._getOrReturnCtx(e);
|
|
1483
|
-
return
|
|
1484
|
-
code:
|
|
1483
|
+
return f(t, {
|
|
1484
|
+
code: d.invalid_type,
|
|
1485
1485
|
expected: h.never,
|
|
1486
1486
|
received: t.parsedType
|
|
1487
1487
|
}), g;
|
|
1488
1488
|
}
|
|
1489
1489
|
}
|
|
1490
|
-
|
|
1490
|
+
D.create = (r) => new D({
|
|
1491
1491
|
typeName: y.ZodNever,
|
|
1492
1492
|
...v(r)
|
|
1493
1493
|
});
|
|
1494
|
-
class
|
|
1494
|
+
class we extends _ {
|
|
1495
1495
|
_parse(e) {
|
|
1496
1496
|
if (this._getType(e) !== h.undefined) {
|
|
1497
1497
|
const n = this._getOrReturnCtx(e);
|
|
1498
|
-
return
|
|
1499
|
-
code:
|
|
1498
|
+
return f(n, {
|
|
1499
|
+
code: d.invalid_type,
|
|
1500
1500
|
expected: h.void,
|
|
1501
1501
|
received: n.parsedType
|
|
1502
1502
|
}), g;
|
|
@@ -1504,67 +1504,67 @@ class _e extends _ {
|
|
|
1504
1504
|
return S(e.data);
|
|
1505
1505
|
}
|
|
1506
1506
|
}
|
|
1507
|
-
|
|
1507
|
+
we.create = (r) => new we({
|
|
1508
1508
|
typeName: y.ZodVoid,
|
|
1509
1509
|
...v(r)
|
|
1510
1510
|
});
|
|
1511
|
-
class
|
|
1511
|
+
class O extends _ {
|
|
1512
1512
|
_parse(e) {
|
|
1513
1513
|
const { ctx: t, status: n } = this._processInputParams(e), s = this._def;
|
|
1514
1514
|
if (t.parsedType !== h.array)
|
|
1515
|
-
return
|
|
1516
|
-
code:
|
|
1515
|
+
return f(t, {
|
|
1516
|
+
code: d.invalid_type,
|
|
1517
1517
|
expected: h.array,
|
|
1518
1518
|
received: t.parsedType
|
|
1519
1519
|
}), g;
|
|
1520
1520
|
if (s.exactLength !== null) {
|
|
1521
|
-
const
|
|
1522
|
-
(
|
|
1523
|
-
code:
|
|
1524
|
-
minimum:
|
|
1525
|
-
maximum:
|
|
1521
|
+
const c = t.data.length > s.exactLength.value, i = t.data.length < s.exactLength.value;
|
|
1522
|
+
(c || i) && (f(t, {
|
|
1523
|
+
code: c ? d.too_big : d.too_small,
|
|
1524
|
+
minimum: i ? s.exactLength.value : void 0,
|
|
1525
|
+
maximum: c ? s.exactLength.value : void 0,
|
|
1526
1526
|
type: "array",
|
|
1527
1527
|
inclusive: !0,
|
|
1528
1528
|
exact: !0,
|
|
1529
1529
|
message: s.exactLength.message
|
|
1530
1530
|
}), n.dirty());
|
|
1531
1531
|
}
|
|
1532
|
-
if (s.minLength !== null && t.data.length < s.minLength.value && (
|
|
1533
|
-
code:
|
|
1532
|
+
if (s.minLength !== null && t.data.length < s.minLength.value && (f(t, {
|
|
1533
|
+
code: d.too_small,
|
|
1534
1534
|
minimum: s.minLength.value,
|
|
1535
1535
|
type: "array",
|
|
1536
1536
|
inclusive: !0,
|
|
1537
1537
|
exact: !1,
|
|
1538
1538
|
message: s.minLength.message
|
|
1539
|
-
}), n.dirty()), s.maxLength !== null && t.data.length > s.maxLength.value && (
|
|
1540
|
-
code:
|
|
1539
|
+
}), n.dirty()), s.maxLength !== null && t.data.length > s.maxLength.value && (f(t, {
|
|
1540
|
+
code: d.too_big,
|
|
1541
1541
|
maximum: s.maxLength.value,
|
|
1542
1542
|
type: "array",
|
|
1543
1543
|
inclusive: !0,
|
|
1544
1544
|
exact: !1,
|
|
1545
1545
|
message: s.maxLength.message
|
|
1546
1546
|
}), n.dirty()), t.common.async)
|
|
1547
|
-
return Promise.all([...t.data].map((
|
|
1548
|
-
const a = [...t.data].map((
|
|
1549
|
-
return
|
|
1547
|
+
return Promise.all([...t.data].map((c, i) => s.type._parseAsync(new R(t, c, t.path, i)))).then((c) => C.mergeArray(n, c));
|
|
1548
|
+
const a = [...t.data].map((c, i) => s.type._parseSync(new R(t, c, t.path, i)));
|
|
1549
|
+
return C.mergeArray(n, a);
|
|
1550
1550
|
}
|
|
1551
1551
|
get element() {
|
|
1552
1552
|
return this._def.type;
|
|
1553
1553
|
}
|
|
1554
1554
|
min(e, t) {
|
|
1555
|
-
return new
|
|
1555
|
+
return new O({
|
|
1556
1556
|
...this._def,
|
|
1557
1557
|
minLength: { value: e, message: m.toString(t) }
|
|
1558
1558
|
});
|
|
1559
1559
|
}
|
|
1560
1560
|
max(e, t) {
|
|
1561
|
-
return new
|
|
1561
|
+
return new O({
|
|
1562
1562
|
...this._def,
|
|
1563
1563
|
maxLength: { value: e, message: m.toString(t) }
|
|
1564
1564
|
});
|
|
1565
1565
|
}
|
|
1566
1566
|
length(e, t) {
|
|
1567
|
-
return new
|
|
1567
|
+
return new O({
|
|
1568
1568
|
...this._def,
|
|
1569
1569
|
exactLength: { value: e, message: m.toString(t) }
|
|
1570
1570
|
});
|
|
@@ -1573,7 +1573,7 @@ class I extends _ {
|
|
|
1573
1573
|
return this.min(1, e);
|
|
1574
1574
|
}
|
|
1575
1575
|
}
|
|
1576
|
-
|
|
1576
|
+
O.create = (r, e) => new O({
|
|
1577
1577
|
type: r,
|
|
1578
1578
|
minLength: null,
|
|
1579
1579
|
maxLength: null,
|
|
@@ -1581,23 +1581,23 @@ I.create = (r, e) => new I({
|
|
|
1581
1581
|
typeName: y.ZodArray,
|
|
1582
1582
|
...v(e)
|
|
1583
1583
|
});
|
|
1584
|
-
function
|
|
1585
|
-
if (r instanceof
|
|
1584
|
+
function J(r) {
|
|
1585
|
+
if (r instanceof k) {
|
|
1586
1586
|
const e = {};
|
|
1587
1587
|
for (const t in r.shape) {
|
|
1588
1588
|
const n = r.shape[t];
|
|
1589
|
-
e[t] =
|
|
1589
|
+
e[t] = E.create(J(n));
|
|
1590
1590
|
}
|
|
1591
|
-
return new
|
|
1591
|
+
return new k({
|
|
1592
1592
|
...r._def,
|
|
1593
1593
|
shape: () => e
|
|
1594
1594
|
});
|
|
1595
|
-
} else return r instanceof
|
|
1595
|
+
} else return r instanceof O ? new O({
|
|
1596
1596
|
...r._def,
|
|
1597
|
-
type:
|
|
1598
|
-
}) : r instanceof
|
|
1597
|
+
type: J(r.element)
|
|
1598
|
+
}) : r instanceof E ? E.create(J(r.unwrap())) : r instanceof F ? F.create(J(r.unwrap())) : r instanceof P ? P.create(r.items.map((e) => J(e))) : r;
|
|
1599
1599
|
}
|
|
1600
|
-
class
|
|
1600
|
+
class k extends _ {
|
|
1601
1601
|
constructor() {
|
|
1602
1602
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
1603
1603
|
}
|
|
@@ -1610,47 +1610,47 @@ class x extends _ {
|
|
|
1610
1610
|
_parse(e) {
|
|
1611
1611
|
if (this._getType(e) !== h.object) {
|
|
1612
1612
|
const u = this._getOrReturnCtx(e);
|
|
1613
|
-
return
|
|
1614
|
-
code:
|
|
1613
|
+
return f(u, {
|
|
1614
|
+
code: d.invalid_type,
|
|
1615
1615
|
expected: h.object,
|
|
1616
1616
|
received: u.parsedType
|
|
1617
1617
|
}), g;
|
|
1618
1618
|
}
|
|
1619
|
-
const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys:
|
|
1620
|
-
if (!(this._def.catchall instanceof
|
|
1619
|
+
const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys: c } = this._getCached(), i = [];
|
|
1620
|
+
if (!(this._def.catchall instanceof D && this._def.unknownKeys === "strip"))
|
|
1621
1621
|
for (const u in s.data)
|
|
1622
|
-
|
|
1623
|
-
const
|
|
1624
|
-
for (const u of
|
|
1625
|
-
const p = a[u],
|
|
1626
|
-
|
|
1622
|
+
c.includes(u) || i.push(u);
|
|
1623
|
+
const l = [];
|
|
1624
|
+
for (const u of c) {
|
|
1625
|
+
const p = a[u], x = s.data[u];
|
|
1626
|
+
l.push({
|
|
1627
1627
|
key: { status: "valid", value: u },
|
|
1628
|
-
value: p._parse(new
|
|
1628
|
+
value: p._parse(new R(s, x, s.path, u)),
|
|
1629
1629
|
alwaysSet: u in s.data
|
|
1630
1630
|
});
|
|
1631
1631
|
}
|
|
1632
|
-
if (this._def.catchall instanceof
|
|
1632
|
+
if (this._def.catchall instanceof D) {
|
|
1633
1633
|
const u = this._def.unknownKeys;
|
|
1634
1634
|
if (u === "passthrough")
|
|
1635
|
-
for (const p of
|
|
1636
|
-
|
|
1635
|
+
for (const p of i)
|
|
1636
|
+
l.push({
|
|
1637
1637
|
key: { status: "valid", value: p },
|
|
1638
1638
|
value: { status: "valid", value: s.data[p] }
|
|
1639
1639
|
});
|
|
1640
1640
|
else if (u === "strict")
|
|
1641
|
-
|
|
1642
|
-
code:
|
|
1643
|
-
keys:
|
|
1641
|
+
i.length > 0 && (f(s, {
|
|
1642
|
+
code: d.unrecognized_keys,
|
|
1643
|
+
keys: i
|
|
1644
1644
|
}), n.dirty());
|
|
1645
1645
|
else if (u !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
1646
1646
|
} else {
|
|
1647
1647
|
const u = this._def.catchall;
|
|
1648
|
-
for (const p of
|
|
1649
|
-
const
|
|
1650
|
-
|
|
1648
|
+
for (const p of i) {
|
|
1649
|
+
const x = s.data[p];
|
|
1650
|
+
l.push({
|
|
1651
1651
|
key: { status: "valid", value: p },
|
|
1652
1652
|
value: u._parse(
|
|
1653
|
-
new
|
|
1653
|
+
new R(s, x, s.path, p)
|
|
1654
1654
|
//, ctx.child(key), value, getParsedType(value)
|
|
1655
1655
|
),
|
|
1656
1656
|
alwaysSet: p in s.data
|
|
@@ -1659,45 +1659,45 @@ class x extends _ {
|
|
|
1659
1659
|
}
|
|
1660
1660
|
return s.common.async ? Promise.resolve().then(async () => {
|
|
1661
1661
|
const u = [];
|
|
1662
|
-
for (const p of
|
|
1663
|
-
const
|
|
1662
|
+
for (const p of l) {
|
|
1663
|
+
const x = await p.key, I = await p.value;
|
|
1664
1664
|
u.push({
|
|
1665
|
-
key:
|
|
1666
|
-
value:
|
|
1665
|
+
key: x,
|
|
1666
|
+
value: I,
|
|
1667
1667
|
alwaysSet: p.alwaysSet
|
|
1668
1668
|
});
|
|
1669
1669
|
}
|
|
1670
1670
|
return u;
|
|
1671
|
-
}).then((u) =>
|
|
1671
|
+
}).then((u) => C.mergeObjectSync(n, u)) : C.mergeObjectSync(n, l);
|
|
1672
1672
|
}
|
|
1673
1673
|
get shape() {
|
|
1674
1674
|
return this._def.shape();
|
|
1675
1675
|
}
|
|
1676
1676
|
strict(e) {
|
|
1677
|
-
return m.errToObj, new
|
|
1677
|
+
return m.errToObj, new k({
|
|
1678
1678
|
...this._def,
|
|
1679
1679
|
unknownKeys: "strict",
|
|
1680
1680
|
...e !== void 0 ? {
|
|
1681
1681
|
errorMap: (t, n) => {
|
|
1682
|
-
var s, a,
|
|
1683
|
-
const
|
|
1682
|
+
var s, a, c, i;
|
|
1683
|
+
const l = (c = (a = (s = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(s, t, n).message) !== null && c !== void 0 ? c : n.defaultError;
|
|
1684
1684
|
return t.code === "unrecognized_keys" ? {
|
|
1685
|
-
message: (
|
|
1685
|
+
message: (i = m.errToObj(e).message) !== null && i !== void 0 ? i : l
|
|
1686
1686
|
} : {
|
|
1687
|
-
message:
|
|
1687
|
+
message: l
|
|
1688
1688
|
};
|
|
1689
1689
|
}
|
|
1690
1690
|
} : {}
|
|
1691
1691
|
});
|
|
1692
1692
|
}
|
|
1693
1693
|
strip() {
|
|
1694
|
-
return new
|
|
1694
|
+
return new k({
|
|
1695
1695
|
...this._def,
|
|
1696
1696
|
unknownKeys: "strip"
|
|
1697
1697
|
});
|
|
1698
1698
|
}
|
|
1699
1699
|
passthrough() {
|
|
1700
|
-
return new
|
|
1700
|
+
return new k({
|
|
1701
1701
|
...this._def,
|
|
1702
1702
|
unknownKeys: "passthrough"
|
|
1703
1703
|
});
|
|
@@ -1720,7 +1720,7 @@ class x extends _ {
|
|
|
1720
1720
|
// }) as any;
|
|
1721
1721
|
// };
|
|
1722
1722
|
extend(e) {
|
|
1723
|
-
return new
|
|
1723
|
+
return new k({
|
|
1724
1724
|
...this._def,
|
|
1725
1725
|
shape: () => ({
|
|
1726
1726
|
...this._def.shape(),
|
|
@@ -1734,7 +1734,7 @@ class x extends _ {
|
|
|
1734
1734
|
* upgrade if you are experiencing issues.
|
|
1735
1735
|
*/
|
|
1736
1736
|
merge(e) {
|
|
1737
|
-
return new
|
|
1737
|
+
return new k({
|
|
1738
1738
|
unknownKeys: e._def.unknownKeys,
|
|
1739
1739
|
catchall: e._def.catchall,
|
|
1740
1740
|
shape: () => ({
|
|
@@ -1804,7 +1804,7 @@ class x extends _ {
|
|
|
1804
1804
|
// return merged;
|
|
1805
1805
|
// }
|
|
1806
1806
|
catchall(e) {
|
|
1807
|
-
return new
|
|
1807
|
+
return new k({
|
|
1808
1808
|
...this._def,
|
|
1809
1809
|
catchall: e
|
|
1810
1810
|
});
|
|
@@ -1813,7 +1813,7 @@ class x extends _ {
|
|
|
1813
1813
|
const t = {};
|
|
1814
1814
|
return b.objectKeys(e).forEach((n) => {
|
|
1815
1815
|
e[n] && this.shape[n] && (t[n] = this.shape[n]);
|
|
1816
|
-
}), new
|
|
1816
|
+
}), new k({
|
|
1817
1817
|
...this._def,
|
|
1818
1818
|
shape: () => t
|
|
1819
1819
|
});
|
|
@@ -1822,7 +1822,7 @@ class x extends _ {
|
|
|
1822
1822
|
const t = {};
|
|
1823
1823
|
return b.objectKeys(this.shape).forEach((n) => {
|
|
1824
1824
|
e[n] || (t[n] = this.shape[n]);
|
|
1825
|
-
}), new
|
|
1825
|
+
}), new k({
|
|
1826
1826
|
...this._def,
|
|
1827
1827
|
shape: () => t
|
|
1828
1828
|
});
|
|
@@ -1831,14 +1831,14 @@ class x extends _ {
|
|
|
1831
1831
|
* @deprecated
|
|
1832
1832
|
*/
|
|
1833
1833
|
deepPartial() {
|
|
1834
|
-
return
|
|
1834
|
+
return J(this);
|
|
1835
1835
|
}
|
|
1836
1836
|
partial(e) {
|
|
1837
1837
|
const t = {};
|
|
1838
1838
|
return b.objectKeys(this.shape).forEach((n) => {
|
|
1839
1839
|
const s = this.shape[n];
|
|
1840
1840
|
e && !e[n] ? t[n] = s : t[n] = s.optional();
|
|
1841
|
-
}), new
|
|
1841
|
+
}), new k({
|
|
1842
1842
|
...this._def,
|
|
1843
1843
|
shape: () => t
|
|
1844
1844
|
});
|
|
@@ -1850,59 +1850,59 @@ class x extends _ {
|
|
|
1850
1850
|
t[n] = this.shape[n];
|
|
1851
1851
|
else {
|
|
1852
1852
|
let a = this.shape[n];
|
|
1853
|
-
for (; a instanceof
|
|
1853
|
+
for (; a instanceof E; )
|
|
1854
1854
|
a = a._def.innerType;
|
|
1855
1855
|
t[n] = a;
|
|
1856
1856
|
}
|
|
1857
|
-
}), new
|
|
1857
|
+
}), new k({
|
|
1858
1858
|
...this._def,
|
|
1859
1859
|
shape: () => t
|
|
1860
1860
|
});
|
|
1861
1861
|
}
|
|
1862
1862
|
keyof() {
|
|
1863
|
-
return
|
|
1863
|
+
return Qe(b.objectKeys(this.shape));
|
|
1864
1864
|
}
|
|
1865
1865
|
}
|
|
1866
|
-
|
|
1866
|
+
k.create = (r, e) => new k({
|
|
1867
1867
|
shape: () => r,
|
|
1868
1868
|
unknownKeys: "strip",
|
|
1869
|
-
catchall:
|
|
1869
|
+
catchall: D.create(),
|
|
1870
1870
|
typeName: y.ZodObject,
|
|
1871
1871
|
...v(e)
|
|
1872
1872
|
});
|
|
1873
|
-
|
|
1873
|
+
k.strictCreate = (r, e) => new k({
|
|
1874
1874
|
shape: () => r,
|
|
1875
1875
|
unknownKeys: "strict",
|
|
1876
|
-
catchall:
|
|
1876
|
+
catchall: D.create(),
|
|
1877
1877
|
typeName: y.ZodObject,
|
|
1878
1878
|
...v(e)
|
|
1879
1879
|
});
|
|
1880
|
-
|
|
1880
|
+
k.lazycreate = (r, e) => new k({
|
|
1881
1881
|
shape: r,
|
|
1882
1882
|
unknownKeys: "strip",
|
|
1883
|
-
catchall:
|
|
1883
|
+
catchall: D.create(),
|
|
1884
1884
|
typeName: y.ZodObject,
|
|
1885
1885
|
...v(e)
|
|
1886
1886
|
});
|
|
1887
|
-
class
|
|
1887
|
+
class oe extends _ {
|
|
1888
1888
|
_parse(e) {
|
|
1889
1889
|
const { ctx: t } = this._processInputParams(e), n = this._def.options;
|
|
1890
1890
|
function s(a) {
|
|
1891
|
-
for (const
|
|
1892
|
-
if (
|
|
1893
|
-
return
|
|
1894
|
-
for (const
|
|
1895
|
-
if (
|
|
1896
|
-
return t.common.issues.push(...
|
|
1897
|
-
const
|
|
1898
|
-
return
|
|
1899
|
-
code:
|
|
1900
|
-
unionErrors:
|
|
1891
|
+
for (const i of a)
|
|
1892
|
+
if (i.result.status === "valid")
|
|
1893
|
+
return i.result;
|
|
1894
|
+
for (const i of a)
|
|
1895
|
+
if (i.result.status === "dirty")
|
|
1896
|
+
return t.common.issues.push(...i.ctx.common.issues), i.result;
|
|
1897
|
+
const c = a.map((i) => new Z(i.ctx.common.issues));
|
|
1898
|
+
return f(t, {
|
|
1899
|
+
code: d.invalid_union,
|
|
1900
|
+
unionErrors: c
|
|
1901
1901
|
}), g;
|
|
1902
1902
|
}
|
|
1903
1903
|
if (t.common.async)
|
|
1904
1904
|
return Promise.all(n.map(async (a) => {
|
|
1905
|
-
const
|
|
1905
|
+
const c = {
|
|
1906
1906
|
...t,
|
|
1907
1907
|
common: {
|
|
1908
1908
|
...t.common,
|
|
@@ -1914,15 +1914,15 @@ class se extends _ {
|
|
|
1914
1914
|
result: await a._parseAsync({
|
|
1915
1915
|
data: t.data,
|
|
1916
1916
|
path: t.path,
|
|
1917
|
-
parent:
|
|
1917
|
+
parent: c
|
|
1918
1918
|
}),
|
|
1919
|
-
ctx:
|
|
1919
|
+
ctx: c
|
|
1920
1920
|
};
|
|
1921
1921
|
})).then(s);
|
|
1922
1922
|
{
|
|
1923
1923
|
let a;
|
|
1924
|
-
const
|
|
1925
|
-
for (const
|
|
1924
|
+
const c = [];
|
|
1925
|
+
for (const l of n) {
|
|
1926
1926
|
const u = {
|
|
1927
1927
|
...t,
|
|
1928
1928
|
common: {
|
|
@@ -1930,21 +1930,21 @@ class se extends _ {
|
|
|
1930
1930
|
issues: []
|
|
1931
1931
|
},
|
|
1932
1932
|
parent: null
|
|
1933
|
-
}, p =
|
|
1933
|
+
}, p = l._parseSync({
|
|
1934
1934
|
data: t.data,
|
|
1935
1935
|
path: t.path,
|
|
1936
1936
|
parent: u
|
|
1937
1937
|
});
|
|
1938
1938
|
if (p.status === "valid")
|
|
1939
1939
|
return p;
|
|
1940
|
-
p.status === "dirty" && !a && (a = { result: p, ctx: u }), u.common.issues.length &&
|
|
1940
|
+
p.status === "dirty" && !a && (a = { result: p, ctx: u }), u.common.issues.length && c.push(u.common.issues);
|
|
1941
1941
|
}
|
|
1942
1942
|
if (a)
|
|
1943
1943
|
return t.common.issues.push(...a.ctx.common.issues), a.result;
|
|
1944
|
-
const
|
|
1945
|
-
return
|
|
1946
|
-
code:
|
|
1947
|
-
unionErrors:
|
|
1944
|
+
const i = c.map((l) => new Z(l));
|
|
1945
|
+
return f(t, {
|
|
1946
|
+
code: d.invalid_union,
|
|
1947
|
+
unionErrors: i
|
|
1948
1948
|
}), g;
|
|
1949
1949
|
}
|
|
1950
1950
|
}
|
|
@@ -1952,18 +1952,18 @@ class se extends _ {
|
|
|
1952
1952
|
return this._def.options;
|
|
1953
1953
|
}
|
|
1954
1954
|
}
|
|
1955
|
-
|
|
1955
|
+
oe.create = (r, e) => new oe({
|
|
1956
1956
|
options: r,
|
|
1957
1957
|
typeName: y.ZodUnion,
|
|
1958
1958
|
...v(e)
|
|
1959
1959
|
});
|
|
1960
|
-
const
|
|
1961
|
-
class
|
|
1960
|
+
const $ = (r) => r instanceof ue ? $(r.schema) : r instanceof j ? $(r.innerType()) : r instanceof le ? [r.value] : r instanceof z ? r.options : r instanceof fe ? b.objectValues(r.enum) : r instanceof he ? $(r._def.innerType) : r instanceof ae ? [void 0] : r instanceof ie ? [null] : r instanceof E ? [void 0, ...$(r.unwrap())] : r instanceof F ? [null, ...$(r.unwrap())] : r instanceof Re || r instanceof me ? $(r.unwrap()) : r instanceof pe ? $(r._def.innerType) : [];
|
|
1961
|
+
class Se extends _ {
|
|
1962
1962
|
_parse(e) {
|
|
1963
1963
|
const { ctx: t } = this._processInputParams(e);
|
|
1964
1964
|
if (t.parsedType !== h.object)
|
|
1965
|
-
return
|
|
1966
|
-
code:
|
|
1965
|
+
return f(t, {
|
|
1966
|
+
code: d.invalid_type,
|
|
1967
1967
|
expected: h.object,
|
|
1968
1968
|
received: t.parsedType
|
|
1969
1969
|
}), g;
|
|
@@ -1976,8 +1976,8 @@ class ke extends _ {
|
|
|
1976
1976
|
data: t.data,
|
|
1977
1977
|
path: t.path,
|
|
1978
1978
|
parent: t
|
|
1979
|
-
}) : (
|
|
1980
|
-
code:
|
|
1979
|
+
}) : (f(t, {
|
|
1980
|
+
code: d.invalid_union_discriminator,
|
|
1981
1981
|
options: Array.from(this.optionsMap.keys()),
|
|
1982
1982
|
path: [n]
|
|
1983
1983
|
}), g);
|
|
@@ -2002,16 +2002,16 @@ class ke extends _ {
|
|
|
2002
2002
|
static create(e, t, n) {
|
|
2003
2003
|
const s = /* @__PURE__ */ new Map();
|
|
2004
2004
|
for (const a of t) {
|
|
2005
|
-
const
|
|
2006
|
-
if (!
|
|
2005
|
+
const c = $(a.shape[e]);
|
|
2006
|
+
if (!c.length)
|
|
2007
2007
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
2008
|
-
for (const
|
|
2009
|
-
if (s.has(
|
|
2010
|
-
throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(
|
|
2011
|
-
s.set(
|
|
2008
|
+
for (const i of c) {
|
|
2009
|
+
if (s.has(i))
|
|
2010
|
+
throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);
|
|
2011
|
+
s.set(i, a);
|
|
2012
2012
|
}
|
|
2013
2013
|
}
|
|
2014
|
-
return new
|
|
2014
|
+
return new Se({
|
|
2015
2015
|
typeName: y.ZodDiscriminatedUnion,
|
|
2016
2016
|
discriminator: e,
|
|
2017
2017
|
options: t,
|
|
@@ -2020,40 +2020,40 @@ class ke extends _ {
|
|
|
2020
2020
|
});
|
|
2021
2021
|
}
|
|
2022
2022
|
}
|
|
2023
|
-
function
|
|
2024
|
-
const t =
|
|
2023
|
+
function Ee(r, e) {
|
|
2024
|
+
const t = V(r), n = V(e);
|
|
2025
2025
|
if (r === e)
|
|
2026
2026
|
return { valid: !0, data: r };
|
|
2027
2027
|
if (t === h.object && n === h.object) {
|
|
2028
|
-
const s = b.objectKeys(e), a = b.objectKeys(r).filter((
|
|
2029
|
-
for (const
|
|
2030
|
-
const
|
|
2031
|
-
if (!
|
|
2028
|
+
const s = b.objectKeys(e), a = b.objectKeys(r).filter((i) => s.indexOf(i) !== -1), c = { ...r, ...e };
|
|
2029
|
+
for (const i of a) {
|
|
2030
|
+
const l = Ee(r[i], e[i]);
|
|
2031
|
+
if (!l.valid)
|
|
2032
2032
|
return { valid: !1 };
|
|
2033
|
-
|
|
2033
|
+
c[i] = l.data;
|
|
2034
2034
|
}
|
|
2035
|
-
return { valid: !0, data:
|
|
2035
|
+
return { valid: !0, data: c };
|
|
2036
2036
|
} else if (t === h.array && n === h.array) {
|
|
2037
2037
|
if (r.length !== e.length)
|
|
2038
2038
|
return { valid: !1 };
|
|
2039
2039
|
const s = [];
|
|
2040
2040
|
for (let a = 0; a < r.length; a++) {
|
|
2041
|
-
const
|
|
2042
|
-
if (!
|
|
2041
|
+
const c = r[a], i = e[a], l = Ee(c, i);
|
|
2042
|
+
if (!l.valid)
|
|
2043
2043
|
return { valid: !1 };
|
|
2044
|
-
s.push(
|
|
2044
|
+
s.push(l.data);
|
|
2045
2045
|
}
|
|
2046
2046
|
return { valid: !0, data: s };
|
|
2047
2047
|
} else return t === h.date && n === h.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
|
|
2048
2048
|
}
|
|
2049
|
-
class
|
|
2049
|
+
class ce extends _ {
|
|
2050
2050
|
_parse(e) {
|
|
2051
|
-
const { status: t, ctx: n } = this._processInputParams(e), s = (a,
|
|
2052
|
-
if (
|
|
2051
|
+
const { status: t, ctx: n } = this._processInputParams(e), s = (a, c) => {
|
|
2052
|
+
if (Oe(a) || Oe(c))
|
|
2053
2053
|
return g;
|
|
2054
|
-
const
|
|
2055
|
-
return
|
|
2056
|
-
code:
|
|
2054
|
+
const i = Ee(a.value, c.value);
|
|
2055
|
+
return i.valid ? ((je(a) || je(c)) && t.dirty(), { status: t.value, value: i.data }) : (f(n, {
|
|
2056
|
+
code: d.invalid_intersection_types
|
|
2057
2057
|
}), g);
|
|
2058
2058
|
};
|
|
2059
2059
|
return n.common.async ? Promise.all([
|
|
@@ -2067,7 +2067,7 @@ class ae extends _ {
|
|
|
2067
2067
|
path: n.path,
|
|
2068
2068
|
parent: n
|
|
2069
2069
|
})
|
|
2070
|
-
]).then(([a,
|
|
2070
|
+
]).then(([a, c]) => s(a, c)) : s(this._def.left._parseSync({
|
|
2071
2071
|
data: n.data,
|
|
2072
2072
|
path: n.path,
|
|
2073
2073
|
parent: n
|
|
@@ -2078,63 +2078,63 @@ class ae extends _ {
|
|
|
2078
2078
|
}));
|
|
2079
2079
|
}
|
|
2080
2080
|
}
|
|
2081
|
-
|
|
2081
|
+
ce.create = (r, e, t) => new ce({
|
|
2082
2082
|
left: r,
|
|
2083
2083
|
right: e,
|
|
2084
2084
|
typeName: y.ZodIntersection,
|
|
2085
2085
|
...v(t)
|
|
2086
2086
|
});
|
|
2087
|
-
class
|
|
2087
|
+
class P extends _ {
|
|
2088
2088
|
_parse(e) {
|
|
2089
2089
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2090
2090
|
if (n.parsedType !== h.array)
|
|
2091
|
-
return
|
|
2092
|
-
code:
|
|
2091
|
+
return f(n, {
|
|
2092
|
+
code: d.invalid_type,
|
|
2093
2093
|
expected: h.array,
|
|
2094
2094
|
received: n.parsedType
|
|
2095
2095
|
}), g;
|
|
2096
2096
|
if (n.data.length < this._def.items.length)
|
|
2097
|
-
return
|
|
2098
|
-
code:
|
|
2097
|
+
return f(n, {
|
|
2098
|
+
code: d.too_small,
|
|
2099
2099
|
minimum: this._def.items.length,
|
|
2100
2100
|
inclusive: !0,
|
|
2101
2101
|
exact: !1,
|
|
2102
2102
|
type: "array"
|
|
2103
2103
|
}), g;
|
|
2104
|
-
!this._def.rest && n.data.length > this._def.items.length && (
|
|
2105
|
-
code:
|
|
2104
|
+
!this._def.rest && n.data.length > this._def.items.length && (f(n, {
|
|
2105
|
+
code: d.too_big,
|
|
2106
2106
|
maximum: this._def.items.length,
|
|
2107
2107
|
inclusive: !0,
|
|
2108
2108
|
exact: !1,
|
|
2109
2109
|
type: "array"
|
|
2110
2110
|
}), t.dirty());
|
|
2111
|
-
const a = [...n.data].map((
|
|
2112
|
-
const
|
|
2113
|
-
return
|
|
2114
|
-
}).filter((
|
|
2115
|
-
return n.common.async ? Promise.all(a).then((
|
|
2111
|
+
const a = [...n.data].map((c, i) => {
|
|
2112
|
+
const l = this._def.items[i] || this._def.rest;
|
|
2113
|
+
return l ? l._parse(new R(n, c, n.path, i)) : null;
|
|
2114
|
+
}).filter((c) => !!c);
|
|
2115
|
+
return n.common.async ? Promise.all(a).then((c) => C.mergeArray(t, c)) : C.mergeArray(t, a);
|
|
2116
2116
|
}
|
|
2117
2117
|
get items() {
|
|
2118
2118
|
return this._def.items;
|
|
2119
2119
|
}
|
|
2120
2120
|
rest(e) {
|
|
2121
|
-
return new
|
|
2121
|
+
return new P({
|
|
2122
2122
|
...this._def,
|
|
2123
2123
|
rest: e
|
|
2124
2124
|
});
|
|
2125
2125
|
}
|
|
2126
2126
|
}
|
|
2127
|
-
|
|
2127
|
+
P.create = (r, e) => {
|
|
2128
2128
|
if (!Array.isArray(r))
|
|
2129
2129
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2130
|
-
return new
|
|
2130
|
+
return new P({
|
|
2131
2131
|
items: r,
|
|
2132
2132
|
typeName: y.ZodTuple,
|
|
2133
2133
|
rest: null,
|
|
2134
2134
|
...v(e)
|
|
2135
2135
|
});
|
|
2136
2136
|
};
|
|
2137
|
-
class
|
|
2137
|
+
class de extends _ {
|
|
2138
2138
|
get keySchema() {
|
|
2139
2139
|
return this._def.keyType;
|
|
2140
2140
|
}
|
|
@@ -2144,38 +2144,38 @@ class ie extends _ {
|
|
|
2144
2144
|
_parse(e) {
|
|
2145
2145
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2146
2146
|
if (n.parsedType !== h.object)
|
|
2147
|
-
return
|
|
2148
|
-
code:
|
|
2147
|
+
return f(n, {
|
|
2148
|
+
code: d.invalid_type,
|
|
2149
2149
|
expected: h.object,
|
|
2150
2150
|
received: n.parsedType
|
|
2151
2151
|
}), g;
|
|
2152
|
-
const s = [], a = this._def.keyType,
|
|
2153
|
-
for (const
|
|
2152
|
+
const s = [], a = this._def.keyType, c = this._def.valueType;
|
|
2153
|
+
for (const i in n.data)
|
|
2154
2154
|
s.push({
|
|
2155
|
-
key: a._parse(new
|
|
2156
|
-
value:
|
|
2157
|
-
alwaysSet:
|
|
2155
|
+
key: a._parse(new R(n, i, n.path, i)),
|
|
2156
|
+
value: c._parse(new R(n, n.data[i], n.path, i)),
|
|
2157
|
+
alwaysSet: i in n.data
|
|
2158
2158
|
});
|
|
2159
|
-
return n.common.async ?
|
|
2159
|
+
return n.common.async ? C.mergeObjectAsync(t, s) : C.mergeObjectSync(t, s);
|
|
2160
2160
|
}
|
|
2161
2161
|
get element() {
|
|
2162
2162
|
return this._def.valueType;
|
|
2163
2163
|
}
|
|
2164
2164
|
static create(e, t, n) {
|
|
2165
|
-
return t instanceof _ ? new
|
|
2165
|
+
return t instanceof _ ? new de({
|
|
2166
2166
|
keyType: e,
|
|
2167
2167
|
valueType: t,
|
|
2168
2168
|
typeName: y.ZodRecord,
|
|
2169
2169
|
...v(n)
|
|
2170
|
-
}) : new
|
|
2171
|
-
keyType:
|
|
2170
|
+
}) : new de({
|
|
2171
|
+
keyType: N.create(),
|
|
2172
2172
|
valueType: e,
|
|
2173
2173
|
typeName: y.ZodRecord,
|
|
2174
2174
|
...v(t)
|
|
2175
2175
|
});
|
|
2176
2176
|
}
|
|
2177
2177
|
}
|
|
2178
|
-
class
|
|
2178
|
+
class Te extends _ {
|
|
2179
2179
|
get keySchema() {
|
|
2180
2180
|
return this._def.keyType;
|
|
2181
2181
|
}
|
|
@@ -2185,63 +2185,63 @@ class be extends _ {
|
|
|
2185
2185
|
_parse(e) {
|
|
2186
2186
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2187
2187
|
if (n.parsedType !== h.map)
|
|
2188
|
-
return
|
|
2189
|
-
code:
|
|
2188
|
+
return f(n, {
|
|
2189
|
+
code: d.invalid_type,
|
|
2190
2190
|
expected: h.map,
|
|
2191
2191
|
received: n.parsedType
|
|
2192
2192
|
}), g;
|
|
2193
|
-
const s = this._def.keyType, a = this._def.valueType,
|
|
2194
|
-
key: s._parse(new
|
|
2195
|
-
value: a._parse(new
|
|
2193
|
+
const s = this._def.keyType, a = this._def.valueType, c = [...n.data.entries()].map(([i, l], u) => ({
|
|
2194
|
+
key: s._parse(new R(n, i, n.path, [u, "key"])),
|
|
2195
|
+
value: a._parse(new R(n, l, n.path, [u, "value"]))
|
|
2196
2196
|
}));
|
|
2197
2197
|
if (n.common.async) {
|
|
2198
|
-
const
|
|
2198
|
+
const i = /* @__PURE__ */ new Map();
|
|
2199
2199
|
return Promise.resolve().then(async () => {
|
|
2200
|
-
for (const
|
|
2201
|
-
const u = await
|
|
2200
|
+
for (const l of c) {
|
|
2201
|
+
const u = await l.key, p = await l.value;
|
|
2202
2202
|
if (u.status === "aborted" || p.status === "aborted")
|
|
2203
2203
|
return g;
|
|
2204
|
-
(u.status === "dirty" || p.status === "dirty") && t.dirty(),
|
|
2204
|
+
(u.status === "dirty" || p.status === "dirty") && t.dirty(), i.set(u.value, p.value);
|
|
2205
2205
|
}
|
|
2206
|
-
return { status: t.value, value:
|
|
2206
|
+
return { status: t.value, value: i };
|
|
2207
2207
|
});
|
|
2208
2208
|
} else {
|
|
2209
|
-
const
|
|
2210
|
-
for (const
|
|
2211
|
-
const u =
|
|
2209
|
+
const i = /* @__PURE__ */ new Map();
|
|
2210
|
+
for (const l of c) {
|
|
2211
|
+
const u = l.key, p = l.value;
|
|
2212
2212
|
if (u.status === "aborted" || p.status === "aborted")
|
|
2213
2213
|
return g;
|
|
2214
|
-
(u.status === "dirty" || p.status === "dirty") && t.dirty(),
|
|
2214
|
+
(u.status === "dirty" || p.status === "dirty") && t.dirty(), i.set(u.value, p.value);
|
|
2215
2215
|
}
|
|
2216
|
-
return { status: t.value, value:
|
|
2216
|
+
return { status: t.value, value: i };
|
|
2217
2217
|
}
|
|
2218
2218
|
}
|
|
2219
2219
|
}
|
|
2220
|
-
|
|
2220
|
+
Te.create = (r, e, t) => new Te({
|
|
2221
2221
|
valueType: e,
|
|
2222
2222
|
keyType: r,
|
|
2223
2223
|
typeName: y.ZodMap,
|
|
2224
2224
|
...v(t)
|
|
2225
2225
|
});
|
|
2226
|
-
class
|
|
2226
|
+
class W extends _ {
|
|
2227
2227
|
_parse(e) {
|
|
2228
2228
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2229
2229
|
if (n.parsedType !== h.set)
|
|
2230
|
-
return
|
|
2231
|
-
code:
|
|
2230
|
+
return f(n, {
|
|
2231
|
+
code: d.invalid_type,
|
|
2232
2232
|
expected: h.set,
|
|
2233
2233
|
received: n.parsedType
|
|
2234
2234
|
}), g;
|
|
2235
2235
|
const s = this._def;
|
|
2236
|
-
s.minSize !== null && n.data.size < s.minSize.value && (
|
|
2237
|
-
code:
|
|
2236
|
+
s.minSize !== null && n.data.size < s.minSize.value && (f(n, {
|
|
2237
|
+
code: d.too_small,
|
|
2238
2238
|
minimum: s.minSize.value,
|
|
2239
2239
|
type: "set",
|
|
2240
2240
|
inclusive: !0,
|
|
2241
2241
|
exact: !1,
|
|
2242
2242
|
message: s.minSize.message
|
|
2243
|
-
}), t.dirty()), s.maxSize !== null && n.data.size > s.maxSize.value && (
|
|
2244
|
-
code:
|
|
2243
|
+
}), t.dirty()), s.maxSize !== null && n.data.size > s.maxSize.value && (f(n, {
|
|
2244
|
+
code: d.too_big,
|
|
2245
2245
|
maximum: s.maxSize.value,
|
|
2246
2246
|
type: "set",
|
|
2247
2247
|
inclusive: !0,
|
|
@@ -2249,26 +2249,26 @@ class F extends _ {
|
|
|
2249
2249
|
message: s.maxSize.message
|
|
2250
2250
|
}), t.dirty());
|
|
2251
2251
|
const a = this._def.valueType;
|
|
2252
|
-
function
|
|
2252
|
+
function c(l) {
|
|
2253
2253
|
const u = /* @__PURE__ */ new Set();
|
|
2254
|
-
for (const p of
|
|
2254
|
+
for (const p of l) {
|
|
2255
2255
|
if (p.status === "aborted")
|
|
2256
2256
|
return g;
|
|
2257
2257
|
p.status === "dirty" && t.dirty(), u.add(p.value);
|
|
2258
2258
|
}
|
|
2259
2259
|
return { status: t.value, value: u };
|
|
2260
2260
|
}
|
|
2261
|
-
const
|
|
2262
|
-
return n.common.async ? Promise.all(
|
|
2261
|
+
const i = [...n.data.values()].map((l, u) => a._parse(new R(n, l, n.path, u)));
|
|
2262
|
+
return n.common.async ? Promise.all(i).then((l) => c(l)) : c(i);
|
|
2263
2263
|
}
|
|
2264
2264
|
min(e, t) {
|
|
2265
|
-
return new
|
|
2265
|
+
return new W({
|
|
2266
2266
|
...this._def,
|
|
2267
2267
|
minSize: { value: e, message: m.toString(t) }
|
|
2268
2268
|
});
|
|
2269
2269
|
}
|
|
2270
2270
|
max(e, t) {
|
|
2271
|
-
return new
|
|
2271
|
+
return new W({
|
|
2272
2272
|
...this._def,
|
|
2273
2273
|
maxSize: { value: e, message: m.toString(t) }
|
|
2274
2274
|
});
|
|
@@ -2280,78 +2280,78 @@ class F extends _ {
|
|
|
2280
2280
|
return this.min(1, e);
|
|
2281
2281
|
}
|
|
2282
2282
|
}
|
|
2283
|
-
|
|
2283
|
+
W.create = (r, e) => new W({
|
|
2284
2284
|
valueType: r,
|
|
2285
2285
|
minSize: null,
|
|
2286
2286
|
maxSize: null,
|
|
2287
2287
|
typeName: y.ZodSet,
|
|
2288
2288
|
...v(e)
|
|
2289
2289
|
});
|
|
2290
|
-
class
|
|
2290
|
+
class Y extends _ {
|
|
2291
2291
|
constructor() {
|
|
2292
2292
|
super(...arguments), this.validate = this.implement;
|
|
2293
2293
|
}
|
|
2294
2294
|
_parse(e) {
|
|
2295
2295
|
const { ctx: t } = this._processInputParams(e);
|
|
2296
2296
|
if (t.parsedType !== h.function)
|
|
2297
|
-
return
|
|
2298
|
-
code:
|
|
2297
|
+
return f(t, {
|
|
2298
|
+
code: d.invalid_type,
|
|
2299
2299
|
expected: h.function,
|
|
2300
2300
|
received: t.parsedType
|
|
2301
2301
|
}), g;
|
|
2302
|
-
function n(
|
|
2303
|
-
return
|
|
2304
|
-
data:
|
|
2302
|
+
function n(i, l) {
|
|
2303
|
+
return be({
|
|
2304
|
+
data: i,
|
|
2305
2305
|
path: t.path,
|
|
2306
2306
|
errorMaps: [
|
|
2307
2307
|
t.common.contextualErrorMap,
|
|
2308
2308
|
t.schemaErrorMap,
|
|
2309
|
-
|
|
2310
|
-
|
|
2309
|
+
_e(),
|
|
2310
|
+
G
|
|
2311
2311
|
].filter((u) => !!u),
|
|
2312
2312
|
issueData: {
|
|
2313
|
-
code:
|
|
2314
|
-
argumentsError:
|
|
2313
|
+
code: d.invalid_arguments,
|
|
2314
|
+
argumentsError: l
|
|
2315
2315
|
}
|
|
2316
2316
|
});
|
|
2317
2317
|
}
|
|
2318
|
-
function s(
|
|
2319
|
-
return
|
|
2320
|
-
data:
|
|
2318
|
+
function s(i, l) {
|
|
2319
|
+
return be({
|
|
2320
|
+
data: i,
|
|
2321
2321
|
path: t.path,
|
|
2322
2322
|
errorMaps: [
|
|
2323
2323
|
t.common.contextualErrorMap,
|
|
2324
2324
|
t.schemaErrorMap,
|
|
2325
|
-
|
|
2326
|
-
|
|
2325
|
+
_e(),
|
|
2326
|
+
G
|
|
2327
2327
|
].filter((u) => !!u),
|
|
2328
2328
|
issueData: {
|
|
2329
|
-
code:
|
|
2330
|
-
returnTypeError:
|
|
2329
|
+
code: d.invalid_return_type,
|
|
2330
|
+
returnTypeError: l
|
|
2331
2331
|
}
|
|
2332
2332
|
});
|
|
2333
2333
|
}
|
|
2334
|
-
const a = { errorMap: t.common.contextualErrorMap },
|
|
2335
|
-
if (this._def.returns instanceof
|
|
2336
|
-
const
|
|
2337
|
-
return S(async function(...
|
|
2338
|
-
const u = new Z([]), p = await
|
|
2339
|
-
throw u.addIssue(n(
|
|
2340
|
-
}),
|
|
2341
|
-
return await
|
|
2342
|
-
throw u.addIssue(s(
|
|
2334
|
+
const a = { errorMap: t.common.contextualErrorMap }, c = t.data;
|
|
2335
|
+
if (this._def.returns instanceof K) {
|
|
2336
|
+
const i = this;
|
|
2337
|
+
return S(async function(...l) {
|
|
2338
|
+
const u = new Z([]), p = await i._def.args.parseAsync(l, a).catch((w) => {
|
|
2339
|
+
throw u.addIssue(n(l, w)), u;
|
|
2340
|
+
}), x = await Reflect.apply(c, this, p);
|
|
2341
|
+
return await i._def.returns._def.type.parseAsync(x, a).catch((w) => {
|
|
2342
|
+
throw u.addIssue(s(x, w)), u;
|
|
2343
2343
|
});
|
|
2344
2344
|
});
|
|
2345
2345
|
} else {
|
|
2346
|
-
const
|
|
2347
|
-
return S(function(...
|
|
2348
|
-
const u =
|
|
2346
|
+
const i = this;
|
|
2347
|
+
return S(function(...l) {
|
|
2348
|
+
const u = i._def.args.safeParse(l, a);
|
|
2349
2349
|
if (!u.success)
|
|
2350
|
-
throw new Z([n(
|
|
2351
|
-
const p = Reflect.apply(
|
|
2352
|
-
if (!
|
|
2353
|
-
throw new Z([s(p,
|
|
2354
|
-
return
|
|
2350
|
+
throw new Z([n(l, u.error)]);
|
|
2351
|
+
const p = Reflect.apply(c, this, u.data), x = i._def.returns.safeParse(p, a);
|
|
2352
|
+
if (!x.success)
|
|
2353
|
+
throw new Z([s(p, x.error)]);
|
|
2354
|
+
return x.data;
|
|
2355
2355
|
});
|
|
2356
2356
|
}
|
|
2357
2357
|
}
|
|
@@ -2362,13 +2362,13 @@ class q extends _ {
|
|
|
2362
2362
|
return this._def.returns;
|
|
2363
2363
|
}
|
|
2364
2364
|
args(...e) {
|
|
2365
|
-
return new
|
|
2365
|
+
return new Y({
|
|
2366
2366
|
...this._def,
|
|
2367
|
-
args:
|
|
2367
|
+
args: P.create(e).rest(U.create())
|
|
2368
2368
|
});
|
|
2369
2369
|
}
|
|
2370
2370
|
returns(e) {
|
|
2371
|
-
return new
|
|
2371
|
+
return new Y({
|
|
2372
2372
|
...this._def,
|
|
2373
2373
|
returns: e
|
|
2374
2374
|
});
|
|
@@ -2380,15 +2380,15 @@ class q extends _ {
|
|
|
2380
2380
|
return this.parse(e);
|
|
2381
2381
|
}
|
|
2382
2382
|
static create(e, t, n) {
|
|
2383
|
-
return new
|
|
2384
|
-
args: e ||
|
|
2385
|
-
returns: t ||
|
|
2383
|
+
return new Y({
|
|
2384
|
+
args: e || P.create([]).rest(U.create()),
|
|
2385
|
+
returns: t || U.create(),
|
|
2386
2386
|
typeName: y.ZodFunction,
|
|
2387
2387
|
...v(n)
|
|
2388
2388
|
});
|
|
2389
2389
|
}
|
|
2390
2390
|
}
|
|
2391
|
-
class
|
|
2391
|
+
class ue extends _ {
|
|
2392
2392
|
get schema() {
|
|
2393
2393
|
return this._def.getter();
|
|
2394
2394
|
}
|
|
@@ -2397,18 +2397,18 @@ class oe extends _ {
|
|
|
2397
2397
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
2398
2398
|
}
|
|
2399
2399
|
}
|
|
2400
|
-
|
|
2400
|
+
ue.create = (r, e) => new ue({
|
|
2401
2401
|
getter: r,
|
|
2402
2402
|
typeName: y.ZodLazy,
|
|
2403
2403
|
...v(e)
|
|
2404
2404
|
});
|
|
2405
|
-
class
|
|
2405
|
+
class le extends _ {
|
|
2406
2406
|
_parse(e) {
|
|
2407
2407
|
if (e.data !== this._def.value) {
|
|
2408
2408
|
const t = this._getOrReturnCtx(e);
|
|
2409
|
-
return
|
|
2409
|
+
return f(t, {
|
|
2410
2410
|
received: t.data,
|
|
2411
|
-
code:
|
|
2411
|
+
code: d.invalid_literal,
|
|
2412
2412
|
expected: this._def.value
|
|
2413
2413
|
}), g;
|
|
2414
2414
|
}
|
|
@@ -2418,36 +2418,36 @@ class de extends _ {
|
|
|
2418
2418
|
return this._def.value;
|
|
2419
2419
|
}
|
|
2420
2420
|
}
|
|
2421
|
-
|
|
2421
|
+
le.create = (r, e) => new le({
|
|
2422
2422
|
value: r,
|
|
2423
2423
|
typeName: y.ZodLiteral,
|
|
2424
2424
|
...v(e)
|
|
2425
2425
|
});
|
|
2426
|
-
function
|
|
2427
|
-
return new
|
|
2426
|
+
function Qe(r, e) {
|
|
2427
|
+
return new z({
|
|
2428
2428
|
values: r,
|
|
2429
2429
|
typeName: y.ZodEnum,
|
|
2430
2430
|
...v(e)
|
|
2431
2431
|
});
|
|
2432
2432
|
}
|
|
2433
|
-
class
|
|
2433
|
+
class z extends _ {
|
|
2434
2434
|
constructor() {
|
|
2435
|
-
super(...arguments),
|
|
2435
|
+
super(...arguments), te.set(this, void 0);
|
|
2436
2436
|
}
|
|
2437
2437
|
_parse(e) {
|
|
2438
2438
|
if (typeof e.data != "string") {
|
|
2439
2439
|
const t = this._getOrReturnCtx(e), n = this._def.values;
|
|
2440
|
-
return
|
|
2440
|
+
return f(t, {
|
|
2441
2441
|
expected: b.joinValues(n),
|
|
2442
2442
|
received: t.parsedType,
|
|
2443
|
-
code:
|
|
2443
|
+
code: d.invalid_type
|
|
2444
2444
|
}), g;
|
|
2445
2445
|
}
|
|
2446
|
-
if (
|
|
2446
|
+
if (xe(this, te) || Be(this, te, new Set(this._def.values)), !xe(this, te).has(e.data)) {
|
|
2447
2447
|
const t = this._getOrReturnCtx(e), n = this._def.values;
|
|
2448
|
-
return
|
|
2448
|
+
return f(t, {
|
|
2449
2449
|
received: t.data,
|
|
2450
|
-
code:
|
|
2450
|
+
code: d.invalid_enum_value,
|
|
2451
2451
|
options: n
|
|
2452
2452
|
}), g;
|
|
2453
2453
|
}
|
|
@@ -2475,39 +2475,39 @@ class V extends _ {
|
|
|
2475
2475
|
return e;
|
|
2476
2476
|
}
|
|
2477
2477
|
extract(e, t = this._def) {
|
|
2478
|
-
return
|
|
2478
|
+
return z.create(e, {
|
|
2479
2479
|
...this._def,
|
|
2480
2480
|
...t
|
|
2481
2481
|
});
|
|
2482
2482
|
}
|
|
2483
2483
|
exclude(e, t = this._def) {
|
|
2484
|
-
return
|
|
2484
|
+
return z.create(this.options.filter((n) => !e.includes(n)), {
|
|
2485
2485
|
...this._def,
|
|
2486
2486
|
...t
|
|
2487
2487
|
});
|
|
2488
2488
|
}
|
|
2489
2489
|
}
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
class
|
|
2490
|
+
te = /* @__PURE__ */ new WeakMap();
|
|
2491
|
+
z.create = Qe;
|
|
2492
|
+
class fe extends _ {
|
|
2493
2493
|
constructor() {
|
|
2494
|
-
super(...arguments),
|
|
2494
|
+
super(...arguments), re.set(this, void 0);
|
|
2495
2495
|
}
|
|
2496
2496
|
_parse(e) {
|
|
2497
2497
|
const t = b.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
|
|
2498
2498
|
if (n.parsedType !== h.string && n.parsedType !== h.number) {
|
|
2499
2499
|
const s = b.objectValues(t);
|
|
2500
|
-
return
|
|
2500
|
+
return f(n, {
|
|
2501
2501
|
expected: b.joinValues(s),
|
|
2502
2502
|
received: n.parsedType,
|
|
2503
|
-
code:
|
|
2503
|
+
code: d.invalid_type
|
|
2504
2504
|
}), g;
|
|
2505
2505
|
}
|
|
2506
|
-
if (
|
|
2506
|
+
if (xe(this, re) || Be(this, re, new Set(b.getValidEnumValues(this._def.values))), !xe(this, re).has(e.data)) {
|
|
2507
2507
|
const s = b.objectValues(t);
|
|
2508
|
-
return
|
|
2508
|
+
return f(n, {
|
|
2509
2509
|
received: n.data,
|
|
2510
|
-
code:
|
|
2510
|
+
code: d.invalid_enum_value,
|
|
2511
2511
|
options: s
|
|
2512
2512
|
}), g;
|
|
2513
2513
|
}
|
|
@@ -2517,21 +2517,21 @@ class ce extends _ {
|
|
|
2517
2517
|
return this._def.values;
|
|
2518
2518
|
}
|
|
2519
2519
|
}
|
|
2520
|
-
|
|
2521
|
-
|
|
2520
|
+
re = /* @__PURE__ */ new WeakMap();
|
|
2521
|
+
fe.create = (r, e) => new fe({
|
|
2522
2522
|
values: r,
|
|
2523
2523
|
typeName: y.ZodNativeEnum,
|
|
2524
2524
|
...v(e)
|
|
2525
2525
|
});
|
|
2526
|
-
class
|
|
2526
|
+
class K extends _ {
|
|
2527
2527
|
unwrap() {
|
|
2528
2528
|
return this._def.type;
|
|
2529
2529
|
}
|
|
2530
2530
|
_parse(e) {
|
|
2531
2531
|
const { ctx: t } = this._processInputParams(e);
|
|
2532
2532
|
if (t.parsedType !== h.promise && t.common.async === !1)
|
|
2533
|
-
return
|
|
2534
|
-
code:
|
|
2533
|
+
return f(t, {
|
|
2534
|
+
code: d.invalid_type,
|
|
2535
2535
|
expected: h.promise,
|
|
2536
2536
|
received: t.parsedType
|
|
2537
2537
|
}), g;
|
|
@@ -2542,12 +2542,12 @@ class G extends _ {
|
|
|
2542
2542
|
})));
|
|
2543
2543
|
}
|
|
2544
2544
|
}
|
|
2545
|
-
|
|
2545
|
+
K.create = (r, e) => new K({
|
|
2546
2546
|
type: r,
|
|
2547
2547
|
typeName: y.ZodPromise,
|
|
2548
2548
|
...v(e)
|
|
2549
2549
|
});
|
|
2550
|
-
class
|
|
2550
|
+
class j extends _ {
|
|
2551
2551
|
innerType() {
|
|
2552
2552
|
return this._def.schema;
|
|
2553
2553
|
}
|
|
@@ -2556,87 +2556,87 @@ class A extends _ {
|
|
|
2556
2556
|
}
|
|
2557
2557
|
_parse(e) {
|
|
2558
2558
|
const { status: t, ctx: n } = this._processInputParams(e), s = this._def.effect || null, a = {
|
|
2559
|
-
addIssue: (
|
|
2560
|
-
|
|
2559
|
+
addIssue: (c) => {
|
|
2560
|
+
f(n, c), c.fatal ? t.abort() : t.dirty();
|
|
2561
2561
|
},
|
|
2562
2562
|
get path() {
|
|
2563
2563
|
return n.path;
|
|
2564
2564
|
}
|
|
2565
2565
|
};
|
|
2566
2566
|
if (a.addIssue = a.addIssue.bind(a), s.type === "preprocess") {
|
|
2567
|
-
const
|
|
2567
|
+
const c = s.transform(n.data, a);
|
|
2568
2568
|
if (n.common.async)
|
|
2569
|
-
return Promise.resolve(
|
|
2569
|
+
return Promise.resolve(c).then(async (i) => {
|
|
2570
2570
|
if (t.value === "aborted")
|
|
2571
2571
|
return g;
|
|
2572
|
-
const
|
|
2573
|
-
data:
|
|
2572
|
+
const l = await this._def.schema._parseAsync({
|
|
2573
|
+
data: i,
|
|
2574
2574
|
path: n.path,
|
|
2575
2575
|
parent: n
|
|
2576
2576
|
});
|
|
2577
|
-
return
|
|
2577
|
+
return l.status === "aborted" ? g : l.status === "dirty" || t.value === "dirty" ? Q(l.value) : l;
|
|
2578
2578
|
});
|
|
2579
2579
|
{
|
|
2580
2580
|
if (t.value === "aborted")
|
|
2581
2581
|
return g;
|
|
2582
|
-
const
|
|
2583
|
-
data:
|
|
2582
|
+
const i = this._def.schema._parseSync({
|
|
2583
|
+
data: c,
|
|
2584
2584
|
path: n.path,
|
|
2585
2585
|
parent: n
|
|
2586
2586
|
});
|
|
2587
|
-
return
|
|
2587
|
+
return i.status === "aborted" ? g : i.status === "dirty" || t.value === "dirty" ? Q(i.value) : i;
|
|
2588
2588
|
}
|
|
2589
2589
|
}
|
|
2590
2590
|
if (s.type === "refinement") {
|
|
2591
|
-
const
|
|
2592
|
-
const
|
|
2591
|
+
const c = (i) => {
|
|
2592
|
+
const l = s.refinement(i, a);
|
|
2593
2593
|
if (n.common.async)
|
|
2594
|
-
return Promise.resolve(
|
|
2595
|
-
if (
|
|
2594
|
+
return Promise.resolve(l);
|
|
2595
|
+
if (l instanceof Promise)
|
|
2596
2596
|
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2597
|
-
return
|
|
2597
|
+
return i;
|
|
2598
2598
|
};
|
|
2599
2599
|
if (n.common.async === !1) {
|
|
2600
|
-
const
|
|
2600
|
+
const i = this._def.schema._parseSync({
|
|
2601
2601
|
data: n.data,
|
|
2602
2602
|
path: n.path,
|
|
2603
2603
|
parent: n
|
|
2604
2604
|
});
|
|
2605
|
-
return
|
|
2605
|
+
return i.status === "aborted" ? g : (i.status === "dirty" && t.dirty(), c(i.value), { status: t.value, value: i.value });
|
|
2606
2606
|
} else
|
|
2607
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((
|
|
2607
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) => i.status === "aborted" ? g : (i.status === "dirty" && t.dirty(), c(i.value).then(() => ({ status: t.value, value: i.value }))));
|
|
2608
2608
|
}
|
|
2609
2609
|
if (s.type === "transform")
|
|
2610
2610
|
if (n.common.async === !1) {
|
|
2611
|
-
const
|
|
2611
|
+
const c = this._def.schema._parseSync({
|
|
2612
2612
|
data: n.data,
|
|
2613
2613
|
path: n.path,
|
|
2614
2614
|
parent: n
|
|
2615
2615
|
});
|
|
2616
|
-
if (!
|
|
2617
|
-
return
|
|
2618
|
-
const
|
|
2619
|
-
if (
|
|
2616
|
+
if (!B(c))
|
|
2617
|
+
return c;
|
|
2618
|
+
const i = s.transform(c.value, a);
|
|
2619
|
+
if (i instanceof Promise)
|
|
2620
2620
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2621
|
-
return { status: t.value, value:
|
|
2621
|
+
return { status: t.value, value: i };
|
|
2622
2622
|
} else
|
|
2623
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((
|
|
2623
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((c) => B(c) ? Promise.resolve(s.transform(c.value, a)).then((i) => ({ status: t.value, value: i })) : c);
|
|
2624
2624
|
b.assertNever(s);
|
|
2625
2625
|
}
|
|
2626
2626
|
}
|
|
2627
|
-
|
|
2627
|
+
j.create = (r, e, t) => new j({
|
|
2628
2628
|
schema: r,
|
|
2629
2629
|
typeName: y.ZodEffects,
|
|
2630
2630
|
effect: e,
|
|
2631
2631
|
...v(t)
|
|
2632
2632
|
});
|
|
2633
|
-
|
|
2633
|
+
j.createWithPreprocess = (r, e, t) => new j({
|
|
2634
2634
|
schema: e,
|
|
2635
2635
|
effect: { type: "preprocess", transform: r },
|
|
2636
2636
|
typeName: y.ZodEffects,
|
|
2637
2637
|
...v(t)
|
|
2638
2638
|
});
|
|
2639
|
-
class
|
|
2639
|
+
class E extends _ {
|
|
2640
2640
|
_parse(e) {
|
|
2641
2641
|
return this._getType(e) === h.undefined ? S(void 0) : this._def.innerType._parse(e);
|
|
2642
2642
|
}
|
|
@@ -2644,12 +2644,12 @@ class N extends _ {
|
|
|
2644
2644
|
return this._def.innerType;
|
|
2645
2645
|
}
|
|
2646
2646
|
}
|
|
2647
|
-
|
|
2647
|
+
E.create = (r, e) => new E({
|
|
2648
2648
|
innerType: r,
|
|
2649
2649
|
typeName: y.ZodOptional,
|
|
2650
2650
|
...v(e)
|
|
2651
2651
|
});
|
|
2652
|
-
class
|
|
2652
|
+
class F extends _ {
|
|
2653
2653
|
_parse(e) {
|
|
2654
2654
|
return this._getType(e) === h.null ? S(null) : this._def.innerType._parse(e);
|
|
2655
2655
|
}
|
|
@@ -2657,12 +2657,12 @@ class D extends _ {
|
|
|
2657
2657
|
return this._def.innerType;
|
|
2658
2658
|
}
|
|
2659
2659
|
}
|
|
2660
|
-
|
|
2660
|
+
F.create = (r, e) => new F({
|
|
2661
2661
|
innerType: r,
|
|
2662
2662
|
typeName: y.ZodNullable,
|
|
2663
2663
|
...v(e)
|
|
2664
2664
|
});
|
|
2665
|
-
class
|
|
2665
|
+
class he extends _ {
|
|
2666
2666
|
_parse(e) {
|
|
2667
2667
|
const { ctx: t } = this._processInputParams(e);
|
|
2668
2668
|
let n = t.data;
|
|
@@ -2676,13 +2676,13 @@ class ue extends _ {
|
|
|
2676
2676
|
return this._def.innerType;
|
|
2677
2677
|
}
|
|
2678
2678
|
}
|
|
2679
|
-
|
|
2679
|
+
he.create = (r, e) => new he({
|
|
2680
2680
|
innerType: r,
|
|
2681
2681
|
typeName: y.ZodDefault,
|
|
2682
2682
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
2683
2683
|
...v(e)
|
|
2684
2684
|
});
|
|
2685
|
-
class
|
|
2685
|
+
class pe extends _ {
|
|
2686
2686
|
_parse(e) {
|
|
2687
2687
|
const { ctx: t } = this._processInputParams(e), n = {
|
|
2688
2688
|
...t,
|
|
@@ -2697,7 +2697,7 @@ class le extends _ {
|
|
|
2697
2697
|
...n
|
|
2698
2698
|
}
|
|
2699
2699
|
});
|
|
2700
|
-
return
|
|
2700
|
+
return ne(s) ? s.then((a) => ({
|
|
2701
2701
|
status: "valid",
|
|
2702
2702
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
2703
2703
|
get error() {
|
|
@@ -2719,18 +2719,18 @@ class le extends _ {
|
|
|
2719
2719
|
return this._def.innerType;
|
|
2720
2720
|
}
|
|
2721
2721
|
}
|
|
2722
|
-
|
|
2722
|
+
pe.create = (r, e) => new pe({
|
|
2723
2723
|
innerType: r,
|
|
2724
2724
|
typeName: y.ZodCatch,
|
|
2725
2725
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2726
2726
|
...v(e)
|
|
2727
2727
|
});
|
|
2728
|
-
class
|
|
2728
|
+
class Ce extends _ {
|
|
2729
2729
|
_parse(e) {
|
|
2730
2730
|
if (this._getType(e) !== h.nan) {
|
|
2731
2731
|
const n = this._getOrReturnCtx(e);
|
|
2732
|
-
return
|
|
2733
|
-
code:
|
|
2732
|
+
return f(n, {
|
|
2733
|
+
code: d.invalid_type,
|
|
2734
2734
|
expected: h.nan,
|
|
2735
2735
|
received: n.parsedType
|
|
2736
2736
|
}), g;
|
|
@@ -2738,12 +2738,12 @@ class xe extends _ {
|
|
|
2738
2738
|
return { status: "valid", value: e.data };
|
|
2739
2739
|
}
|
|
2740
2740
|
}
|
|
2741
|
-
|
|
2741
|
+
Ce.create = (r) => new Ce({
|
|
2742
2742
|
typeName: y.ZodNaN,
|
|
2743
2743
|
...v(r)
|
|
2744
2744
|
});
|
|
2745
|
-
const
|
|
2746
|
-
class
|
|
2745
|
+
const Nt = Symbol("zod_brand");
|
|
2746
|
+
class Re extends _ {
|
|
2747
2747
|
_parse(e) {
|
|
2748
2748
|
const { ctx: t } = this._processInputParams(e), n = t.data;
|
|
2749
2749
|
return this._def.type._parse({
|
|
@@ -2756,7 +2756,7 @@ class Ne extends _ {
|
|
|
2756
2756
|
return this._def.type;
|
|
2757
2757
|
}
|
|
2758
2758
|
}
|
|
2759
|
-
class
|
|
2759
|
+
class ye extends _ {
|
|
2760
2760
|
_parse(e) {
|
|
2761
2761
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2762
2762
|
if (n.common.async)
|
|
@@ -2766,7 +2766,7 @@ class he extends _ {
|
|
|
2766
2766
|
path: n.path,
|
|
2767
2767
|
parent: n
|
|
2768
2768
|
});
|
|
2769
|
-
return a.status === "aborted" ? g : a.status === "dirty" ? (t.dirty(),
|
|
2769
|
+
return a.status === "aborted" ? g : a.status === "dirty" ? (t.dirty(), Q(a.value)) : this._def.out._parseAsync({
|
|
2770
2770
|
data: a.value,
|
|
2771
2771
|
path: n.path,
|
|
2772
2772
|
parent: n
|
|
@@ -2789,307 +2789,307 @@ class he extends _ {
|
|
|
2789
2789
|
}
|
|
2790
2790
|
}
|
|
2791
2791
|
static create(e, t) {
|
|
2792
|
-
return new
|
|
2792
|
+
return new ye({
|
|
2793
2793
|
in: e,
|
|
2794
2794
|
out: t,
|
|
2795
2795
|
typeName: y.ZodPipeline
|
|
2796
2796
|
});
|
|
2797
2797
|
}
|
|
2798
2798
|
}
|
|
2799
|
-
class
|
|
2799
|
+
class me extends _ {
|
|
2800
2800
|
_parse(e) {
|
|
2801
|
-
const t = this._def.innerType._parse(e), n = (s) => (
|
|
2802
|
-
return
|
|
2801
|
+
const t = this._def.innerType._parse(e), n = (s) => (B(s) && (s.value = Object.freeze(s.value)), s);
|
|
2802
|
+
return ne(t) ? t.then((s) => n(s)) : n(t);
|
|
2803
2803
|
}
|
|
2804
2804
|
unwrap() {
|
|
2805
2805
|
return this._def.innerType;
|
|
2806
2806
|
}
|
|
2807
2807
|
}
|
|
2808
|
-
|
|
2808
|
+
me.create = (r, e) => new me({
|
|
2809
2809
|
innerType: r,
|
|
2810
2810
|
typeName: y.ZodReadonly,
|
|
2811
2811
|
...v(e)
|
|
2812
2812
|
});
|
|
2813
|
-
function
|
|
2813
|
+
function ze(r, e) {
|
|
2814
2814
|
const t = typeof r == "function" ? r(e) : typeof r == "string" ? { message: r } : r;
|
|
2815
2815
|
return typeof t == "string" ? { message: t } : t;
|
|
2816
2816
|
}
|
|
2817
|
-
function
|
|
2818
|
-
return r ?
|
|
2819
|
-
var a,
|
|
2820
|
-
const
|
|
2821
|
-
if (
|
|
2822
|
-
return
|
|
2817
|
+
function Ye(r, e = {}, t) {
|
|
2818
|
+
return r ? X.create().superRefine((n, s) => {
|
|
2819
|
+
var a, c;
|
|
2820
|
+
const i = r(n);
|
|
2821
|
+
if (i instanceof Promise)
|
|
2822
|
+
return i.then((l) => {
|
|
2823
2823
|
var u, p;
|
|
2824
|
-
if (!
|
|
2825
|
-
const
|
|
2826
|
-
s.addIssue({ code: "custom", ...
|
|
2824
|
+
if (!l) {
|
|
2825
|
+
const x = ze(e, n), I = (p = (u = x.fatal) !== null && u !== void 0 ? u : t) !== null && p !== void 0 ? p : !0;
|
|
2826
|
+
s.addIssue({ code: "custom", ...x, fatal: I });
|
|
2827
2827
|
}
|
|
2828
2828
|
});
|
|
2829
|
-
if (!
|
|
2830
|
-
const
|
|
2831
|
-
s.addIssue({ code: "custom", ...
|
|
2829
|
+
if (!i) {
|
|
2830
|
+
const l = ze(e, n), u = (c = (a = l.fatal) !== null && a !== void 0 ? a : t) !== null && c !== void 0 ? c : !0;
|
|
2831
|
+
s.addIssue({ code: "custom", ...l, fatal: u });
|
|
2832
2832
|
}
|
|
2833
|
-
}) :
|
|
2833
|
+
}) : X.create();
|
|
2834
2834
|
}
|
|
2835
|
-
const
|
|
2836
|
-
object:
|
|
2835
|
+
const Ot = {
|
|
2836
|
+
object: k.lazycreate
|
|
2837
2837
|
};
|
|
2838
2838
|
var y;
|
|
2839
2839
|
(function(r) {
|
|
2840
2840
|
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";
|
|
2841
2841
|
})(y || (y = {}));
|
|
2842
|
-
const
|
|
2842
|
+
const jt = (r, e = {
|
|
2843
2843
|
message: `Input not instance of ${r.name}`
|
|
2844
|
-
}) =>
|
|
2845
|
-
string: (r) =>
|
|
2846
|
-
number: (r) =>
|
|
2847
|
-
boolean: (r) =>
|
|
2844
|
+
}) => Ye((t) => t instanceof r, e), He = N.create, Ge = M.create, Et = Ce.create, Rt = L.create, Xe = se.create, Pt = q.create, $t = ke.create, Vt = ae.create, Dt = ie.create, Mt = X.create, Lt = U.create, zt = D.create, Ft = we.create, Ut = O.create, Bt = k.create, qt = k.strictCreate, Wt = oe.create, Jt = Se.create, Qt = ce.create, Yt = P.create, Ht = de.create, Gt = Te.create, Xt = W.create, Kt = Y.create, er = ue.create, tr = le.create, rr = z.create, nr = fe.create, sr = K.create, Fe = j.create, ar = E.create, ir = F.create, or = j.createWithPreprocess, cr = ye.create, dr = () => He().optional(), ur = () => Ge().optional(), lr = () => Xe().optional(), fr = {
|
|
2845
|
+
string: (r) => N.create({ ...r, coerce: !0 }),
|
|
2846
|
+
number: (r) => M.create({ ...r, coerce: !0 }),
|
|
2847
|
+
boolean: (r) => se.create({
|
|
2848
2848
|
...r,
|
|
2849
2849
|
coerce: !0
|
|
2850
2850
|
}),
|
|
2851
|
-
bigint: (r) =>
|
|
2852
|
-
date: (r) =>
|
|
2853
|
-
},
|
|
2854
|
-
var
|
|
2851
|
+
bigint: (r) => L.create({ ...r, coerce: !0 }),
|
|
2852
|
+
date: (r) => q.create({ ...r, coerce: !0 })
|
|
2853
|
+
}, hr = g;
|
|
2854
|
+
var o = /* @__PURE__ */ Object.freeze({
|
|
2855
2855
|
__proto__: null,
|
|
2856
|
-
defaultErrorMap:
|
|
2857
|
-
setErrorMap:
|
|
2858
|
-
getErrorMap:
|
|
2859
|
-
makeIssue:
|
|
2860
|
-
EMPTY_PATH:
|
|
2861
|
-
addIssueToContext:
|
|
2862
|
-
ParseStatus:
|
|
2856
|
+
defaultErrorMap: G,
|
|
2857
|
+
setErrorMap: ot,
|
|
2858
|
+
getErrorMap: _e,
|
|
2859
|
+
makeIssue: be,
|
|
2860
|
+
EMPTY_PATH: ct,
|
|
2861
|
+
addIssueToContext: f,
|
|
2862
|
+
ParseStatus: C,
|
|
2863
2863
|
INVALID: g,
|
|
2864
|
-
DIRTY:
|
|
2864
|
+
DIRTY: Q,
|
|
2865
2865
|
OK: S,
|
|
2866
|
-
isAborted:
|
|
2867
|
-
isDirty:
|
|
2868
|
-
isValid:
|
|
2869
|
-
isAsync:
|
|
2866
|
+
isAborted: Oe,
|
|
2867
|
+
isDirty: je,
|
|
2868
|
+
isValid: B,
|
|
2869
|
+
isAsync: ne,
|
|
2870
2870
|
get util() {
|
|
2871
2871
|
return b;
|
|
2872
2872
|
},
|
|
2873
2873
|
get objectUtil() {
|
|
2874
|
-
return
|
|
2874
|
+
return Ne;
|
|
2875
2875
|
},
|
|
2876
2876
|
ZodParsedType: h,
|
|
2877
|
-
getParsedType:
|
|
2877
|
+
getParsedType: V,
|
|
2878
2878
|
ZodType: _,
|
|
2879
|
-
datetimeRegex:
|
|
2880
|
-
ZodString:
|
|
2881
|
-
ZodNumber:
|
|
2882
|
-
ZodBigInt:
|
|
2883
|
-
ZodBoolean:
|
|
2884
|
-
ZodDate:
|
|
2885
|
-
ZodSymbol:
|
|
2886
|
-
ZodUndefined:
|
|
2887
|
-
ZodNull:
|
|
2888
|
-
ZodAny:
|
|
2889
|
-
ZodUnknown:
|
|
2890
|
-
ZodNever:
|
|
2891
|
-
ZodVoid:
|
|
2892
|
-
ZodArray:
|
|
2893
|
-
ZodObject:
|
|
2894
|
-
ZodUnion:
|
|
2895
|
-
ZodDiscriminatedUnion:
|
|
2896
|
-
ZodIntersection:
|
|
2897
|
-
ZodTuple:
|
|
2898
|
-
ZodRecord:
|
|
2899
|
-
ZodMap:
|
|
2900
|
-
ZodSet:
|
|
2901
|
-
ZodFunction:
|
|
2902
|
-
ZodLazy:
|
|
2903
|
-
ZodLiteral:
|
|
2904
|
-
ZodEnum:
|
|
2905
|
-
ZodNativeEnum:
|
|
2906
|
-
ZodPromise:
|
|
2907
|
-
ZodEffects:
|
|
2908
|
-
ZodTransformer:
|
|
2909
|
-
ZodOptional:
|
|
2910
|
-
ZodNullable:
|
|
2911
|
-
ZodDefault:
|
|
2912
|
-
ZodCatch:
|
|
2913
|
-
ZodNaN:
|
|
2914
|
-
BRAND:
|
|
2915
|
-
ZodBranded:
|
|
2916
|
-
ZodPipeline:
|
|
2917
|
-
ZodReadonly:
|
|
2918
|
-
custom:
|
|
2879
|
+
datetimeRegex: Je,
|
|
2880
|
+
ZodString: N,
|
|
2881
|
+
ZodNumber: M,
|
|
2882
|
+
ZodBigInt: L,
|
|
2883
|
+
ZodBoolean: se,
|
|
2884
|
+
ZodDate: q,
|
|
2885
|
+
ZodSymbol: ke,
|
|
2886
|
+
ZodUndefined: ae,
|
|
2887
|
+
ZodNull: ie,
|
|
2888
|
+
ZodAny: X,
|
|
2889
|
+
ZodUnknown: U,
|
|
2890
|
+
ZodNever: D,
|
|
2891
|
+
ZodVoid: we,
|
|
2892
|
+
ZodArray: O,
|
|
2893
|
+
ZodObject: k,
|
|
2894
|
+
ZodUnion: oe,
|
|
2895
|
+
ZodDiscriminatedUnion: Se,
|
|
2896
|
+
ZodIntersection: ce,
|
|
2897
|
+
ZodTuple: P,
|
|
2898
|
+
ZodRecord: de,
|
|
2899
|
+
ZodMap: Te,
|
|
2900
|
+
ZodSet: W,
|
|
2901
|
+
ZodFunction: Y,
|
|
2902
|
+
ZodLazy: ue,
|
|
2903
|
+
ZodLiteral: le,
|
|
2904
|
+
ZodEnum: z,
|
|
2905
|
+
ZodNativeEnum: fe,
|
|
2906
|
+
ZodPromise: K,
|
|
2907
|
+
ZodEffects: j,
|
|
2908
|
+
ZodTransformer: j,
|
|
2909
|
+
ZodOptional: E,
|
|
2910
|
+
ZodNullable: F,
|
|
2911
|
+
ZodDefault: he,
|
|
2912
|
+
ZodCatch: pe,
|
|
2913
|
+
ZodNaN: Ce,
|
|
2914
|
+
BRAND: Nt,
|
|
2915
|
+
ZodBranded: Re,
|
|
2916
|
+
ZodPipeline: ye,
|
|
2917
|
+
ZodReadonly: me,
|
|
2918
|
+
custom: Ye,
|
|
2919
2919
|
Schema: _,
|
|
2920
2920
|
ZodSchema: _,
|
|
2921
|
-
late:
|
|
2921
|
+
late: Ot,
|
|
2922
2922
|
get ZodFirstPartyTypeKind() {
|
|
2923
2923
|
return y;
|
|
2924
2924
|
},
|
|
2925
|
-
coerce:
|
|
2926
|
-
any:
|
|
2927
|
-
array:
|
|
2928
|
-
bigint:
|
|
2929
|
-
boolean:
|
|
2930
|
-
date:
|
|
2931
|
-
discriminatedUnion:
|
|
2932
|
-
effect:
|
|
2933
|
-
enum:
|
|
2934
|
-
function:
|
|
2935
|
-
instanceof:
|
|
2936
|
-
intersection:
|
|
2937
|
-
lazy:
|
|
2938
|
-
literal:
|
|
2939
|
-
map:
|
|
2940
|
-
nan:
|
|
2941
|
-
nativeEnum:
|
|
2942
|
-
never:
|
|
2943
|
-
null:
|
|
2944
|
-
nullable:
|
|
2945
|
-
number:
|
|
2946
|
-
object:
|
|
2947
|
-
oboolean:
|
|
2948
|
-
onumber:
|
|
2949
|
-
optional:
|
|
2950
|
-
ostring:
|
|
2951
|
-
pipeline:
|
|
2952
|
-
preprocess:
|
|
2953
|
-
promise:
|
|
2954
|
-
record:
|
|
2955
|
-
set:
|
|
2956
|
-
strictObject:
|
|
2957
|
-
string:
|
|
2958
|
-
symbol:
|
|
2959
|
-
transformer:
|
|
2960
|
-
tuple:
|
|
2961
|
-
undefined:
|
|
2962
|
-
union:
|
|
2963
|
-
unknown:
|
|
2964
|
-
void:
|
|
2965
|
-
NEVER:
|
|
2966
|
-
ZodIssueCode:
|
|
2967
|
-
quotelessJson:
|
|
2925
|
+
coerce: fr,
|
|
2926
|
+
any: Mt,
|
|
2927
|
+
array: Ut,
|
|
2928
|
+
bigint: Rt,
|
|
2929
|
+
boolean: Xe,
|
|
2930
|
+
date: Pt,
|
|
2931
|
+
discriminatedUnion: Jt,
|
|
2932
|
+
effect: Fe,
|
|
2933
|
+
enum: rr,
|
|
2934
|
+
function: Kt,
|
|
2935
|
+
instanceof: jt,
|
|
2936
|
+
intersection: Qt,
|
|
2937
|
+
lazy: er,
|
|
2938
|
+
literal: tr,
|
|
2939
|
+
map: Gt,
|
|
2940
|
+
nan: Et,
|
|
2941
|
+
nativeEnum: nr,
|
|
2942
|
+
never: zt,
|
|
2943
|
+
null: Dt,
|
|
2944
|
+
nullable: ir,
|
|
2945
|
+
number: Ge,
|
|
2946
|
+
object: Bt,
|
|
2947
|
+
oboolean: lr,
|
|
2948
|
+
onumber: ur,
|
|
2949
|
+
optional: ar,
|
|
2950
|
+
ostring: dr,
|
|
2951
|
+
pipeline: cr,
|
|
2952
|
+
preprocess: or,
|
|
2953
|
+
promise: sr,
|
|
2954
|
+
record: Ht,
|
|
2955
|
+
set: Xt,
|
|
2956
|
+
strictObject: qt,
|
|
2957
|
+
string: He,
|
|
2958
|
+
symbol: $t,
|
|
2959
|
+
transformer: Fe,
|
|
2960
|
+
tuple: Yt,
|
|
2961
|
+
undefined: Vt,
|
|
2962
|
+
union: Wt,
|
|
2963
|
+
unknown: Lt,
|
|
2964
|
+
void: Ft,
|
|
2965
|
+
NEVER: hr,
|
|
2966
|
+
ZodIssueCode: d,
|
|
2967
|
+
quotelessJson: it,
|
|
2968
2968
|
ZodError: Z
|
|
2969
2969
|
});
|
|
2970
|
-
const
|
|
2971
|
-
country:
|
|
2972
|
-
city:
|
|
2973
|
-
street:
|
|
2974
|
-
streetNumber:
|
|
2975
|
-
floor:
|
|
2976
|
-
apartmentEnterNumber:
|
|
2977
|
-
apartmentNumber:
|
|
2978
|
-
}),
|
|
2979
|
-
lang:
|
|
2980
|
-
value:
|
|
2981
|
-
}),
|
|
2982
|
-
id:
|
|
2983
|
-
companyId:
|
|
2984
|
-
storeId:
|
|
2985
|
-
parentId:
|
|
2986
|
-
tag:
|
|
2987
|
-
locales:
|
|
2988
|
-
depth:
|
|
2989
|
-
}),
|
|
2990
|
-
children:
|
|
2991
|
-
}),
|
|
2992
|
-
index:
|
|
2993
|
-
depth:
|
|
2994
|
-
collapsed:
|
|
2995
|
-
children:
|
|
2996
|
-
}),
|
|
2997
|
-
type:
|
|
2998
|
-
storeId:
|
|
2999
|
-
companyId:
|
|
3000
|
-
id:
|
|
3001
|
-
objectID:
|
|
3002
|
-
sku:
|
|
3003
|
-
name:
|
|
3004
|
-
description:
|
|
3005
|
-
isPublished:
|
|
3006
|
-
vat:
|
|
3007
|
-
priceType:
|
|
3008
|
-
type:
|
|
3009
|
-
value:
|
|
2970
|
+
const T = o.string().min(1, { message: "שדה חובה" }), br = o.string().regex(/^\d+$/, "Must be a numeric string"), pr = o.object({
|
|
2971
|
+
country: T,
|
|
2972
|
+
city: T,
|
|
2973
|
+
street: T,
|
|
2974
|
+
streetNumber: T,
|
|
2975
|
+
floor: T,
|
|
2976
|
+
apartmentEnterNumber: T,
|
|
2977
|
+
apartmentNumber: T
|
|
2978
|
+
}), H = o.object({
|
|
2979
|
+
lang: o.enum(["he"]),
|
|
2980
|
+
value: o.string()
|
|
2981
|
+
}), xr = o.array(H), Ke = o.object({
|
|
2982
|
+
id: o.string().min(1),
|
|
2983
|
+
companyId: o.string().min(1),
|
|
2984
|
+
storeId: o.string().min(1),
|
|
2985
|
+
parentId: o.string().nullish(),
|
|
2986
|
+
tag: o.string().optional(),
|
|
2987
|
+
locales: o.array(H),
|
|
2988
|
+
depth: o.number()
|
|
2989
|
+
}), Pe = Ke.extend({
|
|
2990
|
+
children: o.lazy(() => Pe.array())
|
|
2991
|
+
}), kr = Ke.extend({
|
|
2992
|
+
index: o.number(),
|
|
2993
|
+
depth: o.number(),
|
|
2994
|
+
collapsed: o.boolean().optional(),
|
|
2995
|
+
children: o.array(Pe)
|
|
2996
|
+
}), ee = o.string().min(1), et = o.object({
|
|
2997
|
+
type: o.literal("Product"),
|
|
2998
|
+
storeId: ee,
|
|
2999
|
+
companyId: ee,
|
|
3000
|
+
id: ee,
|
|
3001
|
+
objectID: ee,
|
|
3002
|
+
sku: ee,
|
|
3003
|
+
name: o.array(H),
|
|
3004
|
+
description: o.array(H),
|
|
3005
|
+
isPublished: o.boolean(),
|
|
3006
|
+
vat: o.boolean(),
|
|
3007
|
+
priceType: o.object({
|
|
3008
|
+
type: o.enum(["unit", "kg", "gram", "liter", "ml"]),
|
|
3009
|
+
value: o.number()
|
|
3010
3010
|
}),
|
|
3011
|
-
price:
|
|
3012
|
-
purchasePrice:
|
|
3013
|
-
profitPercentage:
|
|
3014
|
-
currency:
|
|
3015
|
-
discount:
|
|
3016
|
-
type:
|
|
3017
|
-
value:
|
|
3011
|
+
price: o.number().positive(),
|
|
3012
|
+
purchasePrice: o.number().optional(),
|
|
3013
|
+
profitPercentage: o.number().optional(),
|
|
3014
|
+
currency: o.literal("ILS"),
|
|
3015
|
+
discount: o.object({
|
|
3016
|
+
type: o.enum(["number", "percent", "none"]),
|
|
3017
|
+
value: o.number()
|
|
3018
3018
|
}),
|
|
3019
|
-
isDiscountable:
|
|
3020
|
-
weight:
|
|
3021
|
-
value:
|
|
3022
|
-
unit:
|
|
3019
|
+
isDiscountable: o.boolean({ description: "included in store discounts" }).optional(),
|
|
3020
|
+
weight: o.object({
|
|
3021
|
+
value: o.number(),
|
|
3022
|
+
unit: o.enum(["kg", "gram", "none"])
|
|
3023
3023
|
}),
|
|
3024
|
-
volume:
|
|
3025
|
-
value:
|
|
3026
|
-
unit:
|
|
3024
|
+
volume: o.object({
|
|
3025
|
+
value: o.number(),
|
|
3026
|
+
unit: o.enum(["liter", "ml", "none"])
|
|
3027
3027
|
}),
|
|
3028
|
-
images:
|
|
3029
|
-
manufacturer:
|
|
3030
|
-
brand:
|
|
3031
|
-
importer:
|
|
3032
|
-
supplier:
|
|
3033
|
-
ingredients:
|
|
3034
|
-
created_at:
|
|
3035
|
-
updated_at:
|
|
3036
|
-
categoryIds:
|
|
3028
|
+
images: o.array(o.object({ url: o.string().url(), id: o.string() })),
|
|
3029
|
+
manufacturer: o.string(),
|
|
3030
|
+
brand: o.string(),
|
|
3031
|
+
importer: o.string(),
|
|
3032
|
+
supplier: o.string(),
|
|
3033
|
+
ingredients: o.array(H),
|
|
3034
|
+
created_at: o.number(),
|
|
3035
|
+
updated_at: o.number(),
|
|
3036
|
+
categoryIds: o.array(o.string().nonempty()),
|
|
3037
3037
|
// @deprecated
|
|
3038
|
-
categoryList:
|
|
3038
|
+
categoryList: o.array(Pe),
|
|
3039
3039
|
// @deprecated
|
|
3040
|
-
categories:
|
|
3041
|
-
lvl0:
|
|
3042
|
-
lvl1:
|
|
3043
|
-
lvl2:
|
|
3044
|
-
lvl3:
|
|
3045
|
-
lvl4:
|
|
3040
|
+
categories: o.object({
|
|
3041
|
+
lvl0: o.array(o.string()),
|
|
3042
|
+
lvl1: o.array(o.string()),
|
|
3043
|
+
lvl2: o.array(o.string()),
|
|
3044
|
+
lvl3: o.array(o.string()),
|
|
3045
|
+
lvl4: o.array(o.string())
|
|
3046
3046
|
}),
|
|
3047
3047
|
// @deprecated
|
|
3048
|
-
categoryNames:
|
|
3049
|
-
}),
|
|
3050
|
-
image:
|
|
3051
|
-
}),
|
|
3052
|
-
product:
|
|
3053
|
-
originalPrice:
|
|
3054
|
-
finalPrice:
|
|
3055
|
-
finalDiscount:
|
|
3056
|
-
amount:
|
|
3057
|
-
}),
|
|
3058
|
-
type:
|
|
3059
|
-
id:
|
|
3060
|
-
companyId:
|
|
3061
|
-
storeId:
|
|
3062
|
-
userId:
|
|
3063
|
-
status:
|
|
3064
|
-
items:
|
|
3065
|
-
}),
|
|
3066
|
-
id:
|
|
3067
|
-
name:
|
|
3068
|
-
websiteDomains:
|
|
3069
|
-
}),
|
|
3070
|
-
type:
|
|
3071
|
-
id:
|
|
3072
|
-
companyId:
|
|
3073
|
-
storeId:
|
|
3074
|
-
userId:
|
|
3075
|
-
productId:
|
|
3076
|
-
}),
|
|
3077
|
-
type:
|
|
3078
|
-
id:
|
|
3079
|
-
companyId:
|
|
3080
|
-
storeId:
|
|
3081
|
-
tenantId:
|
|
3082
|
-
clientType:
|
|
3083
|
-
displayName:
|
|
3084
|
-
email:
|
|
3085
|
-
phoneNumber:
|
|
3086
|
-
address:
|
|
3087
|
-
isAnonymous:
|
|
3088
|
-
createdDate:
|
|
3089
|
-
lastActivityDate:
|
|
3090
|
-
paymentType:
|
|
3048
|
+
categoryNames: o.array(o.string())
|
|
3049
|
+
}), wr = et.extend({
|
|
3050
|
+
image: o.instanceof(File).optional()
|
|
3051
|
+
}), tt = o.object({
|
|
3052
|
+
product: et,
|
|
3053
|
+
originalPrice: o.number().optional(),
|
|
3054
|
+
finalPrice: o.number().optional(),
|
|
3055
|
+
finalDiscount: o.number().optional(),
|
|
3056
|
+
amount: o.number().int().positive({ message: "Quantity must be a positive integer." })
|
|
3057
|
+
}), Tr = o.object({
|
|
3058
|
+
type: o.literal("Cart"),
|
|
3059
|
+
id: o.string().uuid(),
|
|
3060
|
+
companyId: o.string().uuid(),
|
|
3061
|
+
storeId: o.string().uuid(),
|
|
3062
|
+
userId: o.string().uuid(),
|
|
3063
|
+
status: o.enum(["active", "draft", "completed"]),
|
|
3064
|
+
items: o.array(tt)
|
|
3065
|
+
}), Cr = o.object({
|
|
3066
|
+
id: o.string(),
|
|
3067
|
+
name: o.string(),
|
|
3068
|
+
websiteDomains: o.array(o.string())
|
|
3069
|
+
}), Sr = o.object({
|
|
3070
|
+
type: o.literal("FavoriteProduct"),
|
|
3071
|
+
id: o.string().uuid(),
|
|
3072
|
+
companyId: o.string().uuid(),
|
|
3073
|
+
storeId: o.string().uuid(),
|
|
3074
|
+
userId: o.string().uuid(),
|
|
3075
|
+
productId: o.string().uuid()
|
|
3076
|
+
}), rt = o.enum(["default", "delayed"]), mr = o.object({
|
|
3077
|
+
type: o.literal("Profile"),
|
|
3078
|
+
id: T,
|
|
3079
|
+
companyId: T,
|
|
3080
|
+
storeId: T,
|
|
3081
|
+
tenantId: T,
|
|
3082
|
+
clientType: o.enum(["user", "company"]),
|
|
3083
|
+
displayName: T,
|
|
3084
|
+
email: o.string().email(),
|
|
3085
|
+
phoneNumber: T.optional(),
|
|
3086
|
+
address: pr.optional(),
|
|
3087
|
+
isAnonymous: o.boolean(),
|
|
3088
|
+
createdDate: o.number(),
|
|
3089
|
+
lastActivityDate: o.number(),
|
|
3090
|
+
paymentType: rt
|
|
3091
3091
|
});
|
|
3092
|
-
function
|
|
3092
|
+
function Zr() {
|
|
3093
3093
|
return {
|
|
3094
3094
|
type: "Profile",
|
|
3095
3095
|
id: "",
|
|
@@ -3112,16 +3112,16 @@ function pr() {
|
|
|
3112
3112
|
createdDate: 0,
|
|
3113
3113
|
lastActivityDate: 0,
|
|
3114
3114
|
isAnonymous: !0,
|
|
3115
|
-
paymentType:
|
|
3115
|
+
paymentType: rt.Values.default
|
|
3116
3116
|
};
|
|
3117
3117
|
}
|
|
3118
|
-
const
|
|
3119
|
-
type:
|
|
3120
|
-
id:
|
|
3121
|
-
companyId:
|
|
3122
|
-
storeId:
|
|
3123
|
-
userId:
|
|
3124
|
-
status:
|
|
3118
|
+
const Ir = o.object({
|
|
3119
|
+
type: o.literal("Order"),
|
|
3120
|
+
id: T,
|
|
3121
|
+
companyId: T,
|
|
3122
|
+
storeId: T,
|
|
3123
|
+
userId: T,
|
|
3124
|
+
status: o.enum([
|
|
3125
3125
|
"draft",
|
|
3126
3126
|
// before payment
|
|
3127
3127
|
"pending",
|
|
@@ -3135,55 +3135,149 @@ const yr = i.object({
|
|
|
3135
3135
|
"completed",
|
|
3136
3136
|
"refunded"
|
|
3137
3137
|
]),
|
|
3138
|
-
paymentStatus:
|
|
3138
|
+
paymentStatus: o.enum(["pending", "pending_j5", "completed", "failed", "refunded"]),
|
|
3139
3139
|
//todo check if hyp support partial refund
|
|
3140
|
-
cart:
|
|
3141
|
-
id:
|
|
3142
|
-
items:
|
|
3143
|
-
cartDiscount:
|
|
3144
|
-
cartTotal:
|
|
3145
|
-
cartVat:
|
|
3140
|
+
cart: o.object({
|
|
3141
|
+
id: o.string(),
|
|
3142
|
+
items: o.array(tt),
|
|
3143
|
+
cartDiscount: o.number(),
|
|
3144
|
+
cartTotal: o.number(),
|
|
3145
|
+
cartVat: o.number()
|
|
3146
3146
|
}),
|
|
3147
|
-
originalAmount:
|
|
3147
|
+
originalAmount: o.number().positive().optional(),
|
|
3148
3148
|
// what client pay
|
|
3149
|
-
actualAmount:
|
|
3149
|
+
actualAmount: o.number().positive().optional(),
|
|
3150
3150
|
// what store charge
|
|
3151
|
-
date:
|
|
3152
|
-
deliveryDate:
|
|
3153
|
-
createdAt:
|
|
3154
|
-
client:
|
|
3155
|
-
});
|
|
3156
|
-
|
|
3157
|
-
id:
|
|
3158
|
-
companyId:
|
|
3159
|
-
name:
|
|
3160
|
-
urls:
|
|
3161
|
-
logoUrl:
|
|
3162
|
-
tenantId:
|
|
3151
|
+
date: o.number(),
|
|
3152
|
+
deliveryDate: o.number().optional(),
|
|
3153
|
+
createdAt: o.number().optional(),
|
|
3154
|
+
client: mr.required({})
|
|
3155
|
+
}), yr = o.enum(["individual", "company"]);
|
|
3156
|
+
o.object({
|
|
3157
|
+
id: o.string(),
|
|
3158
|
+
companyId: o.string(),
|
|
3159
|
+
name: o.string(),
|
|
3160
|
+
urls: o.array(o.string()),
|
|
3161
|
+
logoUrl: o.string(),
|
|
3162
|
+
tenantId: o.string(),
|
|
3163
3163
|
// firebase auth tenantId
|
|
3164
|
-
paymentType:
|
|
3165
|
-
allowAnonymousClients:
|
|
3166
|
-
isVatIncludedInPrice:
|
|
3164
|
+
paymentType: o.enum(["external", "j5"]),
|
|
3165
|
+
allowAnonymousClients: o.boolean(),
|
|
3166
|
+
isVatIncludedInPrice: o.boolean(),
|
|
3167
|
+
clientTypes: o.array(yr)
|
|
3167
3168
|
});
|
|
3168
|
-
const
|
|
3169
|
-
type:
|
|
3170
|
-
storeId:
|
|
3171
|
-
companyId:
|
|
3172
|
-
id:
|
|
3173
|
-
name:
|
|
3174
|
-
active:
|
|
3175
|
-
variant:
|
|
3176
|
-
|
|
3177
|
-
variantType:
|
|
3178
|
-
productsId:
|
|
3179
|
-
requiredQuantity:
|
|
3180
|
-
discountPrice:
|
|
3169
|
+
const Ae = o.string().min(1), Ar = o.object({
|
|
3170
|
+
type: o.literal("Discount"),
|
|
3171
|
+
storeId: Ae,
|
|
3172
|
+
companyId: Ae,
|
|
3173
|
+
id: Ae,
|
|
3174
|
+
name: o.array(H),
|
|
3175
|
+
active: o.boolean(),
|
|
3176
|
+
variant: o.discriminatedUnion("variantType", [
|
|
3177
|
+
o.object({
|
|
3178
|
+
variantType: o.literal("bundle"),
|
|
3179
|
+
productsId: o.array(o.string()).min(1),
|
|
3180
|
+
requiredQuantity: o.number().positive(),
|
|
3181
|
+
discountPrice: o.number().positive()
|
|
3181
3182
|
})
|
|
3182
3183
|
])
|
|
3183
|
-
}),
|
|
3184
|
+
}), ve = {
|
|
3185
|
+
VAT: 18
|
|
3186
|
+
};
|
|
3187
|
+
function nt(r) {
|
|
3188
|
+
var e, t;
|
|
3189
|
+
return ((e = r.discount) == null ? void 0 : e.type) === "percent" ? r.price * (r.discount.value ?? 100) / 100 : ((t = r.discount) == null ? void 0 : t.type) === "number" ? r.price - (r.discount.value ?? 0) : 0;
|
|
3190
|
+
}
|
|
3191
|
+
function st(r) {
|
|
3192
|
+
var e, t;
|
|
3193
|
+
if (((e = r.discount) == null ? void 0 : e.type) === "percent") {
|
|
3194
|
+
const n = r.price * r.discount.value / 100;
|
|
3195
|
+
return r.price - n;
|
|
3196
|
+
}
|
|
3197
|
+
return ((t = r.discount) == null ? void 0 : t.type) === "number" ? r.price - r.discount.value : r.price;
|
|
3198
|
+
}
|
|
3199
|
+
function Nr({
|
|
3200
|
+
cart: r,
|
|
3201
|
+
discounts: e,
|
|
3202
|
+
store: t
|
|
3203
|
+
}) {
|
|
3204
|
+
const { isVatIncludedInPrice: n } = t;
|
|
3205
|
+
let s = r.map((i) => ({
|
|
3206
|
+
amount: i.amount,
|
|
3207
|
+
product: { ...i.product },
|
|
3208
|
+
originalPrice: i.product.price,
|
|
3209
|
+
finalPrice: i.product.price,
|
|
3210
|
+
finalDiscount: 0
|
|
3211
|
+
}));
|
|
3212
|
+
const a = e.filter((i) => i.variant.variantType === "bundle" && ((r == null ? void 0 : r.reduce((u, p) => (i.variant.productsId.includes(p.product.id) && (u += p.amount), u), 0)) ?? 0) >= i.variant.requiredQuantity);
|
|
3213
|
+
console.log("activeDiscounts", a), a.forEach((i) => {
|
|
3214
|
+
var l, u;
|
|
3215
|
+
if (i.variant.variantType === "bundle") {
|
|
3216
|
+
const p = r.filter(
|
|
3217
|
+
(A) => i.variant.productsId.includes(A.product.id)
|
|
3218
|
+
), x = (p == null ? void 0 : p.reduce((A, Me) => (i.variant.productsId.includes(Me.product.id) && (A += Me.amount), A), 0)) ?? 0, I = Math.floor(x / i.variant.requiredQuantity), w = st((l = p[0]) == null ? void 0 : l.product), Ze = nt((u = p[0]) == null ? void 0 : u.product);
|
|
3219
|
+
console.log("price", w, Ze);
|
|
3220
|
+
const at = Number(
|
|
3221
|
+
(i.variant.discountPrice / i.variant.requiredQuantity).toFixed(2)
|
|
3222
|
+
) * 1;
|
|
3223
|
+
console.log("discountPrice", at);
|
|
3224
|
+
const $e = (w * i.variant.requiredQuantity - i.variant.discountPrice) * I, Ve = x * w, De = Ve - $e;
|
|
3225
|
+
console.log("totalDiscount", $e), console.log("discountPriceFinal", De, Ve);
|
|
3226
|
+
const ge = Number((De / x).toFixed(2));
|
|
3227
|
+
console.log("averagePrice", ge), s = s.map((A) => i.variant.productsId.includes(A.product.id) ? {
|
|
3228
|
+
...A,
|
|
3229
|
+
finalPrice: ge,
|
|
3230
|
+
originalPrice: A.product.price,
|
|
3231
|
+
finalDiscount: A.product.price - ge
|
|
3232
|
+
} : A), console.log("averagePrice", ge), console.log(
|
|
3233
|
+
"yes",
|
|
3234
|
+
I,
|
|
3235
|
+
i.variant.requiredQuantity,
|
|
3236
|
+
i.variant.discountPrice
|
|
3237
|
+
), console.log("dis", x, p);
|
|
3238
|
+
}
|
|
3239
|
+
}), console.log("result", s);
|
|
3240
|
+
const c = s.reduce(
|
|
3241
|
+
(i, l) => {
|
|
3242
|
+
const { product: u, amount: p, finalPrice: x, finalDiscount: I } = l;
|
|
3243
|
+
console.log("isVatIncludedInPrice", n);
|
|
3244
|
+
let w = 0;
|
|
3245
|
+
if (u.vat)
|
|
3246
|
+
if (n) {
|
|
3247
|
+
const Ze = x * (ve.VAT / (100 + ve.VAT));
|
|
3248
|
+
w = Number(Ze.toFixed(2)), w = w * p, i.vat += Number(w.toFixed(2));
|
|
3249
|
+
} else
|
|
3250
|
+
w = x * ve.VAT / 100, w = w * p, i.vat += Number(w.toFixed(2));
|
|
3251
|
+
return console.log("finalDiscount", I), i.cost += p * x, i.discount += I && p * I, i.finalCost += p * x + (n ? 0 : w), i;
|
|
3252
|
+
},
|
|
3253
|
+
{
|
|
3254
|
+
discount: 0,
|
|
3255
|
+
cost: 0,
|
|
3256
|
+
finalCost: 0,
|
|
3257
|
+
vat: 0
|
|
3258
|
+
}
|
|
3259
|
+
);
|
|
3260
|
+
return console.log("cartDetails", c), { items: s, ...c };
|
|
3261
|
+
}
|
|
3262
|
+
function Or(r) {
|
|
3263
|
+
return (r ?? []).reduce(
|
|
3264
|
+
(e, t) => {
|
|
3265
|
+
const { product: n, amount: s } = t, a = st(n), c = nt(n), i = n.price - c;
|
|
3266
|
+
let l = 0;
|
|
3267
|
+
return n.vat && (l = i * ve.VAT / 100, l = l * s, e.vat += l), e.cost += s * n.price, e.discount += c && s * c, e.finalCost += s * a + l, e;
|
|
3268
|
+
},
|
|
3269
|
+
{
|
|
3270
|
+
cost: 0,
|
|
3271
|
+
discount: 0,
|
|
3272
|
+
vat: 0,
|
|
3273
|
+
finalCost: 0
|
|
3274
|
+
}
|
|
3275
|
+
);
|
|
3276
|
+
}
|
|
3277
|
+
const gr = {
|
|
3184
3278
|
stores: "STORES",
|
|
3185
3279
|
companies: "COMPANIES"
|
|
3186
|
-
},
|
|
3280
|
+
}, vr = {
|
|
3187
3281
|
products: "products",
|
|
3188
3282
|
profiles: "profiles",
|
|
3189
3283
|
cart: "cart",
|
|
@@ -3194,9 +3288,9 @@ const Se = i.string().min(1), gr = i.object({
|
|
|
3194
3288
|
payments: "payments",
|
|
3195
3289
|
settings: "settings",
|
|
3196
3290
|
discounts: "discounts"
|
|
3197
|
-
},
|
|
3198
|
-
systemCollections:
|
|
3199
|
-
storeCollections:
|
|
3291
|
+
}, _r = {
|
|
3292
|
+
systemCollections: gr,
|
|
3293
|
+
storeCollections: vr,
|
|
3200
3294
|
// for client
|
|
3201
3295
|
getPath: ({
|
|
3202
3296
|
companyId: r,
|
|
@@ -3206,28 +3300,31 @@ const Se = i.string().min(1), gr = i.object({
|
|
|
3206
3300
|
}) => `${r}/${e}/${t}${n ? `/${n}` : ""}`,
|
|
3207
3301
|
// for backend
|
|
3208
3302
|
getDocPath: (r) => `{companyId}/{storeId}/${r}/{id}`
|
|
3209
|
-
},
|
|
3210
|
-
firestore:
|
|
3303
|
+
}, jr = {
|
|
3304
|
+
firestore: _r
|
|
3211
3305
|
};
|
|
3212
3306
|
export {
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3307
|
+
pr as AddressSchema,
|
|
3308
|
+
Ke as BaseCategorySchema,
|
|
3309
|
+
tt as CartItemProductSchema,
|
|
3310
|
+
Tr as CartSchema,
|
|
3311
|
+
Pe as CategorySchema,
|
|
3312
|
+
Cr as CompanySchema,
|
|
3313
|
+
Ar as DiscountSchema,
|
|
3314
|
+
Sr as FavoriteProductSchema,
|
|
3315
|
+
jr as FirebaseAPI,
|
|
3316
|
+
H as LocaleSchema,
|
|
3317
|
+
xr as LocaleValueSchema,
|
|
3318
|
+
wr as NewProductSchema,
|
|
3319
|
+
Ir as OrderSchema,
|
|
3320
|
+
et as ProductSchema,
|
|
3321
|
+
rt as ProfilePaymentTypeSchema,
|
|
3322
|
+
mr as ProfileSchema,
|
|
3323
|
+
kr as TFlattenCategorySchema,
|
|
3324
|
+
Or as calculateCartPrice,
|
|
3325
|
+
Zr as createEmptyProfile,
|
|
3326
|
+
Nr as getCartCost,
|
|
3327
|
+
T as notEmptyTextSchema,
|
|
3328
|
+
br as numericTextSchema
|
|
3232
3329
|
};
|
|
3233
3330
|
//# sourceMappingURL=core.es.js.map
|