@resconet/qp-bridge 0.0.1-alpha.19 → 0.0.1-alpha.21
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 +142 -0
- package/index.js +1 -1
- package/index.mjs +783 -676
- package/lib/qp-bridge-types.d.ts +146 -0
- package/lib/qp-bridge.d.ts +78 -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), Ae = {
|
|
15
|
+
randomUUID: st
|
|
16
16
|
};
|
|
17
|
-
function
|
|
18
|
-
if (
|
|
19
|
-
return
|
|
17
|
+
function qe(t, e, s) {
|
|
18
|
+
if (Ae.randomUUID && !e && !t)
|
|
19
|
+
return Ae.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) {
|
|
@@ -86,7 +86,7 @@ const f = x.arrayToEnum([
|
|
|
86
86
|
"never",
|
|
87
87
|
"map",
|
|
88
88
|
"set"
|
|
89
|
-
]),
|
|
89
|
+
]), q = (t) => {
|
|
90
90
|
switch (typeof t) {
|
|
91
91
|
case "undefined":
|
|
92
92
|
return f.undefined;
|
|
@@ -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,38 +312,38 @@ 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 }), Ne = (t) => t.status === "aborted", Me = (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;
|
|
340
340
|
}
|
|
341
|
-
var
|
|
341
|
+
var p;
|
|
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
|
-
})(
|
|
345
|
-
var
|
|
346
|
-
class
|
|
344
|
+
})(p || (p = {}));
|
|
345
|
+
var F, ee;
|
|
346
|
+
class O {
|
|
347
347
|
constructor(e, s, n, r) {
|
|
348
348
|
this._cachedPath = [], this.parent = e, this.data = s, this._path = n, this._key = r;
|
|
349
349
|
}
|
|
@@ -351,8 +351,8 @@ class M {
|
|
|
351
351
|
return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
|
-
const
|
|
355
|
-
if (
|
|
354
|
+
const je = (t, e) => {
|
|
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 _ {
|
|
@@ -386,13 +386,13 @@ class _ {
|
|
|
386
386
|
return this._def.description;
|
|
387
387
|
}
|
|
388
388
|
_getType(e) {
|
|
389
|
-
return
|
|
389
|
+
return q(e.data);
|
|
390
390
|
}
|
|
391
391
|
_getOrReturnCtx(e, s) {
|
|
392
392
|
return s || {
|
|
393
393
|
common: e.parent.common,
|
|
394
394
|
data: e.data,
|
|
395
|
-
parsedType:
|
|
395
|
+
parsedType: q(e.data),
|
|
396
396
|
schemaErrorMap: this._def.errorMap,
|
|
397
397
|
path: e.path,
|
|
398
398
|
parent: e.parent
|
|
@@ -400,11 +400,11 @@ 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,
|
|
407
|
-
parsedType:
|
|
407
|
+
parsedType: q(e.data),
|
|
408
408
|
schemaErrorMap: this._def.errorMap,
|
|
409
409
|
path: e.path,
|
|
410
410
|
parent: e.parent
|
|
@@ -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
|
}
|
|
@@ -439,9 +439,9 @@ class _ {
|
|
|
439
439
|
schemaErrorMap: this._def.errorMap,
|
|
440
440
|
parent: null,
|
|
441
441
|
data: e,
|
|
442
|
-
parsedType:
|
|
442
|
+
parsedType: q(e)
|
|
443
443
|
}, a = this._parseSync({ data: e, path: r.path, parent: r });
|
|
444
|
-
return
|
|
444
|
+
return je(r, a);
|
|
445
445
|
}
|
|
446
446
|
async parseAsync(e, s) {
|
|
447
447
|
const n = await this.safeParseAsync(e, s);
|
|
@@ -460,9 +460,9 @@ class _ {
|
|
|
460
460
|
schemaErrorMap: this._def.errorMap,
|
|
461
461
|
parent: null,
|
|
462
462
|
data: e,
|
|
463
|
-
parsedType:
|
|
464
|
-
}, r = this._parse({ data: e, path: n.path, parent: n }), a = await (
|
|
465
|
-
return
|
|
463
|
+
parsedType: q(e)
|
|
464
|
+
}, r = this._parse({ data: e, path: n.path, parent: n }), a = await (ne(r) ? r : Promise.resolve(r));
|
|
465
|
+
return je(n, a);
|
|
466
466
|
}
|
|
467
467
|
refine(e, s) {
|
|
468
468
|
const n = (r) => typeof s == "string" || typeof s > "u" ? { message: s } : typeof s == "function" ? s(r) : s;
|
|
@@ -478,9 +478,9 @@ class _ {
|
|
|
478
478
|
return this._refinement((n, r) => e(n) ? !0 : (r.addIssue(typeof s == "function" ? s(n, r) : s), !1));
|
|
479
479
|
}
|
|
480
480
|
_refinement(e) {
|
|
481
|
-
return new
|
|
481
|
+
return new N({
|
|
482
482
|
schema: this,
|
|
483
|
-
typeName:
|
|
483
|
+
typeName: m.ZodEffects,
|
|
484
484
|
effect: { type: "refinement", refinement: e }
|
|
485
485
|
});
|
|
486
486
|
}
|
|
@@ -488,57 +488,57 @@ 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
|
-
return
|
|
494
|
+
return V.create(this, this._def);
|
|
495
495
|
}
|
|
496
496
|
nullish() {
|
|
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
|
-
return new
|
|
512
|
+
return new N({
|
|
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 Oe({
|
|
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
|
|
@@ -727,44 +727,44 @@ class Z extends _ {
|
|
|
727
727
|
return this.refinement((r) => e.test(r), {
|
|
728
728
|
validation: s,
|
|
729
729
|
code: c.invalid_string,
|
|
730
|
-
...
|
|
730
|
+
...p.errToObj(n)
|
|
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
|
});
|
|
738
738
|
}
|
|
739
739
|
email(e) {
|
|
740
|
-
return this._addCheck({ kind: "email", ...
|
|
740
|
+
return this._addCheck({ kind: "email", ...p.errToObj(e) });
|
|
741
741
|
}
|
|
742
742
|
url(e) {
|
|
743
|
-
return this._addCheck({ kind: "url", ...
|
|
743
|
+
return this._addCheck({ kind: "url", ...p.errToObj(e) });
|
|
744
744
|
}
|
|
745
745
|
emoji(e) {
|
|
746
|
-
return this._addCheck({ kind: "emoji", ...
|
|
746
|
+
return this._addCheck({ kind: "emoji", ...p.errToObj(e) });
|
|
747
747
|
}
|
|
748
748
|
uuid(e) {
|
|
749
|
-
return this._addCheck({ kind: "uuid", ...
|
|
749
|
+
return this._addCheck({ kind: "uuid", ...p.errToObj(e) });
|
|
750
750
|
}
|
|
751
751
|
nanoid(e) {
|
|
752
|
-
return this._addCheck({ kind: "nanoid", ...
|
|
752
|
+
return this._addCheck({ kind: "nanoid", ...p.errToObj(e) });
|
|
753
753
|
}
|
|
754
754
|
cuid(e) {
|
|
755
|
-
return this._addCheck({ kind: "cuid", ...
|
|
755
|
+
return this._addCheck({ kind: "cuid", ...p.errToObj(e) });
|
|
756
756
|
}
|
|
757
757
|
cuid2(e) {
|
|
758
|
-
return this._addCheck({ kind: "cuid2", ...
|
|
758
|
+
return this._addCheck({ kind: "cuid2", ...p.errToObj(e) });
|
|
759
759
|
}
|
|
760
760
|
ulid(e) {
|
|
761
|
-
return this._addCheck({ kind: "ulid", ...
|
|
761
|
+
return this._addCheck({ kind: "ulid", ...p.errToObj(e) });
|
|
762
762
|
}
|
|
763
763
|
base64(e) {
|
|
764
|
-
return this._addCheck({ kind: "base64", ...
|
|
764
|
+
return this._addCheck({ kind: "base64", ...p.errToObj(e) });
|
|
765
765
|
}
|
|
766
766
|
ip(e) {
|
|
767
|
-
return this._addCheck({ kind: "ip", ...
|
|
767
|
+
return this._addCheck({ kind: "ip", ...p.errToObj(e) });
|
|
768
768
|
}
|
|
769
769
|
datetime(e) {
|
|
770
770
|
var s, n;
|
|
@@ -779,7 +779,7 @@ class Z extends _ {
|
|
|
779
779
|
precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
|
|
780
780
|
offset: (s = e == null ? void 0 : e.offset) !== null && s !== void 0 ? s : !1,
|
|
781
781
|
local: (n = e == null ? void 0 : e.local) !== null && n !== void 0 ? n : !1,
|
|
782
|
-
...
|
|
782
|
+
...p.errToObj(e == null ? void 0 : e.message)
|
|
783
783
|
});
|
|
784
784
|
}
|
|
785
785
|
date(e) {
|
|
@@ -793,17 +793,17 @@ class Z extends _ {
|
|
|
793
793
|
}) : this._addCheck({
|
|
794
794
|
kind: "time",
|
|
795
795
|
precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
|
|
796
|
-
...
|
|
796
|
+
...p.errToObj(e == null ? void 0 : e.message)
|
|
797
797
|
});
|
|
798
798
|
}
|
|
799
799
|
duration(e) {
|
|
800
|
-
return this._addCheck({ kind: "duration", ...
|
|
800
|
+
return this._addCheck({ kind: "duration", ...p.errToObj(e) });
|
|
801
801
|
}
|
|
802
802
|
regex(e, s) {
|
|
803
803
|
return this._addCheck({
|
|
804
804
|
kind: "regex",
|
|
805
805
|
regex: e,
|
|
806
|
-
...
|
|
806
|
+
...p.errToObj(s)
|
|
807
807
|
});
|
|
808
808
|
}
|
|
809
809
|
includes(e, s) {
|
|
@@ -811,42 +811,42 @@ class Z extends _ {
|
|
|
811
811
|
kind: "includes",
|
|
812
812
|
value: e,
|
|
813
813
|
position: s == null ? void 0 : s.position,
|
|
814
|
-
...
|
|
814
|
+
...p.errToObj(s == null ? void 0 : s.message)
|
|
815
815
|
});
|
|
816
816
|
}
|
|
817
817
|
startsWith(e, s) {
|
|
818
818
|
return this._addCheck({
|
|
819
819
|
kind: "startsWith",
|
|
820
820
|
value: e,
|
|
821
|
-
...
|
|
821
|
+
...p.errToObj(s)
|
|
822
822
|
});
|
|
823
823
|
}
|
|
824
824
|
endsWith(e, s) {
|
|
825
825
|
return this._addCheck({
|
|
826
826
|
kind: "endsWith",
|
|
827
827
|
value: e,
|
|
828
|
-
...
|
|
828
|
+
...p.errToObj(s)
|
|
829
829
|
});
|
|
830
830
|
}
|
|
831
831
|
min(e, s) {
|
|
832
832
|
return this._addCheck({
|
|
833
833
|
kind: "min",
|
|
834
834
|
value: e,
|
|
835
|
-
...
|
|
835
|
+
...p.errToObj(s)
|
|
836
836
|
});
|
|
837
837
|
}
|
|
838
838
|
max(e, s) {
|
|
839
839
|
return this._addCheck({
|
|
840
840
|
kind: "max",
|
|
841
841
|
value: e,
|
|
842
|
-
...
|
|
842
|
+
...p.errToObj(s)
|
|
843
843
|
});
|
|
844
844
|
}
|
|
845
845
|
length(e, s) {
|
|
846
846
|
return this._addCheck({
|
|
847
847
|
kind: "length",
|
|
848
848
|
value: e,
|
|
849
|
-
...
|
|
849
|
+
...p.errToObj(s)
|
|
850
850
|
});
|
|
851
851
|
}
|
|
852
852
|
/**
|
|
@@ -854,22 +854,22 @@ class Z extends _ {
|
|
|
854
854
|
* @see {@link ZodString.min}
|
|
855
855
|
*/
|
|
856
856
|
nonempty(e) {
|
|
857
|
-
return this.min(1,
|
|
857
|
+
return this.min(1, p.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,16 +929,16 @@ 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
|
}
|
|
@@ -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
|
|
@@ -988,16 +988,16 @@ class $ extends _ {
|
|
|
988
988
|
return { status: r.value, value: e.data };
|
|
989
989
|
}
|
|
990
990
|
gte(e, s) {
|
|
991
|
-
return this.setLimit("min", e, !0,
|
|
991
|
+
return this.setLimit("min", e, !0, p.toString(s));
|
|
992
992
|
}
|
|
993
993
|
gt(e, s) {
|
|
994
|
-
return this.setLimit("min", e, !1,
|
|
994
|
+
return this.setLimit("min", e, !1, p.toString(s));
|
|
995
995
|
}
|
|
996
996
|
lte(e, s) {
|
|
997
|
-
return this.setLimit("max", e, !0,
|
|
997
|
+
return this.setLimit("max", e, !0, p.toString(s));
|
|
998
998
|
}
|
|
999
999
|
lt(e, s) {
|
|
1000
|
-
return this.setLimit("max", e, !1,
|
|
1000
|
+
return this.setLimit("max", e, !1, p.toString(s));
|
|
1001
1001
|
}
|
|
1002
1002
|
setLimit(e, s, n, r) {
|
|
1003
1003
|
return new $({
|
|
@@ -1008,7 +1008,7 @@ class $ extends _ {
|
|
|
1008
1008
|
kind: e,
|
|
1009
1009
|
value: s,
|
|
1010
1010
|
inclusive: n,
|
|
1011
|
-
message:
|
|
1011
|
+
message: p.toString(r)
|
|
1012
1012
|
}
|
|
1013
1013
|
]
|
|
1014
1014
|
});
|
|
@@ -1022,7 +1022,7 @@ class $ extends _ {
|
|
|
1022
1022
|
int(e) {
|
|
1023
1023
|
return this._addCheck({
|
|
1024
1024
|
kind: "int",
|
|
1025
|
-
message:
|
|
1025
|
+
message: p.toString(e)
|
|
1026
1026
|
});
|
|
1027
1027
|
}
|
|
1028
1028
|
positive(e) {
|
|
@@ -1030,7 +1030,7 @@ class $ extends _ {
|
|
|
1030
1030
|
kind: "min",
|
|
1031
1031
|
value: 0,
|
|
1032
1032
|
inclusive: !1,
|
|
1033
|
-
message:
|
|
1033
|
+
message: p.toString(e)
|
|
1034
1034
|
});
|
|
1035
1035
|
}
|
|
1036
1036
|
negative(e) {
|
|
@@ -1038,7 +1038,7 @@ class $ extends _ {
|
|
|
1038
1038
|
kind: "max",
|
|
1039
1039
|
value: 0,
|
|
1040
1040
|
inclusive: !1,
|
|
1041
|
-
message:
|
|
1041
|
+
message: p.toString(e)
|
|
1042
1042
|
});
|
|
1043
1043
|
}
|
|
1044
1044
|
nonpositive(e) {
|
|
@@ -1046,7 +1046,7 @@ class $ extends _ {
|
|
|
1046
1046
|
kind: "max",
|
|
1047
1047
|
value: 0,
|
|
1048
1048
|
inclusive: !0,
|
|
1049
|
-
message:
|
|
1049
|
+
message: p.toString(e)
|
|
1050
1050
|
});
|
|
1051
1051
|
}
|
|
1052
1052
|
nonnegative(e) {
|
|
@@ -1054,20 +1054,20 @@ class $ extends _ {
|
|
|
1054
1054
|
kind: "min",
|
|
1055
1055
|
value: 0,
|
|
1056
1056
|
inclusive: !0,
|
|
1057
|
-
message:
|
|
1057
|
+
message: p.toString(e)
|
|
1058
1058
|
});
|
|
1059
1059
|
}
|
|
1060
1060
|
multipleOf(e, s) {
|
|
1061
1061
|
return this._addCheck({
|
|
1062
1062
|
kind: "multipleOf",
|
|
1063
1063
|
value: e,
|
|
1064
|
-
message:
|
|
1064
|
+
message: p.toString(s)
|
|
1065
1065
|
});
|
|
1066
1066
|
}
|
|
1067
1067
|
finite(e) {
|
|
1068
1068
|
return this._addCheck({
|
|
1069
1069
|
kind: "finite",
|
|
1070
|
-
message:
|
|
1070
|
+
message: p.toString(e)
|
|
1071
1071
|
});
|
|
1072
1072
|
}
|
|
1073
1073
|
safe(e) {
|
|
@@ -1075,12 +1075,12 @@ class $ extends _ {
|
|
|
1075
1075
|
kind: "min",
|
|
1076
1076
|
inclusive: !0,
|
|
1077
1077
|
value: Number.MIN_SAFE_INTEGER,
|
|
1078
|
-
message:
|
|
1078
|
+
message: p.toString(e)
|
|
1079
1079
|
})._addCheck({
|
|
1080
1080
|
kind: "max",
|
|
1081
1081
|
inclusive: !0,
|
|
1082
1082
|
value: Number.MAX_SAFE_INTEGER,
|
|
1083
|
-
message:
|
|
1083
|
+
message: p.toString(e)
|
|
1084
1084
|
});
|
|
1085
1085
|
}
|
|
1086
1086
|
get minValue() {
|
|
@@ -1110,7 +1110,7 @@ class $ extends _ {
|
|
|
1110
1110
|
}
|
|
1111
1111
|
$.create = (t) => new $({
|
|
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
|
});
|
|
@@ -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,
|
|
@@ -1150,16 +1150,16 @@ class U extends _ {
|
|
|
1150
1150
|
return { status: r.value, value: e.data };
|
|
1151
1151
|
}
|
|
1152
1152
|
gte(e, s) {
|
|
1153
|
-
return this.setLimit("min", e, !0,
|
|
1153
|
+
return this.setLimit("min", e, !0, p.toString(s));
|
|
1154
1154
|
}
|
|
1155
1155
|
gt(e, s) {
|
|
1156
|
-
return this.setLimit("min", e, !1,
|
|
1156
|
+
return this.setLimit("min", e, !1, p.toString(s));
|
|
1157
1157
|
}
|
|
1158
1158
|
lte(e, s) {
|
|
1159
|
-
return this.setLimit("max", e, !0,
|
|
1159
|
+
return this.setLimit("max", e, !0, p.toString(s));
|
|
1160
1160
|
}
|
|
1161
1161
|
lt(e, s) {
|
|
1162
|
-
return this.setLimit("max", e, !1,
|
|
1162
|
+
return this.setLimit("max", e, !1, p.toString(s));
|
|
1163
1163
|
}
|
|
1164
1164
|
setLimit(e, s, n, r) {
|
|
1165
1165
|
return new U({
|
|
@@ -1170,7 +1170,7 @@ class U extends _ {
|
|
|
1170
1170
|
kind: e,
|
|
1171
1171
|
value: s,
|
|
1172
1172
|
inclusive: n,
|
|
1173
|
-
message:
|
|
1173
|
+
message: p.toString(r)
|
|
1174
1174
|
}
|
|
1175
1175
|
]
|
|
1176
1176
|
});
|
|
@@ -1186,7 +1186,7 @@ class U extends _ {
|
|
|
1186
1186
|
kind: "min",
|
|
1187
1187
|
value: BigInt(0),
|
|
1188
1188
|
inclusive: !1,
|
|
1189
|
-
message:
|
|
1189
|
+
message: p.toString(e)
|
|
1190
1190
|
});
|
|
1191
1191
|
}
|
|
1192
1192
|
negative(e) {
|
|
@@ -1194,7 +1194,7 @@ class U extends _ {
|
|
|
1194
1194
|
kind: "max",
|
|
1195
1195
|
value: BigInt(0),
|
|
1196
1196
|
inclusive: !1,
|
|
1197
|
-
message:
|
|
1197
|
+
message: p.toString(e)
|
|
1198
1198
|
});
|
|
1199
1199
|
}
|
|
1200
1200
|
nonpositive(e) {
|
|
@@ -1202,7 +1202,7 @@ class U extends _ {
|
|
|
1202
1202
|
kind: "max",
|
|
1203
1203
|
value: BigInt(0),
|
|
1204
1204
|
inclusive: !0,
|
|
1205
|
-
message:
|
|
1205
|
+
message: p.toString(e)
|
|
1206
1206
|
});
|
|
1207
1207
|
}
|
|
1208
1208
|
nonnegative(e) {
|
|
@@ -1210,14 +1210,14 @@ class U extends _ {
|
|
|
1210
1210
|
kind: "min",
|
|
1211
1211
|
value: BigInt(0),
|
|
1212
1212
|
inclusive: !0,
|
|
1213
|
-
message:
|
|
1213
|
+
message: p.toString(e)
|
|
1214
1214
|
});
|
|
1215
1215
|
}
|
|
1216
1216
|
multipleOf(e, s) {
|
|
1217
1217
|
return this._addCheck({
|
|
1218
1218
|
kind: "multipleOf",
|
|
1219
1219
|
value: e,
|
|
1220
|
-
message:
|
|
1220
|
+
message: p.toString(s)
|
|
1221
1221
|
});
|
|
1222
1222
|
}
|
|
1223
1223
|
get minValue() {
|
|
@@ -1237,12 +1237,12 @@ U.create = (t) => {
|
|
|
1237
1237
|
var e;
|
|
1238
1238
|
return new U({
|
|
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, {
|
|
@@ -1309,14 +1309,14 @@ class z extends _ {
|
|
|
1309
1309
|
return this._addCheck({
|
|
1310
1310
|
kind: "min",
|
|
1311
1311
|
value: e.getTime(),
|
|
1312
|
-
message:
|
|
1312
|
+
message: p.toString(s)
|
|
1313
1313
|
});
|
|
1314
1314
|
}
|
|
1315
1315
|
max(e, s) {
|
|
1316
1316
|
return this._addCheck({
|
|
1317
1317
|
kind: "max",
|
|
1318
1318
|
value: e.getTime(),
|
|
1319
|
-
message:
|
|
1319
|
+
message: p.toString(s)
|
|
1320
1320
|
});
|
|
1321
1321
|
}
|
|
1322
1322
|
get minDate() {
|
|
@@ -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 we 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
|
+
we.create = (t) => new we({
|
|
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,24 +1410,24 @@ 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
|
-
class
|
|
1416
|
+
class P extends _ {
|
|
1417
1417
|
_parse(e) {
|
|
1418
1418
|
const s = this._getOrReturnCtx(e);
|
|
1419
1419
|
return l(s, {
|
|
1420
1420
|
code: c.invalid_type,
|
|
1421
1421
|
expected: f.never,
|
|
1422
1422
|
received: s.parsedType
|
|
1423
|
-
}),
|
|
1423
|
+
}), y;
|
|
1424
1424
|
}
|
|
1425
1425
|
}
|
|
1426
|
-
|
|
1427
|
-
typeName:
|
|
1426
|
+
P.create = (t) => new P({
|
|
1427
|
+
typeName: m.ZodNever,
|
|
1428
1428
|
...v(t)
|
|
1429
1429
|
});
|
|
1430
|
-
class
|
|
1430
|
+
class ke 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
|
+
ke.create = (t) => new ke({
|
|
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,59 +1480,59 @@ 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
|
|
1484
|
-
const a = [...s.data].map((i, o) => r.type._parseSync(new
|
|
1485
|
-
return
|
|
1483
|
+
return Promise.all([...s.data].map((i, o) => r.type._parseAsync(new O(s, i, s.path, o)))).then((i) => S.mergeArray(n, i));
|
|
1484
|
+
const a = [...s.data].map((i, o) => r.type._parseSync(new O(s, i, s.path, o)));
|
|
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
|
-
minLength: { value: e, message:
|
|
1493
|
+
minLength: { value: e, message: p.toString(s) }
|
|
1494
1494
|
});
|
|
1495
1495
|
}
|
|
1496
1496
|
max(e, s) {
|
|
1497
|
-
return new
|
|
1497
|
+
return new Z({
|
|
1498
1498
|
...this._def,
|
|
1499
|
-
maxLength: { value: e, message:
|
|
1499
|
+
maxLength: { value: e, message: p.toString(s) }
|
|
1500
1500
|
});
|
|
1501
1501
|
}
|
|
1502
1502
|
length(e, s) {
|
|
1503
|
-
return new
|
|
1503
|
+
return new Z({
|
|
1504
1504
|
...this._def,
|
|
1505
|
-
exactLength: { value: e, message:
|
|
1505
|
+
exactLength: { value: e, message: p.toString(s) }
|
|
1506
1506
|
});
|
|
1507
1507
|
}
|
|
1508
1508
|
nonempty(e) {
|
|
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 V ? V.create(Q(t.unwrap())) : t instanceof A ? A.create(t.items.map((e) => Q(e))) : t;
|
|
1536
1536
|
}
|
|
1537
1537
|
class b extends _ {
|
|
1538
1538
|
constructor() {
|
|
@@ -1551,28 +1551,28 @@ 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
|
-
if (!(this._def.catchall instanceof
|
|
1557
|
+
if (!(this._def.catchall instanceof P && this._def.unknownKeys === "strip"))
|
|
1558
1558
|
for (const u in r.data)
|
|
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 O(r, R, r.path, u)),
|
|
1566
1566
|
alwaysSet: u in r.data
|
|
1567
1567
|
});
|
|
1568
1568
|
}
|
|
1569
|
-
if (this._def.catchall instanceof
|
|
1569
|
+
if (this._def.catchall instanceof P) {
|
|
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,36 +1583,36 @@ 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
|
|
1591
|
+
new O(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();
|
|
1613
1613
|
}
|
|
1614
1614
|
strict(e) {
|
|
1615
|
-
return
|
|
1615
|
+
return p.errToObj, new b({
|
|
1616
1616
|
...this._def,
|
|
1617
1617
|
unknownKeys: "strict",
|
|
1618
1618
|
...e !== void 0 ? {
|
|
@@ -1620,7 +1620,7 @@ class b extends _ {
|
|
|
1620
1620
|
var r, a, i, o;
|
|
1621
1621
|
const d = (i = (a = (r = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(r, s, n).message) !== null && i !== void 0 ? i : n.defaultError;
|
|
1622
1622
|
return s.code === "unrecognized_keys" ? {
|
|
1623
|
-
message: (o =
|
|
1623
|
+
message: (o = p.errToObj(e).message) !== null && o !== void 0 ? o : d
|
|
1624
1624
|
} : {
|
|
1625
1625
|
message: d
|
|
1626
1626
|
};
|
|
@@ -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
|
}
|
|
@@ -1804,25 +1804,25 @@ class b extends _ {
|
|
|
1804
1804
|
b.create = (t, e) => new b({
|
|
1805
1805
|
shape: () => t,
|
|
1806
1806
|
unknownKeys: "strip",
|
|
1807
|
-
catchall:
|
|
1808
|
-
typeName:
|
|
1807
|
+
catchall: P.create(),
|
|
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
|
-
catchall:
|
|
1815
|
-
typeName:
|
|
1814
|
+
catchall: P.create(),
|
|
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
|
-
catchall:
|
|
1822
|
-
typeName:
|
|
1821
|
+
catchall: P.create(),
|
|
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 N ? j(t.innerType()) : t instanceof le ? [t.value] : t instanceof L ? 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 V ? [null, ...j(t.unwrap())] : t instanceof Oe || 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
|
|
1962
|
-
const s =
|
|
1961
|
+
function Ie(t, e) {
|
|
1962
|
+
const s = q(t), n = q(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 = Ie(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 = Ie(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 (Ne(a) || Ne(i))
|
|
1992
|
+
return y;
|
|
1993
|
+
const o = Ie(a.value, i.value);
|
|
1994
|
+
return o.valid ? ((Me(a) || Me(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 A 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,
|
|
@@ -2049,31 +2049,31 @@ class I extends _ {
|
|
|
2049
2049
|
}), s.dirty());
|
|
2050
2050
|
const a = [...n.data].map((i, o) => {
|
|
2051
2051
|
const d = this._def.items[o] || this._def.rest;
|
|
2052
|
-
return d ? d._parse(new
|
|
2052
|
+
return d ? d._parse(new O(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 A({
|
|
2061
2061
|
...this._def,
|
|
2062
2062
|
rest: e
|
|
2063
2063
|
});
|
|
2064
2064
|
}
|
|
2065
2065
|
}
|
|
2066
|
-
|
|
2066
|
+
A.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 A({
|
|
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,34 +2087,34 @@ 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({
|
|
2094
|
-
key: a._parse(new
|
|
2095
|
-
value: i._parse(new
|
|
2094
|
+
key: a._parse(new O(n, o, n.path, o)),
|
|
2095
|
+
value: i._parse(new O(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,41 +2128,41 @@ 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
|
-
key: r._parse(new
|
|
2134
|
-
value: a._parse(new
|
|
2133
|
+
key: r._parse(new O(n, o, n.path, [u, "key"])),
|
|
2134
|
+
value: a._parse(new O(n, d, n.path, [u, "value"]))
|
|
2135
2135
|
}));
|
|
2136
2136
|
if (n.common.async) {
|
|
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,26 +2190,26 @@ 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
|
}
|
|
2200
|
-
const o = [...n.data.values()].map((d, u) => a._parse(new
|
|
2200
|
+
const o = [...n.data.values()].map((d, u) => a._parse(new O(n, d, n.path, u)));
|
|
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
|
-
minSize: { value: e, message:
|
|
2206
|
+
minSize: { value: e, message: p.toString(s) }
|
|
2207
2207
|
});
|
|
2208
2208
|
}
|
|
2209
2209
|
max(e, s) {
|
|
2210
|
-
return new
|
|
2210
|
+
return new G({
|
|
2211
2211
|
...this._def,
|
|
2212
|
-
maxSize: { value: e, message:
|
|
2212
|
+
maxSize: { value: e, message: p.toString(s) }
|
|
2213
2213
|
});
|
|
2214
2214
|
}
|
|
2215
2215
|
size(e, s) {
|
|
@@ -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: A.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 || A.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 L({
|
|
2367
2367
|
values: t,
|
|
2368
|
-
typeName:
|
|
2368
|
+
typeName: m.ZodEnum,
|
|
2369
2369
|
...v(e)
|
|
2370
2370
|
});
|
|
2371
2371
|
}
|
|
2372
|
-
class
|
|
2372
|
+
class L 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 L.create(e, {
|
|
2418
2418
|
...this._def,
|
|
2419
2419
|
...s
|
|
2420
2420
|
});
|
|
2421
2421
|
}
|
|
2422
2422
|
exclude(e, s = this._def) {
|
|
2423
|
-
return
|
|
2423
|
+
return L.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
|
+
L.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,15 +2483,15 @@ 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
|
-
class
|
|
2489
|
+
class N extends _ {
|
|
2490
2490
|
innerType() {
|
|
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
|
+
N.create = (t, e, s) => new N({
|
|
2567
2567
|
schema: t,
|
|
2568
|
-
typeName:
|
|
2568
|
+
typeName: m.ZodEffects,
|
|
2569
2569
|
effect: e,
|
|
2570
2570
|
...v(s)
|
|
2571
2571
|
});
|
|
2572
|
-
|
|
2572
|
+
N.createWithPreprocess = (t, e, s) => new N({
|
|
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,12 +2583,12 @@ 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
|
-
class
|
|
2591
|
+
class V extends _ {
|
|
2592
2592
|
_parse(e) {
|
|
2593
2593
|
return this._getType(e) === f.null ? T(null) : this._def.innerType._parse(e);
|
|
2594
2594
|
}
|
|
@@ -2596,12 +2596,12 @@ class L extends _ {
|
|
|
2596
2596
|
return this._def.innerType;
|
|
2597
2597
|
}
|
|
2598
2598
|
}
|
|
2599
|
-
|
|
2599
|
+
V.create = (t, e) => new V({
|
|
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 Oe 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 wt = {
|
|
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
|
-
})(
|
|
2767
|
+
})(m || (m = {}));
|
|
2768
2768
|
const kt = (t, e = {
|
|
2769
2769
|
message: `Input not instance of ${t.name}`
|
|
2770
|
-
}) => ze((s) => s instanceof t, e),
|
|
2771
|
-
string: (t) =>
|
|
2770
|
+
}) => ze((s) => s instanceof t, e), Ge = C.create, Qe = $.create, St = Te.create, Tt = U.create, We = re.create, Rt = z.create, Et = we.create, Ct = ae.create, Zt = ie.create, Nt = J.create, Mt = B.create, It = P.create, Ot = ke.create, At = Z.create, jt = b.create, Pt = b.strictCreate, qt = oe.create, $t = Re.create, Ut = ce.create, Lt = A.create, Vt = de.create, Dt = Se.create, Bt = G.create, zt = H.create, Gt = ue.create, Qt = le.create, Wt = L.create, Ht = fe.create, Yt = X.create, Pe = N.create, Jt = I.create, Xt = V.create, Kt = N.createWithPreprocess, Ft = ge.create, es = () => Ge().optional(), ts = () => Qe().optional(), ss = () => We().optional(), ns = {
|
|
2771
|
+
string: (t) => C.create({ ...t, coerce: !0 }),
|
|
2772
2772
|
number: (t) => $.create({ ...t, coerce: !0 }),
|
|
2773
|
-
boolean: (t) =>
|
|
2773
|
+
boolean: (t) => re.create({
|
|
2774
2774
|
...t,
|
|
2775
2775
|
coerce: !0
|
|
2776
2776
|
}),
|
|
2777
2777
|
bigint: (t) => U.create({ ...t, coerce: !0 }),
|
|
2778
2778
|
date: (t) => z.create({ ...t, coerce: !0 })
|
|
2779
|
-
},
|
|
2780
|
-
var
|
|
2779
|
+
}, rs = y;
|
|
2780
|
+
var h = /* @__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: Ne,
|
|
2793
|
+
isDirty: Me,
|
|
2794
|
+
isValid: se,
|
|
2795
|
+
isAsync: ne,
|
|
2796
2796
|
get util() {
|
|
2797
2797
|
return x;
|
|
2798
2798
|
},
|
|
@@ -2800,236 +2800,279 @@ var y = /* @__PURE__ */ Object.freeze({
|
|
|
2800
2800
|
return Ze;
|
|
2801
2801
|
},
|
|
2802
2802
|
ZodParsedType: f,
|
|
2803
|
-
getParsedType:
|
|
2803
|
+
getParsedType: q,
|
|
2804
2804
|
ZodType: _,
|
|
2805
2805
|
datetimeRegex: De,
|
|
2806
|
-
ZodString:
|
|
2806
|
+
ZodString: C,
|
|
2807
2807
|
ZodNumber: $,
|
|
2808
2808
|
ZodBigInt: U,
|
|
2809
|
-
ZodBoolean:
|
|
2809
|
+
ZodBoolean: re,
|
|
2810
2810
|
ZodDate: z,
|
|
2811
|
-
ZodSymbol:
|
|
2812
|
-
ZodUndefined:
|
|
2813
|
-
ZodNull:
|
|
2811
|
+
ZodSymbol: we,
|
|
2812
|
+
ZodUndefined: ae,
|
|
2813
|
+
ZodNull: ie,
|
|
2814
2814
|
ZodAny: J,
|
|
2815
2815
|
ZodUnknown: B,
|
|
2816
|
-
ZodNever:
|
|
2817
|
-
ZodVoid:
|
|
2818
|
-
ZodArray:
|
|
2816
|
+
ZodNever: P,
|
|
2817
|
+
ZodVoid: ke,
|
|
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: A,
|
|
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: L,
|
|
2831
|
+
ZodNativeEnum: fe,
|
|
2832
2832
|
ZodPromise: X,
|
|
2833
|
-
ZodEffects:
|
|
2834
|
-
ZodTransformer:
|
|
2835
|
-
ZodOptional:
|
|
2836
|
-
ZodNullable:
|
|
2837
|
-
ZodDefault:
|
|
2838
|
-
ZodCatch:
|
|
2839
|
-
ZodNaN:
|
|
2840
|
-
BRAND:
|
|
2841
|
-
ZodBranded:
|
|
2842
|
-
ZodPipeline:
|
|
2843
|
-
ZodReadonly:
|
|
2833
|
+
ZodEffects: N,
|
|
2834
|
+
ZodTransformer: N,
|
|
2835
|
+
ZodOptional: I,
|
|
2836
|
+
ZodNullable: V,
|
|
2837
|
+
ZodDefault: he,
|
|
2838
|
+
ZodCatch: pe,
|
|
2839
|
+
ZodNaN: Te,
|
|
2840
|
+
BRAND: bt,
|
|
2841
|
+
ZodBranded: Oe,
|
|
2842
|
+
ZodPipeline: ge,
|
|
2843
|
+
ZodReadonly: me,
|
|
2844
2844
|
custom: ze,
|
|
2845
2845
|
Schema: _,
|
|
2846
2846
|
ZodSchema: _,
|
|
2847
|
-
late:
|
|
2847
|
+
late: wt,
|
|
2848
2848
|
get ZodFirstPartyTypeKind() {
|
|
2849
|
-
return
|
|
2849
|
+
return m;
|
|
2850
2850
|
},
|
|
2851
|
-
coerce:
|
|
2852
|
-
any:
|
|
2853
|
-
array:
|
|
2851
|
+
coerce: ns,
|
|
2852
|
+
any: Nt,
|
|
2853
|
+
array: At,
|
|
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:
|
|
2859
|
+
enum: Wt,
|
|
2860
|
+
function: zt,
|
|
2861
2861
|
instanceof: kt,
|
|
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: It,
|
|
2869
2869
|
null: Zt,
|
|
2870
|
-
nullable:
|
|
2871
|
-
number:
|
|
2870
|
+
nullable: Xt,
|
|
2871
|
+
number: Qe,
|
|
2872
2872
|
object: jt,
|
|
2873
|
-
oboolean:
|
|
2874
|
-
onumber:
|
|
2875
|
-
optional:
|
|
2876
|
-
ostring:
|
|
2877
|
-
pipeline:
|
|
2878
|
-
preprocess:
|
|
2879
|
-
promise:
|
|
2880
|
-
record:
|
|
2881
|
-
set:
|
|
2882
|
-
strictObject:
|
|
2883
|
-
string:
|
|
2884
|
-
symbol:
|
|
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: Mt,
|
|
2890
|
+
void: Ot,
|
|
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 = h.object({
|
|
2897
|
+
type: h.literal("qp-bridge"),
|
|
2898
|
+
id: h.string().optional()
|
|
2899
|
+
}), as = w.extend({
|
|
2900
|
+
status: h.literal("answerChanged"),
|
|
2901
|
+
question: h.string(),
|
|
2902
|
+
answer: h.unknown()
|
|
2903
|
+
}), K = w.extend({
|
|
2904
|
+
status: h.literal("success")
|
|
2905
|
+
}), is = w.extend({
|
|
2906
|
+
status: h.literal("error"),
|
|
2907
|
+
message: h.string()
|
|
2908
|
+
}), He = h.object({
|
|
2909
|
+
semanticColor: h.string().optional(),
|
|
2910
|
+
label: h.string(),
|
|
2911
|
+
description: h.string(),
|
|
2912
|
+
disabled: h.boolean(),
|
|
2913
|
+
required: h.boolean(),
|
|
2914
|
+
hidden: h.boolean(),
|
|
2915
|
+
errorMessage: h.string().optional()
|
|
2916
|
+
}), os = He.partial(), cs = h.object({
|
|
2917
|
+
id: h.string().uuid(),
|
|
2918
|
+
name: h.string(),
|
|
2919
|
+
mimeType: h.string(),
|
|
2920
|
+
blobUrl: h.string()
|
|
2921
|
+
}), Ye = h.record(h.unknown()), Je = h.object({
|
|
2922
|
+
label: h.string(),
|
|
2923
|
+
hidden: h.boolean(),
|
|
2924
|
+
collapsed: h.boolean()
|
|
2925
|
+
}), ds = Je.partial(), us = w.extend({
|
|
2926
|
+
action: h.literal("getQuestion"),
|
|
2927
|
+
question: h.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
|
-
}), ks =
|
|
2960
|
-
action:
|
|
2961
|
-
commandName:
|
|
2930
|
+
}), fs = w.extend({
|
|
2931
|
+
action: h.literal("setQuestion"),
|
|
2932
|
+
question: h.string(),
|
|
2933
|
+
questionData: os
|
|
2934
|
+
}), hs = w.extend({
|
|
2935
|
+
action: h.literal("getGroup"),
|
|
2936
|
+
group: h.string()
|
|
2937
|
+
}), ps = K.extend({
|
|
2938
|
+
group: Je
|
|
2939
|
+
}), ms = K.extend({
|
|
2940
|
+
canSave: h.boolean()
|
|
2941
|
+
}), gs = w.extend({
|
|
2942
|
+
action: h.literal("canSave")
|
|
2943
|
+
}), ys = w.extend({
|
|
2944
|
+
action: h.literal("setGroup"),
|
|
2945
|
+
group: h.string(),
|
|
2946
|
+
groupData: ds
|
|
2947
|
+
}), vs = w.extend({
|
|
2948
|
+
action: h.literal("setAnswer"),
|
|
2949
|
+
question: h.string(),
|
|
2950
|
+
answer: h.unknown()
|
|
2951
|
+
}), _s = w.extend({
|
|
2952
|
+
action: h.literal("busyIndicatorStart")
|
|
2953
|
+
}), xs = w.extend({
|
|
2954
|
+
action: h.literal("busyIndicatorEnd")
|
|
2955
|
+
}), bs = w.extend({
|
|
2956
|
+
action: h.literal("saveQuestionnaire")
|
|
2957
|
+
}), ws = w.extend({
|
|
2958
|
+
action: h.literal("completeAndCloseQuestionnaire")
|
|
2959
|
+
}), ks = w.extend({
|
|
2960
|
+
action: h.literal("executeCustomCommand"),
|
|
2961
|
+
commandName: h.string()
|
|
2962
|
+
}), Ss = w.extend({
|
|
2963
|
+
action: h.literal("fetchEntities"),
|
|
2964
|
+
fetchXml: h.string()
|
|
2965
|
+
}), Ts = K.extend({
|
|
2966
|
+
entities: h.array(Ye)
|
|
2967
|
+
}), Rs = w.extend({
|
|
2968
|
+
action: h.literal("getEntityById"),
|
|
2969
|
+
entityName: h.string(),
|
|
2970
|
+
entityId: h.string()
|
|
2971
|
+
}), Es = K.extend({
|
|
2972
|
+
entity: Ye
|
|
2973
|
+
}), Cs = w.extend({
|
|
2974
|
+
action: h.literal("repeatGroup"),
|
|
2975
|
+
parentGroupName: h.string(),
|
|
2976
|
+
groupIndex: h.number()
|
|
2977
|
+
}), Zs = w.extend({
|
|
2978
|
+
action: h.literal("addNewGroup"),
|
|
2979
|
+
groupName: h.string()
|
|
2980
|
+
}), Ns = w.extend({
|
|
2981
|
+
action: h.literal("deleteGroup"),
|
|
2982
|
+
parentGroupName: h.string(),
|
|
2983
|
+
groupIndex: h.number()
|
|
2962
2984
|
});
|
|
2963
|
-
function
|
|
2964
|
-
return
|
|
2965
|
-
}
|
|
2966
|
-
function ws(t) {
|
|
2967
|
-
return rs.safeParse(t).success;
|
|
2985
|
+
function Qs(t) {
|
|
2986
|
+
return cs.safeParse(t).success;
|
|
2968
2987
|
}
|
|
2969
|
-
function
|
|
2970
|
-
return
|
|
2988
|
+
function Ms(t) {
|
|
2989
|
+
return as.safeParse(t).success;
|
|
2971
2990
|
}
|
|
2972
|
-
function
|
|
2973
|
-
return
|
|
2991
|
+
function Xe(t) {
|
|
2992
|
+
return w.safeParse(t).success;
|
|
2974
2993
|
}
|
|
2975
|
-
function
|
|
2976
|
-
return
|
|
2994
|
+
function Is(t) {
|
|
2995
|
+
return K.safeParse(t).success;
|
|
2977
2996
|
}
|
|
2978
|
-
function
|
|
2979
|
-
return
|
|
2997
|
+
function Os(t) {
|
|
2998
|
+
return is.safeParse(t).success;
|
|
2980
2999
|
}
|
|
2981
|
-
function
|
|
3000
|
+
function Ws(t) {
|
|
2982
3001
|
return us.safeParse(t).success;
|
|
2983
3002
|
}
|
|
2984
|
-
function
|
|
2985
|
-
return ys.safeParse(t).success;
|
|
2986
|
-
}
|
|
2987
|
-
function $s(t) {
|
|
3003
|
+
function As(t) {
|
|
2988
3004
|
return ls.safeParse(t).success;
|
|
2989
3005
|
}
|
|
2990
|
-
function
|
|
2991
|
-
return
|
|
3006
|
+
function Hs(t) {
|
|
3007
|
+
return vs.safeParse(t).success;
|
|
2992
3008
|
}
|
|
2993
|
-
function
|
|
3009
|
+
function Ys(t) {
|
|
2994
3010
|
return fs.safeParse(t).success;
|
|
2995
3011
|
}
|
|
2996
|
-
function
|
|
3012
|
+
function Js(t) {
|
|
3013
|
+
return ys.safeParse(t).success;
|
|
3014
|
+
}
|
|
3015
|
+
function Xs(t) {
|
|
2997
3016
|
return hs.safeParse(t).success;
|
|
2998
3017
|
}
|
|
2999
|
-
function
|
|
3018
|
+
function js(t) {
|
|
3000
3019
|
return ps.safeParse(t).success;
|
|
3001
3020
|
}
|
|
3002
|
-
function
|
|
3021
|
+
function Ks(t) {
|
|
3003
3022
|
return ms.safeParse(t).success;
|
|
3004
3023
|
}
|
|
3005
|
-
function
|
|
3006
|
-
return
|
|
3024
|
+
function Ps(t) {
|
|
3025
|
+
return gs.safeParse(t).success;
|
|
3007
3026
|
}
|
|
3008
|
-
function
|
|
3027
|
+
function qs(t) {
|
|
3009
3028
|
return _s.safeParse(t).success;
|
|
3010
3029
|
}
|
|
3011
|
-
function
|
|
3030
|
+
function $s(t) {
|
|
3012
3031
|
return xs.safeParse(t).success;
|
|
3013
3032
|
}
|
|
3014
|
-
function
|
|
3033
|
+
function Fs(t) {
|
|
3015
3034
|
return bs.safeParse(t).success;
|
|
3016
3035
|
}
|
|
3017
|
-
function
|
|
3036
|
+
function en(t) {
|
|
3037
|
+
return ws.safeParse(t).success;
|
|
3038
|
+
}
|
|
3039
|
+
function tn(t) {
|
|
3018
3040
|
return ks.safeParse(t).success;
|
|
3019
3041
|
}
|
|
3020
|
-
function
|
|
3021
|
-
return
|
|
3042
|
+
function sn(t) {
|
|
3043
|
+
return qs(t) || $s(t);
|
|
3022
3044
|
}
|
|
3023
|
-
function
|
|
3045
|
+
function nn(t) {
|
|
3046
|
+
return Ss.safeParse(t).success;
|
|
3047
|
+
}
|
|
3048
|
+
function Us(t) {
|
|
3049
|
+
return Ts.safeParse(t).success;
|
|
3050
|
+
}
|
|
3051
|
+
function rn(t) {
|
|
3052
|
+
return Rs.safeParse(t).success;
|
|
3053
|
+
}
|
|
3054
|
+
function Ls(t) {
|
|
3055
|
+
return Es.safeParse(t).success;
|
|
3056
|
+
}
|
|
3057
|
+
function an(t) {
|
|
3058
|
+
return Cs.safeParse(t).success;
|
|
3059
|
+
}
|
|
3060
|
+
function on(t) {
|
|
3061
|
+
return Zs.safeParse(t).success;
|
|
3062
|
+
}
|
|
3063
|
+
function cn(t) {
|
|
3064
|
+
return Ns.safeParse(t).success;
|
|
3065
|
+
}
|
|
3066
|
+
function Ke(t) {
|
|
3024
3067
|
if (t instanceof File || t instanceof Blob)
|
|
3025
3068
|
return URL.createObjectURL(t);
|
|
3026
3069
|
if (typeof t == "string") {
|
|
3027
3070
|
if (/^data:/.test(t)) {
|
|
3028
3071
|
const a = t.match(/^data:([^;]+);base64,(.*)$/);
|
|
3029
3072
|
if (a) {
|
|
3030
|
-
const i = a[1], o = a[2], d = atob(o), u = new ArrayBuffer(d.length),
|
|
3073
|
+
const i = a[1], o = a[2], d = atob(o), u = new ArrayBuffer(d.length), g = new Uint8Array(u);
|
|
3031
3074
|
for (let D = 0; D < d.length; D++)
|
|
3032
|
-
|
|
3075
|
+
g[D] = d.charCodeAt(D);
|
|
3033
3076
|
const R = new Blob([u], { type: i });
|
|
3034
3077
|
return URL.createObjectURL(R);
|
|
3035
3078
|
}
|
|
@@ -3047,64 +3090,64 @@ function Xe(t) {
|
|
|
3047
3090
|
}
|
|
3048
3091
|
throw new Error("Unsupported content type for blobUrl");
|
|
3049
3092
|
}
|
|
3050
|
-
function
|
|
3093
|
+
function dn(t, e, s, n) {
|
|
3051
3094
|
return {
|
|
3052
|
-
id: n ??
|
|
3095
|
+
id: n ?? qe(),
|
|
3053
3096
|
name: t,
|
|
3054
3097
|
mimeType: e,
|
|
3055
|
-
blobUrl:
|
|
3098
|
+
blobUrl: Ke(s)
|
|
3056
3099
|
};
|
|
3057
3100
|
}
|
|
3058
|
-
function
|
|
3101
|
+
function un(t, e) {
|
|
3059
3102
|
let s = t.blobUrl;
|
|
3060
|
-
return e.content !== void 0 && (s =
|
|
3103
|
+
return e.content !== void 0 && (s = Ke(e.content)), {
|
|
3061
3104
|
...t,
|
|
3062
3105
|
...e,
|
|
3063
3106
|
blobUrl: s
|
|
3064
3107
|
};
|
|
3065
3108
|
}
|
|
3066
|
-
window.addEventListener("message",
|
|
3067
|
-
async function
|
|
3068
|
-
await
|
|
3109
|
+
window.addEventListener("message", Vs);
|
|
3110
|
+
async function ln(t, e) {
|
|
3111
|
+
await M({
|
|
3069
3112
|
type: "qp-bridge",
|
|
3070
3113
|
action: "setAnswer",
|
|
3071
3114
|
question: t,
|
|
3072
3115
|
answer: e
|
|
3073
3116
|
});
|
|
3074
3117
|
}
|
|
3075
|
-
async function
|
|
3076
|
-
return await
|
|
3118
|
+
async function fn(t) {
|
|
3119
|
+
return await Ds({
|
|
3077
3120
|
type: "qp-bridge",
|
|
3078
3121
|
action: "getQuestion",
|
|
3079
3122
|
question: t
|
|
3080
3123
|
});
|
|
3081
3124
|
}
|
|
3082
|
-
async function
|
|
3083
|
-
await
|
|
3125
|
+
async function hn(t, e) {
|
|
3126
|
+
await M({
|
|
3084
3127
|
type: "qp-bridge",
|
|
3085
3128
|
action: "setQuestion",
|
|
3086
3129
|
question: t,
|
|
3087
3130
|
questionData: e
|
|
3088
3131
|
});
|
|
3089
3132
|
}
|
|
3090
|
-
async function
|
|
3091
|
-
return await
|
|
3133
|
+
async function pn(t) {
|
|
3134
|
+
return await Bs({
|
|
3092
3135
|
type: "qp-bridge",
|
|
3093
3136
|
action: "getGroup",
|
|
3094
3137
|
group: t
|
|
3095
3138
|
});
|
|
3096
3139
|
}
|
|
3097
|
-
async function
|
|
3098
|
-
await
|
|
3140
|
+
async function mn(t, e) {
|
|
3141
|
+
await M({
|
|
3099
3142
|
type: "qp-bridge",
|
|
3100
3143
|
action: "setGroup",
|
|
3101
3144
|
group: t,
|
|
3102
3145
|
groupData: e
|
|
3103
3146
|
});
|
|
3104
3147
|
}
|
|
3105
|
-
function
|
|
3148
|
+
function gn(t) {
|
|
3106
3149
|
const e = (s) => {
|
|
3107
|
-
|
|
3150
|
+
Ms(s.data) && t(s.data.question, s.data.answer);
|
|
3108
3151
|
};
|
|
3109
3152
|
return window.addEventListener("message", e), {
|
|
3110
3153
|
cancelSubscription: () => {
|
|
@@ -3112,52 +3155,52 @@ function Ks(t) {
|
|
|
3112
3155
|
}
|
|
3113
3156
|
};
|
|
3114
3157
|
}
|
|
3115
|
-
async function
|
|
3116
|
-
await
|
|
3158
|
+
async function yn(t) {
|
|
3159
|
+
await M({
|
|
3117
3160
|
type: "qp-bridge",
|
|
3118
3161
|
action: "busyIndicatorStart"
|
|
3119
3162
|
});
|
|
3120
3163
|
try {
|
|
3121
3164
|
return await t();
|
|
3122
3165
|
} finally {
|
|
3123
|
-
await
|
|
3166
|
+
await M({
|
|
3124
3167
|
type: "qp-bridge",
|
|
3125
3168
|
action: "busyIndicatorEnd"
|
|
3126
3169
|
});
|
|
3127
3170
|
}
|
|
3128
3171
|
}
|
|
3129
|
-
async function
|
|
3130
|
-
await
|
|
3172
|
+
async function vn() {
|
|
3173
|
+
await M({
|
|
3131
3174
|
type: "qp-bridge",
|
|
3132
3175
|
action: "saveQuestionnaire"
|
|
3133
3176
|
});
|
|
3134
3177
|
}
|
|
3135
|
-
async function
|
|
3136
|
-
await
|
|
3178
|
+
async function _n() {
|
|
3179
|
+
await M({
|
|
3137
3180
|
type: "qp-bridge",
|
|
3138
3181
|
action: "completeAndCloseQuestionnaire"
|
|
3139
3182
|
});
|
|
3140
3183
|
}
|
|
3141
|
-
async function
|
|
3142
|
-
await
|
|
3184
|
+
async function xn(t) {
|
|
3185
|
+
await M({
|
|
3143
3186
|
type: "qp-bridge",
|
|
3144
3187
|
action: "executeCustomCommand",
|
|
3145
3188
|
commandName: t
|
|
3146
3189
|
});
|
|
3147
3190
|
}
|
|
3148
|
-
const
|
|
3149
|
-
function
|
|
3150
|
-
return
|
|
3191
|
+
const te = [];
|
|
3192
|
+
function bn(t) {
|
|
3193
|
+
return te.includes(t) || te.push(t), {
|
|
3151
3194
|
cancelSubscription: () => {
|
|
3152
|
-
const e =
|
|
3153
|
-
e !== -1 &&
|
|
3195
|
+
const e = te.indexOf(t);
|
|
3196
|
+
e !== -1 && te.splice(e, 1);
|
|
3154
3197
|
}
|
|
3155
3198
|
};
|
|
3156
3199
|
}
|
|
3157
|
-
async function
|
|
3200
|
+
async function Vs(t) {
|
|
3158
3201
|
try {
|
|
3159
|
-
if (
|
|
3160
|
-
const e = await Promise.all(
|
|
3202
|
+
if (Ps(t.data)) {
|
|
3203
|
+
const e = await Promise.all(te.map((n) => n())), s = {
|
|
3161
3204
|
type: "qp-bridge",
|
|
3162
3205
|
status: "success",
|
|
3163
3206
|
id: t.data.id,
|
|
@@ -3169,87 +3212,151 @@ async function Ns(t) {
|
|
|
3169
3212
|
const s = {
|
|
3170
3213
|
type: "qp-bridge",
|
|
3171
3214
|
status: "error",
|
|
3172
|
-
id:
|
|
3215
|
+
id: Xe(t.data) ? t.data.id : void 0,
|
|
3173
3216
|
message: e instanceof Error ? e.message : "Unknown error"
|
|
3174
3217
|
};
|
|
3175
3218
|
window.parent.postMessage(s, "*");
|
|
3176
3219
|
}
|
|
3177
3220
|
}
|
|
3178
|
-
async function
|
|
3221
|
+
async function wn(t) {
|
|
3222
|
+
return await zs({
|
|
3223
|
+
type: "qp-bridge",
|
|
3224
|
+
action: "fetchEntities",
|
|
3225
|
+
fetchXml: t
|
|
3226
|
+
});
|
|
3227
|
+
}
|
|
3228
|
+
async function kn(t, e) {
|
|
3229
|
+
return await Gs({
|
|
3230
|
+
type: "qp-bridge",
|
|
3231
|
+
action: "getEntityById",
|
|
3232
|
+
entityName: t,
|
|
3233
|
+
entityId: e
|
|
3234
|
+
});
|
|
3235
|
+
}
|
|
3236
|
+
async function Sn(t, e) {
|
|
3237
|
+
await M({
|
|
3238
|
+
type: "qp-bridge",
|
|
3239
|
+
action: "repeatGroup",
|
|
3240
|
+
parentGroupName: t,
|
|
3241
|
+
groupIndex: e
|
|
3242
|
+
});
|
|
3243
|
+
}
|
|
3244
|
+
async function Tn(t) {
|
|
3245
|
+
await M({
|
|
3246
|
+
type: "qp-bridge",
|
|
3247
|
+
action: "addNewGroup",
|
|
3248
|
+
groupName: t
|
|
3249
|
+
});
|
|
3250
|
+
}
|
|
3251
|
+
async function Rn(t, e) {
|
|
3252
|
+
await M({
|
|
3253
|
+
type: "qp-bridge",
|
|
3254
|
+
action: "deleteGroup",
|
|
3255
|
+
parentGroupName: t,
|
|
3256
|
+
groupIndex: e
|
|
3257
|
+
});
|
|
3258
|
+
}
|
|
3259
|
+
async function ye(t, e) {
|
|
3179
3260
|
return new Promise((s, n) => {
|
|
3180
|
-
const r =
|
|
3181
|
-
if (!
|
|
3261
|
+
const r = qe(), a = (i) => {
|
|
3262
|
+
if (!Xe(i.data) || i.data.id !== r)
|
|
3182
3263
|
return;
|
|
3183
3264
|
const d = e(i.data);
|
|
3184
|
-
d.success ? s(d.data) :
|
|
3265
|
+
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
3266
|
};
|
|
3186
3267
|
window.addEventListener("message", a), window.parent.postMessage({ ...t, id: r }, "*");
|
|
3187
3268
|
});
|
|
3188
3269
|
}
|
|
3189
|
-
async function
|
|
3190
|
-
return
|
|
3270
|
+
async function Ds(t) {
|
|
3271
|
+
return ye(t, (e) => As(e) ? { success: !0, data: e.question } : { success: !1 });
|
|
3272
|
+
}
|
|
3273
|
+
async function Bs(t) {
|
|
3274
|
+
return ye(t, (e) => js(e) ? { success: !0, data: e.group } : { success: !1 });
|
|
3275
|
+
}
|
|
3276
|
+
function M(t) {
|
|
3277
|
+
return ye(t, (e) => Is(e) ? { success: !0, data: void 0 } : { success: !1 });
|
|
3191
3278
|
}
|
|
3192
|
-
async function
|
|
3193
|
-
return
|
|
3279
|
+
async function zs(t) {
|
|
3280
|
+
return ye(t, (e) => Us(e) ? { success: !0, data: e.entities } : { success: !1 });
|
|
3194
3281
|
}
|
|
3195
|
-
function
|
|
3196
|
-
return
|
|
3282
|
+
async function Gs(t) {
|
|
3283
|
+
return ye(t, (e) => Ls(e) ? { success: !0, data: e.entity } : { success: !1 });
|
|
3197
3284
|
}
|
|
3198
3285
|
export {
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3286
|
+
Tn as addNewGroup,
|
|
3287
|
+
Zs as addNewGroupRequestMessageSchema,
|
|
3288
|
+
xs as busyIndicatorEndRequestMessageSchema,
|
|
3289
|
+
_s as busyIndicatorStartRequestMessageSchema,
|
|
3290
|
+
gs as canSaveRequestMessageSchema,
|
|
3291
|
+
ms as canSaveSuccessResponseMessageSchema,
|
|
3292
|
+
_n as completeAndCloseQuestionnaire,
|
|
3293
|
+
ws as completeAndCloseQuestionnaireRequestMessageSchema,
|
|
3294
|
+
dn as createMediaItem,
|
|
3295
|
+
Rn as deleteGroup,
|
|
3296
|
+
Ns as deleteGroupRequestMessageSchema,
|
|
3297
|
+
Ye as entitySchema,
|
|
3298
|
+
xn as executeCustomCommand,
|
|
3207
3299
|
ks as executeCustomCommandRequestMessageSchema,
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
Us as
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3300
|
+
wn as fetchEntities,
|
|
3301
|
+
Ss as fetchEntitiesRequestMessageSchema,
|
|
3302
|
+
Ts as fetchEntitiesSuccessResponseMessageSchema,
|
|
3303
|
+
kn as getEntityById,
|
|
3304
|
+
Rs as getEntityByIdRequestMessageSchema,
|
|
3305
|
+
Es as getEntityByIdSuccessResponseMessageSchema,
|
|
3306
|
+
pn as getGroup,
|
|
3307
|
+
hs as getGroupRequestMessageSchema,
|
|
3308
|
+
ps as getGroupSuccessResponseMessageSchema,
|
|
3309
|
+
fn as getQuestion,
|
|
3310
|
+
us as getQuestionRequestMessageSchema,
|
|
3311
|
+
ls as getQuestionSuccessResponseMessageSchema,
|
|
3312
|
+
ds as groupOptionalScheme,
|
|
3313
|
+
Je as groupSchema,
|
|
3314
|
+
on as isAddNewGroupRequestMessage,
|
|
3315
|
+
$s as isBusyIndicatorEndRequestMessage,
|
|
3316
|
+
qs as isBusyIndicatorStartRequestMessage,
|
|
3317
|
+
Ps as isCanSaveRequestMessage,
|
|
3318
|
+
Ks as isCanSaveSuccessResponseMessage,
|
|
3319
|
+
en as isCompleteAndCloseQuestionnaireRequestMessage,
|
|
3320
|
+
cn as isDeleteGroupRequestMessage,
|
|
3321
|
+
Os as isErrorMessage,
|
|
3322
|
+
tn as isExecuteCustomCommandRequestMessage,
|
|
3323
|
+
nn as isFetchEntitiesRequestMessage,
|
|
3324
|
+
Us as isFetchEntitiesSuccessResponseMessage,
|
|
3325
|
+
rn as isGetEntityByIdRequestMessage,
|
|
3326
|
+
Ls as isGetEntityByIdSuccessResponseMessage,
|
|
3327
|
+
Xs as isGetGroupRequestMessage,
|
|
3328
|
+
js as isGetGroupSuccessResponseMessage,
|
|
3329
|
+
Ws as isGetQuestionRequestMessage,
|
|
3330
|
+
As as isGetQuestionSuccessResponseMessage,
|
|
3331
|
+
Qs as isMediaItem,
|
|
3332
|
+
Ms as isOnAnswerChangeMessage,
|
|
3333
|
+
Xe as isQpBridgeMessage,
|
|
3334
|
+
an as isRepeatGroupRequestMessage,
|
|
3335
|
+
Fs as isSaveQuestionnaireRequestMessage,
|
|
3336
|
+
Hs as isSetAnswerRequestMessage,
|
|
3337
|
+
Js as isSetGroupRequestMessage,
|
|
3338
|
+
Ys as isSetQuestionRequestMessage,
|
|
3339
|
+
Is as isSuccessMessage,
|
|
3340
|
+
sn as isWithBusyIndicatorRequestMessage,
|
|
3341
|
+
cs as mediaItemSchema,
|
|
3342
|
+
gn as onAnswerChange,
|
|
3343
|
+
as as onAnswerChangeMessageSchema,
|
|
3344
|
+
bn as onSave,
|
|
3345
|
+
w as qpBridgeMessageSchema,
|
|
3346
|
+
os as questionOptionalScheme,
|
|
3242
3347
|
He as questionSchema,
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3348
|
+
Sn as repeatGroup,
|
|
3349
|
+
Cs as repeatGroupRequestMessageSchema,
|
|
3350
|
+
is as responseErrorMessageSchema,
|
|
3351
|
+
K as responseSuccessMessageSchema,
|
|
3352
|
+
vn as saveQuestionnaire,
|
|
3353
|
+
bs as saveQuestionnaireRequestMessageSchema,
|
|
3354
|
+
ln as setAnswer,
|
|
3355
|
+
vs as setAnswerRequestMessageSchema,
|
|
3356
|
+
mn as setGroup,
|
|
3357
|
+
ys as setGroupRequestMessageSchema,
|
|
3358
|
+
hn as setQuestion,
|
|
3359
|
+
fs as setQuestionRequestMessageSchema,
|
|
3360
|
+
un as updateMediaItem,
|
|
3361
|
+
yn as withBusyIndicator
|
|
3255
3362
|
};
|