@resconet/qp-bridge 0.0.1-alpha.12 → 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 +26 -6
- package/index.js +1 -1
- package/index.mjs +265 -251
- package/lib/qp-bridge-types.d.ts +16 -0
- package/lib/qp-bridge.d.ts +22 -11
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -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
|
};
|
|
@@ -327,7 +327,7 @@ class w {
|
|
|
327
327
|
}
|
|
328
328
|
const m = Object.freeze({
|
|
329
329
|
status: "aborted"
|
|
330
|
-
}), G = (s) => ({ status: "dirty", value: s }), T = (s) => ({ status: "valid", value: s }), Ze = (s) => s.status === "aborted", Re = (s) => s.status === "dirty",
|
|
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
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");
|
|
@@ -342,7 +342,7 @@ 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
|
|
345
|
+
var X, K;
|
|
346
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;
|
|
@@ -352,7 +352,7 @@ class I {
|
|
|
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 }
|
|
@@ -491,25 +491,25 @@ class v {
|
|
|
491
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();
|
|
498
498
|
}
|
|
499
499
|
array() {
|
|
500
|
-
return
|
|
500
|
+
return E.create(this, this._def);
|
|
501
501
|
}
|
|
502
502
|
promise() {
|
|
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,
|
|
@@ -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,
|
|
@@ -552,7 +552,7 @@ class v {
|
|
|
552
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,22 +564,22 @@ 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
|
}
|
|
579
579
|
function mt(s, e) {
|
|
580
580
|
return !!((e === "v4" || !e) && ut.test(s) || (e === "v6" || !e) && lt.test(s));
|
|
581
581
|
}
|
|
582
|
-
class
|
|
582
|
+
class C extends v {
|
|
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);
|
|
@@ -696,7 +696,7 @@ class R 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 R 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) {
|
|
@@ -731,7 +731,7 @@ class R extends v {
|
|
|
731
731
|
});
|
|
732
732
|
}
|
|
733
733
|
_addCheck(e) {
|
|
734
|
-
return new
|
|
734
|
+
return new C({
|
|
735
735
|
...this._def,
|
|
736
736
|
checks: [...this._def.checks, e]
|
|
737
737
|
});
|
|
@@ -857,19 +857,19 @@ class R extends v {
|
|
|
857
857
|
return this.min(1, h.errToObj(e));
|
|
858
858
|
}
|
|
859
859
|
trim() {
|
|
860
|
-
return new
|
|
860
|
+
return new C({
|
|
861
861
|
...this._def,
|
|
862
862
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
863
863
|
});
|
|
864
864
|
}
|
|
865
865
|
toLowerCase() {
|
|
866
|
-
return new
|
|
866
|
+
return new C({
|
|
867
867
|
...this._def,
|
|
868
868
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
869
869
|
});
|
|
870
870
|
}
|
|
871
871
|
toUpperCase() {
|
|
872
|
-
return new
|
|
872
|
+
return new C({
|
|
873
873
|
...this._def,
|
|
874
874
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
875
875
|
});
|
|
@@ -929,9 +929,9 @@ class R extends v {
|
|
|
929
929
|
return e;
|
|
930
930
|
}
|
|
931
931
|
}
|
|
932
|
-
|
|
932
|
+
C.create = (s) => {
|
|
933
933
|
var e;
|
|
934
|
-
return new
|
|
934
|
+
return new C({
|
|
935
935
|
checks: [],
|
|
936
936
|
typeName: p.ZodString,
|
|
937
937
|
coerce: (e = s == null ? void 0 : s.coerce) !== null && e !== void 0 ? e : !1,
|
|
@@ -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())
|
|
@@ -1355,7 +1355,7 @@ 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
|
});
|
|
@@ -1444,7 +1444,7 @@ _e.create = (s) => new _e({
|
|
|
1444
1444
|
typeName: p.ZodVoid,
|
|
1445
1445
|
...y(s)
|
|
1446
1446
|
});
|
|
1447
|
-
class
|
|
1447
|
+
class E extends v {
|
|
1448
1448
|
_parse(e) {
|
|
1449
1449
|
const { ctx: t, status: n } = this._processInputParams(e), r = this._def;
|
|
1450
1450
|
if (t.parsedType !== f.array)
|
|
@@ -1488,19 +1488,19 @@ class C extends v {
|
|
|
1488
1488
|
return this._def.type;
|
|
1489
1489
|
}
|
|
1490
1490
|
min(e, t) {
|
|
1491
|
-
return new
|
|
1491
|
+
return new E({
|
|
1492
1492
|
...this._def,
|
|
1493
1493
|
minLength: { value: e, message: h.toString(t) }
|
|
1494
1494
|
});
|
|
1495
1495
|
}
|
|
1496
1496
|
max(e, t) {
|
|
1497
|
-
return new
|
|
1497
|
+
return new E({
|
|
1498
1498
|
...this._def,
|
|
1499
1499
|
maxLength: { value: e, message: h.toString(t) }
|
|
1500
1500
|
});
|
|
1501
1501
|
}
|
|
1502
1502
|
length(e, t) {
|
|
1503
|
-
return new
|
|
1503
|
+
return new E({
|
|
1504
1504
|
...this._def,
|
|
1505
1505
|
exactLength: { value: e, message: h.toString(t) }
|
|
1506
1506
|
});
|
|
@@ -1509,7 +1509,7 @@ class C extends v {
|
|
|
1509
1509
|
return this.min(1, e);
|
|
1510
1510
|
}
|
|
1511
1511
|
}
|
|
1512
|
-
|
|
1512
|
+
E.create = (s, e) => new E({
|
|
1513
1513
|
type: s,
|
|
1514
1514
|
minLength: null,
|
|
1515
1515
|
maxLength: null,
|
|
@@ -1529,10 +1529,10 @@ function B(s) {
|
|
|
1529
1529
|
shape: () => e
|
|
1530
1530
|
});
|
|
1531
1531
|
} else
|
|
1532
|
-
return s instanceof
|
|
1532
|
+
return s instanceof E ? new E({
|
|
1533
1533
|
...s._def,
|
|
1534
1534
|
type: B(s.element)
|
|
1535
|
-
}) : s instanceof O ? O.create(B(s.unwrap())) : 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) {
|
|
@@ -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,7 +1783,7 @@ 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 {
|
|
@@ -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);
|
|
@@ -1963,7 +1963,7 @@ function Ce(s, 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
1968
|
const u = Ce(s[o], e[o]);
|
|
1969
1969
|
if (!u.valid)
|
|
@@ -1985,7 +1985,7 @@ function Ce(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))
|
|
@@ -2017,7 +2017,7 @@ 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,
|
|
@@ -2073,7 +2073,7 @@ M.create = (s, e) => {
|
|
|
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
|
}
|
|
@@ -2101,13 +2101,13 @@ 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
|
|
2110
|
-
keyType:
|
|
2109
|
+
}) : new ie({
|
|
2110
|
+
keyType: C.create(),
|
|
2111
2111
|
valueType: e,
|
|
2112
2112
|
typeName: p.ZodRecord,
|
|
2113
2113
|
...y(t)
|
|
@@ -2303,7 +2303,7 @@ class W extends v {
|
|
|
2303
2303
|
args(...e) {
|
|
2304
2304
|
return new W({
|
|
2305
2305
|
...this._def,
|
|
2306
|
-
args: M.create(e).rest(
|
|
2306
|
+
args: M.create(e).rest(L.create())
|
|
2307
2307
|
});
|
|
2308
2308
|
}
|
|
2309
2309
|
returns(e) {
|
|
@@ -2320,14 +2320,14 @@ class W extends v {
|
|
|
2320
2320
|
}
|
|
2321
2321
|
static create(e, t, n) {
|
|
2322
2322
|
return new W({
|
|
2323
|
-
args: e || M.create([]).rest(
|
|
2324
|
-
returns: t ||
|
|
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 (ye(this,
|
|
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 (ye(this,
|
|
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
|
}
|
|
@@ -2552,24 +2552,24 @@ class E 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,
|
|
@@ -2588,7 +2588,7 @@ O.create = (s, e) => new O({
|
|
|
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,7 +2658,7 @@ 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,
|
|
@@ -2735,16 +2735,16 @@ class he extends v {
|
|
|
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,17 +2767,17 @@ 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 =
|
|
2771
|
-
string: (s) =>
|
|
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
|
+
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,
|
|
@@ -2791,10 +2791,10 @@ var x = /* @__PURE__ */ Object.freeze({
|
|
|
2791
2791
|
OK: T,
|
|
2792
2792
|
isAborted: Ze,
|
|
2793
2793
|
isDirty: Re,
|
|
2794
|
-
isValid:
|
|
2795
|
-
isAsync:
|
|
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:
|
|
2806
|
-
ZodString:
|
|
2805
|
+
datetimeRegex: De,
|
|
2806
|
+
ZodString: C,
|
|
2807
2807
|
ZodNumber: $,
|
|
2808
2808
|
ZodBigInt: V,
|
|
2809
|
-
ZodBoolean:
|
|
2809
|
+
ZodBoolean: te,
|
|
2810
2810
|
ZodDate: U,
|
|
2811
2811
|
ZodSymbol: ve,
|
|
2812
|
-
ZodUndefined:
|
|
2813
|
-
ZodNull:
|
|
2812
|
+
ZodUndefined: se,
|
|
2813
|
+
ZodNull: ne,
|
|
2814
2814
|
ZodAny: Y,
|
|
2815
|
-
ZodUnknown:
|
|
2815
|
+
ZodUnknown: L,
|
|
2816
2816
|
ZodNever: A,
|
|
2817
2817
|
ZodVoid: _e,
|
|
2818
|
-
ZodArray:
|
|
2818
|
+
ZodArray: E,
|
|
2819
2819
|
ZodObject: b,
|
|
2820
|
-
ZodUnion:
|
|
2820
|
+
ZodUnion: re,
|
|
2821
2821
|
ZodDiscriminatedUnion: ke,
|
|
2822
|
-
ZodIntersection:
|
|
2822
|
+
ZodIntersection: ae,
|
|
2823
2823
|
ZodTuple: M,
|
|
2824
|
-
ZodRecord:
|
|
2824
|
+
ZodRecord: ie,
|
|
2825
2825
|
ZodMap: xe,
|
|
2826
2826
|
ZodSet: z,
|
|
2827
2827
|
ZodFunction: W,
|
|
2828
|
-
ZodLazy:
|
|
2829
|
-
ZodLiteral:
|
|
2830
|
-
ZodEnum:
|
|
2831
|
-
ZodNativeEnum:
|
|
2828
|
+
ZodLazy: oe,
|
|
2829
|
+
ZodLiteral: ce,
|
|
2830
|
+
ZodEnum: q,
|
|
2831
|
+
ZodNativeEnum: de,
|
|
2832
2832
|
ZodPromise: H,
|
|
2833
|
-
ZodEffects:
|
|
2834
|
-
ZodTransformer:
|
|
2833
|
+
ZodEffects: N,
|
|
2834
|
+
ZodTransformer: N,
|
|
2835
2835
|
ZodOptional: O,
|
|
2836
|
-
ZodNullable:
|
|
2837
|
-
ZodDefault:
|
|
2838
|
-
ZodCatch:
|
|
2836
|
+
ZodNullable: D,
|
|
2837
|
+
ZodDefault: ue,
|
|
2838
|
+
ZodCatch: le,
|
|
2839
2839
|
ZodNaN: be,
|
|
2840
2840
|
BRAND: yt,
|
|
2841
2841
|
ZodBranded: Ee,
|
|
2842
2842
|
ZodPipeline: he,
|
|
2843
|
-
ZodReadonly:
|
|
2843
|
+
ZodReadonly: fe,
|
|
2844
2844
|
custom: Ue,
|
|
2845
2845
|
Schema: v,
|
|
2846
2846
|
ZodSchema: v,
|
|
@@ -2857,10 +2857,10 @@ var x = /* @__PURE__ */ Object.freeze({
|
|
|
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,
|
|
@@ -2878,7 +2878,7 @@ var x = /* @__PURE__ */ Object.freeze({
|
|
|
2878
2878
|
preprocess: Yt,
|
|
2879
2879
|
promise: Gt,
|
|
2880
2880
|
record: $t,
|
|
2881
|
-
set:
|
|
2881
|
+
set: qt,
|
|
2882
2882
|
strictObject: It,
|
|
2883
2883
|
string: ze,
|
|
2884
2884
|
symbol: wt,
|
|
@@ -2893,139 +2893,144 @@ var x = /* @__PURE__ */ Object.freeze({
|
|
|
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
|
-
}), We =
|
|
2909
|
-
semanticColor:
|
|
2910
|
-
label:
|
|
2911
|
-
description:
|
|
2912
|
-
disabled:
|
|
2913
|
-
required:
|
|
2914
|
-
hidden:
|
|
2915
|
-
}), ns = We.partial(), Qe =
|
|
2916
|
-
label:
|
|
2917
|
-
hidden:
|
|
2918
|
-
collapsed:
|
|
2919
|
-
}), rs = Qe.partial(), as =
|
|
2920
|
-
action:
|
|
2921
|
-
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
2922
|
}), is = Ne.extend({
|
|
2923
2923
|
question: We
|
|
2924
|
-
}), os =
|
|
2925
|
-
action:
|
|
2926
|
-
question:
|
|
2924
|
+
}), os = R.extend({
|
|
2925
|
+
action: _.literal("setQuestion"),
|
|
2926
|
+
question: _.string(),
|
|
2927
2927
|
questionData: ns
|
|
2928
|
-
}), cs =
|
|
2929
|
-
action:
|
|
2930
|
-
group:
|
|
2928
|
+
}), cs = R.extend({
|
|
2929
|
+
action: _.literal("getGroup"),
|
|
2930
|
+
group: _.string()
|
|
2931
2931
|
}), ds = Ne.extend({
|
|
2932
2932
|
group: Qe
|
|
2933
|
-
}), us =
|
|
2934
|
-
action:
|
|
2935
|
-
group:
|
|
2933
|
+
}), us = R.extend({
|
|
2934
|
+
action: _.literal("setGroup"),
|
|
2935
|
+
group: _.string(),
|
|
2936
2936
|
groupData: rs
|
|
2937
|
-
}), ls =
|
|
2938
|
-
action:
|
|
2939
|
-
question:
|
|
2940
|
-
answer:
|
|
2941
|
-
}), fs =
|
|
2942
|
-
action:
|
|
2943
|
-
}), hs =
|
|
2944
|
-
action:
|
|
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")
|
|
2945
2947
|
});
|
|
2946
|
-
function ps(s) {
|
|
2947
|
-
return ts.safeParse(s).success;
|
|
2948
|
-
}
|
|
2949
2948
|
function ms(s) {
|
|
2950
|
-
return
|
|
2949
|
+
return ts.safeParse(s).success;
|
|
2951
2950
|
}
|
|
2952
2951
|
function gs(s) {
|
|
2953
|
-
return
|
|
2952
|
+
return R.safeParse(s).success;
|
|
2954
2953
|
}
|
|
2955
2954
|
function ys(s) {
|
|
2955
|
+
return Ne.safeParse(s).success;
|
|
2956
|
+
}
|
|
2957
|
+
function vs(s) {
|
|
2956
2958
|
return ss.safeParse(s).success;
|
|
2957
2959
|
}
|
|
2958
|
-
function
|
|
2960
|
+
function Ss(s) {
|
|
2959
2961
|
return as.safeParse(s).success;
|
|
2960
2962
|
}
|
|
2961
|
-
function
|
|
2963
|
+
function _s(s) {
|
|
2962
2964
|
return is.safeParse(s).success;
|
|
2963
2965
|
}
|
|
2964
|
-
function
|
|
2966
|
+
function Zs(s) {
|
|
2965
2967
|
return ls.safeParse(s).success;
|
|
2966
2968
|
}
|
|
2967
|
-
function
|
|
2969
|
+
function Rs(s) {
|
|
2968
2970
|
return os.safeParse(s).success;
|
|
2969
2971
|
}
|
|
2970
|
-
function
|
|
2972
|
+
function Cs(s) {
|
|
2971
2973
|
return us.safeParse(s).success;
|
|
2972
2974
|
}
|
|
2973
|
-
function
|
|
2975
|
+
function Es(s) {
|
|
2974
2976
|
return cs.safeParse(s).success;
|
|
2975
2977
|
}
|
|
2976
|
-
function
|
|
2978
|
+
function xs(s) {
|
|
2977
2979
|
return ds.safeParse(s).success;
|
|
2978
2980
|
}
|
|
2979
|
-
function
|
|
2981
|
+
function bs(s) {
|
|
2980
2982
|
return fs.safeParse(s).success;
|
|
2981
2983
|
}
|
|
2982
|
-
function
|
|
2984
|
+
function ks(s) {
|
|
2983
2985
|
return hs.safeParse(s).success;
|
|
2984
2986
|
}
|
|
2985
|
-
function
|
|
2986
|
-
return
|
|
2987
|
+
function Ns(s) {
|
|
2988
|
+
return ps.safeParse(s).success;
|
|
2989
|
+
}
|
|
2990
|
+
function Os(s) {
|
|
2991
|
+
return bs(s) || ks(s);
|
|
2987
2992
|
}
|
|
2988
|
-
async function
|
|
2989
|
-
await
|
|
2993
|
+
async function Is(s, e) {
|
|
2994
|
+
await J({
|
|
2990
2995
|
type: "qp-bridge",
|
|
2991
2996
|
action: "setAnswer",
|
|
2992
2997
|
question: s,
|
|
2993
2998
|
answer: e
|
|
2994
2999
|
});
|
|
2995
3000
|
}
|
|
2996
|
-
async function
|
|
2997
|
-
return await
|
|
3001
|
+
async function Ms(s) {
|
|
3002
|
+
return await ws({
|
|
2998
3003
|
type: "qp-bridge",
|
|
2999
3004
|
action: "getQuestion",
|
|
3000
3005
|
question: s
|
|
3001
3006
|
});
|
|
3002
3007
|
}
|
|
3003
|
-
async function
|
|
3004
|
-
await
|
|
3008
|
+
async function js(s, e) {
|
|
3009
|
+
await J({
|
|
3005
3010
|
type: "qp-bridge",
|
|
3006
3011
|
action: "setQuestion",
|
|
3007
3012
|
question: s,
|
|
3008
3013
|
questionData: e
|
|
3009
3014
|
});
|
|
3010
3015
|
}
|
|
3011
|
-
async function
|
|
3012
|
-
return await
|
|
3016
|
+
async function As(s) {
|
|
3017
|
+
return await Ts({
|
|
3013
3018
|
type: "qp-bridge",
|
|
3014
3019
|
action: "getGroup",
|
|
3015
3020
|
group: s
|
|
3016
3021
|
});
|
|
3017
3022
|
}
|
|
3018
|
-
async function
|
|
3019
|
-
await
|
|
3023
|
+
async function Ps(s, e) {
|
|
3024
|
+
await J({
|
|
3020
3025
|
type: "qp-bridge",
|
|
3021
3026
|
action: "setGroup",
|
|
3022
3027
|
group: s,
|
|
3023
3028
|
groupData: e
|
|
3024
3029
|
});
|
|
3025
3030
|
}
|
|
3026
|
-
function
|
|
3031
|
+
function $s(s) {
|
|
3027
3032
|
const e = (t) => {
|
|
3028
|
-
|
|
3033
|
+
ms(t.data) && s(t.data.question, t.data.answer);
|
|
3029
3034
|
};
|
|
3030
3035
|
return window.addEventListener("message", e), {
|
|
3031
3036
|
cancelSubscription: () => {
|
|
@@ -3033,77 +3038,86 @@ function As(s) {
|
|
|
3033
3038
|
}
|
|
3034
3039
|
};
|
|
3035
3040
|
}
|
|
3036
|
-
async function
|
|
3037
|
-
await
|
|
3041
|
+
async function Vs(s) {
|
|
3042
|
+
await J({
|
|
3038
3043
|
type: "qp-bridge",
|
|
3039
3044
|
action: "busyIndicatorStart"
|
|
3040
3045
|
});
|
|
3041
3046
|
try {
|
|
3042
3047
|
return await s();
|
|
3043
3048
|
} finally {
|
|
3044
|
-
await
|
|
3049
|
+
await J({
|
|
3045
3050
|
type: "qp-bridge",
|
|
3046
3051
|
action: "busyIndicatorEnd"
|
|
3047
3052
|
});
|
|
3048
3053
|
}
|
|
3049
3054
|
}
|
|
3055
|
+
async function qs() {
|
|
3056
|
+
await J({
|
|
3057
|
+
type: "qp-bridge",
|
|
3058
|
+
action: "saveQuestionnaire"
|
|
3059
|
+
});
|
|
3060
|
+
}
|
|
3050
3061
|
async function Oe(s, e) {
|
|
3051
3062
|
return new Promise((t, n) => {
|
|
3052
3063
|
const r = Ke(), a = (i) => {
|
|
3053
|
-
if (!
|
|
3064
|
+
if (!gs(i.data) || i.data.id !== r)
|
|
3054
3065
|
return;
|
|
3055
3066
|
const u = e(i.data);
|
|
3056
|
-
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);
|
|
3057
3068
|
};
|
|
3058
3069
|
window.addEventListener("message", a), window.parent.postMessage({ ...s, id: r }, "*");
|
|
3059
3070
|
});
|
|
3060
3071
|
}
|
|
3061
|
-
async function ks(s) {
|
|
3062
|
-
return Oe(s, (e) => vs(e) ? { success: !0, data: e.question } : { success: !1 });
|
|
3063
|
-
}
|
|
3064
3072
|
async function ws(s) {
|
|
3065
|
-
return Oe(s, (e) => _s(e) ? { success: !0, data: e.
|
|
3073
|
+
return Oe(s, (e) => _s(e) ? { success: !0, data: e.question } : { success: !1 });
|
|
3074
|
+
}
|
|
3075
|
+
async function Ts(s) {
|
|
3076
|
+
return Oe(s, (e) => xs(e) ? { success: !0, data: e.group } : { success: !1 });
|
|
3066
3077
|
}
|
|
3067
|
-
function
|
|
3068
|
-
return Oe(s, (e) =>
|
|
3078
|
+
function J(s) {
|
|
3079
|
+
return Oe(s, (e) => ys(e) ? { success: !0, data: void 0 } : { success: !1 });
|
|
3069
3080
|
}
|
|
3070
3081
|
export {
|
|
3071
3082
|
hs as busyIndicatorEndRequestMessageSchema,
|
|
3072
3083
|
fs as busyIndicatorStartRequestMessageSchema,
|
|
3073
|
-
|
|
3084
|
+
As as getGroup,
|
|
3074
3085
|
cs as getGroupRequestMessageSchema,
|
|
3075
3086
|
ds as getGroupSuccessResponseMessageSchema,
|
|
3076
|
-
|
|
3087
|
+
Ms as getQuestion,
|
|
3077
3088
|
as as getQuestionRequestMessageSchema,
|
|
3078
3089
|
is as getQuestionSuccessResponseMessageSchema,
|
|
3079
3090
|
rs as groupOptionalScheme,
|
|
3080
3091
|
Qe as groupSchema,
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
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,
|
|
3096
3108
|
ts as onAnswerChangeMessageSchema,
|
|
3097
|
-
|
|
3109
|
+
R as qpBridgeMessageSchema,
|
|
3098
3110
|
ns as questionOptionalScheme,
|
|
3099
3111
|
We as questionSchema,
|
|
3100
3112
|
ss as responseErrorMessageSchema,
|
|
3101
3113
|
Ne as responseSuccessMessageSchema,
|
|
3102
|
-
|
|
3114
|
+
qs as saveQuestionnaire,
|
|
3115
|
+
ps as saveQuestionnaireRequestMessageSchema,
|
|
3116
|
+
Is as setAnswer,
|
|
3103
3117
|
ls as setAnswerRequestMessageSchema,
|
|
3104
|
-
|
|
3118
|
+
Ps as setGroup,
|
|
3105
3119
|
us as setGroupRequestMessageSchema,
|
|
3106
|
-
|
|
3120
|
+
js as setQuestion,
|
|
3107
3121
|
os as setQuestionRequestMessageSchema,
|
|
3108
|
-
|
|
3122
|
+
Vs as withBusyIndicator
|
|
3109
3123
|
};
|