@resconet/qp-bridge 0.0.1-alpha.19 → 0.0.1-alpha.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -0
- package/index.js +1 -1
- package/index.mjs +642 -587
- package/lib/qp-bridge-types.d.ts +83 -0
- package/lib/qp-bridge.d.ts +34 -1
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
let
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
if (!
|
|
1
|
+
let ve;
|
|
2
|
+
const Fe = new Uint8Array(16);
|
|
3
|
+
function et() {
|
|
4
|
+
if (!ve && (ve = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !ve))
|
|
5
5
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
6
|
-
return
|
|
6
|
+
return ve(Fe);
|
|
7
7
|
}
|
|
8
8
|
const k = [];
|
|
9
9
|
for (let t = 0; t < 256; ++t)
|
|
10
10
|
k.push((t + 256).toString(16).slice(1));
|
|
11
|
-
function
|
|
11
|
+
function tt(t, e = 0) {
|
|
12
12
|
return k[t[e + 0]] + k[t[e + 1]] + k[t[e + 2]] + k[t[e + 3]] + "-" + k[t[e + 4]] + k[t[e + 5]] + "-" + k[t[e + 6]] + k[t[e + 7]] + "-" + k[t[e + 8]] + k[t[e + 9]] + "-" + k[t[e + 10]] + k[t[e + 11]] + k[t[e + 12]] + k[t[e + 13]] + k[t[e + 14]] + k[t[e + 15]];
|
|
13
13
|
}
|
|
14
|
-
const
|
|
15
|
-
randomUUID:
|
|
14
|
+
const st = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), je = {
|
|
15
|
+
randomUUID: st
|
|
16
16
|
};
|
|
17
|
-
function
|
|
17
|
+
function qe(t, e, s) {
|
|
18
18
|
if (je.randomUUID && !e && !t)
|
|
19
19
|
return je.randomUUID();
|
|
20
20
|
t = t || {};
|
|
21
|
-
const n = t.random || (t.rng ||
|
|
22
|
-
return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128,
|
|
21
|
+
const n = t.random || (t.rng || et)();
|
|
22
|
+
return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, tt(n);
|
|
23
23
|
}
|
|
24
24
|
var x;
|
|
25
25
|
(function(t) {
|
|
@@ -124,8 +124,8 @@ const f = x.arrayToEnum([
|
|
|
124
124
|
"invalid_intersection_types",
|
|
125
125
|
"not_multiple_of",
|
|
126
126
|
"not_finite"
|
|
127
|
-
]),
|
|
128
|
-
class
|
|
127
|
+
]), nt = (t) => JSON.stringify(t, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
128
|
+
class E extends Error {
|
|
129
129
|
constructor(e) {
|
|
130
130
|
super(), this.issues = [], this.addIssue = (n) => {
|
|
131
131
|
this.issues = [...this.issues, n];
|
|
@@ -162,7 +162,7 @@ class C extends Error {
|
|
|
162
162
|
return r(this), n;
|
|
163
163
|
}
|
|
164
164
|
static assert(e) {
|
|
165
|
-
if (!(e instanceof
|
|
165
|
+
if (!(e instanceof E))
|
|
166
166
|
throw new Error(`Not a ZodError: ${e}`);
|
|
167
167
|
}
|
|
168
168
|
toString() {
|
|
@@ -184,7 +184,7 @@ class C extends Error {
|
|
|
184
184
|
return this.flatten();
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
|
-
|
|
187
|
+
E.create = (t) => new E(t);
|
|
188
188
|
const Y = (t, e) => {
|
|
189
189
|
let s;
|
|
190
190
|
switch (t.code) {
|
|
@@ -241,14 +241,14 @@ const Y = (t, e) => {
|
|
|
241
241
|
}
|
|
242
242
|
return { message: s };
|
|
243
243
|
};
|
|
244
|
-
let
|
|
245
|
-
function
|
|
246
|
-
|
|
244
|
+
let $e = Y;
|
|
245
|
+
function rt(t) {
|
|
246
|
+
$e = t;
|
|
247
247
|
}
|
|
248
|
-
function
|
|
249
|
-
return
|
|
248
|
+
function _e() {
|
|
249
|
+
return $e;
|
|
250
250
|
}
|
|
251
|
-
const
|
|
251
|
+
const xe = (t) => {
|
|
252
252
|
const { data: e, path: s, errorMaps: n, issueData: r } = t, a = [...s, ...r.path || []], i = {
|
|
253
253
|
...r,
|
|
254
254
|
path: a
|
|
@@ -268,9 +268,9 @@ const ve = (t) => {
|
|
|
268
268
|
path: a,
|
|
269
269
|
message: o
|
|
270
270
|
};
|
|
271
|
-
},
|
|
271
|
+
}, at = [];
|
|
272
272
|
function l(t, e) {
|
|
273
|
-
const s =
|
|
273
|
+
const s = _e(), n = xe({
|
|
274
274
|
issueData: e,
|
|
275
275
|
data: t.data,
|
|
276
276
|
path: t.path,
|
|
@@ -284,7 +284,7 @@ function l(t, e) {
|
|
|
284
284
|
});
|
|
285
285
|
t.common.issues.push(n);
|
|
286
286
|
}
|
|
287
|
-
class
|
|
287
|
+
class S {
|
|
288
288
|
constructor() {
|
|
289
289
|
this.value = "valid";
|
|
290
290
|
}
|
|
@@ -298,7 +298,7 @@ class w {
|
|
|
298
298
|
const n = [];
|
|
299
299
|
for (const r of s) {
|
|
300
300
|
if (r.status === "aborted")
|
|
301
|
-
return
|
|
301
|
+
return y;
|
|
302
302
|
r.status === "dirty" && e.dirty(), n.push(r.value);
|
|
303
303
|
}
|
|
304
304
|
return { status: e.value, value: n };
|
|
@@ -312,28 +312,28 @@ class w {
|
|
|
312
312
|
value: i
|
|
313
313
|
});
|
|
314
314
|
}
|
|
315
|
-
return
|
|
315
|
+
return S.mergeObjectSync(e, n);
|
|
316
316
|
}
|
|
317
317
|
static mergeObjectSync(e, s) {
|
|
318
318
|
const n = {};
|
|
319
319
|
for (const r of s) {
|
|
320
320
|
const { key: a, value: i } = r;
|
|
321
321
|
if (a.status === "aborted" || i.status === "aborted")
|
|
322
|
-
return
|
|
322
|
+
return y;
|
|
323
323
|
a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value < "u" || r.alwaysSet) && (n[a.value] = i.value);
|
|
324
324
|
}
|
|
325
325
|
return { status: e.value, value: n };
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
|
-
const
|
|
328
|
+
const y = Object.freeze({
|
|
329
329
|
status: "aborted"
|
|
330
|
-
}), W = (t) => ({ status: "dirty", value: t }), T = (t) => ({ status: "valid", value: t }),
|
|
331
|
-
function
|
|
330
|
+
}), W = (t) => ({ status: "dirty", value: t }), T = (t) => ({ status: "valid", value: t }), Oe = (t) => t.status === "aborted", Ie = (t) => t.status === "dirty", se = (t) => t.status === "valid", ne = (t) => typeof Promise < "u" && t instanceof Promise;
|
|
331
|
+
function be(t, e, s, n) {
|
|
332
332
|
if (typeof e == "function" ? t !== e || !n : !e.has(t))
|
|
333
333
|
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
334
334
|
return e.get(t);
|
|
335
335
|
}
|
|
336
|
-
function
|
|
336
|
+
function Ue(t, e, s, n, r) {
|
|
337
337
|
if (typeof e == "function" ? t !== e || !r : !e.has(t))
|
|
338
338
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
339
339
|
return e.set(t, s), s;
|
|
@@ -342,7 +342,7 @@ var h;
|
|
|
342
342
|
(function(t) {
|
|
343
343
|
t.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, t.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
344
344
|
})(h || (h = {}));
|
|
345
|
-
var
|
|
345
|
+
var F, ee;
|
|
346
346
|
class M {
|
|
347
347
|
constructor(e, s, n, r) {
|
|
348
348
|
this._cachedPath = [], this.parent = e, this.data = s, this._path = n, this._key = r;
|
|
@@ -352,7 +352,7 @@ class M {
|
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
354
|
const Ae = (t, e) => {
|
|
355
|
-
if (
|
|
355
|
+
if (se(e))
|
|
356
356
|
return { success: !0, data: e.value };
|
|
357
357
|
if (!t.common.issues.length)
|
|
358
358
|
throw new Error("Validation failed but no issues detected.");
|
|
@@ -361,7 +361,7 @@ const Ae = (t, e) => {
|
|
|
361
361
|
get error() {
|
|
362
362
|
if (this._error)
|
|
363
363
|
return this._error;
|
|
364
|
-
const s = new
|
|
364
|
+
const s = new E(t.common.issues);
|
|
365
365
|
return this._error = s, this._error;
|
|
366
366
|
}
|
|
367
367
|
};
|
|
@@ -374,8 +374,8 @@ function v(t) {
|
|
|
374
374
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
375
375
|
return e ? { errorMap: e, description: r } : { errorMap: (i, o) => {
|
|
376
376
|
var d, u;
|
|
377
|
-
const { message:
|
|
378
|
-
return i.code === "invalid_enum_value" ? { message:
|
|
377
|
+
const { message: g } = t;
|
|
378
|
+
return i.code === "invalid_enum_value" ? { message: g ?? o.defaultError } : typeof o.data > "u" ? { message: (d = g ?? n) !== null && d !== void 0 ? d : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (u = g ?? s) !== null && u !== void 0 ? u : o.defaultError };
|
|
379
379
|
}, description: r };
|
|
380
380
|
}
|
|
381
381
|
class _ {
|
|
@@ -400,7 +400,7 @@ class _ {
|
|
|
400
400
|
}
|
|
401
401
|
_processInputParams(e) {
|
|
402
402
|
return {
|
|
403
|
-
status: new
|
|
403
|
+
status: new S(),
|
|
404
404
|
ctx: {
|
|
405
405
|
common: e.parent.common,
|
|
406
406
|
data: e.data,
|
|
@@ -413,7 +413,7 @@ class _ {
|
|
|
413
413
|
}
|
|
414
414
|
_parseSync(e) {
|
|
415
415
|
const s = this._parse(e);
|
|
416
|
-
if (
|
|
416
|
+
if (ne(s))
|
|
417
417
|
throw new Error("Synchronous parse encountered promise.");
|
|
418
418
|
return s;
|
|
419
419
|
}
|
|
@@ -461,7 +461,7 @@ class _ {
|
|
|
461
461
|
parent: null,
|
|
462
462
|
data: e,
|
|
463
463
|
parsedType: P(e)
|
|
464
|
-
}, r = this._parse({ data: e, path: n.path, parent: n }), a = await (
|
|
464
|
+
}, r = this._parse({ data: e, path: n.path, parent: n }), a = await (ne(r) ? r : Promise.resolve(r));
|
|
465
465
|
return Ae(n, a);
|
|
466
466
|
}
|
|
467
467
|
refine(e, s) {
|
|
@@ -480,7 +480,7 @@ class _ {
|
|
|
480
480
|
_refinement(e) {
|
|
481
481
|
return new O({
|
|
482
482
|
schema: this,
|
|
483
|
-
typeName:
|
|
483
|
+
typeName: m.ZodEffects,
|
|
484
484
|
effect: { type: "refinement", refinement: e }
|
|
485
485
|
});
|
|
486
486
|
}
|
|
@@ -488,7 +488,7 @@ class _ {
|
|
|
488
488
|
return this._refinement(e);
|
|
489
489
|
}
|
|
490
490
|
optional() {
|
|
491
|
-
return
|
|
491
|
+
return I.create(this, this._def);
|
|
492
492
|
}
|
|
493
493
|
nullable() {
|
|
494
494
|
return L.create(this, this._def);
|
|
@@ -497,48 +497,48 @@ class _ {
|
|
|
497
497
|
return this.nullable().optional();
|
|
498
498
|
}
|
|
499
499
|
array() {
|
|
500
|
-
return
|
|
500
|
+
return Z.create(this, this._def);
|
|
501
501
|
}
|
|
502
502
|
promise() {
|
|
503
503
|
return X.create(this, this._def);
|
|
504
504
|
}
|
|
505
505
|
or(e) {
|
|
506
|
-
return
|
|
506
|
+
return oe.create([this, e], this._def);
|
|
507
507
|
}
|
|
508
508
|
and(e) {
|
|
509
|
-
return
|
|
509
|
+
return ce.create(this, e, this._def);
|
|
510
510
|
}
|
|
511
511
|
transform(e) {
|
|
512
512
|
return new O({
|
|
513
513
|
...v(this._def),
|
|
514
514
|
schema: this,
|
|
515
|
-
typeName:
|
|
515
|
+
typeName: m.ZodEffects,
|
|
516
516
|
effect: { type: "transform", transform: e }
|
|
517
517
|
});
|
|
518
518
|
}
|
|
519
519
|
default(e) {
|
|
520
520
|
const s = typeof e == "function" ? e : () => e;
|
|
521
|
-
return new
|
|
521
|
+
return new he({
|
|
522
522
|
...v(this._def),
|
|
523
523
|
innerType: this,
|
|
524
524
|
defaultValue: s,
|
|
525
|
-
typeName:
|
|
525
|
+
typeName: m.ZodDefault
|
|
526
526
|
});
|
|
527
527
|
}
|
|
528
528
|
brand() {
|
|
529
|
-
return new
|
|
530
|
-
typeName:
|
|
529
|
+
return new Ne({
|
|
530
|
+
typeName: m.ZodBranded,
|
|
531
531
|
type: this,
|
|
532
532
|
...v(this._def)
|
|
533
533
|
});
|
|
534
534
|
}
|
|
535
535
|
catch(e) {
|
|
536
536
|
const s = typeof e == "function" ? e : () => e;
|
|
537
|
-
return new
|
|
537
|
+
return new pe({
|
|
538
538
|
...v(this._def),
|
|
539
539
|
innerType: this,
|
|
540
540
|
catchValue: s,
|
|
541
|
-
typeName:
|
|
541
|
+
typeName: m.ZodCatch
|
|
542
542
|
});
|
|
543
543
|
}
|
|
544
544
|
describe(e) {
|
|
@@ -549,10 +549,10 @@ class _ {
|
|
|
549
549
|
});
|
|
550
550
|
}
|
|
551
551
|
pipe(e) {
|
|
552
|
-
return
|
|
552
|
+
return ge.create(this, e);
|
|
553
553
|
}
|
|
554
554
|
readonly() {
|
|
555
|
-
return
|
|
555
|
+
return me.create(this);
|
|
556
556
|
}
|
|
557
557
|
isOptional() {
|
|
558
558
|
return this.safeParse(void 0).success;
|
|
@@ -561,14 +561,14 @@ class _ {
|
|
|
561
561
|
return this.safeParse(null).success;
|
|
562
562
|
}
|
|
563
563
|
}
|
|
564
|
-
const
|
|
564
|
+
const it = /^c[^\s-]{8,}$/i, ot = /^[0-9a-z]+$/, ct = /^[0-9A-HJKMNP-TV-Z]{26}$/, dt = /^[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, ut = /^[a-z0-9_-]{21}$/i, lt = /^[-+]?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)?)??$/, ft = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, ht = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
565
565
|
let Ce;
|
|
566
|
-
const
|
|
566
|
+
const pt = /^(?:(?: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])$/, mt = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/, gt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Le = "((\\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])))", yt = new RegExp(`^${Le}$`);
|
|
567
567
|
function Ve(t) {
|
|
568
568
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
569
569
|
return t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
570
570
|
}
|
|
571
|
-
function
|
|
571
|
+
function vt(t) {
|
|
572
572
|
return new RegExp(`^${Ve(t)}$`);
|
|
573
573
|
}
|
|
574
574
|
function De(t) {
|
|
@@ -576,10 +576,10 @@ function De(t) {
|
|
|
576
576
|
const s = [];
|
|
577
577
|
return s.push(t.local ? "Z?" : "Z"), t.offset && s.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${s.join("|")})`, new RegExp(`^${e}$`);
|
|
578
578
|
}
|
|
579
|
-
function
|
|
580
|
-
return !!((e === "v4" || !e) &&
|
|
579
|
+
function _t(t, e) {
|
|
580
|
+
return !!((e === "v4" || !e) && pt.test(t) || (e === "v6" || !e) && mt.test(t));
|
|
581
581
|
}
|
|
582
|
-
class
|
|
582
|
+
class C extends _ {
|
|
583
583
|
_parse(e) {
|
|
584
584
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== f.string) {
|
|
585
585
|
const a = this._getOrReturnCtx(e);
|
|
@@ -587,9 +587,9 @@ class Z extends _ {
|
|
|
587
587
|
code: c.invalid_type,
|
|
588
588
|
expected: f.string,
|
|
589
589
|
received: a.parsedType
|
|
590
|
-
}),
|
|
590
|
+
}), y;
|
|
591
591
|
}
|
|
592
|
-
const n = new
|
|
592
|
+
const n = new S();
|
|
593
593
|
let r;
|
|
594
594
|
for (const a of this._def.checks)
|
|
595
595
|
if (a.kind === "min")
|
|
@@ -628,43 +628,43 @@ class Z extends _ {
|
|
|
628
628
|
message: a.message
|
|
629
629
|
}), n.dirty());
|
|
630
630
|
} else if (a.kind === "email")
|
|
631
|
-
|
|
631
|
+
ft.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
632
632
|
validation: "email",
|
|
633
633
|
code: c.invalid_string,
|
|
634
634
|
message: a.message
|
|
635
635
|
}), n.dirty());
|
|
636
636
|
else if (a.kind === "emoji")
|
|
637
|
-
Ce || (Ce = new RegExp(
|
|
637
|
+
Ce || (Ce = new RegExp(ht, "u")), Ce.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
638
638
|
validation: "emoji",
|
|
639
639
|
code: c.invalid_string,
|
|
640
640
|
message: a.message
|
|
641
641
|
}), n.dirty());
|
|
642
642
|
else if (a.kind === "uuid")
|
|
643
|
-
|
|
643
|
+
dt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
644
644
|
validation: "uuid",
|
|
645
645
|
code: c.invalid_string,
|
|
646
646
|
message: a.message
|
|
647
647
|
}), n.dirty());
|
|
648
648
|
else if (a.kind === "nanoid")
|
|
649
|
-
|
|
649
|
+
ut.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
650
650
|
validation: "nanoid",
|
|
651
651
|
code: c.invalid_string,
|
|
652
652
|
message: a.message
|
|
653
653
|
}), n.dirty());
|
|
654
654
|
else if (a.kind === "cuid")
|
|
655
|
-
|
|
655
|
+
it.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
656
656
|
validation: "cuid",
|
|
657
657
|
code: c.invalid_string,
|
|
658
658
|
message: a.message
|
|
659
659
|
}), n.dirty());
|
|
660
660
|
else if (a.kind === "cuid2")
|
|
661
|
-
|
|
661
|
+
ot.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
662
662
|
validation: "cuid2",
|
|
663
663
|
code: c.invalid_string,
|
|
664
664
|
message: a.message
|
|
665
665
|
}), n.dirty());
|
|
666
666
|
else if (a.kind === "ulid")
|
|
667
|
-
|
|
667
|
+
ct.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
668
668
|
validation: "ulid",
|
|
669
669
|
code: c.invalid_string,
|
|
670
670
|
message: a.message
|
|
@@ -700,23 +700,23 @@ class Z extends _ {
|
|
|
700
700
|
code: c.invalid_string,
|
|
701
701
|
validation: "datetime",
|
|
702
702
|
message: a.message
|
|
703
|
-
}), n.dirty()) : a.kind === "date" ?
|
|
703
|
+
}), n.dirty()) : a.kind === "date" ? yt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
704
704
|
code: c.invalid_string,
|
|
705
705
|
validation: "date",
|
|
706
706
|
message: a.message
|
|
707
|
-
}), n.dirty()) : a.kind === "time" ?
|
|
707
|
+
}), n.dirty()) : a.kind === "time" ? vt(a).test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
708
708
|
code: c.invalid_string,
|
|
709
709
|
validation: "time",
|
|
710
710
|
message: a.message
|
|
711
|
-
}), n.dirty()) : a.kind === "duration" ?
|
|
711
|
+
}), n.dirty()) : a.kind === "duration" ? lt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
712
712
|
validation: "duration",
|
|
713
713
|
code: c.invalid_string,
|
|
714
714
|
message: a.message
|
|
715
|
-
}), n.dirty()) : a.kind === "ip" ?
|
|
715
|
+
}), n.dirty()) : a.kind === "ip" ? _t(e.data, a.version) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
716
716
|
validation: "ip",
|
|
717
717
|
code: c.invalid_string,
|
|
718
718
|
message: a.message
|
|
719
|
-
}), n.dirty()) : a.kind === "base64" ?
|
|
719
|
+
}), n.dirty()) : a.kind === "base64" ? gt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
720
720
|
validation: "base64",
|
|
721
721
|
code: c.invalid_string,
|
|
722
722
|
message: a.message
|
|
@@ -731,7 +731,7 @@ class Z extends _ {
|
|
|
731
731
|
});
|
|
732
732
|
}
|
|
733
733
|
_addCheck(e) {
|
|
734
|
-
return new
|
|
734
|
+
return new C({
|
|
735
735
|
...this._def,
|
|
736
736
|
checks: [...this._def.checks, e]
|
|
737
737
|
});
|
|
@@ -857,19 +857,19 @@ class Z extends _ {
|
|
|
857
857
|
return this.min(1, h.errToObj(e));
|
|
858
858
|
}
|
|
859
859
|
trim() {
|
|
860
|
-
return new
|
|
860
|
+
return new C({
|
|
861
861
|
...this._def,
|
|
862
862
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
863
863
|
});
|
|
864
864
|
}
|
|
865
865
|
toLowerCase() {
|
|
866
|
-
return new
|
|
866
|
+
return new C({
|
|
867
867
|
...this._def,
|
|
868
868
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
869
869
|
});
|
|
870
870
|
}
|
|
871
871
|
toUpperCase() {
|
|
872
|
-
return new
|
|
872
|
+
return new C({
|
|
873
873
|
...this._def,
|
|
874
874
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
875
875
|
});
|
|
@@ -929,20 +929,20 @@ class Z extends _ {
|
|
|
929
929
|
return e;
|
|
930
930
|
}
|
|
931
931
|
}
|
|
932
|
-
|
|
932
|
+
C.create = (t) => {
|
|
933
933
|
var e;
|
|
934
|
-
return new
|
|
934
|
+
return new C({
|
|
935
935
|
checks: [],
|
|
936
|
-
typeName:
|
|
936
|
+
typeName: m.ZodString,
|
|
937
937
|
coerce: (e = t == null ? void 0 : t.coerce) !== null && e !== void 0 ? e : !1,
|
|
938
938
|
...v(t)
|
|
939
939
|
});
|
|
940
940
|
};
|
|
941
|
-
function
|
|
941
|
+
function xt(t, e) {
|
|
942
942
|
const s = (t.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, r = s > n ? s : n, a = parseInt(t.toFixed(r).replace(".", "")), i = parseInt(e.toFixed(r).replace(".", ""));
|
|
943
943
|
return a % i / Math.pow(10, r);
|
|
944
944
|
}
|
|
945
|
-
class
|
|
945
|
+
class q extends _ {
|
|
946
946
|
constructor() {
|
|
947
947
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
948
948
|
}
|
|
@@ -953,10 +953,10 @@ class $ extends _ {
|
|
|
953
953
|
code: c.invalid_type,
|
|
954
954
|
expected: f.number,
|
|
955
955
|
received: a.parsedType
|
|
956
|
-
}),
|
|
956
|
+
}), y;
|
|
957
957
|
}
|
|
958
958
|
let n;
|
|
959
|
-
const r = new
|
|
959
|
+
const r = new S();
|
|
960
960
|
for (const a of this._def.checks)
|
|
961
961
|
a.kind === "int" ? x.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
962
962
|
code: c.invalid_type,
|
|
@@ -977,7 +977,7 @@ class $ extends _ {
|
|
|
977
977
|
inclusive: a.inclusive,
|
|
978
978
|
exact: !1,
|
|
979
979
|
message: a.message
|
|
980
|
-
}), r.dirty()) : a.kind === "multipleOf" ?
|
|
980
|
+
}), r.dirty()) : a.kind === "multipleOf" ? xt(e.data, a.value) !== 0 && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
981
981
|
code: c.not_multiple_of,
|
|
982
982
|
multipleOf: a.value,
|
|
983
983
|
message: a.message
|
|
@@ -1000,7 +1000,7 @@ class $ extends _ {
|
|
|
1000
1000
|
return this.setLimit("max", e, !1, h.toString(s));
|
|
1001
1001
|
}
|
|
1002
1002
|
setLimit(e, s, n, r) {
|
|
1003
|
-
return new
|
|
1003
|
+
return new q({
|
|
1004
1004
|
...this._def,
|
|
1005
1005
|
checks: [
|
|
1006
1006
|
...this._def.checks,
|
|
@@ -1014,7 +1014,7 @@ class $ extends _ {
|
|
|
1014
1014
|
});
|
|
1015
1015
|
}
|
|
1016
1016
|
_addCheck(e) {
|
|
1017
|
-
return new
|
|
1017
|
+
return new q({
|
|
1018
1018
|
...this._def,
|
|
1019
1019
|
checks: [...this._def.checks, e]
|
|
1020
1020
|
});
|
|
@@ -1108,13 +1108,13 @@ class $ extends _ {
|
|
|
1108
1108
|
return Number.isFinite(s) && Number.isFinite(e);
|
|
1109
1109
|
}
|
|
1110
1110
|
}
|
|
1111
|
-
|
|
1111
|
+
q.create = (t) => new q({
|
|
1112
1112
|
checks: [],
|
|
1113
|
-
typeName:
|
|
1113
|
+
typeName: m.ZodNumber,
|
|
1114
1114
|
coerce: (t == null ? void 0 : t.coerce) || !1,
|
|
1115
1115
|
...v(t)
|
|
1116
1116
|
});
|
|
1117
|
-
class
|
|
1117
|
+
class $ extends _ {
|
|
1118
1118
|
constructor() {
|
|
1119
1119
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1120
1120
|
}
|
|
@@ -1125,10 +1125,10 @@ class U extends _ {
|
|
|
1125
1125
|
code: c.invalid_type,
|
|
1126
1126
|
expected: f.bigint,
|
|
1127
1127
|
received: a.parsedType
|
|
1128
|
-
}),
|
|
1128
|
+
}), y;
|
|
1129
1129
|
}
|
|
1130
1130
|
let n;
|
|
1131
|
-
const r = new
|
|
1131
|
+
const r = new S();
|
|
1132
1132
|
for (const a of this._def.checks)
|
|
1133
1133
|
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1134
1134
|
code: c.too_small,
|
|
@@ -1162,7 +1162,7 @@ class U extends _ {
|
|
|
1162
1162
|
return this.setLimit("max", e, !1, h.toString(s));
|
|
1163
1163
|
}
|
|
1164
1164
|
setLimit(e, s, n, r) {
|
|
1165
|
-
return new
|
|
1165
|
+
return new $({
|
|
1166
1166
|
...this._def,
|
|
1167
1167
|
checks: [
|
|
1168
1168
|
...this._def.checks,
|
|
@@ -1176,7 +1176,7 @@ class U extends _ {
|
|
|
1176
1176
|
});
|
|
1177
1177
|
}
|
|
1178
1178
|
_addCheck(e) {
|
|
1179
|
-
return new
|
|
1179
|
+
return new $({
|
|
1180
1180
|
...this._def,
|
|
1181
1181
|
checks: [...this._def.checks, e]
|
|
1182
1182
|
});
|
|
@@ -1233,16 +1233,16 @@ class U extends _ {
|
|
|
1233
1233
|
return e;
|
|
1234
1234
|
}
|
|
1235
1235
|
}
|
|
1236
|
-
|
|
1236
|
+
$.create = (t) => {
|
|
1237
1237
|
var e;
|
|
1238
|
-
return new
|
|
1238
|
+
return new $({
|
|
1239
1239
|
checks: [],
|
|
1240
|
-
typeName:
|
|
1240
|
+
typeName: m.ZodBigInt,
|
|
1241
1241
|
coerce: (e = t == null ? void 0 : t.coerce) !== null && e !== void 0 ? e : !1,
|
|
1242
1242
|
...v(t)
|
|
1243
1243
|
});
|
|
1244
1244
|
};
|
|
1245
|
-
class
|
|
1245
|
+
class re extends _ {
|
|
1246
1246
|
_parse(e) {
|
|
1247
1247
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== f.boolean) {
|
|
1248
1248
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1250,13 +1250,13 @@ class ne extends _ {
|
|
|
1250
1250
|
code: c.invalid_type,
|
|
1251
1251
|
expected: f.boolean,
|
|
1252
1252
|
received: n.parsedType
|
|
1253
|
-
}),
|
|
1253
|
+
}), y;
|
|
1254
1254
|
}
|
|
1255
1255
|
return T(e.data);
|
|
1256
1256
|
}
|
|
1257
1257
|
}
|
|
1258
|
-
|
|
1259
|
-
typeName:
|
|
1258
|
+
re.create = (t) => new re({
|
|
1259
|
+
typeName: m.ZodBoolean,
|
|
1260
1260
|
coerce: (t == null ? void 0 : t.coerce) || !1,
|
|
1261
1261
|
...v(t)
|
|
1262
1262
|
});
|
|
@@ -1268,15 +1268,15 @@ class z extends _ {
|
|
|
1268
1268
|
code: c.invalid_type,
|
|
1269
1269
|
expected: f.date,
|
|
1270
1270
|
received: a.parsedType
|
|
1271
|
-
}),
|
|
1271
|
+
}), y;
|
|
1272
1272
|
}
|
|
1273
1273
|
if (isNaN(e.data.getTime())) {
|
|
1274
1274
|
const a = this._getOrReturnCtx(e);
|
|
1275
1275
|
return l(a, {
|
|
1276
1276
|
code: c.invalid_date
|
|
1277
|
-
}),
|
|
1277
|
+
}), y;
|
|
1278
1278
|
}
|
|
1279
|
-
const n = new
|
|
1279
|
+
const n = new S();
|
|
1280
1280
|
let r;
|
|
1281
1281
|
for (const a of this._def.checks)
|
|
1282
1282
|
a.kind === "min" ? e.data.getTime() < a.value && (r = this._getOrReturnCtx(e, r), l(r, {
|
|
@@ -1335,10 +1335,10 @@ class z extends _ {
|
|
|
1335
1335
|
z.create = (t) => new z({
|
|
1336
1336
|
checks: [],
|
|
1337
1337
|
coerce: (t == null ? void 0 : t.coerce) || !1,
|
|
1338
|
-
typeName:
|
|
1338
|
+
typeName: m.ZodDate,
|
|
1339
1339
|
...v(t)
|
|
1340
1340
|
});
|
|
1341
|
-
class
|
|
1341
|
+
class ke extends _ {
|
|
1342
1342
|
_parse(e) {
|
|
1343
1343
|
if (this._getType(e) !== f.symbol) {
|
|
1344
1344
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1346,16 +1346,16 @@ class xe extends _ {
|
|
|
1346
1346
|
code: c.invalid_type,
|
|
1347
1347
|
expected: f.symbol,
|
|
1348
1348
|
received: n.parsedType
|
|
1349
|
-
}),
|
|
1349
|
+
}), y;
|
|
1350
1350
|
}
|
|
1351
1351
|
return T(e.data);
|
|
1352
1352
|
}
|
|
1353
1353
|
}
|
|
1354
|
-
|
|
1355
|
-
typeName:
|
|
1354
|
+
ke.create = (t) => new ke({
|
|
1355
|
+
typeName: m.ZodSymbol,
|
|
1356
1356
|
...v(t)
|
|
1357
1357
|
});
|
|
1358
|
-
class
|
|
1358
|
+
class ae extends _ {
|
|
1359
1359
|
_parse(e) {
|
|
1360
1360
|
if (this._getType(e) !== f.undefined) {
|
|
1361
1361
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1363,16 +1363,16 @@ class re extends _ {
|
|
|
1363
1363
|
code: c.invalid_type,
|
|
1364
1364
|
expected: f.undefined,
|
|
1365
1365
|
received: n.parsedType
|
|
1366
|
-
}),
|
|
1366
|
+
}), y;
|
|
1367
1367
|
}
|
|
1368
1368
|
return T(e.data);
|
|
1369
1369
|
}
|
|
1370
1370
|
}
|
|
1371
|
-
|
|
1372
|
-
typeName:
|
|
1371
|
+
ae.create = (t) => new ae({
|
|
1372
|
+
typeName: m.ZodUndefined,
|
|
1373
1373
|
...v(t)
|
|
1374
1374
|
});
|
|
1375
|
-
class
|
|
1375
|
+
class ie extends _ {
|
|
1376
1376
|
_parse(e) {
|
|
1377
1377
|
if (this._getType(e) !== f.null) {
|
|
1378
1378
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1380,13 +1380,13 @@ class ae extends _ {
|
|
|
1380
1380
|
code: c.invalid_type,
|
|
1381
1381
|
expected: f.null,
|
|
1382
1382
|
received: n.parsedType
|
|
1383
|
-
}),
|
|
1383
|
+
}), y;
|
|
1384
1384
|
}
|
|
1385
1385
|
return T(e.data);
|
|
1386
1386
|
}
|
|
1387
1387
|
}
|
|
1388
|
-
|
|
1389
|
-
typeName:
|
|
1388
|
+
ie.create = (t) => new ie({
|
|
1389
|
+
typeName: m.ZodNull,
|
|
1390
1390
|
...v(t)
|
|
1391
1391
|
});
|
|
1392
1392
|
class J extends _ {
|
|
@@ -1398,7 +1398,7 @@ class J extends _ {
|
|
|
1398
1398
|
}
|
|
1399
1399
|
}
|
|
1400
1400
|
J.create = (t) => new J({
|
|
1401
|
-
typeName:
|
|
1401
|
+
typeName: m.ZodAny,
|
|
1402
1402
|
...v(t)
|
|
1403
1403
|
});
|
|
1404
1404
|
class B extends _ {
|
|
@@ -1410,7 +1410,7 @@ class B extends _ {
|
|
|
1410
1410
|
}
|
|
1411
1411
|
}
|
|
1412
1412
|
B.create = (t) => new B({
|
|
1413
|
-
typeName:
|
|
1413
|
+
typeName: m.ZodUnknown,
|
|
1414
1414
|
...v(t)
|
|
1415
1415
|
});
|
|
1416
1416
|
class A extends _ {
|
|
@@ -1420,14 +1420,14 @@ class A extends _ {
|
|
|
1420
1420
|
code: c.invalid_type,
|
|
1421
1421
|
expected: f.never,
|
|
1422
1422
|
received: s.parsedType
|
|
1423
|
-
}),
|
|
1423
|
+
}), y;
|
|
1424
1424
|
}
|
|
1425
1425
|
}
|
|
1426
1426
|
A.create = (t) => new A({
|
|
1427
|
-
typeName:
|
|
1427
|
+
typeName: m.ZodNever,
|
|
1428
1428
|
...v(t)
|
|
1429
1429
|
});
|
|
1430
|
-
class
|
|
1430
|
+
class we extends _ {
|
|
1431
1431
|
_parse(e) {
|
|
1432
1432
|
if (this._getType(e) !== f.undefined) {
|
|
1433
1433
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1435,16 +1435,16 @@ class be extends _ {
|
|
|
1435
1435
|
code: c.invalid_type,
|
|
1436
1436
|
expected: f.void,
|
|
1437
1437
|
received: n.parsedType
|
|
1438
|
-
}),
|
|
1438
|
+
}), y;
|
|
1439
1439
|
}
|
|
1440
1440
|
return T(e.data);
|
|
1441
1441
|
}
|
|
1442
1442
|
}
|
|
1443
|
-
|
|
1444
|
-
typeName:
|
|
1443
|
+
we.create = (t) => new we({
|
|
1444
|
+
typeName: m.ZodVoid,
|
|
1445
1445
|
...v(t)
|
|
1446
1446
|
});
|
|
1447
|
-
class
|
|
1447
|
+
class Z extends _ {
|
|
1448
1448
|
_parse(e) {
|
|
1449
1449
|
const { ctx: s, status: n } = this._processInputParams(e), r = this._def;
|
|
1450
1450
|
if (s.parsedType !== f.array)
|
|
@@ -1452,7 +1452,7 @@ class E extends _ {
|
|
|
1452
1452
|
code: c.invalid_type,
|
|
1453
1453
|
expected: f.array,
|
|
1454
1454
|
received: s.parsedType
|
|
1455
|
-
}),
|
|
1455
|
+
}), y;
|
|
1456
1456
|
if (r.exactLength !== null) {
|
|
1457
1457
|
const i = s.data.length > r.exactLength.value, o = s.data.length < r.exactLength.value;
|
|
1458
1458
|
(i || o) && (l(s, {
|
|
@@ -1480,27 +1480,27 @@ class E extends _ {
|
|
|
1480
1480
|
exact: !1,
|
|
1481
1481
|
message: r.maxLength.message
|
|
1482
1482
|
}), n.dirty()), s.common.async)
|
|
1483
|
-
return Promise.all([...s.data].map((i, o) => r.type._parseAsync(new M(s, i, s.path, o)))).then((i) =>
|
|
1483
|
+
return Promise.all([...s.data].map((i, o) => r.type._parseAsync(new M(s, i, s.path, o)))).then((i) => S.mergeArray(n, i));
|
|
1484
1484
|
const a = [...s.data].map((i, o) => r.type._parseSync(new M(s, i, s.path, o)));
|
|
1485
|
-
return
|
|
1485
|
+
return S.mergeArray(n, a);
|
|
1486
1486
|
}
|
|
1487
1487
|
get element() {
|
|
1488
1488
|
return this._def.type;
|
|
1489
1489
|
}
|
|
1490
1490
|
min(e, s) {
|
|
1491
|
-
return new
|
|
1491
|
+
return new Z({
|
|
1492
1492
|
...this._def,
|
|
1493
1493
|
minLength: { value: e, message: h.toString(s) }
|
|
1494
1494
|
});
|
|
1495
1495
|
}
|
|
1496
1496
|
max(e, s) {
|
|
1497
|
-
return new
|
|
1497
|
+
return new Z({
|
|
1498
1498
|
...this._def,
|
|
1499
1499
|
maxLength: { value: e, message: h.toString(s) }
|
|
1500
1500
|
});
|
|
1501
1501
|
}
|
|
1502
1502
|
length(e, s) {
|
|
1503
|
-
return new
|
|
1503
|
+
return new Z({
|
|
1504
1504
|
...this._def,
|
|
1505
1505
|
exactLength: { value: e, message: h.toString(s) }
|
|
1506
1506
|
});
|
|
@@ -1509,30 +1509,30 @@ class E extends _ {
|
|
|
1509
1509
|
return this.min(1, e);
|
|
1510
1510
|
}
|
|
1511
1511
|
}
|
|
1512
|
-
|
|
1512
|
+
Z.create = (t, e) => new Z({
|
|
1513
1513
|
type: t,
|
|
1514
1514
|
minLength: null,
|
|
1515
1515
|
maxLength: null,
|
|
1516
1516
|
exactLength: null,
|
|
1517
|
-
typeName:
|
|
1517
|
+
typeName: m.ZodArray,
|
|
1518
1518
|
...v(e)
|
|
1519
1519
|
});
|
|
1520
|
-
function
|
|
1520
|
+
function Q(t) {
|
|
1521
1521
|
if (t instanceof b) {
|
|
1522
1522
|
const e = {};
|
|
1523
1523
|
for (const s in t.shape) {
|
|
1524
1524
|
const n = t.shape[s];
|
|
1525
|
-
e[s] =
|
|
1525
|
+
e[s] = I.create(Q(n));
|
|
1526
1526
|
}
|
|
1527
1527
|
return new b({
|
|
1528
1528
|
...t._def,
|
|
1529
1529
|
shape: () => e
|
|
1530
1530
|
});
|
|
1531
1531
|
} else
|
|
1532
|
-
return t instanceof
|
|
1532
|
+
return t instanceof Z ? new Z({
|
|
1533
1533
|
...t._def,
|
|
1534
|
-
type:
|
|
1535
|
-
}) : t instanceof
|
|
1534
|
+
type: Q(t.element)
|
|
1535
|
+
}) : t instanceof I ? I.create(Q(t.unwrap())) : t instanceof L ? L.create(Q(t.unwrap())) : t instanceof N ? N.create(t.items.map((e) => Q(e))) : t;
|
|
1536
1536
|
}
|
|
1537
1537
|
class b extends _ {
|
|
1538
1538
|
constructor() {
|
|
@@ -1551,7 +1551,7 @@ class b extends _ {
|
|
|
1551
1551
|
code: c.invalid_type,
|
|
1552
1552
|
expected: f.object,
|
|
1553
1553
|
received: u.parsedType
|
|
1554
|
-
}),
|
|
1554
|
+
}), y;
|
|
1555
1555
|
}
|
|
1556
1556
|
const { status: n, ctx: r } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
|
|
1557
1557
|
if (!(this._def.catchall instanceof A && this._def.unknownKeys === "strip"))
|
|
@@ -1559,20 +1559,20 @@ class b extends _ {
|
|
|
1559
1559
|
i.includes(u) || o.push(u);
|
|
1560
1560
|
const d = [];
|
|
1561
1561
|
for (const u of i) {
|
|
1562
|
-
const
|
|
1562
|
+
const g = a[u], R = r.data[u];
|
|
1563
1563
|
d.push({
|
|
1564
1564
|
key: { status: "valid", value: u },
|
|
1565
|
-
value:
|
|
1565
|
+
value: g._parse(new M(r, R, r.path, u)),
|
|
1566
1566
|
alwaysSet: u in r.data
|
|
1567
1567
|
});
|
|
1568
1568
|
}
|
|
1569
1569
|
if (this._def.catchall instanceof A) {
|
|
1570
1570
|
const u = this._def.unknownKeys;
|
|
1571
1571
|
if (u === "passthrough")
|
|
1572
|
-
for (const
|
|
1572
|
+
for (const g of o)
|
|
1573
1573
|
d.push({
|
|
1574
|
-
key: { status: "valid", value:
|
|
1575
|
-
value: { status: "valid", value: r.data[
|
|
1574
|
+
key: { status: "valid", value: g },
|
|
1575
|
+
value: { status: "valid", value: r.data[g] }
|
|
1576
1576
|
});
|
|
1577
1577
|
else if (u === "strict")
|
|
1578
1578
|
o.length > 0 && (l(r, {
|
|
@@ -1583,30 +1583,30 @@ class b extends _ {
|
|
|
1583
1583
|
throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
1584
1584
|
} else {
|
|
1585
1585
|
const u = this._def.catchall;
|
|
1586
|
-
for (const
|
|
1587
|
-
const R = r.data[
|
|
1586
|
+
for (const g of o) {
|
|
1587
|
+
const R = r.data[g];
|
|
1588
1588
|
d.push({
|
|
1589
|
-
key: { status: "valid", value:
|
|
1589
|
+
key: { status: "valid", value: g },
|
|
1590
1590
|
value: u._parse(
|
|
1591
|
-
new M(r, R, r.path,
|
|
1591
|
+
new M(r, R, r.path, g)
|
|
1592
1592
|
//, ctx.child(key), value, getParsedType(value)
|
|
1593
1593
|
),
|
|
1594
|
-
alwaysSet:
|
|
1594
|
+
alwaysSet: g in r.data
|
|
1595
1595
|
});
|
|
1596
1596
|
}
|
|
1597
1597
|
}
|
|
1598
1598
|
return r.common.async ? Promise.resolve().then(async () => {
|
|
1599
1599
|
const u = [];
|
|
1600
|
-
for (const
|
|
1601
|
-
const R = await
|
|
1600
|
+
for (const g of d) {
|
|
1601
|
+
const R = await g.key, D = await g.value;
|
|
1602
1602
|
u.push({
|
|
1603
1603
|
key: R,
|
|
1604
1604
|
value: D,
|
|
1605
|
-
alwaysSet:
|
|
1605
|
+
alwaysSet: g.alwaysSet
|
|
1606
1606
|
});
|
|
1607
1607
|
}
|
|
1608
1608
|
return u;
|
|
1609
|
-
}).then((u) =>
|
|
1609
|
+
}).then((u) => S.mergeObjectSync(n, u)) : S.mergeObjectSync(n, d);
|
|
1610
1610
|
}
|
|
1611
1611
|
get shape() {
|
|
1612
1612
|
return this._def.shape();
|
|
@@ -1679,7 +1679,7 @@ class b extends _ {
|
|
|
1679
1679
|
...this._def.shape(),
|
|
1680
1680
|
...e._def.shape()
|
|
1681
1681
|
}),
|
|
1682
|
-
typeName:
|
|
1682
|
+
typeName: m.ZodObject
|
|
1683
1683
|
});
|
|
1684
1684
|
}
|
|
1685
1685
|
// merge<
|
|
@@ -1769,7 +1769,7 @@ class b extends _ {
|
|
|
1769
1769
|
* @deprecated
|
|
1770
1770
|
*/
|
|
1771
1771
|
deepPartial() {
|
|
1772
|
-
return
|
|
1772
|
+
return Q(this);
|
|
1773
1773
|
}
|
|
1774
1774
|
partial(e) {
|
|
1775
1775
|
const s = {};
|
|
@@ -1788,7 +1788,7 @@ class b extends _ {
|
|
|
1788
1788
|
s[n] = this.shape[n];
|
|
1789
1789
|
else {
|
|
1790
1790
|
let a = this.shape[n];
|
|
1791
|
-
for (; a instanceof
|
|
1791
|
+
for (; a instanceof I; )
|
|
1792
1792
|
a = a._def.innerType;
|
|
1793
1793
|
s[n] = a;
|
|
1794
1794
|
}
|
|
@@ -1805,24 +1805,24 @@ b.create = (t, e) => new b({
|
|
|
1805
1805
|
shape: () => t,
|
|
1806
1806
|
unknownKeys: "strip",
|
|
1807
1807
|
catchall: A.create(),
|
|
1808
|
-
typeName:
|
|
1808
|
+
typeName: m.ZodObject,
|
|
1809
1809
|
...v(e)
|
|
1810
1810
|
});
|
|
1811
1811
|
b.strictCreate = (t, e) => new b({
|
|
1812
1812
|
shape: () => t,
|
|
1813
1813
|
unknownKeys: "strict",
|
|
1814
1814
|
catchall: A.create(),
|
|
1815
|
-
typeName:
|
|
1815
|
+
typeName: m.ZodObject,
|
|
1816
1816
|
...v(e)
|
|
1817
1817
|
});
|
|
1818
1818
|
b.lazycreate = (t, e) => new b({
|
|
1819
1819
|
shape: t,
|
|
1820
1820
|
unknownKeys: "strip",
|
|
1821
1821
|
catchall: A.create(),
|
|
1822
|
-
typeName:
|
|
1822
|
+
typeName: m.ZodObject,
|
|
1823
1823
|
...v(e)
|
|
1824
1824
|
});
|
|
1825
|
-
class
|
|
1825
|
+
class oe extends _ {
|
|
1826
1826
|
_parse(e) {
|
|
1827
1827
|
const { ctx: s } = this._processInputParams(e), n = this._def.options;
|
|
1828
1828
|
function r(a) {
|
|
@@ -1832,11 +1832,11 @@ class ie extends _ {
|
|
|
1832
1832
|
for (const o of a)
|
|
1833
1833
|
if (o.result.status === "dirty")
|
|
1834
1834
|
return s.common.issues.push(...o.ctx.common.issues), o.result;
|
|
1835
|
-
const i = a.map((o) => new
|
|
1835
|
+
const i = a.map((o) => new E(o.ctx.common.issues));
|
|
1836
1836
|
return l(s, {
|
|
1837
1837
|
code: c.invalid_union,
|
|
1838
1838
|
unionErrors: i
|
|
1839
|
-
}),
|
|
1839
|
+
}), y;
|
|
1840
1840
|
}
|
|
1841
1841
|
if (s.common.async)
|
|
1842
1842
|
return Promise.all(n.map(async (a) => {
|
|
@@ -1868,35 +1868,35 @@ class ie extends _ {
|
|
|
1868
1868
|
issues: []
|
|
1869
1869
|
},
|
|
1870
1870
|
parent: null
|
|
1871
|
-
},
|
|
1871
|
+
}, g = d._parseSync({
|
|
1872
1872
|
data: s.data,
|
|
1873
1873
|
path: s.path,
|
|
1874
1874
|
parent: u
|
|
1875
1875
|
});
|
|
1876
|
-
if (
|
|
1877
|
-
return
|
|
1878
|
-
|
|
1876
|
+
if (g.status === "valid")
|
|
1877
|
+
return g;
|
|
1878
|
+
g.status === "dirty" && !a && (a = { result: g, ctx: u }), u.common.issues.length && i.push(u.common.issues);
|
|
1879
1879
|
}
|
|
1880
1880
|
if (a)
|
|
1881
1881
|
return s.common.issues.push(...a.ctx.common.issues), a.result;
|
|
1882
|
-
const o = i.map((d) => new
|
|
1882
|
+
const o = i.map((d) => new E(d));
|
|
1883
1883
|
return l(s, {
|
|
1884
1884
|
code: c.invalid_union,
|
|
1885
1885
|
unionErrors: o
|
|
1886
|
-
}),
|
|
1886
|
+
}), y;
|
|
1887
1887
|
}
|
|
1888
1888
|
}
|
|
1889
1889
|
get options() {
|
|
1890
1890
|
return this._def.options;
|
|
1891
1891
|
}
|
|
1892
1892
|
}
|
|
1893
|
-
|
|
1893
|
+
oe.create = (t, e) => new oe({
|
|
1894
1894
|
options: t,
|
|
1895
|
-
typeName:
|
|
1895
|
+
typeName: m.ZodUnion,
|
|
1896
1896
|
...v(e)
|
|
1897
1897
|
});
|
|
1898
|
-
const j = (t) => t instanceof
|
|
1899
|
-
class
|
|
1898
|
+
const j = (t) => t instanceof ue ? j(t.schema) : t instanceof O ? j(t.innerType()) : t instanceof le ? [t.value] : t instanceof U ? t.options : t instanceof fe ? x.objectValues(t.enum) : t instanceof he ? j(t._def.innerType) : t instanceof ae ? [void 0] : t instanceof ie ? [null] : t instanceof I ? [void 0, ...j(t.unwrap())] : t instanceof L ? [null, ...j(t.unwrap())] : t instanceof Ne || t instanceof me ? j(t.unwrap()) : t instanceof pe ? j(t._def.innerType) : [];
|
|
1899
|
+
class Re extends _ {
|
|
1900
1900
|
_parse(e) {
|
|
1901
1901
|
const { ctx: s } = this._processInputParams(e);
|
|
1902
1902
|
if (s.parsedType !== f.object)
|
|
@@ -1904,7 +1904,7 @@ class Te extends _ {
|
|
|
1904
1904
|
code: c.invalid_type,
|
|
1905
1905
|
expected: f.object,
|
|
1906
1906
|
received: s.parsedType
|
|
1907
|
-
}),
|
|
1907
|
+
}), y;
|
|
1908
1908
|
const n = this.discriminator, r = s.data[n], a = this.optionsMap.get(r);
|
|
1909
1909
|
return a ? s.common.async ? a._parseAsync({
|
|
1910
1910
|
data: s.data,
|
|
@@ -1918,7 +1918,7 @@ class Te extends _ {
|
|
|
1918
1918
|
code: c.invalid_union_discriminator,
|
|
1919
1919
|
options: Array.from(this.optionsMap.keys()),
|
|
1920
1920
|
path: [n]
|
|
1921
|
-
}),
|
|
1921
|
+
}), y);
|
|
1922
1922
|
}
|
|
1923
1923
|
get discriminator() {
|
|
1924
1924
|
return this._def.discriminator;
|
|
@@ -1949,8 +1949,8 @@ class Te extends _ {
|
|
|
1949
1949
|
r.set(o, a);
|
|
1950
1950
|
}
|
|
1951
1951
|
}
|
|
1952
|
-
return new
|
|
1953
|
-
typeName:
|
|
1952
|
+
return new Re({
|
|
1953
|
+
typeName: m.ZodDiscriminatedUnion,
|
|
1954
1954
|
discriminator: e,
|
|
1955
1955
|
options: s,
|
|
1956
1956
|
optionsMap: r,
|
|
@@ -1958,14 +1958,14 @@ class Te extends _ {
|
|
|
1958
1958
|
});
|
|
1959
1959
|
}
|
|
1960
1960
|
}
|
|
1961
|
-
function
|
|
1961
|
+
function Me(t, e) {
|
|
1962
1962
|
const s = P(t), n = P(e);
|
|
1963
1963
|
if (t === e)
|
|
1964
1964
|
return { valid: !0, data: t };
|
|
1965
1965
|
if (s === f.object && n === f.object) {
|
|
1966
1966
|
const r = x.objectKeys(e), a = x.objectKeys(t).filter((o) => r.indexOf(o) !== -1), i = { ...t, ...e };
|
|
1967
1967
|
for (const o of a) {
|
|
1968
|
-
const d =
|
|
1968
|
+
const d = Me(t[o], e[o]);
|
|
1969
1969
|
if (!d.valid)
|
|
1970
1970
|
return { valid: !1 };
|
|
1971
1971
|
i[o] = d.data;
|
|
@@ -1976,7 +1976,7 @@ function Ne(t, e) {
|
|
|
1976
1976
|
return { valid: !1 };
|
|
1977
1977
|
const r = [];
|
|
1978
1978
|
for (let a = 0; a < t.length; a++) {
|
|
1979
|
-
const i = t[a], o = e[a], d =
|
|
1979
|
+
const i = t[a], o = e[a], d = Me(i, o);
|
|
1980
1980
|
if (!d.valid)
|
|
1981
1981
|
return { valid: !1 };
|
|
1982
1982
|
r.push(d.data);
|
|
@@ -1985,15 +1985,15 @@ function Ne(t, e) {
|
|
|
1985
1985
|
} else
|
|
1986
1986
|
return s === f.date && n === f.date && +t == +e ? { valid: !0, data: t } : { valid: !1 };
|
|
1987
1987
|
}
|
|
1988
|
-
class
|
|
1988
|
+
class ce extends _ {
|
|
1989
1989
|
_parse(e) {
|
|
1990
1990
|
const { status: s, ctx: n } = this._processInputParams(e), r = (a, i) => {
|
|
1991
|
-
if (
|
|
1992
|
-
return
|
|
1993
|
-
const o =
|
|
1994
|
-
return o.valid ? ((
|
|
1991
|
+
if (Oe(a) || Oe(i))
|
|
1992
|
+
return y;
|
|
1993
|
+
const o = Me(a.value, i.value);
|
|
1994
|
+
return o.valid ? ((Ie(a) || Ie(i)) && s.dirty(), { status: s.value, value: o.data }) : (l(n, {
|
|
1995
1995
|
code: c.invalid_intersection_types
|
|
1996
|
-
}),
|
|
1996
|
+
}), y);
|
|
1997
1997
|
};
|
|
1998
1998
|
return n.common.async ? Promise.all([
|
|
1999
1999
|
this._def.left._parseAsync({
|
|
@@ -2017,13 +2017,13 @@ class oe extends _ {
|
|
|
2017
2017
|
}));
|
|
2018
2018
|
}
|
|
2019
2019
|
}
|
|
2020
|
-
|
|
2020
|
+
ce.create = (t, e, s) => new ce({
|
|
2021
2021
|
left: t,
|
|
2022
2022
|
right: e,
|
|
2023
|
-
typeName:
|
|
2023
|
+
typeName: m.ZodIntersection,
|
|
2024
2024
|
...v(s)
|
|
2025
2025
|
});
|
|
2026
|
-
class
|
|
2026
|
+
class N extends _ {
|
|
2027
2027
|
_parse(e) {
|
|
2028
2028
|
const { status: s, ctx: n } = this._processInputParams(e);
|
|
2029
2029
|
if (n.parsedType !== f.array)
|
|
@@ -2031,7 +2031,7 @@ class I extends _ {
|
|
|
2031
2031
|
code: c.invalid_type,
|
|
2032
2032
|
expected: f.array,
|
|
2033
2033
|
received: n.parsedType
|
|
2034
|
-
}),
|
|
2034
|
+
}), y;
|
|
2035
2035
|
if (n.data.length < this._def.items.length)
|
|
2036
2036
|
return l(n, {
|
|
2037
2037
|
code: c.too_small,
|
|
@@ -2039,7 +2039,7 @@ class I extends _ {
|
|
|
2039
2039
|
inclusive: !0,
|
|
2040
2040
|
exact: !1,
|
|
2041
2041
|
type: "array"
|
|
2042
|
-
}),
|
|
2042
|
+
}), y;
|
|
2043
2043
|
!this._def.rest && n.data.length > this._def.items.length && (l(n, {
|
|
2044
2044
|
code: c.too_big,
|
|
2045
2045
|
maximum: this._def.items.length,
|
|
@@ -2051,29 +2051,29 @@ class I extends _ {
|
|
|
2051
2051
|
const d = this._def.items[o] || this._def.rest;
|
|
2052
2052
|
return d ? d._parse(new M(n, i, n.path, o)) : null;
|
|
2053
2053
|
}).filter((i) => !!i);
|
|
2054
|
-
return n.common.async ? Promise.all(a).then((i) =>
|
|
2054
|
+
return n.common.async ? Promise.all(a).then((i) => S.mergeArray(s, i)) : S.mergeArray(s, a);
|
|
2055
2055
|
}
|
|
2056
2056
|
get items() {
|
|
2057
2057
|
return this._def.items;
|
|
2058
2058
|
}
|
|
2059
2059
|
rest(e) {
|
|
2060
|
-
return new
|
|
2060
|
+
return new N({
|
|
2061
2061
|
...this._def,
|
|
2062
2062
|
rest: e
|
|
2063
2063
|
});
|
|
2064
2064
|
}
|
|
2065
2065
|
}
|
|
2066
|
-
|
|
2066
|
+
N.create = (t, e) => {
|
|
2067
2067
|
if (!Array.isArray(t))
|
|
2068
2068
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2069
|
-
return new
|
|
2069
|
+
return new N({
|
|
2070
2070
|
items: t,
|
|
2071
|
-
typeName:
|
|
2071
|
+
typeName: m.ZodTuple,
|
|
2072
2072
|
rest: null,
|
|
2073
2073
|
...v(e)
|
|
2074
2074
|
});
|
|
2075
2075
|
};
|
|
2076
|
-
class
|
|
2076
|
+
class de extends _ {
|
|
2077
2077
|
get keySchema() {
|
|
2078
2078
|
return this._def.keyType;
|
|
2079
2079
|
}
|
|
@@ -2087,7 +2087,7 @@ class ce extends _ {
|
|
|
2087
2087
|
code: c.invalid_type,
|
|
2088
2088
|
expected: f.object,
|
|
2089
2089
|
received: n.parsedType
|
|
2090
|
-
}),
|
|
2090
|
+
}), y;
|
|
2091
2091
|
const r = [], a = this._def.keyType, i = this._def.valueType;
|
|
2092
2092
|
for (const o in n.data)
|
|
2093
2093
|
r.push({
|
|
@@ -2095,26 +2095,26 @@ class ce extends _ {
|
|
|
2095
2095
|
value: i._parse(new M(n, n.data[o], n.path, o)),
|
|
2096
2096
|
alwaysSet: o in n.data
|
|
2097
2097
|
});
|
|
2098
|
-
return n.common.async ?
|
|
2098
|
+
return n.common.async ? S.mergeObjectAsync(s, r) : S.mergeObjectSync(s, r);
|
|
2099
2099
|
}
|
|
2100
2100
|
get element() {
|
|
2101
2101
|
return this._def.valueType;
|
|
2102
2102
|
}
|
|
2103
2103
|
static create(e, s, n) {
|
|
2104
|
-
return s instanceof _ ? new
|
|
2104
|
+
return s instanceof _ ? new de({
|
|
2105
2105
|
keyType: e,
|
|
2106
2106
|
valueType: s,
|
|
2107
|
-
typeName:
|
|
2107
|
+
typeName: m.ZodRecord,
|
|
2108
2108
|
...v(n)
|
|
2109
|
-
}) : new
|
|
2110
|
-
keyType:
|
|
2109
|
+
}) : new de({
|
|
2110
|
+
keyType: C.create(),
|
|
2111
2111
|
valueType: e,
|
|
2112
|
-
typeName:
|
|
2112
|
+
typeName: m.ZodRecord,
|
|
2113
2113
|
...v(s)
|
|
2114
2114
|
});
|
|
2115
2115
|
}
|
|
2116
2116
|
}
|
|
2117
|
-
class
|
|
2117
|
+
class Se extends _ {
|
|
2118
2118
|
get keySchema() {
|
|
2119
2119
|
return this._def.keyType;
|
|
2120
2120
|
}
|
|
@@ -2128,7 +2128,7 @@ class ke extends _ {
|
|
|
2128
2128
|
code: c.invalid_type,
|
|
2129
2129
|
expected: f.map,
|
|
2130
2130
|
received: n.parsedType
|
|
2131
|
-
}),
|
|
2131
|
+
}), y;
|
|
2132
2132
|
const r = this._def.keyType, a = this._def.valueType, i = [...n.data.entries()].map(([o, d], u) => ({
|
|
2133
2133
|
key: r._parse(new M(n, o, n.path, [u, "key"])),
|
|
2134
2134
|
value: a._parse(new M(n, d, n.path, [u, "value"]))
|
|
@@ -2137,32 +2137,32 @@ class ke extends _ {
|
|
|
2137
2137
|
const o = /* @__PURE__ */ new Map();
|
|
2138
2138
|
return Promise.resolve().then(async () => {
|
|
2139
2139
|
for (const d of i) {
|
|
2140
|
-
const u = await d.key,
|
|
2141
|
-
if (u.status === "aborted" ||
|
|
2142
|
-
return
|
|
2143
|
-
(u.status === "dirty" ||
|
|
2140
|
+
const u = await d.key, g = await d.value;
|
|
2141
|
+
if (u.status === "aborted" || g.status === "aborted")
|
|
2142
|
+
return y;
|
|
2143
|
+
(u.status === "dirty" || g.status === "dirty") && s.dirty(), o.set(u.value, g.value);
|
|
2144
2144
|
}
|
|
2145
2145
|
return { status: s.value, value: o };
|
|
2146
2146
|
});
|
|
2147
2147
|
} else {
|
|
2148
2148
|
const o = /* @__PURE__ */ new Map();
|
|
2149
2149
|
for (const d of i) {
|
|
2150
|
-
const u = d.key,
|
|
2151
|
-
if (u.status === "aborted" ||
|
|
2152
|
-
return
|
|
2153
|
-
(u.status === "dirty" ||
|
|
2150
|
+
const u = d.key, g = d.value;
|
|
2151
|
+
if (u.status === "aborted" || g.status === "aborted")
|
|
2152
|
+
return y;
|
|
2153
|
+
(u.status === "dirty" || g.status === "dirty") && s.dirty(), o.set(u.value, g.value);
|
|
2154
2154
|
}
|
|
2155
2155
|
return { status: s.value, value: o };
|
|
2156
2156
|
}
|
|
2157
2157
|
}
|
|
2158
2158
|
}
|
|
2159
|
-
|
|
2159
|
+
Se.create = (t, e, s) => new Se({
|
|
2160
2160
|
valueType: e,
|
|
2161
2161
|
keyType: t,
|
|
2162
|
-
typeName:
|
|
2162
|
+
typeName: m.ZodMap,
|
|
2163
2163
|
...v(s)
|
|
2164
2164
|
});
|
|
2165
|
-
class
|
|
2165
|
+
class G extends _ {
|
|
2166
2166
|
_parse(e) {
|
|
2167
2167
|
const { status: s, ctx: n } = this._processInputParams(e);
|
|
2168
2168
|
if (n.parsedType !== f.set)
|
|
@@ -2170,7 +2170,7 @@ class Q extends _ {
|
|
|
2170
2170
|
code: c.invalid_type,
|
|
2171
2171
|
expected: f.set,
|
|
2172
2172
|
received: n.parsedType
|
|
2173
|
-
}),
|
|
2173
|
+
}), y;
|
|
2174
2174
|
const r = this._def;
|
|
2175
2175
|
r.minSize !== null && n.data.size < r.minSize.value && (l(n, {
|
|
2176
2176
|
code: c.too_small,
|
|
@@ -2190,10 +2190,10 @@ class Q extends _ {
|
|
|
2190
2190
|
const a = this._def.valueType;
|
|
2191
2191
|
function i(d) {
|
|
2192
2192
|
const u = /* @__PURE__ */ new Set();
|
|
2193
|
-
for (const
|
|
2194
|
-
if (
|
|
2195
|
-
return
|
|
2196
|
-
|
|
2193
|
+
for (const g of d) {
|
|
2194
|
+
if (g.status === "aborted")
|
|
2195
|
+
return y;
|
|
2196
|
+
g.status === "dirty" && s.dirty(), u.add(g.value);
|
|
2197
2197
|
}
|
|
2198
2198
|
return { status: s.value, value: u };
|
|
2199
2199
|
}
|
|
@@ -2201,13 +2201,13 @@ class Q extends _ {
|
|
|
2201
2201
|
return n.common.async ? Promise.all(o).then((d) => i(d)) : i(o);
|
|
2202
2202
|
}
|
|
2203
2203
|
min(e, s) {
|
|
2204
|
-
return new
|
|
2204
|
+
return new G({
|
|
2205
2205
|
...this._def,
|
|
2206
2206
|
minSize: { value: e, message: h.toString(s) }
|
|
2207
2207
|
});
|
|
2208
2208
|
}
|
|
2209
2209
|
max(e, s) {
|
|
2210
|
-
return new
|
|
2210
|
+
return new G({
|
|
2211
2211
|
...this._def,
|
|
2212
2212
|
maxSize: { value: e, message: h.toString(s) }
|
|
2213
2213
|
});
|
|
@@ -2219,11 +2219,11 @@ class Q extends _ {
|
|
|
2219
2219
|
return this.min(1, e);
|
|
2220
2220
|
}
|
|
2221
2221
|
}
|
|
2222
|
-
|
|
2222
|
+
G.create = (t, e) => new G({
|
|
2223
2223
|
valueType: t,
|
|
2224
2224
|
minSize: null,
|
|
2225
2225
|
maxSize: null,
|
|
2226
|
-
typeName:
|
|
2226
|
+
typeName: m.ZodSet,
|
|
2227
2227
|
...v(e)
|
|
2228
2228
|
});
|
|
2229
2229
|
class H extends _ {
|
|
@@ -2237,15 +2237,15 @@ class H extends _ {
|
|
|
2237
2237
|
code: c.invalid_type,
|
|
2238
2238
|
expected: f.function,
|
|
2239
2239
|
received: s.parsedType
|
|
2240
|
-
}),
|
|
2240
|
+
}), y;
|
|
2241
2241
|
function n(o, d) {
|
|
2242
|
-
return
|
|
2242
|
+
return xe({
|
|
2243
2243
|
data: o,
|
|
2244
2244
|
path: s.path,
|
|
2245
2245
|
errorMaps: [
|
|
2246
2246
|
s.common.contextualErrorMap,
|
|
2247
2247
|
s.schemaErrorMap,
|
|
2248
|
-
|
|
2248
|
+
_e(),
|
|
2249
2249
|
Y
|
|
2250
2250
|
].filter((u) => !!u),
|
|
2251
2251
|
issueData: {
|
|
@@ -2255,13 +2255,13 @@ class H extends _ {
|
|
|
2255
2255
|
});
|
|
2256
2256
|
}
|
|
2257
2257
|
function r(o, d) {
|
|
2258
|
-
return
|
|
2258
|
+
return xe({
|
|
2259
2259
|
data: o,
|
|
2260
2260
|
path: s.path,
|
|
2261
2261
|
errorMaps: [
|
|
2262
2262
|
s.common.contextualErrorMap,
|
|
2263
2263
|
s.schemaErrorMap,
|
|
2264
|
-
|
|
2264
|
+
_e(),
|
|
2265
2265
|
Y
|
|
2266
2266
|
].filter((u) => !!u),
|
|
2267
2267
|
issueData: {
|
|
@@ -2274,11 +2274,11 @@ class H extends _ {
|
|
|
2274
2274
|
if (this._def.returns instanceof X) {
|
|
2275
2275
|
const o = this;
|
|
2276
2276
|
return T(async function(...d) {
|
|
2277
|
-
const u = new
|
|
2278
|
-
throw u.addIssue(n(d,
|
|
2279
|
-
}), R = await Reflect.apply(i, this,
|
|
2280
|
-
return await o._def.returns._def.type.parseAsync(R, a).catch((
|
|
2281
|
-
throw u.addIssue(r(R,
|
|
2277
|
+
const u = new E([]), g = await o._def.args.parseAsync(d, a).catch((Ee) => {
|
|
2278
|
+
throw u.addIssue(n(d, Ee)), u;
|
|
2279
|
+
}), R = await Reflect.apply(i, this, g);
|
|
2280
|
+
return await o._def.returns._def.type.parseAsync(R, a).catch((Ee) => {
|
|
2281
|
+
throw u.addIssue(r(R, Ee)), u;
|
|
2282
2282
|
});
|
|
2283
2283
|
});
|
|
2284
2284
|
} else {
|
|
@@ -2286,10 +2286,10 @@ class H extends _ {
|
|
|
2286
2286
|
return T(function(...d) {
|
|
2287
2287
|
const u = o._def.args.safeParse(d, a);
|
|
2288
2288
|
if (!u.success)
|
|
2289
|
-
throw new
|
|
2290
|
-
const
|
|
2289
|
+
throw new E([n(d, u.error)]);
|
|
2290
|
+
const g = Reflect.apply(i, this, u.data), R = o._def.returns.safeParse(g, a);
|
|
2291
2291
|
if (!R.success)
|
|
2292
|
-
throw new
|
|
2292
|
+
throw new E([r(g, R.error)]);
|
|
2293
2293
|
return R.data;
|
|
2294
2294
|
});
|
|
2295
2295
|
}
|
|
@@ -2303,7 +2303,7 @@ class H extends _ {
|
|
|
2303
2303
|
args(...e) {
|
|
2304
2304
|
return new H({
|
|
2305
2305
|
...this._def,
|
|
2306
|
-
args:
|
|
2306
|
+
args: N.create(e).rest(B.create())
|
|
2307
2307
|
});
|
|
2308
2308
|
}
|
|
2309
2309
|
returns(e) {
|
|
@@ -2320,14 +2320,14 @@ class H extends _ {
|
|
|
2320
2320
|
}
|
|
2321
2321
|
static create(e, s, n) {
|
|
2322
2322
|
return new H({
|
|
2323
|
-
args: e ||
|
|
2323
|
+
args: e || N.create([]).rest(B.create()),
|
|
2324
2324
|
returns: s || B.create(),
|
|
2325
|
-
typeName:
|
|
2325
|
+
typeName: m.ZodFunction,
|
|
2326
2326
|
...v(n)
|
|
2327
2327
|
});
|
|
2328
2328
|
}
|
|
2329
2329
|
}
|
|
2330
|
-
class
|
|
2330
|
+
class ue extends _ {
|
|
2331
2331
|
get schema() {
|
|
2332
2332
|
return this._def.getter();
|
|
2333
2333
|
}
|
|
@@ -2336,12 +2336,12 @@ class de extends _ {
|
|
|
2336
2336
|
return this._def.getter()._parse({ data: s.data, path: s.path, parent: s });
|
|
2337
2337
|
}
|
|
2338
2338
|
}
|
|
2339
|
-
|
|
2339
|
+
ue.create = (t, e) => new ue({
|
|
2340
2340
|
getter: t,
|
|
2341
|
-
typeName:
|
|
2341
|
+
typeName: m.ZodLazy,
|
|
2342
2342
|
...v(e)
|
|
2343
2343
|
});
|
|
2344
|
-
class
|
|
2344
|
+
class le extends _ {
|
|
2345
2345
|
_parse(e) {
|
|
2346
2346
|
if (e.data !== this._def.value) {
|
|
2347
2347
|
const s = this._getOrReturnCtx(e);
|
|
@@ -2349,7 +2349,7 @@ class ue extends _ {
|
|
|
2349
2349
|
received: s.data,
|
|
2350
2350
|
code: c.invalid_literal,
|
|
2351
2351
|
expected: this._def.value
|
|
2352
|
-
}),
|
|
2352
|
+
}), y;
|
|
2353
2353
|
}
|
|
2354
2354
|
return { status: "valid", value: e.data };
|
|
2355
2355
|
}
|
|
@@ -2357,21 +2357,21 @@ class ue extends _ {
|
|
|
2357
2357
|
return this._def.value;
|
|
2358
2358
|
}
|
|
2359
2359
|
}
|
|
2360
|
-
|
|
2360
|
+
le.create = (t, e) => new le({
|
|
2361
2361
|
value: t,
|
|
2362
|
-
typeName:
|
|
2362
|
+
typeName: m.ZodLiteral,
|
|
2363
2363
|
...v(e)
|
|
2364
2364
|
});
|
|
2365
2365
|
function Be(t, e) {
|
|
2366
|
-
return new
|
|
2366
|
+
return new U({
|
|
2367
2367
|
values: t,
|
|
2368
|
-
typeName:
|
|
2368
|
+
typeName: m.ZodEnum,
|
|
2369
2369
|
...v(e)
|
|
2370
2370
|
});
|
|
2371
2371
|
}
|
|
2372
|
-
class
|
|
2372
|
+
class U extends _ {
|
|
2373
2373
|
constructor() {
|
|
2374
|
-
super(...arguments),
|
|
2374
|
+
super(...arguments), F.set(this, void 0);
|
|
2375
2375
|
}
|
|
2376
2376
|
_parse(e) {
|
|
2377
2377
|
if (typeof e.data != "string") {
|
|
@@ -2380,15 +2380,15 @@ class q extends _ {
|
|
|
2380
2380
|
expected: x.joinValues(n),
|
|
2381
2381
|
received: s.parsedType,
|
|
2382
2382
|
code: c.invalid_type
|
|
2383
|
-
}),
|
|
2383
|
+
}), y;
|
|
2384
2384
|
}
|
|
2385
|
-
if (
|
|
2385
|
+
if (be(this, F) || Ue(this, F, new Set(this._def.values)), !be(this, F).has(e.data)) {
|
|
2386
2386
|
const s = this._getOrReturnCtx(e), n = this._def.values;
|
|
2387
2387
|
return l(s, {
|
|
2388
2388
|
received: s.data,
|
|
2389
2389
|
code: c.invalid_enum_value,
|
|
2390
2390
|
options: n
|
|
2391
|
-
}),
|
|
2391
|
+
}), y;
|
|
2392
2392
|
}
|
|
2393
2393
|
return T(e.data);
|
|
2394
2394
|
}
|
|
@@ -2414,23 +2414,23 @@ class q extends _ {
|
|
|
2414
2414
|
return e;
|
|
2415
2415
|
}
|
|
2416
2416
|
extract(e, s = this._def) {
|
|
2417
|
-
return
|
|
2417
|
+
return U.create(e, {
|
|
2418
2418
|
...this._def,
|
|
2419
2419
|
...s
|
|
2420
2420
|
});
|
|
2421
2421
|
}
|
|
2422
2422
|
exclude(e, s = this._def) {
|
|
2423
|
-
return
|
|
2423
|
+
return U.create(this.options.filter((n) => !e.includes(n)), {
|
|
2424
2424
|
...this._def,
|
|
2425
2425
|
...s
|
|
2426
2426
|
});
|
|
2427
2427
|
}
|
|
2428
2428
|
}
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
class
|
|
2429
|
+
F = /* @__PURE__ */ new WeakMap();
|
|
2430
|
+
U.create = Be;
|
|
2431
|
+
class fe extends _ {
|
|
2432
2432
|
constructor() {
|
|
2433
|
-
super(...arguments),
|
|
2433
|
+
super(...arguments), ee.set(this, void 0);
|
|
2434
2434
|
}
|
|
2435
2435
|
_parse(e) {
|
|
2436
2436
|
const s = x.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
|
|
@@ -2440,15 +2440,15 @@ class le extends _ {
|
|
|
2440
2440
|
expected: x.joinValues(r),
|
|
2441
2441
|
received: n.parsedType,
|
|
2442
2442
|
code: c.invalid_type
|
|
2443
|
-
}),
|
|
2443
|
+
}), y;
|
|
2444
2444
|
}
|
|
2445
|
-
if (
|
|
2445
|
+
if (be(this, ee) || Ue(this, ee, new Set(x.getValidEnumValues(this._def.values))), !be(this, ee).has(e.data)) {
|
|
2446
2446
|
const r = x.objectValues(s);
|
|
2447
2447
|
return l(n, {
|
|
2448
2448
|
received: n.data,
|
|
2449
2449
|
code: c.invalid_enum_value,
|
|
2450
2450
|
options: r
|
|
2451
|
-
}),
|
|
2451
|
+
}), y;
|
|
2452
2452
|
}
|
|
2453
2453
|
return T(e.data);
|
|
2454
2454
|
}
|
|
@@ -2456,10 +2456,10 @@ class le extends _ {
|
|
|
2456
2456
|
return this._def.values;
|
|
2457
2457
|
}
|
|
2458
2458
|
}
|
|
2459
|
-
|
|
2460
|
-
|
|
2459
|
+
ee = /* @__PURE__ */ new WeakMap();
|
|
2460
|
+
fe.create = (t, e) => new fe({
|
|
2461
2461
|
values: t,
|
|
2462
|
-
typeName:
|
|
2462
|
+
typeName: m.ZodNativeEnum,
|
|
2463
2463
|
...v(e)
|
|
2464
2464
|
});
|
|
2465
2465
|
class X extends _ {
|
|
@@ -2473,7 +2473,7 @@ class X extends _ {
|
|
|
2473
2473
|
code: c.invalid_type,
|
|
2474
2474
|
expected: f.promise,
|
|
2475
2475
|
received: s.parsedType
|
|
2476
|
-
}),
|
|
2476
|
+
}), y;
|
|
2477
2477
|
const n = s.parsedType === f.promise ? s.data : Promise.resolve(s.data);
|
|
2478
2478
|
return T(n.then((r) => this._def.type.parseAsync(r, {
|
|
2479
2479
|
path: s.path,
|
|
@@ -2483,7 +2483,7 @@ class X extends _ {
|
|
|
2483
2483
|
}
|
|
2484
2484
|
X.create = (t, e) => new X({
|
|
2485
2485
|
type: t,
|
|
2486
|
-
typeName:
|
|
2486
|
+
typeName: m.ZodPromise,
|
|
2487
2487
|
...v(e)
|
|
2488
2488
|
});
|
|
2489
2489
|
class O extends _ {
|
|
@@ -2491,7 +2491,7 @@ class O extends _ {
|
|
|
2491
2491
|
return this._def.schema;
|
|
2492
2492
|
}
|
|
2493
2493
|
sourceType() {
|
|
2494
|
-
return this._def.schema._def.typeName ===
|
|
2494
|
+
return this._def.schema._def.typeName === m.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
2495
2495
|
}
|
|
2496
2496
|
_parse(e) {
|
|
2497
2497
|
const { status: s, ctx: n } = this._processInputParams(e), r = this._def.effect || null, a = {
|
|
@@ -2507,23 +2507,23 @@ class O extends _ {
|
|
|
2507
2507
|
if (n.common.async)
|
|
2508
2508
|
return Promise.resolve(i).then(async (o) => {
|
|
2509
2509
|
if (s.value === "aborted")
|
|
2510
|
-
return
|
|
2510
|
+
return y;
|
|
2511
2511
|
const d = await this._def.schema._parseAsync({
|
|
2512
2512
|
data: o,
|
|
2513
2513
|
path: n.path,
|
|
2514
2514
|
parent: n
|
|
2515
2515
|
});
|
|
2516
|
-
return d.status === "aborted" ?
|
|
2516
|
+
return d.status === "aborted" ? y : d.status === "dirty" || s.value === "dirty" ? W(d.value) : d;
|
|
2517
2517
|
});
|
|
2518
2518
|
{
|
|
2519
2519
|
if (s.value === "aborted")
|
|
2520
|
-
return
|
|
2520
|
+
return y;
|
|
2521
2521
|
const o = this._def.schema._parseSync({
|
|
2522
2522
|
data: i,
|
|
2523
2523
|
path: n.path,
|
|
2524
2524
|
parent: n
|
|
2525
2525
|
});
|
|
2526
|
-
return o.status === "aborted" ?
|
|
2526
|
+
return o.status === "aborted" ? y : o.status === "dirty" || s.value === "dirty" ? W(o.value) : o;
|
|
2527
2527
|
}
|
|
2528
2528
|
}
|
|
2529
2529
|
if (r.type === "refinement") {
|
|
@@ -2541,9 +2541,9 @@ class O extends _ {
|
|
|
2541
2541
|
path: n.path,
|
|
2542
2542
|
parent: n
|
|
2543
2543
|
});
|
|
2544
|
-
return o.status === "aborted" ?
|
|
2544
|
+
return o.status === "aborted" ? y : (o.status === "dirty" && s.dirty(), i(o.value), { status: s.value, value: o.value });
|
|
2545
2545
|
} else
|
|
2546
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => o.status === "aborted" ?
|
|
2546
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => o.status === "aborted" ? y : (o.status === "dirty" && s.dirty(), i(o.value).then(() => ({ status: s.value, value: o.value }))));
|
|
2547
2547
|
}
|
|
2548
2548
|
if (r.type === "transform")
|
|
2549
2549
|
if (n.common.async === !1) {
|
|
@@ -2552,30 +2552,30 @@ class O extends _ {
|
|
|
2552
2552
|
path: n.path,
|
|
2553
2553
|
parent: n
|
|
2554
2554
|
});
|
|
2555
|
-
if (!
|
|
2555
|
+
if (!se(i))
|
|
2556
2556
|
return i;
|
|
2557
2557
|
const o = r.transform(i.value, a);
|
|
2558
2558
|
if (o instanceof Promise)
|
|
2559
2559
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2560
2560
|
return { status: s.value, value: o };
|
|
2561
2561
|
} else
|
|
2562
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) =>
|
|
2562
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) => se(i) ? Promise.resolve(r.transform(i.value, a)).then((o) => ({ status: s.value, value: o })) : i);
|
|
2563
2563
|
x.assertNever(r);
|
|
2564
2564
|
}
|
|
2565
2565
|
}
|
|
2566
2566
|
O.create = (t, e, s) => new O({
|
|
2567
2567
|
schema: t,
|
|
2568
|
-
typeName:
|
|
2568
|
+
typeName: m.ZodEffects,
|
|
2569
2569
|
effect: e,
|
|
2570
2570
|
...v(s)
|
|
2571
2571
|
});
|
|
2572
2572
|
O.createWithPreprocess = (t, e, s) => new O({
|
|
2573
2573
|
schema: e,
|
|
2574
2574
|
effect: { type: "preprocess", transform: t },
|
|
2575
|
-
typeName:
|
|
2575
|
+
typeName: m.ZodEffects,
|
|
2576
2576
|
...v(s)
|
|
2577
2577
|
});
|
|
2578
|
-
class
|
|
2578
|
+
class I extends _ {
|
|
2579
2579
|
_parse(e) {
|
|
2580
2580
|
return this._getType(e) === f.undefined ? T(void 0) : this._def.innerType._parse(e);
|
|
2581
2581
|
}
|
|
@@ -2583,9 +2583,9 @@ class N extends _ {
|
|
|
2583
2583
|
return this._def.innerType;
|
|
2584
2584
|
}
|
|
2585
2585
|
}
|
|
2586
|
-
|
|
2586
|
+
I.create = (t, e) => new I({
|
|
2587
2587
|
innerType: t,
|
|
2588
|
-
typeName:
|
|
2588
|
+
typeName: m.ZodOptional,
|
|
2589
2589
|
...v(e)
|
|
2590
2590
|
});
|
|
2591
2591
|
class L extends _ {
|
|
@@ -2598,10 +2598,10 @@ class L extends _ {
|
|
|
2598
2598
|
}
|
|
2599
2599
|
L.create = (t, e) => new L({
|
|
2600
2600
|
innerType: t,
|
|
2601
|
-
typeName:
|
|
2601
|
+
typeName: m.ZodNullable,
|
|
2602
2602
|
...v(e)
|
|
2603
2603
|
});
|
|
2604
|
-
class
|
|
2604
|
+
class he extends _ {
|
|
2605
2605
|
_parse(e) {
|
|
2606
2606
|
const { ctx: s } = this._processInputParams(e);
|
|
2607
2607
|
let n = s.data;
|
|
@@ -2615,13 +2615,13 @@ class fe extends _ {
|
|
|
2615
2615
|
return this._def.innerType;
|
|
2616
2616
|
}
|
|
2617
2617
|
}
|
|
2618
|
-
|
|
2618
|
+
he.create = (t, e) => new he({
|
|
2619
2619
|
innerType: t,
|
|
2620
|
-
typeName:
|
|
2620
|
+
typeName: m.ZodDefault,
|
|
2621
2621
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
2622
2622
|
...v(e)
|
|
2623
2623
|
});
|
|
2624
|
-
class
|
|
2624
|
+
class pe extends _ {
|
|
2625
2625
|
_parse(e) {
|
|
2626
2626
|
const { ctx: s } = this._processInputParams(e), n = {
|
|
2627
2627
|
...s,
|
|
@@ -2636,11 +2636,11 @@ class he extends _ {
|
|
|
2636
2636
|
...n
|
|
2637
2637
|
}
|
|
2638
2638
|
});
|
|
2639
|
-
return
|
|
2639
|
+
return ne(r) ? r.then((a) => ({
|
|
2640
2640
|
status: "valid",
|
|
2641
2641
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
2642
2642
|
get error() {
|
|
2643
|
-
return new
|
|
2643
|
+
return new E(n.common.issues);
|
|
2644
2644
|
},
|
|
2645
2645
|
input: n.data
|
|
2646
2646
|
})
|
|
@@ -2648,7 +2648,7 @@ class he extends _ {
|
|
|
2648
2648
|
status: "valid",
|
|
2649
2649
|
value: r.status === "valid" ? r.value : this._def.catchValue({
|
|
2650
2650
|
get error() {
|
|
2651
|
-
return new
|
|
2651
|
+
return new E(n.common.issues);
|
|
2652
2652
|
},
|
|
2653
2653
|
input: n.data
|
|
2654
2654
|
})
|
|
@@ -2658,13 +2658,13 @@ class he extends _ {
|
|
|
2658
2658
|
return this._def.innerType;
|
|
2659
2659
|
}
|
|
2660
2660
|
}
|
|
2661
|
-
|
|
2661
|
+
pe.create = (t, e) => new pe({
|
|
2662
2662
|
innerType: t,
|
|
2663
|
-
typeName:
|
|
2663
|
+
typeName: m.ZodCatch,
|
|
2664
2664
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2665
2665
|
...v(e)
|
|
2666
2666
|
});
|
|
2667
|
-
class
|
|
2667
|
+
class Te extends _ {
|
|
2668
2668
|
_parse(e) {
|
|
2669
2669
|
if (this._getType(e) !== f.nan) {
|
|
2670
2670
|
const n = this._getOrReturnCtx(e);
|
|
@@ -2672,17 +2672,17 @@ class we extends _ {
|
|
|
2672
2672
|
code: c.invalid_type,
|
|
2673
2673
|
expected: f.nan,
|
|
2674
2674
|
received: n.parsedType
|
|
2675
|
-
}),
|
|
2675
|
+
}), y;
|
|
2676
2676
|
}
|
|
2677
2677
|
return { status: "valid", value: e.data };
|
|
2678
2678
|
}
|
|
2679
2679
|
}
|
|
2680
|
-
|
|
2681
|
-
typeName:
|
|
2680
|
+
Te.create = (t) => new Te({
|
|
2681
|
+
typeName: m.ZodNaN,
|
|
2682
2682
|
...v(t)
|
|
2683
2683
|
});
|
|
2684
|
-
const
|
|
2685
|
-
class
|
|
2684
|
+
const bt = Symbol("zod_brand");
|
|
2685
|
+
class Ne extends _ {
|
|
2686
2686
|
_parse(e) {
|
|
2687
2687
|
const { ctx: s } = this._processInputParams(e), n = s.data;
|
|
2688
2688
|
return this._def.type._parse({
|
|
@@ -2695,7 +2695,7 @@ class Me extends _ {
|
|
|
2695
2695
|
return this._def.type;
|
|
2696
2696
|
}
|
|
2697
2697
|
}
|
|
2698
|
-
class
|
|
2698
|
+
class ge extends _ {
|
|
2699
2699
|
_parse(e) {
|
|
2700
2700
|
const { status: s, ctx: n } = this._processInputParams(e);
|
|
2701
2701
|
if (n.common.async)
|
|
@@ -2705,7 +2705,7 @@ class me extends _ {
|
|
|
2705
2705
|
path: n.path,
|
|
2706
2706
|
parent: n
|
|
2707
2707
|
});
|
|
2708
|
-
return a.status === "aborted" ?
|
|
2708
|
+
return a.status === "aborted" ? y : a.status === "dirty" ? (s.dirty(), W(a.value)) : this._def.out._parseAsync({
|
|
2709
2709
|
data: a.value,
|
|
2710
2710
|
path: n.path,
|
|
2711
2711
|
parent: n
|
|
@@ -2717,7 +2717,7 @@ class me extends _ {
|
|
|
2717
2717
|
path: n.path,
|
|
2718
2718
|
parent: n
|
|
2719
2719
|
});
|
|
2720
|
-
return r.status === "aborted" ?
|
|
2720
|
+
return r.status === "aborted" ? y : r.status === "dirty" ? (s.dirty(), {
|
|
2721
2721
|
status: "dirty",
|
|
2722
2722
|
value: r.value
|
|
2723
2723
|
}) : this._def.out._parseSync({
|
|
@@ -2728,25 +2728,25 @@ class me extends _ {
|
|
|
2728
2728
|
}
|
|
2729
2729
|
}
|
|
2730
2730
|
static create(e, s) {
|
|
2731
|
-
return new
|
|
2731
|
+
return new ge({
|
|
2732
2732
|
in: e,
|
|
2733
2733
|
out: s,
|
|
2734
|
-
typeName:
|
|
2734
|
+
typeName: m.ZodPipeline
|
|
2735
2735
|
});
|
|
2736
2736
|
}
|
|
2737
2737
|
}
|
|
2738
|
-
class
|
|
2738
|
+
class me extends _ {
|
|
2739
2739
|
_parse(e) {
|
|
2740
|
-
const s = this._def.innerType._parse(e), n = (r) => (
|
|
2741
|
-
return
|
|
2740
|
+
const s = this._def.innerType._parse(e), n = (r) => (se(r) && (r.value = Object.freeze(r.value)), r);
|
|
2741
|
+
return ne(s) ? s.then((r) => n(r)) : n(s);
|
|
2742
2742
|
}
|
|
2743
2743
|
unwrap() {
|
|
2744
2744
|
return this._def.innerType;
|
|
2745
2745
|
}
|
|
2746
2746
|
}
|
|
2747
|
-
|
|
2747
|
+
me.create = (t, e) => new me({
|
|
2748
2748
|
innerType: t,
|
|
2749
|
-
typeName:
|
|
2749
|
+
typeName: m.ZodReadonly,
|
|
2750
2750
|
...v(e)
|
|
2751
2751
|
});
|
|
2752
2752
|
function ze(t, e = {}, s) {
|
|
@@ -2758,41 +2758,41 @@ function ze(t, e = {}, s) {
|
|
|
2758
2758
|
}
|
|
2759
2759
|
}) : J.create();
|
|
2760
2760
|
}
|
|
2761
|
-
const
|
|
2761
|
+
const kt = {
|
|
2762
2762
|
object: b.lazycreate
|
|
2763
2763
|
};
|
|
2764
|
-
var
|
|
2764
|
+
var m;
|
|
2765
2765
|
(function(t) {
|
|
2766
2766
|
t.ZodString = "ZodString", t.ZodNumber = "ZodNumber", t.ZodNaN = "ZodNaN", t.ZodBigInt = "ZodBigInt", t.ZodBoolean = "ZodBoolean", t.ZodDate = "ZodDate", t.ZodSymbol = "ZodSymbol", t.ZodUndefined = "ZodUndefined", t.ZodNull = "ZodNull", t.ZodAny = "ZodAny", t.ZodUnknown = "ZodUnknown", t.ZodNever = "ZodNever", t.ZodVoid = "ZodVoid", t.ZodArray = "ZodArray", t.ZodObject = "ZodObject", t.ZodUnion = "ZodUnion", t.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", t.ZodIntersection = "ZodIntersection", t.ZodTuple = "ZodTuple", t.ZodRecord = "ZodRecord", t.ZodMap = "ZodMap", t.ZodSet = "ZodSet", t.ZodFunction = "ZodFunction", t.ZodLazy = "ZodLazy", t.ZodLiteral = "ZodLiteral", t.ZodEnum = "ZodEnum", t.ZodEffects = "ZodEffects", t.ZodNativeEnum = "ZodNativeEnum", t.ZodOptional = "ZodOptional", t.ZodNullable = "ZodNullable", t.ZodDefault = "ZodDefault", t.ZodCatch = "ZodCatch", t.ZodPromise = "ZodPromise", t.ZodBranded = "ZodBranded", t.ZodPipeline = "ZodPipeline", t.ZodReadonly = "ZodReadonly";
|
|
2767
|
-
})(
|
|
2768
|
-
const
|
|
2767
|
+
})(m || (m = {}));
|
|
2768
|
+
const wt = (t, e = {
|
|
2769
2769
|
message: `Input not instance of ${t.name}`
|
|
2770
|
-
}) => ze((s) => s instanceof t, e),
|
|
2771
|
-
string: (t) =>
|
|
2772
|
-
number: (t) =>
|
|
2773
|
-
boolean: (t) =>
|
|
2770
|
+
}) => ze((s) => s instanceof t, e), Ge = C.create, Qe = q.create, St = Te.create, Tt = $.create, We = re.create, Rt = z.create, Et = ke.create, Ct = ae.create, Zt = ie.create, Ot = J.create, It = B.create, Mt = A.create, Nt = we.create, jt = Z.create, At = b.create, Pt = b.strictCreate, qt = oe.create, $t = Re.create, Ut = ce.create, Lt = N.create, Vt = de.create, Dt = Se.create, Bt = G.create, zt = H.create, Gt = ue.create, Qt = le.create, Wt = U.create, Ht = fe.create, Yt = X.create, Pe = O.create, Jt = I.create, Xt = L.create, Kt = O.createWithPreprocess, Ft = ge.create, es = () => Ge().optional(), ts = () => Qe().optional(), ss = () => We().optional(), ns = {
|
|
2771
|
+
string: (t) => C.create({ ...t, coerce: !0 }),
|
|
2772
|
+
number: (t) => q.create({ ...t, coerce: !0 }),
|
|
2773
|
+
boolean: (t) => re.create({
|
|
2774
2774
|
...t,
|
|
2775
2775
|
coerce: !0
|
|
2776
2776
|
}),
|
|
2777
|
-
bigint: (t) =>
|
|
2777
|
+
bigint: (t) => $.create({ ...t, coerce: !0 }),
|
|
2778
2778
|
date: (t) => z.create({ ...t, coerce: !0 })
|
|
2779
|
-
},
|
|
2780
|
-
var
|
|
2779
|
+
}, rs = y;
|
|
2780
|
+
var p = /* @__PURE__ */ Object.freeze({
|
|
2781
2781
|
__proto__: null,
|
|
2782
2782
|
defaultErrorMap: Y,
|
|
2783
|
-
setErrorMap:
|
|
2784
|
-
getErrorMap:
|
|
2785
|
-
makeIssue:
|
|
2786
|
-
EMPTY_PATH:
|
|
2783
|
+
setErrorMap: rt,
|
|
2784
|
+
getErrorMap: _e,
|
|
2785
|
+
makeIssue: xe,
|
|
2786
|
+
EMPTY_PATH: at,
|
|
2787
2787
|
addIssueToContext: l,
|
|
2788
|
-
ParseStatus:
|
|
2789
|
-
INVALID:
|
|
2788
|
+
ParseStatus: S,
|
|
2789
|
+
INVALID: y,
|
|
2790
2790
|
DIRTY: W,
|
|
2791
2791
|
OK: T,
|
|
2792
|
-
isAborted:
|
|
2793
|
-
isDirty:
|
|
2794
|
-
isValid:
|
|
2795
|
-
isAsync:
|
|
2792
|
+
isAborted: Oe,
|
|
2793
|
+
isDirty: Ie,
|
|
2794
|
+
isValid: se,
|
|
2795
|
+
isAsync: ne,
|
|
2796
2796
|
get util() {
|
|
2797
2797
|
return x;
|
|
2798
2798
|
},
|
|
@@ -2803,233 +2803,256 @@ var y = /* @__PURE__ */ Object.freeze({
|
|
|
2803
2803
|
getParsedType: P,
|
|
2804
2804
|
ZodType: _,
|
|
2805
2805
|
datetimeRegex: De,
|
|
2806
|
-
ZodString:
|
|
2807
|
-
ZodNumber:
|
|
2808
|
-
ZodBigInt:
|
|
2809
|
-
ZodBoolean:
|
|
2806
|
+
ZodString: C,
|
|
2807
|
+
ZodNumber: q,
|
|
2808
|
+
ZodBigInt: $,
|
|
2809
|
+
ZodBoolean: re,
|
|
2810
2810
|
ZodDate: z,
|
|
2811
|
-
ZodSymbol:
|
|
2812
|
-
ZodUndefined:
|
|
2813
|
-
ZodNull:
|
|
2811
|
+
ZodSymbol: ke,
|
|
2812
|
+
ZodUndefined: ae,
|
|
2813
|
+
ZodNull: ie,
|
|
2814
2814
|
ZodAny: J,
|
|
2815
2815
|
ZodUnknown: B,
|
|
2816
2816
|
ZodNever: A,
|
|
2817
|
-
ZodVoid:
|
|
2818
|
-
ZodArray:
|
|
2817
|
+
ZodVoid: we,
|
|
2818
|
+
ZodArray: Z,
|
|
2819
2819
|
ZodObject: b,
|
|
2820
|
-
ZodUnion:
|
|
2821
|
-
ZodDiscriminatedUnion:
|
|
2822
|
-
ZodIntersection:
|
|
2823
|
-
ZodTuple:
|
|
2824
|
-
ZodRecord:
|
|
2825
|
-
ZodMap:
|
|
2826
|
-
ZodSet:
|
|
2820
|
+
ZodUnion: oe,
|
|
2821
|
+
ZodDiscriminatedUnion: Re,
|
|
2822
|
+
ZodIntersection: ce,
|
|
2823
|
+
ZodTuple: N,
|
|
2824
|
+
ZodRecord: de,
|
|
2825
|
+
ZodMap: Se,
|
|
2826
|
+
ZodSet: G,
|
|
2827
2827
|
ZodFunction: H,
|
|
2828
|
-
ZodLazy:
|
|
2829
|
-
ZodLiteral:
|
|
2830
|
-
ZodEnum:
|
|
2831
|
-
ZodNativeEnum:
|
|
2828
|
+
ZodLazy: ue,
|
|
2829
|
+
ZodLiteral: le,
|
|
2830
|
+
ZodEnum: U,
|
|
2831
|
+
ZodNativeEnum: fe,
|
|
2832
2832
|
ZodPromise: X,
|
|
2833
2833
|
ZodEffects: O,
|
|
2834
2834
|
ZodTransformer: O,
|
|
2835
|
-
ZodOptional:
|
|
2835
|
+
ZodOptional: I,
|
|
2836
2836
|
ZodNullable: L,
|
|
2837
|
-
ZodDefault:
|
|
2838
|
-
ZodCatch:
|
|
2839
|
-
ZodNaN:
|
|
2840
|
-
BRAND:
|
|
2841
|
-
ZodBranded:
|
|
2842
|
-
ZodPipeline:
|
|
2843
|
-
ZodReadonly:
|
|
2837
|
+
ZodDefault: he,
|
|
2838
|
+
ZodCatch: pe,
|
|
2839
|
+
ZodNaN: Te,
|
|
2840
|
+
BRAND: bt,
|
|
2841
|
+
ZodBranded: Ne,
|
|
2842
|
+
ZodPipeline: ge,
|
|
2843
|
+
ZodReadonly: me,
|
|
2844
2844
|
custom: ze,
|
|
2845
2845
|
Schema: _,
|
|
2846
2846
|
ZodSchema: _,
|
|
2847
|
-
late:
|
|
2847
|
+
late: kt,
|
|
2848
2848
|
get ZodFirstPartyTypeKind() {
|
|
2849
|
-
return
|
|
2849
|
+
return m;
|
|
2850
2850
|
},
|
|
2851
|
-
coerce:
|
|
2852
|
-
any:
|
|
2853
|
-
array:
|
|
2851
|
+
coerce: ns,
|
|
2852
|
+
any: Ot,
|
|
2853
|
+
array: jt,
|
|
2854
2854
|
bigint: Tt,
|
|
2855
2855
|
boolean: We,
|
|
2856
|
-
date:
|
|
2856
|
+
date: Rt,
|
|
2857
2857
|
discriminatedUnion: $t,
|
|
2858
2858
|
effect: Pe,
|
|
2859
|
-
enum:
|
|
2860
|
-
function:
|
|
2861
|
-
instanceof:
|
|
2859
|
+
enum: Wt,
|
|
2860
|
+
function: zt,
|
|
2861
|
+
instanceof: wt,
|
|
2862
2862
|
intersection: Ut,
|
|
2863
|
-
lazy:
|
|
2863
|
+
lazy: Gt,
|
|
2864
2864
|
literal: Qt,
|
|
2865
|
-
map:
|
|
2866
|
-
nan:
|
|
2867
|
-
nativeEnum:
|
|
2868
|
-
never:
|
|
2865
|
+
map: Dt,
|
|
2866
|
+
nan: St,
|
|
2867
|
+
nativeEnum: Ht,
|
|
2868
|
+
never: Mt,
|
|
2869
2869
|
null: Zt,
|
|
2870
|
-
nullable:
|
|
2871
|
-
number:
|
|
2872
|
-
object:
|
|
2873
|
-
oboolean:
|
|
2874
|
-
onumber:
|
|
2875
|
-
optional:
|
|
2876
|
-
ostring:
|
|
2877
|
-
pipeline:
|
|
2878
|
-
preprocess:
|
|
2879
|
-
promise:
|
|
2880
|
-
record:
|
|
2881
|
-
set:
|
|
2882
|
-
strictObject:
|
|
2883
|
-
string:
|
|
2884
|
-
symbol:
|
|
2870
|
+
nullable: Xt,
|
|
2871
|
+
number: Qe,
|
|
2872
|
+
object: At,
|
|
2873
|
+
oboolean: ss,
|
|
2874
|
+
onumber: ts,
|
|
2875
|
+
optional: Jt,
|
|
2876
|
+
ostring: es,
|
|
2877
|
+
pipeline: Ft,
|
|
2878
|
+
preprocess: Kt,
|
|
2879
|
+
promise: Yt,
|
|
2880
|
+
record: Vt,
|
|
2881
|
+
set: Bt,
|
|
2882
|
+
strictObject: Pt,
|
|
2883
|
+
string: Ge,
|
|
2884
|
+
symbol: Et,
|
|
2885
2885
|
transformer: Pe,
|
|
2886
|
-
tuple:
|
|
2886
|
+
tuple: Lt,
|
|
2887
2887
|
undefined: Ct,
|
|
2888
|
-
union:
|
|
2889
|
-
unknown:
|
|
2890
|
-
void:
|
|
2891
|
-
NEVER:
|
|
2888
|
+
union: qt,
|
|
2889
|
+
unknown: It,
|
|
2890
|
+
void: Nt,
|
|
2891
|
+
NEVER: rs,
|
|
2892
2892
|
ZodIssueCode: c,
|
|
2893
|
-
quotelessJson:
|
|
2894
|
-
ZodError:
|
|
2893
|
+
quotelessJson: nt,
|
|
2894
|
+
ZodError: E
|
|
2895
2895
|
});
|
|
2896
|
-
const
|
|
2897
|
-
type:
|
|
2898
|
-
id:
|
|
2899
|
-
}),
|
|
2900
|
-
status:
|
|
2901
|
-
question:
|
|
2902
|
-
answer:
|
|
2903
|
-
}),
|
|
2904
|
-
status:
|
|
2905
|
-
}),
|
|
2906
|
-
status:
|
|
2907
|
-
message:
|
|
2908
|
-
}), He =
|
|
2909
|
-
semanticColor:
|
|
2910
|
-
label:
|
|
2911
|
-
description:
|
|
2912
|
-
disabled:
|
|
2913
|
-
required:
|
|
2914
|
-
hidden:
|
|
2915
|
-
errorMessage:
|
|
2916
|
-
}),
|
|
2917
|
-
id:
|
|
2918
|
-
name:
|
|
2919
|
-
mimeType:
|
|
2920
|
-
blobUrl:
|
|
2921
|
-
}), Ye =
|
|
2922
|
-
label:
|
|
2923
|
-
hidden:
|
|
2924
|
-
collapsed:
|
|
2925
|
-
}),
|
|
2926
|
-
action:
|
|
2927
|
-
question:
|
|
2928
|
-
}),
|
|
2896
|
+
const w = p.object({
|
|
2897
|
+
type: p.literal("qp-bridge"),
|
|
2898
|
+
id: p.string().optional()
|
|
2899
|
+
}), as = w.extend({
|
|
2900
|
+
status: p.literal("answerChanged"),
|
|
2901
|
+
question: p.string(),
|
|
2902
|
+
answer: p.unknown()
|
|
2903
|
+
}), K = w.extend({
|
|
2904
|
+
status: p.literal("success")
|
|
2905
|
+
}), is = w.extend({
|
|
2906
|
+
status: p.literal("error"),
|
|
2907
|
+
message: p.string()
|
|
2908
|
+
}), He = p.object({
|
|
2909
|
+
semanticColor: p.string().optional(),
|
|
2910
|
+
label: p.string(),
|
|
2911
|
+
description: p.string(),
|
|
2912
|
+
disabled: p.boolean(),
|
|
2913
|
+
required: p.boolean(),
|
|
2914
|
+
hidden: p.boolean(),
|
|
2915
|
+
errorMessage: p.string().optional()
|
|
2916
|
+
}), os = He.partial(), cs = p.object({
|
|
2917
|
+
id: p.string().uuid(),
|
|
2918
|
+
name: p.string(),
|
|
2919
|
+
mimeType: p.string(),
|
|
2920
|
+
blobUrl: p.string()
|
|
2921
|
+
}), Ye = p.record(p.unknown()), Je = p.object({
|
|
2922
|
+
label: p.string(),
|
|
2923
|
+
hidden: p.boolean(),
|
|
2924
|
+
collapsed: p.boolean()
|
|
2925
|
+
}), ds = Je.partial(), us = w.extend({
|
|
2926
|
+
action: p.literal("getQuestion"),
|
|
2927
|
+
question: p.string()
|
|
2928
|
+
}), ls = K.extend({
|
|
2929
2929
|
question: He
|
|
2930
|
-
}),
|
|
2931
|
-
action:
|
|
2932
|
-
question:
|
|
2933
|
-
questionData:
|
|
2934
|
-
}),
|
|
2935
|
-
action:
|
|
2936
|
-
group:
|
|
2937
|
-
}),
|
|
2938
|
-
group:
|
|
2939
|
-
}),
|
|
2940
|
-
canSave:
|
|
2941
|
-
}),
|
|
2942
|
-
action:
|
|
2943
|
-
}),
|
|
2944
|
-
action:
|
|
2945
|
-
group:
|
|
2946
|
-
groupData:
|
|
2947
|
-
}),
|
|
2948
|
-
action:
|
|
2949
|
-
question:
|
|
2950
|
-
answer:
|
|
2951
|
-
}),
|
|
2952
|
-
action:
|
|
2953
|
-
}),
|
|
2954
|
-
action:
|
|
2955
|
-
}),
|
|
2956
|
-
action:
|
|
2957
|
-
}),
|
|
2958
|
-
action:
|
|
2959
|
-
}),
|
|
2960
|
-
action:
|
|
2961
|
-
commandName:
|
|
2930
|
+
}), fs = w.extend({
|
|
2931
|
+
action: p.literal("setQuestion"),
|
|
2932
|
+
question: p.string(),
|
|
2933
|
+
questionData: os
|
|
2934
|
+
}), hs = w.extend({
|
|
2935
|
+
action: p.literal("getGroup"),
|
|
2936
|
+
group: p.string()
|
|
2937
|
+
}), ps = K.extend({
|
|
2938
|
+
group: Je
|
|
2939
|
+
}), ms = K.extend({
|
|
2940
|
+
canSave: p.boolean()
|
|
2941
|
+
}), gs = w.extend({
|
|
2942
|
+
action: p.literal("canSave")
|
|
2943
|
+
}), ys = w.extend({
|
|
2944
|
+
action: p.literal("setGroup"),
|
|
2945
|
+
group: p.string(),
|
|
2946
|
+
groupData: ds
|
|
2947
|
+
}), vs = w.extend({
|
|
2948
|
+
action: p.literal("setAnswer"),
|
|
2949
|
+
question: p.string(),
|
|
2950
|
+
answer: p.unknown()
|
|
2951
|
+
}), _s = w.extend({
|
|
2952
|
+
action: p.literal("busyIndicatorStart")
|
|
2953
|
+
}), xs = w.extend({
|
|
2954
|
+
action: p.literal("busyIndicatorEnd")
|
|
2955
|
+
}), bs = w.extend({
|
|
2956
|
+
action: p.literal("saveQuestionnaire")
|
|
2957
|
+
}), ks = w.extend({
|
|
2958
|
+
action: p.literal("completeAndCloseQuestionnaire")
|
|
2959
|
+
}), ws = w.extend({
|
|
2960
|
+
action: p.literal("executeCustomCommand"),
|
|
2961
|
+
commandName: p.string()
|
|
2962
|
+
}), Ss = w.extend({
|
|
2963
|
+
action: p.literal("fetchEntities"),
|
|
2964
|
+
fetchXml: p.string()
|
|
2965
|
+
}), Ts = K.extend({
|
|
2966
|
+
entities: p.array(Ye)
|
|
2967
|
+
}), Rs = w.extend({
|
|
2968
|
+
action: p.literal("getEntityById"),
|
|
2969
|
+
entityName: p.string(),
|
|
2970
|
+
entityId: p.string()
|
|
2971
|
+
}), Es = K.extend({
|
|
2972
|
+
entity: Ye
|
|
2962
2973
|
});
|
|
2963
|
-
function
|
|
2964
|
-
return
|
|
2965
|
-
}
|
|
2966
|
-
function ws(t) {
|
|
2967
|
-
return rs.safeParse(t).success;
|
|
2974
|
+
function Bs(t) {
|
|
2975
|
+
return cs.safeParse(t).success;
|
|
2968
2976
|
}
|
|
2969
|
-
function
|
|
2970
|
-
return
|
|
2977
|
+
function Cs(t) {
|
|
2978
|
+
return as.safeParse(t).success;
|
|
2971
2979
|
}
|
|
2972
|
-
function
|
|
2973
|
-
return
|
|
2980
|
+
function Xe(t) {
|
|
2981
|
+
return w.safeParse(t).success;
|
|
2974
2982
|
}
|
|
2975
|
-
function
|
|
2976
|
-
return
|
|
2983
|
+
function Zs(t) {
|
|
2984
|
+
return K.safeParse(t).success;
|
|
2977
2985
|
}
|
|
2978
|
-
function
|
|
2979
|
-
return
|
|
2986
|
+
function Os(t) {
|
|
2987
|
+
return is.safeParse(t).success;
|
|
2980
2988
|
}
|
|
2981
|
-
function
|
|
2989
|
+
function zs(t) {
|
|
2982
2990
|
return us.safeParse(t).success;
|
|
2983
2991
|
}
|
|
2984
|
-
function
|
|
2985
|
-
return ys.safeParse(t).success;
|
|
2986
|
-
}
|
|
2987
|
-
function $s(t) {
|
|
2992
|
+
function Is(t) {
|
|
2988
2993
|
return ls.safeParse(t).success;
|
|
2989
2994
|
}
|
|
2990
|
-
function
|
|
2991
|
-
return
|
|
2995
|
+
function Gs(t) {
|
|
2996
|
+
return vs.safeParse(t).success;
|
|
2992
2997
|
}
|
|
2993
|
-
function
|
|
2998
|
+
function Qs(t) {
|
|
2994
2999
|
return fs.safeParse(t).success;
|
|
2995
3000
|
}
|
|
2996
|
-
function
|
|
3001
|
+
function Ws(t) {
|
|
3002
|
+
return ys.safeParse(t).success;
|
|
3003
|
+
}
|
|
3004
|
+
function Hs(t) {
|
|
2997
3005
|
return hs.safeParse(t).success;
|
|
2998
3006
|
}
|
|
2999
|
-
function
|
|
3007
|
+
function Ms(t) {
|
|
3000
3008
|
return ps.safeParse(t).success;
|
|
3001
3009
|
}
|
|
3002
|
-
function
|
|
3010
|
+
function Ys(t) {
|
|
3003
3011
|
return ms.safeParse(t).success;
|
|
3004
3012
|
}
|
|
3005
|
-
function
|
|
3006
|
-
return
|
|
3013
|
+
function Ns(t) {
|
|
3014
|
+
return gs.safeParse(t).success;
|
|
3007
3015
|
}
|
|
3008
|
-
function
|
|
3016
|
+
function js(t) {
|
|
3009
3017
|
return _s.safeParse(t).success;
|
|
3010
3018
|
}
|
|
3011
|
-
function
|
|
3019
|
+
function As(t) {
|
|
3012
3020
|
return xs.safeParse(t).success;
|
|
3013
3021
|
}
|
|
3014
|
-
function
|
|
3022
|
+
function Js(t) {
|
|
3015
3023
|
return bs.safeParse(t).success;
|
|
3016
3024
|
}
|
|
3017
|
-
function
|
|
3025
|
+
function Xs(t) {
|
|
3018
3026
|
return ks.safeParse(t).success;
|
|
3019
3027
|
}
|
|
3020
|
-
function
|
|
3021
|
-
return
|
|
3028
|
+
function Ks(t) {
|
|
3029
|
+
return ws.safeParse(t).success;
|
|
3022
3030
|
}
|
|
3023
|
-
function
|
|
3031
|
+
function Fs(t) {
|
|
3032
|
+
return js(t) || As(t);
|
|
3033
|
+
}
|
|
3034
|
+
function en(t) {
|
|
3035
|
+
return Ss.safeParse(t).success;
|
|
3036
|
+
}
|
|
3037
|
+
function Ps(t) {
|
|
3038
|
+
return Ts.safeParse(t).success;
|
|
3039
|
+
}
|
|
3040
|
+
function tn(t) {
|
|
3041
|
+
return Rs.safeParse(t).success;
|
|
3042
|
+
}
|
|
3043
|
+
function qs(t) {
|
|
3044
|
+
return Es.safeParse(t).success;
|
|
3045
|
+
}
|
|
3046
|
+
function Ke(t) {
|
|
3024
3047
|
if (t instanceof File || t instanceof Blob)
|
|
3025
3048
|
return URL.createObjectURL(t);
|
|
3026
3049
|
if (typeof t == "string") {
|
|
3027
3050
|
if (/^data:/.test(t)) {
|
|
3028
3051
|
const a = t.match(/^data:([^;]+);base64,(.*)$/);
|
|
3029
3052
|
if (a) {
|
|
3030
|
-
const i = a[1], o = a[2], d = atob(o), u = new ArrayBuffer(d.length),
|
|
3053
|
+
const i = a[1], o = a[2], d = atob(o), u = new ArrayBuffer(d.length), g = new Uint8Array(u);
|
|
3031
3054
|
for (let D = 0; D < d.length; D++)
|
|
3032
|
-
|
|
3055
|
+
g[D] = d.charCodeAt(D);
|
|
3033
3056
|
const R = new Blob([u], { type: i });
|
|
3034
3057
|
return URL.createObjectURL(R);
|
|
3035
3058
|
}
|
|
@@ -3047,24 +3070,24 @@ function Xe(t) {
|
|
|
3047
3070
|
}
|
|
3048
3071
|
throw new Error("Unsupported content type for blobUrl");
|
|
3049
3072
|
}
|
|
3050
|
-
function
|
|
3073
|
+
function sn(t, e, s, n) {
|
|
3051
3074
|
return {
|
|
3052
|
-
id: n ??
|
|
3075
|
+
id: n ?? qe(),
|
|
3053
3076
|
name: t,
|
|
3054
3077
|
mimeType: e,
|
|
3055
|
-
blobUrl:
|
|
3078
|
+
blobUrl: Ke(s)
|
|
3056
3079
|
};
|
|
3057
3080
|
}
|
|
3058
|
-
function
|
|
3081
|
+
function nn(t, e) {
|
|
3059
3082
|
let s = t.blobUrl;
|
|
3060
|
-
return e.content !== void 0 && (s =
|
|
3083
|
+
return e.content !== void 0 && (s = Ke(e.content)), {
|
|
3061
3084
|
...t,
|
|
3062
3085
|
...e,
|
|
3063
3086
|
blobUrl: s
|
|
3064
3087
|
};
|
|
3065
3088
|
}
|
|
3066
|
-
window.addEventListener("message",
|
|
3067
|
-
async function
|
|
3089
|
+
window.addEventListener("message", $s);
|
|
3090
|
+
async function rn(t, e) {
|
|
3068
3091
|
await V({
|
|
3069
3092
|
type: "qp-bridge",
|
|
3070
3093
|
action: "setAnswer",
|
|
@@ -3072,14 +3095,14 @@ async function Ws(t, e) {
|
|
|
3072
3095
|
answer: e
|
|
3073
3096
|
});
|
|
3074
3097
|
}
|
|
3075
|
-
async function
|
|
3076
|
-
return await
|
|
3098
|
+
async function an(t) {
|
|
3099
|
+
return await Us({
|
|
3077
3100
|
type: "qp-bridge",
|
|
3078
3101
|
action: "getQuestion",
|
|
3079
3102
|
question: t
|
|
3080
3103
|
});
|
|
3081
3104
|
}
|
|
3082
|
-
async function
|
|
3105
|
+
async function on(t, e) {
|
|
3083
3106
|
await V({
|
|
3084
3107
|
type: "qp-bridge",
|
|
3085
3108
|
action: "setQuestion",
|
|
@@ -3087,14 +3110,14 @@ async function Ys(t, e) {
|
|
|
3087
3110
|
questionData: e
|
|
3088
3111
|
});
|
|
3089
3112
|
}
|
|
3090
|
-
async function
|
|
3091
|
-
return await
|
|
3113
|
+
async function cn(t) {
|
|
3114
|
+
return await Ls({
|
|
3092
3115
|
type: "qp-bridge",
|
|
3093
3116
|
action: "getGroup",
|
|
3094
3117
|
group: t
|
|
3095
3118
|
});
|
|
3096
3119
|
}
|
|
3097
|
-
async function
|
|
3120
|
+
async function dn(t, e) {
|
|
3098
3121
|
await V({
|
|
3099
3122
|
type: "qp-bridge",
|
|
3100
3123
|
action: "setGroup",
|
|
@@ -3102,9 +3125,9 @@ async function Xs(t, e) {
|
|
|
3102
3125
|
groupData: e
|
|
3103
3126
|
});
|
|
3104
3127
|
}
|
|
3105
|
-
function
|
|
3128
|
+
function un(t) {
|
|
3106
3129
|
const e = (s) => {
|
|
3107
|
-
|
|
3130
|
+
Cs(s.data) && t(s.data.question, s.data.answer);
|
|
3108
3131
|
};
|
|
3109
3132
|
return window.addEventListener("message", e), {
|
|
3110
3133
|
cancelSubscription: () => {
|
|
@@ -3112,7 +3135,7 @@ function Ks(t) {
|
|
|
3112
3135
|
}
|
|
3113
3136
|
};
|
|
3114
3137
|
}
|
|
3115
|
-
async function
|
|
3138
|
+
async function ln(t) {
|
|
3116
3139
|
await V({
|
|
3117
3140
|
type: "qp-bridge",
|
|
3118
3141
|
action: "busyIndicatorStart"
|
|
@@ -3126,38 +3149,38 @@ async function Fs(t) {
|
|
|
3126
3149
|
});
|
|
3127
3150
|
}
|
|
3128
3151
|
}
|
|
3129
|
-
async function
|
|
3152
|
+
async function fn() {
|
|
3130
3153
|
await V({
|
|
3131
3154
|
type: "qp-bridge",
|
|
3132
3155
|
action: "saveQuestionnaire"
|
|
3133
3156
|
});
|
|
3134
3157
|
}
|
|
3135
|
-
async function
|
|
3158
|
+
async function hn() {
|
|
3136
3159
|
await V({
|
|
3137
3160
|
type: "qp-bridge",
|
|
3138
3161
|
action: "completeAndCloseQuestionnaire"
|
|
3139
3162
|
});
|
|
3140
3163
|
}
|
|
3141
|
-
async function
|
|
3164
|
+
async function pn(t) {
|
|
3142
3165
|
await V({
|
|
3143
3166
|
type: "qp-bridge",
|
|
3144
3167
|
action: "executeCustomCommand",
|
|
3145
3168
|
commandName: t
|
|
3146
3169
|
});
|
|
3147
3170
|
}
|
|
3148
|
-
const
|
|
3149
|
-
function
|
|
3150
|
-
return
|
|
3171
|
+
const te = [];
|
|
3172
|
+
function mn(t) {
|
|
3173
|
+
return te.includes(t) || te.push(t), {
|
|
3151
3174
|
cancelSubscription: () => {
|
|
3152
|
-
const e =
|
|
3153
|
-
e !== -1 &&
|
|
3175
|
+
const e = te.indexOf(t);
|
|
3176
|
+
e !== -1 && te.splice(e, 1);
|
|
3154
3177
|
}
|
|
3155
3178
|
};
|
|
3156
3179
|
}
|
|
3157
|
-
async function
|
|
3180
|
+
async function $s(t) {
|
|
3158
3181
|
try {
|
|
3159
|
-
if (
|
|
3160
|
-
const e = await Promise.all(
|
|
3182
|
+
if (Ns(t.data)) {
|
|
3183
|
+
const e = await Promise.all(te.map((n) => n())), s = {
|
|
3161
3184
|
type: "qp-bridge",
|
|
3162
3185
|
status: "success",
|
|
3163
3186
|
id: t.data.id,
|
|
@@ -3169,87 +3192,119 @@ async function Ns(t) {
|
|
|
3169
3192
|
const s = {
|
|
3170
3193
|
type: "qp-bridge",
|
|
3171
3194
|
status: "error",
|
|
3172
|
-
id:
|
|
3195
|
+
id: Xe(t.data) ? t.data.id : void 0,
|
|
3173
3196
|
message: e instanceof Error ? e.message : "Unknown error"
|
|
3174
3197
|
};
|
|
3175
3198
|
window.parent.postMessage(s, "*");
|
|
3176
3199
|
}
|
|
3177
3200
|
}
|
|
3178
|
-
async function
|
|
3201
|
+
async function gn(t) {
|
|
3202
|
+
return await Vs({
|
|
3203
|
+
type: "qp-bridge",
|
|
3204
|
+
action: "fetchEntities",
|
|
3205
|
+
fetchXml: t
|
|
3206
|
+
});
|
|
3207
|
+
}
|
|
3208
|
+
async function yn(t, e) {
|
|
3209
|
+
return await Ds({
|
|
3210
|
+
type: "qp-bridge",
|
|
3211
|
+
action: "getEntityById",
|
|
3212
|
+
entityName: t,
|
|
3213
|
+
entityId: e
|
|
3214
|
+
});
|
|
3215
|
+
}
|
|
3216
|
+
async function ye(t, e) {
|
|
3179
3217
|
return new Promise((s, n) => {
|
|
3180
|
-
const r =
|
|
3181
|
-
if (!
|
|
3218
|
+
const r = qe(), a = (i) => {
|
|
3219
|
+
if (!Xe(i.data) || i.data.id !== r)
|
|
3182
3220
|
return;
|
|
3183
3221
|
const d = e(i.data);
|
|
3184
|
-
d.success ? s(d.data) :
|
|
3222
|
+
d.success ? s(d.data) : Os(i.data) ? n(new Error(i.data.message)) : n(new Error("Unknown message received")), window.removeEventListener("message", a);
|
|
3185
3223
|
};
|
|
3186
3224
|
window.addEventListener("message", a), window.parent.postMessage({ ...t, id: r }, "*");
|
|
3187
3225
|
});
|
|
3188
3226
|
}
|
|
3189
|
-
async function
|
|
3190
|
-
return
|
|
3227
|
+
async function Us(t) {
|
|
3228
|
+
return ye(t, (e) => Is(e) ? { success: !0, data: e.question } : { success: !1 });
|
|
3191
3229
|
}
|
|
3192
|
-
async function
|
|
3193
|
-
return
|
|
3230
|
+
async function Ls(t) {
|
|
3231
|
+
return ye(t, (e) => Ms(e) ? { success: !0, data: e.group } : { success: !1 });
|
|
3194
3232
|
}
|
|
3195
3233
|
function V(t) {
|
|
3196
|
-
return
|
|
3234
|
+
return ye(t, (e) => Zs(e) ? { success: !0, data: void 0 } : { success: !1 });
|
|
3235
|
+
}
|
|
3236
|
+
async function Vs(t) {
|
|
3237
|
+
return ye(t, (e) => Ps(e) ? { success: !0, data: e.entities } : { success: !1 });
|
|
3238
|
+
}
|
|
3239
|
+
async function Ds(t) {
|
|
3240
|
+
return ye(t, (e) => qs(e) ? { success: !0, data: e.entity } : { success: !1 });
|
|
3197
3241
|
}
|
|
3198
3242
|
export {
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
Ps as
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3243
|
+
xs as busyIndicatorEndRequestMessageSchema,
|
|
3244
|
+
_s as busyIndicatorStartRequestMessageSchema,
|
|
3245
|
+
gs as canSaveRequestMessageSchema,
|
|
3246
|
+
ms as canSaveSuccessResponseMessageSchema,
|
|
3247
|
+
hn as completeAndCloseQuestionnaire,
|
|
3248
|
+
ks as completeAndCloseQuestionnaireRequestMessageSchema,
|
|
3249
|
+
sn as createMediaItem,
|
|
3250
|
+
Ye as entitySchema,
|
|
3251
|
+
pn as executeCustomCommand,
|
|
3252
|
+
ws as executeCustomCommandRequestMessageSchema,
|
|
3253
|
+
gn as fetchEntities,
|
|
3254
|
+
Ss as fetchEntitiesRequestMessageSchema,
|
|
3255
|
+
Ts as fetchEntitiesSuccessResponseMessageSchema,
|
|
3256
|
+
yn as getEntityById,
|
|
3257
|
+
Rs as getEntityByIdRequestMessageSchema,
|
|
3258
|
+
Es as getEntityByIdSuccessResponseMessageSchema,
|
|
3259
|
+
cn as getGroup,
|
|
3260
|
+
hs as getGroupRequestMessageSchema,
|
|
3261
|
+
ps as getGroupSuccessResponseMessageSchema,
|
|
3262
|
+
an as getQuestion,
|
|
3263
|
+
us as getQuestionRequestMessageSchema,
|
|
3264
|
+
ls as getQuestionSuccessResponseMessageSchema,
|
|
3265
|
+
ds as groupOptionalScheme,
|
|
3266
|
+
Je as groupSchema,
|
|
3267
|
+
As as isBusyIndicatorEndRequestMessage,
|
|
3268
|
+
js as isBusyIndicatorStartRequestMessage,
|
|
3269
|
+
Ns as isCanSaveRequestMessage,
|
|
3270
|
+
Ys as isCanSaveSuccessResponseMessage,
|
|
3271
|
+
Xs as isCompleteAndCloseQuestionnaireRequestMessage,
|
|
3272
|
+
Os as isErrorMessage,
|
|
3273
|
+
Ks as isExecuteCustomCommandRequestMessage,
|
|
3274
|
+
en as isFetchEntitiesRequestMessage,
|
|
3275
|
+
Ps as isFetchEntitiesSuccessResponseMessage,
|
|
3276
|
+
tn as isGetEntityByIdRequestMessage,
|
|
3277
|
+
qs as isGetEntityByIdSuccessResponseMessage,
|
|
3278
|
+
Hs as isGetGroupRequestMessage,
|
|
3279
|
+
Ms as isGetGroupSuccessResponseMessage,
|
|
3280
|
+
zs as isGetQuestionRequestMessage,
|
|
3281
|
+
Is as isGetQuestionSuccessResponseMessage,
|
|
3282
|
+
Bs as isMediaItem,
|
|
3283
|
+
Cs as isOnAnswerChangeMessage,
|
|
3284
|
+
Xe as isQpBridgeMessage,
|
|
3285
|
+
Js as isSaveQuestionnaireRequestMessage,
|
|
3286
|
+
Gs as isSetAnswerRequestMessage,
|
|
3287
|
+
Ws as isSetGroupRequestMessage,
|
|
3288
|
+
Qs as isSetQuestionRequestMessage,
|
|
3289
|
+
Zs as isSuccessMessage,
|
|
3290
|
+
Fs as isWithBusyIndicatorRequestMessage,
|
|
3291
|
+
cs as mediaItemSchema,
|
|
3292
|
+
un as onAnswerChange,
|
|
3293
|
+
as as onAnswerChangeMessageSchema,
|
|
3294
|
+
mn as onSave,
|
|
3295
|
+
w as qpBridgeMessageSchema,
|
|
3296
|
+
os as questionOptionalScheme,
|
|
3242
3297
|
He as questionSchema,
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3298
|
+
is as responseErrorMessageSchema,
|
|
3299
|
+
K as responseSuccessMessageSchema,
|
|
3300
|
+
fn as saveQuestionnaire,
|
|
3301
|
+
bs as saveQuestionnaireRequestMessageSchema,
|
|
3302
|
+
rn as setAnswer,
|
|
3303
|
+
vs as setAnswerRequestMessageSchema,
|
|
3304
|
+
dn as setGroup,
|
|
3305
|
+
ys as setGroupRequestMessageSchema,
|
|
3306
|
+
on as setQuestion,
|
|
3307
|
+
fs as setQuestionRequestMessageSchema,
|
|
3308
|
+
nn as updateMediaItem,
|
|
3309
|
+
ln as withBusyIndicator
|
|
3255
3310
|
};
|