@jsdev_ninja/core 0.13.15 → 0.13.17
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 +950 -930
- 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/Invoice.d.ts +95 -0
- package/dist/entities/Invoice.d.ts.map +1 -0
- package/dist/entities/Invoice.js +18 -0
- package/dist/entities/Order.d.ts +302 -2
- package/dist/entities/Order.d.ts.map +1 -1
- package/dist/entities/Order.js +7 -0
- package/dist/entities/Organization.d.ts +64 -4
- package/dist/entities/Organization.d.ts.map +1 -1
- package/dist/entities/Organization.js +6 -0
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/lib/entities/Invoice.ts +23 -0
- package/lib/entities/Order.ts +5 -0
- package/lib/entities/Organization.ts +8 -0
- package/package.json +1 -1
package/dist/core.es.js
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var at = Object.defineProperty;
|
|
2
|
+
var it = (n, e, t) => e in n ? at(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var Re = (n, e, t) => it(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
var x;
|
|
5
|
-
(function(
|
|
6
|
-
|
|
5
|
+
(function(n) {
|
|
6
|
+
n.assertEqual = (s) => s;
|
|
7
7
|
function e(s) {
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
n.assertIs = e;
|
|
10
10
|
function t(s) {
|
|
11
11
|
throw new Error();
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
n.assertNever = t, n.arrayToEnum = (s) => {
|
|
14
14
|
const a = {};
|
|
15
15
|
for (const o of s)
|
|
16
16
|
a[o] = o;
|
|
17
17
|
return a;
|
|
18
|
-
},
|
|
19
|
-
const a =
|
|
18
|
+
}, n.getValidEnumValues = (s) => {
|
|
19
|
+
const a = n.objectKeys(s).filter((c) => typeof s[s[c]] != "number"), o = {};
|
|
20
20
|
for (const c of a)
|
|
21
21
|
o[c] = s[c];
|
|
22
|
-
return
|
|
23
|
-
},
|
|
22
|
+
return n.objectValues(o);
|
|
23
|
+
}, n.objectValues = (s) => n.objectKeys(s).map(function(a) {
|
|
24
24
|
return s[a];
|
|
25
|
-
}),
|
|
25
|
+
}), n.objectKeys = typeof Object.keys == "function" ? (s) => Object.keys(s) : (s) => {
|
|
26
26
|
const a = [];
|
|
27
27
|
for (const o in s)
|
|
28
28
|
Object.prototype.hasOwnProperty.call(s, o) && a.push(o);
|
|
29
29
|
return a;
|
|
30
|
-
},
|
|
30
|
+
}, n.find = (s, a) => {
|
|
31
31
|
for (const o of s)
|
|
32
32
|
if (a(o))
|
|
33
33
|
return o;
|
|
34
|
-
},
|
|
35
|
-
function
|
|
34
|
+
}, n.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && isFinite(s) && Math.floor(s) === s;
|
|
35
|
+
function r(s, a = " | ") {
|
|
36
36
|
return s.map((o) => typeof o == "string" ? `'${o}'` : o).join(a);
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
n.joinValues = r, n.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a;
|
|
39
39
|
})(x || (x = {}));
|
|
40
40
|
var Ne;
|
|
41
|
-
(function(
|
|
42
|
-
|
|
41
|
+
(function(n) {
|
|
42
|
+
n.mergeShapes = (e, t) => ({
|
|
43
43
|
...e,
|
|
44
44
|
...t
|
|
45
45
|
// second overwrites first
|
|
46
46
|
});
|
|
47
47
|
})(Ne || (Ne = {}));
|
|
48
|
-
const
|
|
48
|
+
const m = x.arrayToEnum([
|
|
49
49
|
"string",
|
|
50
50
|
"nan",
|
|
51
51
|
"number",
|
|
@@ -66,26 +66,26 @@ const h = x.arrayToEnum([
|
|
|
66
66
|
"never",
|
|
67
67
|
"map",
|
|
68
68
|
"set"
|
|
69
|
-
]), R = (
|
|
70
|
-
switch (typeof
|
|
69
|
+
]), R = (n) => {
|
|
70
|
+
switch (typeof n) {
|
|
71
71
|
case "undefined":
|
|
72
|
-
return
|
|
72
|
+
return m.undefined;
|
|
73
73
|
case "string":
|
|
74
|
-
return
|
|
74
|
+
return m.string;
|
|
75
75
|
case "number":
|
|
76
|
-
return isNaN(
|
|
76
|
+
return isNaN(n) ? m.nan : m.number;
|
|
77
77
|
case "boolean":
|
|
78
|
-
return
|
|
78
|
+
return m.boolean;
|
|
79
79
|
case "function":
|
|
80
|
-
return
|
|
80
|
+
return m.function;
|
|
81
81
|
case "bigint":
|
|
82
|
-
return
|
|
82
|
+
return m.bigint;
|
|
83
83
|
case "symbol":
|
|
84
|
-
return
|
|
84
|
+
return m.symbol;
|
|
85
85
|
case "object":
|
|
86
|
-
return Array.isArray(
|
|
86
|
+
return Array.isArray(n) ? m.array : n === null ? m.null : n.then && typeof n.then == "function" && n.catch && typeof n.catch == "function" ? m.promise : typeof Map < "u" && n instanceof Map ? m.map : typeof Set < "u" && n instanceof Set ? m.set : typeof Date < "u" && n instanceof Date ? m.date : m.object;
|
|
87
87
|
default:
|
|
88
|
-
return
|
|
88
|
+
return m.unknown;
|
|
89
89
|
}
|
|
90
90
|
}, u = x.arrayToEnum([
|
|
91
91
|
"invalid_type",
|
|
@@ -104,16 +104,16 @@ const h = x.arrayToEnum([
|
|
|
104
104
|
"invalid_intersection_types",
|
|
105
105
|
"not_multiple_of",
|
|
106
106
|
"not_finite"
|
|
107
|
-
]),
|
|
108
|
-
class
|
|
107
|
+
]), ot = (n) => JSON.stringify(n, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
108
|
+
class A extends Error {
|
|
109
109
|
get errors() {
|
|
110
110
|
return this.issues;
|
|
111
111
|
}
|
|
112
112
|
constructor(e) {
|
|
113
|
-
super(), this.issues = [], this.addIssue = (
|
|
114
|
-
this.issues = [...this.issues,
|
|
115
|
-
}, this.addIssues = (
|
|
116
|
-
this.issues = [...this.issues, ...
|
|
113
|
+
super(), this.issues = [], this.addIssue = (r) => {
|
|
114
|
+
this.issues = [...this.issues, r];
|
|
115
|
+
}, this.addIssues = (r = []) => {
|
|
116
|
+
this.issues = [...this.issues, ...r];
|
|
117
117
|
};
|
|
118
118
|
const t = new.target.prototype;
|
|
119
119
|
Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
|
|
@@ -121,7 +121,7 @@ class C extends Error {
|
|
|
121
121
|
format(e) {
|
|
122
122
|
const t = e || function(a) {
|
|
123
123
|
return a.message;
|
|
124
|
-
},
|
|
124
|
+
}, r = { _errors: [] }, s = (a) => {
|
|
125
125
|
for (const o of a.issues)
|
|
126
126
|
if (o.code === "invalid_union")
|
|
127
127
|
o.unionErrors.map(s);
|
|
@@ -130,19 +130,19 @@ class C extends Error {
|
|
|
130
130
|
else if (o.code === "invalid_arguments")
|
|
131
131
|
s(o.argumentsError);
|
|
132
132
|
else if (o.path.length === 0)
|
|
133
|
-
|
|
133
|
+
r._errors.push(t(o));
|
|
134
134
|
else {
|
|
135
|
-
let c =
|
|
135
|
+
let c = r, d = 0;
|
|
136
136
|
for (; d < o.path.length; ) {
|
|
137
137
|
const l = o.path[d];
|
|
138
138
|
d === o.path.length - 1 ? (c[l] = c[l] || { _errors: [] }, c[l]._errors.push(t(o))) : c[l] = c[l] || { _errors: [] }, c = c[l], d++;
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
};
|
|
142
|
-
return s(this),
|
|
142
|
+
return s(this), r;
|
|
143
143
|
}
|
|
144
144
|
static assert(e) {
|
|
145
|
-
if (!(e instanceof
|
|
145
|
+
if (!(e instanceof A))
|
|
146
146
|
throw new Error(`Not a ZodError: ${e}`);
|
|
147
147
|
}
|
|
148
148
|
toString() {
|
|
@@ -155,36 +155,36 @@ class C extends Error {
|
|
|
155
155
|
return this.issues.length === 0;
|
|
156
156
|
}
|
|
157
157
|
flatten(e = (t) => t.message) {
|
|
158
|
-
const t = {},
|
|
158
|
+
const t = {}, r = [];
|
|
159
159
|
for (const s of this.issues)
|
|
160
|
-
s.path.length > 0 ? (t[s.path[0]] = t[s.path[0]] || [], t[s.path[0]].push(e(s))) :
|
|
161
|
-
return { formErrors:
|
|
160
|
+
s.path.length > 0 ? (t[s.path[0]] = t[s.path[0]] || [], t[s.path[0]].push(e(s))) : r.push(e(s));
|
|
161
|
+
return { formErrors: r, fieldErrors: t };
|
|
162
162
|
}
|
|
163
163
|
get formErrors() {
|
|
164
164
|
return this.flatten();
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
|
|
168
|
-
const X = (
|
|
167
|
+
A.create = (n) => new A(n);
|
|
168
|
+
const X = (n, e) => {
|
|
169
169
|
let t;
|
|
170
|
-
switch (
|
|
170
|
+
switch (n.code) {
|
|
171
171
|
case u.invalid_type:
|
|
172
|
-
|
|
172
|
+
n.received === m.undefined ? t = "Required" : t = `Expected ${n.expected}, received ${n.received}`;
|
|
173
173
|
break;
|
|
174
174
|
case u.invalid_literal:
|
|
175
|
-
t = `Invalid literal value, expected ${JSON.stringify(
|
|
175
|
+
t = `Invalid literal value, expected ${JSON.stringify(n.expected, x.jsonStringifyReplacer)}`;
|
|
176
176
|
break;
|
|
177
177
|
case u.unrecognized_keys:
|
|
178
|
-
t = `Unrecognized key(s) in object: ${x.joinValues(
|
|
178
|
+
t = `Unrecognized key(s) in object: ${x.joinValues(n.keys, ", ")}`;
|
|
179
179
|
break;
|
|
180
180
|
case u.invalid_union:
|
|
181
181
|
t = "Invalid input";
|
|
182
182
|
break;
|
|
183
183
|
case u.invalid_union_discriminator:
|
|
184
|
-
t = `Invalid discriminator value. Expected ${x.joinValues(
|
|
184
|
+
t = `Invalid discriminator value. Expected ${x.joinValues(n.options)}`;
|
|
185
185
|
break;
|
|
186
186
|
case u.invalid_enum_value:
|
|
187
|
-
t = `Invalid enum value. Expected ${x.joinValues(
|
|
187
|
+
t = `Invalid enum value. Expected ${x.joinValues(n.options)}, received '${n.received}'`;
|
|
188
188
|
break;
|
|
189
189
|
case u.invalid_arguments:
|
|
190
190
|
t = "Invalid function arguments";
|
|
@@ -196,13 +196,13 @@ const X = (r, e) => {
|
|
|
196
196
|
t = "Invalid date";
|
|
197
197
|
break;
|
|
198
198
|
case u.invalid_string:
|
|
199
|
-
typeof
|
|
199
|
+
typeof n.validation == "object" ? "includes" in n.validation ? (t = `Invalid input: must include "${n.validation.includes}"`, typeof n.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${n.validation.position}`)) : "startsWith" in n.validation ? t = `Invalid input: must start with "${n.validation.startsWith}"` : "endsWith" in n.validation ? t = `Invalid input: must end with "${n.validation.endsWith}"` : x.assertNever(n.validation) : n.validation !== "regex" ? t = `Invalid ${n.validation}` : t = "Invalid";
|
|
200
200
|
break;
|
|
201
201
|
case u.too_small:
|
|
202
|
-
|
|
202
|
+
n.type === "array" ? t = `Array must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "more than"} ${n.minimum} element(s)` : n.type === "string" ? t = `String must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "over"} ${n.minimum} character(s)` : n.type === "number" ? t = `Number must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${n.minimum}` : n.type === "date" ? t = `Date must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(n.minimum))}` : t = "Invalid input";
|
|
203
203
|
break;
|
|
204
204
|
case u.too_big:
|
|
205
|
-
|
|
205
|
+
n.type === "array" ? t = `Array must contain ${n.exact ? "exactly" : n.inclusive ? "at most" : "less than"} ${n.maximum} element(s)` : n.type === "string" ? t = `String must contain ${n.exact ? "exactly" : n.inclusive ? "at most" : "under"} ${n.maximum} character(s)` : n.type === "number" ? t = `Number must be ${n.exact ? "exactly" : n.inclusive ? "less than or equal to" : "less than"} ${n.maximum}` : n.type === "bigint" ? t = `BigInt must be ${n.exact ? "exactly" : n.inclusive ? "less than or equal to" : "less than"} ${n.maximum}` : n.type === "date" ? t = `Date must be ${n.exact ? "exactly" : n.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(n.maximum))}` : t = "Invalid input";
|
|
206
206
|
break;
|
|
207
207
|
case u.custom:
|
|
208
208
|
t = "Invalid input";
|
|
@@ -211,25 +211,25 @@ const X = (r, e) => {
|
|
|
211
211
|
t = "Intersection results could not be merged";
|
|
212
212
|
break;
|
|
213
213
|
case u.not_multiple_of:
|
|
214
|
-
t = `Number must be a multiple of ${
|
|
214
|
+
t = `Number must be a multiple of ${n.multipleOf}`;
|
|
215
215
|
break;
|
|
216
216
|
case u.not_finite:
|
|
217
217
|
t = "Number must be finite";
|
|
218
218
|
break;
|
|
219
219
|
default:
|
|
220
|
-
t = e.defaultError, x.assertNever(
|
|
220
|
+
t = e.defaultError, x.assertNever(n);
|
|
221
221
|
}
|
|
222
222
|
return { message: t };
|
|
223
223
|
};
|
|
224
|
-
let
|
|
225
|
-
function
|
|
226
|
-
|
|
224
|
+
let Fe = X;
|
|
225
|
+
function ct(n) {
|
|
226
|
+
Fe = n;
|
|
227
227
|
}
|
|
228
|
-
function
|
|
229
|
-
return
|
|
228
|
+
function ye() {
|
|
229
|
+
return Fe;
|
|
230
230
|
}
|
|
231
|
-
const ve = (
|
|
232
|
-
const { data: e, path: t, errorMaps:
|
|
231
|
+
const ve = (n) => {
|
|
232
|
+
const { data: e, path: t, errorMaps: r, issueData: s } = n, a = [...t, ...s.path || []], o = {
|
|
233
233
|
...s,
|
|
234
234
|
path: a
|
|
235
235
|
};
|
|
@@ -240,7 +240,7 @@ const ve = (r) => {
|
|
|
240
240
|
message: s.message
|
|
241
241
|
};
|
|
242
242
|
let c = "";
|
|
243
|
-
const d =
|
|
243
|
+
const d = r.filter((l) => !!l).slice().reverse();
|
|
244
244
|
for (const l of d)
|
|
245
245
|
c = l(o, { data: e, defaultError: c }).message;
|
|
246
246
|
return {
|
|
@@ -248,16 +248,16 @@ const ve = (r) => {
|
|
|
248
248
|
path: a,
|
|
249
249
|
message: c
|
|
250
250
|
};
|
|
251
|
-
},
|
|
252
|
-
function f(
|
|
253
|
-
const t =
|
|
251
|
+
}, dt = [];
|
|
252
|
+
function f(n, e) {
|
|
253
|
+
const t = ye(), r = ve({
|
|
254
254
|
issueData: e,
|
|
255
|
-
data:
|
|
256
|
-
path:
|
|
255
|
+
data: n.data,
|
|
256
|
+
path: n.path,
|
|
257
257
|
errorMaps: [
|
|
258
|
-
|
|
258
|
+
n.common.contextualErrorMap,
|
|
259
259
|
// contextual error map is first priority
|
|
260
|
-
|
|
260
|
+
n.schemaErrorMap,
|
|
261
261
|
// then schema-bound map if available
|
|
262
262
|
t,
|
|
263
263
|
// then global override map
|
|
@@ -265,7 +265,7 @@ function f(r, e) {
|
|
|
265
265
|
// then global default map
|
|
266
266
|
].filter((s) => !!s)
|
|
267
267
|
});
|
|
268
|
-
|
|
268
|
+
n.common.issues.push(r);
|
|
269
269
|
}
|
|
270
270
|
class T {
|
|
271
271
|
constructor() {
|
|
@@ -278,85 +278,85 @@ class T {
|
|
|
278
278
|
this.value !== "aborted" && (this.value = "aborted");
|
|
279
279
|
}
|
|
280
280
|
static mergeArray(e, t) {
|
|
281
|
-
const
|
|
281
|
+
const r = [];
|
|
282
282
|
for (const s of t) {
|
|
283
283
|
if (s.status === "aborted")
|
|
284
|
-
return
|
|
285
|
-
s.status === "dirty" && e.dirty(),
|
|
284
|
+
return y;
|
|
285
|
+
s.status === "dirty" && e.dirty(), r.push(s.value);
|
|
286
286
|
}
|
|
287
|
-
return { status: e.value, value:
|
|
287
|
+
return { status: e.value, value: r };
|
|
288
288
|
}
|
|
289
289
|
static async mergeObjectAsync(e, t) {
|
|
290
|
-
const
|
|
290
|
+
const r = [];
|
|
291
291
|
for (const s of t) {
|
|
292
292
|
const a = await s.key, o = await s.value;
|
|
293
|
-
|
|
293
|
+
r.push({
|
|
294
294
|
key: a,
|
|
295
295
|
value: o
|
|
296
296
|
});
|
|
297
297
|
}
|
|
298
|
-
return T.mergeObjectSync(e,
|
|
298
|
+
return T.mergeObjectSync(e, r);
|
|
299
299
|
}
|
|
300
300
|
static mergeObjectSync(e, t) {
|
|
301
|
-
const
|
|
301
|
+
const r = {};
|
|
302
302
|
for (const s of t) {
|
|
303
303
|
const { key: a, value: o } = s;
|
|
304
304
|
if (a.status === "aborted" || o.status === "aborted")
|
|
305
|
-
return
|
|
306
|
-
a.status === "dirty" && e.dirty(), o.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof o.value < "u" || s.alwaysSet) && (
|
|
305
|
+
return y;
|
|
306
|
+
a.status === "dirty" && e.dirty(), o.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof o.value < "u" || s.alwaysSet) && (r[a.value] = o.value);
|
|
307
307
|
}
|
|
308
|
-
return { status: e.value, value:
|
|
308
|
+
return { status: e.value, value: r };
|
|
309
309
|
}
|
|
310
310
|
}
|
|
311
|
-
const
|
|
311
|
+
const y = Object.freeze({
|
|
312
312
|
status: "aborted"
|
|
313
|
-
}), Y = (
|
|
314
|
-
function _e(
|
|
315
|
-
if (typeof e == "function" ?
|
|
316
|
-
return e.get(
|
|
313
|
+
}), Y = (n) => ({ status: "dirty", value: n }), I = (n) => ({ status: "valid", value: n }), Ze = (n) => n.status === "aborted", Oe = (n) => n.status === "dirty", B = (n) => n.status === "valid", re = (n) => typeof Promise < "u" && n instanceof Promise;
|
|
314
|
+
function _e(n, e, t, r) {
|
|
315
|
+
if (typeof e == "function" ? n !== e || !0 : !e.has(n)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
316
|
+
return e.get(n);
|
|
317
317
|
}
|
|
318
|
-
function
|
|
319
|
-
if (typeof e == "function" ?
|
|
320
|
-
return e.set(
|
|
318
|
+
function Ue(n, e, t, r, s) {
|
|
319
|
+
if (typeof e == "function" ? n !== e || !0 : !e.has(n)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
320
|
+
return e.set(n, t), t;
|
|
321
321
|
}
|
|
322
322
|
var p;
|
|
323
|
-
(function(
|
|
324
|
-
|
|
323
|
+
(function(n) {
|
|
324
|
+
n.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, n.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
325
325
|
})(p || (p = {}));
|
|
326
326
|
var ee, te;
|
|
327
|
-
class
|
|
328
|
-
constructor(e, t,
|
|
329
|
-
this._cachedPath = [], this.parent = e, this.data = t, this._path =
|
|
327
|
+
class j {
|
|
328
|
+
constructor(e, t, r, s) {
|
|
329
|
+
this._cachedPath = [], this.parent = e, this.data = t, this._path = r, this._key = s;
|
|
330
330
|
}
|
|
331
331
|
get path() {
|
|
332
332
|
return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
|
-
const
|
|
335
|
+
const Me = (n, e) => {
|
|
336
336
|
if (B(e))
|
|
337
337
|
return { success: !0, data: e.value };
|
|
338
|
-
if (!
|
|
338
|
+
if (!n.common.issues.length)
|
|
339
339
|
throw new Error("Validation failed but no issues detected.");
|
|
340
340
|
return {
|
|
341
341
|
success: !1,
|
|
342
342
|
get error() {
|
|
343
343
|
if (this._error)
|
|
344
344
|
return this._error;
|
|
345
|
-
const t = new
|
|
345
|
+
const t = new A(n.common.issues);
|
|
346
346
|
return this._error = t, this._error;
|
|
347
347
|
}
|
|
348
348
|
};
|
|
349
349
|
};
|
|
350
|
-
function v(
|
|
351
|
-
if (!
|
|
350
|
+
function v(n) {
|
|
351
|
+
if (!n)
|
|
352
352
|
return {};
|
|
353
|
-
const { errorMap: e, invalid_type_error: t, required_error:
|
|
354
|
-
if (e && (t ||
|
|
353
|
+
const { errorMap: e, invalid_type_error: t, required_error: r, description: s } = n;
|
|
354
|
+
if (e && (t || r))
|
|
355
355
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
356
356
|
return e ? { errorMap: e, description: s } : { errorMap: (o, c) => {
|
|
357
357
|
var d, l;
|
|
358
|
-
const { message:
|
|
359
|
-
return o.code === "invalid_enum_value" ? { message:
|
|
358
|
+
const { message: h } = n;
|
|
359
|
+
return o.code === "invalid_enum_value" ? { message: h ?? c.defaultError } : typeof c.data > "u" ? { message: (d = h ?? r) !== null && d !== void 0 ? d : c.defaultError } : o.code !== "invalid_type" ? { message: c.defaultError } : { message: (l = h ?? t) !== null && l !== void 0 ? l : c.defaultError };
|
|
360
360
|
}, description: s };
|
|
361
361
|
}
|
|
362
362
|
class _ {
|
|
@@ -391,7 +391,7 @@ class _ {
|
|
|
391
391
|
}
|
|
392
392
|
_parseSync(e) {
|
|
393
393
|
const t = this._parse(e);
|
|
394
|
-
if (
|
|
394
|
+
if (re(t))
|
|
395
395
|
throw new Error("Synchronous parse encountered promise.");
|
|
396
396
|
return t;
|
|
397
397
|
}
|
|
@@ -400,17 +400,17 @@ class _ {
|
|
|
400
400
|
return Promise.resolve(t);
|
|
401
401
|
}
|
|
402
402
|
parse(e, t) {
|
|
403
|
-
const
|
|
404
|
-
if (
|
|
405
|
-
return
|
|
406
|
-
throw
|
|
403
|
+
const r = this.safeParse(e, t);
|
|
404
|
+
if (r.success)
|
|
405
|
+
return r.data;
|
|
406
|
+
throw r.error;
|
|
407
407
|
}
|
|
408
408
|
safeParse(e, t) {
|
|
409
|
-
var
|
|
409
|
+
var r;
|
|
410
410
|
const s = {
|
|
411
411
|
common: {
|
|
412
412
|
issues: [],
|
|
413
|
-
async: (
|
|
413
|
+
async: (r = t == null ? void 0 : t.async) !== null && r !== void 0 ? r : !1,
|
|
414
414
|
contextualErrorMap: t == null ? void 0 : t.errorMap
|
|
415
415
|
},
|
|
416
416
|
path: (t == null ? void 0 : t.path) || [],
|
|
@@ -419,10 +419,10 @@ class _ {
|
|
|
419
419
|
data: e,
|
|
420
420
|
parsedType: R(e)
|
|
421
421
|
}, a = this._parseSync({ data: e, path: s.path, parent: s });
|
|
422
|
-
return
|
|
422
|
+
return Me(s, a);
|
|
423
423
|
}
|
|
424
424
|
"~validate"(e) {
|
|
425
|
-
var t,
|
|
425
|
+
var t, r;
|
|
426
426
|
const s = {
|
|
427
427
|
common: {
|
|
428
428
|
issues: [],
|
|
@@ -443,7 +443,7 @@ class _ {
|
|
|
443
443
|
issues: s.common.issues
|
|
444
444
|
};
|
|
445
445
|
} catch (a) {
|
|
446
|
-
!((
|
|
446
|
+
!((r = (t = a == null ? void 0 : a.message) === null || t === void 0 ? void 0 : t.toLowerCase()) === null || r === void 0) && r.includes("encountered") && (this["~standard"].async = !0), s.common = {
|
|
447
447
|
issues: [],
|
|
448
448
|
async: !0
|
|
449
449
|
};
|
|
@@ -455,13 +455,13 @@ class _ {
|
|
|
455
455
|
});
|
|
456
456
|
}
|
|
457
457
|
async parseAsync(e, t) {
|
|
458
|
-
const
|
|
459
|
-
if (
|
|
460
|
-
return
|
|
461
|
-
throw
|
|
458
|
+
const r = await this.safeParseAsync(e, t);
|
|
459
|
+
if (r.success)
|
|
460
|
+
return r.data;
|
|
461
|
+
throw r.error;
|
|
462
462
|
}
|
|
463
463
|
async safeParseAsync(e, t) {
|
|
464
|
-
const
|
|
464
|
+
const r = {
|
|
465
465
|
common: {
|
|
466
466
|
issues: [],
|
|
467
467
|
contextualErrorMap: t == null ? void 0 : t.errorMap,
|
|
@@ -472,26 +472,26 @@ class _ {
|
|
|
472
472
|
parent: null,
|
|
473
473
|
data: e,
|
|
474
474
|
parsedType: R(e)
|
|
475
|
-
}, s = this._parse({ data: e, path:
|
|
476
|
-
return
|
|
475
|
+
}, s = this._parse({ data: e, path: r.path, parent: r }), a = await (re(s) ? s : Promise.resolve(s));
|
|
476
|
+
return Me(r, a);
|
|
477
477
|
}
|
|
478
478
|
refine(e, t) {
|
|
479
|
-
const
|
|
479
|
+
const r = (s) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(s) : t;
|
|
480
480
|
return this._refinement((s, a) => {
|
|
481
481
|
const o = e(s), c = () => a.addIssue({
|
|
482
482
|
code: u.custom,
|
|
483
|
-
...
|
|
483
|
+
...r(s)
|
|
484
484
|
});
|
|
485
485
|
return typeof Promise < "u" && o instanceof Promise ? o.then((d) => d ? !0 : (c(), !1)) : o ? !0 : (c(), !1);
|
|
486
486
|
});
|
|
487
487
|
}
|
|
488
488
|
refinement(e, t) {
|
|
489
|
-
return this._refinement((
|
|
489
|
+
return this._refinement((r, s) => e(r) ? !0 : (s.addIssue(typeof t == "function" ? t(r, s) : t), !1));
|
|
490
490
|
}
|
|
491
491
|
_refinement(e) {
|
|
492
492
|
return new O({
|
|
493
493
|
schema: this,
|
|
494
|
-
typeName:
|
|
494
|
+
typeName: g.ZodEffects,
|
|
495
495
|
effect: { type: "refinement", refinement: e }
|
|
496
496
|
});
|
|
497
497
|
}
|
|
@@ -506,10 +506,10 @@ class _ {
|
|
|
506
506
|
};
|
|
507
507
|
}
|
|
508
508
|
optional() {
|
|
509
|
-
return
|
|
509
|
+
return D.create(this, this._def);
|
|
510
510
|
}
|
|
511
511
|
nullable() {
|
|
512
|
-
return
|
|
512
|
+
return z.create(this, this._def);
|
|
513
513
|
}
|
|
514
514
|
nullish() {
|
|
515
515
|
return this.nullable().optional();
|
|
@@ -530,33 +530,33 @@ class _ {
|
|
|
530
530
|
return new O({
|
|
531
531
|
...v(this._def),
|
|
532
532
|
schema: this,
|
|
533
|
-
typeName:
|
|
533
|
+
typeName: g.ZodEffects,
|
|
534
534
|
effect: { type: "transform", transform: e }
|
|
535
535
|
});
|
|
536
536
|
}
|
|
537
537
|
default(e) {
|
|
538
538
|
const t = typeof e == "function" ? e : () => e;
|
|
539
|
-
return new
|
|
539
|
+
return new me({
|
|
540
540
|
...v(this._def),
|
|
541
541
|
innerType: this,
|
|
542
542
|
defaultValue: t,
|
|
543
|
-
typeName:
|
|
543
|
+
typeName: g.ZodDefault
|
|
544
544
|
});
|
|
545
545
|
}
|
|
546
546
|
brand() {
|
|
547
|
-
return new
|
|
548
|
-
typeName:
|
|
547
|
+
return new je({
|
|
548
|
+
typeName: g.ZodBranded,
|
|
549
549
|
type: this,
|
|
550
550
|
...v(this._def)
|
|
551
551
|
});
|
|
552
552
|
}
|
|
553
553
|
catch(e) {
|
|
554
554
|
const t = typeof e == "function" ? e : () => e;
|
|
555
|
-
return new
|
|
555
|
+
return new he({
|
|
556
556
|
...v(this._def),
|
|
557
557
|
innerType: this,
|
|
558
558
|
catchValue: t,
|
|
559
|
-
typeName:
|
|
559
|
+
typeName: g.ZodCatch
|
|
560
560
|
});
|
|
561
561
|
}
|
|
562
562
|
describe(e) {
|
|
@@ -567,7 +567,7 @@ class _ {
|
|
|
567
567
|
});
|
|
568
568
|
}
|
|
569
569
|
pipe(e) {
|
|
570
|
-
return
|
|
570
|
+
return ge.create(this, e);
|
|
571
571
|
}
|
|
572
572
|
readonly() {
|
|
573
573
|
return pe.create(this);
|
|
@@ -579,48 +579,48 @@ class _ {
|
|
|
579
579
|
return this.safeParse(null).success;
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
|
-
const
|
|
583
|
-
let
|
|
584
|
-
const
|
|
585
|
-
function Le(
|
|
582
|
+
const ut = /^c[^\s-]{8,}$/i, lt = /^[0-9a-z]+$/, ft = /^[0-9A-HJKMNP-TV-Z]{26}$/i, mt = /^[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-_]*$/, gt = /^[-+]?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, vt = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
583
|
+
let Ae;
|
|
584
|
+
const _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])$/, bt = /^(?:(?: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])$/, 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]))$/, kt = /^(([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])$/, wt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Tt = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, ze = "((\\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])))", It = new RegExp(`^${ze}$`);
|
|
585
|
+
function Le(n) {
|
|
586
586
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
587
|
-
return
|
|
587
|
+
return n.precision ? e = `${e}\\.\\d{${n.precision}}` : n.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
588
588
|
}
|
|
589
|
-
function
|
|
590
|
-
return new RegExp(`^${Le(
|
|
589
|
+
function St(n) {
|
|
590
|
+
return new RegExp(`^${Le(n)}$`);
|
|
591
591
|
}
|
|
592
|
-
function
|
|
593
|
-
let e = `${ze}T${Le(
|
|
592
|
+
function Be(n) {
|
|
593
|
+
let e = `${ze}T${Le(n)}`;
|
|
594
594
|
const t = [];
|
|
595
|
-
return t.push(
|
|
595
|
+
return t.push(n.local ? "Z?" : "Z"), n.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
596
596
|
}
|
|
597
|
-
function
|
|
598
|
-
return !!((e === "v4" || !e) &&
|
|
597
|
+
function At(n, e) {
|
|
598
|
+
return !!((e === "v4" || !e) && _t.test(n) || (e === "v6" || !e) && xt.test(n));
|
|
599
599
|
}
|
|
600
|
-
function
|
|
601
|
-
if (!
|
|
600
|
+
function Ct(n, e) {
|
|
601
|
+
if (!pt.test(n))
|
|
602
602
|
return !1;
|
|
603
603
|
try {
|
|
604
|
-
const [t] =
|
|
604
|
+
const [t] = n.split("."), r = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), s = JSON.parse(atob(r));
|
|
605
605
|
return !(typeof s != "object" || s === null || !s.typ || !s.alg || e && s.alg !== e);
|
|
606
606
|
} catch {
|
|
607
607
|
return !1;
|
|
608
608
|
}
|
|
609
609
|
}
|
|
610
|
-
function
|
|
611
|
-
return !!((e === "v4" || !e) &&
|
|
610
|
+
function Nt(n, e) {
|
|
611
|
+
return !!((e === "v4" || !e) && bt.test(n) || (e === "v6" || !e) && kt.test(n));
|
|
612
612
|
}
|
|
613
613
|
class N extends _ {
|
|
614
614
|
_parse(e) {
|
|
615
|
-
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !==
|
|
615
|
+
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== m.string) {
|
|
616
616
|
const a = this._getOrReturnCtx(e);
|
|
617
617
|
return f(a, {
|
|
618
618
|
code: u.invalid_type,
|
|
619
|
-
expected:
|
|
619
|
+
expected: m.string,
|
|
620
620
|
received: a.parsedType
|
|
621
|
-
}),
|
|
621
|
+
}), y;
|
|
622
622
|
}
|
|
623
|
-
const
|
|
623
|
+
const r = new T();
|
|
624
624
|
let s;
|
|
625
625
|
for (const a of this._def.checks)
|
|
626
626
|
if (a.kind === "min")
|
|
@@ -631,7 +631,7 @@ class N extends _ {
|
|
|
631
631
|
inclusive: !0,
|
|
632
632
|
exact: !1,
|
|
633
633
|
message: a.message
|
|
634
|
-
}),
|
|
634
|
+
}), r.dirty());
|
|
635
635
|
else if (a.kind === "max")
|
|
636
636
|
e.data.length > a.value && (s = this._getOrReturnCtx(e, s), f(s, {
|
|
637
637
|
code: u.too_big,
|
|
@@ -640,7 +640,7 @@ class N extends _ {
|
|
|
640
640
|
inclusive: !0,
|
|
641
641
|
exact: !1,
|
|
642
642
|
message: a.message
|
|
643
|
-
}),
|
|
643
|
+
}), r.dirty());
|
|
644
644
|
else if (a.kind === "length") {
|
|
645
645
|
const o = e.data.length > a.value, c = e.data.length < a.value;
|
|
646
646
|
(o || c) && (s = this._getOrReturnCtx(e, s), o ? f(s, {
|
|
@@ -657,49 +657,49 @@ class N extends _ {
|
|
|
657
657
|
inclusive: !0,
|
|
658
658
|
exact: !0,
|
|
659
659
|
message: a.message
|
|
660
|
-
}),
|
|
660
|
+
}), r.dirty());
|
|
661
661
|
} else if (a.kind === "email")
|
|
662
|
-
|
|
662
|
+
yt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
663
663
|
validation: "email",
|
|
664
664
|
code: u.invalid_string,
|
|
665
665
|
message: a.message
|
|
666
|
-
}),
|
|
666
|
+
}), r.dirty());
|
|
667
667
|
else if (a.kind === "emoji")
|
|
668
|
-
|
|
668
|
+
Ae || (Ae = new RegExp(vt, "u")), Ae.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
669
669
|
validation: "emoji",
|
|
670
670
|
code: u.invalid_string,
|
|
671
671
|
message: a.message
|
|
672
|
-
}),
|
|
672
|
+
}), r.dirty());
|
|
673
673
|
else if (a.kind === "uuid")
|
|
674
|
-
|
|
674
|
+
mt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
675
675
|
validation: "uuid",
|
|
676
676
|
code: u.invalid_string,
|
|
677
677
|
message: a.message
|
|
678
|
-
}),
|
|
678
|
+
}), r.dirty());
|
|
679
679
|
else if (a.kind === "nanoid")
|
|
680
|
-
|
|
680
|
+
ht.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
681
681
|
validation: "nanoid",
|
|
682
682
|
code: u.invalid_string,
|
|
683
683
|
message: a.message
|
|
684
|
-
}),
|
|
684
|
+
}), r.dirty());
|
|
685
685
|
else if (a.kind === "cuid")
|
|
686
|
-
|
|
686
|
+
ut.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
687
687
|
validation: "cuid",
|
|
688
688
|
code: u.invalid_string,
|
|
689
689
|
message: a.message
|
|
690
|
-
}),
|
|
690
|
+
}), r.dirty());
|
|
691
691
|
else if (a.kind === "cuid2")
|
|
692
|
-
|
|
692
|
+
lt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
693
693
|
validation: "cuid2",
|
|
694
694
|
code: u.invalid_string,
|
|
695
695
|
message: a.message
|
|
696
|
-
}),
|
|
696
|
+
}), r.dirty());
|
|
697
697
|
else if (a.kind === "ulid")
|
|
698
|
-
|
|
698
|
+
ft.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
699
699
|
validation: "ulid",
|
|
700
700
|
code: u.invalid_string,
|
|
701
701
|
message: a.message
|
|
702
|
-
}),
|
|
702
|
+
}), r.dirty());
|
|
703
703
|
else if (a.kind === "url")
|
|
704
704
|
try {
|
|
705
705
|
new URL(e.data);
|
|
@@ -708,68 +708,68 @@ class N extends _ {
|
|
|
708
708
|
validation: "url",
|
|
709
709
|
code: u.invalid_string,
|
|
710
710
|
message: a.message
|
|
711
|
-
}),
|
|
711
|
+
}), r.dirty();
|
|
712
712
|
}
|
|
713
713
|
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
714
714
|
validation: "regex",
|
|
715
715
|
code: u.invalid_string,
|
|
716
716
|
message: a.message
|
|
717
|
-
}),
|
|
717
|
+
}), r.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, {
|
|
718
718
|
code: u.invalid_string,
|
|
719
719
|
validation: { includes: a.value, position: a.position },
|
|
720
720
|
message: a.message
|
|
721
|
-
}),
|
|
721
|
+
}), r.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, {
|
|
722
722
|
code: u.invalid_string,
|
|
723
723
|
validation: { startsWith: a.value },
|
|
724
724
|
message: a.message
|
|
725
|
-
}),
|
|
725
|
+
}), r.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
726
726
|
code: u.invalid_string,
|
|
727
727
|
validation: { endsWith: a.value },
|
|
728
728
|
message: a.message
|
|
729
|
-
}),
|
|
729
|
+
}), r.dirty()) : a.kind === "datetime" ? Be(a).test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
730
730
|
code: u.invalid_string,
|
|
731
731
|
validation: "datetime",
|
|
732
732
|
message: a.message
|
|
733
|
-
}),
|
|
733
|
+
}), r.dirty()) : a.kind === "date" ? It.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
734
734
|
code: u.invalid_string,
|
|
735
735
|
validation: "date",
|
|
736
736
|
message: a.message
|
|
737
|
-
}),
|
|
737
|
+
}), r.dirty()) : a.kind === "time" ? St(a).test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
738
738
|
code: u.invalid_string,
|
|
739
739
|
validation: "time",
|
|
740
740
|
message: a.message
|
|
741
|
-
}),
|
|
741
|
+
}), r.dirty()) : a.kind === "duration" ? gt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
742
742
|
validation: "duration",
|
|
743
743
|
code: u.invalid_string,
|
|
744
744
|
message: a.message
|
|
745
|
-
}),
|
|
745
|
+
}), r.dirty()) : a.kind === "ip" ? At(e.data, a.version) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
746
746
|
validation: "ip",
|
|
747
747
|
code: u.invalid_string,
|
|
748
748
|
message: a.message
|
|
749
|
-
}),
|
|
749
|
+
}), r.dirty()) : a.kind === "jwt" ? Ct(e.data, a.alg) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
750
750
|
validation: "jwt",
|
|
751
751
|
code: u.invalid_string,
|
|
752
752
|
message: a.message
|
|
753
|
-
}),
|
|
753
|
+
}), r.dirty()) : a.kind === "cidr" ? Nt(e.data, a.version) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
754
754
|
validation: "cidr",
|
|
755
755
|
code: u.invalid_string,
|
|
756
756
|
message: a.message
|
|
757
|
-
}),
|
|
757
|
+
}), r.dirty()) : a.kind === "base64" ? wt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
758
758
|
validation: "base64",
|
|
759
759
|
code: u.invalid_string,
|
|
760
760
|
message: a.message
|
|
761
|
-
}),
|
|
761
|
+
}), r.dirty()) : a.kind === "base64url" ? Tt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
762
762
|
validation: "base64url",
|
|
763
763
|
code: u.invalid_string,
|
|
764
764
|
message: a.message
|
|
765
|
-
}),
|
|
766
|
-
return { status:
|
|
765
|
+
}), r.dirty()) : x.assertNever(a);
|
|
766
|
+
return { status: r.value, value: e.data };
|
|
767
767
|
}
|
|
768
|
-
_regex(e, t,
|
|
768
|
+
_regex(e, t, r) {
|
|
769
769
|
return this.refinement((s) => e.test(s), {
|
|
770
770
|
validation: t,
|
|
771
771
|
code: u.invalid_string,
|
|
772
|
-
...p.errToObj(
|
|
772
|
+
...p.errToObj(r)
|
|
773
773
|
});
|
|
774
774
|
}
|
|
775
775
|
_addCheck(e) {
|
|
@@ -821,7 +821,7 @@ class N extends _ {
|
|
|
821
821
|
return this._addCheck({ kind: "cidr", ...p.errToObj(e) });
|
|
822
822
|
}
|
|
823
823
|
datetime(e) {
|
|
824
|
-
var t,
|
|
824
|
+
var t, r;
|
|
825
825
|
return typeof e == "string" ? this._addCheck({
|
|
826
826
|
kind: "datetime",
|
|
827
827
|
precision: null,
|
|
@@ -832,7 +832,7 @@ class N extends _ {
|
|
|
832
832
|
kind: "datetime",
|
|
833
833
|
precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
|
|
834
834
|
offset: (t = e == null ? void 0 : e.offset) !== null && t !== void 0 ? t : !1,
|
|
835
|
-
local: (
|
|
835
|
+
local: (r = e == null ? void 0 : e.local) !== null && r !== void 0 ? r : !1,
|
|
836
836
|
...p.errToObj(e == null ? void 0 : e.message)
|
|
837
837
|
});
|
|
838
838
|
}
|
|
@@ -988,17 +988,17 @@ class N extends _ {
|
|
|
988
988
|
return e;
|
|
989
989
|
}
|
|
990
990
|
}
|
|
991
|
-
N.create = (
|
|
991
|
+
N.create = (n) => {
|
|
992
992
|
var e;
|
|
993
993
|
return new N({
|
|
994
994
|
checks: [],
|
|
995
|
-
typeName:
|
|
996
|
-
coerce: (e =
|
|
997
|
-
...v(
|
|
995
|
+
typeName: g.ZodString,
|
|
996
|
+
coerce: (e = n == null ? void 0 : n.coerce) !== null && e !== void 0 ? e : !1,
|
|
997
|
+
...v(n)
|
|
998
998
|
});
|
|
999
999
|
};
|
|
1000
|
-
function
|
|
1001
|
-
const t = (
|
|
1000
|
+
function Zt(n, e) {
|
|
1001
|
+
const t = (n.toString().split(".")[1] || "").length, r = (e.toString().split(".")[1] || "").length, s = t > r ? t : r, a = parseInt(n.toFixed(s).replace(".", "")), o = parseInt(e.toFixed(s).replace(".", ""));
|
|
1002
1002
|
return a % o / Math.pow(10, s);
|
|
1003
1003
|
}
|
|
1004
1004
|
class V extends _ {
|
|
@@ -1006,41 +1006,41 @@ class V extends _ {
|
|
|
1006
1006
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1007
1007
|
}
|
|
1008
1008
|
_parse(e) {
|
|
1009
|
-
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !==
|
|
1009
|
+
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== m.number) {
|
|
1010
1010
|
const a = this._getOrReturnCtx(e);
|
|
1011
1011
|
return f(a, {
|
|
1012
1012
|
code: u.invalid_type,
|
|
1013
|
-
expected:
|
|
1013
|
+
expected: m.number,
|
|
1014
1014
|
received: a.parsedType
|
|
1015
|
-
}),
|
|
1015
|
+
}), y;
|
|
1016
1016
|
}
|
|
1017
|
-
let
|
|
1017
|
+
let r;
|
|
1018
1018
|
const s = new T();
|
|
1019
1019
|
for (const a of this._def.checks)
|
|
1020
|
-
a.kind === "int" ? x.isInteger(e.data) || (
|
|
1020
|
+
a.kind === "int" ? x.isInteger(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
|
|
1021
1021
|
code: u.invalid_type,
|
|
1022
1022
|
expected: "integer",
|
|
1023
1023
|
received: "float",
|
|
1024
1024
|
message: a.message
|
|
1025
|
-
}), s.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (
|
|
1025
|
+
}), s.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (r = this._getOrReturnCtx(e, r), f(r, {
|
|
1026
1026
|
code: u.too_small,
|
|
1027
1027
|
minimum: a.value,
|
|
1028
1028
|
type: "number",
|
|
1029
1029
|
inclusive: a.inclusive,
|
|
1030
1030
|
exact: !1,
|
|
1031
1031
|
message: a.message
|
|
1032
|
-
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (
|
|
1032
|
+
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (r = this._getOrReturnCtx(e, r), f(r, {
|
|
1033
1033
|
code: u.too_big,
|
|
1034
1034
|
maximum: a.value,
|
|
1035
1035
|
type: "number",
|
|
1036
1036
|
inclusive: a.inclusive,
|
|
1037
1037
|
exact: !1,
|
|
1038
1038
|
message: a.message
|
|
1039
|
-
}), s.dirty()) : a.kind === "multipleOf" ?
|
|
1039
|
+
}), s.dirty()) : a.kind === "multipleOf" ? Zt(e.data, a.value) !== 0 && (r = this._getOrReturnCtx(e, r), f(r, {
|
|
1040
1040
|
code: u.not_multiple_of,
|
|
1041
1041
|
multipleOf: a.value,
|
|
1042
1042
|
message: a.message
|
|
1043
|
-
}), s.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (
|
|
1043
|
+
}), s.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
|
|
1044
1044
|
code: u.not_finite,
|
|
1045
1045
|
message: a.message
|
|
1046
1046
|
}), s.dirty()) : x.assertNever(a);
|
|
@@ -1058,7 +1058,7 @@ class V extends _ {
|
|
|
1058
1058
|
lt(e, t) {
|
|
1059
1059
|
return this.setLimit("max", e, !1, p.toString(t));
|
|
1060
1060
|
}
|
|
1061
|
-
setLimit(e, t,
|
|
1061
|
+
setLimit(e, t, r, s) {
|
|
1062
1062
|
return new V({
|
|
1063
1063
|
...this._def,
|
|
1064
1064
|
checks: [
|
|
@@ -1066,7 +1066,7 @@ class V extends _ {
|
|
|
1066
1066
|
{
|
|
1067
1067
|
kind: e,
|
|
1068
1068
|
value: t,
|
|
1069
|
-
inclusive:
|
|
1069
|
+
inclusive: r,
|
|
1070
1070
|
message: p.toString(s)
|
|
1071
1071
|
}
|
|
1072
1072
|
]
|
|
@@ -1159,19 +1159,19 @@ class V extends _ {
|
|
|
1159
1159
|
}
|
|
1160
1160
|
get isFinite() {
|
|
1161
1161
|
let e = null, t = null;
|
|
1162
|
-
for (const
|
|
1163
|
-
if (
|
|
1162
|
+
for (const r of this._def.checks) {
|
|
1163
|
+
if (r.kind === "finite" || r.kind === "int" || r.kind === "multipleOf")
|
|
1164
1164
|
return !0;
|
|
1165
|
-
|
|
1165
|
+
r.kind === "min" ? (t === null || r.value > t) && (t = r.value) : r.kind === "max" && (e === null || r.value < e) && (e = r.value);
|
|
1166
1166
|
}
|
|
1167
1167
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
1168
1168
|
}
|
|
1169
1169
|
}
|
|
1170
|
-
V.create = (
|
|
1170
|
+
V.create = (n) => new V({
|
|
1171
1171
|
checks: [],
|
|
1172
|
-
typeName:
|
|
1173
|
-
coerce: (
|
|
1174
|
-
...v(
|
|
1172
|
+
typeName: g.ZodNumber,
|
|
1173
|
+
coerce: (n == null ? void 0 : n.coerce) || !1,
|
|
1174
|
+
...v(n)
|
|
1175
1175
|
});
|
|
1176
1176
|
class F extends _ {
|
|
1177
1177
|
constructor() {
|
|
@@ -1184,24 +1184,24 @@ class F extends _ {
|
|
|
1184
1184
|
} catch {
|
|
1185
1185
|
return this._getInvalidInput(e);
|
|
1186
1186
|
}
|
|
1187
|
-
if (this._getType(e) !==
|
|
1187
|
+
if (this._getType(e) !== m.bigint)
|
|
1188
1188
|
return this._getInvalidInput(e);
|
|
1189
|
-
let
|
|
1189
|
+
let r;
|
|
1190
1190
|
const s = new T();
|
|
1191
1191
|
for (const a of this._def.checks)
|
|
1192
|
-
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (
|
|
1192
|
+
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (r = this._getOrReturnCtx(e, r), f(r, {
|
|
1193
1193
|
code: u.too_small,
|
|
1194
1194
|
type: "bigint",
|
|
1195
1195
|
minimum: a.value,
|
|
1196
1196
|
inclusive: a.inclusive,
|
|
1197
1197
|
message: a.message
|
|
1198
|
-
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (
|
|
1198
|
+
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (r = this._getOrReturnCtx(e, r), f(r, {
|
|
1199
1199
|
code: u.too_big,
|
|
1200
1200
|
type: "bigint",
|
|
1201
1201
|
maximum: a.value,
|
|
1202
1202
|
inclusive: a.inclusive,
|
|
1203
1203
|
message: a.message
|
|
1204
|
-
}), s.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (
|
|
1204
|
+
}), s.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (r = this._getOrReturnCtx(e, r), f(r, {
|
|
1205
1205
|
code: u.not_multiple_of,
|
|
1206
1206
|
multipleOf: a.value,
|
|
1207
1207
|
message: a.message
|
|
@@ -1212,9 +1212,9 @@ class F extends _ {
|
|
|
1212
1212
|
const t = this._getOrReturnCtx(e);
|
|
1213
1213
|
return f(t, {
|
|
1214
1214
|
code: u.invalid_type,
|
|
1215
|
-
expected:
|
|
1215
|
+
expected: m.bigint,
|
|
1216
1216
|
received: t.parsedType
|
|
1217
|
-
}),
|
|
1217
|
+
}), y;
|
|
1218
1218
|
}
|
|
1219
1219
|
gte(e, t) {
|
|
1220
1220
|
return this.setLimit("min", e, !0, p.toString(t));
|
|
@@ -1228,7 +1228,7 @@ class F extends _ {
|
|
|
1228
1228
|
lt(e, t) {
|
|
1229
1229
|
return this.setLimit("max", e, !1, p.toString(t));
|
|
1230
1230
|
}
|
|
1231
|
-
setLimit(e, t,
|
|
1231
|
+
setLimit(e, t, r, s) {
|
|
1232
1232
|
return new F({
|
|
1233
1233
|
...this._def,
|
|
1234
1234
|
checks: [
|
|
@@ -1236,7 +1236,7 @@ class F extends _ {
|
|
|
1236
1236
|
{
|
|
1237
1237
|
kind: e,
|
|
1238
1238
|
value: t,
|
|
1239
|
-
inclusive:
|
|
1239
|
+
inclusive: r,
|
|
1240
1240
|
message: p.toString(s)
|
|
1241
1241
|
}
|
|
1242
1242
|
]
|
|
@@ -1300,50 +1300,50 @@ class F extends _ {
|
|
|
1300
1300
|
return e;
|
|
1301
1301
|
}
|
|
1302
1302
|
}
|
|
1303
|
-
F.create = (
|
|
1303
|
+
F.create = (n) => {
|
|
1304
1304
|
var e;
|
|
1305
1305
|
return new F({
|
|
1306
1306
|
checks: [],
|
|
1307
|
-
typeName:
|
|
1308
|
-
coerce: (e =
|
|
1309
|
-
...v(
|
|
1307
|
+
typeName: g.ZodBigInt,
|
|
1308
|
+
coerce: (e = n == null ? void 0 : n.coerce) !== null && e !== void 0 ? e : !1,
|
|
1309
|
+
...v(n)
|
|
1310
1310
|
});
|
|
1311
1311
|
};
|
|
1312
1312
|
class se extends _ {
|
|
1313
1313
|
_parse(e) {
|
|
1314
|
-
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !==
|
|
1315
|
-
const
|
|
1316
|
-
return f(
|
|
1314
|
+
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== m.boolean) {
|
|
1315
|
+
const r = this._getOrReturnCtx(e);
|
|
1316
|
+
return f(r, {
|
|
1317
1317
|
code: u.invalid_type,
|
|
1318
|
-
expected:
|
|
1319
|
-
received:
|
|
1320
|
-
}),
|
|
1318
|
+
expected: m.boolean,
|
|
1319
|
+
received: r.parsedType
|
|
1320
|
+
}), y;
|
|
1321
1321
|
}
|
|
1322
1322
|
return I(e.data);
|
|
1323
1323
|
}
|
|
1324
1324
|
}
|
|
1325
|
-
se.create = (
|
|
1326
|
-
typeName:
|
|
1327
|
-
coerce: (
|
|
1328
|
-
...v(
|
|
1325
|
+
se.create = (n) => new se({
|
|
1326
|
+
typeName: g.ZodBoolean,
|
|
1327
|
+
coerce: (n == null ? void 0 : n.coerce) || !1,
|
|
1328
|
+
...v(n)
|
|
1329
1329
|
});
|
|
1330
1330
|
class q extends _ {
|
|
1331
1331
|
_parse(e) {
|
|
1332
|
-
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !==
|
|
1332
|
+
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== m.date) {
|
|
1333
1333
|
const a = this._getOrReturnCtx(e);
|
|
1334
1334
|
return f(a, {
|
|
1335
1335
|
code: u.invalid_type,
|
|
1336
|
-
expected:
|
|
1336
|
+
expected: m.date,
|
|
1337
1337
|
received: a.parsedType
|
|
1338
|
-
}),
|
|
1338
|
+
}), y;
|
|
1339
1339
|
}
|
|
1340
1340
|
if (isNaN(e.data.getTime())) {
|
|
1341
1341
|
const a = this._getOrReturnCtx(e);
|
|
1342
1342
|
return f(a, {
|
|
1343
1343
|
code: u.invalid_date
|
|
1344
|
-
}),
|
|
1344
|
+
}), y;
|
|
1345
1345
|
}
|
|
1346
|
-
const
|
|
1346
|
+
const r = new T();
|
|
1347
1347
|
let s;
|
|
1348
1348
|
for (const a of this._def.checks)
|
|
1349
1349
|
a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s), f(s, {
|
|
@@ -1353,16 +1353,16 @@ class q extends _ {
|
|
|
1353
1353
|
exact: !1,
|
|
1354
1354
|
minimum: a.value,
|
|
1355
1355
|
type: "date"
|
|
1356
|
-
}),
|
|
1356
|
+
}), r.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (s = this._getOrReturnCtx(e, s), f(s, {
|
|
1357
1357
|
code: u.too_big,
|
|
1358
1358
|
message: a.message,
|
|
1359
1359
|
inclusive: !0,
|
|
1360
1360
|
exact: !1,
|
|
1361
1361
|
maximum: a.value,
|
|
1362
1362
|
type: "date"
|
|
1363
|
-
}),
|
|
1363
|
+
}), r.dirty()) : x.assertNever(a);
|
|
1364
1364
|
return {
|
|
1365
|
-
status:
|
|
1365
|
+
status: r.value,
|
|
1366
1366
|
value: new Date(e.data.getTime())
|
|
1367
1367
|
};
|
|
1368
1368
|
}
|
|
@@ -1399,62 +1399,62 @@ class q extends _ {
|
|
|
1399
1399
|
return e != null ? new Date(e) : null;
|
|
1400
1400
|
}
|
|
1401
1401
|
}
|
|
1402
|
-
q.create = (
|
|
1402
|
+
q.create = (n) => new q({
|
|
1403
1403
|
checks: [],
|
|
1404
|
-
coerce: (
|
|
1405
|
-
typeName:
|
|
1406
|
-
...v(
|
|
1404
|
+
coerce: (n == null ? void 0 : n.coerce) || !1,
|
|
1405
|
+
typeName: g.ZodDate,
|
|
1406
|
+
...v(n)
|
|
1407
1407
|
});
|
|
1408
1408
|
class be extends _ {
|
|
1409
1409
|
_parse(e) {
|
|
1410
|
-
if (this._getType(e) !==
|
|
1411
|
-
const
|
|
1412
|
-
return f(
|
|
1410
|
+
if (this._getType(e) !== m.symbol) {
|
|
1411
|
+
const r = this._getOrReturnCtx(e);
|
|
1412
|
+
return f(r, {
|
|
1413
1413
|
code: u.invalid_type,
|
|
1414
|
-
expected:
|
|
1415
|
-
received:
|
|
1416
|
-
}),
|
|
1414
|
+
expected: m.symbol,
|
|
1415
|
+
received: r.parsedType
|
|
1416
|
+
}), y;
|
|
1417
1417
|
}
|
|
1418
1418
|
return I(e.data);
|
|
1419
1419
|
}
|
|
1420
1420
|
}
|
|
1421
|
-
be.create = (
|
|
1422
|
-
typeName:
|
|
1423
|
-
...v(
|
|
1421
|
+
be.create = (n) => new be({
|
|
1422
|
+
typeName: g.ZodSymbol,
|
|
1423
|
+
...v(n)
|
|
1424
1424
|
});
|
|
1425
1425
|
class ae extends _ {
|
|
1426
1426
|
_parse(e) {
|
|
1427
|
-
if (this._getType(e) !==
|
|
1428
|
-
const
|
|
1429
|
-
return f(
|
|
1427
|
+
if (this._getType(e) !== m.undefined) {
|
|
1428
|
+
const r = this._getOrReturnCtx(e);
|
|
1429
|
+
return f(r, {
|
|
1430
1430
|
code: u.invalid_type,
|
|
1431
|
-
expected:
|
|
1432
|
-
received:
|
|
1433
|
-
}),
|
|
1431
|
+
expected: m.undefined,
|
|
1432
|
+
received: r.parsedType
|
|
1433
|
+
}), y;
|
|
1434
1434
|
}
|
|
1435
1435
|
return I(e.data);
|
|
1436
1436
|
}
|
|
1437
1437
|
}
|
|
1438
|
-
ae.create = (
|
|
1439
|
-
typeName:
|
|
1440
|
-
...v(
|
|
1438
|
+
ae.create = (n) => new ae({
|
|
1439
|
+
typeName: g.ZodUndefined,
|
|
1440
|
+
...v(n)
|
|
1441
1441
|
});
|
|
1442
1442
|
class ie extends _ {
|
|
1443
1443
|
_parse(e) {
|
|
1444
|
-
if (this._getType(e) !==
|
|
1445
|
-
const
|
|
1446
|
-
return f(
|
|
1444
|
+
if (this._getType(e) !== m.null) {
|
|
1445
|
+
const r = this._getOrReturnCtx(e);
|
|
1446
|
+
return f(r, {
|
|
1447
1447
|
code: u.invalid_type,
|
|
1448
|
-
expected:
|
|
1449
|
-
received:
|
|
1450
|
-
}),
|
|
1448
|
+
expected: m.null,
|
|
1449
|
+
received: r.parsedType
|
|
1450
|
+
}), y;
|
|
1451
1451
|
}
|
|
1452
1452
|
return I(e.data);
|
|
1453
1453
|
}
|
|
1454
1454
|
}
|
|
1455
|
-
ie.create = (
|
|
1456
|
-
typeName:
|
|
1457
|
-
...v(
|
|
1455
|
+
ie.create = (n) => new ie({
|
|
1456
|
+
typeName: g.ZodNull,
|
|
1457
|
+
...v(n)
|
|
1458
1458
|
});
|
|
1459
1459
|
class H extends _ {
|
|
1460
1460
|
constructor() {
|
|
@@ -1464,11 +1464,11 @@ class H extends _ {
|
|
|
1464
1464
|
return I(e.data);
|
|
1465
1465
|
}
|
|
1466
1466
|
}
|
|
1467
|
-
H.create = (
|
|
1468
|
-
typeName:
|
|
1469
|
-
...v(
|
|
1467
|
+
H.create = (n) => new H({
|
|
1468
|
+
typeName: g.ZodAny,
|
|
1469
|
+
...v(n)
|
|
1470
1470
|
});
|
|
1471
|
-
class
|
|
1471
|
+
class L extends _ {
|
|
1472
1472
|
constructor() {
|
|
1473
1473
|
super(...arguments), this._unknown = !0;
|
|
1474
1474
|
}
|
|
@@ -1476,50 +1476,50 @@ class U extends _ {
|
|
|
1476
1476
|
return I(e.data);
|
|
1477
1477
|
}
|
|
1478
1478
|
}
|
|
1479
|
-
|
|
1480
|
-
typeName:
|
|
1481
|
-
...v(
|
|
1479
|
+
L.create = (n) => new L({
|
|
1480
|
+
typeName: g.ZodUnknown,
|
|
1481
|
+
...v(n)
|
|
1482
1482
|
});
|
|
1483
1483
|
class $ extends _ {
|
|
1484
1484
|
_parse(e) {
|
|
1485
1485
|
const t = this._getOrReturnCtx(e);
|
|
1486
1486
|
return f(t, {
|
|
1487
1487
|
code: u.invalid_type,
|
|
1488
|
-
expected:
|
|
1488
|
+
expected: m.never,
|
|
1489
1489
|
received: t.parsedType
|
|
1490
|
-
}),
|
|
1490
|
+
}), y;
|
|
1491
1491
|
}
|
|
1492
1492
|
}
|
|
1493
|
-
$.create = (
|
|
1494
|
-
typeName:
|
|
1495
|
-
...v(
|
|
1493
|
+
$.create = (n) => new $({
|
|
1494
|
+
typeName: g.ZodNever,
|
|
1495
|
+
...v(n)
|
|
1496
1496
|
});
|
|
1497
1497
|
class xe extends _ {
|
|
1498
1498
|
_parse(e) {
|
|
1499
|
-
if (this._getType(e) !==
|
|
1500
|
-
const
|
|
1501
|
-
return f(
|
|
1499
|
+
if (this._getType(e) !== m.undefined) {
|
|
1500
|
+
const r = this._getOrReturnCtx(e);
|
|
1501
|
+
return f(r, {
|
|
1502
1502
|
code: u.invalid_type,
|
|
1503
|
-
expected:
|
|
1504
|
-
received:
|
|
1505
|
-
}),
|
|
1503
|
+
expected: m.void,
|
|
1504
|
+
received: r.parsedType
|
|
1505
|
+
}), y;
|
|
1506
1506
|
}
|
|
1507
1507
|
return I(e.data);
|
|
1508
1508
|
}
|
|
1509
1509
|
}
|
|
1510
|
-
xe.create = (
|
|
1511
|
-
typeName:
|
|
1512
|
-
...v(
|
|
1510
|
+
xe.create = (n) => new xe({
|
|
1511
|
+
typeName: g.ZodVoid,
|
|
1512
|
+
...v(n)
|
|
1513
1513
|
});
|
|
1514
1514
|
class Z extends _ {
|
|
1515
1515
|
_parse(e) {
|
|
1516
|
-
const { ctx: t, status:
|
|
1517
|
-
if (t.parsedType !==
|
|
1516
|
+
const { ctx: t, status: r } = this._processInputParams(e), s = this._def;
|
|
1517
|
+
if (t.parsedType !== m.array)
|
|
1518
1518
|
return f(t, {
|
|
1519
1519
|
code: u.invalid_type,
|
|
1520
|
-
expected:
|
|
1520
|
+
expected: m.array,
|
|
1521
1521
|
received: t.parsedType
|
|
1522
|
-
}),
|
|
1522
|
+
}), y;
|
|
1523
1523
|
if (s.exactLength !== null) {
|
|
1524
1524
|
const o = t.data.length > s.exactLength.value, c = t.data.length < s.exactLength.value;
|
|
1525
1525
|
(o || c) && (f(t, {
|
|
@@ -1530,7 +1530,7 @@ class Z extends _ {
|
|
|
1530
1530
|
inclusive: !0,
|
|
1531
1531
|
exact: !0,
|
|
1532
1532
|
message: s.exactLength.message
|
|
1533
|
-
}),
|
|
1533
|
+
}), r.dirty());
|
|
1534
1534
|
}
|
|
1535
1535
|
if (s.minLength !== null && t.data.length < s.minLength.value && (f(t, {
|
|
1536
1536
|
code: u.too_small,
|
|
@@ -1539,17 +1539,17 @@ class Z extends _ {
|
|
|
1539
1539
|
inclusive: !0,
|
|
1540
1540
|
exact: !1,
|
|
1541
1541
|
message: s.minLength.message
|
|
1542
|
-
}),
|
|
1542
|
+
}), r.dirty()), s.maxLength !== null && t.data.length > s.maxLength.value && (f(t, {
|
|
1543
1543
|
code: u.too_big,
|
|
1544
1544
|
maximum: s.maxLength.value,
|
|
1545
1545
|
type: "array",
|
|
1546
1546
|
inclusive: !0,
|
|
1547
1547
|
exact: !1,
|
|
1548
1548
|
message: s.maxLength.message
|
|
1549
|
-
}),
|
|
1550
|
-
return Promise.all([...t.data].map((o, c) => s.type._parseAsync(new
|
|
1551
|
-
const a = [...t.data].map((o, c) => s.type._parseSync(new
|
|
1552
|
-
return T.mergeArray(
|
|
1549
|
+
}), r.dirty()), t.common.async)
|
|
1550
|
+
return Promise.all([...t.data].map((o, c) => s.type._parseAsync(new j(t, o, t.path, c)))).then((o) => T.mergeArray(r, o));
|
|
1551
|
+
const a = [...t.data].map((o, c) => s.type._parseSync(new j(t, o, t.path, c)));
|
|
1552
|
+
return T.mergeArray(r, a);
|
|
1553
1553
|
}
|
|
1554
1554
|
get element() {
|
|
1555
1555
|
return this._def.type;
|
|
@@ -1576,29 +1576,29 @@ class Z extends _ {
|
|
|
1576
1576
|
return this.min(1, e);
|
|
1577
1577
|
}
|
|
1578
1578
|
}
|
|
1579
|
-
Z.create = (
|
|
1580
|
-
type:
|
|
1579
|
+
Z.create = (n, e) => new Z({
|
|
1580
|
+
type: n,
|
|
1581
1581
|
minLength: null,
|
|
1582
1582
|
maxLength: null,
|
|
1583
1583
|
exactLength: null,
|
|
1584
|
-
typeName:
|
|
1584
|
+
typeName: g.ZodArray,
|
|
1585
1585
|
...v(e)
|
|
1586
1586
|
});
|
|
1587
|
-
function Q(
|
|
1588
|
-
if (
|
|
1587
|
+
function Q(n) {
|
|
1588
|
+
if (n instanceof k) {
|
|
1589
1589
|
const e = {};
|
|
1590
|
-
for (const t in
|
|
1591
|
-
const
|
|
1592
|
-
e[t] =
|
|
1590
|
+
for (const t in n.shape) {
|
|
1591
|
+
const r = n.shape[t];
|
|
1592
|
+
e[t] = D.create(Q(r));
|
|
1593
1593
|
}
|
|
1594
1594
|
return new k({
|
|
1595
|
-
...
|
|
1595
|
+
...n._def,
|
|
1596
1596
|
shape: () => e
|
|
1597
1597
|
});
|
|
1598
|
-
} else return
|
|
1599
|
-
...
|
|
1600
|
-
type: Q(
|
|
1601
|
-
}) :
|
|
1598
|
+
} else return n instanceof Z ? new Z({
|
|
1599
|
+
...n._def,
|
|
1600
|
+
type: Q(n.element)
|
|
1601
|
+
}) : n instanceof D ? D.create(Q(n.unwrap())) : n instanceof z ? z.create(Q(n.unwrap())) : n instanceof E ? E.create(n.items.map((e) => Q(e))) : n;
|
|
1602
1602
|
}
|
|
1603
1603
|
class k extends _ {
|
|
1604
1604
|
constructor() {
|
|
@@ -1611,67 +1611,67 @@ class k extends _ {
|
|
|
1611
1611
|
return this._cached = { shape: e, keys: t };
|
|
1612
1612
|
}
|
|
1613
1613
|
_parse(e) {
|
|
1614
|
-
if (this._getType(e) !==
|
|
1614
|
+
if (this._getType(e) !== m.object) {
|
|
1615
1615
|
const l = this._getOrReturnCtx(e);
|
|
1616
1616
|
return f(l, {
|
|
1617
1617
|
code: u.invalid_type,
|
|
1618
|
-
expected:
|
|
1618
|
+
expected: m.object,
|
|
1619
1619
|
received: l.parsedType
|
|
1620
|
-
}),
|
|
1620
|
+
}), y;
|
|
1621
1621
|
}
|
|
1622
|
-
const { status:
|
|
1622
|
+
const { status: r, ctx: s } = this._processInputParams(e), { shape: a, keys: o } = this._getCached(), c = [];
|
|
1623
1623
|
if (!(this._def.catchall instanceof $ && this._def.unknownKeys === "strip"))
|
|
1624
1624
|
for (const l in s.data)
|
|
1625
1625
|
o.includes(l) || c.push(l);
|
|
1626
1626
|
const d = [];
|
|
1627
1627
|
for (const l of o) {
|
|
1628
|
-
const
|
|
1628
|
+
const h = a[l], b = s.data[l];
|
|
1629
1629
|
d.push({
|
|
1630
1630
|
key: { status: "valid", value: l },
|
|
1631
|
-
value:
|
|
1631
|
+
value: h._parse(new j(s, b, s.path, l)),
|
|
1632
1632
|
alwaysSet: l in s.data
|
|
1633
1633
|
});
|
|
1634
1634
|
}
|
|
1635
1635
|
if (this._def.catchall instanceof $) {
|
|
1636
1636
|
const l = this._def.unknownKeys;
|
|
1637
1637
|
if (l === "passthrough")
|
|
1638
|
-
for (const
|
|
1638
|
+
for (const h of c)
|
|
1639
1639
|
d.push({
|
|
1640
|
-
key: { status: "valid", value:
|
|
1641
|
-
value: { status: "valid", value: s.data[
|
|
1640
|
+
key: { status: "valid", value: h },
|
|
1641
|
+
value: { status: "valid", value: s.data[h] }
|
|
1642
1642
|
});
|
|
1643
1643
|
else if (l === "strict")
|
|
1644
1644
|
c.length > 0 && (f(s, {
|
|
1645
1645
|
code: u.unrecognized_keys,
|
|
1646
1646
|
keys: c
|
|
1647
|
-
}),
|
|
1647
|
+
}), r.dirty());
|
|
1648
1648
|
else if (l !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
1649
1649
|
} else {
|
|
1650
1650
|
const l = this._def.catchall;
|
|
1651
|
-
for (const
|
|
1652
|
-
const b = s.data[
|
|
1651
|
+
for (const h of c) {
|
|
1652
|
+
const b = s.data[h];
|
|
1653
1653
|
d.push({
|
|
1654
|
-
key: { status: "valid", value:
|
|
1654
|
+
key: { status: "valid", value: h },
|
|
1655
1655
|
value: l._parse(
|
|
1656
|
-
new
|
|
1656
|
+
new j(s, b, s.path, h)
|
|
1657
1657
|
//, ctx.child(key), value, getParsedType(value)
|
|
1658
1658
|
),
|
|
1659
|
-
alwaysSet:
|
|
1659
|
+
alwaysSet: h in s.data
|
|
1660
1660
|
});
|
|
1661
1661
|
}
|
|
1662
1662
|
}
|
|
1663
1663
|
return s.common.async ? Promise.resolve().then(async () => {
|
|
1664
1664
|
const l = [];
|
|
1665
|
-
for (const
|
|
1666
|
-
const b = await
|
|
1665
|
+
for (const h of d) {
|
|
1666
|
+
const b = await h.key, w = await h.value;
|
|
1667
1667
|
l.push({
|
|
1668
1668
|
key: b,
|
|
1669
1669
|
value: w,
|
|
1670
|
-
alwaysSet:
|
|
1670
|
+
alwaysSet: h.alwaysSet
|
|
1671
1671
|
});
|
|
1672
1672
|
}
|
|
1673
1673
|
return l;
|
|
1674
|
-
}).then((l) => T.mergeObjectSync(
|
|
1674
|
+
}).then((l) => T.mergeObjectSync(r, l)) : T.mergeObjectSync(r, d);
|
|
1675
1675
|
}
|
|
1676
1676
|
get shape() {
|
|
1677
1677
|
return this._def.shape();
|
|
@@ -1681,9 +1681,9 @@ class k extends _ {
|
|
|
1681
1681
|
...this._def,
|
|
1682
1682
|
unknownKeys: "strict",
|
|
1683
1683
|
...e !== void 0 ? {
|
|
1684
|
-
errorMap: (t,
|
|
1684
|
+
errorMap: (t, r) => {
|
|
1685
1685
|
var s, a, o, c;
|
|
1686
|
-
const d = (o = (a = (s = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(s, t,
|
|
1686
|
+
const d = (o = (a = (s = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(s, t, r).message) !== null && o !== void 0 ? o : r.defaultError;
|
|
1687
1687
|
return t.code === "unrecognized_keys" ? {
|
|
1688
1688
|
message: (c = p.errToObj(e).message) !== null && c !== void 0 ? c : d
|
|
1689
1689
|
} : {
|
|
@@ -1744,7 +1744,7 @@ class k extends _ {
|
|
|
1744
1744
|
...this._def.shape(),
|
|
1745
1745
|
...e._def.shape()
|
|
1746
1746
|
}),
|
|
1747
|
-
typeName:
|
|
1747
|
+
typeName: g.ZodObject
|
|
1748
1748
|
});
|
|
1749
1749
|
}
|
|
1750
1750
|
// merge<
|
|
@@ -1814,8 +1814,8 @@ class k extends _ {
|
|
|
1814
1814
|
}
|
|
1815
1815
|
pick(e) {
|
|
1816
1816
|
const t = {};
|
|
1817
|
-
return x.objectKeys(e).forEach((
|
|
1818
|
-
e[
|
|
1817
|
+
return x.objectKeys(e).forEach((r) => {
|
|
1818
|
+
e[r] && this.shape[r] && (t[r] = this.shape[r]);
|
|
1819
1819
|
}), new k({
|
|
1820
1820
|
...this._def,
|
|
1821
1821
|
shape: () => t
|
|
@@ -1823,8 +1823,8 @@ class k extends _ {
|
|
|
1823
1823
|
}
|
|
1824
1824
|
omit(e) {
|
|
1825
1825
|
const t = {};
|
|
1826
|
-
return x.objectKeys(this.shape).forEach((
|
|
1827
|
-
e[
|
|
1826
|
+
return x.objectKeys(this.shape).forEach((r) => {
|
|
1827
|
+
e[r] || (t[r] = this.shape[r]);
|
|
1828
1828
|
}), new k({
|
|
1829
1829
|
...this._def,
|
|
1830
1830
|
shape: () => t
|
|
@@ -1838,9 +1838,9 @@ class k extends _ {
|
|
|
1838
1838
|
}
|
|
1839
1839
|
partial(e) {
|
|
1840
1840
|
const t = {};
|
|
1841
|
-
return x.objectKeys(this.shape).forEach((
|
|
1842
|
-
const s = this.shape[
|
|
1843
|
-
e && !e[
|
|
1841
|
+
return x.objectKeys(this.shape).forEach((r) => {
|
|
1842
|
+
const s = this.shape[r];
|
|
1843
|
+
e && !e[r] ? t[r] = s : t[r] = s.optional();
|
|
1844
1844
|
}), new k({
|
|
1845
1845
|
...this._def,
|
|
1846
1846
|
shape: () => t
|
|
@@ -1848,14 +1848,14 @@ class k extends _ {
|
|
|
1848
1848
|
}
|
|
1849
1849
|
required(e) {
|
|
1850
1850
|
const t = {};
|
|
1851
|
-
return x.objectKeys(this.shape).forEach((
|
|
1852
|
-
if (e && !e[
|
|
1853
|
-
t[
|
|
1851
|
+
return x.objectKeys(this.shape).forEach((r) => {
|
|
1852
|
+
if (e && !e[r])
|
|
1853
|
+
t[r] = this.shape[r];
|
|
1854
1854
|
else {
|
|
1855
|
-
let a = this.shape[
|
|
1856
|
-
for (; a instanceof
|
|
1855
|
+
let a = this.shape[r];
|
|
1856
|
+
for (; a instanceof D; )
|
|
1857
1857
|
a = a._def.innerType;
|
|
1858
|
-
t[
|
|
1858
|
+
t[r] = a;
|
|
1859
1859
|
}
|
|
1860
1860
|
}), new k({
|
|
1861
1861
|
...this._def,
|
|
@@ -1863,33 +1863,33 @@ class k extends _ {
|
|
|
1863
1863
|
});
|
|
1864
1864
|
}
|
|
1865
1865
|
keyof() {
|
|
1866
|
-
return
|
|
1866
|
+
return qe(x.objectKeys(this.shape));
|
|
1867
1867
|
}
|
|
1868
1868
|
}
|
|
1869
|
-
k.create = (
|
|
1870
|
-
shape: () =>
|
|
1869
|
+
k.create = (n, e) => new k({
|
|
1870
|
+
shape: () => n,
|
|
1871
1871
|
unknownKeys: "strip",
|
|
1872
1872
|
catchall: $.create(),
|
|
1873
|
-
typeName:
|
|
1873
|
+
typeName: g.ZodObject,
|
|
1874
1874
|
...v(e)
|
|
1875
1875
|
});
|
|
1876
|
-
k.strictCreate = (
|
|
1877
|
-
shape: () =>
|
|
1876
|
+
k.strictCreate = (n, e) => new k({
|
|
1877
|
+
shape: () => n,
|
|
1878
1878
|
unknownKeys: "strict",
|
|
1879
1879
|
catchall: $.create(),
|
|
1880
|
-
typeName:
|
|
1880
|
+
typeName: g.ZodObject,
|
|
1881
1881
|
...v(e)
|
|
1882
1882
|
});
|
|
1883
|
-
k.lazycreate = (
|
|
1884
|
-
shape:
|
|
1883
|
+
k.lazycreate = (n, e) => new k({
|
|
1884
|
+
shape: n,
|
|
1885
1885
|
unknownKeys: "strip",
|
|
1886
1886
|
catchall: $.create(),
|
|
1887
|
-
typeName:
|
|
1887
|
+
typeName: g.ZodObject,
|
|
1888
1888
|
...v(e)
|
|
1889
1889
|
});
|
|
1890
1890
|
class oe extends _ {
|
|
1891
1891
|
_parse(e) {
|
|
1892
|
-
const { ctx: t } = this._processInputParams(e),
|
|
1892
|
+
const { ctx: t } = this._processInputParams(e), r = this._def.options;
|
|
1893
1893
|
function s(a) {
|
|
1894
1894
|
for (const c of a)
|
|
1895
1895
|
if (c.result.status === "valid")
|
|
@@ -1897,14 +1897,14 @@ class oe extends _ {
|
|
|
1897
1897
|
for (const c of a)
|
|
1898
1898
|
if (c.result.status === "dirty")
|
|
1899
1899
|
return t.common.issues.push(...c.ctx.common.issues), c.result;
|
|
1900
|
-
const o = a.map((c) => new
|
|
1900
|
+
const o = a.map((c) => new A(c.ctx.common.issues));
|
|
1901
1901
|
return f(t, {
|
|
1902
1902
|
code: u.invalid_union,
|
|
1903
1903
|
unionErrors: o
|
|
1904
|
-
}),
|
|
1904
|
+
}), y;
|
|
1905
1905
|
}
|
|
1906
1906
|
if (t.common.async)
|
|
1907
|
-
return Promise.all(
|
|
1907
|
+
return Promise.all(r.map(async (a) => {
|
|
1908
1908
|
const o = {
|
|
1909
1909
|
...t,
|
|
1910
1910
|
common: {
|
|
@@ -1925,7 +1925,7 @@ class oe extends _ {
|
|
|
1925
1925
|
{
|
|
1926
1926
|
let a;
|
|
1927
1927
|
const o = [];
|
|
1928
|
-
for (const d of
|
|
1928
|
+
for (const d of r) {
|
|
1929
1929
|
const l = {
|
|
1930
1930
|
...t,
|
|
1931
1931
|
common: {
|
|
@@ -1933,44 +1933,44 @@ class oe extends _ {
|
|
|
1933
1933
|
issues: []
|
|
1934
1934
|
},
|
|
1935
1935
|
parent: null
|
|
1936
|
-
},
|
|
1936
|
+
}, h = d._parseSync({
|
|
1937
1937
|
data: t.data,
|
|
1938
1938
|
path: t.path,
|
|
1939
1939
|
parent: l
|
|
1940
1940
|
});
|
|
1941
|
-
if (
|
|
1942
|
-
return
|
|
1943
|
-
|
|
1941
|
+
if (h.status === "valid")
|
|
1942
|
+
return h;
|
|
1943
|
+
h.status === "dirty" && !a && (a = { result: h, ctx: l }), l.common.issues.length && o.push(l.common.issues);
|
|
1944
1944
|
}
|
|
1945
1945
|
if (a)
|
|
1946
1946
|
return t.common.issues.push(...a.ctx.common.issues), a.result;
|
|
1947
|
-
const c = o.map((d) => new
|
|
1947
|
+
const c = o.map((d) => new A(d));
|
|
1948
1948
|
return f(t, {
|
|
1949
1949
|
code: u.invalid_union,
|
|
1950
1950
|
unionErrors: c
|
|
1951
|
-
}),
|
|
1951
|
+
}), y;
|
|
1952
1952
|
}
|
|
1953
1953
|
}
|
|
1954
1954
|
get options() {
|
|
1955
1955
|
return this._def.options;
|
|
1956
1956
|
}
|
|
1957
1957
|
}
|
|
1958
|
-
oe.create = (
|
|
1959
|
-
options:
|
|
1960
|
-
typeName:
|
|
1958
|
+
oe.create = (n, e) => new oe({
|
|
1959
|
+
options: n,
|
|
1960
|
+
typeName: g.ZodUnion,
|
|
1961
1961
|
...v(e)
|
|
1962
1962
|
});
|
|
1963
|
-
const P = (
|
|
1963
|
+
const P = (n) => n instanceof ue ? P(n.schema) : n instanceof O ? P(n.innerType()) : n instanceof le ? [n.value] : n instanceof U ? n.options : n instanceof fe ? x.objectValues(n.enum) : n instanceof me ? P(n._def.innerType) : n instanceof ae ? [void 0] : n instanceof ie ? [null] : n instanceof D ? [void 0, ...P(n.unwrap())] : n instanceof z ? [null, ...P(n.unwrap())] : n instanceof je || n instanceof pe ? P(n.unwrap()) : n instanceof he ? P(n._def.innerType) : [];
|
|
1964
1964
|
class Te extends _ {
|
|
1965
1965
|
_parse(e) {
|
|
1966
1966
|
const { ctx: t } = this._processInputParams(e);
|
|
1967
|
-
if (t.parsedType !==
|
|
1967
|
+
if (t.parsedType !== m.object)
|
|
1968
1968
|
return f(t, {
|
|
1969
1969
|
code: u.invalid_type,
|
|
1970
|
-
expected:
|
|
1970
|
+
expected: m.object,
|
|
1971
1971
|
received: t.parsedType
|
|
1972
|
-
}),
|
|
1973
|
-
const
|
|
1972
|
+
}), y;
|
|
1973
|
+
const r = this.discriminator, s = t.data[r], a = this.optionsMap.get(s);
|
|
1974
1974
|
return a ? t.common.async ? a._parseAsync({
|
|
1975
1975
|
data: t.data,
|
|
1976
1976
|
path: t.path,
|
|
@@ -1982,8 +1982,8 @@ class Te extends _ {
|
|
|
1982
1982
|
}) : (f(t, {
|
|
1983
1983
|
code: u.invalid_union_discriminator,
|
|
1984
1984
|
options: Array.from(this.optionsMap.keys()),
|
|
1985
|
-
path: [
|
|
1986
|
-
}),
|
|
1985
|
+
path: [r]
|
|
1986
|
+
}), y);
|
|
1987
1987
|
}
|
|
1988
1988
|
get discriminator() {
|
|
1989
1989
|
return this._def.discriminator;
|
|
@@ -2002,7 +2002,7 @@ class Te extends _ {
|
|
|
2002
2002
|
* @param types an array of object schemas
|
|
2003
2003
|
* @param params
|
|
2004
2004
|
*/
|
|
2005
|
-
static create(e, t,
|
|
2005
|
+
static create(e, t, r) {
|
|
2006
2006
|
const s = /* @__PURE__ */ new Map();
|
|
2007
2007
|
for (const a of t) {
|
|
2008
2008
|
const o = P(a.shape[e]);
|
|
@@ -2015,124 +2015,124 @@ class Te extends _ {
|
|
|
2015
2015
|
}
|
|
2016
2016
|
}
|
|
2017
2017
|
return new Te({
|
|
2018
|
-
typeName:
|
|
2018
|
+
typeName: g.ZodDiscriminatedUnion,
|
|
2019
2019
|
discriminator: e,
|
|
2020
2020
|
options: t,
|
|
2021
2021
|
optionsMap: s,
|
|
2022
|
-
...v(
|
|
2022
|
+
...v(r)
|
|
2023
2023
|
});
|
|
2024
2024
|
}
|
|
2025
2025
|
}
|
|
2026
|
-
function
|
|
2027
|
-
const t = R(
|
|
2028
|
-
if (
|
|
2029
|
-
return { valid: !0, data:
|
|
2030
|
-
if (t ===
|
|
2031
|
-
const s = x.objectKeys(e), a = x.objectKeys(
|
|
2026
|
+
function De(n, e) {
|
|
2027
|
+
const t = R(n), r = R(e);
|
|
2028
|
+
if (n === e)
|
|
2029
|
+
return { valid: !0, data: n };
|
|
2030
|
+
if (t === m.object && r === m.object) {
|
|
2031
|
+
const s = x.objectKeys(e), a = x.objectKeys(n).filter((c) => s.indexOf(c) !== -1), o = { ...n, ...e };
|
|
2032
2032
|
for (const c of a) {
|
|
2033
|
-
const d =
|
|
2033
|
+
const d = De(n[c], e[c]);
|
|
2034
2034
|
if (!d.valid)
|
|
2035
2035
|
return { valid: !1 };
|
|
2036
2036
|
o[c] = d.data;
|
|
2037
2037
|
}
|
|
2038
2038
|
return { valid: !0, data: o };
|
|
2039
|
-
} else if (t ===
|
|
2040
|
-
if (
|
|
2039
|
+
} else if (t === m.array && r === m.array) {
|
|
2040
|
+
if (n.length !== e.length)
|
|
2041
2041
|
return { valid: !1 };
|
|
2042
2042
|
const s = [];
|
|
2043
|
-
for (let a = 0; a <
|
|
2044
|
-
const o =
|
|
2043
|
+
for (let a = 0; a < n.length; a++) {
|
|
2044
|
+
const o = n[a], c = e[a], d = De(o, c);
|
|
2045
2045
|
if (!d.valid)
|
|
2046
2046
|
return { valid: !1 };
|
|
2047
2047
|
s.push(d.data);
|
|
2048
2048
|
}
|
|
2049
2049
|
return { valid: !0, data: s };
|
|
2050
|
-
} else return t ===
|
|
2050
|
+
} else return t === m.date && r === m.date && +n == +e ? { valid: !0, data: n } : { valid: !1 };
|
|
2051
2051
|
}
|
|
2052
2052
|
class ce extends _ {
|
|
2053
2053
|
_parse(e) {
|
|
2054
|
-
const { status: t, ctx:
|
|
2054
|
+
const { status: t, ctx: r } = this._processInputParams(e), s = (a, o) => {
|
|
2055
2055
|
if (Ze(a) || Ze(o))
|
|
2056
|
-
return
|
|
2057
|
-
const c =
|
|
2058
|
-
return c.valid ? ((Oe(a) || Oe(o)) && t.dirty(), { status: t.value, value: c.data }) : (f(
|
|
2056
|
+
return y;
|
|
2057
|
+
const c = De(a.value, o.value);
|
|
2058
|
+
return c.valid ? ((Oe(a) || Oe(o)) && t.dirty(), { status: t.value, value: c.data }) : (f(r, {
|
|
2059
2059
|
code: u.invalid_intersection_types
|
|
2060
|
-
}),
|
|
2060
|
+
}), y);
|
|
2061
2061
|
};
|
|
2062
|
-
return
|
|
2062
|
+
return r.common.async ? Promise.all([
|
|
2063
2063
|
this._def.left._parseAsync({
|
|
2064
|
-
data:
|
|
2065
|
-
path:
|
|
2066
|
-
parent:
|
|
2064
|
+
data: r.data,
|
|
2065
|
+
path: r.path,
|
|
2066
|
+
parent: r
|
|
2067
2067
|
}),
|
|
2068
2068
|
this._def.right._parseAsync({
|
|
2069
|
-
data:
|
|
2070
|
-
path:
|
|
2071
|
-
parent:
|
|
2069
|
+
data: r.data,
|
|
2070
|
+
path: r.path,
|
|
2071
|
+
parent: r
|
|
2072
2072
|
})
|
|
2073
2073
|
]).then(([a, o]) => s(a, o)) : s(this._def.left._parseSync({
|
|
2074
|
-
data:
|
|
2075
|
-
path:
|
|
2076
|
-
parent:
|
|
2074
|
+
data: r.data,
|
|
2075
|
+
path: r.path,
|
|
2076
|
+
parent: r
|
|
2077
2077
|
}), this._def.right._parseSync({
|
|
2078
|
-
data:
|
|
2079
|
-
path:
|
|
2080
|
-
parent:
|
|
2078
|
+
data: r.data,
|
|
2079
|
+
path: r.path,
|
|
2080
|
+
parent: r
|
|
2081
2081
|
}));
|
|
2082
2082
|
}
|
|
2083
2083
|
}
|
|
2084
|
-
ce.create = (
|
|
2085
|
-
left:
|
|
2084
|
+
ce.create = (n, e, t) => new ce({
|
|
2085
|
+
left: n,
|
|
2086
2086
|
right: e,
|
|
2087
|
-
typeName:
|
|
2087
|
+
typeName: g.ZodIntersection,
|
|
2088
2088
|
...v(t)
|
|
2089
2089
|
});
|
|
2090
|
-
class
|
|
2090
|
+
class E extends _ {
|
|
2091
2091
|
_parse(e) {
|
|
2092
|
-
const { status: t, ctx:
|
|
2093
|
-
if (
|
|
2094
|
-
return f(
|
|
2092
|
+
const { status: t, ctx: r } = this._processInputParams(e);
|
|
2093
|
+
if (r.parsedType !== m.array)
|
|
2094
|
+
return f(r, {
|
|
2095
2095
|
code: u.invalid_type,
|
|
2096
|
-
expected:
|
|
2097
|
-
received:
|
|
2098
|
-
}),
|
|
2099
|
-
if (
|
|
2100
|
-
return f(
|
|
2096
|
+
expected: m.array,
|
|
2097
|
+
received: r.parsedType
|
|
2098
|
+
}), y;
|
|
2099
|
+
if (r.data.length < this._def.items.length)
|
|
2100
|
+
return f(r, {
|
|
2101
2101
|
code: u.too_small,
|
|
2102
2102
|
minimum: this._def.items.length,
|
|
2103
2103
|
inclusive: !0,
|
|
2104
2104
|
exact: !1,
|
|
2105
2105
|
type: "array"
|
|
2106
|
-
}),
|
|
2107
|
-
!this._def.rest &&
|
|
2106
|
+
}), y;
|
|
2107
|
+
!this._def.rest && r.data.length > this._def.items.length && (f(r, {
|
|
2108
2108
|
code: u.too_big,
|
|
2109
2109
|
maximum: this._def.items.length,
|
|
2110
2110
|
inclusive: !0,
|
|
2111
2111
|
exact: !1,
|
|
2112
2112
|
type: "array"
|
|
2113
2113
|
}), t.dirty());
|
|
2114
|
-
const a = [...
|
|
2114
|
+
const a = [...r.data].map((o, c) => {
|
|
2115
2115
|
const d = this._def.items[c] || this._def.rest;
|
|
2116
|
-
return d ? d._parse(new
|
|
2116
|
+
return d ? d._parse(new j(r, o, r.path, c)) : null;
|
|
2117
2117
|
}).filter((o) => !!o);
|
|
2118
|
-
return
|
|
2118
|
+
return r.common.async ? Promise.all(a).then((o) => T.mergeArray(t, o)) : T.mergeArray(t, a);
|
|
2119
2119
|
}
|
|
2120
2120
|
get items() {
|
|
2121
2121
|
return this._def.items;
|
|
2122
2122
|
}
|
|
2123
2123
|
rest(e) {
|
|
2124
|
-
return new
|
|
2124
|
+
return new E({
|
|
2125
2125
|
...this._def,
|
|
2126
2126
|
rest: e
|
|
2127
2127
|
});
|
|
2128
2128
|
}
|
|
2129
2129
|
}
|
|
2130
|
-
|
|
2131
|
-
if (!Array.isArray(
|
|
2130
|
+
E.create = (n, e) => {
|
|
2131
|
+
if (!Array.isArray(n))
|
|
2132
2132
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2133
|
-
return new
|
|
2134
|
-
items:
|
|
2135
|
-
typeName:
|
|
2133
|
+
return new E({
|
|
2134
|
+
items: n,
|
|
2135
|
+
typeName: g.ZodTuple,
|
|
2136
2136
|
rest: null,
|
|
2137
2137
|
...v(e)
|
|
2138
2138
|
});
|
|
@@ -2145,35 +2145,35 @@ class de extends _ {
|
|
|
2145
2145
|
return this._def.valueType;
|
|
2146
2146
|
}
|
|
2147
2147
|
_parse(e) {
|
|
2148
|
-
const { status: t, ctx:
|
|
2149
|
-
if (
|
|
2150
|
-
return f(
|
|
2148
|
+
const { status: t, ctx: r } = this._processInputParams(e);
|
|
2149
|
+
if (r.parsedType !== m.object)
|
|
2150
|
+
return f(r, {
|
|
2151
2151
|
code: u.invalid_type,
|
|
2152
|
-
expected:
|
|
2153
|
-
received:
|
|
2154
|
-
}),
|
|
2152
|
+
expected: m.object,
|
|
2153
|
+
received: r.parsedType
|
|
2154
|
+
}), y;
|
|
2155
2155
|
const s = [], a = this._def.keyType, o = this._def.valueType;
|
|
2156
|
-
for (const c in
|
|
2156
|
+
for (const c in r.data)
|
|
2157
2157
|
s.push({
|
|
2158
|
-
key: a._parse(new
|
|
2159
|
-
value: o._parse(new
|
|
2160
|
-
alwaysSet: c in
|
|
2158
|
+
key: a._parse(new j(r, c, r.path, c)),
|
|
2159
|
+
value: o._parse(new j(r, r.data[c], r.path, c)),
|
|
2160
|
+
alwaysSet: c in r.data
|
|
2161
2161
|
});
|
|
2162
|
-
return
|
|
2162
|
+
return r.common.async ? T.mergeObjectAsync(t, s) : T.mergeObjectSync(t, s);
|
|
2163
2163
|
}
|
|
2164
2164
|
get element() {
|
|
2165
2165
|
return this._def.valueType;
|
|
2166
2166
|
}
|
|
2167
|
-
static create(e, t,
|
|
2167
|
+
static create(e, t, r) {
|
|
2168
2168
|
return t instanceof _ ? new de({
|
|
2169
2169
|
keyType: e,
|
|
2170
2170
|
valueType: t,
|
|
2171
|
-
typeName:
|
|
2172
|
-
...v(
|
|
2171
|
+
typeName: g.ZodRecord,
|
|
2172
|
+
...v(r)
|
|
2173
2173
|
}) : new de({
|
|
2174
2174
|
keyType: N.create(),
|
|
2175
2175
|
valueType: e,
|
|
2176
|
-
typeName:
|
|
2176
|
+
typeName: g.ZodRecord,
|
|
2177
2177
|
...v(t)
|
|
2178
2178
|
});
|
|
2179
2179
|
}
|
|
@@ -2186,64 +2186,64 @@ class ke extends _ {
|
|
|
2186
2186
|
return this._def.valueType;
|
|
2187
2187
|
}
|
|
2188
2188
|
_parse(e) {
|
|
2189
|
-
const { status: t, ctx:
|
|
2190
|
-
if (
|
|
2191
|
-
return f(
|
|
2189
|
+
const { status: t, ctx: r } = this._processInputParams(e);
|
|
2190
|
+
if (r.parsedType !== m.map)
|
|
2191
|
+
return f(r, {
|
|
2192
2192
|
code: u.invalid_type,
|
|
2193
|
-
expected:
|
|
2194
|
-
received:
|
|
2195
|
-
}),
|
|
2196
|
-
const s = this._def.keyType, a = this._def.valueType, o = [...
|
|
2197
|
-
key: s._parse(new
|
|
2198
|
-
value: a._parse(new
|
|
2193
|
+
expected: m.map,
|
|
2194
|
+
received: r.parsedType
|
|
2195
|
+
}), y;
|
|
2196
|
+
const s = this._def.keyType, a = this._def.valueType, o = [...r.data.entries()].map(([c, d], l) => ({
|
|
2197
|
+
key: s._parse(new j(r, c, r.path, [l, "key"])),
|
|
2198
|
+
value: a._parse(new j(r, d, r.path, [l, "value"]))
|
|
2199
2199
|
}));
|
|
2200
|
-
if (
|
|
2200
|
+
if (r.common.async) {
|
|
2201
2201
|
const c = /* @__PURE__ */ new Map();
|
|
2202
2202
|
return Promise.resolve().then(async () => {
|
|
2203
2203
|
for (const d of o) {
|
|
2204
|
-
const l = await d.key,
|
|
2205
|
-
if (l.status === "aborted" ||
|
|
2206
|
-
return
|
|
2207
|
-
(l.status === "dirty" ||
|
|
2204
|
+
const l = await d.key, h = await d.value;
|
|
2205
|
+
if (l.status === "aborted" || h.status === "aborted")
|
|
2206
|
+
return y;
|
|
2207
|
+
(l.status === "dirty" || h.status === "dirty") && t.dirty(), c.set(l.value, h.value);
|
|
2208
2208
|
}
|
|
2209
2209
|
return { status: t.value, value: c };
|
|
2210
2210
|
});
|
|
2211
2211
|
} else {
|
|
2212
2212
|
const c = /* @__PURE__ */ new Map();
|
|
2213
2213
|
for (const d of o) {
|
|
2214
|
-
const l = d.key,
|
|
2215
|
-
if (l.status === "aborted" ||
|
|
2216
|
-
return
|
|
2217
|
-
(l.status === "dirty" ||
|
|
2214
|
+
const l = d.key, h = d.value;
|
|
2215
|
+
if (l.status === "aborted" || h.status === "aborted")
|
|
2216
|
+
return y;
|
|
2217
|
+
(l.status === "dirty" || h.status === "dirty") && t.dirty(), c.set(l.value, h.value);
|
|
2218
2218
|
}
|
|
2219
2219
|
return { status: t.value, value: c };
|
|
2220
2220
|
}
|
|
2221
2221
|
}
|
|
2222
2222
|
}
|
|
2223
|
-
ke.create = (
|
|
2223
|
+
ke.create = (n, e, t) => new ke({
|
|
2224
2224
|
valueType: e,
|
|
2225
|
-
keyType:
|
|
2226
|
-
typeName:
|
|
2225
|
+
keyType: n,
|
|
2226
|
+
typeName: g.ZodMap,
|
|
2227
2227
|
...v(t)
|
|
2228
2228
|
});
|
|
2229
2229
|
class W extends _ {
|
|
2230
2230
|
_parse(e) {
|
|
2231
|
-
const { status: t, ctx:
|
|
2232
|
-
if (
|
|
2233
|
-
return f(
|
|
2231
|
+
const { status: t, ctx: r } = this._processInputParams(e);
|
|
2232
|
+
if (r.parsedType !== m.set)
|
|
2233
|
+
return f(r, {
|
|
2234
2234
|
code: u.invalid_type,
|
|
2235
|
-
expected:
|
|
2236
|
-
received:
|
|
2237
|
-
}),
|
|
2235
|
+
expected: m.set,
|
|
2236
|
+
received: r.parsedType
|
|
2237
|
+
}), y;
|
|
2238
2238
|
const s = this._def;
|
|
2239
|
-
s.minSize !== null &&
|
|
2239
|
+
s.minSize !== null && r.data.size < s.minSize.value && (f(r, {
|
|
2240
2240
|
code: u.too_small,
|
|
2241
2241
|
minimum: s.minSize.value,
|
|
2242
2242
|
type: "set",
|
|
2243
2243
|
inclusive: !0,
|
|
2244
2244
|
exact: !1,
|
|
2245
2245
|
message: s.minSize.message
|
|
2246
|
-
}), t.dirty()), s.maxSize !== null &&
|
|
2246
|
+
}), t.dirty()), s.maxSize !== null && r.data.size > s.maxSize.value && (f(r, {
|
|
2247
2247
|
code: u.too_big,
|
|
2248
2248
|
maximum: s.maxSize.value,
|
|
2249
2249
|
type: "set",
|
|
@@ -2254,15 +2254,15 @@ class W extends _ {
|
|
|
2254
2254
|
const a = this._def.valueType;
|
|
2255
2255
|
function o(d) {
|
|
2256
2256
|
const l = /* @__PURE__ */ new Set();
|
|
2257
|
-
for (const
|
|
2258
|
-
if (
|
|
2259
|
-
return
|
|
2260
|
-
|
|
2257
|
+
for (const h of d) {
|
|
2258
|
+
if (h.status === "aborted")
|
|
2259
|
+
return y;
|
|
2260
|
+
h.status === "dirty" && t.dirty(), l.add(h.value);
|
|
2261
2261
|
}
|
|
2262
2262
|
return { status: t.value, value: l };
|
|
2263
2263
|
}
|
|
2264
|
-
const c = [...
|
|
2265
|
-
return
|
|
2264
|
+
const c = [...r.data.values()].map((d, l) => a._parse(new j(r, d, r.path, l)));
|
|
2265
|
+
return r.common.async ? Promise.all(c).then((d) => o(d)) : o(c);
|
|
2266
2266
|
}
|
|
2267
2267
|
min(e, t) {
|
|
2268
2268
|
return new W({
|
|
@@ -2283,11 +2283,11 @@ class W extends _ {
|
|
|
2283
2283
|
return this.min(1, e);
|
|
2284
2284
|
}
|
|
2285
2285
|
}
|
|
2286
|
-
W.create = (
|
|
2287
|
-
valueType:
|
|
2286
|
+
W.create = (n, e) => new W({
|
|
2287
|
+
valueType: n,
|
|
2288
2288
|
minSize: null,
|
|
2289
2289
|
maxSize: null,
|
|
2290
|
-
typeName:
|
|
2290
|
+
typeName: g.ZodSet,
|
|
2291
2291
|
...v(e)
|
|
2292
2292
|
});
|
|
2293
2293
|
class J extends _ {
|
|
@@ -2296,20 +2296,20 @@ class J extends _ {
|
|
|
2296
2296
|
}
|
|
2297
2297
|
_parse(e) {
|
|
2298
2298
|
const { ctx: t } = this._processInputParams(e);
|
|
2299
|
-
if (t.parsedType !==
|
|
2299
|
+
if (t.parsedType !== m.function)
|
|
2300
2300
|
return f(t, {
|
|
2301
2301
|
code: u.invalid_type,
|
|
2302
|
-
expected:
|
|
2302
|
+
expected: m.function,
|
|
2303
2303
|
received: t.parsedType
|
|
2304
|
-
}),
|
|
2305
|
-
function
|
|
2304
|
+
}), y;
|
|
2305
|
+
function r(c, d) {
|
|
2306
2306
|
return ve({
|
|
2307
2307
|
data: c,
|
|
2308
2308
|
path: t.path,
|
|
2309
2309
|
errorMaps: [
|
|
2310
2310
|
t.common.contextualErrorMap,
|
|
2311
2311
|
t.schemaErrorMap,
|
|
2312
|
-
|
|
2312
|
+
ye(),
|
|
2313
2313
|
X
|
|
2314
2314
|
].filter((l) => !!l),
|
|
2315
2315
|
issueData: {
|
|
@@ -2325,7 +2325,7 @@ class J extends _ {
|
|
|
2325
2325
|
errorMaps: [
|
|
2326
2326
|
t.common.contextualErrorMap,
|
|
2327
2327
|
t.schemaErrorMap,
|
|
2328
|
-
|
|
2328
|
+
ye(),
|
|
2329
2329
|
X
|
|
2330
2330
|
].filter((l) => !!l),
|
|
2331
2331
|
issueData: {
|
|
@@ -2338,9 +2338,9 @@ class J extends _ {
|
|
|
2338
2338
|
if (this._def.returns instanceof G) {
|
|
2339
2339
|
const c = this;
|
|
2340
2340
|
return I(async function(...d) {
|
|
2341
|
-
const l = new
|
|
2342
|
-
throw l.addIssue(
|
|
2343
|
-
}), b = await Reflect.apply(o, this,
|
|
2341
|
+
const l = new A([]), h = await c._def.args.parseAsync(d, a).catch((S) => {
|
|
2342
|
+
throw l.addIssue(r(d, S)), l;
|
|
2343
|
+
}), b = await Reflect.apply(o, this, h);
|
|
2344
2344
|
return await c._def.returns._def.type.parseAsync(b, a).catch((S) => {
|
|
2345
2345
|
throw l.addIssue(s(b, S)), l;
|
|
2346
2346
|
});
|
|
@@ -2350,10 +2350,10 @@ class J extends _ {
|
|
|
2350
2350
|
return I(function(...d) {
|
|
2351
2351
|
const l = c._def.args.safeParse(d, a);
|
|
2352
2352
|
if (!l.success)
|
|
2353
|
-
throw new
|
|
2354
|
-
const
|
|
2353
|
+
throw new A([r(d, l.error)]);
|
|
2354
|
+
const h = Reflect.apply(o, this, l.data), b = c._def.returns.safeParse(h, a);
|
|
2355
2355
|
if (!b.success)
|
|
2356
|
-
throw new
|
|
2356
|
+
throw new A([s(h, b.error)]);
|
|
2357
2357
|
return b.data;
|
|
2358
2358
|
});
|
|
2359
2359
|
}
|
|
@@ -2367,7 +2367,7 @@ class J extends _ {
|
|
|
2367
2367
|
args(...e) {
|
|
2368
2368
|
return new J({
|
|
2369
2369
|
...this._def,
|
|
2370
|
-
args:
|
|
2370
|
+
args: E.create(e).rest(L.create())
|
|
2371
2371
|
});
|
|
2372
2372
|
}
|
|
2373
2373
|
returns(e) {
|
|
@@ -2382,12 +2382,12 @@ class J extends _ {
|
|
|
2382
2382
|
strictImplement(e) {
|
|
2383
2383
|
return this.parse(e);
|
|
2384
2384
|
}
|
|
2385
|
-
static create(e, t,
|
|
2385
|
+
static create(e, t, r) {
|
|
2386
2386
|
return new J({
|
|
2387
|
-
args: e ||
|
|
2388
|
-
returns: t ||
|
|
2389
|
-
typeName:
|
|
2390
|
-
...v(
|
|
2387
|
+
args: e || E.create([]).rest(L.create()),
|
|
2388
|
+
returns: t || L.create(),
|
|
2389
|
+
typeName: g.ZodFunction,
|
|
2390
|
+
...v(r)
|
|
2391
2391
|
});
|
|
2392
2392
|
}
|
|
2393
2393
|
}
|
|
@@ -2400,9 +2400,9 @@ class ue extends _ {
|
|
|
2400
2400
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
2401
2401
|
}
|
|
2402
2402
|
}
|
|
2403
|
-
ue.create = (
|
|
2404
|
-
getter:
|
|
2405
|
-
typeName:
|
|
2403
|
+
ue.create = (n, e) => new ue({
|
|
2404
|
+
getter: n,
|
|
2405
|
+
typeName: g.ZodLazy,
|
|
2406
2406
|
...v(e)
|
|
2407
2407
|
});
|
|
2408
2408
|
class le extends _ {
|
|
@@ -2413,7 +2413,7 @@ class le extends _ {
|
|
|
2413
2413
|
received: t.data,
|
|
2414
2414
|
code: u.invalid_literal,
|
|
2415
2415
|
expected: this._def.value
|
|
2416
|
-
}),
|
|
2416
|
+
}), y;
|
|
2417
2417
|
}
|
|
2418
2418
|
return { status: "valid", value: e.data };
|
|
2419
2419
|
}
|
|
@@ -2421,38 +2421,38 @@ class le extends _ {
|
|
|
2421
2421
|
return this._def.value;
|
|
2422
2422
|
}
|
|
2423
2423
|
}
|
|
2424
|
-
le.create = (
|
|
2425
|
-
value:
|
|
2426
|
-
typeName:
|
|
2424
|
+
le.create = (n, e) => new le({
|
|
2425
|
+
value: n,
|
|
2426
|
+
typeName: g.ZodLiteral,
|
|
2427
2427
|
...v(e)
|
|
2428
2428
|
});
|
|
2429
|
-
function
|
|
2430
|
-
return new
|
|
2431
|
-
values:
|
|
2432
|
-
typeName:
|
|
2429
|
+
function qe(n, e) {
|
|
2430
|
+
return new U({
|
|
2431
|
+
values: n,
|
|
2432
|
+
typeName: g.ZodEnum,
|
|
2433
2433
|
...v(e)
|
|
2434
2434
|
});
|
|
2435
2435
|
}
|
|
2436
|
-
class
|
|
2436
|
+
class U extends _ {
|
|
2437
2437
|
constructor() {
|
|
2438
2438
|
super(...arguments), ee.set(this, void 0);
|
|
2439
2439
|
}
|
|
2440
2440
|
_parse(e) {
|
|
2441
2441
|
if (typeof e.data != "string") {
|
|
2442
|
-
const t = this._getOrReturnCtx(e),
|
|
2442
|
+
const t = this._getOrReturnCtx(e), r = this._def.values;
|
|
2443
2443
|
return f(t, {
|
|
2444
|
-
expected: x.joinValues(
|
|
2444
|
+
expected: x.joinValues(r),
|
|
2445
2445
|
received: t.parsedType,
|
|
2446
2446
|
code: u.invalid_type
|
|
2447
|
-
}),
|
|
2447
|
+
}), y;
|
|
2448
2448
|
}
|
|
2449
|
-
if (_e(this, ee) ||
|
|
2450
|
-
const t = this._getOrReturnCtx(e),
|
|
2449
|
+
if (_e(this, ee) || Ue(this, ee, new Set(this._def.values)), !_e(this, ee).has(e.data)) {
|
|
2450
|
+
const t = this._getOrReturnCtx(e), r = this._def.values;
|
|
2451
2451
|
return f(t, {
|
|
2452
2452
|
received: t.data,
|
|
2453
2453
|
code: u.invalid_enum_value,
|
|
2454
|
-
options:
|
|
2455
|
-
}),
|
|
2454
|
+
options: r
|
|
2455
|
+
}), y;
|
|
2456
2456
|
}
|
|
2457
2457
|
return I(e.data);
|
|
2458
2458
|
}
|
|
@@ -2478,41 +2478,41 @@ class z extends _ {
|
|
|
2478
2478
|
return e;
|
|
2479
2479
|
}
|
|
2480
2480
|
extract(e, t = this._def) {
|
|
2481
|
-
return
|
|
2481
|
+
return U.create(e, {
|
|
2482
2482
|
...this._def,
|
|
2483
2483
|
...t
|
|
2484
2484
|
});
|
|
2485
2485
|
}
|
|
2486
2486
|
exclude(e, t = this._def) {
|
|
2487
|
-
return
|
|
2487
|
+
return U.create(this.options.filter((r) => !e.includes(r)), {
|
|
2488
2488
|
...this._def,
|
|
2489
2489
|
...t
|
|
2490
2490
|
});
|
|
2491
2491
|
}
|
|
2492
2492
|
}
|
|
2493
2493
|
ee = /* @__PURE__ */ new WeakMap();
|
|
2494
|
-
|
|
2494
|
+
U.create = qe;
|
|
2495
2495
|
class fe extends _ {
|
|
2496
2496
|
constructor() {
|
|
2497
2497
|
super(...arguments), te.set(this, void 0);
|
|
2498
2498
|
}
|
|
2499
2499
|
_parse(e) {
|
|
2500
|
-
const t = x.getValidEnumValues(this._def.values),
|
|
2501
|
-
if (
|
|
2500
|
+
const t = x.getValidEnumValues(this._def.values), r = this._getOrReturnCtx(e);
|
|
2501
|
+
if (r.parsedType !== m.string && r.parsedType !== m.number) {
|
|
2502
2502
|
const s = x.objectValues(t);
|
|
2503
|
-
return f(
|
|
2503
|
+
return f(r, {
|
|
2504
2504
|
expected: x.joinValues(s),
|
|
2505
|
-
received:
|
|
2505
|
+
received: r.parsedType,
|
|
2506
2506
|
code: u.invalid_type
|
|
2507
|
-
}),
|
|
2507
|
+
}), y;
|
|
2508
2508
|
}
|
|
2509
|
-
if (_e(this, te) ||
|
|
2509
|
+
if (_e(this, te) || Ue(this, te, new Set(x.getValidEnumValues(this._def.values))), !_e(this, te).has(e.data)) {
|
|
2510
2510
|
const s = x.objectValues(t);
|
|
2511
|
-
return f(
|
|
2512
|
-
received:
|
|
2511
|
+
return f(r, {
|
|
2512
|
+
received: r.data,
|
|
2513
2513
|
code: u.invalid_enum_value,
|
|
2514
2514
|
options: s
|
|
2515
|
-
}),
|
|
2515
|
+
}), y;
|
|
2516
2516
|
}
|
|
2517
2517
|
return I(e.data);
|
|
2518
2518
|
}
|
|
@@ -2521,9 +2521,9 @@ class fe extends _ {
|
|
|
2521
2521
|
}
|
|
2522
2522
|
}
|
|
2523
2523
|
te = /* @__PURE__ */ new WeakMap();
|
|
2524
|
-
fe.create = (
|
|
2525
|
-
values:
|
|
2526
|
-
typeName:
|
|
2524
|
+
fe.create = (n, e) => new fe({
|
|
2525
|
+
values: n,
|
|
2526
|
+
typeName: g.ZodNativeEnum,
|
|
2527
2527
|
...v(e)
|
|
2528
2528
|
});
|
|
2529
2529
|
class G extends _ {
|
|
@@ -2532,22 +2532,22 @@ class G extends _ {
|
|
|
2532
2532
|
}
|
|
2533
2533
|
_parse(e) {
|
|
2534
2534
|
const { ctx: t } = this._processInputParams(e);
|
|
2535
|
-
if (t.parsedType !==
|
|
2535
|
+
if (t.parsedType !== m.promise && t.common.async === !1)
|
|
2536
2536
|
return f(t, {
|
|
2537
2537
|
code: u.invalid_type,
|
|
2538
|
-
expected:
|
|
2538
|
+
expected: m.promise,
|
|
2539
2539
|
received: t.parsedType
|
|
2540
|
-
}),
|
|
2541
|
-
const
|
|
2542
|
-
return I(
|
|
2540
|
+
}), y;
|
|
2541
|
+
const r = t.parsedType === m.promise ? t.data : Promise.resolve(t.data);
|
|
2542
|
+
return I(r.then((s) => this._def.type.parseAsync(s, {
|
|
2543
2543
|
path: t.path,
|
|
2544
2544
|
errorMap: t.common.contextualErrorMap
|
|
2545
2545
|
})));
|
|
2546
2546
|
}
|
|
2547
2547
|
}
|
|
2548
|
-
G.create = (
|
|
2549
|
-
type:
|
|
2550
|
-
typeName:
|
|
2548
|
+
G.create = (n, e) => new G({
|
|
2549
|
+
type: n,
|
|
2550
|
+
typeName: g.ZodPromise,
|
|
2551
2551
|
...v(e)
|
|
2552
2552
|
});
|
|
2553
2553
|
class O extends _ {
|
|
@@ -2555,66 +2555,66 @@ class O extends _ {
|
|
|
2555
2555
|
return this._def.schema;
|
|
2556
2556
|
}
|
|
2557
2557
|
sourceType() {
|
|
2558
|
-
return this._def.schema._def.typeName ===
|
|
2558
|
+
return this._def.schema._def.typeName === g.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
2559
2559
|
}
|
|
2560
2560
|
_parse(e) {
|
|
2561
|
-
const { status: t, ctx:
|
|
2561
|
+
const { status: t, ctx: r } = this._processInputParams(e), s = this._def.effect || null, a = {
|
|
2562
2562
|
addIssue: (o) => {
|
|
2563
|
-
f(
|
|
2563
|
+
f(r, o), o.fatal ? t.abort() : t.dirty();
|
|
2564
2564
|
},
|
|
2565
2565
|
get path() {
|
|
2566
|
-
return
|
|
2566
|
+
return r.path;
|
|
2567
2567
|
}
|
|
2568
2568
|
};
|
|
2569
2569
|
if (a.addIssue = a.addIssue.bind(a), s.type === "preprocess") {
|
|
2570
|
-
const o = s.transform(
|
|
2571
|
-
if (
|
|
2570
|
+
const o = s.transform(r.data, a);
|
|
2571
|
+
if (r.common.async)
|
|
2572
2572
|
return Promise.resolve(o).then(async (c) => {
|
|
2573
2573
|
if (t.value === "aborted")
|
|
2574
|
-
return
|
|
2574
|
+
return y;
|
|
2575
2575
|
const d = await this._def.schema._parseAsync({
|
|
2576
2576
|
data: c,
|
|
2577
|
-
path:
|
|
2578
|
-
parent:
|
|
2577
|
+
path: r.path,
|
|
2578
|
+
parent: r
|
|
2579
2579
|
});
|
|
2580
|
-
return d.status === "aborted" ?
|
|
2580
|
+
return d.status === "aborted" ? y : d.status === "dirty" || t.value === "dirty" ? Y(d.value) : d;
|
|
2581
2581
|
});
|
|
2582
2582
|
{
|
|
2583
2583
|
if (t.value === "aborted")
|
|
2584
|
-
return
|
|
2584
|
+
return y;
|
|
2585
2585
|
const c = this._def.schema._parseSync({
|
|
2586
2586
|
data: o,
|
|
2587
|
-
path:
|
|
2588
|
-
parent:
|
|
2587
|
+
path: r.path,
|
|
2588
|
+
parent: r
|
|
2589
2589
|
});
|
|
2590
|
-
return c.status === "aborted" ?
|
|
2590
|
+
return c.status === "aborted" ? y : c.status === "dirty" || t.value === "dirty" ? Y(c.value) : c;
|
|
2591
2591
|
}
|
|
2592
2592
|
}
|
|
2593
2593
|
if (s.type === "refinement") {
|
|
2594
2594
|
const o = (c) => {
|
|
2595
2595
|
const d = s.refinement(c, a);
|
|
2596
|
-
if (
|
|
2596
|
+
if (r.common.async)
|
|
2597
2597
|
return Promise.resolve(d);
|
|
2598
2598
|
if (d instanceof Promise)
|
|
2599
2599
|
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2600
2600
|
return c;
|
|
2601
2601
|
};
|
|
2602
|
-
if (
|
|
2602
|
+
if (r.common.async === !1) {
|
|
2603
2603
|
const c = this._def.schema._parseSync({
|
|
2604
|
-
data:
|
|
2605
|
-
path:
|
|
2606
|
-
parent:
|
|
2604
|
+
data: r.data,
|
|
2605
|
+
path: r.path,
|
|
2606
|
+
parent: r
|
|
2607
2607
|
});
|
|
2608
|
-
return c.status === "aborted" ?
|
|
2608
|
+
return c.status === "aborted" ? y : (c.status === "dirty" && t.dirty(), o(c.value), { status: t.value, value: c.value });
|
|
2609
2609
|
} else
|
|
2610
|
-
return this._def.schema._parseAsync({ data:
|
|
2610
|
+
return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((c) => c.status === "aborted" ? y : (c.status === "dirty" && t.dirty(), o(c.value).then(() => ({ status: t.value, value: c.value }))));
|
|
2611
2611
|
}
|
|
2612
2612
|
if (s.type === "transform")
|
|
2613
|
-
if (
|
|
2613
|
+
if (r.common.async === !1) {
|
|
2614
2614
|
const o = this._def.schema._parseSync({
|
|
2615
|
-
data:
|
|
2616
|
-
path:
|
|
2617
|
-
parent:
|
|
2615
|
+
data: r.data,
|
|
2616
|
+
path: r.path,
|
|
2617
|
+
parent: r
|
|
2618
2618
|
});
|
|
2619
2619
|
if (!B(o))
|
|
2620
2620
|
return o;
|
|
@@ -2623,54 +2623,54 @@ class O extends _ {
|
|
|
2623
2623
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2624
2624
|
return { status: t.value, value: c };
|
|
2625
2625
|
} else
|
|
2626
|
-
return this._def.schema._parseAsync({ data:
|
|
2626
|
+
return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((o) => B(o) ? Promise.resolve(s.transform(o.value, a)).then((c) => ({ status: t.value, value: c })) : o);
|
|
2627
2627
|
x.assertNever(s);
|
|
2628
2628
|
}
|
|
2629
2629
|
}
|
|
2630
|
-
O.create = (
|
|
2631
|
-
schema:
|
|
2632
|
-
typeName:
|
|
2630
|
+
O.create = (n, e, t) => new O({
|
|
2631
|
+
schema: n,
|
|
2632
|
+
typeName: g.ZodEffects,
|
|
2633
2633
|
effect: e,
|
|
2634
2634
|
...v(t)
|
|
2635
2635
|
});
|
|
2636
|
-
O.createWithPreprocess = (
|
|
2636
|
+
O.createWithPreprocess = (n, e, t) => new O({
|
|
2637
2637
|
schema: e,
|
|
2638
|
-
effect: { type: "preprocess", transform:
|
|
2639
|
-
typeName:
|
|
2638
|
+
effect: { type: "preprocess", transform: n },
|
|
2639
|
+
typeName: g.ZodEffects,
|
|
2640
2640
|
...v(t)
|
|
2641
2641
|
});
|
|
2642
|
-
class
|
|
2642
|
+
class D extends _ {
|
|
2643
2643
|
_parse(e) {
|
|
2644
|
-
return this._getType(e) ===
|
|
2644
|
+
return this._getType(e) === m.undefined ? I(void 0) : this._def.innerType._parse(e);
|
|
2645
2645
|
}
|
|
2646
2646
|
unwrap() {
|
|
2647
2647
|
return this._def.innerType;
|
|
2648
2648
|
}
|
|
2649
2649
|
}
|
|
2650
|
-
|
|
2651
|
-
innerType:
|
|
2652
|
-
typeName:
|
|
2650
|
+
D.create = (n, e) => new D({
|
|
2651
|
+
innerType: n,
|
|
2652
|
+
typeName: g.ZodOptional,
|
|
2653
2653
|
...v(e)
|
|
2654
2654
|
});
|
|
2655
|
-
class
|
|
2655
|
+
class z extends _ {
|
|
2656
2656
|
_parse(e) {
|
|
2657
|
-
return this._getType(e) ===
|
|
2657
|
+
return this._getType(e) === m.null ? I(null) : this._def.innerType._parse(e);
|
|
2658
2658
|
}
|
|
2659
2659
|
unwrap() {
|
|
2660
2660
|
return this._def.innerType;
|
|
2661
2661
|
}
|
|
2662
2662
|
}
|
|
2663
|
-
|
|
2664
|
-
innerType:
|
|
2665
|
-
typeName:
|
|
2663
|
+
z.create = (n, e) => new z({
|
|
2664
|
+
innerType: n,
|
|
2665
|
+
typeName: g.ZodNullable,
|
|
2666
2666
|
...v(e)
|
|
2667
2667
|
});
|
|
2668
|
-
class
|
|
2668
|
+
class me extends _ {
|
|
2669
2669
|
_parse(e) {
|
|
2670
2670
|
const { ctx: t } = this._processInputParams(e);
|
|
2671
|
-
let
|
|
2672
|
-
return t.parsedType ===
|
|
2673
|
-
data:
|
|
2671
|
+
let r = t.data;
|
|
2672
|
+
return t.parsedType === m.undefined && (r = this._def.defaultValue()), this._def.innerType._parse({
|
|
2673
|
+
data: r,
|
|
2674
2674
|
path: t.path,
|
|
2675
2675
|
parent: t
|
|
2676
2676
|
});
|
|
@@ -2679,42 +2679,42 @@ class he extends _ {
|
|
|
2679
2679
|
return this._def.innerType;
|
|
2680
2680
|
}
|
|
2681
2681
|
}
|
|
2682
|
-
|
|
2683
|
-
innerType:
|
|
2684
|
-
typeName:
|
|
2682
|
+
me.create = (n, e) => new me({
|
|
2683
|
+
innerType: n,
|
|
2684
|
+
typeName: g.ZodDefault,
|
|
2685
2685
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
2686
2686
|
...v(e)
|
|
2687
2687
|
});
|
|
2688
|
-
class
|
|
2688
|
+
class he extends _ {
|
|
2689
2689
|
_parse(e) {
|
|
2690
|
-
const { ctx: t } = this._processInputParams(e),
|
|
2690
|
+
const { ctx: t } = this._processInputParams(e), r = {
|
|
2691
2691
|
...t,
|
|
2692
2692
|
common: {
|
|
2693
2693
|
...t.common,
|
|
2694
2694
|
issues: []
|
|
2695
2695
|
}
|
|
2696
2696
|
}, s = this._def.innerType._parse({
|
|
2697
|
-
data:
|
|
2698
|
-
path:
|
|
2697
|
+
data: r.data,
|
|
2698
|
+
path: r.path,
|
|
2699
2699
|
parent: {
|
|
2700
|
-
...
|
|
2700
|
+
...r
|
|
2701
2701
|
}
|
|
2702
2702
|
});
|
|
2703
|
-
return
|
|
2703
|
+
return re(s) ? s.then((a) => ({
|
|
2704
2704
|
status: "valid",
|
|
2705
2705
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
2706
2706
|
get error() {
|
|
2707
|
-
return new
|
|
2707
|
+
return new A(r.common.issues);
|
|
2708
2708
|
},
|
|
2709
|
-
input:
|
|
2709
|
+
input: r.data
|
|
2710
2710
|
})
|
|
2711
2711
|
})) : {
|
|
2712
2712
|
status: "valid",
|
|
2713
2713
|
value: s.status === "valid" ? s.value : this._def.catchValue({
|
|
2714
2714
|
get error() {
|
|
2715
|
-
return new
|
|
2715
|
+
return new A(r.common.issues);
|
|
2716
2716
|
},
|
|
2717
|
-
input:
|
|
2717
|
+
input: r.data
|
|
2718
2718
|
})
|
|
2719
2719
|
};
|
|
2720
2720
|
}
|
|
@@ -2722,35 +2722,35 @@ class me extends _ {
|
|
|
2722
2722
|
return this._def.innerType;
|
|
2723
2723
|
}
|
|
2724
2724
|
}
|
|
2725
|
-
|
|
2726
|
-
innerType:
|
|
2727
|
-
typeName:
|
|
2725
|
+
he.create = (n, e) => new he({
|
|
2726
|
+
innerType: n,
|
|
2727
|
+
typeName: g.ZodCatch,
|
|
2728
2728
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2729
2729
|
...v(e)
|
|
2730
2730
|
});
|
|
2731
2731
|
class we extends _ {
|
|
2732
2732
|
_parse(e) {
|
|
2733
|
-
if (this._getType(e) !==
|
|
2734
|
-
const
|
|
2735
|
-
return f(
|
|
2733
|
+
if (this._getType(e) !== m.nan) {
|
|
2734
|
+
const r = this._getOrReturnCtx(e);
|
|
2735
|
+
return f(r, {
|
|
2736
2736
|
code: u.invalid_type,
|
|
2737
|
-
expected:
|
|
2738
|
-
received:
|
|
2739
|
-
}),
|
|
2737
|
+
expected: m.nan,
|
|
2738
|
+
received: r.parsedType
|
|
2739
|
+
}), y;
|
|
2740
2740
|
}
|
|
2741
2741
|
return { status: "valid", value: e.data };
|
|
2742
2742
|
}
|
|
2743
2743
|
}
|
|
2744
|
-
we.create = (
|
|
2745
|
-
typeName:
|
|
2746
|
-
...v(
|
|
2744
|
+
we.create = (n) => new we({
|
|
2745
|
+
typeName: g.ZodNaN,
|
|
2746
|
+
...v(n)
|
|
2747
2747
|
});
|
|
2748
|
-
const
|
|
2749
|
-
class
|
|
2748
|
+
const Ot = Symbol("zod_brand");
|
|
2749
|
+
class je extends _ {
|
|
2750
2750
|
_parse(e) {
|
|
2751
|
-
const { ctx: t } = this._processInputParams(e),
|
|
2751
|
+
const { ctx: t } = this._processInputParams(e), r = t.data;
|
|
2752
2752
|
return this._def.type._parse({
|
|
2753
|
-
data:
|
|
2753
|
+
data: r,
|
|
2754
2754
|
path: t.path,
|
|
2755
2755
|
parent: t
|
|
2756
2756
|
});
|
|
@@ -2759,127 +2759,127 @@ class Ee extends _ {
|
|
|
2759
2759
|
return this._def.type;
|
|
2760
2760
|
}
|
|
2761
2761
|
}
|
|
2762
|
-
class
|
|
2762
|
+
class ge extends _ {
|
|
2763
2763
|
_parse(e) {
|
|
2764
|
-
const { status: t, ctx:
|
|
2765
|
-
if (
|
|
2764
|
+
const { status: t, ctx: r } = this._processInputParams(e);
|
|
2765
|
+
if (r.common.async)
|
|
2766
2766
|
return (async () => {
|
|
2767
2767
|
const a = await this._def.in._parseAsync({
|
|
2768
|
-
data:
|
|
2769
|
-
path:
|
|
2770
|
-
parent:
|
|
2768
|
+
data: r.data,
|
|
2769
|
+
path: r.path,
|
|
2770
|
+
parent: r
|
|
2771
2771
|
});
|
|
2772
|
-
return a.status === "aborted" ?
|
|
2772
|
+
return a.status === "aborted" ? y : a.status === "dirty" ? (t.dirty(), Y(a.value)) : this._def.out._parseAsync({
|
|
2773
2773
|
data: a.value,
|
|
2774
|
-
path:
|
|
2775
|
-
parent:
|
|
2774
|
+
path: r.path,
|
|
2775
|
+
parent: r
|
|
2776
2776
|
});
|
|
2777
2777
|
})();
|
|
2778
2778
|
{
|
|
2779
2779
|
const s = this._def.in._parseSync({
|
|
2780
|
-
data:
|
|
2781
|
-
path:
|
|
2782
|
-
parent:
|
|
2780
|
+
data: r.data,
|
|
2781
|
+
path: r.path,
|
|
2782
|
+
parent: r
|
|
2783
2783
|
});
|
|
2784
|
-
return s.status === "aborted" ?
|
|
2784
|
+
return s.status === "aborted" ? y : s.status === "dirty" ? (t.dirty(), {
|
|
2785
2785
|
status: "dirty",
|
|
2786
2786
|
value: s.value
|
|
2787
2787
|
}) : this._def.out._parseSync({
|
|
2788
2788
|
data: s.value,
|
|
2789
|
-
path:
|
|
2790
|
-
parent:
|
|
2789
|
+
path: r.path,
|
|
2790
|
+
parent: r
|
|
2791
2791
|
});
|
|
2792
2792
|
}
|
|
2793
2793
|
}
|
|
2794
2794
|
static create(e, t) {
|
|
2795
|
-
return new
|
|
2795
|
+
return new ge({
|
|
2796
2796
|
in: e,
|
|
2797
2797
|
out: t,
|
|
2798
|
-
typeName:
|
|
2798
|
+
typeName: g.ZodPipeline
|
|
2799
2799
|
});
|
|
2800
2800
|
}
|
|
2801
2801
|
}
|
|
2802
2802
|
class pe extends _ {
|
|
2803
2803
|
_parse(e) {
|
|
2804
|
-
const t = this._def.innerType._parse(e),
|
|
2805
|
-
return
|
|
2804
|
+
const t = this._def.innerType._parse(e), r = (s) => (B(s) && (s.value = Object.freeze(s.value)), s);
|
|
2805
|
+
return re(t) ? t.then((s) => r(s)) : r(t);
|
|
2806
2806
|
}
|
|
2807
2807
|
unwrap() {
|
|
2808
2808
|
return this._def.innerType;
|
|
2809
2809
|
}
|
|
2810
2810
|
}
|
|
2811
|
-
pe.create = (
|
|
2812
|
-
innerType:
|
|
2813
|
-
typeName:
|
|
2811
|
+
pe.create = (n, e) => new pe({
|
|
2812
|
+
innerType: n,
|
|
2813
|
+
typeName: g.ZodReadonly,
|
|
2814
2814
|
...v(e)
|
|
2815
2815
|
});
|
|
2816
|
-
function
|
|
2817
|
-
const t = typeof
|
|
2816
|
+
function $e(n, e) {
|
|
2817
|
+
const t = typeof n == "function" ? n(e) : typeof n == "string" ? { message: n } : n;
|
|
2818
2818
|
return typeof t == "string" ? { message: t } : t;
|
|
2819
2819
|
}
|
|
2820
|
-
function
|
|
2821
|
-
return
|
|
2820
|
+
function We(n, e = {}, t) {
|
|
2821
|
+
return n ? H.create().superRefine((r, s) => {
|
|
2822
2822
|
var a, o;
|
|
2823
|
-
const c = r
|
|
2823
|
+
const c = n(r);
|
|
2824
2824
|
if (c instanceof Promise)
|
|
2825
2825
|
return c.then((d) => {
|
|
2826
|
-
var l,
|
|
2826
|
+
var l, h;
|
|
2827
2827
|
if (!d) {
|
|
2828
|
-
const b =
|
|
2828
|
+
const b = $e(e, r), w = (h = (l = b.fatal) !== null && l !== void 0 ? l : t) !== null && h !== void 0 ? h : !0;
|
|
2829
2829
|
s.addIssue({ code: "custom", ...b, fatal: w });
|
|
2830
2830
|
}
|
|
2831
2831
|
});
|
|
2832
2832
|
if (!c) {
|
|
2833
|
-
const d =
|
|
2833
|
+
const d = $e(e, r), l = (o = (a = d.fatal) !== null && a !== void 0 ? a : t) !== null && o !== void 0 ? o : !0;
|
|
2834
2834
|
s.addIssue({ code: "custom", ...d, fatal: l });
|
|
2835
2835
|
}
|
|
2836
2836
|
}) : H.create();
|
|
2837
2837
|
}
|
|
2838
|
-
const
|
|
2838
|
+
const Dt = {
|
|
2839
2839
|
object: k.lazycreate
|
|
2840
2840
|
};
|
|
2841
|
-
var
|
|
2842
|
-
(function(
|
|
2843
|
-
|
|
2844
|
-
})(
|
|
2845
|
-
const
|
|
2846
|
-
message: `Input not instance of ${
|
|
2847
|
-
}) =>
|
|
2848
|
-
string: (
|
|
2849
|
-
number: (
|
|
2850
|
-
boolean: (
|
|
2851
|
-
...
|
|
2841
|
+
var g;
|
|
2842
|
+
(function(n) {
|
|
2843
|
+
n.ZodString = "ZodString", n.ZodNumber = "ZodNumber", n.ZodNaN = "ZodNaN", n.ZodBigInt = "ZodBigInt", n.ZodBoolean = "ZodBoolean", n.ZodDate = "ZodDate", n.ZodSymbol = "ZodSymbol", n.ZodUndefined = "ZodUndefined", n.ZodNull = "ZodNull", n.ZodAny = "ZodAny", n.ZodUnknown = "ZodUnknown", n.ZodNever = "ZodNever", n.ZodVoid = "ZodVoid", n.ZodArray = "ZodArray", n.ZodObject = "ZodObject", n.ZodUnion = "ZodUnion", n.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", n.ZodIntersection = "ZodIntersection", n.ZodTuple = "ZodTuple", n.ZodRecord = "ZodRecord", n.ZodMap = "ZodMap", n.ZodSet = "ZodSet", n.ZodFunction = "ZodFunction", n.ZodLazy = "ZodLazy", n.ZodLiteral = "ZodLiteral", n.ZodEnum = "ZodEnum", n.ZodEffects = "ZodEffects", n.ZodNativeEnum = "ZodNativeEnum", n.ZodOptional = "ZodOptional", n.ZodNullable = "ZodNullable", n.ZodDefault = "ZodDefault", n.ZodCatch = "ZodCatch", n.ZodPromise = "ZodPromise", n.ZodBranded = "ZodBranded", n.ZodPipeline = "ZodPipeline", n.ZodReadonly = "ZodReadonly";
|
|
2844
|
+
})(g || (g = {}));
|
|
2845
|
+
const jt = (n, e = {
|
|
2846
|
+
message: `Input not instance of ${n.name}`
|
|
2847
|
+
}) => We((t) => t instanceof n, e), Qe = N.create, Ye = V.create, Et = we.create, Pt = F.create, Je = se.create, Rt = q.create, Mt = be.create, $t = ae.create, Vt = ie.create, Ft = H.create, Ut = L.create, zt = $.create, Lt = xe.create, Bt = Z.create, qt = k.create, Wt = k.strictCreate, Qt = oe.create, Yt = Te.create, Jt = ce.create, Xt = E.create, Ht = de.create, Gt = ke.create, Kt = W.create, en = J.create, tn = ue.create, nn = le.create, rn = U.create, sn = fe.create, an = G.create, Ve = O.create, on = D.create, cn = z.create, dn = O.createWithPreprocess, un = ge.create, ln = () => Qe().optional(), fn = () => Ye().optional(), mn = () => Je().optional(), hn = {
|
|
2848
|
+
string: (n) => N.create({ ...n, coerce: !0 }),
|
|
2849
|
+
number: (n) => V.create({ ...n, coerce: !0 }),
|
|
2850
|
+
boolean: (n) => se.create({
|
|
2851
|
+
...n,
|
|
2852
2852
|
coerce: !0
|
|
2853
2853
|
}),
|
|
2854
|
-
bigint: (
|
|
2855
|
-
date: (
|
|
2856
|
-
},
|
|
2854
|
+
bigint: (n) => F.create({ ...n, coerce: !0 }),
|
|
2855
|
+
date: (n) => q.create({ ...n, coerce: !0 })
|
|
2856
|
+
}, pn = y;
|
|
2857
2857
|
var i = /* @__PURE__ */ Object.freeze({
|
|
2858
2858
|
__proto__: null,
|
|
2859
2859
|
defaultErrorMap: X,
|
|
2860
|
-
setErrorMap:
|
|
2861
|
-
getErrorMap:
|
|
2860
|
+
setErrorMap: ct,
|
|
2861
|
+
getErrorMap: ye,
|
|
2862
2862
|
makeIssue: ve,
|
|
2863
|
-
EMPTY_PATH:
|
|
2863
|
+
EMPTY_PATH: dt,
|
|
2864
2864
|
addIssueToContext: f,
|
|
2865
2865
|
ParseStatus: T,
|
|
2866
|
-
INVALID:
|
|
2866
|
+
INVALID: y,
|
|
2867
2867
|
DIRTY: Y,
|
|
2868
2868
|
OK: I,
|
|
2869
2869
|
isAborted: Ze,
|
|
2870
2870
|
isDirty: Oe,
|
|
2871
2871
|
isValid: B,
|
|
2872
|
-
isAsync:
|
|
2872
|
+
isAsync: re,
|
|
2873
2873
|
get util() {
|
|
2874
2874
|
return x;
|
|
2875
2875
|
},
|
|
2876
2876
|
get objectUtil() {
|
|
2877
2877
|
return Ne;
|
|
2878
2878
|
},
|
|
2879
|
-
ZodParsedType:
|
|
2879
|
+
ZodParsedType: m,
|
|
2880
2880
|
getParsedType: R,
|
|
2881
2881
|
ZodType: _,
|
|
2882
|
-
datetimeRegex:
|
|
2882
|
+
datetimeRegex: Be,
|
|
2883
2883
|
ZodString: N,
|
|
2884
2884
|
ZodNumber: V,
|
|
2885
2885
|
ZodBigInt: F,
|
|
@@ -2889,7 +2889,7 @@ var i = /* @__PURE__ */ Object.freeze({
|
|
|
2889
2889
|
ZodUndefined: ae,
|
|
2890
2890
|
ZodNull: ie,
|
|
2891
2891
|
ZodAny: H,
|
|
2892
|
-
ZodUnknown:
|
|
2892
|
+
ZodUnknown: L,
|
|
2893
2893
|
ZodNever: $,
|
|
2894
2894
|
ZodVoid: xe,
|
|
2895
2895
|
ZodArray: Z,
|
|
@@ -2897,80 +2897,80 @@ var i = /* @__PURE__ */ Object.freeze({
|
|
|
2897
2897
|
ZodUnion: oe,
|
|
2898
2898
|
ZodDiscriminatedUnion: Te,
|
|
2899
2899
|
ZodIntersection: ce,
|
|
2900
|
-
ZodTuple:
|
|
2900
|
+
ZodTuple: E,
|
|
2901
2901
|
ZodRecord: de,
|
|
2902
2902
|
ZodMap: ke,
|
|
2903
2903
|
ZodSet: W,
|
|
2904
2904
|
ZodFunction: J,
|
|
2905
2905
|
ZodLazy: ue,
|
|
2906
2906
|
ZodLiteral: le,
|
|
2907
|
-
ZodEnum:
|
|
2907
|
+
ZodEnum: U,
|
|
2908
2908
|
ZodNativeEnum: fe,
|
|
2909
2909
|
ZodPromise: G,
|
|
2910
2910
|
ZodEffects: O,
|
|
2911
2911
|
ZodTransformer: O,
|
|
2912
|
-
ZodOptional:
|
|
2913
|
-
ZodNullable:
|
|
2914
|
-
ZodDefault:
|
|
2915
|
-
ZodCatch:
|
|
2912
|
+
ZodOptional: D,
|
|
2913
|
+
ZodNullable: z,
|
|
2914
|
+
ZodDefault: me,
|
|
2915
|
+
ZodCatch: he,
|
|
2916
2916
|
ZodNaN: we,
|
|
2917
|
-
BRAND:
|
|
2918
|
-
ZodBranded:
|
|
2919
|
-
ZodPipeline:
|
|
2917
|
+
BRAND: Ot,
|
|
2918
|
+
ZodBranded: je,
|
|
2919
|
+
ZodPipeline: ge,
|
|
2920
2920
|
ZodReadonly: pe,
|
|
2921
|
-
custom:
|
|
2921
|
+
custom: We,
|
|
2922
2922
|
Schema: _,
|
|
2923
2923
|
ZodSchema: _,
|
|
2924
|
-
late:
|
|
2924
|
+
late: Dt,
|
|
2925
2925
|
get ZodFirstPartyTypeKind() {
|
|
2926
|
-
return
|
|
2926
|
+
return g;
|
|
2927
2927
|
},
|
|
2928
|
-
coerce:
|
|
2929
|
-
any:
|
|
2930
|
-
array:
|
|
2931
|
-
bigint:
|
|
2932
|
-
boolean:
|
|
2933
|
-
date:
|
|
2934
|
-
discriminatedUnion:
|
|
2935
|
-
effect:
|
|
2936
|
-
enum:
|
|
2937
|
-
function:
|
|
2938
|
-
instanceof:
|
|
2939
|
-
intersection:
|
|
2940
|
-
lazy:
|
|
2941
|
-
literal:
|
|
2942
|
-
map:
|
|
2943
|
-
nan:
|
|
2944
|
-
nativeEnum:
|
|
2945
|
-
never:
|
|
2946
|
-
null:
|
|
2947
|
-
nullable:
|
|
2948
|
-
number:
|
|
2949
|
-
object:
|
|
2950
|
-
oboolean:
|
|
2951
|
-
onumber:
|
|
2952
|
-
optional:
|
|
2953
|
-
ostring:
|
|
2954
|
-
pipeline:
|
|
2955
|
-
preprocess:
|
|
2956
|
-
promise:
|
|
2957
|
-
record:
|
|
2958
|
-
set:
|
|
2959
|
-
strictObject:
|
|
2960
|
-
string:
|
|
2961
|
-
symbol:
|
|
2962
|
-
transformer:
|
|
2963
|
-
tuple:
|
|
2964
|
-
undefined:
|
|
2965
|
-
union:
|
|
2966
|
-
unknown:
|
|
2967
|
-
void:
|
|
2968
|
-
NEVER:
|
|
2928
|
+
coerce: hn,
|
|
2929
|
+
any: Ft,
|
|
2930
|
+
array: Bt,
|
|
2931
|
+
bigint: Pt,
|
|
2932
|
+
boolean: Je,
|
|
2933
|
+
date: Rt,
|
|
2934
|
+
discriminatedUnion: Yt,
|
|
2935
|
+
effect: Ve,
|
|
2936
|
+
enum: rn,
|
|
2937
|
+
function: en,
|
|
2938
|
+
instanceof: jt,
|
|
2939
|
+
intersection: Jt,
|
|
2940
|
+
lazy: tn,
|
|
2941
|
+
literal: nn,
|
|
2942
|
+
map: Gt,
|
|
2943
|
+
nan: Et,
|
|
2944
|
+
nativeEnum: sn,
|
|
2945
|
+
never: zt,
|
|
2946
|
+
null: Vt,
|
|
2947
|
+
nullable: cn,
|
|
2948
|
+
number: Ye,
|
|
2949
|
+
object: qt,
|
|
2950
|
+
oboolean: mn,
|
|
2951
|
+
onumber: fn,
|
|
2952
|
+
optional: on,
|
|
2953
|
+
ostring: ln,
|
|
2954
|
+
pipeline: un,
|
|
2955
|
+
preprocess: dn,
|
|
2956
|
+
promise: an,
|
|
2957
|
+
record: Ht,
|
|
2958
|
+
set: Kt,
|
|
2959
|
+
strictObject: Wt,
|
|
2960
|
+
string: Qe,
|
|
2961
|
+
symbol: Mt,
|
|
2962
|
+
transformer: Ve,
|
|
2963
|
+
tuple: Xt,
|
|
2964
|
+
undefined: $t,
|
|
2965
|
+
union: Qt,
|
|
2966
|
+
unknown: Ut,
|
|
2967
|
+
void: Lt,
|
|
2968
|
+
NEVER: pn,
|
|
2969
2969
|
ZodIssueCode: u,
|
|
2970
|
-
quotelessJson:
|
|
2971
|
-
ZodError:
|
|
2970
|
+
quotelessJson: ot,
|
|
2971
|
+
ZodError: A
|
|
2972
2972
|
});
|
|
2973
|
-
const
|
|
2973
|
+
const gn = i.object({
|
|
2974
2974
|
country: i.string(),
|
|
2975
2975
|
city: i.string(),
|
|
2976
2976
|
street: i.string(),
|
|
@@ -2978,37 +2978,37 @@ const hr = i.object({
|
|
|
2978
2978
|
floor: i.string(),
|
|
2979
2979
|
apartmentEnterNumber: i.string(),
|
|
2980
2980
|
apartmentNumber: i.string()
|
|
2981
|
-
}), M = i.string().min(1, { message: "שדה חובה" }),
|
|
2982
|
-
function
|
|
2983
|
-
return !!(
|
|
2981
|
+
}), M = i.string().min(1, { message: "שדה חובה" }), On = i.string().regex(/^\d+$/, "Must be a numeric string"), Dn = i.object({ url: i.string().url(), id: i.string() });
|
|
2982
|
+
function jn(n) {
|
|
2983
|
+
return !!(n != null && n.url);
|
|
2984
2984
|
}
|
|
2985
|
-
const
|
|
2985
|
+
const ne = i.object({
|
|
2986
2986
|
lang: i.enum(["he"]),
|
|
2987
2987
|
value: i.string()
|
|
2988
|
-
}),
|
|
2988
|
+
}), En = i.array(ne), Xe = i.object({
|
|
2989
2989
|
id: i.string().min(1),
|
|
2990
2990
|
companyId: i.string().min(1),
|
|
2991
2991
|
storeId: i.string().min(1),
|
|
2992
2992
|
parentId: i.string().nullish(),
|
|
2993
2993
|
tag: i.string().optional(),
|
|
2994
|
-
locales: i.array(
|
|
2994
|
+
locales: i.array(ne),
|
|
2995
2995
|
depth: i.number()
|
|
2996
|
-
}),
|
|
2997
|
-
children: i.lazy(() =>
|
|
2998
|
-
}),
|
|
2996
|
+
}), Ee = Xe.extend({
|
|
2997
|
+
children: i.lazy(() => Ee.array())
|
|
2998
|
+
}), Pn = Xe.extend({
|
|
2999
2999
|
index: i.number(),
|
|
3000
3000
|
depth: i.number(),
|
|
3001
3001
|
collapsed: i.boolean().optional(),
|
|
3002
|
-
children: i.array(
|
|
3003
|
-
}), K = i.string().min(1),
|
|
3002
|
+
children: i.array(Ee)
|
|
3003
|
+
}), K = i.string().min(1), He = i.object({
|
|
3004
3004
|
type: i.literal("Product"),
|
|
3005
3005
|
storeId: K,
|
|
3006
3006
|
companyId: K,
|
|
3007
3007
|
id: K,
|
|
3008
3008
|
objectID: K,
|
|
3009
3009
|
sku: K,
|
|
3010
|
-
name: i.array(
|
|
3011
|
-
description: i.array(
|
|
3010
|
+
name: i.array(ne),
|
|
3011
|
+
description: i.array(ne),
|
|
3012
3012
|
isPublished: i.boolean(),
|
|
3013
3013
|
vat: i.boolean(),
|
|
3014
3014
|
priceType: i.object({
|
|
@@ -3037,12 +3037,12 @@ const re = i.object({
|
|
|
3037
3037
|
brand: i.string(),
|
|
3038
3038
|
importer: i.string(),
|
|
3039
3039
|
supplier: i.string(),
|
|
3040
|
-
ingredients: i.array(
|
|
3040
|
+
ingredients: i.array(ne),
|
|
3041
3041
|
created_at: i.number(),
|
|
3042
3042
|
updated_at: i.number(),
|
|
3043
3043
|
categoryIds: i.array(i.string().nonempty()),
|
|
3044
3044
|
// @deprecated
|
|
3045
|
-
categoryList: i.array(
|
|
3045
|
+
categoryList: i.array(Ee).optional(),
|
|
3046
3046
|
// @deprecated
|
|
3047
3047
|
categories: i.object({
|
|
3048
3048
|
lvl0: i.array(i.string()),
|
|
@@ -3053,36 +3053,36 @@ const re = i.object({
|
|
|
3053
3053
|
}).optional(),
|
|
3054
3054
|
// @deprecated
|
|
3055
3055
|
categoryNames: i.array(i.string()).optional()
|
|
3056
|
-
}),
|
|
3056
|
+
}), Rn = He.extend({
|
|
3057
3057
|
image: i.instanceof(File).optional()
|
|
3058
|
-
}),
|
|
3059
|
-
product:
|
|
3058
|
+
}), Ge = i.object({
|
|
3059
|
+
product: He,
|
|
3060
3060
|
originalPrice: i.number().optional(),
|
|
3061
3061
|
finalPrice: i.number().optional(),
|
|
3062
3062
|
finalDiscount: i.number().optional(),
|
|
3063
3063
|
amount: i.number().positive({ message: "Quantity must be a positive number." })
|
|
3064
|
-
}),
|
|
3064
|
+
}), Mn = i.object({
|
|
3065
3065
|
type: i.literal("Cart"),
|
|
3066
3066
|
id: i.string().uuid(),
|
|
3067
3067
|
companyId: i.string().uuid(),
|
|
3068
3068
|
storeId: i.string().uuid(),
|
|
3069
3069
|
userId: i.string().uuid(),
|
|
3070
3070
|
status: i.enum(["active", "draft", "completed"]),
|
|
3071
|
-
items: i.array(
|
|
3072
|
-
}),
|
|
3071
|
+
items: i.array(Ge)
|
|
3072
|
+
}), $n = i.object({
|
|
3073
3073
|
id: i.string(),
|
|
3074
3074
|
name: i.string(),
|
|
3075
3075
|
websiteDomains: i.array(i.string())
|
|
3076
|
-
}),
|
|
3076
|
+
}), Vn = i.object({
|
|
3077
3077
|
type: i.literal("FavoriteProduct"),
|
|
3078
3078
|
id: i.string().uuid(),
|
|
3079
3079
|
companyId: i.string().uuid(),
|
|
3080
3080
|
storeId: i.string().uuid(),
|
|
3081
3081
|
userId: i.string().uuid(),
|
|
3082
3082
|
productId: i.string().uuid()
|
|
3083
|
-
}),
|
|
3083
|
+
}), Ke = i.enum(["default", "delayed"], {
|
|
3084
3084
|
description: "delayed is J5 transaction"
|
|
3085
|
-
}),
|
|
3085
|
+
}), yn = i.object({
|
|
3086
3086
|
type: i.literal("Profile"),
|
|
3087
3087
|
id: M,
|
|
3088
3088
|
companyId: M,
|
|
@@ -3093,14 +3093,14 @@ const re = i.object({
|
|
|
3093
3093
|
displayName: M,
|
|
3094
3094
|
email: i.string().email(),
|
|
3095
3095
|
phoneNumber: i.string().optional(),
|
|
3096
|
-
address:
|
|
3096
|
+
address: gn.optional(),
|
|
3097
3097
|
isAnonymous: i.boolean(),
|
|
3098
3098
|
createdDate: i.number(),
|
|
3099
3099
|
lastActivityDate: i.number(),
|
|
3100
|
-
paymentType:
|
|
3100
|
+
paymentType: Ke,
|
|
3101
3101
|
organizationId: i.string().optional()
|
|
3102
3102
|
});
|
|
3103
|
-
function
|
|
3103
|
+
function Fn() {
|
|
3104
3104
|
return {
|
|
3105
3105
|
type: "Profile",
|
|
3106
3106
|
id: "",
|
|
@@ -3123,10 +3123,59 @@ function Mr() {
|
|
|
3123
3123
|
createdDate: 0,
|
|
3124
3124
|
lastActivityDate: 0,
|
|
3125
3125
|
isAnonymous: !0,
|
|
3126
|
-
paymentType:
|
|
3126
|
+
paymentType: Ke.Values.default
|
|
3127
3127
|
};
|
|
3128
3128
|
}
|
|
3129
|
-
const
|
|
3129
|
+
const Pe = i.object({
|
|
3130
|
+
_COMMENT: i.string().optional(),
|
|
3131
|
+
transaction_id: i.string(),
|
|
3132
|
+
date: i.string().regex(/^\d{4}-\d{2}-\d{2}$/, "Date must be in YYYY-MM-DD format"),
|
|
3133
|
+
currency: i.string().length(3, "Currency must be 3 characters"),
|
|
3134
|
+
rate: i.number().positive(),
|
|
3135
|
+
vat: i.string().regex(/^\d+\.\d{2}$/, "VAT must be in format XX.XX"),
|
|
3136
|
+
vat_price: i.number().positive(),
|
|
3137
|
+
price_discount: i.number(),
|
|
3138
|
+
price_discount_in_currency: i.number(),
|
|
3139
|
+
price_total: i.string().regex(/^\d+\.\d{2}$/, "Price total must be in format XX.XX"),
|
|
3140
|
+
price_total_in_currency: i.number().positive()
|
|
3141
|
+
}), et = i.object({
|
|
3142
|
+
doc_uuid: i.string().uuid("Document UUID must be a valid UUID"),
|
|
3143
|
+
pdf_link: i.string().url("PDF link must be a valid URL"),
|
|
3144
|
+
pdf_link_copy: i.string().url("PDF copy link must be a valid URL"),
|
|
3145
|
+
doc_number: i.string().min(1, "Document number is required"),
|
|
3146
|
+
sent_mails: i.array(i.string().email("Each email must be valid")),
|
|
3147
|
+
success: i.boolean(),
|
|
3148
|
+
ua_uuid: i.string().uuid("UA UUID must be a valid UUID"),
|
|
3149
|
+
calculatedData: Pe,
|
|
3150
|
+
warning: i.string().optional()
|
|
3151
|
+
});
|
|
3152
|
+
function Un(n) {
|
|
3153
|
+
return et.safeParse(n).success;
|
|
3154
|
+
}
|
|
3155
|
+
function zn(n) {
|
|
3156
|
+
return Pe.safeParse(n).success;
|
|
3157
|
+
}
|
|
3158
|
+
const tt = i.object({
|
|
3159
|
+
number: i.string(),
|
|
3160
|
+
name: i.string(),
|
|
3161
|
+
id: i.string()
|
|
3162
|
+
}), vn = i.object({
|
|
3163
|
+
id: i.string(),
|
|
3164
|
+
name: i.string(),
|
|
3165
|
+
discountPercentage: i.number().positive().min(0).max(100).optional(),
|
|
3166
|
+
nameOnInvoice: i.string().optional(),
|
|
3167
|
+
billingAccounts: i.array(tt)
|
|
3168
|
+
}), Ln = vn.omit({ id: !0 }), _n = i.object({
|
|
3169
|
+
doc_uuid: i.string().uuid("Document UUID must be a valid UUID"),
|
|
3170
|
+
pdf_link: i.string().url("PDF link must be a valid URL"),
|
|
3171
|
+
pdf_link_copy: i.string().url("PDF copy link must be a valid URL"),
|
|
3172
|
+
doc_number: i.string().min(1, "Document number is required"),
|
|
3173
|
+
sent_mails: i.array(i.string().email("Each email must be valid")),
|
|
3174
|
+
success: i.boolean(),
|
|
3175
|
+
ua_uuid: i.string().uuid("UA UUID must be a valid UUID"),
|
|
3176
|
+
calculatedData: Pe,
|
|
3177
|
+
warning: i.string().optional()
|
|
3178
|
+
}), Bn = i.object({
|
|
3130
3179
|
type: i.literal("Order"),
|
|
3131
3180
|
id: M,
|
|
3132
3181
|
companyId: M,
|
|
@@ -3150,7 +3199,7 @@ const $r = i.object({
|
|
|
3150
3199
|
//todo check if hyp support partial refund
|
|
3151
3200
|
cart: i.object({
|
|
3152
3201
|
id: i.string(),
|
|
3153
|
-
items: i.array(
|
|
3202
|
+
items: i.array(Ge),
|
|
3154
3203
|
cartDiscount: i.number(),
|
|
3155
3204
|
cartTotal: i.number(),
|
|
3156
3205
|
cartVat: i.number(),
|
|
@@ -3162,10 +3211,14 @@ const $r = i.object({
|
|
|
3162
3211
|
// what store charge
|
|
3163
3212
|
date: i.number(),
|
|
3164
3213
|
deliveryDate: i.coerce.number(),
|
|
3165
|
-
client:
|
|
3214
|
+
client: yn.required({}),
|
|
3166
3215
|
nameOnInvoice: i.string().optional(),
|
|
3167
|
-
clientComment: i.string().optional()
|
|
3168
|
-
|
|
3216
|
+
clientComment: i.string().optional(),
|
|
3217
|
+
deliveryNote: et.optional(),
|
|
3218
|
+
invoice: _n.optional(),
|
|
3219
|
+
organizationId: i.string().optional(),
|
|
3220
|
+
billingAccount: tt.optional()
|
|
3221
|
+
}), bn = i.enum(["individual", "company"]), qn = i.object({
|
|
3169
3222
|
id: i.string(),
|
|
3170
3223
|
companyId: i.string(),
|
|
3171
3224
|
name: i.string(),
|
|
@@ -3176,14 +3229,14 @@ const $r = i.object({
|
|
|
3176
3229
|
paymentType: i.enum(["external", "j5"]),
|
|
3177
3230
|
allowAnonymousClients: i.boolean(),
|
|
3178
3231
|
isVatIncludedInPrice: i.boolean(),
|
|
3179
|
-
clientTypes: i.array(
|
|
3232
|
+
clientTypes: i.array(bn),
|
|
3180
3233
|
minimumOrder: i.number().optional(),
|
|
3181
3234
|
freeDeliveryPrice: i.number().optional(),
|
|
3182
3235
|
deliveryPrice: i.number().optional()
|
|
3183
|
-
}),
|
|
3236
|
+
}), xn = i.object({
|
|
3184
3237
|
minSpend: i.number().positive().optional(),
|
|
3185
3238
|
stackable: i.boolean().default(!1)
|
|
3186
|
-
}).optional(),
|
|
3239
|
+
}).optional(), kn = i.discriminatedUnion("variantType", [
|
|
3187
3240
|
i.object({
|
|
3188
3241
|
variantType: i.literal("bundle"),
|
|
3189
3242
|
productsId: i.array(i.string().nonempty()).min(1),
|
|
@@ -3193,7 +3246,7 @@ const $r = i.object({
|
|
|
3193
3246
|
bundlePrice: i.number().positive()
|
|
3194
3247
|
// Total price for the bundle (e.g., $25)
|
|
3195
3248
|
})
|
|
3196
|
-
]),
|
|
3249
|
+
]), Wn = i.object({
|
|
3197
3250
|
type: i.literal("Discount"),
|
|
3198
3251
|
storeId: i.string().min(1),
|
|
3199
3252
|
companyId: i.string().min(1),
|
|
@@ -3202,27 +3255,27 @@ const $r = i.object({
|
|
|
3202
3255
|
active: i.boolean(),
|
|
3203
3256
|
startDate: i.number(),
|
|
3204
3257
|
endDate: i.number(),
|
|
3205
|
-
variant:
|
|
3206
|
-
conditions:
|
|
3258
|
+
variant: kn,
|
|
3259
|
+
conditions: xn
|
|
3207
3260
|
});
|
|
3208
|
-
class
|
|
3261
|
+
class wn {
|
|
3209
3262
|
canApply(e, t) {
|
|
3210
3263
|
if (e.variant.variantType !== "bundle" || !this.isDiscountActive(e)) return !1;
|
|
3211
|
-
const { productsId:
|
|
3212
|
-
return this.getTotalQuantity(t.cart,
|
|
3264
|
+
const { productsId: r, requiredQuantity: s } = e.variant;
|
|
3265
|
+
return this.getTotalQuantity(t.cart, r) >= s;
|
|
3213
3266
|
}
|
|
3214
3267
|
calculate(e, t) {
|
|
3215
3268
|
if (e.variant.variantType !== "bundle")
|
|
3216
3269
|
return { applicable: !1, discountAmount: 0, affectedItems: [] };
|
|
3217
|
-
const { productsId:
|
|
3270
|
+
const { productsId: r, requiredQuantity: s, bundlePrice: a } = e.variant, o = t.cart.filter((C) => r.includes(C.product.id)), c = this.getTotalQuantity(t.cart, r), d = Math.floor(c / s);
|
|
3218
3271
|
if (d === 0)
|
|
3219
3272
|
return { applicable: !1, discountAmount: 0, affectedItems: [] };
|
|
3220
|
-
const l = this.calculateOriginalPrice(o),
|
|
3273
|
+
const l = this.calculateOriginalPrice(o), h = this.getTotalQuantity(t.cart, r), b = this.calculateDiscountedPrice(
|
|
3221
3274
|
l,
|
|
3222
3275
|
a,
|
|
3223
3276
|
d,
|
|
3224
3277
|
s,
|
|
3225
|
-
|
|
3278
|
+
h
|
|
3226
3279
|
), w = l - b, S = this.distributeDiscount(o, w, l);
|
|
3227
3280
|
return {
|
|
3228
3281
|
applicable: !0,
|
|
@@ -3235,17 +3288,17 @@ class vr {
|
|
|
3235
3288
|
return e.active && e.startDate <= t && e.endDate >= t;
|
|
3236
3289
|
}
|
|
3237
3290
|
getTotalQuantity(e, t) {
|
|
3238
|
-
return e.filter((
|
|
3291
|
+
return e.filter((r) => t.includes(r.product.id)).reduce((r, s) => r + s.amount, 0);
|
|
3239
3292
|
}
|
|
3240
3293
|
calculateOriginalPrice(e) {
|
|
3241
|
-
return e.reduce((t,
|
|
3294
|
+
return e.reduce((t, r) => t + r.product.price * r.amount, 0);
|
|
3242
3295
|
}
|
|
3243
|
-
calculateDiscountedPrice(e, t,
|
|
3244
|
-
const o = t *
|
|
3296
|
+
calculateDiscountedPrice(e, t, r, s, a) {
|
|
3297
|
+
const o = t * r, c = r * s, l = Math.max(0, a - c) / a * e;
|
|
3245
3298
|
return o + l;
|
|
3246
3299
|
}
|
|
3247
|
-
distributeDiscount(e, t,
|
|
3248
|
-
const s = t /
|
|
3300
|
+
distributeDiscount(e, t, r) {
|
|
3301
|
+
const s = t / r;
|
|
3249
3302
|
return e.map((a) => {
|
|
3250
3303
|
const o = a.product.price * a.amount * s;
|
|
3251
3304
|
return {
|
|
@@ -3258,7 +3311,7 @@ class vr {
|
|
|
3258
3311
|
});
|
|
3259
3312
|
}
|
|
3260
3313
|
}
|
|
3261
|
-
class
|
|
3314
|
+
class nt {
|
|
3262
3315
|
static getStrategy(e) {
|
|
3263
3316
|
return this.strategies.get(e.variant.variantType) || null;
|
|
3264
3317
|
}
|
|
@@ -3272,24 +3325,24 @@ class Ke {
|
|
|
3272
3325
|
this.strategies.clear();
|
|
3273
3326
|
}
|
|
3274
3327
|
}
|
|
3275
|
-
|
|
3276
|
-
["bundle", new
|
|
3328
|
+
Re(nt, "strategies", /* @__PURE__ */ new Map([
|
|
3329
|
+
["bundle", new wn()]
|
|
3277
3330
|
]));
|
|
3278
|
-
class
|
|
3279
|
-
static calculateDiscounts(e, t,
|
|
3280
|
-
var l,
|
|
3331
|
+
class Tn {
|
|
3332
|
+
static calculateDiscounts(e, t, r) {
|
|
3333
|
+
var l, h;
|
|
3281
3334
|
const s = {
|
|
3282
3335
|
cart: e,
|
|
3283
|
-
user:
|
|
3336
|
+
user: r,
|
|
3284
3337
|
appliedDiscounts: []
|
|
3285
3338
|
}, a = this.filterActiveDiscounts(t), o = [];
|
|
3286
3339
|
for (const b of a) {
|
|
3287
|
-
const w =
|
|
3340
|
+
const w = nt.getStrategy(b);
|
|
3288
3341
|
if (!w || !w.canApply(b, s) || !((l = b.conditions) != null && l.stackable) && o.length > 0) continue;
|
|
3289
3342
|
const S = w.calculate(b, s);
|
|
3290
3343
|
S.applicable && (o.push({
|
|
3291
3344
|
discountId: b.id,
|
|
3292
|
-
discountName: ((
|
|
3345
|
+
discountName: ((h = b.name[0]) == null ? void 0 : h.value) || "Discount",
|
|
3293
3346
|
discountAmount: Number(S.discountAmount.toFixed(2)),
|
|
3294
3347
|
affectedItems: S.affectedItems
|
|
3295
3348
|
}), s.appliedDiscounts = o);
|
|
@@ -3307,23 +3360,23 @@ class _r {
|
|
|
3307
3360
|
static filterActiveDiscounts(e) {
|
|
3308
3361
|
const t = Date.now();
|
|
3309
3362
|
return e.filter(
|
|
3310
|
-
(
|
|
3363
|
+
(r) => r.active && r.startDate <= t && r.endDate >= t
|
|
3311
3364
|
);
|
|
3312
3365
|
}
|
|
3313
3366
|
static calculateFinalPrices(e, t) {
|
|
3314
|
-
return e.map((
|
|
3367
|
+
return e.map((r) => {
|
|
3315
3368
|
const s = t.filter(
|
|
3316
|
-
(d) => d.affectedItems.some((l) => l.productId ===
|
|
3369
|
+
(d) => d.affectedItems.some((l) => l.productId === r.product.id)
|
|
3317
3370
|
), a = s.reduce((d, l) => {
|
|
3318
|
-
const
|
|
3319
|
-
(b) => b.productId ===
|
|
3371
|
+
const h = l.affectedItems.find(
|
|
3372
|
+
(b) => b.productId === r.product.id
|
|
3320
3373
|
);
|
|
3321
|
-
return d + ((
|
|
3322
|
-
}, 0), o = a /
|
|
3374
|
+
return d + ((h == null ? void 0 : h.discountAmount) || 0);
|
|
3375
|
+
}, 0), o = a / r.amount, c = r.product.price - o;
|
|
3323
3376
|
return {
|
|
3324
|
-
amount:
|
|
3325
|
-
product:
|
|
3326
|
-
originalPrice: Number(
|
|
3377
|
+
amount: r.amount,
|
|
3378
|
+
product: r.product,
|
|
3379
|
+
originalPrice: Number(r.product.price.toFixed(2)),
|
|
3327
3380
|
finalPrice: Number(Math.max(0, c).toFixed(2)),
|
|
3328
3381
|
finalDiscount: Number(a.toFixed(2)),
|
|
3329
3382
|
appliedDiscounts: s.map((d) => d.discountId)
|
|
@@ -3338,104 +3391,70 @@ class _r {
|
|
|
3338
3391
|
return this.filterActiveDiscounts(e);
|
|
3339
3392
|
}
|
|
3340
3393
|
}
|
|
3341
|
-
function
|
|
3342
|
-
return Number(
|
|
3394
|
+
function rt(n) {
|
|
3395
|
+
return Number(n.toFixed(2));
|
|
3343
3396
|
}
|
|
3344
|
-
function
|
|
3345
|
-
return
|
|
3397
|
+
function Qn(n) {
|
|
3398
|
+
return n.toFixed(2);
|
|
3346
3399
|
}
|
|
3347
|
-
function
|
|
3348
|
-
return Math.max(0,
|
|
3349
|
-
}
|
|
3350
|
-
function Ur(r, e) {
|
|
3351
|
-
if (r <= 0) return 0;
|
|
3352
|
-
const t = r - e;
|
|
3353
|
-
return et(t / r * 100);
|
|
3354
|
-
}
|
|
3355
|
-
const br = i.object({
|
|
3356
|
-
id: i.string(),
|
|
3357
|
-
name: i.string(),
|
|
3358
|
-
discountPercentage: i.number().positive().min(0).max(100).optional(),
|
|
3359
|
-
nameOnInvoice: i.string().optional()
|
|
3360
|
-
}), Br = br.omit({ id: !0 }), tt = i.object({
|
|
3361
|
-
_COMMENT: i.string().optional(),
|
|
3362
|
-
transaction_id: i.string(),
|
|
3363
|
-
date: i.string().regex(/^\d{4}-\d{2}-\d{2}$/, "Date must be in YYYY-MM-DD format"),
|
|
3364
|
-
currency: i.string().length(3, "Currency must be 3 characters"),
|
|
3365
|
-
rate: i.number().positive(),
|
|
3366
|
-
vat: i.string().regex(/^\d+\.\d{2}$/, "VAT must be in format XX.XX"),
|
|
3367
|
-
vat_price: i.number().positive(),
|
|
3368
|
-
price_discount: i.number(),
|
|
3369
|
-
price_discount_in_currency: i.number(),
|
|
3370
|
-
price_total: i.string().regex(/^\d+\.\d{2}$/, "Price total must be in format XX.XX"),
|
|
3371
|
-
price_total_in_currency: i.number().positive()
|
|
3372
|
-
}), xr = i.object({
|
|
3373
|
-
doc_uuid: i.string().uuid("Document UUID must be a valid UUID"),
|
|
3374
|
-
pdf_link: i.string().url("PDF link must be a valid URL"),
|
|
3375
|
-
pdf_link_copy: i.string().url("PDF copy link must be a valid URL"),
|
|
3376
|
-
doc_number: i.string().min(1, "Document number is required"),
|
|
3377
|
-
sent_mails: i.array(i.string().email("Each email must be valid")),
|
|
3378
|
-
success: i.boolean(),
|
|
3379
|
-
ua_uuid: i.string().uuid("UA UUID must be a valid UUID"),
|
|
3380
|
-
calculatedData: tt,
|
|
3381
|
-
warning: i.string().optional()
|
|
3382
|
-
});
|
|
3383
|
-
function qr(r) {
|
|
3384
|
-
return xr.safeParse(r).success;
|
|
3400
|
+
function Yn(n) {
|
|
3401
|
+
return Math.max(0, rt(n));
|
|
3385
3402
|
}
|
|
3386
|
-
function
|
|
3387
|
-
|
|
3403
|
+
function Jn(n, e) {
|
|
3404
|
+
if (n <= 0) return 0;
|
|
3405
|
+
const t = n - e;
|
|
3406
|
+
return rt(t / n * 100);
|
|
3388
3407
|
}
|
|
3389
|
-
const
|
|
3408
|
+
const Ce = {
|
|
3390
3409
|
VAT: 18
|
|
3391
3410
|
};
|
|
3392
|
-
function
|
|
3411
|
+
function In(n) {
|
|
3393
3412
|
var e, t;
|
|
3394
|
-
return ((e =
|
|
3413
|
+
return ((e = n.discount) == null ? void 0 : e.type) === "percent" ? n.price * (n.discount.value ?? 100) / 100 : ((t = n.discount) == null ? void 0 : t.type) === "number" ? n.discount.value ?? 0 : 0;
|
|
3395
3414
|
}
|
|
3396
|
-
function
|
|
3415
|
+
function Sn(n) {
|
|
3397
3416
|
var e, t;
|
|
3398
|
-
if (((e =
|
|
3399
|
-
const
|
|
3400
|
-
return
|
|
3417
|
+
if (((e = n.discount) == null ? void 0 : e.type) === "percent") {
|
|
3418
|
+
const r = n.price * n.discount.value / 100;
|
|
3419
|
+
return n.price - r;
|
|
3401
3420
|
}
|
|
3402
|
-
return ((t =
|
|
3421
|
+
return ((t = n.discount) == null ? void 0 : t.type) === "number" ? n.price - n.discount.value : n.price;
|
|
3403
3422
|
}
|
|
3404
|
-
function
|
|
3405
|
-
cart:
|
|
3423
|
+
function Xn({
|
|
3424
|
+
cart: n,
|
|
3406
3425
|
discounts: e,
|
|
3407
3426
|
store: t
|
|
3408
3427
|
}) {
|
|
3409
|
-
const { isVatIncludedInPrice:
|
|
3428
|
+
const { isVatIncludedInPrice: r } = t, s = n.map((d) => ({
|
|
3410
3429
|
amount: d.amount,
|
|
3411
3430
|
product: {
|
|
3412
3431
|
id: d.product.id,
|
|
3413
3432
|
price: d.product.price
|
|
3414
3433
|
}
|
|
3415
|
-
})), a =
|
|
3416
|
-
const
|
|
3434
|
+
})), a = Tn.calculateDiscounts(s, e), o = n.map((d, l) => {
|
|
3435
|
+
const h = a.items[l];
|
|
3417
3436
|
return {
|
|
3418
3437
|
amount: d.amount,
|
|
3419
3438
|
product: { ...d.product },
|
|
3420
3439
|
originalPrice: d.product.price,
|
|
3421
|
-
finalPrice:
|
|
3422
|
-
finalDiscount:
|
|
3440
|
+
finalPrice: h ? h.finalPrice : Sn(d.product),
|
|
3441
|
+
finalDiscount: h ? h.finalDiscount : In(d.product)
|
|
3423
3442
|
};
|
|
3424
3443
|
}), c = o.reduce(
|
|
3425
3444
|
(d, l) => {
|
|
3426
|
-
const { product:
|
|
3427
|
-
let
|
|
3428
|
-
if (
|
|
3445
|
+
const { product: h, amount: b, finalPrice: w, finalDiscount: S } = l;
|
|
3446
|
+
let C = 0;
|
|
3447
|
+
if (h.vat) {
|
|
3429
3448
|
let Se = 0;
|
|
3430
|
-
if (
|
|
3431
|
-
const
|
|
3432
|
-
|
|
3449
|
+
if (r) {
|
|
3450
|
+
const st = w * (Ce.VAT / (100 + Ce.VAT));
|
|
3451
|
+
C = Number(st.toFixed(2)), C = C * b, Se = Number(C.toFixed(2));
|
|
3433
3452
|
} else
|
|
3434
|
-
|
|
3453
|
+
C = w * Ce.VAT / 100, C = C * b, Se = Number(C.toFixed(2));
|
|
3435
3454
|
d.vat = Number((d.vat + Se).toFixed(2));
|
|
3436
3455
|
}
|
|
3437
3456
|
const Ie = Number(w.toFixed(2));
|
|
3438
|
-
return d.cost += b * Ie, d.discount += S && b * S, d.finalCost += b * Ie + (
|
|
3457
|
+
return d.cost += b * Ie, d.discount += S && b * S, d.finalCost += b * Ie + (r ? 0 : C), d.productsCost += b * Ie + (r ? 0 : C), d.cost = Number(d.cost.toFixed(2)), d.discount = Number(d.discount.toFixed(2)), d.finalCost = Number(d.finalCost.toFixed(2)), d.productsCost = Number(d.productsCost.toFixed(2)), d;
|
|
3439
3458
|
},
|
|
3440
3459
|
{
|
|
3441
3460
|
discount: 0,
|
|
@@ -3448,10 +3467,10 @@ function Qr({
|
|
|
3448
3467
|
);
|
|
3449
3468
|
return c.deliveryPrice && c.productsCost >= (t.freeDeliveryPrice ?? 0) ? c.deliveryPrice = 0 : c.finalCost += c.deliveryPrice, console.log("cartDetails", c), { items: o, ...c };
|
|
3450
3469
|
}
|
|
3451
|
-
const
|
|
3470
|
+
const An = {
|
|
3452
3471
|
stores: "STORES",
|
|
3453
3472
|
companies: "COMPANIES"
|
|
3454
|
-
},
|
|
3473
|
+
}, Cn = {
|
|
3455
3474
|
products: "products",
|
|
3456
3475
|
profiles: "profiles",
|
|
3457
3476
|
cart: "cart",
|
|
@@ -3463,61 +3482,62 @@ const Tr = {
|
|
|
3463
3482
|
settings: "settings",
|
|
3464
3483
|
discounts: "discounts",
|
|
3465
3484
|
organizations: "organizations"
|
|
3466
|
-
},
|
|
3467
|
-
systemCollections:
|
|
3468
|
-
storeCollections:
|
|
3485
|
+
}, Nn = {
|
|
3486
|
+
systemCollections: An,
|
|
3487
|
+
storeCollections: Cn,
|
|
3469
3488
|
// for client
|
|
3470
3489
|
getPath: ({
|
|
3471
|
-
companyId:
|
|
3490
|
+
companyId: n,
|
|
3472
3491
|
storeId: e,
|
|
3473
3492
|
collectionName: t,
|
|
3474
|
-
id:
|
|
3475
|
-
}) => `${
|
|
3493
|
+
id: r
|
|
3494
|
+
}) => `${n}/${e}/${t}${r ? `/${r}` : ""}`,
|
|
3476
3495
|
// for backend
|
|
3477
|
-
getDocPath: (
|
|
3478
|
-
},
|
|
3479
|
-
firestore:
|
|
3496
|
+
getDocPath: (n) => `{companyId}/{storeId}/${n}/{id}`
|
|
3497
|
+
}, Hn = {
|
|
3498
|
+
firestore: Nn
|
|
3480
3499
|
};
|
|
3481
3500
|
export {
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3501
|
+
gn as AddressSchema,
|
|
3502
|
+
Xe as BaseCategorySchema,
|
|
3503
|
+
tt as BillingAccountSchema,
|
|
3504
|
+
wn as BundleDiscountStrategy,
|
|
3505
|
+
Pe as CalculatedDataSchema,
|
|
3506
|
+
Ge as CartItemProductSchema,
|
|
3507
|
+
Mn as CartSchema,
|
|
3508
|
+
Ee as CategorySchema,
|
|
3509
|
+
$n as CompanySchema,
|
|
3510
|
+
et as DeliveryNoteSchema,
|
|
3511
|
+
xn as DiscountConditionsSchema,
|
|
3512
|
+
Tn as DiscountEngine,
|
|
3513
|
+
Wn as DiscountSchema,
|
|
3514
|
+
nt as DiscountStrategyFactory,
|
|
3515
|
+
kn as DiscountVariantSchema,
|
|
3516
|
+
Vn as FavoriteProductSchema,
|
|
3517
|
+
Dn as FileSchema,
|
|
3518
|
+
Hn as FirebaseAPI,
|
|
3519
|
+
ne as LocaleSchema,
|
|
3520
|
+
En as LocaleValueSchema,
|
|
3521
|
+
Ln as NewOrganizationSchema,
|
|
3522
|
+
Rn as NewProductSchema,
|
|
3523
|
+
Bn as OrderSchema,
|
|
3524
|
+
vn as OrganizationSchema,
|
|
3525
|
+
He as ProductSchema,
|
|
3526
|
+
Ke as ProfilePaymentTypeSchema,
|
|
3527
|
+
yn as ProfileSchema,
|
|
3528
|
+
qn as StoreSchema,
|
|
3529
|
+
Pn as TFlattenCategorySchema,
|
|
3530
|
+
Jn as calculatePercentageDiscount,
|
|
3531
|
+
bn as clientTypesSchema,
|
|
3532
|
+
Fn as createEmptyProfile,
|
|
3533
|
+
Yn as ensureNonNegative,
|
|
3534
|
+
rt as formatCurrency,
|
|
3535
|
+
Qn as formatCurrencyString,
|
|
3536
|
+
Xn as getCartCost,
|
|
3537
|
+
zn as isCalculatedData,
|
|
3538
|
+
Un as isDeliveryNote,
|
|
3539
|
+
jn as isFile,
|
|
3520
3540
|
M as notEmptyTextSchema,
|
|
3521
|
-
|
|
3541
|
+
On as numericTextSchema
|
|
3522
3542
|
};
|
|
3523
3543
|
//# sourceMappingURL=core.es.js.map
|