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