@resconet/qp-bridge 1.3.2-alpha.3 → 1.4.0-alpha.5
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 +19 -19
- package/index.js +1 -1
- package/index.mjs +903 -823
- package/lib/qp-bridge-types.d.ts +88 -1
- package/lib/qp-bridge.d.ts +22 -19
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var
|
|
2
|
-
function
|
|
3
|
-
if (
|
|
4
|
-
|
|
5
|
-
var t =
|
|
1
|
+
var pe = { exports: {} }, Ee;
|
|
2
|
+
function Xe() {
|
|
3
|
+
if (Ee) return pe.exports;
|
|
4
|
+
Ee = 1;
|
|
5
|
+
var t = pe.exports = {}, e, s;
|
|
6
6
|
function n() {
|
|
7
7
|
throw new Error("setTimeout has not been defined");
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function a() {
|
|
10
10
|
throw new Error("clearTimeout has not been defined");
|
|
11
11
|
}
|
|
12
12
|
(function() {
|
|
@@ -16,12 +16,12 @@ function Ye() {
|
|
|
16
16
|
e = n;
|
|
17
17
|
}
|
|
18
18
|
try {
|
|
19
|
-
typeof clearTimeout == "function" ? s = clearTimeout : s =
|
|
19
|
+
typeof clearTimeout == "function" ? s = clearTimeout : s = a;
|
|
20
20
|
} catch {
|
|
21
|
-
s =
|
|
21
|
+
s = a;
|
|
22
22
|
}
|
|
23
23
|
})();
|
|
24
|
-
function
|
|
24
|
+
function r(k) {
|
|
25
25
|
if (e === setTimeout)
|
|
26
26
|
return setTimeout(k, 0);
|
|
27
27
|
if ((e === n || !e) && setTimeout)
|
|
@@ -39,7 +39,7 @@ function Ye() {
|
|
|
39
39
|
function i(k) {
|
|
40
40
|
if (s === clearTimeout)
|
|
41
41
|
return clearTimeout(k);
|
|
42
|
-
if ((s ===
|
|
42
|
+
if ((s === a || !s) && clearTimeout)
|
|
43
43
|
return s = clearTimeout, clearTimeout(k);
|
|
44
44
|
try {
|
|
45
45
|
return s(k);
|
|
@@ -52,32 +52,32 @@ function Ye() {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
var o = [], d = !1, l, y = -1;
|
|
55
|
-
function
|
|
55
|
+
function O() {
|
|
56
56
|
!d || !l || (d = !1, l.length ? o = l.concat(o) : y = -1, o.length && M());
|
|
57
57
|
}
|
|
58
58
|
function M() {
|
|
59
59
|
if (!d) {
|
|
60
|
-
var k =
|
|
60
|
+
var k = r(O);
|
|
61
61
|
d = !0;
|
|
62
|
-
for (var
|
|
63
|
-
for (l = o, o = []; ++y <
|
|
62
|
+
for (var E = o.length; E; ) {
|
|
63
|
+
for (l = o, o = []; ++y < E; )
|
|
64
64
|
l && l[y].run();
|
|
65
|
-
y = -1,
|
|
65
|
+
y = -1, E = o.length;
|
|
66
66
|
}
|
|
67
67
|
l = null, d = !1, i(k);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
t.nextTick = function(k) {
|
|
71
|
-
var
|
|
71
|
+
var E = new Array(arguments.length - 1);
|
|
72
72
|
if (arguments.length > 1)
|
|
73
73
|
for (var B = 1; B < arguments.length; B++)
|
|
74
|
-
|
|
75
|
-
o.push(new
|
|
74
|
+
E[B - 1] = arguments[B];
|
|
75
|
+
o.push(new Ie(k, E)), o.length === 1 && !d && r(M);
|
|
76
76
|
};
|
|
77
|
-
function
|
|
78
|
-
this.fun = k, this.array =
|
|
77
|
+
function Ie(k, E) {
|
|
78
|
+
this.fun = k, this.array = E;
|
|
79
79
|
}
|
|
80
|
-
|
|
80
|
+
Ie.prototype.run = function() {
|
|
81
81
|
this.fun.apply(null, this.array);
|
|
82
82
|
}, t.title = "browser", t.browser = !0, t.env = {}, t.argv = [], t.version = "", t.versions = {};
|
|
83
83
|
function Z() {
|
|
@@ -92,78 +92,78 @@ function Ye() {
|
|
|
92
92
|
throw new Error("process.chdir is not supported");
|
|
93
93
|
}, t.umask = function() {
|
|
94
94
|
return 0;
|
|
95
|
-
},
|
|
95
|
+
}, pe.exports;
|
|
96
96
|
}
|
|
97
|
-
var
|
|
97
|
+
var Ke = Xe();
|
|
98
98
|
let re;
|
|
99
|
-
const
|
|
100
|
-
function
|
|
99
|
+
const et = new Uint8Array(16);
|
|
100
|
+
function tt() {
|
|
101
101
|
if (!re && (re = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !re))
|
|
102
102
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
103
|
-
return re(
|
|
103
|
+
return re(et);
|
|
104
104
|
}
|
|
105
105
|
const R = [];
|
|
106
106
|
for (let t = 0; t < 256; ++t)
|
|
107
107
|
R.push((t + 256).toString(16).slice(1));
|
|
108
|
-
function
|
|
108
|
+
function st(t, e = 0) {
|
|
109
109
|
return R[t[e + 0]] + R[t[e + 1]] + R[t[e + 2]] + R[t[e + 3]] + "-" + R[t[e + 4]] + R[t[e + 5]] + "-" + R[t[e + 6]] + R[t[e + 7]] + "-" + R[t[e + 8]] + R[t[e + 9]] + "-" + R[t[e + 10]] + R[t[e + 11]] + R[t[e + 12]] + R[t[e + 13]] + R[t[e + 14]] + R[t[e + 15]];
|
|
110
110
|
}
|
|
111
|
-
const
|
|
112
|
-
randomUUID:
|
|
111
|
+
const nt = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Ae = {
|
|
112
|
+
randomUUID: nt
|
|
113
113
|
};
|
|
114
|
-
function
|
|
115
|
-
if (
|
|
116
|
-
return
|
|
114
|
+
function ze(t, e, s) {
|
|
115
|
+
if (Ae.randomUUID && !t)
|
|
116
|
+
return Ae.randomUUID();
|
|
117
117
|
t = t || {};
|
|
118
|
-
const n = t.random || (t.rng ||
|
|
119
|
-
return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128,
|
|
118
|
+
const n = t.random || (t.rng || tt)();
|
|
119
|
+
return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, st(n);
|
|
120
120
|
}
|
|
121
|
-
var
|
|
121
|
+
var v;
|
|
122
122
|
(function(t) {
|
|
123
|
-
t.assertEqual = (
|
|
123
|
+
t.assertEqual = (a) => {
|
|
124
124
|
};
|
|
125
|
-
function e(
|
|
125
|
+
function e(a) {
|
|
126
126
|
}
|
|
127
127
|
t.assertIs = e;
|
|
128
|
-
function s(
|
|
128
|
+
function s(a) {
|
|
129
129
|
throw new Error();
|
|
130
130
|
}
|
|
131
|
-
t.assertNever = s, t.arrayToEnum = (
|
|
132
|
-
const
|
|
133
|
-
for (const i of
|
|
134
|
-
|
|
135
|
-
return
|
|
136
|
-
}, t.getValidEnumValues = (
|
|
137
|
-
const
|
|
138
|
-
for (const o of
|
|
139
|
-
i[o] =
|
|
131
|
+
t.assertNever = s, t.arrayToEnum = (a) => {
|
|
132
|
+
const r = {};
|
|
133
|
+
for (const i of a)
|
|
134
|
+
r[i] = i;
|
|
135
|
+
return r;
|
|
136
|
+
}, t.getValidEnumValues = (a) => {
|
|
137
|
+
const r = t.objectKeys(a).filter((o) => typeof a[a[o]] != "number"), i = {};
|
|
138
|
+
for (const o of r)
|
|
139
|
+
i[o] = a[o];
|
|
140
140
|
return t.objectValues(i);
|
|
141
|
-
}, t.objectValues = (
|
|
142
|
-
return r
|
|
143
|
-
}), t.objectKeys = typeof Object.keys == "function" ? (
|
|
144
|
-
const
|
|
145
|
-
for (const i in
|
|
146
|
-
Object.prototype.hasOwnProperty.call(
|
|
147
|
-
return
|
|
148
|
-
}, t.find = (
|
|
149
|
-
for (const i of
|
|
150
|
-
if (
|
|
141
|
+
}, t.objectValues = (a) => t.objectKeys(a).map(function(r) {
|
|
142
|
+
return a[r];
|
|
143
|
+
}), t.objectKeys = typeof Object.keys == "function" ? (a) => Object.keys(a) : (a) => {
|
|
144
|
+
const r = [];
|
|
145
|
+
for (const i in a)
|
|
146
|
+
Object.prototype.hasOwnProperty.call(a, i) && r.push(i);
|
|
147
|
+
return r;
|
|
148
|
+
}, t.find = (a, r) => {
|
|
149
|
+
for (const i of a)
|
|
150
|
+
if (r(i))
|
|
151
151
|
return i;
|
|
152
|
-
}, t.isInteger = typeof Number.isInteger == "function" ? (
|
|
153
|
-
function n(
|
|
154
|
-
return
|
|
152
|
+
}, t.isInteger = typeof Number.isInteger == "function" ? (a) => Number.isInteger(a) : (a) => typeof a == "number" && Number.isFinite(a) && Math.floor(a) === a;
|
|
153
|
+
function n(a, r = " | ") {
|
|
154
|
+
return a.map((i) => typeof i == "string" ? `'${i}'` : i).join(r);
|
|
155
155
|
}
|
|
156
|
-
t.joinValues = n, t.jsonStringifyReplacer = (
|
|
157
|
-
})(
|
|
158
|
-
var
|
|
156
|
+
t.joinValues = n, t.jsonStringifyReplacer = (a, r) => typeof r == "bigint" ? r.toString() : r;
|
|
157
|
+
})(v || (v = {}));
|
|
158
|
+
var Ne;
|
|
159
159
|
(function(t) {
|
|
160
160
|
t.mergeShapes = (e, s) => ({
|
|
161
161
|
...e,
|
|
162
162
|
...s
|
|
163
163
|
// second overwrites first
|
|
164
164
|
});
|
|
165
|
-
})(
|
|
166
|
-
const f =
|
|
165
|
+
})(Ne || (Ne = {}));
|
|
166
|
+
const f = v.arrayToEnum([
|
|
167
167
|
"string",
|
|
168
168
|
"nan",
|
|
169
169
|
"number",
|
|
@@ -205,7 +205,7 @@ const f = _.arrayToEnum([
|
|
|
205
205
|
default:
|
|
206
206
|
return f.unknown;
|
|
207
207
|
}
|
|
208
|
-
}, c =
|
|
208
|
+
}, c = v.arrayToEnum([
|
|
209
209
|
"invalid_type",
|
|
210
210
|
"invalid_literal",
|
|
211
211
|
"custom",
|
|
@@ -237,16 +237,16 @@ class q extends Error {
|
|
|
237
237
|
Object.setPrototypeOf ? Object.setPrototypeOf(this, s) : this.__proto__ = s, this.name = "ZodError", this.issues = e;
|
|
238
238
|
}
|
|
239
239
|
format(e) {
|
|
240
|
-
const s = e || function(
|
|
241
|
-
return
|
|
242
|
-
}, n = { _errors: [] },
|
|
243
|
-
for (const i of
|
|
240
|
+
const s = e || function(r) {
|
|
241
|
+
return r.message;
|
|
242
|
+
}, n = { _errors: [] }, a = (r) => {
|
|
243
|
+
for (const i of r.issues)
|
|
244
244
|
if (i.code === "invalid_union")
|
|
245
|
-
i.unionErrors.map(
|
|
245
|
+
i.unionErrors.map(a);
|
|
246
246
|
else if (i.code === "invalid_return_type")
|
|
247
|
-
|
|
247
|
+
a(i.returnTypeError);
|
|
248
248
|
else if (i.code === "invalid_arguments")
|
|
249
|
-
|
|
249
|
+
a(i.argumentsError);
|
|
250
250
|
else if (i.path.length === 0)
|
|
251
251
|
n._errors.push(s(i));
|
|
252
252
|
else {
|
|
@@ -257,7 +257,7 @@ class q extends Error {
|
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
259
|
};
|
|
260
|
-
return
|
|
260
|
+
return a(this), n;
|
|
261
261
|
}
|
|
262
262
|
static assert(e) {
|
|
263
263
|
if (!(e instanceof q))
|
|
@@ -267,19 +267,19 @@ class q extends Error {
|
|
|
267
267
|
return this.message;
|
|
268
268
|
}
|
|
269
269
|
get message() {
|
|
270
|
-
return JSON.stringify(this.issues,
|
|
270
|
+
return JSON.stringify(this.issues, v.jsonStringifyReplacer, 2);
|
|
271
271
|
}
|
|
272
272
|
get isEmpty() {
|
|
273
273
|
return this.issues.length === 0;
|
|
274
274
|
}
|
|
275
275
|
flatten(e = (s) => s.message) {
|
|
276
276
|
const s = {}, n = [];
|
|
277
|
-
for (const
|
|
278
|
-
if (
|
|
279
|
-
const
|
|
280
|
-
s[
|
|
277
|
+
for (const a of this.issues)
|
|
278
|
+
if (a.path.length > 0) {
|
|
279
|
+
const r = a.path[0];
|
|
280
|
+
s[r] = s[r] || [], s[r].push(e(a));
|
|
281
281
|
} else
|
|
282
|
-
n.push(e(
|
|
282
|
+
n.push(e(a));
|
|
283
283
|
return { formErrors: n, fieldErrors: s };
|
|
284
284
|
}
|
|
285
285
|
get formErrors() {
|
|
@@ -287,26 +287,26 @@ class q extends Error {
|
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
289
|
q.create = (t) => new q(t);
|
|
290
|
-
const
|
|
290
|
+
const ge = (t, e) => {
|
|
291
291
|
let s;
|
|
292
292
|
switch (t.code) {
|
|
293
293
|
case c.invalid_type:
|
|
294
294
|
t.received === f.undefined ? s = "Required" : s = `Expected ${t.expected}, received ${t.received}`;
|
|
295
295
|
break;
|
|
296
296
|
case c.invalid_literal:
|
|
297
|
-
s = `Invalid literal value, expected ${JSON.stringify(t.expected,
|
|
297
|
+
s = `Invalid literal value, expected ${JSON.stringify(t.expected, v.jsonStringifyReplacer)}`;
|
|
298
298
|
break;
|
|
299
299
|
case c.unrecognized_keys:
|
|
300
|
-
s = `Unrecognized key(s) in object: ${
|
|
300
|
+
s = `Unrecognized key(s) in object: ${v.joinValues(t.keys, ", ")}`;
|
|
301
301
|
break;
|
|
302
302
|
case c.invalid_union:
|
|
303
303
|
s = "Invalid input";
|
|
304
304
|
break;
|
|
305
305
|
case c.invalid_union_discriminator:
|
|
306
|
-
s = `Invalid discriminator value. Expected ${
|
|
306
|
+
s = `Invalid discriminator value. Expected ${v.joinValues(t.options)}`;
|
|
307
307
|
break;
|
|
308
308
|
case c.invalid_enum_value:
|
|
309
|
-
s = `Invalid enum value. Expected ${
|
|
309
|
+
s = `Invalid enum value. Expected ${v.joinValues(t.options)}, received '${t.received}'`;
|
|
310
310
|
break;
|
|
311
311
|
case c.invalid_arguments:
|
|
312
312
|
s = "Invalid function arguments";
|
|
@@ -318,7 +318,7 @@ const me = (t, e) => {
|
|
|
318
318
|
s = "Invalid date";
|
|
319
319
|
break;
|
|
320
320
|
case c.invalid_string:
|
|
321
|
-
typeof t.validation == "object" ? "includes" in t.validation ? (s = `Invalid input: must include "${t.validation.includes}"`, typeof t.validation.position == "number" && (s = `${s} at one or more positions greater than or equal to ${t.validation.position}`)) : "startsWith" in t.validation ? s = `Invalid input: must start with "${t.validation.startsWith}"` : "endsWith" in t.validation ? s = `Invalid input: must end with "${t.validation.endsWith}"` :
|
|
321
|
+
typeof t.validation == "object" ? "includes" in t.validation ? (s = `Invalid input: must include "${t.validation.includes}"`, typeof t.validation.position == "number" && (s = `${s} at one or more positions greater than or equal to ${t.validation.position}`)) : "startsWith" in t.validation ? s = `Invalid input: must start with "${t.validation.startsWith}"` : "endsWith" in t.validation ? s = `Invalid input: must end with "${t.validation.endsWith}"` : v.assertNever(t.validation) : t.validation !== "regex" ? s = `Invalid ${t.validation}` : s = "Invalid";
|
|
322
322
|
break;
|
|
323
323
|
case c.too_small:
|
|
324
324
|
t.type === "array" ? s = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "more than"} ${t.minimum} element(s)` : t.type === "string" ? s = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "over"} ${t.minimum} character(s)` : t.type === "number" ? s = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${t.minimum}` : t.type === "bigint" ? s = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${t.minimum}` : t.type === "date" ? s = `Date must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(t.minimum))}` : s = "Invalid input";
|
|
@@ -339,37 +339,37 @@ const me = (t, e) => {
|
|
|
339
339
|
s = "Number must be finite";
|
|
340
340
|
break;
|
|
341
341
|
default:
|
|
342
|
-
s = e.defaultError,
|
|
342
|
+
s = e.defaultError, v.assertNever(t);
|
|
343
343
|
}
|
|
344
344
|
return { message: s };
|
|
345
345
|
};
|
|
346
|
-
let
|
|
346
|
+
let at = ge;
|
|
347
347
|
function rt() {
|
|
348
|
-
return
|
|
348
|
+
return at;
|
|
349
349
|
}
|
|
350
|
-
const
|
|
351
|
-
const { data: e, path: s, errorMaps: n, issueData:
|
|
352
|
-
...
|
|
353
|
-
path:
|
|
350
|
+
const it = (t) => {
|
|
351
|
+
const { data: e, path: s, errorMaps: n, issueData: a } = t, r = [...s, ...a.path || []], i = {
|
|
352
|
+
...a,
|
|
353
|
+
path: r
|
|
354
354
|
};
|
|
355
|
-
if (
|
|
355
|
+
if (a.message !== void 0)
|
|
356
356
|
return {
|
|
357
|
-
...
|
|
358
|
-
path:
|
|
359
|
-
message:
|
|
357
|
+
...a,
|
|
358
|
+
path: r,
|
|
359
|
+
message: a.message
|
|
360
360
|
};
|
|
361
361
|
let o = "";
|
|
362
362
|
const d = n.filter((l) => !!l).slice().reverse();
|
|
363
363
|
for (const l of d)
|
|
364
364
|
o = l(i, { data: e, defaultError: o }).message;
|
|
365
365
|
return {
|
|
366
|
-
...
|
|
367
|
-
path:
|
|
366
|
+
...a,
|
|
367
|
+
path: r,
|
|
368
368
|
message: o
|
|
369
369
|
};
|
|
370
370
|
};
|
|
371
371
|
function u(t, e) {
|
|
372
|
-
const s = rt(), n =
|
|
372
|
+
const s = rt(), n = it({
|
|
373
373
|
issueData: e,
|
|
374
374
|
data: t.data,
|
|
375
375
|
path: t.path,
|
|
@@ -380,9 +380,9 @@ function u(t, e) {
|
|
|
380
380
|
// then schema-bound map if available
|
|
381
381
|
s,
|
|
382
382
|
// then global override map
|
|
383
|
-
s ===
|
|
383
|
+
s === ge ? void 0 : ge
|
|
384
384
|
// then global default map
|
|
385
|
-
].filter((
|
|
385
|
+
].filter((a) => !!a)
|
|
386
386
|
});
|
|
387
387
|
t.common.issues.push(n);
|
|
388
388
|
}
|
|
@@ -398,19 +398,19 @@ class T {
|
|
|
398
398
|
}
|
|
399
399
|
static mergeArray(e, s) {
|
|
400
400
|
const n = [];
|
|
401
|
-
for (const
|
|
402
|
-
if (
|
|
401
|
+
for (const a of s) {
|
|
402
|
+
if (a.status === "aborted")
|
|
403
403
|
return m;
|
|
404
|
-
|
|
404
|
+
a.status === "dirty" && e.dirty(), n.push(a.value);
|
|
405
405
|
}
|
|
406
406
|
return { status: e.value, value: n };
|
|
407
407
|
}
|
|
408
408
|
static async mergeObjectAsync(e, s) {
|
|
409
409
|
const n = [];
|
|
410
|
-
for (const
|
|
411
|
-
const
|
|
410
|
+
for (const a of s) {
|
|
411
|
+
const r = await a.key, i = await a.value;
|
|
412
412
|
n.push({
|
|
413
|
-
key:
|
|
413
|
+
key: r,
|
|
414
414
|
value: i
|
|
415
415
|
});
|
|
416
416
|
}
|
|
@@ -418,31 +418,31 @@ class T {
|
|
|
418
418
|
}
|
|
419
419
|
static mergeObjectSync(e, s) {
|
|
420
420
|
const n = {};
|
|
421
|
-
for (const
|
|
422
|
-
const { key:
|
|
423
|
-
if (
|
|
421
|
+
for (const a of s) {
|
|
422
|
+
const { key: r, value: i } = a;
|
|
423
|
+
if (r.status === "aborted" || i.status === "aborted")
|
|
424
424
|
return m;
|
|
425
|
-
|
|
425
|
+
r.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), r.value !== "__proto__" && (typeof i.value < "u" || a.alwaysSet) && (n[r.value] = i.value);
|
|
426
426
|
}
|
|
427
427
|
return { status: e.value, value: n };
|
|
428
428
|
}
|
|
429
429
|
}
|
|
430
430
|
const m = Object.freeze({
|
|
431
431
|
status: "aborted"
|
|
432
|
-
}), Y = (t) => ({ status: "dirty", value: t }),
|
|
432
|
+
}), Y = (t) => ({ status: "dirty", value: t }), I = (t) => ({ status: "valid", value: t }), Oe = (t) => t.status === "aborted", Me = (t) => t.status === "dirty", G = (t) => t.status === "valid", ie = (t) => typeof Promise < "u" && t instanceof Promise;
|
|
433
433
|
var h;
|
|
434
434
|
(function(t) {
|
|
435
435
|
t.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, t.toString = (e) => typeof e == "string" ? e : e?.message;
|
|
436
436
|
})(h || (h = {}));
|
|
437
|
-
class
|
|
438
|
-
constructor(e, s, n,
|
|
439
|
-
this._cachedPath = [], this.parent = e, this.data = s, this._path = n, this._key =
|
|
437
|
+
class N {
|
|
438
|
+
constructor(e, s, n, a) {
|
|
439
|
+
this._cachedPath = [], this.parent = e, this.data = s, this._path = n, this._key = a;
|
|
440
440
|
}
|
|
441
441
|
get path() {
|
|
442
442
|
return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
443
443
|
}
|
|
444
444
|
}
|
|
445
|
-
const
|
|
445
|
+
const Ze = (t, e) => {
|
|
446
446
|
if (G(e))
|
|
447
447
|
return { success: !0, data: e.value };
|
|
448
448
|
if (!t.common.issues.length)
|
|
@@ -460,15 +460,15 @@ const Ie = (t, e) => {
|
|
|
460
460
|
function g(t) {
|
|
461
461
|
if (!t)
|
|
462
462
|
return {};
|
|
463
|
-
const { errorMap: e, invalid_type_error: s, required_error: n, description:
|
|
463
|
+
const { errorMap: e, invalid_type_error: s, required_error: n, description: a } = t;
|
|
464
464
|
if (e && (s || n))
|
|
465
465
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
466
|
-
return e ? { errorMap: e, description:
|
|
466
|
+
return e ? { errorMap: e, description: a } : { errorMap: (i, o) => {
|
|
467
467
|
const { message: d } = t;
|
|
468
468
|
return i.code === "invalid_enum_value" ? { message: d ?? o.defaultError } : typeof o.data > "u" ? { message: d ?? n ?? o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: d ?? s ?? o.defaultError };
|
|
469
|
-
}, description:
|
|
469
|
+
}, description: a };
|
|
470
470
|
}
|
|
471
|
-
class
|
|
471
|
+
class _ {
|
|
472
472
|
get description() {
|
|
473
473
|
return this._def.description;
|
|
474
474
|
}
|
|
@@ -500,7 +500,7 @@ class v {
|
|
|
500
500
|
}
|
|
501
501
|
_parseSync(e) {
|
|
502
502
|
const s = this._parse(e);
|
|
503
|
-
if (
|
|
503
|
+
if (ie(s))
|
|
504
504
|
throw new Error("Synchronous parse encountered promise.");
|
|
505
505
|
return s;
|
|
506
506
|
}
|
|
@@ -526,8 +526,8 @@ class v {
|
|
|
526
526
|
parent: null,
|
|
527
527
|
data: e,
|
|
528
528
|
parsedType: P(e)
|
|
529
|
-
},
|
|
530
|
-
return
|
|
529
|
+
}, a = this._parseSync({ data: e, path: n.path, parent: n });
|
|
530
|
+
return Ze(n, a);
|
|
531
531
|
}
|
|
532
532
|
"~validate"(e) {
|
|
533
533
|
const s = {
|
|
@@ -579,21 +579,21 @@ class v {
|
|
|
579
579
|
parent: null,
|
|
580
580
|
data: e,
|
|
581
581
|
parsedType: P(e)
|
|
582
|
-
},
|
|
583
|
-
return
|
|
582
|
+
}, a = this._parse({ data: e, path: n.path, parent: n }), r = await (ie(a) ? a : Promise.resolve(a));
|
|
583
|
+
return Ze(n, r);
|
|
584
584
|
}
|
|
585
585
|
refine(e, s) {
|
|
586
|
-
const n = (
|
|
587
|
-
return this._refinement((
|
|
588
|
-
const i = e(
|
|
586
|
+
const n = (a) => typeof s == "string" || typeof s > "u" ? { message: s } : typeof s == "function" ? s(a) : s;
|
|
587
|
+
return this._refinement((a, r) => {
|
|
588
|
+
const i = e(a), o = () => r.addIssue({
|
|
589
589
|
code: c.custom,
|
|
590
|
-
...n(
|
|
590
|
+
...n(a)
|
|
591
591
|
});
|
|
592
592
|
return typeof Promise < "u" && i instanceof Promise ? i.then((d) => d ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
|
|
593
593
|
});
|
|
594
594
|
}
|
|
595
595
|
refinement(e, s) {
|
|
596
|
-
return this._refinement((n,
|
|
596
|
+
return this._refinement((n, a) => e(n) ? !0 : (a.addIssue(typeof s == "function" ? s(n, a) : s), !1));
|
|
597
597
|
}
|
|
598
598
|
_refinement(e) {
|
|
599
599
|
return new W({
|
|
@@ -622,16 +622,16 @@ class v {
|
|
|
622
622
|
return this.nullable().optional();
|
|
623
623
|
}
|
|
624
624
|
array() {
|
|
625
|
-
return
|
|
625
|
+
return A.create(this);
|
|
626
626
|
}
|
|
627
627
|
promise() {
|
|
628
|
-
return
|
|
628
|
+
return le.create(this, this._def);
|
|
629
629
|
}
|
|
630
630
|
or(e) {
|
|
631
|
-
return
|
|
631
|
+
return ce.create([this, e], this._def);
|
|
632
632
|
}
|
|
633
633
|
and(e) {
|
|
634
|
-
return
|
|
634
|
+
return ue.create(this, e, this._def);
|
|
635
635
|
}
|
|
636
636
|
transform(e) {
|
|
637
637
|
return new W({
|
|
@@ -643,7 +643,7 @@ class v {
|
|
|
643
643
|
}
|
|
644
644
|
default(e) {
|
|
645
645
|
const s = typeof e == "function" ? e : () => e;
|
|
646
|
-
return new
|
|
646
|
+
return new be({
|
|
647
647
|
...g(this._def),
|
|
648
648
|
innerType: this,
|
|
649
649
|
defaultValue: s,
|
|
@@ -659,7 +659,7 @@ class v {
|
|
|
659
659
|
}
|
|
660
660
|
catch(e) {
|
|
661
661
|
const s = typeof e == "function" ? e : () => e;
|
|
662
|
-
return new
|
|
662
|
+
return new ke({
|
|
663
663
|
...g(this._def),
|
|
664
664
|
innerType: this,
|
|
665
665
|
catchValue: s,
|
|
@@ -674,10 +674,10 @@ class v {
|
|
|
674
674
|
});
|
|
675
675
|
}
|
|
676
676
|
pipe(e) {
|
|
677
|
-
return
|
|
677
|
+
return Re.create(this, e);
|
|
678
678
|
}
|
|
679
679
|
readonly() {
|
|
680
|
-
return
|
|
680
|
+
return we.create(this);
|
|
681
681
|
}
|
|
682
682
|
isOptional() {
|
|
683
683
|
return this.safeParse(void 0).success;
|
|
@@ -686,199 +686,199 @@ class v {
|
|
|
686
686
|
return this.safeParse(null).success;
|
|
687
687
|
}
|
|
688
688
|
}
|
|
689
|
-
const
|
|
690
|
-
let
|
|
691
|
-
const
|
|
692
|
-
function
|
|
689
|
+
const ot = /^c[^\s-]{8,}$/i, ct = /^[0-9a-z]+$/, ut = /^[0-9A-HJKMNP-TV-Z]{26}$/i, dt = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, lt = /^[a-z0-9_-]{21}$/i, ft = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, ht = /^[-+]?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)?)??$/, pt = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, mt = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
690
|
+
let me;
|
|
691
|
+
const gt = /^(?:(?: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])$/, yt = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, _t = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, vt = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, xt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, bt = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Ge = "((\\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])))", kt = new RegExp(`^${Ge}$`);
|
|
692
|
+
function Qe(t) {
|
|
693
693
|
let e = "[0-5]\\d";
|
|
694
694
|
t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`);
|
|
695
695
|
const s = t.precision ? "+" : "?";
|
|
696
696
|
return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${s}`;
|
|
697
697
|
}
|
|
698
|
-
function kt(t) {
|
|
699
|
-
return new RegExp(`^${De(t)}$`);
|
|
700
|
-
}
|
|
701
698
|
function wt(t) {
|
|
702
|
-
|
|
699
|
+
return new RegExp(`^${Qe(t)}$`);
|
|
700
|
+
}
|
|
701
|
+
function St(t) {
|
|
702
|
+
let e = `${Ge}T${Qe(t)}`;
|
|
703
703
|
const s = [];
|
|
704
704
|
return s.push(t.local ? "Z?" : "Z"), t.offset && s.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${s.join("|")})`, new RegExp(`^${e}$`);
|
|
705
705
|
}
|
|
706
|
-
function St(t, e) {
|
|
707
|
-
return !!((e === "v4" || !e) && mt.test(t) || (e === "v6" || !e) && yt.test(t));
|
|
708
|
-
}
|
|
709
706
|
function Rt(t, e) {
|
|
710
|
-
|
|
707
|
+
return !!((e === "v4" || !e) && gt.test(t) || (e === "v6" || !e) && _t.test(t));
|
|
708
|
+
}
|
|
709
|
+
function Tt(t, e) {
|
|
710
|
+
if (!ft.test(t))
|
|
711
711
|
return !1;
|
|
712
712
|
try {
|
|
713
713
|
const [s] = t.split(".");
|
|
714
714
|
if (!s)
|
|
715
715
|
return !1;
|
|
716
|
-
const n = s.replace(/-/g, "+").replace(/_/g, "/").padEnd(s.length + (4 - s.length % 4) % 4, "="),
|
|
717
|
-
return !(typeof
|
|
716
|
+
const n = s.replace(/-/g, "+").replace(/_/g, "/").padEnd(s.length + (4 - s.length % 4) % 4, "="), a = JSON.parse(atob(n));
|
|
717
|
+
return !(typeof a != "object" || a === null || "typ" in a && a?.typ !== "JWT" || !a.alg || e && a.alg !== e);
|
|
718
718
|
} catch {
|
|
719
719
|
return !1;
|
|
720
720
|
}
|
|
721
721
|
}
|
|
722
|
-
function
|
|
723
|
-
return !!((e === "v4" || !e) &&
|
|
722
|
+
function Ct(t, e) {
|
|
723
|
+
return !!((e === "v4" || !e) && yt.test(t) || (e === "v6" || !e) && vt.test(t));
|
|
724
724
|
}
|
|
725
|
-
class j extends
|
|
725
|
+
class j extends _ {
|
|
726
726
|
_parse(e) {
|
|
727
727
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== f.string) {
|
|
728
|
-
const
|
|
729
|
-
return u(
|
|
728
|
+
const r = this._getOrReturnCtx(e);
|
|
729
|
+
return u(r, {
|
|
730
730
|
code: c.invalid_type,
|
|
731
731
|
expected: f.string,
|
|
732
|
-
received:
|
|
732
|
+
received: r.parsedType
|
|
733
733
|
}), m;
|
|
734
734
|
}
|
|
735
735
|
const n = new T();
|
|
736
|
-
let
|
|
737
|
-
for (const
|
|
738
|
-
if (
|
|
739
|
-
e.data.length <
|
|
736
|
+
let a;
|
|
737
|
+
for (const r of this._def.checks)
|
|
738
|
+
if (r.kind === "min")
|
|
739
|
+
e.data.length < r.value && (a = this._getOrReturnCtx(e, a), u(a, {
|
|
740
740
|
code: c.too_small,
|
|
741
|
-
minimum:
|
|
741
|
+
minimum: r.value,
|
|
742
742
|
type: "string",
|
|
743
743
|
inclusive: !0,
|
|
744
744
|
exact: !1,
|
|
745
|
-
message:
|
|
745
|
+
message: r.message
|
|
746
746
|
}), n.dirty());
|
|
747
|
-
else if (
|
|
748
|
-
e.data.length >
|
|
747
|
+
else if (r.kind === "max")
|
|
748
|
+
e.data.length > r.value && (a = this._getOrReturnCtx(e, a), u(a, {
|
|
749
749
|
code: c.too_big,
|
|
750
|
-
maximum:
|
|
750
|
+
maximum: r.value,
|
|
751
751
|
type: "string",
|
|
752
752
|
inclusive: !0,
|
|
753
753
|
exact: !1,
|
|
754
|
-
message:
|
|
754
|
+
message: r.message
|
|
755
755
|
}), n.dirty());
|
|
756
|
-
else if (
|
|
757
|
-
const i = e.data.length >
|
|
758
|
-
(i || o) && (
|
|
756
|
+
else if (r.kind === "length") {
|
|
757
|
+
const i = e.data.length > r.value, o = e.data.length < r.value;
|
|
758
|
+
(i || o) && (a = this._getOrReturnCtx(e, a), i ? u(a, {
|
|
759
759
|
code: c.too_big,
|
|
760
|
-
maximum:
|
|
760
|
+
maximum: r.value,
|
|
761
761
|
type: "string",
|
|
762
762
|
inclusive: !0,
|
|
763
763
|
exact: !0,
|
|
764
|
-
message:
|
|
765
|
-
}) : o && u(
|
|
764
|
+
message: r.message
|
|
765
|
+
}) : o && u(a, {
|
|
766
766
|
code: c.too_small,
|
|
767
|
-
minimum:
|
|
767
|
+
minimum: r.value,
|
|
768
768
|
type: "string",
|
|
769
769
|
inclusive: !0,
|
|
770
770
|
exact: !0,
|
|
771
|
-
message:
|
|
771
|
+
message: r.message
|
|
772
772
|
}), n.dirty());
|
|
773
|
-
} else if (
|
|
774
|
-
|
|
773
|
+
} else if (r.kind === "email")
|
|
774
|
+
pt.test(e.data) || (a = this._getOrReturnCtx(e, a), u(a, {
|
|
775
775
|
validation: "email",
|
|
776
776
|
code: c.invalid_string,
|
|
777
|
-
message:
|
|
777
|
+
message: r.message
|
|
778
778
|
}), n.dirty());
|
|
779
|
-
else if (
|
|
780
|
-
|
|
779
|
+
else if (r.kind === "emoji")
|
|
780
|
+
me || (me = new RegExp(mt, "u")), me.test(e.data) || (a = this._getOrReturnCtx(e, a), u(a, {
|
|
781
781
|
validation: "emoji",
|
|
782
782
|
code: c.invalid_string,
|
|
783
|
-
message:
|
|
783
|
+
message: r.message
|
|
784
784
|
}), n.dirty());
|
|
785
|
-
else if (
|
|
786
|
-
|
|
785
|
+
else if (r.kind === "uuid")
|
|
786
|
+
dt.test(e.data) || (a = this._getOrReturnCtx(e, a), u(a, {
|
|
787
787
|
validation: "uuid",
|
|
788
788
|
code: c.invalid_string,
|
|
789
|
-
message:
|
|
789
|
+
message: r.message
|
|
790
790
|
}), n.dirty());
|
|
791
|
-
else if (
|
|
792
|
-
|
|
791
|
+
else if (r.kind === "nanoid")
|
|
792
|
+
lt.test(e.data) || (a = this._getOrReturnCtx(e, a), u(a, {
|
|
793
793
|
validation: "nanoid",
|
|
794
794
|
code: c.invalid_string,
|
|
795
|
-
message:
|
|
795
|
+
message: r.message
|
|
796
796
|
}), n.dirty());
|
|
797
|
-
else if (
|
|
798
|
-
|
|
797
|
+
else if (r.kind === "cuid")
|
|
798
|
+
ot.test(e.data) || (a = this._getOrReturnCtx(e, a), u(a, {
|
|
799
799
|
validation: "cuid",
|
|
800
800
|
code: c.invalid_string,
|
|
801
|
-
message:
|
|
801
|
+
message: r.message
|
|
802
802
|
}), n.dirty());
|
|
803
|
-
else if (
|
|
804
|
-
|
|
803
|
+
else if (r.kind === "cuid2")
|
|
804
|
+
ct.test(e.data) || (a = this._getOrReturnCtx(e, a), u(a, {
|
|
805
805
|
validation: "cuid2",
|
|
806
806
|
code: c.invalid_string,
|
|
807
|
-
message:
|
|
807
|
+
message: r.message
|
|
808
808
|
}), n.dirty());
|
|
809
|
-
else if (
|
|
810
|
-
|
|
809
|
+
else if (r.kind === "ulid")
|
|
810
|
+
ut.test(e.data) || (a = this._getOrReturnCtx(e, a), u(a, {
|
|
811
811
|
validation: "ulid",
|
|
812
812
|
code: c.invalid_string,
|
|
813
|
-
message:
|
|
813
|
+
message: r.message
|
|
814
814
|
}), n.dirty());
|
|
815
|
-
else if (
|
|
815
|
+
else if (r.kind === "url")
|
|
816
816
|
try {
|
|
817
817
|
new URL(e.data);
|
|
818
818
|
} catch {
|
|
819
|
-
|
|
819
|
+
a = this._getOrReturnCtx(e, a), u(a, {
|
|
820
820
|
validation: "url",
|
|
821
821
|
code: c.invalid_string,
|
|
822
|
-
message:
|
|
822
|
+
message: r.message
|
|
823
823
|
}), n.dirty();
|
|
824
824
|
}
|
|
825
|
-
else
|
|
825
|
+
else r.kind === "regex" ? (r.regex.lastIndex = 0, r.regex.test(e.data) || (a = this._getOrReturnCtx(e, a), u(a, {
|
|
826
826
|
validation: "regex",
|
|
827
827
|
code: c.invalid_string,
|
|
828
|
-
message:
|
|
829
|
-
}), n.dirty())) :
|
|
828
|
+
message: r.message
|
|
829
|
+
}), n.dirty())) : r.kind === "trim" ? e.data = e.data.trim() : r.kind === "includes" ? e.data.includes(r.value, r.position) || (a = this._getOrReturnCtx(e, a), u(a, {
|
|
830
830
|
code: c.invalid_string,
|
|
831
|
-
validation: { includes:
|
|
832
|
-
message:
|
|
833
|
-
}), n.dirty()) :
|
|
831
|
+
validation: { includes: r.value, position: r.position },
|
|
832
|
+
message: r.message
|
|
833
|
+
}), n.dirty()) : r.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : r.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : r.kind === "startsWith" ? e.data.startsWith(r.value) || (a = this._getOrReturnCtx(e, a), u(a, {
|
|
834
834
|
code: c.invalid_string,
|
|
835
|
-
validation: { startsWith:
|
|
836
|
-
message:
|
|
837
|
-
}), n.dirty()) :
|
|
835
|
+
validation: { startsWith: r.value },
|
|
836
|
+
message: r.message
|
|
837
|
+
}), n.dirty()) : r.kind === "endsWith" ? e.data.endsWith(r.value) || (a = this._getOrReturnCtx(e, a), u(a, {
|
|
838
838
|
code: c.invalid_string,
|
|
839
|
-
validation: { endsWith:
|
|
840
|
-
message:
|
|
841
|
-
}), n.dirty()) :
|
|
839
|
+
validation: { endsWith: r.value },
|
|
840
|
+
message: r.message
|
|
841
|
+
}), n.dirty()) : r.kind === "datetime" ? St(r).test(e.data) || (a = this._getOrReturnCtx(e, a), u(a, {
|
|
842
842
|
code: c.invalid_string,
|
|
843
843
|
validation: "datetime",
|
|
844
|
-
message:
|
|
845
|
-
}), n.dirty()) :
|
|
844
|
+
message: r.message
|
|
845
|
+
}), n.dirty()) : r.kind === "date" ? kt.test(e.data) || (a = this._getOrReturnCtx(e, a), u(a, {
|
|
846
846
|
code: c.invalid_string,
|
|
847
847
|
validation: "date",
|
|
848
|
-
message:
|
|
849
|
-
}), n.dirty()) :
|
|
848
|
+
message: r.message
|
|
849
|
+
}), n.dirty()) : r.kind === "time" ? wt(r).test(e.data) || (a = this._getOrReturnCtx(e, a), u(a, {
|
|
850
850
|
code: c.invalid_string,
|
|
851
851
|
validation: "time",
|
|
852
|
-
message:
|
|
853
|
-
}), n.dirty()) :
|
|
852
|
+
message: r.message
|
|
853
|
+
}), n.dirty()) : r.kind === "duration" ? ht.test(e.data) || (a = this._getOrReturnCtx(e, a), u(a, {
|
|
854
854
|
validation: "duration",
|
|
855
855
|
code: c.invalid_string,
|
|
856
|
-
message:
|
|
857
|
-
}), n.dirty()) :
|
|
856
|
+
message: r.message
|
|
857
|
+
}), n.dirty()) : r.kind === "ip" ? Rt(e.data, r.version) || (a = this._getOrReturnCtx(e, a), u(a, {
|
|
858
858
|
validation: "ip",
|
|
859
859
|
code: c.invalid_string,
|
|
860
|
-
message:
|
|
861
|
-
}), n.dirty()) :
|
|
860
|
+
message: r.message
|
|
861
|
+
}), n.dirty()) : r.kind === "jwt" ? Tt(e.data, r.alg) || (a = this._getOrReturnCtx(e, a), u(a, {
|
|
862
862
|
validation: "jwt",
|
|
863
863
|
code: c.invalid_string,
|
|
864
|
-
message:
|
|
865
|
-
}), n.dirty()) :
|
|
864
|
+
message: r.message
|
|
865
|
+
}), n.dirty()) : r.kind === "cidr" ? Ct(e.data, r.version) || (a = this._getOrReturnCtx(e, a), u(a, {
|
|
866
866
|
validation: "cidr",
|
|
867
867
|
code: c.invalid_string,
|
|
868
|
-
message:
|
|
869
|
-
}), n.dirty()) :
|
|
868
|
+
message: r.message
|
|
869
|
+
}), n.dirty()) : r.kind === "base64" ? xt.test(e.data) || (a = this._getOrReturnCtx(e, a), u(a, {
|
|
870
870
|
validation: "base64",
|
|
871
871
|
code: c.invalid_string,
|
|
872
|
-
message:
|
|
873
|
-
}), n.dirty()) :
|
|
872
|
+
message: r.message
|
|
873
|
+
}), n.dirty()) : r.kind === "base64url" ? bt.test(e.data) || (a = this._getOrReturnCtx(e, a), u(a, {
|
|
874
874
|
validation: "base64url",
|
|
875
875
|
code: c.invalid_string,
|
|
876
|
-
message:
|
|
877
|
-
}), n.dirty()) :
|
|
876
|
+
message: r.message
|
|
877
|
+
}), n.dirty()) : v.assertNever(r);
|
|
878
878
|
return { status: n.value, value: e.data };
|
|
879
879
|
}
|
|
880
880
|
_regex(e, s, n) {
|
|
881
|
-
return this.refinement((
|
|
881
|
+
return this.refinement((a) => e.test(a), {
|
|
882
882
|
validation: s,
|
|
883
883
|
code: c.invalid_string,
|
|
884
884
|
...h.errToObj(n)
|
|
@@ -1105,54 +1105,54 @@ j.create = (t) => new j({
|
|
|
1105
1105
|
coerce: t?.coerce ?? !1,
|
|
1106
1106
|
...g(t)
|
|
1107
1107
|
});
|
|
1108
|
-
function
|
|
1109
|
-
const s = (t.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length,
|
|
1110
|
-
return
|
|
1108
|
+
function It(t, e) {
|
|
1109
|
+
const s = (t.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, a = s > n ? s : n, r = Number.parseInt(t.toFixed(a).replace(".", "")), i = Number.parseInt(e.toFixed(a).replace(".", ""));
|
|
1110
|
+
return r % i / 10 ** a;
|
|
1111
1111
|
}
|
|
1112
|
-
class Q extends
|
|
1112
|
+
class Q extends _ {
|
|
1113
1113
|
constructor() {
|
|
1114
1114
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1115
1115
|
}
|
|
1116
1116
|
_parse(e) {
|
|
1117
1117
|
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== f.number) {
|
|
1118
|
-
const
|
|
1119
|
-
return u(
|
|
1118
|
+
const r = this._getOrReturnCtx(e);
|
|
1119
|
+
return u(r, {
|
|
1120
1120
|
code: c.invalid_type,
|
|
1121
1121
|
expected: f.number,
|
|
1122
|
-
received:
|
|
1122
|
+
received: r.parsedType
|
|
1123
1123
|
}), m;
|
|
1124
1124
|
}
|
|
1125
1125
|
let n;
|
|
1126
|
-
const
|
|
1127
|
-
for (const
|
|
1128
|
-
|
|
1126
|
+
const a = new T();
|
|
1127
|
+
for (const r of this._def.checks)
|
|
1128
|
+
r.kind === "int" ? v.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), u(n, {
|
|
1129
1129
|
code: c.invalid_type,
|
|
1130
1130
|
expected: "integer",
|
|
1131
1131
|
received: "float",
|
|
1132
|
-
message:
|
|
1133
|
-
}),
|
|
1132
|
+
message: r.message
|
|
1133
|
+
}), a.dirty()) : r.kind === "min" ? (r.inclusive ? e.data < r.value : e.data <= r.value) && (n = this._getOrReturnCtx(e, n), u(n, {
|
|
1134
1134
|
code: c.too_small,
|
|
1135
|
-
minimum:
|
|
1135
|
+
minimum: r.value,
|
|
1136
1136
|
type: "number",
|
|
1137
|
-
inclusive:
|
|
1137
|
+
inclusive: r.inclusive,
|
|
1138
1138
|
exact: !1,
|
|
1139
|
-
message:
|
|
1140
|
-
}),
|
|
1139
|
+
message: r.message
|
|
1140
|
+
}), a.dirty()) : r.kind === "max" ? (r.inclusive ? e.data > r.value : e.data >= r.value) && (n = this._getOrReturnCtx(e, n), u(n, {
|
|
1141
1141
|
code: c.too_big,
|
|
1142
|
-
maximum:
|
|
1142
|
+
maximum: r.value,
|
|
1143
1143
|
type: "number",
|
|
1144
|
-
inclusive:
|
|
1144
|
+
inclusive: r.inclusive,
|
|
1145
1145
|
exact: !1,
|
|
1146
|
-
message:
|
|
1147
|
-
}),
|
|
1146
|
+
message: r.message
|
|
1147
|
+
}), a.dirty()) : r.kind === "multipleOf" ? It(e.data, r.value) !== 0 && (n = this._getOrReturnCtx(e, n), u(n, {
|
|
1148
1148
|
code: c.not_multiple_of,
|
|
1149
|
-
multipleOf:
|
|
1150
|
-
message:
|
|
1151
|
-
}),
|
|
1149
|
+
multipleOf: r.value,
|
|
1150
|
+
message: r.message
|
|
1151
|
+
}), a.dirty()) : r.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), u(n, {
|
|
1152
1152
|
code: c.not_finite,
|
|
1153
|
-
message:
|
|
1154
|
-
}),
|
|
1155
|
-
return { status:
|
|
1153
|
+
message: r.message
|
|
1154
|
+
}), a.dirty()) : v.assertNever(r);
|
|
1155
|
+
return { status: a.value, value: e.data };
|
|
1156
1156
|
}
|
|
1157
1157
|
gte(e, s) {
|
|
1158
1158
|
return this.setLimit("min", e, !0, h.toString(s));
|
|
@@ -1166,7 +1166,7 @@ class Q extends v {
|
|
|
1166
1166
|
lt(e, s) {
|
|
1167
1167
|
return this.setLimit("max", e, !1, h.toString(s));
|
|
1168
1168
|
}
|
|
1169
|
-
setLimit(e, s, n,
|
|
1169
|
+
setLimit(e, s, n, a) {
|
|
1170
1170
|
return new Q({
|
|
1171
1171
|
...this._def,
|
|
1172
1172
|
checks: [
|
|
@@ -1175,7 +1175,7 @@ class Q extends v {
|
|
|
1175
1175
|
kind: e,
|
|
1176
1176
|
value: s,
|
|
1177
1177
|
inclusive: n,
|
|
1178
|
-
message: h.toString(
|
|
1178
|
+
message: h.toString(a)
|
|
1179
1179
|
}
|
|
1180
1180
|
]
|
|
1181
1181
|
});
|
|
@@ -1263,7 +1263,7 @@ class Q extends v {
|
|
|
1263
1263
|
return e;
|
|
1264
1264
|
}
|
|
1265
1265
|
get isInt() {
|
|
1266
|
-
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" &&
|
|
1266
|
+
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && v.isInteger(e.value));
|
|
1267
1267
|
}
|
|
1268
1268
|
get isFinite() {
|
|
1269
1269
|
let e = null, s = null;
|
|
@@ -1281,7 +1281,7 @@ Q.create = (t) => new Q({
|
|
|
1281
1281
|
coerce: t?.coerce || !1,
|
|
1282
1282
|
...g(t)
|
|
1283
1283
|
});
|
|
1284
|
-
class te extends
|
|
1284
|
+
class te extends _ {
|
|
1285
1285
|
constructor() {
|
|
1286
1286
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1287
1287
|
}
|
|
@@ -1295,26 +1295,26 @@ class te extends v {
|
|
|
1295
1295
|
if (this._getType(e) !== f.bigint)
|
|
1296
1296
|
return this._getInvalidInput(e);
|
|
1297
1297
|
let n;
|
|
1298
|
-
const
|
|
1299
|
-
for (const
|
|
1300
|
-
|
|
1298
|
+
const a = new T();
|
|
1299
|
+
for (const r of this._def.checks)
|
|
1300
|
+
r.kind === "min" ? (r.inclusive ? e.data < r.value : e.data <= r.value) && (n = this._getOrReturnCtx(e, n), u(n, {
|
|
1301
1301
|
code: c.too_small,
|
|
1302
1302
|
type: "bigint",
|
|
1303
|
-
minimum:
|
|
1304
|
-
inclusive:
|
|
1305
|
-
message:
|
|
1306
|
-
}),
|
|
1303
|
+
minimum: r.value,
|
|
1304
|
+
inclusive: r.inclusive,
|
|
1305
|
+
message: r.message
|
|
1306
|
+
}), a.dirty()) : r.kind === "max" ? (r.inclusive ? e.data > r.value : e.data >= r.value) && (n = this._getOrReturnCtx(e, n), u(n, {
|
|
1307
1307
|
code: c.too_big,
|
|
1308
1308
|
type: "bigint",
|
|
1309
|
-
maximum:
|
|
1310
|
-
inclusive:
|
|
1311
|
-
message:
|
|
1312
|
-
}),
|
|
1309
|
+
maximum: r.value,
|
|
1310
|
+
inclusive: r.inclusive,
|
|
1311
|
+
message: r.message
|
|
1312
|
+
}), a.dirty()) : r.kind === "multipleOf" ? e.data % r.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n), u(n, {
|
|
1313
1313
|
code: c.not_multiple_of,
|
|
1314
|
-
multipleOf:
|
|
1315
|
-
message:
|
|
1316
|
-
}),
|
|
1317
|
-
return { status:
|
|
1314
|
+
multipleOf: r.value,
|
|
1315
|
+
message: r.message
|
|
1316
|
+
}), a.dirty()) : v.assertNever(r);
|
|
1317
|
+
return { status: a.value, value: e.data };
|
|
1318
1318
|
}
|
|
1319
1319
|
_getInvalidInput(e) {
|
|
1320
1320
|
const s = this._getOrReturnCtx(e);
|
|
@@ -1336,7 +1336,7 @@ class te extends v {
|
|
|
1336
1336
|
lt(e, s) {
|
|
1337
1337
|
return this.setLimit("max", e, !1, h.toString(s));
|
|
1338
1338
|
}
|
|
1339
|
-
setLimit(e, s, n,
|
|
1339
|
+
setLimit(e, s, n, a) {
|
|
1340
1340
|
return new te({
|
|
1341
1341
|
...this._def,
|
|
1342
1342
|
checks: [
|
|
@@ -1345,7 +1345,7 @@ class te extends v {
|
|
|
1345
1345
|
kind: e,
|
|
1346
1346
|
value: s,
|
|
1347
1347
|
inclusive: n,
|
|
1348
|
-
message: h.toString(
|
|
1348
|
+
message: h.toString(a)
|
|
1349
1349
|
}
|
|
1350
1350
|
]
|
|
1351
1351
|
});
|
|
@@ -1414,7 +1414,7 @@ te.create = (t) => new te({
|
|
|
1414
1414
|
coerce: t?.coerce ?? !1,
|
|
1415
1415
|
...g(t)
|
|
1416
1416
|
});
|
|
1417
|
-
class
|
|
1417
|
+
class ye extends _ {
|
|
1418
1418
|
_parse(e) {
|
|
1419
1419
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== f.boolean) {
|
|
1420
1420
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1424,55 +1424,55 @@ class ge extends v {
|
|
|
1424
1424
|
received: n.parsedType
|
|
1425
1425
|
}), m;
|
|
1426
1426
|
}
|
|
1427
|
-
return
|
|
1427
|
+
return I(e.data);
|
|
1428
1428
|
}
|
|
1429
1429
|
}
|
|
1430
|
-
|
|
1430
|
+
ye.create = (t) => new ye({
|
|
1431
1431
|
typeName: p.ZodBoolean,
|
|
1432
1432
|
coerce: t?.coerce || !1,
|
|
1433
1433
|
...g(t)
|
|
1434
1434
|
});
|
|
1435
|
-
class
|
|
1435
|
+
class oe extends _ {
|
|
1436
1436
|
_parse(e) {
|
|
1437
1437
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== f.date) {
|
|
1438
|
-
const
|
|
1439
|
-
return u(
|
|
1438
|
+
const r = this._getOrReturnCtx(e);
|
|
1439
|
+
return u(r, {
|
|
1440
1440
|
code: c.invalid_type,
|
|
1441
1441
|
expected: f.date,
|
|
1442
|
-
received:
|
|
1442
|
+
received: r.parsedType
|
|
1443
1443
|
}), m;
|
|
1444
1444
|
}
|
|
1445
1445
|
if (Number.isNaN(e.data.getTime())) {
|
|
1446
|
-
const
|
|
1447
|
-
return u(
|
|
1446
|
+
const r = this._getOrReturnCtx(e);
|
|
1447
|
+
return u(r, {
|
|
1448
1448
|
code: c.invalid_date
|
|
1449
1449
|
}), m;
|
|
1450
1450
|
}
|
|
1451
1451
|
const n = new T();
|
|
1452
|
-
let
|
|
1453
|
-
for (const
|
|
1454
|
-
|
|
1452
|
+
let a;
|
|
1453
|
+
for (const r of this._def.checks)
|
|
1454
|
+
r.kind === "min" ? e.data.getTime() < r.value && (a = this._getOrReturnCtx(e, a), u(a, {
|
|
1455
1455
|
code: c.too_small,
|
|
1456
|
-
message:
|
|
1456
|
+
message: r.message,
|
|
1457
1457
|
inclusive: !0,
|
|
1458
1458
|
exact: !1,
|
|
1459
|
-
minimum:
|
|
1459
|
+
minimum: r.value,
|
|
1460
1460
|
type: "date"
|
|
1461
|
-
}), n.dirty()) :
|
|
1461
|
+
}), n.dirty()) : r.kind === "max" ? e.data.getTime() > r.value && (a = this._getOrReturnCtx(e, a), u(a, {
|
|
1462
1462
|
code: c.too_big,
|
|
1463
|
-
message:
|
|
1463
|
+
message: r.message,
|
|
1464
1464
|
inclusive: !0,
|
|
1465
1465
|
exact: !1,
|
|
1466
|
-
maximum:
|
|
1466
|
+
maximum: r.value,
|
|
1467
1467
|
type: "date"
|
|
1468
|
-
}), n.dirty()) :
|
|
1468
|
+
}), n.dirty()) : v.assertNever(r);
|
|
1469
1469
|
return {
|
|
1470
1470
|
status: n.value,
|
|
1471
1471
|
value: new Date(e.data.getTime())
|
|
1472
1472
|
};
|
|
1473
1473
|
}
|
|
1474
1474
|
_addCheck(e) {
|
|
1475
|
-
return new
|
|
1475
|
+
return new oe({
|
|
1476
1476
|
...this._def,
|
|
1477
1477
|
checks: [...this._def.checks, e]
|
|
1478
1478
|
});
|
|
@@ -1504,13 +1504,13 @@ class ie extends v {
|
|
|
1504
1504
|
return e != null ? new Date(e) : null;
|
|
1505
1505
|
}
|
|
1506
1506
|
}
|
|
1507
|
-
|
|
1507
|
+
oe.create = (t) => new oe({
|
|
1508
1508
|
checks: [],
|
|
1509
1509
|
coerce: t?.coerce || !1,
|
|
1510
1510
|
typeName: p.ZodDate,
|
|
1511
1511
|
...g(t)
|
|
1512
1512
|
});
|
|
1513
|
-
class
|
|
1513
|
+
class je extends _ {
|
|
1514
1514
|
_parse(e) {
|
|
1515
1515
|
if (this._getType(e) !== f.symbol) {
|
|
1516
1516
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1520,14 +1520,14 @@ class Me extends v {
|
|
|
1520
1520
|
received: n.parsedType
|
|
1521
1521
|
}), m;
|
|
1522
1522
|
}
|
|
1523
|
-
return
|
|
1523
|
+
return I(e.data);
|
|
1524
1524
|
}
|
|
1525
1525
|
}
|
|
1526
|
-
|
|
1526
|
+
je.create = (t) => new je({
|
|
1527
1527
|
typeName: p.ZodSymbol,
|
|
1528
1528
|
...g(t)
|
|
1529
1529
|
});
|
|
1530
|
-
class
|
|
1530
|
+
class qe extends _ {
|
|
1531
1531
|
_parse(e) {
|
|
1532
1532
|
if (this._getType(e) !== f.undefined) {
|
|
1533
1533
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1537,14 +1537,14 @@ class Ze extends v {
|
|
|
1537
1537
|
received: n.parsedType
|
|
1538
1538
|
}), m;
|
|
1539
1539
|
}
|
|
1540
|
-
return
|
|
1540
|
+
return I(e.data);
|
|
1541
1541
|
}
|
|
1542
1542
|
}
|
|
1543
|
-
|
|
1543
|
+
qe.create = (t) => new qe({
|
|
1544
1544
|
typeName: p.ZodUndefined,
|
|
1545
1545
|
...g(t)
|
|
1546
1546
|
});
|
|
1547
|
-
class
|
|
1547
|
+
class Pe extends _ {
|
|
1548
1548
|
_parse(e) {
|
|
1549
1549
|
if (this._getType(e) !== f.null) {
|
|
1550
1550
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1554,38 +1554,38 @@ class je extends v {
|
|
|
1554
1554
|
received: n.parsedType
|
|
1555
1555
|
}), m;
|
|
1556
1556
|
}
|
|
1557
|
-
return
|
|
1557
|
+
return I(e.data);
|
|
1558
1558
|
}
|
|
1559
1559
|
}
|
|
1560
|
-
|
|
1560
|
+
Pe.create = (t) => new Pe({
|
|
1561
1561
|
typeName: p.ZodNull,
|
|
1562
1562
|
...g(t)
|
|
1563
1563
|
});
|
|
1564
|
-
class
|
|
1564
|
+
class Le extends _ {
|
|
1565
1565
|
constructor() {
|
|
1566
1566
|
super(...arguments), this._any = !0;
|
|
1567
1567
|
}
|
|
1568
1568
|
_parse(e) {
|
|
1569
|
-
return
|
|
1569
|
+
return I(e.data);
|
|
1570
1570
|
}
|
|
1571
1571
|
}
|
|
1572
|
-
|
|
1572
|
+
Le.create = (t) => new Le({
|
|
1573
1573
|
typeName: p.ZodAny,
|
|
1574
1574
|
...g(t)
|
|
1575
1575
|
});
|
|
1576
|
-
class
|
|
1576
|
+
class _e extends _ {
|
|
1577
1577
|
constructor() {
|
|
1578
1578
|
super(...arguments), this._unknown = !0;
|
|
1579
1579
|
}
|
|
1580
1580
|
_parse(e) {
|
|
1581
|
-
return
|
|
1581
|
+
return I(e.data);
|
|
1582
1582
|
}
|
|
1583
1583
|
}
|
|
1584
|
-
|
|
1584
|
+
_e.create = (t) => new _e({
|
|
1585
1585
|
typeName: p.ZodUnknown,
|
|
1586
1586
|
...g(t)
|
|
1587
1587
|
});
|
|
1588
|
-
class $ extends
|
|
1588
|
+
class $ extends _ {
|
|
1589
1589
|
_parse(e) {
|
|
1590
1590
|
const s = this._getOrReturnCtx(e);
|
|
1591
1591
|
return u(s, {
|
|
@@ -1599,7 +1599,7 @@ $.create = (t) => new $({
|
|
|
1599
1599
|
typeName: p.ZodNever,
|
|
1600
1600
|
...g(t)
|
|
1601
1601
|
});
|
|
1602
|
-
class
|
|
1602
|
+
class $e extends _ {
|
|
1603
1603
|
_parse(e) {
|
|
1604
1604
|
if (this._getType(e) !== f.undefined) {
|
|
1605
1605
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1609,70 +1609,70 @@ class Pe extends v {
|
|
|
1609
1609
|
received: n.parsedType
|
|
1610
1610
|
}), m;
|
|
1611
1611
|
}
|
|
1612
|
-
return
|
|
1612
|
+
return I(e.data);
|
|
1613
1613
|
}
|
|
1614
1614
|
}
|
|
1615
|
-
|
|
1615
|
+
$e.create = (t) => new $e({
|
|
1616
1616
|
typeName: p.ZodVoid,
|
|
1617
1617
|
...g(t)
|
|
1618
1618
|
});
|
|
1619
|
-
class
|
|
1619
|
+
class A extends _ {
|
|
1620
1620
|
_parse(e) {
|
|
1621
|
-
const { ctx: s, status: n } = this._processInputParams(e),
|
|
1621
|
+
const { ctx: s, status: n } = this._processInputParams(e), a = this._def;
|
|
1622
1622
|
if (s.parsedType !== f.array)
|
|
1623
1623
|
return u(s, {
|
|
1624
1624
|
code: c.invalid_type,
|
|
1625
1625
|
expected: f.array,
|
|
1626
1626
|
received: s.parsedType
|
|
1627
1627
|
}), m;
|
|
1628
|
-
if (
|
|
1629
|
-
const i = s.data.length >
|
|
1628
|
+
if (a.exactLength !== null) {
|
|
1629
|
+
const i = s.data.length > a.exactLength.value, o = s.data.length < a.exactLength.value;
|
|
1630
1630
|
(i || o) && (u(s, {
|
|
1631
1631
|
code: i ? c.too_big : c.too_small,
|
|
1632
|
-
minimum: o ?
|
|
1633
|
-
maximum: i ?
|
|
1632
|
+
minimum: o ? a.exactLength.value : void 0,
|
|
1633
|
+
maximum: i ? a.exactLength.value : void 0,
|
|
1634
1634
|
type: "array",
|
|
1635
1635
|
inclusive: !0,
|
|
1636
1636
|
exact: !0,
|
|
1637
|
-
message:
|
|
1637
|
+
message: a.exactLength.message
|
|
1638
1638
|
}), n.dirty());
|
|
1639
1639
|
}
|
|
1640
|
-
if (
|
|
1640
|
+
if (a.minLength !== null && s.data.length < a.minLength.value && (u(s, {
|
|
1641
1641
|
code: c.too_small,
|
|
1642
|
-
minimum:
|
|
1642
|
+
minimum: a.minLength.value,
|
|
1643
1643
|
type: "array",
|
|
1644
1644
|
inclusive: !0,
|
|
1645
1645
|
exact: !1,
|
|
1646
|
-
message:
|
|
1647
|
-
}), n.dirty()),
|
|
1646
|
+
message: a.minLength.message
|
|
1647
|
+
}), n.dirty()), a.maxLength !== null && s.data.length > a.maxLength.value && (u(s, {
|
|
1648
1648
|
code: c.too_big,
|
|
1649
|
-
maximum:
|
|
1649
|
+
maximum: a.maxLength.value,
|
|
1650
1650
|
type: "array",
|
|
1651
1651
|
inclusive: !0,
|
|
1652
1652
|
exact: !1,
|
|
1653
|
-
message:
|
|
1653
|
+
message: a.maxLength.message
|
|
1654
1654
|
}), n.dirty()), s.common.async)
|
|
1655
|
-
return Promise.all([...s.data].map((i, o) =>
|
|
1656
|
-
const
|
|
1657
|
-
return T.mergeArray(n,
|
|
1655
|
+
return Promise.all([...s.data].map((i, o) => a.type._parseAsync(new N(s, i, s.path, o)))).then((i) => T.mergeArray(n, i));
|
|
1656
|
+
const r = [...s.data].map((i, o) => a.type._parseSync(new N(s, i, s.path, o)));
|
|
1657
|
+
return T.mergeArray(n, r);
|
|
1658
1658
|
}
|
|
1659
1659
|
get element() {
|
|
1660
1660
|
return this._def.type;
|
|
1661
1661
|
}
|
|
1662
1662
|
min(e, s) {
|
|
1663
|
-
return new
|
|
1663
|
+
return new A({
|
|
1664
1664
|
...this._def,
|
|
1665
1665
|
minLength: { value: e, message: h.toString(s) }
|
|
1666
1666
|
});
|
|
1667
1667
|
}
|
|
1668
1668
|
max(e, s) {
|
|
1669
|
-
return new
|
|
1669
|
+
return new A({
|
|
1670
1670
|
...this._def,
|
|
1671
1671
|
maxLength: { value: e, message: h.toString(s) }
|
|
1672
1672
|
});
|
|
1673
1673
|
}
|
|
1674
1674
|
length(e, s) {
|
|
1675
|
-
return new
|
|
1675
|
+
return new A({
|
|
1676
1676
|
...this._def,
|
|
1677
1677
|
exactLength: { value: e, message: h.toString(s) }
|
|
1678
1678
|
});
|
|
@@ -1681,7 +1681,7 @@ class N extends v {
|
|
|
1681
1681
|
return this.min(1, e);
|
|
1682
1682
|
}
|
|
1683
1683
|
}
|
|
1684
|
-
|
|
1684
|
+
A.create = (t, e) => new A({
|
|
1685
1685
|
type: t,
|
|
1686
1686
|
minLength: null,
|
|
1687
1687
|
maxLength: null,
|
|
@@ -1689,30 +1689,30 @@ N.create = (t, e) => new N({
|
|
|
1689
1689
|
typeName: p.ZodArray,
|
|
1690
1690
|
...g(e)
|
|
1691
1691
|
});
|
|
1692
|
-
function
|
|
1692
|
+
function D(t) {
|
|
1693
1693
|
if (t instanceof w) {
|
|
1694
1694
|
const e = {};
|
|
1695
1695
|
for (const s in t.shape) {
|
|
1696
1696
|
const n = t.shape[s];
|
|
1697
|
-
e[s] = L.create(
|
|
1697
|
+
e[s] = L.create(D(n));
|
|
1698
1698
|
}
|
|
1699
1699
|
return new w({
|
|
1700
1700
|
...t._def,
|
|
1701
1701
|
shape: () => e
|
|
1702
1702
|
});
|
|
1703
|
-
} else return t instanceof
|
|
1703
|
+
} else return t instanceof A ? new A({
|
|
1704
1704
|
...t._def,
|
|
1705
|
-
type:
|
|
1706
|
-
}) : t instanceof L ? L.create(
|
|
1705
|
+
type: D(t.element)
|
|
1706
|
+
}) : t instanceof L ? L.create(D(t.unwrap())) : t instanceof H ? H.create(D(t.unwrap())) : t instanceof V ? V.create(t.items.map((e) => D(e))) : t;
|
|
1707
1707
|
}
|
|
1708
|
-
class w extends
|
|
1708
|
+
class w extends _ {
|
|
1709
1709
|
constructor() {
|
|
1710
1710
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
1711
1711
|
}
|
|
1712
1712
|
_getCached() {
|
|
1713
1713
|
if (this._cached !== null)
|
|
1714
1714
|
return this._cached;
|
|
1715
|
-
const e = this._def.shape(), s =
|
|
1715
|
+
const e = this._def.shape(), s = v.objectKeys(e);
|
|
1716
1716
|
return this._cached = { shape: e, keys: s }, this._cached;
|
|
1717
1717
|
}
|
|
1718
1718
|
_parse(e) {
|
|
@@ -1724,17 +1724,17 @@ class w extends v {
|
|
|
1724
1724
|
received: l.parsedType
|
|
1725
1725
|
}), m;
|
|
1726
1726
|
}
|
|
1727
|
-
const { status: n, ctx:
|
|
1727
|
+
const { status: n, ctx: a } = this._processInputParams(e), { shape: r, keys: i } = this._getCached(), o = [];
|
|
1728
1728
|
if (!(this._def.catchall instanceof $ && this._def.unknownKeys === "strip"))
|
|
1729
|
-
for (const l in
|
|
1729
|
+
for (const l in a.data)
|
|
1730
1730
|
i.includes(l) || o.push(l);
|
|
1731
1731
|
const d = [];
|
|
1732
1732
|
for (const l of i) {
|
|
1733
|
-
const y =
|
|
1733
|
+
const y = r[l], O = a.data[l];
|
|
1734
1734
|
d.push({
|
|
1735
1735
|
key: { status: "valid", value: l },
|
|
1736
|
-
value: y._parse(new
|
|
1737
|
-
alwaysSet: l in
|
|
1736
|
+
value: y._parse(new N(a, O, a.path, l)),
|
|
1737
|
+
alwaysSet: l in a.data
|
|
1738
1738
|
});
|
|
1739
1739
|
}
|
|
1740
1740
|
if (this._def.catchall instanceof $) {
|
|
@@ -1743,10 +1743,10 @@ class w extends v {
|
|
|
1743
1743
|
for (const y of o)
|
|
1744
1744
|
d.push({
|
|
1745
1745
|
key: { status: "valid", value: y },
|
|
1746
|
-
value: { status: "valid", value:
|
|
1746
|
+
value: { status: "valid", value: a.data[y] }
|
|
1747
1747
|
});
|
|
1748
1748
|
else if (l === "strict")
|
|
1749
|
-
o.length > 0 && (u(
|
|
1749
|
+
o.length > 0 && (u(a, {
|
|
1750
1750
|
code: c.unrecognized_keys,
|
|
1751
1751
|
keys: o
|
|
1752
1752
|
}), n.dirty());
|
|
@@ -1754,23 +1754,23 @@ class w extends v {
|
|
|
1754
1754
|
} else {
|
|
1755
1755
|
const l = this._def.catchall;
|
|
1756
1756
|
for (const y of o) {
|
|
1757
|
-
const
|
|
1757
|
+
const O = a.data[y];
|
|
1758
1758
|
d.push({
|
|
1759
1759
|
key: { status: "valid", value: y },
|
|
1760
1760
|
value: l._parse(
|
|
1761
|
-
new
|
|
1761
|
+
new N(a, O, a.path, y)
|
|
1762
1762
|
//, ctx.child(key), value, getParsedType(value)
|
|
1763
1763
|
),
|
|
1764
|
-
alwaysSet: y in
|
|
1764
|
+
alwaysSet: y in a.data
|
|
1765
1765
|
});
|
|
1766
1766
|
}
|
|
1767
1767
|
}
|
|
1768
|
-
return
|
|
1768
|
+
return a.common.async ? Promise.resolve().then(async () => {
|
|
1769
1769
|
const l = [];
|
|
1770
1770
|
for (const y of d) {
|
|
1771
|
-
const
|
|
1771
|
+
const O = await y.key, M = await y.value;
|
|
1772
1772
|
l.push({
|
|
1773
|
-
key:
|
|
1773
|
+
key: O,
|
|
1774
1774
|
value: M,
|
|
1775
1775
|
alwaysSet: y.alwaysSet
|
|
1776
1776
|
});
|
|
@@ -1787,11 +1787,11 @@ class w extends v {
|
|
|
1787
1787
|
unknownKeys: "strict",
|
|
1788
1788
|
...e !== void 0 ? {
|
|
1789
1789
|
errorMap: (s, n) => {
|
|
1790
|
-
const
|
|
1790
|
+
const a = this._def.errorMap?.(s, n).message ?? n.defaultError;
|
|
1791
1791
|
return s.code === "unrecognized_keys" ? {
|
|
1792
|
-
message: h.errToObj(e).message ??
|
|
1792
|
+
message: h.errToObj(e).message ?? a
|
|
1793
1793
|
} : {
|
|
1794
|
-
message:
|
|
1794
|
+
message: a
|
|
1795
1795
|
};
|
|
1796
1796
|
}
|
|
1797
1797
|
} : {}
|
|
@@ -1918,7 +1918,7 @@ class w extends v {
|
|
|
1918
1918
|
}
|
|
1919
1919
|
pick(e) {
|
|
1920
1920
|
const s = {};
|
|
1921
|
-
for (const n of
|
|
1921
|
+
for (const n of v.objectKeys(e))
|
|
1922
1922
|
e[n] && this.shape[n] && (s[n] = this.shape[n]);
|
|
1923
1923
|
return new w({
|
|
1924
1924
|
...this._def,
|
|
@@ -1927,7 +1927,7 @@ class w extends v {
|
|
|
1927
1927
|
}
|
|
1928
1928
|
omit(e) {
|
|
1929
1929
|
const s = {};
|
|
1930
|
-
for (const n of
|
|
1930
|
+
for (const n of v.objectKeys(this.shape))
|
|
1931
1931
|
e[n] || (s[n] = this.shape[n]);
|
|
1932
1932
|
return new w({
|
|
1933
1933
|
...this._def,
|
|
@@ -1938,13 +1938,13 @@ class w extends v {
|
|
|
1938
1938
|
* @deprecated
|
|
1939
1939
|
*/
|
|
1940
1940
|
deepPartial() {
|
|
1941
|
-
return
|
|
1941
|
+
return D(this);
|
|
1942
1942
|
}
|
|
1943
1943
|
partial(e) {
|
|
1944
1944
|
const s = {};
|
|
1945
|
-
for (const n of
|
|
1946
|
-
const
|
|
1947
|
-
e && !e[n] ? s[n] =
|
|
1945
|
+
for (const n of v.objectKeys(this.shape)) {
|
|
1946
|
+
const a = this.shape[n];
|
|
1947
|
+
e && !e[n] ? s[n] = a : s[n] = a.optional();
|
|
1948
1948
|
}
|
|
1949
1949
|
return new w({
|
|
1950
1950
|
...this._def,
|
|
@@ -1953,14 +1953,14 @@ class w extends v {
|
|
|
1953
1953
|
}
|
|
1954
1954
|
required(e) {
|
|
1955
1955
|
const s = {};
|
|
1956
|
-
for (const n of
|
|
1956
|
+
for (const n of v.objectKeys(this.shape))
|
|
1957
1957
|
if (e && !e[n])
|
|
1958
1958
|
s[n] = this.shape[n];
|
|
1959
1959
|
else {
|
|
1960
|
-
let
|
|
1961
|
-
for (;
|
|
1962
|
-
|
|
1963
|
-
s[n] =
|
|
1960
|
+
let r = this.shape[n];
|
|
1961
|
+
for (; r instanceof L; )
|
|
1962
|
+
r = r._def.innerType;
|
|
1963
|
+
s[n] = r;
|
|
1964
1964
|
}
|
|
1965
1965
|
return new w({
|
|
1966
1966
|
...this._def,
|
|
@@ -1968,7 +1968,7 @@ class w extends v {
|
|
|
1968
1968
|
});
|
|
1969
1969
|
}
|
|
1970
1970
|
keyof() {
|
|
1971
|
-
return
|
|
1971
|
+
return Fe(v.objectKeys(this.shape));
|
|
1972
1972
|
}
|
|
1973
1973
|
}
|
|
1974
1974
|
w.create = (t, e) => new w({
|
|
@@ -1992,24 +1992,24 @@ w.lazycreate = (t, e) => new w({
|
|
|
1992
1992
|
typeName: p.ZodObject,
|
|
1993
1993
|
...g(e)
|
|
1994
1994
|
});
|
|
1995
|
-
class
|
|
1995
|
+
class ce extends _ {
|
|
1996
1996
|
_parse(e) {
|
|
1997
1997
|
const { ctx: s } = this._processInputParams(e), n = this._def.options;
|
|
1998
|
-
function r
|
|
1999
|
-
for (const o of
|
|
1998
|
+
function a(r) {
|
|
1999
|
+
for (const o of r)
|
|
2000
2000
|
if (o.result.status === "valid")
|
|
2001
2001
|
return o.result;
|
|
2002
|
-
for (const o of
|
|
2002
|
+
for (const o of r)
|
|
2003
2003
|
if (o.result.status === "dirty")
|
|
2004
2004
|
return s.common.issues.push(...o.ctx.common.issues), o.result;
|
|
2005
|
-
const i =
|
|
2005
|
+
const i = r.map((o) => new q(o.ctx.common.issues));
|
|
2006
2006
|
return u(s, {
|
|
2007
2007
|
code: c.invalid_union,
|
|
2008
2008
|
unionErrors: i
|
|
2009
2009
|
}), m;
|
|
2010
2010
|
}
|
|
2011
2011
|
if (s.common.async)
|
|
2012
|
-
return Promise.all(n.map(async (
|
|
2012
|
+
return Promise.all(n.map(async (r) => {
|
|
2013
2013
|
const i = {
|
|
2014
2014
|
...s,
|
|
2015
2015
|
common: {
|
|
@@ -2019,16 +2019,16 @@ class oe extends v {
|
|
|
2019
2019
|
parent: null
|
|
2020
2020
|
};
|
|
2021
2021
|
return {
|
|
2022
|
-
result: await
|
|
2022
|
+
result: await r._parseAsync({
|
|
2023
2023
|
data: s.data,
|
|
2024
2024
|
path: s.path,
|
|
2025
2025
|
parent: i
|
|
2026
2026
|
}),
|
|
2027
2027
|
ctx: i
|
|
2028
2028
|
};
|
|
2029
|
-
})).then(
|
|
2029
|
+
})).then(a);
|
|
2030
2030
|
{
|
|
2031
|
-
let
|
|
2031
|
+
let r;
|
|
2032
2032
|
const i = [];
|
|
2033
2033
|
for (const d of n) {
|
|
2034
2034
|
const l = {
|
|
@@ -2045,10 +2045,10 @@ class oe extends v {
|
|
|
2045
2045
|
});
|
|
2046
2046
|
if (y.status === "valid")
|
|
2047
2047
|
return y;
|
|
2048
|
-
y.status === "dirty" && !
|
|
2048
|
+
y.status === "dirty" && !r && (r = { result: y, ctx: l }), l.common.issues.length && i.push(l.common.issues);
|
|
2049
2049
|
}
|
|
2050
|
-
if (
|
|
2051
|
-
return s.common.issues.push(...
|
|
2050
|
+
if (r)
|
|
2051
|
+
return s.common.issues.push(...r.ctx.common.issues), r.result;
|
|
2052
2052
|
const o = i.map((d) => new q(d));
|
|
2053
2053
|
return u(s, {
|
|
2054
2054
|
code: c.invalid_union,
|
|
@@ -2060,7 +2060,7 @@ class oe extends v {
|
|
|
2060
2060
|
return this._def.options;
|
|
2061
2061
|
}
|
|
2062
2062
|
}
|
|
2063
|
-
|
|
2063
|
+
ce.create = (t, e) => new ce({
|
|
2064
2064
|
options: t,
|
|
2065
2065
|
typeName: p.ZodUnion,
|
|
2066
2066
|
...g(e)
|
|
@@ -2070,8 +2070,8 @@ function ve(t, e) {
|
|
|
2070
2070
|
if (t === e)
|
|
2071
2071
|
return { valid: !0, data: t };
|
|
2072
2072
|
if (s === f.object && n === f.object) {
|
|
2073
|
-
const
|
|
2074
|
-
for (const o of
|
|
2073
|
+
const a = v.objectKeys(e), r = v.objectKeys(t).filter((o) => a.indexOf(o) !== -1), i = { ...t, ...e };
|
|
2074
|
+
for (const o of r) {
|
|
2075
2075
|
const d = ve(t[o], e[o]);
|
|
2076
2076
|
if (!d.valid)
|
|
2077
2077
|
return { valid: !1 };
|
|
@@ -2081,23 +2081,23 @@ function ve(t, e) {
|
|
|
2081
2081
|
} else if (s === f.array && n === f.array) {
|
|
2082
2082
|
if (t.length !== e.length)
|
|
2083
2083
|
return { valid: !1 };
|
|
2084
|
-
const
|
|
2085
|
-
for (let
|
|
2086
|
-
const i = t[
|
|
2084
|
+
const a = [];
|
|
2085
|
+
for (let r = 0; r < t.length; r++) {
|
|
2086
|
+
const i = t[r], o = e[r], d = ve(i, o);
|
|
2087
2087
|
if (!d.valid)
|
|
2088
2088
|
return { valid: !1 };
|
|
2089
|
-
|
|
2089
|
+
a.push(d.data);
|
|
2090
2090
|
}
|
|
2091
|
-
return { valid: !0, data:
|
|
2091
|
+
return { valid: !0, data: a };
|
|
2092
2092
|
} else return s === f.date && n === f.date && +t == +e ? { valid: !0, data: t } : { valid: !1 };
|
|
2093
2093
|
}
|
|
2094
|
-
class
|
|
2094
|
+
class ue extends _ {
|
|
2095
2095
|
_parse(e) {
|
|
2096
|
-
const { status: s, ctx: n } = this._processInputParams(e),
|
|
2097
|
-
if (
|
|
2096
|
+
const { status: s, ctx: n } = this._processInputParams(e), a = (r, i) => {
|
|
2097
|
+
if (Oe(r) || Oe(i))
|
|
2098
2098
|
return m;
|
|
2099
|
-
const o = ve(
|
|
2100
|
-
return o.valid ? ((
|
|
2099
|
+
const o = ve(r.value, i.value);
|
|
2100
|
+
return o.valid ? ((Me(r) || Me(i)) && s.dirty(), { status: s.value, value: o.data }) : (u(n, {
|
|
2101
2101
|
code: c.invalid_intersection_types
|
|
2102
2102
|
}), m);
|
|
2103
2103
|
};
|
|
@@ -2112,7 +2112,7 @@ class ce extends v {
|
|
|
2112
2112
|
path: n.path,
|
|
2113
2113
|
parent: n
|
|
2114
2114
|
})
|
|
2115
|
-
]).then(([
|
|
2115
|
+
]).then(([r, i]) => a(r, i)) : a(this._def.left._parseSync({
|
|
2116
2116
|
data: n.data,
|
|
2117
2117
|
path: n.path,
|
|
2118
2118
|
parent: n
|
|
@@ -2123,13 +2123,13 @@ class ce extends v {
|
|
|
2123
2123
|
}));
|
|
2124
2124
|
}
|
|
2125
2125
|
}
|
|
2126
|
-
|
|
2126
|
+
ue.create = (t, e, s) => new ue({
|
|
2127
2127
|
left: t,
|
|
2128
2128
|
right: e,
|
|
2129
2129
|
typeName: p.ZodIntersection,
|
|
2130
2130
|
...g(s)
|
|
2131
2131
|
});
|
|
2132
|
-
class
|
|
2132
|
+
class V extends _ {
|
|
2133
2133
|
_parse(e) {
|
|
2134
2134
|
const { status: s, ctx: n } = this._processInputParams(e);
|
|
2135
2135
|
if (n.parsedType !== f.array)
|
|
@@ -2153,33 +2153,33 @@ class U extends v {
|
|
|
2153
2153
|
exact: !1,
|
|
2154
2154
|
type: "array"
|
|
2155
2155
|
}), s.dirty());
|
|
2156
|
-
const
|
|
2156
|
+
const r = [...n.data].map((i, o) => {
|
|
2157
2157
|
const d = this._def.items[o] || this._def.rest;
|
|
2158
|
-
return d ? d._parse(new
|
|
2158
|
+
return d ? d._parse(new N(n, i, n.path, o)) : null;
|
|
2159
2159
|
}).filter((i) => !!i);
|
|
2160
|
-
return n.common.async ? Promise.all(
|
|
2160
|
+
return n.common.async ? Promise.all(r).then((i) => T.mergeArray(s, i)) : T.mergeArray(s, r);
|
|
2161
2161
|
}
|
|
2162
2162
|
get items() {
|
|
2163
2163
|
return this._def.items;
|
|
2164
2164
|
}
|
|
2165
2165
|
rest(e) {
|
|
2166
|
-
return new
|
|
2166
|
+
return new V({
|
|
2167
2167
|
...this._def,
|
|
2168
2168
|
rest: e
|
|
2169
2169
|
});
|
|
2170
2170
|
}
|
|
2171
2171
|
}
|
|
2172
|
-
|
|
2172
|
+
V.create = (t, e) => {
|
|
2173
2173
|
if (!Array.isArray(t))
|
|
2174
2174
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2175
|
-
return new
|
|
2175
|
+
return new V({
|
|
2176
2176
|
items: t,
|
|
2177
2177
|
typeName: p.ZodTuple,
|
|
2178
2178
|
rest: null,
|
|
2179
2179
|
...g(e)
|
|
2180
2180
|
});
|
|
2181
2181
|
};
|
|
2182
|
-
class
|
|
2182
|
+
class de extends _ {
|
|
2183
2183
|
get keySchema() {
|
|
2184
2184
|
return this._def.keyType;
|
|
2185
2185
|
}
|
|
@@ -2194,25 +2194,25 @@ class ue extends v {
|
|
|
2194
2194
|
expected: f.object,
|
|
2195
2195
|
received: n.parsedType
|
|
2196
2196
|
}), m;
|
|
2197
|
-
const
|
|
2197
|
+
const a = [], r = this._def.keyType, i = this._def.valueType;
|
|
2198
2198
|
for (const o in n.data)
|
|
2199
|
-
|
|
2200
|
-
key:
|
|
2201
|
-
value: i._parse(new
|
|
2199
|
+
a.push({
|
|
2200
|
+
key: r._parse(new N(n, o, n.path, o)),
|
|
2201
|
+
value: i._parse(new N(n, n.data[o], n.path, o)),
|
|
2202
2202
|
alwaysSet: o in n.data
|
|
2203
2203
|
});
|
|
2204
|
-
return n.common.async ? T.mergeObjectAsync(s,
|
|
2204
|
+
return n.common.async ? T.mergeObjectAsync(s, a) : T.mergeObjectSync(s, a);
|
|
2205
2205
|
}
|
|
2206
2206
|
get element() {
|
|
2207
2207
|
return this._def.valueType;
|
|
2208
2208
|
}
|
|
2209
2209
|
static create(e, s, n) {
|
|
2210
|
-
return s instanceof
|
|
2210
|
+
return s instanceof _ ? new de({
|
|
2211
2211
|
keyType: e,
|
|
2212
2212
|
valueType: s,
|
|
2213
2213
|
typeName: p.ZodRecord,
|
|
2214
2214
|
...g(n)
|
|
2215
|
-
}) : new
|
|
2215
|
+
}) : new de({
|
|
2216
2216
|
keyType: j.create(),
|
|
2217
2217
|
valueType: e,
|
|
2218
2218
|
typeName: p.ZodRecord,
|
|
@@ -2220,7 +2220,7 @@ class ue extends v {
|
|
|
2220
2220
|
});
|
|
2221
2221
|
}
|
|
2222
2222
|
}
|
|
2223
|
-
class
|
|
2223
|
+
class Ve extends _ {
|
|
2224
2224
|
get keySchema() {
|
|
2225
2225
|
return this._def.keyType;
|
|
2226
2226
|
}
|
|
@@ -2235,9 +2235,9 @@ class Le extends v {
|
|
|
2235
2235
|
expected: f.map,
|
|
2236
2236
|
received: n.parsedType
|
|
2237
2237
|
}), m;
|
|
2238
|
-
const
|
|
2239
|
-
key:
|
|
2240
|
-
value:
|
|
2238
|
+
const a = this._def.keyType, r = this._def.valueType, i = [...n.data.entries()].map(([o, d], l) => ({
|
|
2239
|
+
key: a._parse(new N(n, o, n.path, [l, "key"])),
|
|
2240
|
+
value: r._parse(new N(n, d, n.path, [l, "value"]))
|
|
2241
2241
|
}));
|
|
2242
2242
|
if (n.common.async) {
|
|
2243
2243
|
const o = /* @__PURE__ */ new Map();
|
|
@@ -2262,13 +2262,13 @@ class Le extends v {
|
|
|
2262
2262
|
}
|
|
2263
2263
|
}
|
|
2264
2264
|
}
|
|
2265
|
-
|
|
2265
|
+
Ve.create = (t, e, s) => new Ve({
|
|
2266
2266
|
valueType: e,
|
|
2267
2267
|
keyType: t,
|
|
2268
2268
|
typeName: p.ZodMap,
|
|
2269
2269
|
...g(s)
|
|
2270
2270
|
});
|
|
2271
|
-
class se extends
|
|
2271
|
+
class se extends _ {
|
|
2272
2272
|
_parse(e) {
|
|
2273
2273
|
const { status: s, ctx: n } = this._processInputParams(e);
|
|
2274
2274
|
if (n.parsedType !== f.set)
|
|
@@ -2277,23 +2277,23 @@ class se extends v {
|
|
|
2277
2277
|
expected: f.set,
|
|
2278
2278
|
received: n.parsedType
|
|
2279
2279
|
}), m;
|
|
2280
|
-
const
|
|
2281
|
-
|
|
2280
|
+
const a = this._def;
|
|
2281
|
+
a.minSize !== null && n.data.size < a.minSize.value && (u(n, {
|
|
2282
2282
|
code: c.too_small,
|
|
2283
|
-
minimum:
|
|
2283
|
+
minimum: a.minSize.value,
|
|
2284
2284
|
type: "set",
|
|
2285
2285
|
inclusive: !0,
|
|
2286
2286
|
exact: !1,
|
|
2287
|
-
message:
|
|
2288
|
-
}), s.dirty()),
|
|
2287
|
+
message: a.minSize.message
|
|
2288
|
+
}), s.dirty()), a.maxSize !== null && n.data.size > a.maxSize.value && (u(n, {
|
|
2289
2289
|
code: c.too_big,
|
|
2290
|
-
maximum:
|
|
2290
|
+
maximum: a.maxSize.value,
|
|
2291
2291
|
type: "set",
|
|
2292
2292
|
inclusive: !0,
|
|
2293
2293
|
exact: !1,
|
|
2294
|
-
message:
|
|
2294
|
+
message: a.maxSize.message
|
|
2295
2295
|
}), s.dirty());
|
|
2296
|
-
const
|
|
2296
|
+
const r = this._def.valueType;
|
|
2297
2297
|
function i(d) {
|
|
2298
2298
|
const l = /* @__PURE__ */ new Set();
|
|
2299
2299
|
for (const y of d) {
|
|
@@ -2303,7 +2303,7 @@ class se extends v {
|
|
|
2303
2303
|
}
|
|
2304
2304
|
return { status: s.value, value: l };
|
|
2305
2305
|
}
|
|
2306
|
-
const o = [...n.data.values()].map((d, l) =>
|
|
2306
|
+
const o = [...n.data.values()].map((d, l) => r._parse(new N(n, d, n.path, l)));
|
|
2307
2307
|
return n.common.async ? Promise.all(o).then((d) => i(d)) : i(o);
|
|
2308
2308
|
}
|
|
2309
2309
|
min(e, s) {
|
|
@@ -2332,7 +2332,7 @@ se.create = (t, e) => new se({
|
|
|
2332
2332
|
typeName: p.ZodSet,
|
|
2333
2333
|
...g(e)
|
|
2334
2334
|
});
|
|
2335
|
-
class
|
|
2335
|
+
class Ue extends _ {
|
|
2336
2336
|
get schema() {
|
|
2337
2337
|
return this._def.getter();
|
|
2338
2338
|
}
|
|
@@ -2341,12 +2341,12 @@ class $e extends v {
|
|
|
2341
2341
|
return this._def.getter()._parse({ data: s.data, path: s.path, parent: s });
|
|
2342
2342
|
}
|
|
2343
2343
|
}
|
|
2344
|
-
|
|
2344
|
+
Ue.create = (t, e) => new Ue({
|
|
2345
2345
|
getter: t,
|
|
2346
2346
|
typeName: p.ZodLazy,
|
|
2347
2347
|
...g(e)
|
|
2348
2348
|
});
|
|
2349
|
-
class
|
|
2349
|
+
class xe extends _ {
|
|
2350
2350
|
_parse(e) {
|
|
2351
2351
|
if (e.data !== this._def.value) {
|
|
2352
2352
|
const s = this._getOrReturnCtx(e);
|
|
@@ -2362,24 +2362,24 @@ class _e extends v {
|
|
|
2362
2362
|
return this._def.value;
|
|
2363
2363
|
}
|
|
2364
2364
|
}
|
|
2365
|
-
|
|
2365
|
+
xe.create = (t, e) => new xe({
|
|
2366
2366
|
value: t,
|
|
2367
2367
|
typeName: p.ZodLiteral,
|
|
2368
2368
|
...g(e)
|
|
2369
2369
|
});
|
|
2370
|
-
function
|
|
2370
|
+
function Fe(t, e) {
|
|
2371
2371
|
return new F({
|
|
2372
2372
|
values: t,
|
|
2373
2373
|
typeName: p.ZodEnum,
|
|
2374
2374
|
...g(e)
|
|
2375
2375
|
});
|
|
2376
2376
|
}
|
|
2377
|
-
class F extends
|
|
2377
|
+
class F extends _ {
|
|
2378
2378
|
_parse(e) {
|
|
2379
2379
|
if (typeof e.data != "string") {
|
|
2380
2380
|
const s = this._getOrReturnCtx(e), n = this._def.values;
|
|
2381
2381
|
return u(s, {
|
|
2382
|
-
expected:
|
|
2382
|
+
expected: v.joinValues(n),
|
|
2383
2383
|
received: s.parsedType,
|
|
2384
2384
|
code: c.invalid_type
|
|
2385
2385
|
}), m;
|
|
@@ -2392,7 +2392,7 @@ class F extends v {
|
|
|
2392
2392
|
options: n
|
|
2393
2393
|
}), m;
|
|
2394
2394
|
}
|
|
2395
|
-
return
|
|
2395
|
+
return I(e.data);
|
|
2396
2396
|
}
|
|
2397
2397
|
get options() {
|
|
2398
2398
|
return this._def.values;
|
|
@@ -2428,38 +2428,38 @@ class F extends v {
|
|
|
2428
2428
|
});
|
|
2429
2429
|
}
|
|
2430
2430
|
}
|
|
2431
|
-
F.create =
|
|
2432
|
-
class
|
|
2431
|
+
F.create = Fe;
|
|
2432
|
+
class Be extends _ {
|
|
2433
2433
|
_parse(e) {
|
|
2434
|
-
const s =
|
|
2434
|
+
const s = v.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
|
|
2435
2435
|
if (n.parsedType !== f.string && n.parsedType !== f.number) {
|
|
2436
|
-
const
|
|
2436
|
+
const a = v.objectValues(s);
|
|
2437
2437
|
return u(n, {
|
|
2438
|
-
expected:
|
|
2438
|
+
expected: v.joinValues(a),
|
|
2439
2439
|
received: n.parsedType,
|
|
2440
2440
|
code: c.invalid_type
|
|
2441
2441
|
}), m;
|
|
2442
2442
|
}
|
|
2443
|
-
if (this._cache || (this._cache = new Set(
|
|
2444
|
-
const
|
|
2443
|
+
if (this._cache || (this._cache = new Set(v.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
|
|
2444
|
+
const a = v.objectValues(s);
|
|
2445
2445
|
return u(n, {
|
|
2446
2446
|
received: n.data,
|
|
2447
2447
|
code: c.invalid_enum_value,
|
|
2448
|
-
options:
|
|
2448
|
+
options: a
|
|
2449
2449
|
}), m;
|
|
2450
2450
|
}
|
|
2451
|
-
return
|
|
2451
|
+
return I(e.data);
|
|
2452
2452
|
}
|
|
2453
2453
|
get enum() {
|
|
2454
2454
|
return this._def.values;
|
|
2455
2455
|
}
|
|
2456
2456
|
}
|
|
2457
|
-
|
|
2457
|
+
Be.create = (t, e) => new Be({
|
|
2458
2458
|
values: t,
|
|
2459
2459
|
typeName: p.ZodNativeEnum,
|
|
2460
2460
|
...g(e)
|
|
2461
2461
|
});
|
|
2462
|
-
class
|
|
2462
|
+
class le extends _ {
|
|
2463
2463
|
unwrap() {
|
|
2464
2464
|
return this._def.type;
|
|
2465
2465
|
}
|
|
@@ -2472,18 +2472,18 @@ class de extends v {
|
|
|
2472
2472
|
received: s.parsedType
|
|
2473
2473
|
}), m;
|
|
2474
2474
|
const n = s.parsedType === f.promise ? s.data : Promise.resolve(s.data);
|
|
2475
|
-
return
|
|
2475
|
+
return I(n.then((a) => this._def.type.parseAsync(a, {
|
|
2476
2476
|
path: s.path,
|
|
2477
2477
|
errorMap: s.common.contextualErrorMap
|
|
2478
2478
|
})));
|
|
2479
2479
|
}
|
|
2480
2480
|
}
|
|
2481
|
-
|
|
2481
|
+
le.create = (t, e) => new le({
|
|
2482
2482
|
type: t,
|
|
2483
2483
|
typeName: p.ZodPromise,
|
|
2484
2484
|
...g(e)
|
|
2485
2485
|
});
|
|
2486
|
-
class W extends
|
|
2486
|
+
class W extends _ {
|
|
2487
2487
|
innerType() {
|
|
2488
2488
|
return this._def.schema;
|
|
2489
2489
|
}
|
|
@@ -2491,7 +2491,7 @@ class W extends v {
|
|
|
2491
2491
|
return this._def.schema._def.typeName === p.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
2492
2492
|
}
|
|
2493
2493
|
_parse(e) {
|
|
2494
|
-
const { status: s, ctx: n } = this._processInputParams(e),
|
|
2494
|
+
const { status: s, ctx: n } = this._processInputParams(e), a = this._def.effect || null, r = {
|
|
2495
2495
|
addIssue: (i) => {
|
|
2496
2496
|
u(n, i), i.fatal ? s.abort() : s.dirty();
|
|
2497
2497
|
},
|
|
@@ -2499,8 +2499,8 @@ class W extends v {
|
|
|
2499
2499
|
return n.path;
|
|
2500
2500
|
}
|
|
2501
2501
|
};
|
|
2502
|
-
if (
|
|
2503
|
-
const i =
|
|
2502
|
+
if (r.addIssue = r.addIssue.bind(r), a.type === "preprocess") {
|
|
2503
|
+
const i = a.transform(n.data, r);
|
|
2504
2504
|
if (n.common.async)
|
|
2505
2505
|
return Promise.resolve(i).then(async (o) => {
|
|
2506
2506
|
if (s.value === "aborted")
|
|
@@ -2523,9 +2523,9 @@ class W extends v {
|
|
|
2523
2523
|
return o.status === "aborted" ? m : o.status === "dirty" || s.value === "dirty" ? Y(o.value) : o;
|
|
2524
2524
|
}
|
|
2525
2525
|
}
|
|
2526
|
-
if (
|
|
2526
|
+
if (a.type === "refinement") {
|
|
2527
2527
|
const i = (o) => {
|
|
2528
|
-
const d =
|
|
2528
|
+
const d = a.refinement(o, r);
|
|
2529
2529
|
if (n.common.async)
|
|
2530
2530
|
return Promise.resolve(d);
|
|
2531
2531
|
if (d instanceof Promise)
|
|
@@ -2542,7 +2542,7 @@ class W extends v {
|
|
|
2542
2542
|
} else
|
|
2543
2543
|
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => o.status === "aborted" ? m : (o.status === "dirty" && s.dirty(), i(o.value).then(() => ({ status: s.value, value: o.value }))));
|
|
2544
2544
|
}
|
|
2545
|
-
if (
|
|
2545
|
+
if (a.type === "transform")
|
|
2546
2546
|
if (n.common.async === !1) {
|
|
2547
2547
|
const i = this._def.schema._parseSync({
|
|
2548
2548
|
data: n.data,
|
|
@@ -2551,16 +2551,16 @@ class W extends v {
|
|
|
2551
2551
|
});
|
|
2552
2552
|
if (!G(i))
|
|
2553
2553
|
return m;
|
|
2554
|
-
const o =
|
|
2554
|
+
const o = a.transform(i.value, r);
|
|
2555
2555
|
if (o instanceof Promise)
|
|
2556
2556
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2557
2557
|
return { status: s.value, value: o };
|
|
2558
2558
|
} else
|
|
2559
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) => G(i) ? Promise.resolve(
|
|
2559
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) => G(i) ? Promise.resolve(a.transform(i.value, r)).then((o) => ({
|
|
2560
2560
|
status: s.value,
|
|
2561
2561
|
value: o
|
|
2562
2562
|
})) : m);
|
|
2563
|
-
|
|
2563
|
+
v.assertNever(a);
|
|
2564
2564
|
}
|
|
2565
2565
|
}
|
|
2566
2566
|
W.create = (t, e, s) => new W({
|
|
@@ -2575,9 +2575,9 @@ W.createWithPreprocess = (t, e, s) => new W({
|
|
|
2575
2575
|
typeName: p.ZodEffects,
|
|
2576
2576
|
...g(s)
|
|
2577
2577
|
});
|
|
2578
|
-
class L extends
|
|
2578
|
+
class L extends _ {
|
|
2579
2579
|
_parse(e) {
|
|
2580
|
-
return this._getType(e) === f.undefined ?
|
|
2580
|
+
return this._getType(e) === f.undefined ? I(void 0) : this._def.innerType._parse(e);
|
|
2581
2581
|
}
|
|
2582
2582
|
unwrap() {
|
|
2583
2583
|
return this._def.innerType;
|
|
@@ -2588,9 +2588,9 @@ L.create = (t, e) => new L({
|
|
|
2588
2588
|
typeName: p.ZodOptional,
|
|
2589
2589
|
...g(e)
|
|
2590
2590
|
});
|
|
2591
|
-
class H extends
|
|
2591
|
+
class H extends _ {
|
|
2592
2592
|
_parse(e) {
|
|
2593
|
-
return this._getType(e) === f.null ?
|
|
2593
|
+
return this._getType(e) === f.null ? I(null) : this._def.innerType._parse(e);
|
|
2594
2594
|
}
|
|
2595
2595
|
unwrap() {
|
|
2596
2596
|
return this._def.innerType;
|
|
@@ -2601,7 +2601,7 @@ H.create = (t, e) => new H({
|
|
|
2601
2601
|
typeName: p.ZodNullable,
|
|
2602
2602
|
...g(e)
|
|
2603
2603
|
});
|
|
2604
|
-
class
|
|
2604
|
+
class be extends _ {
|
|
2605
2605
|
_parse(e) {
|
|
2606
2606
|
const { ctx: s } = this._processInputParams(e);
|
|
2607
2607
|
let n = s.data;
|
|
@@ -2615,13 +2615,13 @@ class xe extends v {
|
|
|
2615
2615
|
return this._def.innerType;
|
|
2616
2616
|
}
|
|
2617
2617
|
}
|
|
2618
|
-
|
|
2618
|
+
be.create = (t, e) => new be({
|
|
2619
2619
|
innerType: t,
|
|
2620
2620
|
typeName: p.ZodDefault,
|
|
2621
2621
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
2622
2622
|
...g(e)
|
|
2623
2623
|
});
|
|
2624
|
-
class
|
|
2624
|
+
class ke extends _ {
|
|
2625
2625
|
_parse(e) {
|
|
2626
2626
|
const { ctx: s } = this._processInputParams(e), n = {
|
|
2627
2627
|
...s,
|
|
@@ -2629,16 +2629,16 @@ class be extends v {
|
|
|
2629
2629
|
...s.common,
|
|
2630
2630
|
issues: []
|
|
2631
2631
|
}
|
|
2632
|
-
},
|
|
2632
|
+
}, a = this._def.innerType._parse({
|
|
2633
2633
|
data: n.data,
|
|
2634
2634
|
path: n.path,
|
|
2635
2635
|
parent: {
|
|
2636
2636
|
...n
|
|
2637
2637
|
}
|
|
2638
2638
|
});
|
|
2639
|
-
return
|
|
2639
|
+
return ie(a) ? a.then((r) => ({
|
|
2640
2640
|
status: "valid",
|
|
2641
|
-
value:
|
|
2641
|
+
value: r.status === "valid" ? r.value : this._def.catchValue({
|
|
2642
2642
|
get error() {
|
|
2643
2643
|
return new q(n.common.issues);
|
|
2644
2644
|
},
|
|
@@ -2646,7 +2646,7 @@ class be extends v {
|
|
|
2646
2646
|
})
|
|
2647
2647
|
})) : {
|
|
2648
2648
|
status: "valid",
|
|
2649
|
-
value:
|
|
2649
|
+
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
2650
2650
|
get error() {
|
|
2651
2651
|
return new q(n.common.issues);
|
|
2652
2652
|
},
|
|
@@ -2658,13 +2658,13 @@ class be extends v {
|
|
|
2658
2658
|
return this._def.innerType;
|
|
2659
2659
|
}
|
|
2660
2660
|
}
|
|
2661
|
-
|
|
2661
|
+
ke.create = (t, e) => new ke({
|
|
2662
2662
|
innerType: t,
|
|
2663
2663
|
typeName: p.ZodCatch,
|
|
2664
2664
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2665
2665
|
...g(e)
|
|
2666
2666
|
});
|
|
2667
|
-
class
|
|
2667
|
+
class De extends _ {
|
|
2668
2668
|
_parse(e) {
|
|
2669
2669
|
if (this._getType(e) !== f.nan) {
|
|
2670
2670
|
const n = this._getOrReturnCtx(e);
|
|
@@ -2677,11 +2677,11 @@ class Ve extends v {
|
|
|
2677
2677
|
return { status: "valid", value: e.data };
|
|
2678
2678
|
}
|
|
2679
2679
|
}
|
|
2680
|
-
|
|
2680
|
+
De.create = (t) => new De({
|
|
2681
2681
|
typeName: p.ZodNaN,
|
|
2682
2682
|
...g(t)
|
|
2683
2683
|
});
|
|
2684
|
-
class Et extends
|
|
2684
|
+
class Et extends _ {
|
|
2685
2685
|
_parse(e) {
|
|
2686
2686
|
const { ctx: s } = this._processInputParams(e), n = s.data;
|
|
2687
2687
|
return this._def.type._parse({
|
|
@@ -2694,56 +2694,56 @@ class Et extends v {
|
|
|
2694
2694
|
return this._def.type;
|
|
2695
2695
|
}
|
|
2696
2696
|
}
|
|
2697
|
-
class
|
|
2697
|
+
class Re extends _ {
|
|
2698
2698
|
_parse(e) {
|
|
2699
2699
|
const { status: s, ctx: n } = this._processInputParams(e);
|
|
2700
2700
|
if (n.common.async)
|
|
2701
2701
|
return (async () => {
|
|
2702
|
-
const
|
|
2702
|
+
const r = await this._def.in._parseAsync({
|
|
2703
2703
|
data: n.data,
|
|
2704
2704
|
path: n.path,
|
|
2705
2705
|
parent: n
|
|
2706
2706
|
});
|
|
2707
|
-
return
|
|
2708
|
-
data:
|
|
2707
|
+
return r.status === "aborted" ? m : r.status === "dirty" ? (s.dirty(), Y(r.value)) : this._def.out._parseAsync({
|
|
2708
|
+
data: r.value,
|
|
2709
2709
|
path: n.path,
|
|
2710
2710
|
parent: n
|
|
2711
2711
|
});
|
|
2712
2712
|
})();
|
|
2713
2713
|
{
|
|
2714
|
-
const
|
|
2714
|
+
const a = this._def.in._parseSync({
|
|
2715
2715
|
data: n.data,
|
|
2716
2716
|
path: n.path,
|
|
2717
2717
|
parent: n
|
|
2718
2718
|
});
|
|
2719
|
-
return
|
|
2719
|
+
return a.status === "aborted" ? m : a.status === "dirty" ? (s.dirty(), {
|
|
2720
2720
|
status: "dirty",
|
|
2721
|
-
value:
|
|
2721
|
+
value: a.value
|
|
2722
2722
|
}) : this._def.out._parseSync({
|
|
2723
|
-
data:
|
|
2723
|
+
data: a.value,
|
|
2724
2724
|
path: n.path,
|
|
2725
2725
|
parent: n
|
|
2726
2726
|
});
|
|
2727
2727
|
}
|
|
2728
2728
|
}
|
|
2729
2729
|
static create(e, s) {
|
|
2730
|
-
return new
|
|
2730
|
+
return new Re({
|
|
2731
2731
|
in: e,
|
|
2732
2732
|
out: s,
|
|
2733
2733
|
typeName: p.ZodPipeline
|
|
2734
2734
|
});
|
|
2735
2735
|
}
|
|
2736
2736
|
}
|
|
2737
|
-
class
|
|
2737
|
+
class we extends _ {
|
|
2738
2738
|
_parse(e) {
|
|
2739
|
-
const s = this._def.innerType._parse(e), n = (
|
|
2740
|
-
return
|
|
2739
|
+
const s = this._def.innerType._parse(e), n = (a) => (G(a) && (a.value = Object.freeze(a.value)), a);
|
|
2740
|
+
return ie(s) ? s.then((a) => n(a)) : n(s);
|
|
2741
2741
|
}
|
|
2742
2742
|
unwrap() {
|
|
2743
2743
|
return this._def.innerType;
|
|
2744
2744
|
}
|
|
2745
2745
|
}
|
|
2746
|
-
|
|
2746
|
+
we.create = (t, e) => new we({
|
|
2747
2747
|
innerType: t,
|
|
2748
2748
|
typeName: p.ZodReadonly,
|
|
2749
2749
|
...g(e)
|
|
@@ -2752,122 +2752,120 @@ var p;
|
|
|
2752
2752
|
(function(t) {
|
|
2753
2753
|
t.ZodString = "ZodString", t.ZodNumber = "ZodNumber", t.ZodNaN = "ZodNaN", t.ZodBigInt = "ZodBigInt", t.ZodBoolean = "ZodBoolean", t.ZodDate = "ZodDate", t.ZodSymbol = "ZodSymbol", t.ZodUndefined = "ZodUndefined", t.ZodNull = "ZodNull", t.ZodAny = "ZodAny", t.ZodUnknown = "ZodUnknown", t.ZodNever = "ZodNever", t.ZodVoid = "ZodVoid", t.ZodArray = "ZodArray", t.ZodObject = "ZodObject", t.ZodUnion = "ZodUnion", t.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", t.ZodIntersection = "ZodIntersection", t.ZodTuple = "ZodTuple", t.ZodRecord = "ZodRecord", t.ZodMap = "ZodMap", t.ZodSet = "ZodSet", t.ZodFunction = "ZodFunction", t.ZodLazy = "ZodLazy", t.ZodLiteral = "ZodLiteral", t.ZodEnum = "ZodEnum", t.ZodEffects = "ZodEffects", t.ZodNativeEnum = "ZodNativeEnum", t.ZodOptional = "ZodOptional", t.ZodNullable = "ZodNullable", t.ZodDefault = "ZodDefault", t.ZodCatch = "ZodCatch", t.ZodPromise = "ZodPromise", t.ZodBranded = "ZodBranded", t.ZodPipeline = "ZodPipeline", t.ZodReadonly = "ZodReadonly";
|
|
2754
2754
|
})(p || (p = {}));
|
|
2755
|
-
const x = j.create,
|
|
2755
|
+
const x = j.create, Te = Q.create, z = ye.create, fe = _e.create;
|
|
2756
2756
|
$.create;
|
|
2757
|
-
const At =
|
|
2758
|
-
oe.create;
|
|
2757
|
+
const At = A.create, he = w.create;
|
|
2759
2758
|
ce.create;
|
|
2760
|
-
|
|
2761
|
-
|
|
2759
|
+
ue.create;
|
|
2760
|
+
V.create;
|
|
2761
|
+
const Nt = de.create, b = xe.create;
|
|
2762
2762
|
F.create;
|
|
2763
|
-
|
|
2763
|
+
le.create;
|
|
2764
2764
|
L.create;
|
|
2765
2765
|
H.create;
|
|
2766
|
-
const Ot = 1,
|
|
2766
|
+
const Ot = 1, U = he({
|
|
2767
2767
|
type: b("qp-bridge"),
|
|
2768
|
-
id: x().optional()
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2768
|
+
id: x().optional(),
|
|
2769
|
+
instanceId: x().optional()
|
|
2770
|
+
}), S = U.extend({
|
|
2771
|
+
featureVersion: Te().optional()
|
|
2772
|
+
}), Mt = U.extend({
|
|
2772
2773
|
status: b("answerChanged"),
|
|
2773
2774
|
question: x(),
|
|
2774
|
-
answer:
|
|
2775
|
-
}),
|
|
2775
|
+
answer: fe()
|
|
2776
|
+
}), Zt = U.extend({
|
|
2776
2777
|
action: b("commandExecuted"),
|
|
2777
2778
|
commandName: x()
|
|
2778
|
-
}),
|
|
2779
|
+
}), jt = U.extend({
|
|
2779
2780
|
action: b("questionnaireLoaded")
|
|
2780
|
-
}), J =
|
|
2781
|
+
}), J = U.extend({
|
|
2781
2782
|
status: b("success")
|
|
2782
|
-
}),
|
|
2783
|
+
}), qt = U.extend({
|
|
2783
2784
|
status: b("error"),
|
|
2784
2785
|
message: x()
|
|
2785
|
-
}),
|
|
2786
|
+
}), We = he({
|
|
2786
2787
|
semanticColor: x().optional(),
|
|
2787
2788
|
label: x(),
|
|
2788
2789
|
description: x(),
|
|
2789
|
-
disabled:
|
|
2790
|
-
required:
|
|
2791
|
-
hidden:
|
|
2790
|
+
disabled: z(),
|
|
2791
|
+
required: z(),
|
|
2792
|
+
hidden: z(),
|
|
2792
2793
|
errorMessage: x().optional(),
|
|
2793
|
-
answer:
|
|
2794
|
-
}),
|
|
2794
|
+
answer: fe().optional()
|
|
2795
|
+
}), Pt = We.partial(), Lt = he({
|
|
2795
2796
|
id: x().uuid(),
|
|
2796
2797
|
name: x(),
|
|
2797
2798
|
mimeType: x(),
|
|
2798
2799
|
blobUrl: x()
|
|
2799
|
-
}),
|
|
2800
|
+
}), Ce = Nt(fe()), He = he({
|
|
2800
2801
|
label: x(),
|
|
2801
|
-
hidden:
|
|
2802
|
-
collapsed:
|
|
2803
|
-
}),
|
|
2802
|
+
hidden: z(),
|
|
2803
|
+
collapsed: z()
|
|
2804
|
+
}), $t = He.partial(), Vt = S.extend({
|
|
2804
2805
|
action: b("getQuestion"),
|
|
2805
2806
|
question: x()
|
|
2806
2807
|
}), Ut = J.extend({
|
|
2807
|
-
question:
|
|
2808
|
-
}),
|
|
2808
|
+
question: We
|
|
2809
|
+
}), Bt = S.extend({
|
|
2809
2810
|
action: b("setQuestion"),
|
|
2810
2811
|
question: x(),
|
|
2811
|
-
questionData:
|
|
2812
|
-
}),
|
|
2812
|
+
questionData: Pt
|
|
2813
|
+
}), Dt = S.extend({
|
|
2813
2814
|
action: b("getGroup"),
|
|
2814
2815
|
group: x()
|
|
2815
2816
|
}), zt = J.extend({
|
|
2816
|
-
group:
|
|
2817
|
-
}),
|
|
2818
|
-
canSave:
|
|
2819
|
-
}), Gt = S.extend({
|
|
2820
|
-
action: b("canSave")
|
|
2817
|
+
group: He
|
|
2818
|
+
}), Gt = J.extend({
|
|
2819
|
+
canSave: z()
|
|
2821
2820
|
}), Qt = S.extend({
|
|
2821
|
+
action: b("canSave")
|
|
2822
|
+
}), Ft = S.extend({
|
|
2822
2823
|
action: b("setGroup"),
|
|
2823
2824
|
group: x(),
|
|
2824
|
-
groupData:
|
|
2825
|
-
}),
|
|
2825
|
+
groupData: $t
|
|
2826
|
+
}), Wt = S.extend({
|
|
2826
2827
|
action: b("setAnswer"),
|
|
2827
2828
|
question: x(),
|
|
2828
|
-
answer:
|
|
2829
|
-
}), Wt = S.extend({
|
|
2830
|
-
action: b("busyIndicatorStart")
|
|
2829
|
+
answer: fe()
|
|
2831
2830
|
}), Ht = S.extend({
|
|
2832
|
-
action: b("
|
|
2831
|
+
action: b("busyIndicatorStart")
|
|
2833
2832
|
}), Jt = S.extend({
|
|
2834
|
-
action: b("
|
|
2833
|
+
action: b("busyIndicatorEnd")
|
|
2835
2834
|
}), Yt = S.extend({
|
|
2836
|
-
action: b("
|
|
2835
|
+
action: b("saveQuestionnaire")
|
|
2837
2836
|
}), Xt = S.extend({
|
|
2837
|
+
action: b("completeAndCloseQuestionnaire")
|
|
2838
|
+
}), Kt = S.extend({
|
|
2838
2839
|
action: b("executeCustomCommand"),
|
|
2839
2840
|
commandName: x()
|
|
2840
|
-
}),
|
|
2841
|
+
}), es = S.extend({
|
|
2841
2842
|
action: b("fetchEntities"),
|
|
2842
2843
|
fetchXml: x()
|
|
2843
|
-
}),
|
|
2844
|
-
entities: At(
|
|
2845
|
-
}),
|
|
2844
|
+
}), ts = J.extend({
|
|
2845
|
+
entities: At(Ce)
|
|
2846
|
+
}), ss = S.extend({
|
|
2846
2847
|
action: b("getEntityById"),
|
|
2847
2848
|
entityName: x(),
|
|
2848
2849
|
entityId: x()
|
|
2849
|
-
}),
|
|
2850
|
-
entity:
|
|
2851
|
-
}),
|
|
2850
|
+
}), ns = J.extend({
|
|
2851
|
+
entity: Ce
|
|
2852
|
+
}), as = S.extend({
|
|
2852
2853
|
action: b("saveEntity"),
|
|
2853
|
-
entity:
|
|
2854
|
+
entity: Ce
|
|
2854
2855
|
}), rs = S.extend({
|
|
2855
2856
|
action: b("repeatGroup"),
|
|
2856
2857
|
parentGroupName: x(),
|
|
2857
|
-
groupIndex:
|
|
2858
|
-
}),
|
|
2858
|
+
groupIndex: Te()
|
|
2859
|
+
}), is = S.extend({
|
|
2859
2860
|
action: b("addNewGroup"),
|
|
2860
2861
|
groupName: x()
|
|
2861
|
-
}),
|
|
2862
|
+
}), os = S.extend({
|
|
2862
2863
|
action: b("deleteGroup"),
|
|
2863
2864
|
parentGroupName: x(),
|
|
2864
|
-
groupIndex:
|
|
2865
|
+
groupIndex: Te()
|
|
2865
2866
|
});
|
|
2866
|
-
function
|
|
2867
|
-
return
|
|
2868
|
-
}
|
|
2869
|
-
function os(t) {
|
|
2870
|
-
return It.safeParse(t).success;
|
|
2867
|
+
function Ts(t) {
|
|
2868
|
+
return Lt.safeParse(t).success;
|
|
2871
2869
|
}
|
|
2872
2870
|
function cs(t) {
|
|
2873
2871
|
return Mt.safeParse(t).success;
|
|
@@ -2875,52 +2873,52 @@ function cs(t) {
|
|
|
2875
2873
|
function us(t) {
|
|
2876
2874
|
return Zt.safeParse(t).success;
|
|
2877
2875
|
}
|
|
2878
|
-
function
|
|
2879
|
-
return
|
|
2876
|
+
function ds(t) {
|
|
2877
|
+
return jt.safeParse(t).success;
|
|
2880
2878
|
}
|
|
2881
|
-
function
|
|
2879
|
+
function Se(t) {
|
|
2880
|
+
return U.safeParse(t).success;
|
|
2881
|
+
}
|
|
2882
|
+
function Cs(t) {
|
|
2882
2883
|
return S.safeParse(t).success;
|
|
2883
2884
|
}
|
|
2884
|
-
function
|
|
2885
|
+
function ls(t) {
|
|
2885
2886
|
return J.safeParse(t).success;
|
|
2886
2887
|
}
|
|
2887
|
-
function
|
|
2888
|
-
return
|
|
2888
|
+
function fs(t) {
|
|
2889
|
+
return qt.safeParse(t).success;
|
|
2889
2890
|
}
|
|
2890
|
-
function
|
|
2891
|
-
return
|
|
2891
|
+
function Is(t) {
|
|
2892
|
+
return Vt.safeParse(t).success;
|
|
2892
2893
|
}
|
|
2893
|
-
function
|
|
2894
|
+
function hs(t) {
|
|
2894
2895
|
return Ut.safeParse(t).success;
|
|
2895
2896
|
}
|
|
2896
2897
|
function Es(t) {
|
|
2897
|
-
return
|
|
2898
|
+
return Wt.safeParse(t).success;
|
|
2898
2899
|
}
|
|
2899
2900
|
function As(t) {
|
|
2900
|
-
return
|
|
2901
|
+
return Bt.safeParse(t).success;
|
|
2901
2902
|
}
|
|
2902
2903
|
function Ns(t) {
|
|
2903
|
-
return
|
|
2904
|
+
return Ft.safeParse(t).success;
|
|
2904
2905
|
}
|
|
2905
2906
|
function Os(t) {
|
|
2906
|
-
return Bt.safeParse(t).success;
|
|
2907
|
-
}
|
|
2908
|
-
function hs(t) {
|
|
2909
|
-
return zt.safeParse(t).success;
|
|
2910
|
-
}
|
|
2911
|
-
function Is(t) {
|
|
2912
2907
|
return Dt.safeParse(t).success;
|
|
2913
2908
|
}
|
|
2914
2909
|
function ps(t) {
|
|
2910
|
+
return zt.safeParse(t).success;
|
|
2911
|
+
}
|
|
2912
|
+
function Ms(t) {
|
|
2915
2913
|
return Gt.safeParse(t).success;
|
|
2916
2914
|
}
|
|
2917
2915
|
function ms(t) {
|
|
2918
|
-
return
|
|
2916
|
+
return Qt.safeParse(t).success;
|
|
2919
2917
|
}
|
|
2920
2918
|
function gs(t) {
|
|
2921
2919
|
return Ht.safeParse(t).success;
|
|
2922
2920
|
}
|
|
2923
|
-
function
|
|
2921
|
+
function ys(t) {
|
|
2924
2922
|
return Jt.safeParse(t).success;
|
|
2925
2923
|
}
|
|
2926
2924
|
function Zs(t) {
|
|
@@ -2930,55 +2928,64 @@ function js(t) {
|
|
|
2930
2928
|
return Xt.safeParse(t).success;
|
|
2931
2929
|
}
|
|
2932
2930
|
function qs(t) {
|
|
2933
|
-
return
|
|
2934
|
-
}
|
|
2935
|
-
function ys(t, e) {
|
|
2936
|
-
return !We(t) || t.id !== e || !("status" in t);
|
|
2931
|
+
return Kt.safeParse(t).success;
|
|
2937
2932
|
}
|
|
2938
2933
|
function Ps(t) {
|
|
2939
|
-
return
|
|
2934
|
+
return gs(t) || ys(t);
|
|
2940
2935
|
}
|
|
2941
|
-
function
|
|
2942
|
-
return
|
|
2936
|
+
function _s(t, e, s) {
|
|
2937
|
+
return !Se(t) || t.id !== e || s !== void 0 && t.instanceId !== s || !("status" in t);
|
|
2943
2938
|
}
|
|
2944
2939
|
function Ls(t) {
|
|
2940
|
+
return es.safeParse(t).success;
|
|
2941
|
+
}
|
|
2942
|
+
function vs(t) {
|
|
2945
2943
|
return ts.safeParse(t).success;
|
|
2946
2944
|
}
|
|
2947
|
-
function
|
|
2945
|
+
function $s(t) {
|
|
2948
2946
|
return ss.safeParse(t).success;
|
|
2949
2947
|
}
|
|
2950
|
-
function
|
|
2948
|
+
function xs(t) {
|
|
2951
2949
|
return ns.safeParse(t).success;
|
|
2952
2950
|
}
|
|
2953
|
-
function Us(t) {
|
|
2954
|
-
return rs.safeParse(t).success;
|
|
2955
|
-
}
|
|
2956
2951
|
function Vs(t) {
|
|
2957
2952
|
return as.safeParse(t).success;
|
|
2958
2953
|
}
|
|
2954
|
+
function Us(t) {
|
|
2955
|
+
return rs.safeParse(t).success;
|
|
2956
|
+
}
|
|
2959
2957
|
function Bs(t) {
|
|
2960
2958
|
return is.safeParse(t).success;
|
|
2961
2959
|
}
|
|
2962
|
-
function
|
|
2960
|
+
function Ds(t) {
|
|
2961
|
+
return os.safeParse(t).success;
|
|
2962
|
+
}
|
|
2963
|
+
function ne(t) {
|
|
2964
|
+
if (t?.instanceId != null)
|
|
2965
|
+
return t.instanceId;
|
|
2966
|
+
const e = globalThis.__RESCO_QP_BRIDGE_INSTANCE_ID;
|
|
2967
|
+
return typeof e == "string" ? e : void 0;
|
|
2968
|
+
}
|
|
2969
|
+
function Je(t) {
|
|
2963
2970
|
if (t instanceof File || t instanceof Blob)
|
|
2964
2971
|
return URL.createObjectURL(t);
|
|
2965
2972
|
if (typeof t == "string") {
|
|
2966
2973
|
if (/^data:/.test(t)) {
|
|
2967
|
-
const
|
|
2968
|
-
if (
|
|
2969
|
-
const i =
|
|
2974
|
+
const r = t.match(/^data:([^;]+);base64,(.*)$/);
|
|
2975
|
+
if (r) {
|
|
2976
|
+
const i = r[1], o = r[2], d = atob(o), l = new ArrayBuffer(d.length), y = new Uint8Array(l);
|
|
2970
2977
|
for (let M = 0; M < d.length; M++)
|
|
2971
2978
|
y[M] = d.charCodeAt(M);
|
|
2972
|
-
const
|
|
2973
|
-
return URL.createObjectURL(
|
|
2979
|
+
const O = new Blob([l], { type: i });
|
|
2980
|
+
return URL.createObjectURL(O);
|
|
2974
2981
|
}
|
|
2975
2982
|
throw new Error("Invalid data URL format. Only base64 data URLs are supported.");
|
|
2976
2983
|
}
|
|
2977
2984
|
const e = atob(t), s = new ArrayBuffer(e.length), n = new Uint8Array(s);
|
|
2978
|
-
for (let
|
|
2979
|
-
n[
|
|
2980
|
-
const
|
|
2981
|
-
return URL.createObjectURL(
|
|
2985
|
+
for (let r = 0; r < e.length; r++)
|
|
2986
|
+
n[r] = e.charCodeAt(r);
|
|
2987
|
+
const a = new Blob([s]);
|
|
2988
|
+
return URL.createObjectURL(a);
|
|
2982
2989
|
}
|
|
2983
2990
|
if (t instanceof ArrayBuffer) {
|
|
2984
2991
|
const e = new Blob([t]);
|
|
@@ -2988,319 +2995,392 @@ function He(t) {
|
|
|
2988
2995
|
}
|
|
2989
2996
|
function zs(t, e, s, n) {
|
|
2990
2997
|
return {
|
|
2991
|
-
id: n ??
|
|
2998
|
+
id: n ?? ze(),
|
|
2992
2999
|
name: t,
|
|
2993
3000
|
mimeType: e,
|
|
2994
|
-
blobUrl:
|
|
3001
|
+
blobUrl: Je(s)
|
|
2995
3002
|
};
|
|
2996
3003
|
}
|
|
2997
|
-
function
|
|
3004
|
+
function Gs(t, e) {
|
|
2998
3005
|
let s = t.blobUrl;
|
|
2999
|
-
return e.content !== void 0 && (s =
|
|
3006
|
+
return e.content !== void 0 && (s = Je(e.content)), {
|
|
3000
3007
|
...t,
|
|
3001
3008
|
...e,
|
|
3002
3009
|
blobUrl: s
|
|
3003
3010
|
};
|
|
3004
3011
|
}
|
|
3005
|
-
|
|
3006
|
-
function
|
|
3007
|
-
window.addEventListener("message",
|
|
3012
|
+
Ke.env?.NODE_ENV !== "test" && bs();
|
|
3013
|
+
function bs() {
|
|
3014
|
+
window.addEventListener("message", Ye);
|
|
3008
3015
|
}
|
|
3009
|
-
function
|
|
3010
|
-
window.removeEventListener("message",
|
|
3016
|
+
function Qs() {
|
|
3017
|
+
window.removeEventListener("message", Ye);
|
|
3011
3018
|
}
|
|
3012
|
-
async function
|
|
3013
|
-
await C(
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
}
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
type: "qp-bridge",
|
|
3023
|
-
action: "getQuestion",
|
|
3024
|
-
question: t
|
|
3025
|
-
});
|
|
3019
|
+
async function Fs(t, e, s) {
|
|
3020
|
+
await C(
|
|
3021
|
+
{
|
|
3022
|
+
type: "qp-bridge",
|
|
3023
|
+
action: "setAnswer",
|
|
3024
|
+
question: t,
|
|
3025
|
+
answer: e
|
|
3026
|
+
},
|
|
3027
|
+
s
|
|
3028
|
+
);
|
|
3026
3029
|
}
|
|
3027
3030
|
async function Ws(t, e) {
|
|
3028
|
-
await
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3031
|
+
return await ks(
|
|
3032
|
+
{
|
|
3033
|
+
type: "qp-bridge",
|
|
3034
|
+
action: "getQuestion",
|
|
3035
|
+
question: t
|
|
3036
|
+
},
|
|
3037
|
+
e
|
|
3038
|
+
);
|
|
3039
|
+
}
|
|
3040
|
+
async function Hs(t, e, s) {
|
|
3041
|
+
await C(
|
|
3042
|
+
{
|
|
3043
|
+
type: "qp-bridge",
|
|
3044
|
+
action: "setQuestion",
|
|
3045
|
+
question: t,
|
|
3046
|
+
questionData: e
|
|
3047
|
+
},
|
|
3048
|
+
s
|
|
3049
|
+
);
|
|
3041
3050
|
}
|
|
3042
3051
|
async function Js(t, e) {
|
|
3043
|
-
await
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3052
|
+
return await ws(
|
|
3053
|
+
{
|
|
3054
|
+
type: "qp-bridge",
|
|
3055
|
+
action: "getGroup",
|
|
3056
|
+
group: t
|
|
3057
|
+
},
|
|
3058
|
+
e
|
|
3059
|
+
);
|
|
3060
|
+
}
|
|
3061
|
+
async function Ys(t, e, s) {
|
|
3062
|
+
await C(
|
|
3063
|
+
{
|
|
3064
|
+
type: "qp-bridge",
|
|
3065
|
+
action: "setGroup",
|
|
3066
|
+
group: t,
|
|
3067
|
+
groupData: e
|
|
3068
|
+
},
|
|
3069
|
+
s
|
|
3070
|
+
);
|
|
3071
|
+
}
|
|
3072
|
+
function Xs(t, e) {
|
|
3073
|
+
const s = ne(e), n = (a) => {
|
|
3074
|
+
cs(a.data) && a.data.instanceId === s && t(a.data.question, a.data.answer);
|
|
3053
3075
|
};
|
|
3054
|
-
return window.addEventListener("message",
|
|
3076
|
+
return window.addEventListener("message", n), {
|
|
3055
3077
|
cancelSubscription: () => {
|
|
3056
|
-
window.removeEventListener("message",
|
|
3078
|
+
window.removeEventListener("message", n);
|
|
3057
3079
|
}
|
|
3058
3080
|
};
|
|
3059
3081
|
}
|
|
3060
|
-
async function
|
|
3061
|
-
await C(
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3082
|
+
async function Ks(t, e) {
|
|
3083
|
+
await C(
|
|
3084
|
+
{
|
|
3085
|
+
type: "qp-bridge",
|
|
3086
|
+
action: "busyIndicatorStart"
|
|
3087
|
+
},
|
|
3088
|
+
e
|
|
3089
|
+
);
|
|
3065
3090
|
try {
|
|
3066
3091
|
return await t();
|
|
3067
3092
|
} finally {
|
|
3068
|
-
await C(
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3093
|
+
await C(
|
|
3094
|
+
{
|
|
3095
|
+
type: "qp-bridge",
|
|
3096
|
+
action: "busyIndicatorEnd"
|
|
3097
|
+
},
|
|
3098
|
+
e
|
|
3099
|
+
);
|
|
3072
3100
|
}
|
|
3073
3101
|
}
|
|
3074
|
-
async function
|
|
3075
|
-
await C(
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
}
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
type: "qp-bridge",
|
|
3083
|
-
action: "completeAndCloseQuestionnaire"
|
|
3084
|
-
});
|
|
3102
|
+
async function en(t) {
|
|
3103
|
+
await C(
|
|
3104
|
+
{
|
|
3105
|
+
type: "qp-bridge",
|
|
3106
|
+
action: "saveQuestionnaire"
|
|
3107
|
+
},
|
|
3108
|
+
t
|
|
3109
|
+
);
|
|
3085
3110
|
}
|
|
3086
3111
|
async function tn(t) {
|
|
3087
|
-
await C(
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3112
|
+
await C(
|
|
3113
|
+
{
|
|
3114
|
+
type: "qp-bridge",
|
|
3115
|
+
action: "completeAndCloseQuestionnaire"
|
|
3116
|
+
},
|
|
3117
|
+
t
|
|
3118
|
+
);
|
|
3119
|
+
}
|
|
3120
|
+
async function sn(t, e) {
|
|
3121
|
+
await C(
|
|
3122
|
+
{
|
|
3123
|
+
type: "qp-bridge",
|
|
3124
|
+
action: "executeCustomCommand",
|
|
3125
|
+
commandName: t
|
|
3126
|
+
},
|
|
3127
|
+
e
|
|
3128
|
+
);
|
|
3092
3129
|
}
|
|
3093
3130
|
const X = [], K = [], ee = [];
|
|
3094
|
-
function
|
|
3095
|
-
|
|
3131
|
+
function nn(t, e) {
|
|
3132
|
+
const s = ne(e);
|
|
3133
|
+
return ee.some((n) => n.handler === t && n.instanceId === s) || ee.push({ handler: t, instanceId: s }), {
|
|
3096
3134
|
cancelSubscription: () => {
|
|
3097
|
-
const
|
|
3098
|
-
|
|
3135
|
+
const n = ee.findIndex((a) => a.handler === t && a.instanceId === s);
|
|
3136
|
+
n !== -1 && ee.splice(n, 1);
|
|
3099
3137
|
}
|
|
3100
3138
|
};
|
|
3101
3139
|
}
|
|
3102
|
-
function
|
|
3103
|
-
|
|
3140
|
+
function an(t, e) {
|
|
3141
|
+
const s = ne(e);
|
|
3142
|
+
return K.some((n) => n.handler === t && n.instanceId === s) || K.push({ handler: t, instanceId: s }), {
|
|
3104
3143
|
cancelSubscription: () => {
|
|
3105
|
-
const
|
|
3106
|
-
|
|
3144
|
+
const n = K.findIndex((a) => a.handler === t && a.instanceId === s);
|
|
3145
|
+
n !== -1 && K.splice(n, 1);
|
|
3107
3146
|
}
|
|
3108
3147
|
};
|
|
3109
3148
|
}
|
|
3110
|
-
function rn(t) {
|
|
3111
|
-
|
|
3149
|
+
function rn(t, e) {
|
|
3150
|
+
const s = ne(e);
|
|
3151
|
+
return X.some((n) => n.validator === t && n.instanceId === s) || X.push({ validator: t, instanceId: s }), {
|
|
3112
3152
|
cancelSubscription: () => {
|
|
3113
|
-
const
|
|
3114
|
-
|
|
3153
|
+
const n = X.findIndex((a) => a.validator === t && a.instanceId === s);
|
|
3154
|
+
n !== -1 && X.splice(n, 1);
|
|
3115
3155
|
}
|
|
3116
3156
|
};
|
|
3117
3157
|
}
|
|
3118
|
-
async function
|
|
3158
|
+
async function Ye(t) {
|
|
3119
3159
|
try {
|
|
3120
|
-
if (
|
|
3121
|
-
const e = await Promise.all(
|
|
3160
|
+
if (us(t.data) && K.filter((e) => e.instanceId === t.data.instanceId).forEach((e) => e.handler(t.data.commandName)), ds(t.data) && ee.filter((e) => e.instanceId === t.data.instanceId).forEach((e) => e.handler()), ms(t.data)) {
|
|
3161
|
+
const e = X.filter((a) => a.instanceId === t.data.instanceId), s = await Promise.all(e.map((a) => a.validator())), n = {
|
|
3122
3162
|
type: "qp-bridge",
|
|
3123
3163
|
status: "success",
|
|
3124
3164
|
id: t.data.id,
|
|
3125
|
-
|
|
3165
|
+
instanceId: t.data.instanceId,
|
|
3166
|
+
canSave: s.every((a) => a)
|
|
3126
3167
|
};
|
|
3127
|
-
window.parent.postMessage(
|
|
3168
|
+
window.parent.postMessage(n, "*");
|
|
3128
3169
|
}
|
|
3129
3170
|
} catch (e) {
|
|
3130
3171
|
const s = {
|
|
3131
3172
|
type: "qp-bridge",
|
|
3132
3173
|
status: "error",
|
|
3133
|
-
id:
|
|
3174
|
+
id: Se(t.data) ? t.data.id : void 0,
|
|
3175
|
+
instanceId: Se(t.data) ? t.data.instanceId : void 0,
|
|
3134
3176
|
message: e instanceof Error ? e.message : "Unknown error"
|
|
3135
3177
|
};
|
|
3136
3178
|
window.parent.postMessage(s, "*");
|
|
3137
3179
|
}
|
|
3138
3180
|
}
|
|
3139
|
-
async function an(t) {
|
|
3140
|
-
return await ws({
|
|
3141
|
-
type: "qp-bridge",
|
|
3142
|
-
action: "fetchEntities",
|
|
3143
|
-
fetchXml: t
|
|
3144
|
-
});
|
|
3145
|
-
}
|
|
3146
3181
|
async function on(t, e) {
|
|
3147
|
-
return await Ss(
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3182
|
+
return await Ss(
|
|
3183
|
+
{
|
|
3184
|
+
type: "qp-bridge",
|
|
3185
|
+
action: "fetchEntities",
|
|
3186
|
+
fetchXml: t
|
|
3187
|
+
},
|
|
3188
|
+
e
|
|
3189
|
+
);
|
|
3190
|
+
}
|
|
3191
|
+
async function cn(t, e, s) {
|
|
3192
|
+
return await Rs(
|
|
3193
|
+
{
|
|
3194
|
+
type: "qp-bridge",
|
|
3195
|
+
action: "getEntityById",
|
|
3196
|
+
entityName: t,
|
|
3197
|
+
entityId: e
|
|
3198
|
+
},
|
|
3199
|
+
s
|
|
3200
|
+
);
|
|
3201
|
+
}
|
|
3202
|
+
function un() {
|
|
3155
3203
|
return { isNew: !0 };
|
|
3156
3204
|
}
|
|
3157
|
-
async function un(t) {
|
|
3158
|
-
await C({
|
|
3159
|
-
type: "qp-bridge",
|
|
3160
|
-
action: "saveEntity",
|
|
3161
|
-
entity: t
|
|
3162
|
-
});
|
|
3163
|
-
}
|
|
3164
3205
|
async function dn(t, e) {
|
|
3165
|
-
await C(
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3206
|
+
await C(
|
|
3207
|
+
{
|
|
3208
|
+
type: "qp-bridge",
|
|
3209
|
+
action: "saveEntity",
|
|
3210
|
+
entity: t
|
|
3211
|
+
},
|
|
3212
|
+
e
|
|
3213
|
+
);
|
|
3214
|
+
}
|
|
3215
|
+
async function ln(t, e, s) {
|
|
3216
|
+
await C(
|
|
3217
|
+
{
|
|
3218
|
+
type: "qp-bridge",
|
|
3219
|
+
action: "repeatGroup",
|
|
3220
|
+
parentGroupName: t,
|
|
3221
|
+
groupIndex: e
|
|
3222
|
+
},
|
|
3223
|
+
s
|
|
3224
|
+
);
|
|
3178
3225
|
}
|
|
3179
3226
|
async function fn(t, e) {
|
|
3180
|
-
await C(
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3227
|
+
await C(
|
|
3228
|
+
{
|
|
3229
|
+
type: "qp-bridge",
|
|
3230
|
+
action: "addNewGroup",
|
|
3231
|
+
groupName: t
|
|
3232
|
+
},
|
|
3233
|
+
e
|
|
3234
|
+
);
|
|
3235
|
+
}
|
|
3236
|
+
async function hn(t, e, s) {
|
|
3237
|
+
await C(
|
|
3238
|
+
{
|
|
3239
|
+
type: "qp-bridge",
|
|
3240
|
+
action: "deleteGroup",
|
|
3241
|
+
parentGroupName: t,
|
|
3242
|
+
groupIndex: e
|
|
3243
|
+
},
|
|
3244
|
+
s
|
|
3245
|
+
);
|
|
3246
|
+
}
|
|
3247
|
+
async function ae(t, e, s) {
|
|
3248
|
+
return new Promise((n, a) => {
|
|
3249
|
+
const r = ze(), i = ne(s), o = (d) => {
|
|
3250
|
+
if (_s(d.data, r, i))
|
|
3191
3251
|
return;
|
|
3192
|
-
const
|
|
3193
|
-
|
|
3252
|
+
const l = e(d.data);
|
|
3253
|
+
l.success ? n(l.data) : fs(d.data) ? a(new Error(d.data.message)) : a(new Error("Unknown message received")), window.removeEventListener("message", o);
|
|
3194
3254
|
};
|
|
3195
|
-
window.addEventListener("message",
|
|
3255
|
+
window.addEventListener("message", o), window.parent.postMessage({ ...t, id: r, instanceId: i, featureVersion: Ot }, "*");
|
|
3196
3256
|
});
|
|
3197
3257
|
}
|
|
3198
|
-
async function
|
|
3199
|
-
return
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3258
|
+
async function ks(t, e) {
|
|
3259
|
+
return ae(
|
|
3260
|
+
t,
|
|
3261
|
+
(s) => hs(s) ? { success: !0, data: s.question } : { success: !1 },
|
|
3262
|
+
e
|
|
3263
|
+
);
|
|
3264
|
+
}
|
|
3265
|
+
async function ws(t, e) {
|
|
3266
|
+
return ae(
|
|
3267
|
+
t,
|
|
3268
|
+
(s) => ps(s) ? { success: !0, data: s.group } : { success: !1 },
|
|
3269
|
+
e
|
|
3270
|
+
);
|
|
3271
|
+
}
|
|
3272
|
+
function C(t, e) {
|
|
3273
|
+
return ae(
|
|
3274
|
+
t,
|
|
3275
|
+
(s) => ls(s) ? { success: !0, data: void 0 } : { success: !1 },
|
|
3276
|
+
e
|
|
3277
|
+
);
|
|
3278
|
+
}
|
|
3279
|
+
async function Ss(t, e) {
|
|
3280
|
+
return ae(
|
|
3281
|
+
t,
|
|
3282
|
+
(s) => vs(s) ? { success: !0, data: s.entities } : { success: !1 },
|
|
3283
|
+
e
|
|
3284
|
+
);
|
|
3285
|
+
}
|
|
3286
|
+
async function Rs(t, e) {
|
|
3287
|
+
return ae(
|
|
3288
|
+
t,
|
|
3289
|
+
(s) => xs(s) ? { success: !0, data: s.entity } : { success: !1 },
|
|
3290
|
+
e
|
|
3291
|
+
);
|
|
3212
3292
|
}
|
|
3213
3293
|
export {
|
|
3214
3294
|
Ot as QP_BRIDGE_FEATURE_VERSION,
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3295
|
+
fn as addNewGroup,
|
|
3296
|
+
is as addNewGroupRequestMessageSchema,
|
|
3297
|
+
Jt as busyIndicatorEndRequestMessageSchema,
|
|
3298
|
+
Ht as busyIndicatorStartRequestMessageSchema,
|
|
3299
|
+
Qt as canSaveRequestMessageSchema,
|
|
3300
|
+
Gt as canSaveSuccessResponseMessageSchema,
|
|
3301
|
+
Zt as commandExecutedMessageSchema,
|
|
3302
|
+
tn as completeAndCloseQuestionnaire,
|
|
3303
|
+
Xt as completeAndCloseQuestionnaireRequestMessageSchema,
|
|
3224
3304
|
zs as createMediaItem,
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3305
|
+
un as createNewEntity,
|
|
3306
|
+
hn as deleteGroup,
|
|
3307
|
+
os as deleteGroupRequestMessageSchema,
|
|
3308
|
+
Ce as entitySchema,
|
|
3309
|
+
sn as executeCustomCommand,
|
|
3310
|
+
Kt as executeCustomCommandRequestMessageSchema,
|
|
3311
|
+
on as fetchEntities,
|
|
3312
|
+
es as fetchEntitiesRequestMessageSchema,
|
|
3313
|
+
ts as fetchEntitiesSuccessResponseMessageSchema,
|
|
3314
|
+
cn as getEntityById,
|
|
3315
|
+
ss as getEntityByIdRequestMessageSchema,
|
|
3316
|
+
ns as getEntityByIdSuccessResponseMessageSchema,
|
|
3317
|
+
Js as getGroup,
|
|
3318
|
+
Dt as getGroupRequestMessageSchema,
|
|
3239
3319
|
zt as getGroupSuccessResponseMessageSchema,
|
|
3240
|
-
|
|
3241
|
-
|
|
3320
|
+
Ws as getQuestion,
|
|
3321
|
+
Vt as getQuestionRequestMessageSchema,
|
|
3242
3322
|
Ut as getQuestionSuccessResponseMessageSchema,
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3323
|
+
$t as groupOptionalScheme,
|
|
3324
|
+
He as groupSchema,
|
|
3325
|
+
bs as initOnSaveMessageHandler,
|
|
3326
|
+
Bs as isAddNewGroupRequestMessage,
|
|
3327
|
+
ys as isBusyIndicatorEndRequestMessage,
|
|
3328
|
+
gs as isBusyIndicatorStartRequestMessage,
|
|
3329
|
+
ms as isCanSaveRequestMessage,
|
|
3330
|
+
Ms as isCanSaveSuccessResponseMessage,
|
|
3331
|
+
us as isCommandExecutedMessage,
|
|
3332
|
+
js as isCompleteAndCloseQuestionnaireRequestMessage,
|
|
3333
|
+
Ds as isDeleteGroupRequestMessage,
|
|
3334
|
+
fs as isErrorMessage,
|
|
3335
|
+
qs as isExecuteCustomCommandRequestMessage,
|
|
3336
|
+
Ls as isFetchEntitiesRequestMessage,
|
|
3257
3337
|
vs as isFetchEntitiesSuccessResponseMessage,
|
|
3258
|
-
|
|
3259
|
-
|
|
3338
|
+
$s as isGetEntityByIdRequestMessage,
|
|
3339
|
+
xs as isGetEntityByIdSuccessResponseMessage,
|
|
3260
3340
|
Os as isGetGroupRequestMessage,
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3341
|
+
ps as isGetGroupSuccessResponseMessage,
|
|
3342
|
+
Is as isGetQuestionRequestMessage,
|
|
3343
|
+
hs as isGetQuestionSuccessResponseMessage,
|
|
3344
|
+
Ts as isMediaItem,
|
|
3345
|
+
_s as isNotRelevantMessage,
|
|
3346
|
+
cs as isOnAnswerChangeMessage,
|
|
3347
|
+
Se as isQpBridgeMessage,
|
|
3348
|
+
Cs as isQpBridgeRequestMessage,
|
|
3349
|
+
ds as isQuestionnaireLoadedMessage,
|
|
3270
3350
|
Us as isRepeatGroupRequestMessage,
|
|
3271
|
-
|
|
3272
|
-
|
|
3351
|
+
Vs as isSaveEntityRequestMessage,
|
|
3352
|
+
Zs as isSaveQuestionnaireRequestMessage,
|
|
3273
3353
|
Es as isSetAnswerRequestMessage,
|
|
3274
3354
|
Ns as isSetGroupRequestMessage,
|
|
3275
3355
|
As as isSetQuestionRequestMessage,
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3356
|
+
ls as isSuccessMessage,
|
|
3357
|
+
Ps as isWithBusyIndicatorRequestMessage,
|
|
3358
|
+
Lt as mediaItemSchema,
|
|
3359
|
+
Xs as onAnswerChange,
|
|
3360
|
+
Mt as onAnswerChangeMessageSchema,
|
|
3361
|
+
an as onCommandExecuted,
|
|
3362
|
+
nn as onQuestionnaireLoaded,
|
|
3283
3363
|
rn as onSave,
|
|
3284
|
-
|
|
3364
|
+
U as qpBridgeBaseMessageSchema,
|
|
3285
3365
|
S as qpBridgeRequestMessageSchema,
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3366
|
+
Pt as questionOptionalScheme,
|
|
3367
|
+
We as questionSchema,
|
|
3368
|
+
jt as questionnaireLoadedMessageSchema,
|
|
3369
|
+
Qs as removeOnSaveMessageHandler,
|
|
3370
|
+
ln as repeatGroup,
|
|
3291
3371
|
rs as repeatGroupRequestMessageSchema,
|
|
3292
|
-
|
|
3372
|
+
qt as responseErrorMessageSchema,
|
|
3293
3373
|
J as responseSuccessMessageSchema,
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3374
|
+
dn as saveEntity,
|
|
3375
|
+
as as saveEntityRequestMessageSchema,
|
|
3376
|
+
en as saveQuestionnaire,
|
|
3377
|
+
Yt as saveQuestionnaireRequestMessageSchema,
|
|
3378
|
+
Fs as setAnswer,
|
|
3379
|
+
Wt as setAnswerRequestMessageSchema,
|
|
3380
|
+
Ys as setGroup,
|
|
3381
|
+
Ft as setGroupRequestMessageSchema,
|
|
3382
|
+
Hs as setQuestion,
|
|
3383
|
+
Bt as setQuestionRequestMessageSchema,
|
|
3384
|
+
Gs as updateMediaItem,
|
|
3385
|
+
Ks as withBusyIndicator
|
|
3306
3386
|
};
|