@resconet/qp-bridge 0.0.1-alpha.11 → 0.0.1-alpha.13
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 +52 -6
- package/index.js +1 -1
- package/index.mjs +350 -318
- package/lib/qp-bridge-types.d.ts +58 -0
- package/lib/qp-bridge.d.ts +35 -11
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
let
|
|
1
|
+
let pe;
|
|
2
2
|
const Ye = new Uint8Array(16);
|
|
3
3
|
function He() {
|
|
4
|
-
if (!
|
|
4
|
+
if (!pe && (pe = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !pe))
|
|
5
5
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
6
|
-
return
|
|
6
|
+
return pe(Ye);
|
|
7
7
|
}
|
|
8
8
|
const k = [];
|
|
9
9
|
for (let s = 0; s < 256; ++s)
|
|
@@ -21,7 +21,7 @@ function Ke(s, e, t) {
|
|
|
21
21
|
const n = s.random || (s.rng || He)();
|
|
22
22
|
return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, Je(n);
|
|
23
23
|
}
|
|
24
|
-
var
|
|
24
|
+
var x;
|
|
25
25
|
(function(s) {
|
|
26
26
|
s.assertEqual = (r) => r;
|
|
27
27
|
function e(r) {
|
|
@@ -56,7 +56,7 @@ var _;
|
|
|
56
56
|
return r.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
|
|
57
57
|
}
|
|
58
58
|
s.joinValues = n, s.jsonStringifyReplacer = (r, a) => typeof a == "bigint" ? a.toString() : a;
|
|
59
|
-
})(
|
|
59
|
+
})(x || (x = {}));
|
|
60
60
|
var Se;
|
|
61
61
|
(function(s) {
|
|
62
62
|
s.mergeShapes = (e, t) => ({
|
|
@@ -65,7 +65,7 @@ var Se;
|
|
|
65
65
|
// second overwrites first
|
|
66
66
|
});
|
|
67
67
|
})(Se || (Se = {}));
|
|
68
|
-
const f =
|
|
68
|
+
const f = x.arrayToEnum([
|
|
69
69
|
"string",
|
|
70
70
|
"nan",
|
|
71
71
|
"number",
|
|
@@ -107,7 +107,7 @@ const f = _.arrayToEnum([
|
|
|
107
107
|
default:
|
|
108
108
|
return f.unknown;
|
|
109
109
|
}
|
|
110
|
-
}, c =
|
|
110
|
+
}, c = x.arrayToEnum([
|
|
111
111
|
"invalid_type",
|
|
112
112
|
"invalid_literal",
|
|
113
113
|
"custom",
|
|
@@ -169,7 +169,7 @@ class S extends Error {
|
|
|
169
169
|
return this.message;
|
|
170
170
|
}
|
|
171
171
|
get message() {
|
|
172
|
-
return JSON.stringify(this.issues,
|
|
172
|
+
return JSON.stringify(this.issues, x.jsonStringifyReplacer, 2);
|
|
173
173
|
}
|
|
174
174
|
get isEmpty() {
|
|
175
175
|
return this.issues.length === 0;
|
|
@@ -192,19 +192,19 @@ const Q = (s, e) => {
|
|
|
192
192
|
s.received === f.undefined ? t = "Required" : t = `Expected ${s.expected}, received ${s.received}`;
|
|
193
193
|
break;
|
|
194
194
|
case c.invalid_literal:
|
|
195
|
-
t = `Invalid literal value, expected ${JSON.stringify(s.expected,
|
|
195
|
+
t = `Invalid literal value, expected ${JSON.stringify(s.expected, x.jsonStringifyReplacer)}`;
|
|
196
196
|
break;
|
|
197
197
|
case c.unrecognized_keys:
|
|
198
|
-
t = `Unrecognized key(s) in object: ${
|
|
198
|
+
t = `Unrecognized key(s) in object: ${x.joinValues(s.keys, ", ")}`;
|
|
199
199
|
break;
|
|
200
200
|
case c.invalid_union:
|
|
201
201
|
t = "Invalid input";
|
|
202
202
|
break;
|
|
203
203
|
case c.invalid_union_discriminator:
|
|
204
|
-
t = `Invalid discriminator value. Expected ${
|
|
204
|
+
t = `Invalid discriminator value. Expected ${x.joinValues(s.options)}`;
|
|
205
205
|
break;
|
|
206
206
|
case c.invalid_enum_value:
|
|
207
|
-
t = `Invalid enum value. Expected ${
|
|
207
|
+
t = `Invalid enum value. Expected ${x.joinValues(s.options)}, received '${s.received}'`;
|
|
208
208
|
break;
|
|
209
209
|
case c.invalid_arguments:
|
|
210
210
|
t = "Invalid function arguments";
|
|
@@ -216,7 +216,7 @@ const Q = (s, e) => {
|
|
|
216
216
|
t = "Invalid date";
|
|
217
217
|
break;
|
|
218
218
|
case c.invalid_string:
|
|
219
|
-
typeof s.validation == "object" ? "includes" in s.validation ? (t = `Invalid input: must include "${s.validation.includes}"`, typeof s.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${s.validation.position}`)) : "startsWith" in s.validation ? t = `Invalid input: must start with "${s.validation.startsWith}"` : "endsWith" in s.validation ? t = `Invalid input: must end with "${s.validation.endsWith}"` :
|
|
219
|
+
typeof s.validation == "object" ? "includes" in s.validation ? (t = `Invalid input: must include "${s.validation.includes}"`, typeof s.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${s.validation.position}`)) : "startsWith" in s.validation ? t = `Invalid input: must start with "${s.validation.startsWith}"` : "endsWith" in s.validation ? t = `Invalid input: must end with "${s.validation.endsWith}"` : x.assertNever(s.validation) : s.validation !== "regex" ? t = `Invalid ${s.validation}` : t = "Invalid";
|
|
220
220
|
break;
|
|
221
221
|
case c.too_small:
|
|
222
222
|
s.type === "array" ? t = `Array must contain ${s.exact ? "exactly" : s.inclusive ? "at least" : "more than"} ${s.minimum} element(s)` : s.type === "string" ? t = `String must contain ${s.exact ? "exactly" : s.inclusive ? "at least" : "over"} ${s.minimum} character(s)` : s.type === "number" ? t = `Number must be ${s.exact ? "exactly equal to " : s.inclusive ? "greater than or equal to " : "greater than "}${s.minimum}` : s.type === "date" ? t = `Date must be ${s.exact ? "exactly equal to " : s.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(s.minimum))}` : t = "Invalid input";
|
|
@@ -237,7 +237,7 @@ const Q = (s, e) => {
|
|
|
237
237
|
t = "Number must be finite";
|
|
238
238
|
break;
|
|
239
239
|
default:
|
|
240
|
-
t = e.defaultError,
|
|
240
|
+
t = e.defaultError, x.assertNever(s);
|
|
241
241
|
}
|
|
242
242
|
return { message: t };
|
|
243
243
|
};
|
|
@@ -245,10 +245,10 @@ let Pe = Q;
|
|
|
245
245
|
function et(s) {
|
|
246
246
|
Pe = s;
|
|
247
247
|
}
|
|
248
|
-
function
|
|
248
|
+
function me() {
|
|
249
249
|
return Pe;
|
|
250
250
|
}
|
|
251
|
-
const
|
|
251
|
+
const ge = (s) => {
|
|
252
252
|
const { data: e, path: t, errorMaps: n, issueData: r } = s, a = [...t, ...r.path || []], i = {
|
|
253
253
|
...r,
|
|
254
254
|
path: a
|
|
@@ -270,7 +270,7 @@ const me = (s) => {
|
|
|
270
270
|
};
|
|
271
271
|
}, tt = [];
|
|
272
272
|
function l(s, e) {
|
|
273
|
-
const t =
|
|
273
|
+
const t = me(), n = ge({
|
|
274
274
|
issueData: e,
|
|
275
275
|
data: s.data,
|
|
276
276
|
path: s.path,
|
|
@@ -327,8 +327,8 @@ class w {
|
|
|
327
327
|
}
|
|
328
328
|
const m = Object.freeze({
|
|
329
329
|
status: "aborted"
|
|
330
|
-
}),
|
|
331
|
-
function
|
|
330
|
+
}), G = (s) => ({ status: "dirty", value: s }), T = (s) => ({ status: "valid", value: s }), Ze = (s) => s.status === "aborted", Re = (s) => s.status === "dirty", F = (s) => s.status === "valid", ee = (s) => typeof Promise < "u" && s instanceof Promise;
|
|
331
|
+
function ye(s, e, t, n) {
|
|
332
332
|
if (typeof e == "function" ? s !== e || !n : !e.has(s))
|
|
333
333
|
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
334
334
|
return e.get(s);
|
|
@@ -342,8 +342,8 @@ var h;
|
|
|
342
342
|
(function(s) {
|
|
343
343
|
s.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, s.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
344
344
|
})(h || (h = {}));
|
|
345
|
-
var
|
|
346
|
-
class
|
|
345
|
+
var X, K;
|
|
346
|
+
class I {
|
|
347
347
|
constructor(e, t, n, r) {
|
|
348
348
|
this._cachedPath = [], this.parent = e, this.data = t, this._path = n, this._key = r;
|
|
349
349
|
}
|
|
@@ -352,7 +352,7 @@ class O {
|
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
354
|
const je = (s, e) => {
|
|
355
|
-
if (
|
|
355
|
+
if (F(e))
|
|
356
356
|
return { success: !0, data: e.value };
|
|
357
357
|
if (!s.common.issues.length)
|
|
358
358
|
throw new Error("Validation failed but no issues detected.");
|
|
@@ -413,7 +413,7 @@ class v {
|
|
|
413
413
|
}
|
|
414
414
|
_parseSync(e) {
|
|
415
415
|
const t = this._parse(e);
|
|
416
|
-
if (
|
|
416
|
+
if (ee(t))
|
|
417
417
|
throw new Error("Synchronous parse encountered promise.");
|
|
418
418
|
return t;
|
|
419
419
|
}
|
|
@@ -461,7 +461,7 @@ class v {
|
|
|
461
461
|
parent: null,
|
|
462
462
|
data: e,
|
|
463
463
|
parsedType: P(e)
|
|
464
|
-
}, r = this._parse({ data: e, path: n.path, parent: n }), a = await (
|
|
464
|
+
}, r = this._parse({ data: e, path: n.path, parent: n }), a = await (ee(r) ? r : Promise.resolve(r));
|
|
465
465
|
return je(n, a);
|
|
466
466
|
}
|
|
467
467
|
refine(e, t) {
|
|
@@ -478,7 +478,7 @@ class v {
|
|
|
478
478
|
return this._refinement((n, r) => e(n) ? !0 : (r.addIssue(typeof t == "function" ? t(n, r) : t), !1));
|
|
479
479
|
}
|
|
480
480
|
_refinement(e) {
|
|
481
|
-
return new
|
|
481
|
+
return new N({
|
|
482
482
|
schema: this,
|
|
483
483
|
typeName: p.ZodEffects,
|
|
484
484
|
effect: { type: "refinement", refinement: e }
|
|
@@ -488,10 +488,10 @@ class v {
|
|
|
488
488
|
return this._refinement(e);
|
|
489
489
|
}
|
|
490
490
|
optional() {
|
|
491
|
-
return
|
|
491
|
+
return O.create(this, this._def);
|
|
492
492
|
}
|
|
493
493
|
nullable() {
|
|
494
|
-
return
|
|
494
|
+
return D.create(this, this._def);
|
|
495
495
|
}
|
|
496
496
|
nullish() {
|
|
497
497
|
return this.nullable().optional();
|
|
@@ -503,13 +503,13 @@ class v {
|
|
|
503
503
|
return H.create(this, this._def);
|
|
504
504
|
}
|
|
505
505
|
or(e) {
|
|
506
|
-
return
|
|
506
|
+
return re.create([this, e], this._def);
|
|
507
507
|
}
|
|
508
508
|
and(e) {
|
|
509
|
-
return
|
|
509
|
+
return ae.create(this, e, this._def);
|
|
510
510
|
}
|
|
511
511
|
transform(e) {
|
|
512
|
-
return new
|
|
512
|
+
return new N({
|
|
513
513
|
...y(this._def),
|
|
514
514
|
schema: this,
|
|
515
515
|
typeName: p.ZodEffects,
|
|
@@ -518,7 +518,7 @@ class v {
|
|
|
518
518
|
}
|
|
519
519
|
default(e) {
|
|
520
520
|
const t = typeof e == "function" ? e : () => e;
|
|
521
|
-
return new
|
|
521
|
+
return new ue({
|
|
522
522
|
...y(this._def),
|
|
523
523
|
innerType: this,
|
|
524
524
|
defaultValue: t,
|
|
@@ -526,7 +526,7 @@ class v {
|
|
|
526
526
|
});
|
|
527
527
|
}
|
|
528
528
|
brand() {
|
|
529
|
-
return new
|
|
529
|
+
return new Ee({
|
|
530
530
|
typeName: p.ZodBranded,
|
|
531
531
|
type: this,
|
|
532
532
|
...y(this._def)
|
|
@@ -534,7 +534,7 @@ class v {
|
|
|
534
534
|
}
|
|
535
535
|
catch(e) {
|
|
536
536
|
const t = typeof e == "function" ? e : () => e;
|
|
537
|
-
return new
|
|
537
|
+
return new le({
|
|
538
538
|
...y(this._def),
|
|
539
539
|
innerType: this,
|
|
540
540
|
catchValue: t,
|
|
@@ -549,10 +549,10 @@ class v {
|
|
|
549
549
|
});
|
|
550
550
|
}
|
|
551
551
|
pipe(e) {
|
|
552
|
-
return
|
|
552
|
+
return he.create(this, e);
|
|
553
553
|
}
|
|
554
554
|
readonly() {
|
|
555
|
-
return
|
|
555
|
+
return fe.create(this);
|
|
556
556
|
}
|
|
557
557
|
isOptional() {
|
|
558
558
|
return this.safeParse(void 0).success;
|
|
@@ -564,15 +564,15 @@ class v {
|
|
|
564
564
|
const st = /^c[^\s-]{8,}$/i, nt = /^[0-9a-z]+$/, rt = /^[0-9A-HJKMNP-TV-Z]{26}$/, at = /^[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, it = /^[a-z0-9_-]{21}$/i, ot = /^[-+]?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)?)??$/, ct = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, dt = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
565
565
|
let Te;
|
|
566
566
|
const ut = /^(?:(?: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])$/, lt = /^(([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})))$/, ft = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Ve = "((\\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])))", ht = new RegExp(`^${Ve}$`);
|
|
567
|
-
function
|
|
567
|
+
function qe(s) {
|
|
568
568
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
569
569
|
return s.precision ? e = `${e}\\.\\d{${s.precision}}` : s.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
570
570
|
}
|
|
571
571
|
function pt(s) {
|
|
572
|
-
return new RegExp(`^${
|
|
572
|
+
return new RegExp(`^${qe(s)}$`);
|
|
573
573
|
}
|
|
574
|
-
function
|
|
575
|
-
let e = `${Ve}T${
|
|
574
|
+
function De(s) {
|
|
575
|
+
let e = `${Ve}T${qe(s)}`;
|
|
576
576
|
const t = [];
|
|
577
577
|
return t.push(s.local ? "Z?" : "Z"), s.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
578
578
|
}
|
|
@@ -696,7 +696,7 @@ class C extends v {
|
|
|
696
696
|
code: c.invalid_string,
|
|
697
697
|
validation: { endsWith: a.value },
|
|
698
698
|
message: a.message
|
|
699
|
-
}), n.dirty()) : a.kind === "datetime" ?
|
|
699
|
+
}), n.dirty()) : a.kind === "datetime" ? De(a).test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
700
700
|
code: c.invalid_string,
|
|
701
701
|
validation: "datetime",
|
|
702
702
|
message: a.message
|
|
@@ -720,7 +720,7 @@ class C extends v {
|
|
|
720
720
|
validation: "base64",
|
|
721
721
|
code: c.invalid_string,
|
|
722
722
|
message: a.message
|
|
723
|
-
}), n.dirty()) :
|
|
723
|
+
}), n.dirty()) : x.assertNever(a);
|
|
724
724
|
return { status: n.value, value: e.data };
|
|
725
725
|
}
|
|
726
726
|
_regex(e, t, n) {
|
|
@@ -958,7 +958,7 @@ class $ extends v {
|
|
|
958
958
|
let n;
|
|
959
959
|
const r = new w();
|
|
960
960
|
for (const a of this._def.checks)
|
|
961
|
-
a.kind === "int" ?
|
|
961
|
+
a.kind === "int" ? x.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
962
962
|
code: c.invalid_type,
|
|
963
963
|
expected: "integer",
|
|
964
964
|
received: "float",
|
|
@@ -984,7 +984,7 @@ class $ extends v {
|
|
|
984
984
|
}), r.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
985
985
|
code: c.not_finite,
|
|
986
986
|
message: a.message
|
|
987
|
-
}), r.dirty()) :
|
|
987
|
+
}), r.dirty()) : x.assertNever(a);
|
|
988
988
|
return { status: r.value, value: e.data };
|
|
989
989
|
}
|
|
990
990
|
gte(e, t) {
|
|
@@ -1096,7 +1096,7 @@ class $ extends v {
|
|
|
1096
1096
|
return e;
|
|
1097
1097
|
}
|
|
1098
1098
|
get isInt() {
|
|
1099
|
-
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" &&
|
|
1099
|
+
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && x.isInteger(e.value));
|
|
1100
1100
|
}
|
|
1101
1101
|
get isFinite() {
|
|
1102
1102
|
let e = null, t = null;
|
|
@@ -1146,7 +1146,7 @@ class V extends v {
|
|
|
1146
1146
|
code: c.not_multiple_of,
|
|
1147
1147
|
multipleOf: a.value,
|
|
1148
1148
|
message: a.message
|
|
1149
|
-
}), r.dirty()) :
|
|
1149
|
+
}), r.dirty()) : x.assertNever(a);
|
|
1150
1150
|
return { status: r.value, value: e.data };
|
|
1151
1151
|
}
|
|
1152
1152
|
gte(e, t) {
|
|
@@ -1242,7 +1242,7 @@ V.create = (s) => {
|
|
|
1242
1242
|
...y(s)
|
|
1243
1243
|
});
|
|
1244
1244
|
};
|
|
1245
|
-
class
|
|
1245
|
+
class te extends v {
|
|
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);
|
|
@@ -1255,7 +1255,7 @@ class ee extends v {
|
|
|
1255
1255
|
return T(e.data);
|
|
1256
1256
|
}
|
|
1257
1257
|
}
|
|
1258
|
-
|
|
1258
|
+
te.create = (s) => new te({
|
|
1259
1259
|
typeName: p.ZodBoolean,
|
|
1260
1260
|
coerce: (s == null ? void 0 : s.coerce) || !1,
|
|
1261
1261
|
...y(s)
|
|
@@ -1293,7 +1293,7 @@ class U extends v {
|
|
|
1293
1293
|
exact: !1,
|
|
1294
1294
|
maximum: a.value,
|
|
1295
1295
|
type: "date"
|
|
1296
|
-
}), n.dirty()) :
|
|
1296
|
+
}), n.dirty()) : x.assertNever(a);
|
|
1297
1297
|
return {
|
|
1298
1298
|
status: n.value,
|
|
1299
1299
|
value: new Date(e.data.getTime())
|
|
@@ -1338,7 +1338,7 @@ U.create = (s) => new U({
|
|
|
1338
1338
|
typeName: p.ZodDate,
|
|
1339
1339
|
...y(s)
|
|
1340
1340
|
});
|
|
1341
|
-
class
|
|
1341
|
+
class ve extends v {
|
|
1342
1342
|
_parse(e) {
|
|
1343
1343
|
if (this._getType(e) !== f.symbol) {
|
|
1344
1344
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1351,11 +1351,11 @@ class ye extends v {
|
|
|
1351
1351
|
return T(e.data);
|
|
1352
1352
|
}
|
|
1353
1353
|
}
|
|
1354
|
-
|
|
1354
|
+
ve.create = (s) => new ve({
|
|
1355
1355
|
typeName: p.ZodSymbol,
|
|
1356
1356
|
...y(s)
|
|
1357
1357
|
});
|
|
1358
|
-
class
|
|
1358
|
+
class se extends v {
|
|
1359
1359
|
_parse(e) {
|
|
1360
1360
|
if (this._getType(e) !== f.undefined) {
|
|
1361
1361
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1368,11 +1368,11 @@ class te extends v {
|
|
|
1368
1368
|
return T(e.data);
|
|
1369
1369
|
}
|
|
1370
1370
|
}
|
|
1371
|
-
|
|
1371
|
+
se.create = (s) => new se({
|
|
1372
1372
|
typeName: p.ZodUndefined,
|
|
1373
1373
|
...y(s)
|
|
1374
1374
|
});
|
|
1375
|
-
class
|
|
1375
|
+
class ne extends v {
|
|
1376
1376
|
_parse(e) {
|
|
1377
1377
|
if (this._getType(e) !== f.null) {
|
|
1378
1378
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1385,7 +1385,7 @@ class se extends v {
|
|
|
1385
1385
|
return T(e.data);
|
|
1386
1386
|
}
|
|
1387
1387
|
}
|
|
1388
|
-
|
|
1388
|
+
ne.create = (s) => new ne({
|
|
1389
1389
|
typeName: p.ZodNull,
|
|
1390
1390
|
...y(s)
|
|
1391
1391
|
});
|
|
@@ -1401,7 +1401,7 @@ Y.create = (s) => new Y({
|
|
|
1401
1401
|
typeName: p.ZodAny,
|
|
1402
1402
|
...y(s)
|
|
1403
1403
|
});
|
|
1404
|
-
class
|
|
1404
|
+
class L extends v {
|
|
1405
1405
|
constructor() {
|
|
1406
1406
|
super(...arguments), this._unknown = !0;
|
|
1407
1407
|
}
|
|
@@ -1409,7 +1409,7 @@ class q extends v {
|
|
|
1409
1409
|
return T(e.data);
|
|
1410
1410
|
}
|
|
1411
1411
|
}
|
|
1412
|
-
|
|
1412
|
+
L.create = (s) => new L({
|
|
1413
1413
|
typeName: p.ZodUnknown,
|
|
1414
1414
|
...y(s)
|
|
1415
1415
|
});
|
|
@@ -1427,7 +1427,7 @@ A.create = (s) => new A({
|
|
|
1427
1427
|
typeName: p.ZodNever,
|
|
1428
1428
|
...y(s)
|
|
1429
1429
|
});
|
|
1430
|
-
class
|
|
1430
|
+
class _e extends v {
|
|
1431
1431
|
_parse(e) {
|
|
1432
1432
|
if (this._getType(e) !== f.undefined) {
|
|
1433
1433
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1440,7 +1440,7 @@ class ve extends v {
|
|
|
1440
1440
|
return T(e.data);
|
|
1441
1441
|
}
|
|
1442
1442
|
}
|
|
1443
|
-
|
|
1443
|
+
_e.create = (s) => new _e({
|
|
1444
1444
|
typeName: p.ZodVoid,
|
|
1445
1445
|
...y(s)
|
|
1446
1446
|
});
|
|
@@ -1480,8 +1480,8 @@ class E extends v {
|
|
|
1480
1480
|
exact: !1,
|
|
1481
1481
|
message: r.maxLength.message
|
|
1482
1482
|
}), n.dirty()), t.common.async)
|
|
1483
|
-
return Promise.all([...t.data].map((i, o) => r.type._parseAsync(new
|
|
1484
|
-
const a = [...t.data].map((i, o) => r.type._parseSync(new
|
|
1483
|
+
return Promise.all([...t.data].map((i, o) => r.type._parseAsync(new I(t, i, t.path, o)))).then((i) => w.mergeArray(n, i));
|
|
1484
|
+
const a = [...t.data].map((i, o) => r.type._parseSync(new I(t, i, t.path, o)));
|
|
1485
1485
|
return w.mergeArray(n, a);
|
|
1486
1486
|
}
|
|
1487
1487
|
get element() {
|
|
@@ -1522,7 +1522,7 @@ function B(s) {
|
|
|
1522
1522
|
const e = {};
|
|
1523
1523
|
for (const t in s.shape) {
|
|
1524
1524
|
const n = s.shape[t];
|
|
1525
|
-
e[t] =
|
|
1525
|
+
e[t] = O.create(B(n));
|
|
1526
1526
|
}
|
|
1527
1527
|
return new b({
|
|
1528
1528
|
...s._def,
|
|
@@ -1532,7 +1532,7 @@ function B(s) {
|
|
|
1532
1532
|
return s instanceof E ? new E({
|
|
1533
1533
|
...s._def,
|
|
1534
1534
|
type: B(s.element)
|
|
1535
|
-
}) : s instanceof
|
|
1535
|
+
}) : s instanceof O ? O.create(B(s.unwrap())) : s instanceof D ? D.create(B(s.unwrap())) : s instanceof M ? M.create(s.items.map((e) => B(e))) : s;
|
|
1536
1536
|
}
|
|
1537
1537
|
class b extends v {
|
|
1538
1538
|
constructor() {
|
|
@@ -1541,7 +1541,7 @@ class b extends v {
|
|
|
1541
1541
|
_getCached() {
|
|
1542
1542
|
if (this._cached !== null)
|
|
1543
1543
|
return this._cached;
|
|
1544
|
-
const e = this._def.shape(), t =
|
|
1544
|
+
const e = this._def.shape(), t = x.objectKeys(e);
|
|
1545
1545
|
return this._cached = { shape: e, keys: t };
|
|
1546
1546
|
}
|
|
1547
1547
|
_parse(e) {
|
|
@@ -1562,7 +1562,7 @@ class b extends v {
|
|
|
1562
1562
|
const g = a[d], Z = r.data[d];
|
|
1563
1563
|
u.push({
|
|
1564
1564
|
key: { status: "valid", value: d },
|
|
1565
|
-
value: g._parse(new
|
|
1565
|
+
value: g._parse(new I(r, Z, r.path, d)),
|
|
1566
1566
|
alwaysSet: d in r.data
|
|
1567
1567
|
});
|
|
1568
1568
|
}
|
|
@@ -1588,7 +1588,7 @@ class b extends v {
|
|
|
1588
1588
|
u.push({
|
|
1589
1589
|
key: { status: "valid", value: g },
|
|
1590
1590
|
value: d._parse(
|
|
1591
|
-
new
|
|
1591
|
+
new I(r, Z, r.path, g)
|
|
1592
1592
|
//, ctx.child(key), value, getParsedType(value)
|
|
1593
1593
|
),
|
|
1594
1594
|
alwaysSet: g in r.data
|
|
@@ -1749,7 +1749,7 @@ class b extends v {
|
|
|
1749
1749
|
}
|
|
1750
1750
|
pick(e) {
|
|
1751
1751
|
const t = {};
|
|
1752
|
-
return
|
|
1752
|
+
return x.objectKeys(e).forEach((n) => {
|
|
1753
1753
|
e[n] && this.shape[n] && (t[n] = this.shape[n]);
|
|
1754
1754
|
}), new b({
|
|
1755
1755
|
...this._def,
|
|
@@ -1758,7 +1758,7 @@ class b extends v {
|
|
|
1758
1758
|
}
|
|
1759
1759
|
omit(e) {
|
|
1760
1760
|
const t = {};
|
|
1761
|
-
return
|
|
1761
|
+
return x.objectKeys(this.shape).forEach((n) => {
|
|
1762
1762
|
e[n] || (t[n] = this.shape[n]);
|
|
1763
1763
|
}), new b({
|
|
1764
1764
|
...this._def,
|
|
@@ -1773,7 +1773,7 @@ class b extends v {
|
|
|
1773
1773
|
}
|
|
1774
1774
|
partial(e) {
|
|
1775
1775
|
const t = {};
|
|
1776
|
-
return
|
|
1776
|
+
return x.objectKeys(this.shape).forEach((n) => {
|
|
1777
1777
|
const r = this.shape[n];
|
|
1778
1778
|
e && !e[n] ? t[n] = r : t[n] = r.optional();
|
|
1779
1779
|
}), new b({
|
|
@@ -1783,12 +1783,12 @@ class b extends v {
|
|
|
1783
1783
|
}
|
|
1784
1784
|
required(e) {
|
|
1785
1785
|
const t = {};
|
|
1786
|
-
return
|
|
1786
|
+
return x.objectKeys(this.shape).forEach((n) => {
|
|
1787
1787
|
if (e && !e[n])
|
|
1788
1788
|
t[n] = this.shape[n];
|
|
1789
1789
|
else {
|
|
1790
1790
|
let a = this.shape[n];
|
|
1791
|
-
for (; a instanceof
|
|
1791
|
+
for (; a instanceof O; )
|
|
1792
1792
|
a = a._def.innerType;
|
|
1793
1793
|
t[n] = a;
|
|
1794
1794
|
}
|
|
@@ -1798,7 +1798,7 @@ class b extends v {
|
|
|
1798
1798
|
});
|
|
1799
1799
|
}
|
|
1800
1800
|
keyof() {
|
|
1801
|
-
return
|
|
1801
|
+
return Le(x.objectKeys(this.shape));
|
|
1802
1802
|
}
|
|
1803
1803
|
}
|
|
1804
1804
|
b.create = (s, e) => new b({
|
|
@@ -1822,7 +1822,7 @@ b.lazycreate = (s, e) => new b({
|
|
|
1822
1822
|
typeName: p.ZodObject,
|
|
1823
1823
|
...y(e)
|
|
1824
1824
|
});
|
|
1825
|
-
class
|
|
1825
|
+
class re extends v {
|
|
1826
1826
|
_parse(e) {
|
|
1827
1827
|
const { ctx: t } = this._processInputParams(e), n = this._def.options;
|
|
1828
1828
|
function r(a) {
|
|
@@ -1890,12 +1890,12 @@ class ne extends v {
|
|
|
1890
1890
|
return this._def.options;
|
|
1891
1891
|
}
|
|
1892
1892
|
}
|
|
1893
|
-
|
|
1893
|
+
re.create = (s, e) => new re({
|
|
1894
1894
|
options: s,
|
|
1895
1895
|
typeName: p.ZodUnion,
|
|
1896
1896
|
...y(e)
|
|
1897
1897
|
});
|
|
1898
|
-
const j = (s) => s instanceof
|
|
1898
|
+
const j = (s) => s instanceof oe ? j(s.schema) : s instanceof N ? j(s.innerType()) : s instanceof ce ? [s.value] : s instanceof q ? s.options : s instanceof de ? x.objectValues(s.enum) : s instanceof ue ? j(s._def.innerType) : s instanceof se ? [void 0] : s instanceof ne ? [null] : s instanceof O ? [void 0, ...j(s.unwrap())] : s instanceof D ? [null, ...j(s.unwrap())] : s instanceof Ee || s instanceof fe ? j(s.unwrap()) : s instanceof le ? j(s._def.innerType) : [];
|
|
1899
1899
|
class ke extends v {
|
|
1900
1900
|
_parse(e) {
|
|
1901
1901
|
const { ctx: t } = this._processInputParams(e);
|
|
@@ -1958,14 +1958,14 @@ class ke extends v {
|
|
|
1958
1958
|
});
|
|
1959
1959
|
}
|
|
1960
1960
|
}
|
|
1961
|
-
function
|
|
1961
|
+
function Ce(s, e) {
|
|
1962
1962
|
const t = P(s), n = P(e);
|
|
1963
1963
|
if (s === e)
|
|
1964
1964
|
return { valid: !0, data: s };
|
|
1965
1965
|
if (t === f.object && n === f.object) {
|
|
1966
|
-
const r =
|
|
1966
|
+
const r = x.objectKeys(e), a = x.objectKeys(s).filter((o) => r.indexOf(o) !== -1), i = { ...s, ...e };
|
|
1967
1967
|
for (const o of a) {
|
|
1968
|
-
const u =
|
|
1968
|
+
const u = Ce(s[o], e[o]);
|
|
1969
1969
|
if (!u.valid)
|
|
1970
1970
|
return { valid: !1 };
|
|
1971
1971
|
i[o] = u.data;
|
|
@@ -1976,7 +1976,7 @@ function Ee(s, e) {
|
|
|
1976
1976
|
return { valid: !1 };
|
|
1977
1977
|
const r = [];
|
|
1978
1978
|
for (let a = 0; a < s.length; a++) {
|
|
1979
|
-
const i = s[a], o = e[a], u =
|
|
1979
|
+
const i = s[a], o = e[a], u = Ce(i, o);
|
|
1980
1980
|
if (!u.valid)
|
|
1981
1981
|
return { valid: !1 };
|
|
1982
1982
|
r.push(u.data);
|
|
@@ -1985,13 +1985,13 @@ function Ee(s, e) {
|
|
|
1985
1985
|
} else
|
|
1986
1986
|
return t === f.date && n === f.date && +s == +e ? { valid: !0, data: s } : { valid: !1 };
|
|
1987
1987
|
}
|
|
1988
|
-
class
|
|
1988
|
+
class ae extends v {
|
|
1989
1989
|
_parse(e) {
|
|
1990
1990
|
const { status: t, ctx: n } = this._processInputParams(e), r = (a, i) => {
|
|
1991
1991
|
if (Ze(a) || Ze(i))
|
|
1992
1992
|
return m;
|
|
1993
|
-
const o =
|
|
1994
|
-
return o.valid ? ((
|
|
1993
|
+
const o = Ce(a.value, i.value);
|
|
1994
|
+
return o.valid ? ((Re(a) || Re(i)) && t.dirty(), { status: t.value, value: o.data }) : (l(n, {
|
|
1995
1995
|
code: c.invalid_intersection_types
|
|
1996
1996
|
}), m);
|
|
1997
1997
|
};
|
|
@@ -2017,13 +2017,13 @@ class re extends v {
|
|
|
2017
2017
|
}));
|
|
2018
2018
|
}
|
|
2019
2019
|
}
|
|
2020
|
-
|
|
2020
|
+
ae.create = (s, e, t) => new ae({
|
|
2021
2021
|
left: s,
|
|
2022
2022
|
right: e,
|
|
2023
2023
|
typeName: p.ZodIntersection,
|
|
2024
2024
|
...y(t)
|
|
2025
2025
|
});
|
|
2026
|
-
class
|
|
2026
|
+
class M extends v {
|
|
2027
2027
|
_parse(e) {
|
|
2028
2028
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2029
2029
|
if (n.parsedType !== f.array)
|
|
@@ -2049,7 +2049,7 @@ class I extends v {
|
|
|
2049
2049
|
}), t.dirty());
|
|
2050
2050
|
const a = [...n.data].map((i, o) => {
|
|
2051
2051
|
const u = this._def.items[o] || this._def.rest;
|
|
2052
|
-
return u ? u._parse(new
|
|
2052
|
+
return u ? u._parse(new I(n, i, n.path, o)) : null;
|
|
2053
2053
|
}).filter((i) => !!i);
|
|
2054
2054
|
return n.common.async ? Promise.all(a).then((i) => w.mergeArray(t, i)) : w.mergeArray(t, a);
|
|
2055
2055
|
}
|
|
@@ -2057,23 +2057,23 @@ class I extends v {
|
|
|
2057
2057
|
return this._def.items;
|
|
2058
2058
|
}
|
|
2059
2059
|
rest(e) {
|
|
2060
|
-
return new
|
|
2060
|
+
return new M({
|
|
2061
2061
|
...this._def,
|
|
2062
2062
|
rest: e
|
|
2063
2063
|
});
|
|
2064
2064
|
}
|
|
2065
2065
|
}
|
|
2066
|
-
|
|
2066
|
+
M.create = (s, e) => {
|
|
2067
2067
|
if (!Array.isArray(s))
|
|
2068
2068
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2069
|
-
return new
|
|
2069
|
+
return new M({
|
|
2070
2070
|
items: s,
|
|
2071
2071
|
typeName: p.ZodTuple,
|
|
2072
2072
|
rest: null,
|
|
2073
2073
|
...y(e)
|
|
2074
2074
|
});
|
|
2075
2075
|
};
|
|
2076
|
-
class
|
|
2076
|
+
class ie extends v {
|
|
2077
2077
|
get keySchema() {
|
|
2078
2078
|
return this._def.keyType;
|
|
2079
2079
|
}
|
|
@@ -2091,8 +2091,8 @@ class ae extends v {
|
|
|
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 I(n, o, n.path, o)),
|
|
2095
|
+
value: i._parse(new I(n, n.data[o], n.path, o)),
|
|
2096
2096
|
alwaysSet: o in n.data
|
|
2097
2097
|
});
|
|
2098
2098
|
return n.common.async ? w.mergeObjectAsync(t, r) : w.mergeObjectSync(t, r);
|
|
@@ -2101,12 +2101,12 @@ class ae extends v {
|
|
|
2101
2101
|
return this._def.valueType;
|
|
2102
2102
|
}
|
|
2103
2103
|
static create(e, t, n) {
|
|
2104
|
-
return t instanceof v ? new
|
|
2104
|
+
return t instanceof v ? new ie({
|
|
2105
2105
|
keyType: e,
|
|
2106
2106
|
valueType: t,
|
|
2107
2107
|
typeName: p.ZodRecord,
|
|
2108
2108
|
...y(n)
|
|
2109
|
-
}) : new
|
|
2109
|
+
}) : new ie({
|
|
2110
2110
|
keyType: C.create(),
|
|
2111
2111
|
valueType: e,
|
|
2112
2112
|
typeName: p.ZodRecord,
|
|
@@ -2114,7 +2114,7 @@ class ae extends v {
|
|
|
2114
2114
|
});
|
|
2115
2115
|
}
|
|
2116
2116
|
}
|
|
2117
|
-
class
|
|
2117
|
+
class xe extends v {
|
|
2118
2118
|
get keySchema() {
|
|
2119
2119
|
return this._def.keyType;
|
|
2120
2120
|
}
|
|
@@ -2130,8 +2130,8 @@ class _e extends v {
|
|
|
2130
2130
|
received: n.parsedType
|
|
2131
2131
|
}), m;
|
|
2132
2132
|
const r = this._def.keyType, a = this._def.valueType, i = [...n.data.entries()].map(([o, u], d) => ({
|
|
2133
|
-
key: r._parse(new
|
|
2134
|
-
value: a._parse(new
|
|
2133
|
+
key: r._parse(new I(n, o, n.path, [d, "key"])),
|
|
2134
|
+
value: a._parse(new I(n, u, n.path, [d, "value"]))
|
|
2135
2135
|
}));
|
|
2136
2136
|
if (n.common.async) {
|
|
2137
2137
|
const o = /* @__PURE__ */ new Map();
|
|
@@ -2156,7 +2156,7 @@ class _e extends v {
|
|
|
2156
2156
|
}
|
|
2157
2157
|
}
|
|
2158
2158
|
}
|
|
2159
|
-
|
|
2159
|
+
xe.create = (s, e, t) => new xe({
|
|
2160
2160
|
valueType: e,
|
|
2161
2161
|
keyType: s,
|
|
2162
2162
|
typeName: p.ZodMap,
|
|
@@ -2197,7 +2197,7 @@ class z extends v {
|
|
|
2197
2197
|
}
|
|
2198
2198
|
return { status: t.value, value: d };
|
|
2199
2199
|
}
|
|
2200
|
-
const o = [...n.data.values()].map((u, d) => a._parse(new
|
|
2200
|
+
const o = [...n.data.values()].map((u, d) => a._parse(new I(n, u, n.path, d)));
|
|
2201
2201
|
return n.common.async ? Promise.all(o).then((u) => i(u)) : i(o);
|
|
2202
2202
|
}
|
|
2203
2203
|
min(e, t) {
|
|
@@ -2226,7 +2226,7 @@ z.create = (s, e) => new z({
|
|
|
2226
2226
|
typeName: p.ZodSet,
|
|
2227
2227
|
...y(e)
|
|
2228
2228
|
});
|
|
2229
|
-
class
|
|
2229
|
+
class W extends v {
|
|
2230
2230
|
constructor() {
|
|
2231
2231
|
super(...arguments), this.validate = this.implement;
|
|
2232
2232
|
}
|
|
@@ -2239,13 +2239,13 @@ class G extends v {
|
|
|
2239
2239
|
received: t.parsedType
|
|
2240
2240
|
}), m;
|
|
2241
2241
|
function n(o, u) {
|
|
2242
|
-
return
|
|
2242
|
+
return ge({
|
|
2243
2243
|
data: o,
|
|
2244
2244
|
path: t.path,
|
|
2245
2245
|
errorMaps: [
|
|
2246
2246
|
t.common.contextualErrorMap,
|
|
2247
2247
|
t.schemaErrorMap,
|
|
2248
|
-
|
|
2248
|
+
me(),
|
|
2249
2249
|
Q
|
|
2250
2250
|
].filter((d) => !!d),
|
|
2251
2251
|
issueData: {
|
|
@@ -2255,13 +2255,13 @@ class G extends v {
|
|
|
2255
2255
|
});
|
|
2256
2256
|
}
|
|
2257
2257
|
function r(o, u) {
|
|
2258
|
-
return
|
|
2258
|
+
return ge({
|
|
2259
2259
|
data: o,
|
|
2260
2260
|
path: t.path,
|
|
2261
2261
|
errorMaps: [
|
|
2262
2262
|
t.common.contextualErrorMap,
|
|
2263
2263
|
t.schemaErrorMap,
|
|
2264
|
-
|
|
2264
|
+
me(),
|
|
2265
2265
|
Q
|
|
2266
2266
|
].filter((d) => !!d),
|
|
2267
2267
|
issueData: {
|
|
@@ -2301,13 +2301,13 @@ class G extends v {
|
|
|
2301
2301
|
return this._def.returns;
|
|
2302
2302
|
}
|
|
2303
2303
|
args(...e) {
|
|
2304
|
-
return new
|
|
2304
|
+
return new W({
|
|
2305
2305
|
...this._def,
|
|
2306
|
-
args:
|
|
2306
|
+
args: M.create(e).rest(L.create())
|
|
2307
2307
|
});
|
|
2308
2308
|
}
|
|
2309
2309
|
returns(e) {
|
|
2310
|
-
return new
|
|
2310
|
+
return new W({
|
|
2311
2311
|
...this._def,
|
|
2312
2312
|
returns: e
|
|
2313
2313
|
});
|
|
@@ -2319,15 +2319,15 @@ class G extends v {
|
|
|
2319
2319
|
return this.parse(e);
|
|
2320
2320
|
}
|
|
2321
2321
|
static create(e, t, n) {
|
|
2322
|
-
return new
|
|
2323
|
-
args: e ||
|
|
2324
|
-
returns: t ||
|
|
2322
|
+
return new W({
|
|
2323
|
+
args: e || M.create([]).rest(L.create()),
|
|
2324
|
+
returns: t || L.create(),
|
|
2325
2325
|
typeName: p.ZodFunction,
|
|
2326
2326
|
...y(n)
|
|
2327
2327
|
});
|
|
2328
2328
|
}
|
|
2329
2329
|
}
|
|
2330
|
-
class
|
|
2330
|
+
class oe extends v {
|
|
2331
2331
|
get schema() {
|
|
2332
2332
|
return this._def.getter();
|
|
2333
2333
|
}
|
|
@@ -2336,12 +2336,12 @@ class ie extends v {
|
|
|
2336
2336
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
2337
2337
|
}
|
|
2338
2338
|
}
|
|
2339
|
-
|
|
2339
|
+
oe.create = (s, e) => new oe({
|
|
2340
2340
|
getter: s,
|
|
2341
2341
|
typeName: p.ZodLazy,
|
|
2342
2342
|
...y(e)
|
|
2343
2343
|
});
|
|
2344
|
-
class
|
|
2344
|
+
class ce extends v {
|
|
2345
2345
|
_parse(e) {
|
|
2346
2346
|
if (e.data !== this._def.value) {
|
|
2347
2347
|
const t = this._getOrReturnCtx(e);
|
|
@@ -2357,32 +2357,32 @@ class oe extends v {
|
|
|
2357
2357
|
return this._def.value;
|
|
2358
2358
|
}
|
|
2359
2359
|
}
|
|
2360
|
-
|
|
2360
|
+
ce.create = (s, e) => new ce({
|
|
2361
2361
|
value: s,
|
|
2362
2362
|
typeName: p.ZodLiteral,
|
|
2363
2363
|
...y(e)
|
|
2364
2364
|
});
|
|
2365
|
-
function
|
|
2366
|
-
return new
|
|
2365
|
+
function Le(s, e) {
|
|
2366
|
+
return new q({
|
|
2367
2367
|
values: s,
|
|
2368
2368
|
typeName: p.ZodEnum,
|
|
2369
2369
|
...y(e)
|
|
2370
2370
|
});
|
|
2371
2371
|
}
|
|
2372
|
-
class
|
|
2372
|
+
class q extends v {
|
|
2373
2373
|
constructor() {
|
|
2374
|
-
super(...arguments),
|
|
2374
|
+
super(...arguments), X.set(this, void 0);
|
|
2375
2375
|
}
|
|
2376
2376
|
_parse(e) {
|
|
2377
2377
|
if (typeof e.data != "string") {
|
|
2378
2378
|
const t = this._getOrReturnCtx(e), n = this._def.values;
|
|
2379
2379
|
return l(t, {
|
|
2380
|
-
expected:
|
|
2380
|
+
expected: x.joinValues(n),
|
|
2381
2381
|
received: t.parsedType,
|
|
2382
2382
|
code: c.invalid_type
|
|
2383
2383
|
}), m;
|
|
2384
2384
|
}
|
|
2385
|
-
if (
|
|
2385
|
+
if (ye(this, X) || $e(this, X, new Set(this._def.values)), !ye(this, X).has(e.data)) {
|
|
2386
2386
|
const t = this._getOrReturnCtx(e), n = this._def.values;
|
|
2387
2387
|
return l(t, {
|
|
2388
2388
|
received: t.data,
|
|
@@ -2414,36 +2414,36 @@ class D extends v {
|
|
|
2414
2414
|
return e;
|
|
2415
2415
|
}
|
|
2416
2416
|
extract(e, t = this._def) {
|
|
2417
|
-
return
|
|
2417
|
+
return q.create(e, {
|
|
2418
2418
|
...this._def,
|
|
2419
2419
|
...t
|
|
2420
2420
|
});
|
|
2421
2421
|
}
|
|
2422
2422
|
exclude(e, t = this._def) {
|
|
2423
|
-
return
|
|
2423
|
+
return q.create(this.options.filter((n) => !e.includes(n)), {
|
|
2424
2424
|
...this._def,
|
|
2425
2425
|
...t
|
|
2426
2426
|
});
|
|
2427
2427
|
}
|
|
2428
2428
|
}
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
class
|
|
2429
|
+
X = /* @__PURE__ */ new WeakMap();
|
|
2430
|
+
q.create = Le;
|
|
2431
|
+
class de extends v {
|
|
2432
2432
|
constructor() {
|
|
2433
|
-
super(...arguments),
|
|
2433
|
+
super(...arguments), K.set(this, void 0);
|
|
2434
2434
|
}
|
|
2435
2435
|
_parse(e) {
|
|
2436
|
-
const t =
|
|
2436
|
+
const t = x.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
|
|
2437
2437
|
if (n.parsedType !== f.string && n.parsedType !== f.number) {
|
|
2438
|
-
const r =
|
|
2438
|
+
const r = x.objectValues(t);
|
|
2439
2439
|
return l(n, {
|
|
2440
|
-
expected:
|
|
2440
|
+
expected: x.joinValues(r),
|
|
2441
2441
|
received: n.parsedType,
|
|
2442
2442
|
code: c.invalid_type
|
|
2443
2443
|
}), m;
|
|
2444
2444
|
}
|
|
2445
|
-
if (
|
|
2446
|
-
const r =
|
|
2445
|
+
if (ye(this, K) || $e(this, K, new Set(x.getValidEnumValues(this._def.values))), !ye(this, K).has(e.data)) {
|
|
2446
|
+
const r = x.objectValues(t);
|
|
2447
2447
|
return l(n, {
|
|
2448
2448
|
received: n.data,
|
|
2449
2449
|
code: c.invalid_enum_value,
|
|
@@ -2456,8 +2456,8 @@ class ce extends v {
|
|
|
2456
2456
|
return this._def.values;
|
|
2457
2457
|
}
|
|
2458
2458
|
}
|
|
2459
|
-
|
|
2460
|
-
|
|
2459
|
+
K = /* @__PURE__ */ new WeakMap();
|
|
2460
|
+
de.create = (s, e) => new de({
|
|
2461
2461
|
values: s,
|
|
2462
2462
|
typeName: p.ZodNativeEnum,
|
|
2463
2463
|
...y(e)
|
|
@@ -2486,7 +2486,7 @@ H.create = (s, e) => new H({
|
|
|
2486
2486
|
typeName: p.ZodPromise,
|
|
2487
2487
|
...y(e)
|
|
2488
2488
|
});
|
|
2489
|
-
class
|
|
2489
|
+
class N extends v {
|
|
2490
2490
|
innerType() {
|
|
2491
2491
|
return this._def.schema;
|
|
2492
2492
|
}
|
|
@@ -2513,7 +2513,7 @@ class R extends v {
|
|
|
2513
2513
|
path: n.path,
|
|
2514
2514
|
parent: n
|
|
2515
2515
|
});
|
|
2516
|
-
return u.status === "aborted" ? m : u.status === "dirty" || t.value === "dirty" ?
|
|
2516
|
+
return u.status === "aborted" ? m : u.status === "dirty" || t.value === "dirty" ? G(u.value) : u;
|
|
2517
2517
|
});
|
|
2518
2518
|
{
|
|
2519
2519
|
if (t.value === "aborted")
|
|
@@ -2523,7 +2523,7 @@ class R extends v {
|
|
|
2523
2523
|
path: n.path,
|
|
2524
2524
|
parent: n
|
|
2525
2525
|
});
|
|
2526
|
-
return o.status === "aborted" ? m : o.status === "dirty" || t.value === "dirty" ?
|
|
2526
|
+
return o.status === "aborted" ? m : o.status === "dirty" || t.value === "dirty" ? G(o.value) : o;
|
|
2527
2527
|
}
|
|
2528
2528
|
}
|
|
2529
2529
|
if (r.type === "refinement") {
|
|
@@ -2552,30 +2552,30 @@ class R extends v {
|
|
|
2552
2552
|
path: n.path,
|
|
2553
2553
|
parent: n
|
|
2554
2554
|
});
|
|
2555
|
-
if (!
|
|
2555
|
+
if (!F(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: t.value, value: o };
|
|
2561
2561
|
} else
|
|
2562
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) =>
|
|
2563
|
-
|
|
2562
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) => F(i) ? Promise.resolve(r.transform(i.value, a)).then((o) => ({ status: t.value, value: o })) : i);
|
|
2563
|
+
x.assertNever(r);
|
|
2564
2564
|
}
|
|
2565
2565
|
}
|
|
2566
|
-
|
|
2566
|
+
N.create = (s, e, t) => new N({
|
|
2567
2567
|
schema: s,
|
|
2568
2568
|
typeName: p.ZodEffects,
|
|
2569
2569
|
effect: e,
|
|
2570
2570
|
...y(t)
|
|
2571
2571
|
});
|
|
2572
|
-
|
|
2572
|
+
N.createWithPreprocess = (s, e, t) => new N({
|
|
2573
2573
|
schema: e,
|
|
2574
2574
|
effect: { type: "preprocess", transform: s },
|
|
2575
2575
|
typeName: p.ZodEffects,
|
|
2576
2576
|
...y(t)
|
|
2577
2577
|
});
|
|
2578
|
-
class
|
|
2578
|
+
class O extends v {
|
|
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 v {
|
|
|
2583
2583
|
return this._def.innerType;
|
|
2584
2584
|
}
|
|
2585
2585
|
}
|
|
2586
|
-
|
|
2586
|
+
O.create = (s, e) => new O({
|
|
2587
2587
|
innerType: s,
|
|
2588
2588
|
typeName: p.ZodOptional,
|
|
2589
2589
|
...y(e)
|
|
2590
2590
|
});
|
|
2591
|
-
class
|
|
2591
|
+
class D extends v {
|
|
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 v {
|
|
|
2596
2596
|
return this._def.innerType;
|
|
2597
2597
|
}
|
|
2598
2598
|
}
|
|
2599
|
-
|
|
2599
|
+
D.create = (s, e) => new D({
|
|
2600
2600
|
innerType: s,
|
|
2601
2601
|
typeName: p.ZodNullable,
|
|
2602
2602
|
...y(e)
|
|
2603
2603
|
});
|
|
2604
|
-
class
|
|
2604
|
+
class ue extends v {
|
|
2605
2605
|
_parse(e) {
|
|
2606
2606
|
const { ctx: t } = this._processInputParams(e);
|
|
2607
2607
|
let n = t.data;
|
|
@@ -2615,13 +2615,13 @@ class de extends v {
|
|
|
2615
2615
|
return this._def.innerType;
|
|
2616
2616
|
}
|
|
2617
2617
|
}
|
|
2618
|
-
|
|
2618
|
+
ue.create = (s, e) => new ue({
|
|
2619
2619
|
innerType: s,
|
|
2620
2620
|
typeName: p.ZodDefault,
|
|
2621
2621
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
2622
2622
|
...y(e)
|
|
2623
2623
|
});
|
|
2624
|
-
class
|
|
2624
|
+
class le extends v {
|
|
2625
2625
|
_parse(e) {
|
|
2626
2626
|
const { ctx: t } = this._processInputParams(e), n = {
|
|
2627
2627
|
...t,
|
|
@@ -2636,7 +2636,7 @@ class ue extends v {
|
|
|
2636
2636
|
...n
|
|
2637
2637
|
}
|
|
2638
2638
|
});
|
|
2639
|
-
return
|
|
2639
|
+
return ee(r) ? r.then((a) => ({
|
|
2640
2640
|
status: "valid",
|
|
2641
2641
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
2642
2642
|
get error() {
|
|
@@ -2658,13 +2658,13 @@ class ue extends v {
|
|
|
2658
2658
|
return this._def.innerType;
|
|
2659
2659
|
}
|
|
2660
2660
|
}
|
|
2661
|
-
|
|
2661
|
+
le.create = (s, e) => new le({
|
|
2662
2662
|
innerType: s,
|
|
2663
2663
|
typeName: p.ZodCatch,
|
|
2664
2664
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2665
2665
|
...y(e)
|
|
2666
2666
|
});
|
|
2667
|
-
class
|
|
2667
|
+
class be extends v {
|
|
2668
2668
|
_parse(e) {
|
|
2669
2669
|
if (this._getType(e) !== f.nan) {
|
|
2670
2670
|
const n = this._getOrReturnCtx(e);
|
|
@@ -2677,12 +2677,12 @@ class xe extends v {
|
|
|
2677
2677
|
return { status: "valid", value: e.data };
|
|
2678
2678
|
}
|
|
2679
2679
|
}
|
|
2680
|
-
|
|
2680
|
+
be.create = (s) => new be({
|
|
2681
2681
|
typeName: p.ZodNaN,
|
|
2682
2682
|
...y(s)
|
|
2683
2683
|
});
|
|
2684
2684
|
const yt = Symbol("zod_brand");
|
|
2685
|
-
class
|
|
2685
|
+
class Ee extends v {
|
|
2686
2686
|
_parse(e) {
|
|
2687
2687
|
const { ctx: t } = this._processInputParams(e), n = t.data;
|
|
2688
2688
|
return this._def.type._parse({
|
|
@@ -2695,7 +2695,7 @@ class Re extends v {
|
|
|
2695
2695
|
return this._def.type;
|
|
2696
2696
|
}
|
|
2697
2697
|
}
|
|
2698
|
-
class
|
|
2698
|
+
class he extends v {
|
|
2699
2699
|
_parse(e) {
|
|
2700
2700
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2701
2701
|
if (n.common.async)
|
|
@@ -2705,7 +2705,7 @@ class fe extends v {
|
|
|
2705
2705
|
path: n.path,
|
|
2706
2706
|
parent: n
|
|
2707
2707
|
});
|
|
2708
|
-
return a.status === "aborted" ? m : a.status === "dirty" ? (t.dirty(),
|
|
2708
|
+
return a.status === "aborted" ? m : a.status === "dirty" ? (t.dirty(), G(a.value)) : this._def.out._parseAsync({
|
|
2709
2709
|
data: a.value,
|
|
2710
2710
|
path: n.path,
|
|
2711
2711
|
parent: n
|
|
@@ -2728,23 +2728,23 @@ class fe extends v {
|
|
|
2728
2728
|
}
|
|
2729
2729
|
}
|
|
2730
2730
|
static create(e, t) {
|
|
2731
|
-
return new
|
|
2731
|
+
return new he({
|
|
2732
2732
|
in: e,
|
|
2733
2733
|
out: t,
|
|
2734
2734
|
typeName: p.ZodPipeline
|
|
2735
2735
|
});
|
|
2736
2736
|
}
|
|
2737
2737
|
}
|
|
2738
|
-
class
|
|
2738
|
+
class fe extends v {
|
|
2739
2739
|
_parse(e) {
|
|
2740
|
-
const t = this._def.innerType._parse(e), n = (r) => (
|
|
2741
|
-
return
|
|
2740
|
+
const t = this._def.innerType._parse(e), n = (r) => (F(r) && (r.value = Object.freeze(r.value)), r);
|
|
2741
|
+
return ee(t) ? t.then((r) => n(r)) : n(t);
|
|
2742
2742
|
}
|
|
2743
2743
|
unwrap() {
|
|
2744
2744
|
return this._def.innerType;
|
|
2745
2745
|
}
|
|
2746
2746
|
}
|
|
2747
|
-
|
|
2747
|
+
fe.create = (s, e) => new fe({
|
|
2748
2748
|
innerType: s,
|
|
2749
2749
|
typeName: p.ZodReadonly,
|
|
2750
2750
|
...y(e)
|
|
@@ -2767,34 +2767,34 @@ var p;
|
|
|
2767
2767
|
})(p || (p = {}));
|
|
2768
2768
|
const _t = (s, e = {
|
|
2769
2769
|
message: `Input not instance of ${s.name}`
|
|
2770
|
-
}) => Ue((t) => t instanceof s, e), ze = C.create, Be = $.create, xt =
|
|
2770
|
+
}) => Ue((t) => t instanceof s, e), ze = C.create, Be = $.create, xt = be.create, bt = V.create, Ge = te.create, kt = U.create, wt = ve.create, Tt = se.create, St = ne.create, Zt = Y.create, Rt = L.create, Ct = A.create, Et = _e.create, Nt = E.create, Ot = b.create, It = b.strictCreate, Mt = re.create, jt = ke.create, At = ae.create, Pt = M.create, $t = ie.create, Vt = xe.create, qt = z.create, Dt = W.create, Lt = oe.create, Ut = ce.create, zt = q.create, Bt = de.create, Gt = H.create, Ae = N.create, Wt = O.create, Qt = D.create, Yt = N.createWithPreprocess, Ht = he.create, Jt = () => ze().optional(), Xt = () => Be().optional(), Kt = () => Ge().optional(), Ft = {
|
|
2771
2771
|
string: (s) => C.create({ ...s, coerce: !0 }),
|
|
2772
2772
|
number: (s) => $.create({ ...s, coerce: !0 }),
|
|
2773
|
-
boolean: (s) =>
|
|
2773
|
+
boolean: (s) => te.create({
|
|
2774
2774
|
...s,
|
|
2775
2775
|
coerce: !0
|
|
2776
2776
|
}),
|
|
2777
2777
|
bigint: (s) => V.create({ ...s, coerce: !0 }),
|
|
2778
2778
|
date: (s) => U.create({ ...s, coerce: !0 })
|
|
2779
2779
|
}, es = m;
|
|
2780
|
-
var
|
|
2780
|
+
var _ = /* @__PURE__ */ Object.freeze({
|
|
2781
2781
|
__proto__: null,
|
|
2782
2782
|
defaultErrorMap: Q,
|
|
2783
2783
|
setErrorMap: et,
|
|
2784
|
-
getErrorMap:
|
|
2785
|
-
makeIssue:
|
|
2784
|
+
getErrorMap: me,
|
|
2785
|
+
makeIssue: ge,
|
|
2786
2786
|
EMPTY_PATH: tt,
|
|
2787
2787
|
addIssueToContext: l,
|
|
2788
2788
|
ParseStatus: w,
|
|
2789
2789
|
INVALID: m,
|
|
2790
|
-
DIRTY:
|
|
2790
|
+
DIRTY: G,
|
|
2791
2791
|
OK: T,
|
|
2792
2792
|
isAborted: Ze,
|
|
2793
|
-
isDirty:
|
|
2794
|
-
isValid:
|
|
2795
|
-
isAsync:
|
|
2793
|
+
isDirty: Re,
|
|
2794
|
+
isValid: F,
|
|
2795
|
+
isAsync: ee,
|
|
2796
2796
|
get util() {
|
|
2797
|
-
return
|
|
2797
|
+
return x;
|
|
2798
2798
|
},
|
|
2799
2799
|
get objectUtil() {
|
|
2800
2800
|
return Se;
|
|
@@ -2802,45 +2802,45 @@ var x = /* @__PURE__ */ Object.freeze({
|
|
|
2802
2802
|
ZodParsedType: f,
|
|
2803
2803
|
getParsedType: P,
|
|
2804
2804
|
ZodType: v,
|
|
2805
|
-
datetimeRegex:
|
|
2805
|
+
datetimeRegex: De,
|
|
2806
2806
|
ZodString: C,
|
|
2807
2807
|
ZodNumber: $,
|
|
2808
2808
|
ZodBigInt: V,
|
|
2809
|
-
ZodBoolean:
|
|
2809
|
+
ZodBoolean: te,
|
|
2810
2810
|
ZodDate: U,
|
|
2811
|
-
ZodSymbol:
|
|
2812
|
-
ZodUndefined:
|
|
2813
|
-
ZodNull:
|
|
2811
|
+
ZodSymbol: ve,
|
|
2812
|
+
ZodUndefined: se,
|
|
2813
|
+
ZodNull: ne,
|
|
2814
2814
|
ZodAny: Y,
|
|
2815
|
-
ZodUnknown:
|
|
2815
|
+
ZodUnknown: L,
|
|
2816
2816
|
ZodNever: A,
|
|
2817
|
-
ZodVoid:
|
|
2817
|
+
ZodVoid: _e,
|
|
2818
2818
|
ZodArray: E,
|
|
2819
2819
|
ZodObject: b,
|
|
2820
|
-
ZodUnion:
|
|
2820
|
+
ZodUnion: re,
|
|
2821
2821
|
ZodDiscriminatedUnion: ke,
|
|
2822
|
-
ZodIntersection:
|
|
2823
|
-
ZodTuple:
|
|
2824
|
-
ZodRecord:
|
|
2825
|
-
ZodMap:
|
|
2822
|
+
ZodIntersection: ae,
|
|
2823
|
+
ZodTuple: M,
|
|
2824
|
+
ZodRecord: ie,
|
|
2825
|
+
ZodMap: xe,
|
|
2826
2826
|
ZodSet: z,
|
|
2827
|
-
ZodFunction:
|
|
2828
|
-
ZodLazy:
|
|
2829
|
-
ZodLiteral:
|
|
2830
|
-
ZodEnum:
|
|
2831
|
-
ZodNativeEnum:
|
|
2827
|
+
ZodFunction: W,
|
|
2828
|
+
ZodLazy: oe,
|
|
2829
|
+
ZodLiteral: ce,
|
|
2830
|
+
ZodEnum: q,
|
|
2831
|
+
ZodNativeEnum: de,
|
|
2832
2832
|
ZodPromise: H,
|
|
2833
|
-
ZodEffects:
|
|
2834
|
-
ZodTransformer:
|
|
2835
|
-
ZodOptional:
|
|
2836
|
-
ZodNullable:
|
|
2837
|
-
ZodDefault:
|
|
2838
|
-
ZodCatch:
|
|
2839
|
-
ZodNaN:
|
|
2833
|
+
ZodEffects: N,
|
|
2834
|
+
ZodTransformer: N,
|
|
2835
|
+
ZodOptional: O,
|
|
2836
|
+
ZodNullable: D,
|
|
2837
|
+
ZodDefault: ue,
|
|
2838
|
+
ZodCatch: le,
|
|
2839
|
+
ZodNaN: be,
|
|
2840
2840
|
BRAND: yt,
|
|
2841
|
-
ZodBranded:
|
|
2842
|
-
ZodPipeline:
|
|
2843
|
-
ZodReadonly:
|
|
2841
|
+
ZodBranded: Ee,
|
|
2842
|
+
ZodPipeline: he,
|
|
2843
|
+
ZodReadonly: fe,
|
|
2844
2844
|
custom: Ue,
|
|
2845
2845
|
Schema: v,
|
|
2846
2846
|
ZodSchema: v,
|
|
@@ -2852,33 +2852,33 @@ var x = /* @__PURE__ */ Object.freeze({
|
|
|
2852
2852
|
any: Zt,
|
|
2853
2853
|
array: Nt,
|
|
2854
2854
|
bigint: bt,
|
|
2855
|
-
boolean:
|
|
2855
|
+
boolean: Ge,
|
|
2856
2856
|
date: kt,
|
|
2857
2857
|
discriminatedUnion: jt,
|
|
2858
2858
|
effect: Ae,
|
|
2859
2859
|
enum: zt,
|
|
2860
|
-
function:
|
|
2860
|
+
function: Dt,
|
|
2861
2861
|
instanceof: _t,
|
|
2862
2862
|
intersection: At,
|
|
2863
|
-
lazy:
|
|
2863
|
+
lazy: Lt,
|
|
2864
2864
|
literal: Ut,
|
|
2865
2865
|
map: Vt,
|
|
2866
2866
|
nan: xt,
|
|
2867
2867
|
nativeEnum: Bt,
|
|
2868
|
-
never:
|
|
2868
|
+
never: Ct,
|
|
2869
2869
|
null: St,
|
|
2870
2870
|
nullable: Qt,
|
|
2871
2871
|
number: Be,
|
|
2872
2872
|
object: Ot,
|
|
2873
2873
|
oboolean: Kt,
|
|
2874
2874
|
onumber: Xt,
|
|
2875
|
-
optional:
|
|
2875
|
+
optional: Wt,
|
|
2876
2876
|
ostring: Jt,
|
|
2877
2877
|
pipeline: Ht,
|
|
2878
2878
|
preprocess: Yt,
|
|
2879
|
-
promise:
|
|
2879
|
+
promise: Gt,
|
|
2880
2880
|
record: $t,
|
|
2881
|
-
set:
|
|
2881
|
+
set: qt,
|
|
2882
2882
|
strictObject: It,
|
|
2883
2883
|
string: ze,
|
|
2884
2884
|
symbol: wt,
|
|
@@ -2886,131 +2886,151 @@ var x = /* @__PURE__ */ Object.freeze({
|
|
|
2886
2886
|
tuple: Pt,
|
|
2887
2887
|
undefined: Tt,
|
|
2888
2888
|
union: Mt,
|
|
2889
|
-
unknown:
|
|
2890
|
-
void:
|
|
2889
|
+
unknown: Rt,
|
|
2890
|
+
void: Et,
|
|
2891
2891
|
NEVER: es,
|
|
2892
2892
|
ZodIssueCode: c,
|
|
2893
2893
|
quotelessJson: Fe,
|
|
2894
2894
|
ZodError: S
|
|
2895
2895
|
});
|
|
2896
|
-
const
|
|
2897
|
-
type:
|
|
2898
|
-
id:
|
|
2899
|
-
}), ts =
|
|
2900
|
-
status:
|
|
2901
|
-
question:
|
|
2902
|
-
answer:
|
|
2903
|
-
}), Ne =
|
|
2904
|
-
status:
|
|
2905
|
-
}), ss =
|
|
2906
|
-
status:
|
|
2907
|
-
message:
|
|
2908
|
-
}),
|
|
2909
|
-
semanticColor:
|
|
2910
|
-
label:
|
|
2911
|
-
description:
|
|
2912
|
-
disabled:
|
|
2913
|
-
required:
|
|
2914
|
-
hidden:
|
|
2915
|
-
}), ns =
|
|
2916
|
-
label:
|
|
2917
|
-
hidden:
|
|
2918
|
-
collapsed:
|
|
2919
|
-
}),
|
|
2920
|
-
action:
|
|
2921
|
-
question:
|
|
2922
|
-
}),
|
|
2923
|
-
question:
|
|
2924
|
-
}),
|
|
2925
|
-
action:
|
|
2926
|
-
question:
|
|
2896
|
+
const R = _.object({
|
|
2897
|
+
type: _.literal("qp-bridge"),
|
|
2898
|
+
id: _.string().optional()
|
|
2899
|
+
}), ts = R.extend({
|
|
2900
|
+
status: _.literal("answerChanged"),
|
|
2901
|
+
question: _.string(),
|
|
2902
|
+
answer: _.unknown()
|
|
2903
|
+
}), Ne = R.extend({
|
|
2904
|
+
status: _.literal("success")
|
|
2905
|
+
}), ss = R.extend({
|
|
2906
|
+
status: _.literal("error"),
|
|
2907
|
+
message: _.string()
|
|
2908
|
+
}), We = _.object({
|
|
2909
|
+
semanticColor: _.string().optional(),
|
|
2910
|
+
label: _.string(),
|
|
2911
|
+
description: _.string(),
|
|
2912
|
+
disabled: _.boolean(),
|
|
2913
|
+
required: _.boolean(),
|
|
2914
|
+
hidden: _.boolean()
|
|
2915
|
+
}), ns = We.partial(), Qe = _.object({
|
|
2916
|
+
label: _.string(),
|
|
2917
|
+
hidden: _.boolean(),
|
|
2918
|
+
collapsed: _.boolean()
|
|
2919
|
+
}), rs = Qe.partial(), as = R.extend({
|
|
2920
|
+
action: _.literal("getQuestion"),
|
|
2921
|
+
question: _.string()
|
|
2922
|
+
}), is = Ne.extend({
|
|
2923
|
+
question: We
|
|
2924
|
+
}), os = R.extend({
|
|
2925
|
+
action: _.literal("setQuestion"),
|
|
2926
|
+
question: _.string(),
|
|
2927
2927
|
questionData: ns
|
|
2928
|
-
}),
|
|
2929
|
-
action:
|
|
2930
|
-
group:
|
|
2931
|
-
}),
|
|
2928
|
+
}), cs = R.extend({
|
|
2929
|
+
action: _.literal("getGroup"),
|
|
2930
|
+
group: _.string()
|
|
2931
|
+
}), ds = Ne.extend({
|
|
2932
2932
|
group: Qe
|
|
2933
|
-
}),
|
|
2934
|
-
action:
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
}),
|
|
2938
|
-
action:
|
|
2939
|
-
|
|
2940
|
-
|
|
2933
|
+
}), us = R.extend({
|
|
2934
|
+
action: _.literal("setGroup"),
|
|
2935
|
+
group: _.string(),
|
|
2936
|
+
groupData: rs
|
|
2937
|
+
}), ls = R.extend({
|
|
2938
|
+
action: _.literal("setAnswer"),
|
|
2939
|
+
question: _.string(),
|
|
2940
|
+
answer: _.unknown()
|
|
2941
|
+
}), fs = R.extend({
|
|
2942
|
+
action: _.literal("busyIndicatorStart")
|
|
2943
|
+
}), hs = R.extend({
|
|
2944
|
+
action: _.literal("busyIndicatorEnd")
|
|
2945
|
+
}), ps = R.extend({
|
|
2946
|
+
action: _.literal("saveQuestionnaire")
|
|
2941
2947
|
});
|
|
2942
|
-
function
|
|
2948
|
+
function ms(s) {
|
|
2943
2949
|
return ts.safeParse(s).success;
|
|
2944
2950
|
}
|
|
2945
|
-
function
|
|
2946
|
-
return
|
|
2951
|
+
function gs(s) {
|
|
2952
|
+
return R.safeParse(s).success;
|
|
2947
2953
|
}
|
|
2948
|
-
function
|
|
2954
|
+
function ys(s) {
|
|
2949
2955
|
return Ne.safeParse(s).success;
|
|
2950
2956
|
}
|
|
2951
|
-
function
|
|
2957
|
+
function vs(s) {
|
|
2952
2958
|
return ss.safeParse(s).success;
|
|
2953
2959
|
}
|
|
2954
|
-
function
|
|
2955
|
-
return rs.safeParse(s).success;
|
|
2956
|
-
}
|
|
2957
|
-
function gs(s) {
|
|
2960
|
+
function Ss(s) {
|
|
2958
2961
|
return as.safeParse(s).success;
|
|
2959
2962
|
}
|
|
2960
|
-
function
|
|
2961
|
-
return ds.safeParse(s).success;
|
|
2962
|
-
}
|
|
2963
|
-
function Ss(s) {
|
|
2963
|
+
function _s(s) {
|
|
2964
2964
|
return is.safeParse(s).success;
|
|
2965
2965
|
}
|
|
2966
2966
|
function Zs(s) {
|
|
2967
|
+
return ls.safeParse(s).success;
|
|
2968
|
+
}
|
|
2969
|
+
function Rs(s) {
|
|
2967
2970
|
return os.safeParse(s).success;
|
|
2968
2971
|
}
|
|
2969
|
-
function
|
|
2972
|
+
function Cs(s) {
|
|
2973
|
+
return us.safeParse(s).success;
|
|
2974
|
+
}
|
|
2975
|
+
function Es(s) {
|
|
2970
2976
|
return cs.safeParse(s).success;
|
|
2971
2977
|
}
|
|
2972
|
-
function
|
|
2973
|
-
return
|
|
2978
|
+
function xs(s) {
|
|
2979
|
+
return ds.safeParse(s).success;
|
|
2974
2980
|
}
|
|
2975
|
-
function
|
|
2976
|
-
return
|
|
2981
|
+
function bs(s) {
|
|
2982
|
+
return fs.safeParse(s).success;
|
|
2977
2983
|
}
|
|
2978
|
-
function
|
|
2979
|
-
return
|
|
2984
|
+
function ks(s) {
|
|
2985
|
+
return hs.safeParse(s).success;
|
|
2986
|
+
}
|
|
2987
|
+
function Ns(s) {
|
|
2988
|
+
return ps.safeParse(s).success;
|
|
2980
2989
|
}
|
|
2981
|
-
|
|
2982
|
-
|
|
2990
|
+
function Os(s) {
|
|
2991
|
+
return bs(s) || ks(s);
|
|
2992
|
+
}
|
|
2993
|
+
async function Is(s, e) {
|
|
2994
|
+
await J({
|
|
2983
2995
|
type: "qp-bridge",
|
|
2984
2996
|
action: "setAnswer",
|
|
2985
2997
|
question: s,
|
|
2986
2998
|
answer: e
|
|
2987
2999
|
});
|
|
2988
3000
|
}
|
|
2989
|
-
async function
|
|
2990
|
-
return await
|
|
3001
|
+
async function Ms(s) {
|
|
3002
|
+
return await ws({
|
|
2991
3003
|
type: "qp-bridge",
|
|
2992
3004
|
action: "getQuestion",
|
|
2993
3005
|
question: s
|
|
2994
3006
|
});
|
|
2995
3007
|
}
|
|
2996
|
-
async function
|
|
2997
|
-
await
|
|
3008
|
+
async function js(s, e) {
|
|
3009
|
+
await J({
|
|
2998
3010
|
type: "qp-bridge",
|
|
2999
3011
|
action: "setQuestion",
|
|
3000
3012
|
question: s,
|
|
3001
3013
|
questionData: e
|
|
3002
3014
|
});
|
|
3003
3015
|
}
|
|
3004
|
-
async function
|
|
3005
|
-
return await
|
|
3016
|
+
async function As(s) {
|
|
3017
|
+
return await Ts({
|
|
3006
3018
|
type: "qp-bridge",
|
|
3007
3019
|
action: "getGroup",
|
|
3008
3020
|
group: s
|
|
3009
3021
|
});
|
|
3010
3022
|
}
|
|
3011
|
-
function
|
|
3023
|
+
async function Ps(s, e) {
|
|
3024
|
+
await J({
|
|
3025
|
+
type: "qp-bridge",
|
|
3026
|
+
action: "setGroup",
|
|
3027
|
+
group: s,
|
|
3028
|
+
groupData: e
|
|
3029
|
+
});
|
|
3030
|
+
}
|
|
3031
|
+
function $s(s) {
|
|
3012
3032
|
const e = (t) => {
|
|
3013
|
-
|
|
3033
|
+
ms(t.data) && s(t.data.question, t.data.answer);
|
|
3014
3034
|
};
|
|
3015
3035
|
return window.addEventListener("message", e), {
|
|
3016
3036
|
cancelSubscription: () => {
|
|
@@ -3018,74 +3038,86 @@ function Is(s) {
|
|
|
3018
3038
|
}
|
|
3019
3039
|
};
|
|
3020
3040
|
}
|
|
3021
|
-
async function
|
|
3022
|
-
await
|
|
3041
|
+
async function Vs(s) {
|
|
3042
|
+
await J({
|
|
3023
3043
|
type: "qp-bridge",
|
|
3024
3044
|
action: "busyIndicatorStart"
|
|
3025
3045
|
});
|
|
3026
3046
|
try {
|
|
3027
3047
|
return await s();
|
|
3028
3048
|
} finally {
|
|
3029
|
-
await
|
|
3049
|
+
await J({
|
|
3030
3050
|
type: "qp-bridge",
|
|
3031
3051
|
action: "busyIndicatorEnd"
|
|
3032
3052
|
});
|
|
3033
3053
|
}
|
|
3034
3054
|
}
|
|
3055
|
+
async function qs() {
|
|
3056
|
+
await J({
|
|
3057
|
+
type: "qp-bridge",
|
|
3058
|
+
action: "saveQuestionnaire"
|
|
3059
|
+
});
|
|
3060
|
+
}
|
|
3035
3061
|
async function Oe(s, e) {
|
|
3036
3062
|
return new Promise((t, n) => {
|
|
3037
3063
|
const r = Ke(), a = (i) => {
|
|
3038
|
-
if (!
|
|
3064
|
+
if (!gs(i.data) || i.data.id !== r)
|
|
3039
3065
|
return;
|
|
3040
3066
|
const u = e(i.data);
|
|
3041
|
-
u.success ? t(u.data) :
|
|
3067
|
+
u.success ? t(u.data) : vs(i.data) ? n(new Error(i.data.message)) : n(new Error("Unknown message received")), window.removeEventListener("message", a);
|
|
3042
3068
|
};
|
|
3043
3069
|
window.addEventListener("message", a), window.parent.postMessage({ ...s, id: r }, "*");
|
|
3044
3070
|
});
|
|
3045
3071
|
}
|
|
3046
|
-
async function
|
|
3047
|
-
return Oe(s, (e) =>
|
|
3072
|
+
async function ws(s) {
|
|
3073
|
+
return Oe(s, (e) => _s(e) ? { success: !0, data: e.question } : { success: !1 });
|
|
3048
3074
|
}
|
|
3049
|
-
async function
|
|
3050
|
-
return Oe(s, (e) =>
|
|
3075
|
+
async function Ts(s) {
|
|
3076
|
+
return Oe(s, (e) => xs(e) ? { success: !0, data: e.group } : { success: !1 });
|
|
3051
3077
|
}
|
|
3052
|
-
function
|
|
3053
|
-
return Oe(s, (e) =>
|
|
3078
|
+
function J(s) {
|
|
3079
|
+
return Oe(s, (e) => ys(e) ? { success: !0, data: void 0 } : { success: !1 });
|
|
3054
3080
|
}
|
|
3055
3081
|
export {
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3082
|
+
hs as busyIndicatorEndRequestMessageSchema,
|
|
3083
|
+
fs as busyIndicatorStartRequestMessageSchema,
|
|
3084
|
+
As as getGroup,
|
|
3085
|
+
cs as getGroupRequestMessageSchema,
|
|
3086
|
+
ds as getGroupSuccessResponseMessageSchema,
|
|
3087
|
+
Ms as getQuestion,
|
|
3088
|
+
as as getQuestionRequestMessageSchema,
|
|
3089
|
+
is as getQuestionSuccessResponseMessageSchema,
|
|
3090
|
+
rs as groupOptionalScheme,
|
|
3065
3091
|
Qe as groupSchema,
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3092
|
+
ks as isBusyIndicatorEndRequestMessage,
|
|
3093
|
+
bs as isBusyIndicatorStartRequestMessage,
|
|
3094
|
+
vs as isErrorMessage,
|
|
3095
|
+
Es as isGetGroupRequestMessage,
|
|
3096
|
+
xs as isGetGroupSuccessResponseMessage,
|
|
3097
|
+
Ss as isGetQuestionRequestMessage,
|
|
3098
|
+
_s as isGetQuestionSuccessResponseMessage,
|
|
3099
|
+
ms as isOnAnswerChangeMessage,
|
|
3100
|
+
gs as isQpBridgeMessage,
|
|
3101
|
+
Ns as isSaveQuestionnaireRequestMessage,
|
|
3102
|
+
Zs as isSetAnswerRequestMessage,
|
|
3103
|
+
Cs as isSetGroupRequestMessage,
|
|
3104
|
+
Rs as isSetQuestionRequestMessage,
|
|
3105
|
+
ys as isSuccessMessage,
|
|
3106
|
+
Os as isWithBusyIndicatorRequestMessage,
|
|
3107
|
+
$s as onAnswerChange,
|
|
3080
3108
|
ts as onAnswerChangeMessageSchema,
|
|
3081
|
-
|
|
3109
|
+
R as qpBridgeMessageSchema,
|
|
3082
3110
|
ns as questionOptionalScheme,
|
|
3083
|
-
|
|
3111
|
+
We as questionSchema,
|
|
3084
3112
|
ss as responseErrorMessageSchema,
|
|
3085
3113
|
Ne as responseSuccessMessageSchema,
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3114
|
+
qs as saveQuestionnaire,
|
|
3115
|
+
ps as saveQuestionnaireRequestMessageSchema,
|
|
3116
|
+
Is as setAnswer,
|
|
3117
|
+
ls as setAnswerRequestMessageSchema,
|
|
3118
|
+
Ps as setGroup,
|
|
3119
|
+
us as setGroupRequestMessageSchema,
|
|
3120
|
+
js as setQuestion,
|
|
3121
|
+
os as setQuestionRequestMessageSchema,
|
|
3122
|
+
Vs as withBusyIndicator
|
|
3091
3123
|
};
|