@authhero/adapter-interfaces 0.12.0 → 0.14.0
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function dt(t, e) {
|
|
2
2
|
var n = {};
|
|
3
3
|
for (var s in t) Object.prototype.hasOwnProperty.call(t, s) && e.indexOf(s) < 0 && (n[s] = t[s]);
|
|
4
4
|
if (t != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -6,7 +6,7 @@ function ct(t, e) {
|
|
|
6
6
|
e.indexOf(s[a]) < 0 && Object.prototype.propertyIsEnumerable.call(t, s[a]) && (n[s[a]] = t[s[a]]);
|
|
7
7
|
return n;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function ct(t, e) {
|
|
10
10
|
var n;
|
|
11
11
|
return ((n = t == null ? void 0 : t._def) === null || n === void 0 ? void 0 : n.typeName) === e;
|
|
12
12
|
}
|
|
@@ -21,11 +21,11 @@ function lt(t) {
|
|
|
21
21
|
if (typeof t.ZodType.prototype.openapi < "u")
|
|
22
22
|
return;
|
|
23
23
|
t.ZodType.prototype.openapi = function(a, i) {
|
|
24
|
-
var o,
|
|
25
|
-
const z = typeof a == "string" ? i : a, B = z ?? {}, { param: Ue } = B, at =
|
|
24
|
+
var o, d, u, l, m, x;
|
|
25
|
+
const z = typeof a == "string" ? i : a, B = z ?? {}, { param: Ue } = B, at = dt(B, ["param"]), $e = Object.assign(Object.assign({}, (o = this._def.openapi) === null || o === void 0 ? void 0 : o._internal), typeof a == "string" ? { refId: a } : void 0), Ve = Object.assign(Object.assign(Object.assign({}, (d = this._def.openapi) === null || d === void 0 ? void 0 : d.metadata), at), !((l = (u = this._def.openapi) === null || u === void 0 ? void 0 : u.metadata) === null || l === void 0) && l.param || Ue ? {
|
|
26
26
|
param: Object.assign(Object.assign({}, (x = (m = this._def.openapi) === null || m === void 0 ? void 0 : m.metadata) === null || x === void 0 ? void 0 : x.param), Ue)
|
|
27
27
|
} : void 0), Le = new this.constructor(Object.assign(Object.assign({}, this._def), { openapi: Object.assign(Object.assign({}, Object.keys($e).length > 0 ? { _internal: $e } : void 0), Object.keys(Ve).length > 0 ? { metadata: Ve } : void 0) }));
|
|
28
|
-
if (
|
|
28
|
+
if (ct(this, "ZodObject")) {
|
|
29
29
|
const it = this.extend;
|
|
30
30
|
Le.extend = function(...ot) {
|
|
31
31
|
var we, Se, Te, Ee, Ce, Oe;
|
|
@@ -43,9 +43,9 @@ function lt(t) {
|
|
|
43
43
|
const e = t.ZodObject.prototype.deepPartial;
|
|
44
44
|
t.ZodObject.prototype.deepPartial = function() {
|
|
45
45
|
const a = this._def.shape(), i = e.apply(this), o = i._def.shape();
|
|
46
|
-
return Object.entries(o).forEach(([
|
|
46
|
+
return Object.entries(o).forEach(([d, u]) => {
|
|
47
47
|
var l, m;
|
|
48
|
-
u._def.openapi = (m = (l = a[
|
|
48
|
+
u._def.openapi = (m = (l = a[d]) === null || l === void 0 ? void 0 : l._def) === null || m === void 0 ? void 0 : m.openapi;
|
|
49
49
|
}), i._def.openapi = void 0, i;
|
|
50
50
|
};
|
|
51
51
|
const n = t.ZodObject.prototype.pick;
|
|
@@ -75,9 +75,9 @@ var b;
|
|
|
75
75
|
i[o] = o;
|
|
76
76
|
return i;
|
|
77
77
|
}, t.getValidEnumValues = (a) => {
|
|
78
|
-
const i = t.objectKeys(a).filter((
|
|
79
|
-
for (const
|
|
80
|
-
o[
|
|
78
|
+
const i = t.objectKeys(a).filter((d) => typeof a[a[d]] != "number"), o = {};
|
|
79
|
+
for (const d of i)
|
|
80
|
+
o[d] = a[d];
|
|
81
81
|
return t.objectValues(o);
|
|
82
82
|
}, t.objectValues = (a) => t.objectKeys(a).map(function(i) {
|
|
83
83
|
return a[i];
|
|
@@ -146,7 +146,7 @@ const h = b.arrayToEnum([
|
|
|
146
146
|
default:
|
|
147
147
|
return h.unknown;
|
|
148
148
|
}
|
|
149
|
-
},
|
|
149
|
+
}, c = b.arrayToEnum([
|
|
150
150
|
"invalid_type",
|
|
151
151
|
"invalid_literal",
|
|
152
152
|
"custom",
|
|
@@ -191,10 +191,10 @@ class T extends Error {
|
|
|
191
191
|
else if (o.path.length === 0)
|
|
192
192
|
s._errors.push(n(o));
|
|
193
193
|
else {
|
|
194
|
-
let
|
|
194
|
+
let d = s, u = 0;
|
|
195
195
|
for (; u < o.path.length; ) {
|
|
196
196
|
const l = o.path[u];
|
|
197
|
-
u === o.path.length - 1 ? (
|
|
197
|
+
u === o.path.length - 1 ? (d[l] = d[l] || { _errors: [] }, d[l]._errors.push(n(o))) : d[l] = d[l] || { _errors: [] }, d = d[l], u++;
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
};
|
|
@@ -227,52 +227,52 @@ T.create = (t) => new T(t);
|
|
|
227
227
|
const F = (t, e) => {
|
|
228
228
|
let n;
|
|
229
229
|
switch (t.code) {
|
|
230
|
-
case
|
|
230
|
+
case c.invalid_type:
|
|
231
231
|
t.received === h.undefined ? n = "Required" : n = `Expected ${t.expected}, received ${t.received}`;
|
|
232
232
|
break;
|
|
233
|
-
case
|
|
233
|
+
case c.invalid_literal:
|
|
234
234
|
n = `Invalid literal value, expected ${JSON.stringify(t.expected, b.jsonStringifyReplacer)}`;
|
|
235
235
|
break;
|
|
236
|
-
case
|
|
236
|
+
case c.unrecognized_keys:
|
|
237
237
|
n = `Unrecognized key(s) in object: ${b.joinValues(t.keys, ", ")}`;
|
|
238
238
|
break;
|
|
239
|
-
case
|
|
239
|
+
case c.invalid_union:
|
|
240
240
|
n = "Invalid input";
|
|
241
241
|
break;
|
|
242
|
-
case
|
|
242
|
+
case c.invalid_union_discriminator:
|
|
243
243
|
n = `Invalid discriminator value. Expected ${b.joinValues(t.options)}`;
|
|
244
244
|
break;
|
|
245
|
-
case
|
|
245
|
+
case c.invalid_enum_value:
|
|
246
246
|
n = `Invalid enum value. Expected ${b.joinValues(t.options)}, received '${t.received}'`;
|
|
247
247
|
break;
|
|
248
|
-
case
|
|
248
|
+
case c.invalid_arguments:
|
|
249
249
|
n = "Invalid function arguments";
|
|
250
250
|
break;
|
|
251
|
-
case
|
|
251
|
+
case c.invalid_return_type:
|
|
252
252
|
n = "Invalid function return type";
|
|
253
253
|
break;
|
|
254
|
-
case
|
|
254
|
+
case c.invalid_date:
|
|
255
255
|
n = "Invalid date";
|
|
256
256
|
break;
|
|
257
|
-
case
|
|
257
|
+
case c.invalid_string:
|
|
258
258
|
typeof t.validation == "object" ? "includes" in t.validation ? (n = `Invalid input: must include "${t.validation.includes}"`, typeof t.validation.position == "number" && (n = `${n} at one or more positions greater than or equal to ${t.validation.position}`)) : "startsWith" in t.validation ? n = `Invalid input: must start with "${t.validation.startsWith}"` : "endsWith" in t.validation ? n = `Invalid input: must end with "${t.validation.endsWith}"` : b.assertNever(t.validation) : t.validation !== "regex" ? n = `Invalid ${t.validation}` : n = "Invalid";
|
|
259
259
|
break;
|
|
260
|
-
case
|
|
260
|
+
case c.too_small:
|
|
261
261
|
t.type === "array" ? n = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "more than"} ${t.minimum} element(s)` : t.type === "string" ? n = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "over"} ${t.minimum} character(s)` : t.type === "number" ? n = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${t.minimum}` : t.type === "date" ? n = `Date must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(t.minimum))}` : n = "Invalid input";
|
|
262
262
|
break;
|
|
263
|
-
case
|
|
263
|
+
case c.too_big:
|
|
264
264
|
t.type === "array" ? n = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at most" : "less than"} ${t.maximum} element(s)` : t.type === "string" ? n = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at most" : "under"} ${t.maximum} character(s)` : t.type === "number" ? n = `Number must be ${t.exact ? "exactly" : t.inclusive ? "less than or equal to" : "less than"} ${t.maximum}` : t.type === "bigint" ? n = `BigInt must be ${t.exact ? "exactly" : t.inclusive ? "less than or equal to" : "less than"} ${t.maximum}` : t.type === "date" ? n = `Date must be ${t.exact ? "exactly" : t.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(t.maximum))}` : n = "Invalid input";
|
|
265
265
|
break;
|
|
266
|
-
case
|
|
266
|
+
case c.custom:
|
|
267
267
|
n = "Invalid input";
|
|
268
268
|
break;
|
|
269
|
-
case
|
|
269
|
+
case c.invalid_intersection_types:
|
|
270
270
|
n = "Intersection results could not be merged";
|
|
271
271
|
break;
|
|
272
|
-
case
|
|
272
|
+
case c.not_multiple_of:
|
|
273
273
|
n = `Number must be a multiple of ${t.multipleOf}`;
|
|
274
274
|
break;
|
|
275
|
-
case
|
|
275
|
+
case c.not_finite:
|
|
276
276
|
n = "Number must be finite";
|
|
277
277
|
break;
|
|
278
278
|
default:
|
|
@@ -298,14 +298,14 @@ const _e = (t) => {
|
|
|
298
298
|
path: i,
|
|
299
299
|
message: a.message
|
|
300
300
|
};
|
|
301
|
-
let
|
|
301
|
+
let d = "";
|
|
302
302
|
const u = s.filter((l) => !!l).slice().reverse();
|
|
303
303
|
for (const l of u)
|
|
304
|
-
|
|
304
|
+
d = l(o, { data: e, defaultError: d }).message;
|
|
305
305
|
return {
|
|
306
306
|
...a,
|
|
307
307
|
path: i,
|
|
308
|
-
message:
|
|
308
|
+
message: d
|
|
309
309
|
};
|
|
310
310
|
}, ht = [];
|
|
311
311
|
function p(t, e) {
|
|
@@ -366,12 +366,12 @@ class w {
|
|
|
366
366
|
}
|
|
367
367
|
const g = Object.freeze({
|
|
368
368
|
status: "aborted"
|
|
369
|
-
}),
|
|
369
|
+
}), G = (t) => ({ status: "dirty", value: t }), S = (t) => ({ status: "valid", value: t }), Ze = (t) => t.status === "aborted", Re = (t) => t.status === "dirty", ee = (t) => t.status === "valid", te = (t) => typeof Promise < "u" && t instanceof Promise;
|
|
370
370
|
function ge(t, e, n, s) {
|
|
371
371
|
if (typeof e == "function" ? t !== e || !s : !e.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
372
372
|
return e.get(t);
|
|
373
373
|
}
|
|
374
|
-
function
|
|
374
|
+
function He(t, e, n, s, a) {
|
|
375
375
|
if (typeof e == "function" ? t !== e || !a : !e.has(t)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
376
376
|
return e.set(t, n), n;
|
|
377
377
|
}
|
|
@@ -409,10 +409,10 @@ function y(t) {
|
|
|
409
409
|
const { errorMap: e, invalid_type_error: n, required_error: s, description: a } = t;
|
|
410
410
|
if (e && (n || s))
|
|
411
411
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
412
|
-
return e ? { errorMap: e, description: a } : { errorMap: (o,
|
|
412
|
+
return e ? { errorMap: e, description: a } : { errorMap: (o, d) => {
|
|
413
413
|
var u, l;
|
|
414
414
|
const { message: m } = t;
|
|
415
|
-
return o.code === "invalid_enum_value" ? { message: m ??
|
|
415
|
+
return o.code === "invalid_enum_value" ? { message: m ?? d.defaultError } : typeof d.data > "u" ? { message: (u = m ?? s) !== null && u !== void 0 ? u : d.defaultError } : o.code !== "invalid_type" ? { message: d.defaultError } : { message: (l = m ?? n) !== null && l !== void 0 ? l : d.defaultError };
|
|
416
416
|
}, description: a };
|
|
417
417
|
}
|
|
418
418
|
class v {
|
|
@@ -504,11 +504,11 @@ class v {
|
|
|
504
504
|
refine(e, n) {
|
|
505
505
|
const s = (a) => typeof n == "string" || typeof n > "u" ? { message: n } : typeof n == "function" ? n(a) : n;
|
|
506
506
|
return this._refinement((a, i) => {
|
|
507
|
-
const o = e(a),
|
|
508
|
-
code:
|
|
507
|
+
const o = e(a), d = () => i.addIssue({
|
|
508
|
+
code: c.custom,
|
|
509
509
|
...s(a)
|
|
510
510
|
});
|
|
511
|
-
return typeof Promise < "u" && o instanceof Promise ? o.then((u) => u ? !0 : (
|
|
511
|
+
return typeof Promise < "u" && o instanceof Promise ? o.then((u) => u ? !0 : (d(), !1)) : o ? !0 : (d(), !1);
|
|
512
512
|
});
|
|
513
513
|
}
|
|
514
514
|
refinement(e, n) {
|
|
@@ -600,7 +600,7 @@ class v {
|
|
|
600
600
|
}
|
|
601
601
|
const ft = /^c[^\s-]{8,}$/i, mt = /^[0-9a-z]+$/, _t = /^[0-9A-HJKMNP-TV-Z]{26}$/, gt = /^[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, yt = /^[a-z0-9_-]{21}$/i, vt = /^[-+]?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)?)??$/, bt = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, kt = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
602
602
|
let Ie;
|
|
603
|
-
const xt = /^(?:(?: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])$/, wt = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/, St = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,
|
|
603
|
+
const xt = /^(?:(?: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])$/, wt = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/, St = /^([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])))", Tt = new RegExp(`^${Ge}$`);
|
|
604
604
|
function qe(t) {
|
|
605
605
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
606
606
|
return t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
@@ -609,7 +609,7 @@ function Et(t) {
|
|
|
609
609
|
return new RegExp(`^${qe(t)}$`);
|
|
610
610
|
}
|
|
611
611
|
function Fe(t) {
|
|
612
|
-
let e = `${
|
|
612
|
+
let e = `${Ge}T${qe(t)}`;
|
|
613
613
|
const n = [];
|
|
614
614
|
return n.push(t.local ? "Z?" : "Z"), t.offset && n.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${n.join("|")})`, new RegExp(`^${e}$`);
|
|
615
615
|
}
|
|
@@ -621,7 +621,7 @@ class E extends v {
|
|
|
621
621
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== h.string) {
|
|
622
622
|
const i = this._getOrReturnCtx(e);
|
|
623
623
|
return p(i, {
|
|
624
|
-
code:
|
|
624
|
+
code: c.invalid_type,
|
|
625
625
|
expected: h.string,
|
|
626
626
|
received: i.parsedType
|
|
627
627
|
}), g;
|
|
@@ -631,7 +631,7 @@ class E extends v {
|
|
|
631
631
|
for (const i of this._def.checks)
|
|
632
632
|
if (i.kind === "min")
|
|
633
633
|
e.data.length < i.value && (a = this._getOrReturnCtx(e, a), p(a, {
|
|
634
|
-
code:
|
|
634
|
+
code: c.too_small,
|
|
635
635
|
minimum: i.value,
|
|
636
636
|
type: "string",
|
|
637
637
|
inclusive: !0,
|
|
@@ -640,7 +640,7 @@ class E extends v {
|
|
|
640
640
|
}), s.dirty());
|
|
641
641
|
else if (i.kind === "max")
|
|
642
642
|
e.data.length > i.value && (a = this._getOrReturnCtx(e, a), p(a, {
|
|
643
|
-
code:
|
|
643
|
+
code: c.too_big,
|
|
644
644
|
maximum: i.value,
|
|
645
645
|
type: "string",
|
|
646
646
|
inclusive: !0,
|
|
@@ -648,16 +648,16 @@ class E extends v {
|
|
|
648
648
|
message: i.message
|
|
649
649
|
}), s.dirty());
|
|
650
650
|
else if (i.kind === "length") {
|
|
651
|
-
const o = e.data.length > i.value,
|
|
652
|
-
(o ||
|
|
653
|
-
code:
|
|
651
|
+
const o = e.data.length > i.value, d = e.data.length < i.value;
|
|
652
|
+
(o || d) && (a = this._getOrReturnCtx(e, a), o ? p(a, {
|
|
653
|
+
code: c.too_big,
|
|
654
654
|
maximum: i.value,
|
|
655
655
|
type: "string",
|
|
656
656
|
inclusive: !0,
|
|
657
657
|
exact: !0,
|
|
658
658
|
message: i.message
|
|
659
|
-
}) :
|
|
660
|
-
code:
|
|
659
|
+
}) : d && p(a, {
|
|
660
|
+
code: c.too_small,
|
|
661
661
|
minimum: i.value,
|
|
662
662
|
type: "string",
|
|
663
663
|
inclusive: !0,
|
|
@@ -667,43 +667,43 @@ class E extends v {
|
|
|
667
667
|
} else if (i.kind === "email")
|
|
668
668
|
bt.test(e.data) || (a = this._getOrReturnCtx(e, a), p(a, {
|
|
669
669
|
validation: "email",
|
|
670
|
-
code:
|
|
670
|
+
code: c.invalid_string,
|
|
671
671
|
message: i.message
|
|
672
672
|
}), s.dirty());
|
|
673
673
|
else if (i.kind === "emoji")
|
|
674
674
|
Ie || (Ie = new RegExp(kt, "u")), Ie.test(e.data) || (a = this._getOrReturnCtx(e, a), p(a, {
|
|
675
675
|
validation: "emoji",
|
|
676
|
-
code:
|
|
676
|
+
code: c.invalid_string,
|
|
677
677
|
message: i.message
|
|
678
678
|
}), s.dirty());
|
|
679
679
|
else if (i.kind === "uuid")
|
|
680
680
|
gt.test(e.data) || (a = this._getOrReturnCtx(e, a), p(a, {
|
|
681
681
|
validation: "uuid",
|
|
682
|
-
code:
|
|
682
|
+
code: c.invalid_string,
|
|
683
683
|
message: i.message
|
|
684
684
|
}), s.dirty());
|
|
685
685
|
else if (i.kind === "nanoid")
|
|
686
686
|
yt.test(e.data) || (a = this._getOrReturnCtx(e, a), p(a, {
|
|
687
687
|
validation: "nanoid",
|
|
688
|
-
code:
|
|
688
|
+
code: c.invalid_string,
|
|
689
689
|
message: i.message
|
|
690
690
|
}), s.dirty());
|
|
691
691
|
else if (i.kind === "cuid")
|
|
692
692
|
ft.test(e.data) || (a = this._getOrReturnCtx(e, a), p(a, {
|
|
693
693
|
validation: "cuid",
|
|
694
|
-
code:
|
|
694
|
+
code: c.invalid_string,
|
|
695
695
|
message: i.message
|
|
696
696
|
}), s.dirty());
|
|
697
697
|
else if (i.kind === "cuid2")
|
|
698
698
|
mt.test(e.data) || (a = this._getOrReturnCtx(e, a), p(a, {
|
|
699
699
|
validation: "cuid2",
|
|
700
|
-
code:
|
|
700
|
+
code: c.invalid_string,
|
|
701
701
|
message: i.message
|
|
702
702
|
}), s.dirty());
|
|
703
703
|
else if (i.kind === "ulid")
|
|
704
704
|
_t.test(e.data) || (a = this._getOrReturnCtx(e, a), p(a, {
|
|
705
705
|
validation: "ulid",
|
|
706
|
-
code:
|
|
706
|
+
code: c.invalid_string,
|
|
707
707
|
message: i.message
|
|
708
708
|
}), s.dirty());
|
|
709
709
|
else if (i.kind === "url")
|
|
@@ -712,49 +712,49 @@ class E extends v {
|
|
|
712
712
|
} catch {
|
|
713
713
|
a = this._getOrReturnCtx(e, a), p(a, {
|
|
714
714
|
validation: "url",
|
|
715
|
-
code:
|
|
715
|
+
code: c.invalid_string,
|
|
716
716
|
message: i.message
|
|
717
717
|
}), s.dirty();
|
|
718
718
|
}
|
|
719
719
|
else i.kind === "regex" ? (i.regex.lastIndex = 0, i.regex.test(e.data) || (a = this._getOrReturnCtx(e, a), p(a, {
|
|
720
720
|
validation: "regex",
|
|
721
|
-
code:
|
|
721
|
+
code: c.invalid_string,
|
|
722
722
|
message: i.message
|
|
723
723
|
}), s.dirty())) : i.kind === "trim" ? e.data = e.data.trim() : i.kind === "includes" ? e.data.includes(i.value, i.position) || (a = this._getOrReturnCtx(e, a), p(a, {
|
|
724
|
-
code:
|
|
724
|
+
code: c.invalid_string,
|
|
725
725
|
validation: { includes: i.value, position: i.position },
|
|
726
726
|
message: i.message
|
|
727
727
|
}), s.dirty()) : i.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : i.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : i.kind === "startsWith" ? e.data.startsWith(i.value) || (a = this._getOrReturnCtx(e, a), p(a, {
|
|
728
|
-
code:
|
|
728
|
+
code: c.invalid_string,
|
|
729
729
|
validation: { startsWith: i.value },
|
|
730
730
|
message: i.message
|
|
731
731
|
}), s.dirty()) : i.kind === "endsWith" ? e.data.endsWith(i.value) || (a = this._getOrReturnCtx(e, a), p(a, {
|
|
732
|
-
code:
|
|
732
|
+
code: c.invalid_string,
|
|
733
733
|
validation: { endsWith: i.value },
|
|
734
734
|
message: i.message
|
|
735
735
|
}), s.dirty()) : i.kind === "datetime" ? Fe(i).test(e.data) || (a = this._getOrReturnCtx(e, a), p(a, {
|
|
736
|
-
code:
|
|
736
|
+
code: c.invalid_string,
|
|
737
737
|
validation: "datetime",
|
|
738
738
|
message: i.message
|
|
739
739
|
}), s.dirty()) : i.kind === "date" ? Tt.test(e.data) || (a = this._getOrReturnCtx(e, a), p(a, {
|
|
740
|
-
code:
|
|
740
|
+
code: c.invalid_string,
|
|
741
741
|
validation: "date",
|
|
742
742
|
message: i.message
|
|
743
743
|
}), s.dirty()) : i.kind === "time" ? Et(i).test(e.data) || (a = this._getOrReturnCtx(e, a), p(a, {
|
|
744
|
-
code:
|
|
744
|
+
code: c.invalid_string,
|
|
745
745
|
validation: "time",
|
|
746
746
|
message: i.message
|
|
747
747
|
}), s.dirty()) : i.kind === "duration" ? vt.test(e.data) || (a = this._getOrReturnCtx(e, a), p(a, {
|
|
748
748
|
validation: "duration",
|
|
749
|
-
code:
|
|
749
|
+
code: c.invalid_string,
|
|
750
750
|
message: i.message
|
|
751
751
|
}), s.dirty()) : i.kind === "ip" ? Ct(e.data, i.version) || (a = this._getOrReturnCtx(e, a), p(a, {
|
|
752
752
|
validation: "ip",
|
|
753
|
-
code:
|
|
753
|
+
code: c.invalid_string,
|
|
754
754
|
message: i.message
|
|
755
755
|
}), s.dirty()) : i.kind === "base64" ? St.test(e.data) || (a = this._getOrReturnCtx(e, a), p(a, {
|
|
756
756
|
validation: "base64",
|
|
757
|
-
code:
|
|
757
|
+
code: c.invalid_string,
|
|
758
758
|
message: i.message
|
|
759
759
|
}), s.dirty()) : b.assertNever(i);
|
|
760
760
|
return { status: s.value, value: e.data };
|
|
@@ -762,7 +762,7 @@ class E extends v {
|
|
|
762
762
|
_regex(e, n, s) {
|
|
763
763
|
return this.refinement((a) => e.test(a), {
|
|
764
764
|
validation: n,
|
|
765
|
-
code:
|
|
765
|
+
code: c.invalid_string,
|
|
766
766
|
...f.errToObj(s)
|
|
767
767
|
});
|
|
768
768
|
}
|
|
@@ -986,7 +986,7 @@ class P extends v {
|
|
|
986
986
|
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== h.number) {
|
|
987
987
|
const i = this._getOrReturnCtx(e);
|
|
988
988
|
return p(i, {
|
|
989
|
-
code:
|
|
989
|
+
code: c.invalid_type,
|
|
990
990
|
expected: h.number,
|
|
991
991
|
received: i.parsedType
|
|
992
992
|
}), g;
|
|
@@ -995,30 +995,30 @@ class P extends v {
|
|
|
995
995
|
const a = new w();
|
|
996
996
|
for (const i of this._def.checks)
|
|
997
997
|
i.kind === "int" ? b.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
|
|
998
|
-
code:
|
|
998
|
+
code: c.invalid_type,
|
|
999
999
|
expected: "integer",
|
|
1000
1000
|
received: "float",
|
|
1001
1001
|
message: i.message
|
|
1002
1002
|
}), a.dirty()) : i.kind === "min" ? (i.inclusive ? e.data < i.value : e.data <= i.value) && (s = this._getOrReturnCtx(e, s), p(s, {
|
|
1003
|
-
code:
|
|
1003
|
+
code: c.too_small,
|
|
1004
1004
|
minimum: i.value,
|
|
1005
1005
|
type: "number",
|
|
1006
1006
|
inclusive: i.inclusive,
|
|
1007
1007
|
exact: !1,
|
|
1008
1008
|
message: i.message
|
|
1009
1009
|
}), a.dirty()) : i.kind === "max" ? (i.inclusive ? e.data > i.value : e.data >= i.value) && (s = this._getOrReturnCtx(e, s), p(s, {
|
|
1010
|
-
code:
|
|
1010
|
+
code: c.too_big,
|
|
1011
1011
|
maximum: i.value,
|
|
1012
1012
|
type: "number",
|
|
1013
1013
|
inclusive: i.inclusive,
|
|
1014
1014
|
exact: !1,
|
|
1015
1015
|
message: i.message
|
|
1016
1016
|
}), a.dirty()) : i.kind === "multipleOf" ? Ot(e.data, i.value) !== 0 && (s = this._getOrReturnCtx(e, s), p(s, {
|
|
1017
|
-
code:
|
|
1017
|
+
code: c.not_multiple_of,
|
|
1018
1018
|
multipleOf: i.value,
|
|
1019
1019
|
message: i.message
|
|
1020
1020
|
}), a.dirty()) : i.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
|
|
1021
|
-
code:
|
|
1021
|
+
code: c.not_finite,
|
|
1022
1022
|
message: i.message
|
|
1023
1023
|
}), a.dirty()) : b.assertNever(i);
|
|
1024
1024
|
return { status: a.value, value: e.data };
|
|
@@ -1158,7 +1158,7 @@ class M extends v {
|
|
|
1158
1158
|
if (this._def.coerce && (e.data = BigInt(e.data)), this._getType(e) !== h.bigint) {
|
|
1159
1159
|
const i = this._getOrReturnCtx(e);
|
|
1160
1160
|
return p(i, {
|
|
1161
|
-
code:
|
|
1161
|
+
code: c.invalid_type,
|
|
1162
1162
|
expected: h.bigint,
|
|
1163
1163
|
received: i.parsedType
|
|
1164
1164
|
}), g;
|
|
@@ -1167,19 +1167,19 @@ class M extends v {
|
|
|
1167
1167
|
const a = new w();
|
|
1168
1168
|
for (const i of this._def.checks)
|
|
1169
1169
|
i.kind === "min" ? (i.inclusive ? e.data < i.value : e.data <= i.value) && (s = this._getOrReturnCtx(e, s), p(s, {
|
|
1170
|
-
code:
|
|
1170
|
+
code: c.too_small,
|
|
1171
1171
|
type: "bigint",
|
|
1172
1172
|
minimum: i.value,
|
|
1173
1173
|
inclusive: i.inclusive,
|
|
1174
1174
|
message: i.message
|
|
1175
1175
|
}), a.dirty()) : i.kind === "max" ? (i.inclusive ? e.data > i.value : e.data >= i.value) && (s = this._getOrReturnCtx(e, s), p(s, {
|
|
1176
|
-
code:
|
|
1176
|
+
code: c.too_big,
|
|
1177
1177
|
type: "bigint",
|
|
1178
1178
|
maximum: i.value,
|
|
1179
1179
|
inclusive: i.inclusive,
|
|
1180
1180
|
message: i.message
|
|
1181
1181
|
}), a.dirty()) : i.kind === "multipleOf" ? e.data % i.value !== BigInt(0) && (s = this._getOrReturnCtx(e, s), p(s, {
|
|
1182
|
-
code:
|
|
1182
|
+
code: c.not_multiple_of,
|
|
1183
1183
|
multipleOf: i.value,
|
|
1184
1184
|
message: i.message
|
|
1185
1185
|
}), a.dirty()) : b.assertNever(i);
|
|
@@ -1283,7 +1283,7 @@ class ne extends v {
|
|
|
1283
1283
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== h.boolean) {
|
|
1284
1284
|
const s = this._getOrReturnCtx(e);
|
|
1285
1285
|
return p(s, {
|
|
1286
|
-
code:
|
|
1286
|
+
code: c.invalid_type,
|
|
1287
1287
|
expected: h.boolean,
|
|
1288
1288
|
received: s.parsedType
|
|
1289
1289
|
}), g;
|
|
@@ -1301,7 +1301,7 @@ class V extends v {
|
|
|
1301
1301
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== h.date) {
|
|
1302
1302
|
const i = this._getOrReturnCtx(e);
|
|
1303
1303
|
return p(i, {
|
|
1304
|
-
code:
|
|
1304
|
+
code: c.invalid_type,
|
|
1305
1305
|
expected: h.date,
|
|
1306
1306
|
received: i.parsedType
|
|
1307
1307
|
}), g;
|
|
@@ -1309,21 +1309,21 @@ class V extends v {
|
|
|
1309
1309
|
if (isNaN(e.data.getTime())) {
|
|
1310
1310
|
const i = this._getOrReturnCtx(e);
|
|
1311
1311
|
return p(i, {
|
|
1312
|
-
code:
|
|
1312
|
+
code: c.invalid_date
|
|
1313
1313
|
}), g;
|
|
1314
1314
|
}
|
|
1315
1315
|
const s = new w();
|
|
1316
1316
|
let a;
|
|
1317
1317
|
for (const i of this._def.checks)
|
|
1318
1318
|
i.kind === "min" ? e.data.getTime() < i.value && (a = this._getOrReturnCtx(e, a), p(a, {
|
|
1319
|
-
code:
|
|
1319
|
+
code: c.too_small,
|
|
1320
1320
|
message: i.message,
|
|
1321
1321
|
inclusive: !0,
|
|
1322
1322
|
exact: !1,
|
|
1323
1323
|
minimum: i.value,
|
|
1324
1324
|
type: "date"
|
|
1325
1325
|
}), s.dirty()) : i.kind === "max" ? e.data.getTime() > i.value && (a = this._getOrReturnCtx(e, a), p(a, {
|
|
1326
|
-
code:
|
|
1326
|
+
code: c.too_big,
|
|
1327
1327
|
message: i.message,
|
|
1328
1328
|
inclusive: !0,
|
|
1329
1329
|
exact: !1,
|
|
@@ -1379,7 +1379,7 @@ class ye extends v {
|
|
|
1379
1379
|
if (this._getType(e) !== h.symbol) {
|
|
1380
1380
|
const s = this._getOrReturnCtx(e);
|
|
1381
1381
|
return p(s, {
|
|
1382
|
-
code:
|
|
1382
|
+
code: c.invalid_type,
|
|
1383
1383
|
expected: h.symbol,
|
|
1384
1384
|
received: s.parsedType
|
|
1385
1385
|
}), g;
|
|
@@ -1396,7 +1396,7 @@ class re extends v {
|
|
|
1396
1396
|
if (this._getType(e) !== h.undefined) {
|
|
1397
1397
|
const s = this._getOrReturnCtx(e);
|
|
1398
1398
|
return p(s, {
|
|
1399
|
-
code:
|
|
1399
|
+
code: c.invalid_type,
|
|
1400
1400
|
expected: h.undefined,
|
|
1401
1401
|
received: s.parsedType
|
|
1402
1402
|
}), g;
|
|
@@ -1413,7 +1413,7 @@ class se extends v {
|
|
|
1413
1413
|
if (this._getType(e) !== h.null) {
|
|
1414
1414
|
const s = this._getOrReturnCtx(e);
|
|
1415
1415
|
return p(s, {
|
|
1416
|
-
code:
|
|
1416
|
+
code: c.invalid_type,
|
|
1417
1417
|
expected: h.null,
|
|
1418
1418
|
received: s.parsedType
|
|
1419
1419
|
}), g;
|
|
@@ -1453,7 +1453,7 @@ class R extends v {
|
|
|
1453
1453
|
_parse(e) {
|
|
1454
1454
|
const n = this._getOrReturnCtx(e);
|
|
1455
1455
|
return p(n, {
|
|
1456
|
-
code:
|
|
1456
|
+
code: c.invalid_type,
|
|
1457
1457
|
expected: h.never,
|
|
1458
1458
|
received: n.parsedType
|
|
1459
1459
|
}), g;
|
|
@@ -1468,7 +1468,7 @@ class ve extends v {
|
|
|
1468
1468
|
if (this._getType(e) !== h.undefined) {
|
|
1469
1469
|
const s = this._getOrReturnCtx(e);
|
|
1470
1470
|
return p(s, {
|
|
1471
|
-
code:
|
|
1471
|
+
code: c.invalid_type,
|
|
1472
1472
|
expected: h.void,
|
|
1473
1473
|
received: s.parsedType
|
|
1474
1474
|
}), g;
|
|
@@ -1485,15 +1485,15 @@ class C extends v {
|
|
|
1485
1485
|
const { ctx: n, status: s } = this._processInputParams(e), a = this._def;
|
|
1486
1486
|
if (n.parsedType !== h.array)
|
|
1487
1487
|
return p(n, {
|
|
1488
|
-
code:
|
|
1488
|
+
code: c.invalid_type,
|
|
1489
1489
|
expected: h.array,
|
|
1490
1490
|
received: n.parsedType
|
|
1491
1491
|
}), g;
|
|
1492
1492
|
if (a.exactLength !== null) {
|
|
1493
|
-
const o = n.data.length > a.exactLength.value,
|
|
1494
|
-
(o ||
|
|
1495
|
-
code: o ?
|
|
1496
|
-
minimum:
|
|
1493
|
+
const o = n.data.length > a.exactLength.value, d = n.data.length < a.exactLength.value;
|
|
1494
|
+
(o || d) && (p(n, {
|
|
1495
|
+
code: o ? c.too_big : c.too_small,
|
|
1496
|
+
minimum: d ? a.exactLength.value : void 0,
|
|
1497
1497
|
maximum: o ? a.exactLength.value : void 0,
|
|
1498
1498
|
type: "array",
|
|
1499
1499
|
inclusive: !0,
|
|
@@ -1502,22 +1502,22 @@ class C extends v {
|
|
|
1502
1502
|
}), s.dirty());
|
|
1503
1503
|
}
|
|
1504
1504
|
if (a.minLength !== null && n.data.length < a.minLength.value && (p(n, {
|
|
1505
|
-
code:
|
|
1505
|
+
code: c.too_small,
|
|
1506
1506
|
minimum: a.minLength.value,
|
|
1507
1507
|
type: "array",
|
|
1508
1508
|
inclusive: !0,
|
|
1509
1509
|
exact: !1,
|
|
1510
1510
|
message: a.minLength.message
|
|
1511
1511
|
}), s.dirty()), a.maxLength !== null && n.data.length > a.maxLength.value && (p(n, {
|
|
1512
|
-
code:
|
|
1512
|
+
code: c.too_big,
|
|
1513
1513
|
maximum: a.maxLength.value,
|
|
1514
1514
|
type: "array",
|
|
1515
1515
|
inclusive: !0,
|
|
1516
1516
|
exact: !1,
|
|
1517
1517
|
message: a.maxLength.message
|
|
1518
1518
|
}), s.dirty()), n.common.async)
|
|
1519
|
-
return Promise.all([...n.data].map((o,
|
|
1520
|
-
const i = [...n.data].map((o,
|
|
1519
|
+
return Promise.all([...n.data].map((o, d) => a.type._parseAsync(new I(n, o, n.path, d)))).then((o) => w.mergeArray(s, o));
|
|
1520
|
+
const i = [...n.data].map((o, d) => a.type._parseSync(new I(n, o, n.path, d)));
|
|
1521
1521
|
return w.mergeArray(s, i);
|
|
1522
1522
|
}
|
|
1523
1523
|
get element() {
|
|
@@ -1553,12 +1553,12 @@ C.create = (t, e) => new C({
|
|
|
1553
1553
|
typeName: _.ZodArray,
|
|
1554
1554
|
...y(e)
|
|
1555
1555
|
});
|
|
1556
|
-
function
|
|
1556
|
+
function H(t) {
|
|
1557
1557
|
if (t instanceof k) {
|
|
1558
1558
|
const e = {};
|
|
1559
1559
|
for (const n in t.shape) {
|
|
1560
1560
|
const s = t.shape[n];
|
|
1561
|
-
e[n] = j.create(
|
|
1561
|
+
e[n] = j.create(H(s));
|
|
1562
1562
|
}
|
|
1563
1563
|
return new k({
|
|
1564
1564
|
...t._def,
|
|
@@ -1566,8 +1566,8 @@ function G(t) {
|
|
|
1566
1566
|
});
|
|
1567
1567
|
} else return t instanceof C ? new C({
|
|
1568
1568
|
...t._def,
|
|
1569
|
-
type:
|
|
1570
|
-
}) : t instanceof j ? j.create(
|
|
1569
|
+
type: H(t.element)
|
|
1570
|
+
}) : t instanceof j ? j.create(H(t.unwrap())) : t instanceof U ? U.create(H(t.unwrap())) : t instanceof N ? N.create(t.items.map((e) => H(e))) : t;
|
|
1571
1571
|
}
|
|
1572
1572
|
class k extends v {
|
|
1573
1573
|
constructor() {
|
|
@@ -1583,15 +1583,15 @@ class k extends v {
|
|
|
1583
1583
|
if (this._getType(e) !== h.object) {
|
|
1584
1584
|
const l = this._getOrReturnCtx(e);
|
|
1585
1585
|
return p(l, {
|
|
1586
|
-
code:
|
|
1586
|
+
code: c.invalid_type,
|
|
1587
1587
|
expected: h.object,
|
|
1588
1588
|
received: l.parsedType
|
|
1589
1589
|
}), g;
|
|
1590
1590
|
}
|
|
1591
|
-
const { status: s, ctx: a } = this._processInputParams(e), { shape: i, keys: o } = this._getCached(),
|
|
1591
|
+
const { status: s, ctx: a } = this._processInputParams(e), { shape: i, keys: o } = this._getCached(), d = [];
|
|
1592
1592
|
if (!(this._def.catchall instanceof R && this._def.unknownKeys === "strip"))
|
|
1593
1593
|
for (const l in a.data)
|
|
1594
|
-
o.includes(l) ||
|
|
1594
|
+
o.includes(l) || d.push(l);
|
|
1595
1595
|
const u = [];
|
|
1596
1596
|
for (const l of o) {
|
|
1597
1597
|
const m = i[l], x = a.data[l];
|
|
@@ -1604,20 +1604,20 @@ class k extends v {
|
|
|
1604
1604
|
if (this._def.catchall instanceof R) {
|
|
1605
1605
|
const l = this._def.unknownKeys;
|
|
1606
1606
|
if (l === "passthrough")
|
|
1607
|
-
for (const m of
|
|
1607
|
+
for (const m of d)
|
|
1608
1608
|
u.push({
|
|
1609
1609
|
key: { status: "valid", value: m },
|
|
1610
1610
|
value: { status: "valid", value: a.data[m] }
|
|
1611
1611
|
});
|
|
1612
1612
|
else if (l === "strict")
|
|
1613
|
-
|
|
1614
|
-
code:
|
|
1615
|
-
keys:
|
|
1613
|
+
d.length > 0 && (p(a, {
|
|
1614
|
+
code: c.unrecognized_keys,
|
|
1615
|
+
keys: d
|
|
1616
1616
|
}), s.dirty());
|
|
1617
1617
|
else if (l !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
1618
1618
|
} else {
|
|
1619
1619
|
const l = this._def.catchall;
|
|
1620
|
-
for (const m of
|
|
1620
|
+
for (const m of d) {
|
|
1621
1621
|
const x = a.data[m];
|
|
1622
1622
|
u.push({
|
|
1623
1623
|
key: { status: "valid", value: m },
|
|
@@ -1651,10 +1651,10 @@ class k extends v {
|
|
|
1651
1651
|
unknownKeys: "strict",
|
|
1652
1652
|
...e !== void 0 ? {
|
|
1653
1653
|
errorMap: (n, s) => {
|
|
1654
|
-
var a, i, o,
|
|
1654
|
+
var a, i, o, d;
|
|
1655
1655
|
const u = (o = (i = (a = this._def).errorMap) === null || i === void 0 ? void 0 : i.call(a, n, s).message) !== null && o !== void 0 ? o : s.defaultError;
|
|
1656
1656
|
return n.code === "unrecognized_keys" ? {
|
|
1657
|
-
message: (
|
|
1657
|
+
message: (d = f.errToObj(e).message) !== null && d !== void 0 ? d : u
|
|
1658
1658
|
} : {
|
|
1659
1659
|
message: u
|
|
1660
1660
|
};
|
|
@@ -1803,7 +1803,7 @@ class k extends v {
|
|
|
1803
1803
|
* @deprecated
|
|
1804
1804
|
*/
|
|
1805
1805
|
deepPartial() {
|
|
1806
|
-
return
|
|
1806
|
+
return H(this);
|
|
1807
1807
|
}
|
|
1808
1808
|
partial(e) {
|
|
1809
1809
|
const n = {};
|
|
@@ -1860,15 +1860,15 @@ class ae extends v {
|
|
|
1860
1860
|
_parse(e) {
|
|
1861
1861
|
const { ctx: n } = this._processInputParams(e), s = this._def.options;
|
|
1862
1862
|
function a(i) {
|
|
1863
|
-
for (const
|
|
1864
|
-
if (
|
|
1865
|
-
return
|
|
1866
|
-
for (const
|
|
1867
|
-
if (
|
|
1868
|
-
return n.common.issues.push(...
|
|
1869
|
-
const o = i.map((
|
|
1863
|
+
for (const d of i)
|
|
1864
|
+
if (d.result.status === "valid")
|
|
1865
|
+
return d.result;
|
|
1866
|
+
for (const d of i)
|
|
1867
|
+
if (d.result.status === "dirty")
|
|
1868
|
+
return n.common.issues.push(...d.ctx.common.issues), d.result;
|
|
1869
|
+
const o = i.map((d) => new T(d.ctx.common.issues));
|
|
1870
1870
|
return p(n, {
|
|
1871
|
-
code:
|
|
1871
|
+
code: c.invalid_union,
|
|
1872
1872
|
unionErrors: o
|
|
1873
1873
|
}), g;
|
|
1874
1874
|
}
|
|
@@ -1913,10 +1913,10 @@ class ae extends v {
|
|
|
1913
1913
|
}
|
|
1914
1914
|
if (i)
|
|
1915
1915
|
return n.common.issues.push(...i.ctx.common.issues), i.result;
|
|
1916
|
-
const
|
|
1916
|
+
const d = o.map((u) => new T(u));
|
|
1917
1917
|
return p(n, {
|
|
1918
|
-
code:
|
|
1919
|
-
unionErrors:
|
|
1918
|
+
code: c.invalid_union,
|
|
1919
|
+
unionErrors: d
|
|
1920
1920
|
}), g;
|
|
1921
1921
|
}
|
|
1922
1922
|
}
|
|
@@ -1929,13 +1929,13 @@ ae.create = (t, e) => new ae({
|
|
|
1929
1929
|
typeName: _.ZodUnion,
|
|
1930
1930
|
...y(e)
|
|
1931
1931
|
});
|
|
1932
|
-
const Z = (t) => t instanceof
|
|
1932
|
+
const Z = (t) => t instanceof de ? Z(t.schema) : t instanceof O ? Z(t.innerType()) : t instanceof ce ? [t.value] : t instanceof D ? t.options : t instanceof le ? b.objectValues(t.enum) : t instanceof ue ? Z(t._def.innerType) : t instanceof re ? [void 0] : t instanceof se ? [null] : t instanceof j ? [void 0, ...Z(t.unwrap())] : t instanceof U ? [null, ...Z(t.unwrap())] : t instanceof Pe || t instanceof he ? Z(t.unwrap()) : t instanceof pe ? Z(t._def.innerType) : [];
|
|
1933
1933
|
class xe extends v {
|
|
1934
1934
|
_parse(e) {
|
|
1935
1935
|
const { ctx: n } = this._processInputParams(e);
|
|
1936
1936
|
if (n.parsedType !== h.object)
|
|
1937
1937
|
return p(n, {
|
|
1938
|
-
code:
|
|
1938
|
+
code: c.invalid_type,
|
|
1939
1939
|
expected: h.object,
|
|
1940
1940
|
received: n.parsedType
|
|
1941
1941
|
}), g;
|
|
@@ -1949,7 +1949,7 @@ class xe extends v {
|
|
|
1949
1949
|
path: n.path,
|
|
1950
1950
|
parent: n
|
|
1951
1951
|
}) : (p(n, {
|
|
1952
|
-
code:
|
|
1952
|
+
code: c.invalid_union_discriminator,
|
|
1953
1953
|
options: Array.from(this.optionsMap.keys()),
|
|
1954
1954
|
path: [s]
|
|
1955
1955
|
}), g);
|
|
@@ -1977,10 +1977,10 @@ class xe extends v {
|
|
|
1977
1977
|
const o = Z(i.shape[e]);
|
|
1978
1978
|
if (!o.length)
|
|
1979
1979
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
1980
|
-
for (const
|
|
1981
|
-
if (a.has(
|
|
1982
|
-
throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(
|
|
1983
|
-
a.set(
|
|
1980
|
+
for (const d of o) {
|
|
1981
|
+
if (a.has(d))
|
|
1982
|
+
throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(d)}`);
|
|
1983
|
+
a.set(d, i);
|
|
1984
1984
|
}
|
|
1985
1985
|
}
|
|
1986
1986
|
return new xe({
|
|
@@ -1997,12 +1997,12 @@ function Ae(t, e) {
|
|
|
1997
1997
|
if (t === e)
|
|
1998
1998
|
return { valid: !0, data: t };
|
|
1999
1999
|
if (n === h.object && s === h.object) {
|
|
2000
|
-
const a = b.objectKeys(e), i = b.objectKeys(t).filter((
|
|
2001
|
-
for (const
|
|
2002
|
-
const u = Ae(t[
|
|
2000
|
+
const a = b.objectKeys(e), i = b.objectKeys(t).filter((d) => a.indexOf(d) !== -1), o = { ...t, ...e };
|
|
2001
|
+
for (const d of i) {
|
|
2002
|
+
const u = Ae(t[d], e[d]);
|
|
2003
2003
|
if (!u.valid)
|
|
2004
2004
|
return { valid: !1 };
|
|
2005
|
-
o[
|
|
2005
|
+
o[d] = u.data;
|
|
2006
2006
|
}
|
|
2007
2007
|
return { valid: !0, data: o };
|
|
2008
2008
|
} else if (n === h.array && s === h.array) {
|
|
@@ -2010,7 +2010,7 @@ function Ae(t, e) {
|
|
|
2010
2010
|
return { valid: !1 };
|
|
2011
2011
|
const a = [];
|
|
2012
2012
|
for (let i = 0; i < t.length; i++) {
|
|
2013
|
-
const o = t[i],
|
|
2013
|
+
const o = t[i], d = e[i], u = Ae(o, d);
|
|
2014
2014
|
if (!u.valid)
|
|
2015
2015
|
return { valid: !1 };
|
|
2016
2016
|
a.push(u.data);
|
|
@@ -2023,9 +2023,9 @@ class ie extends v {
|
|
|
2023
2023
|
const { status: n, ctx: s } = this._processInputParams(e), a = (i, o) => {
|
|
2024
2024
|
if (Ze(i) || Ze(o))
|
|
2025
2025
|
return g;
|
|
2026
|
-
const
|
|
2027
|
-
return
|
|
2028
|
-
code:
|
|
2026
|
+
const d = Ae(i.value, o.value);
|
|
2027
|
+
return d.valid ? ((Re(i) || Re(o)) && n.dirty(), { status: n.value, value: d.data }) : (p(s, {
|
|
2028
|
+
code: c.invalid_intersection_types
|
|
2029
2029
|
}), g);
|
|
2030
2030
|
};
|
|
2031
2031
|
return s.common.async ? Promise.all([
|
|
@@ -2061,28 +2061,28 @@ class N extends v {
|
|
|
2061
2061
|
const { status: n, ctx: s } = this._processInputParams(e);
|
|
2062
2062
|
if (s.parsedType !== h.array)
|
|
2063
2063
|
return p(s, {
|
|
2064
|
-
code:
|
|
2064
|
+
code: c.invalid_type,
|
|
2065
2065
|
expected: h.array,
|
|
2066
2066
|
received: s.parsedType
|
|
2067
2067
|
}), g;
|
|
2068
2068
|
if (s.data.length < this._def.items.length)
|
|
2069
2069
|
return p(s, {
|
|
2070
|
-
code:
|
|
2070
|
+
code: c.too_small,
|
|
2071
2071
|
minimum: this._def.items.length,
|
|
2072
2072
|
inclusive: !0,
|
|
2073
2073
|
exact: !1,
|
|
2074
2074
|
type: "array"
|
|
2075
2075
|
}), g;
|
|
2076
2076
|
!this._def.rest && s.data.length > this._def.items.length && (p(s, {
|
|
2077
|
-
code:
|
|
2077
|
+
code: c.too_big,
|
|
2078
2078
|
maximum: this._def.items.length,
|
|
2079
2079
|
inclusive: !0,
|
|
2080
2080
|
exact: !1,
|
|
2081
2081
|
type: "array"
|
|
2082
2082
|
}), n.dirty());
|
|
2083
|
-
const i = [...s.data].map((o,
|
|
2084
|
-
const u = this._def.items[
|
|
2085
|
-
return u ? u._parse(new I(s, o, s.path,
|
|
2083
|
+
const i = [...s.data].map((o, d) => {
|
|
2084
|
+
const u = this._def.items[d] || this._def.rest;
|
|
2085
|
+
return u ? u._parse(new I(s, o, s.path, d)) : null;
|
|
2086
2086
|
}).filter((o) => !!o);
|
|
2087
2087
|
return s.common.async ? Promise.all(i).then((o) => w.mergeArray(n, o)) : w.mergeArray(n, i);
|
|
2088
2088
|
}
|
|
@@ -2117,16 +2117,16 @@ class oe extends v {
|
|
|
2117
2117
|
const { status: n, ctx: s } = this._processInputParams(e);
|
|
2118
2118
|
if (s.parsedType !== h.object)
|
|
2119
2119
|
return p(s, {
|
|
2120
|
-
code:
|
|
2120
|
+
code: c.invalid_type,
|
|
2121
2121
|
expected: h.object,
|
|
2122
2122
|
received: s.parsedType
|
|
2123
2123
|
}), g;
|
|
2124
2124
|
const a = [], i = this._def.keyType, o = this._def.valueType;
|
|
2125
|
-
for (const
|
|
2125
|
+
for (const d in s.data)
|
|
2126
2126
|
a.push({
|
|
2127
|
-
key: i._parse(new I(s,
|
|
2128
|
-
value: o._parse(new I(s, s.data[
|
|
2129
|
-
alwaysSet:
|
|
2127
|
+
key: i._parse(new I(s, d, s.path, d)),
|
|
2128
|
+
value: o._parse(new I(s, s.data[d], s.path, d)),
|
|
2129
|
+
alwaysSet: d in s.data
|
|
2130
2130
|
});
|
|
2131
2131
|
return s.common.async ? w.mergeObjectAsync(n, a) : w.mergeObjectSync(n, a);
|
|
2132
2132
|
}
|
|
@@ -2158,34 +2158,34 @@ class be extends v {
|
|
|
2158
2158
|
const { status: n, ctx: s } = this._processInputParams(e);
|
|
2159
2159
|
if (s.parsedType !== h.map)
|
|
2160
2160
|
return p(s, {
|
|
2161
|
-
code:
|
|
2161
|
+
code: c.invalid_type,
|
|
2162
2162
|
expected: h.map,
|
|
2163
2163
|
received: s.parsedType
|
|
2164
2164
|
}), g;
|
|
2165
|
-
const a = this._def.keyType, i = this._def.valueType, o = [...s.data.entries()].map(([
|
|
2166
|
-
key: a._parse(new I(s,
|
|
2165
|
+
const a = this._def.keyType, i = this._def.valueType, o = [...s.data.entries()].map(([d, u], l) => ({
|
|
2166
|
+
key: a._parse(new I(s, d, s.path, [l, "key"])),
|
|
2167
2167
|
value: i._parse(new I(s, u, s.path, [l, "value"]))
|
|
2168
2168
|
}));
|
|
2169
2169
|
if (s.common.async) {
|
|
2170
|
-
const
|
|
2170
|
+
const d = /* @__PURE__ */ new Map();
|
|
2171
2171
|
return Promise.resolve().then(async () => {
|
|
2172
2172
|
for (const u of o) {
|
|
2173
2173
|
const l = await u.key, m = await u.value;
|
|
2174
2174
|
if (l.status === "aborted" || m.status === "aborted")
|
|
2175
2175
|
return g;
|
|
2176
|
-
(l.status === "dirty" || m.status === "dirty") && n.dirty(),
|
|
2176
|
+
(l.status === "dirty" || m.status === "dirty") && n.dirty(), d.set(l.value, m.value);
|
|
2177
2177
|
}
|
|
2178
|
-
return { status: n.value, value:
|
|
2178
|
+
return { status: n.value, value: d };
|
|
2179
2179
|
});
|
|
2180
2180
|
} else {
|
|
2181
|
-
const
|
|
2181
|
+
const d = /* @__PURE__ */ new Map();
|
|
2182
2182
|
for (const u of o) {
|
|
2183
2183
|
const l = u.key, m = u.value;
|
|
2184
2184
|
if (l.status === "aborted" || m.status === "aborted")
|
|
2185
2185
|
return g;
|
|
2186
|
-
(l.status === "dirty" || m.status === "dirty") && n.dirty(),
|
|
2186
|
+
(l.status === "dirty" || m.status === "dirty") && n.dirty(), d.set(l.value, m.value);
|
|
2187
2187
|
}
|
|
2188
|
-
return { status: n.value, value:
|
|
2188
|
+
return { status: n.value, value: d };
|
|
2189
2189
|
}
|
|
2190
2190
|
}
|
|
2191
2191
|
}
|
|
@@ -2200,20 +2200,20 @@ class L extends v {
|
|
|
2200
2200
|
const { status: n, ctx: s } = this._processInputParams(e);
|
|
2201
2201
|
if (s.parsedType !== h.set)
|
|
2202
2202
|
return p(s, {
|
|
2203
|
-
code:
|
|
2203
|
+
code: c.invalid_type,
|
|
2204
2204
|
expected: h.set,
|
|
2205
2205
|
received: s.parsedType
|
|
2206
2206
|
}), g;
|
|
2207
2207
|
const a = this._def;
|
|
2208
2208
|
a.minSize !== null && s.data.size < a.minSize.value && (p(s, {
|
|
2209
|
-
code:
|
|
2209
|
+
code: c.too_small,
|
|
2210
2210
|
minimum: a.minSize.value,
|
|
2211
2211
|
type: "set",
|
|
2212
2212
|
inclusive: !0,
|
|
2213
2213
|
exact: !1,
|
|
2214
2214
|
message: a.minSize.message
|
|
2215
2215
|
}), n.dirty()), a.maxSize !== null && s.data.size > a.maxSize.value && (p(s, {
|
|
2216
|
-
code:
|
|
2216
|
+
code: c.too_big,
|
|
2217
2217
|
maximum: a.maxSize.value,
|
|
2218
2218
|
type: "set",
|
|
2219
2219
|
inclusive: !0,
|
|
@@ -2230,8 +2230,8 @@ class L extends v {
|
|
|
2230
2230
|
}
|
|
2231
2231
|
return { status: n.value, value: l };
|
|
2232
2232
|
}
|
|
2233
|
-
const
|
|
2234
|
-
return s.common.async ? Promise.all(
|
|
2233
|
+
const d = [...s.data.values()].map((u, l) => i._parse(new I(s, u, s.path, l)));
|
|
2234
|
+
return s.common.async ? Promise.all(d).then((u) => o(u)) : o(d);
|
|
2235
2235
|
}
|
|
2236
2236
|
min(e, n) {
|
|
2237
2237
|
return new L({
|
|
@@ -2267,13 +2267,13 @@ class q extends v {
|
|
|
2267
2267
|
const { ctx: n } = this._processInputParams(e);
|
|
2268
2268
|
if (n.parsedType !== h.function)
|
|
2269
2269
|
return p(n, {
|
|
2270
|
-
code:
|
|
2270
|
+
code: c.invalid_type,
|
|
2271
2271
|
expected: h.function,
|
|
2272
2272
|
received: n.parsedType
|
|
2273
2273
|
}), g;
|
|
2274
|
-
function s(
|
|
2274
|
+
function s(d, u) {
|
|
2275
2275
|
return _e({
|
|
2276
|
-
data:
|
|
2276
|
+
data: d,
|
|
2277
2277
|
path: n.path,
|
|
2278
2278
|
errorMaps: [
|
|
2279
2279
|
n.common.contextualErrorMap,
|
|
@@ -2282,14 +2282,14 @@ class q extends v {
|
|
|
2282
2282
|
F
|
|
2283
2283
|
].filter((l) => !!l),
|
|
2284
2284
|
issueData: {
|
|
2285
|
-
code:
|
|
2285
|
+
code: c.invalid_arguments,
|
|
2286
2286
|
argumentsError: u
|
|
2287
2287
|
}
|
|
2288
2288
|
});
|
|
2289
2289
|
}
|
|
2290
|
-
function a(
|
|
2290
|
+
function a(d, u) {
|
|
2291
2291
|
return _e({
|
|
2292
|
-
data:
|
|
2292
|
+
data: d,
|
|
2293
2293
|
path: n.path,
|
|
2294
2294
|
errorMaps: [
|
|
2295
2295
|
n.common.contextualErrorMap,
|
|
@@ -2298,29 +2298,29 @@ class q extends v {
|
|
|
2298
2298
|
F
|
|
2299
2299
|
].filter((l) => !!l),
|
|
2300
2300
|
issueData: {
|
|
2301
|
-
code:
|
|
2301
|
+
code: c.invalid_return_type,
|
|
2302
2302
|
returnTypeError: u
|
|
2303
2303
|
}
|
|
2304
2304
|
});
|
|
2305
2305
|
}
|
|
2306
2306
|
const i = { errorMap: n.common.contextualErrorMap }, o = n.data;
|
|
2307
2307
|
if (this._def.returns instanceof K) {
|
|
2308
|
-
const
|
|
2308
|
+
const d = this;
|
|
2309
2309
|
return S(async function(...u) {
|
|
2310
|
-
const l = new T([]), m = await
|
|
2310
|
+
const l = new T([]), m = await d._def.args.parseAsync(u, i).catch((B) => {
|
|
2311
2311
|
throw l.addIssue(s(u, B)), l;
|
|
2312
2312
|
}), x = await Reflect.apply(o, this, m);
|
|
2313
|
-
return await
|
|
2313
|
+
return await d._def.returns._def.type.parseAsync(x, i).catch((B) => {
|
|
2314
2314
|
throw l.addIssue(a(x, B)), l;
|
|
2315
2315
|
});
|
|
2316
2316
|
});
|
|
2317
2317
|
} else {
|
|
2318
|
-
const
|
|
2318
|
+
const d = this;
|
|
2319
2319
|
return S(function(...u) {
|
|
2320
|
-
const l =
|
|
2320
|
+
const l = d._def.args.safeParse(u, i);
|
|
2321
2321
|
if (!l.success)
|
|
2322
2322
|
throw new T([s(u, l.error)]);
|
|
2323
|
-
const m = Reflect.apply(o, this, l.data), x =
|
|
2323
|
+
const m = Reflect.apply(o, this, l.data), x = d._def.returns.safeParse(m, i);
|
|
2324
2324
|
if (!x.success)
|
|
2325
2325
|
throw new T([a(m, x.error)]);
|
|
2326
2326
|
return x.data;
|
|
@@ -2360,7 +2360,7 @@ class q extends v {
|
|
|
2360
2360
|
});
|
|
2361
2361
|
}
|
|
2362
2362
|
}
|
|
2363
|
-
class
|
|
2363
|
+
class de extends v {
|
|
2364
2364
|
get schema() {
|
|
2365
2365
|
return this._def.getter();
|
|
2366
2366
|
}
|
|
@@ -2369,18 +2369,18 @@ class ce extends v {
|
|
|
2369
2369
|
return this._def.getter()._parse({ data: n.data, path: n.path, parent: n });
|
|
2370
2370
|
}
|
|
2371
2371
|
}
|
|
2372
|
-
|
|
2372
|
+
de.create = (t, e) => new de({
|
|
2373
2373
|
getter: t,
|
|
2374
2374
|
typeName: _.ZodLazy,
|
|
2375
2375
|
...y(e)
|
|
2376
2376
|
});
|
|
2377
|
-
class
|
|
2377
|
+
class ce extends v {
|
|
2378
2378
|
_parse(e) {
|
|
2379
2379
|
if (e.data !== this._def.value) {
|
|
2380
2380
|
const n = this._getOrReturnCtx(e);
|
|
2381
2381
|
return p(n, {
|
|
2382
2382
|
received: n.data,
|
|
2383
|
-
code:
|
|
2383
|
+
code: c.invalid_literal,
|
|
2384
2384
|
expected: this._def.value
|
|
2385
2385
|
}), g;
|
|
2386
2386
|
}
|
|
@@ -2390,7 +2390,7 @@ class de extends v {
|
|
|
2390
2390
|
return this._def.value;
|
|
2391
2391
|
}
|
|
2392
2392
|
}
|
|
2393
|
-
|
|
2393
|
+
ce.create = (t, e) => new ce({
|
|
2394
2394
|
value: t,
|
|
2395
2395
|
typeName: _.ZodLiteral,
|
|
2396
2396
|
...y(e)
|
|
@@ -2412,14 +2412,14 @@ class D extends v {
|
|
|
2412
2412
|
return p(n, {
|
|
2413
2413
|
expected: b.joinValues(s),
|
|
2414
2414
|
received: n.parsedType,
|
|
2415
|
-
code:
|
|
2415
|
+
code: c.invalid_type
|
|
2416
2416
|
}), g;
|
|
2417
2417
|
}
|
|
2418
|
-
if (ge(this, Q) ||
|
|
2418
|
+
if (ge(this, Q) || He(this, Q, new Set(this._def.values)), !ge(this, Q).has(e.data)) {
|
|
2419
2419
|
const n = this._getOrReturnCtx(e), s = this._def.values;
|
|
2420
2420
|
return p(n, {
|
|
2421
2421
|
received: n.data,
|
|
2422
|
-
code:
|
|
2422
|
+
code: c.invalid_enum_value,
|
|
2423
2423
|
options: s
|
|
2424
2424
|
}), g;
|
|
2425
2425
|
}
|
|
@@ -2472,14 +2472,14 @@ class le extends v {
|
|
|
2472
2472
|
return p(s, {
|
|
2473
2473
|
expected: b.joinValues(a),
|
|
2474
2474
|
received: s.parsedType,
|
|
2475
|
-
code:
|
|
2475
|
+
code: c.invalid_type
|
|
2476
2476
|
}), g;
|
|
2477
2477
|
}
|
|
2478
|
-
if (ge(this, X) ||
|
|
2478
|
+
if (ge(this, X) || He(this, X, new Set(b.getValidEnumValues(this._def.values))), !ge(this, X).has(e.data)) {
|
|
2479
2479
|
const a = b.objectValues(n);
|
|
2480
2480
|
return p(s, {
|
|
2481
2481
|
received: s.data,
|
|
2482
|
-
code:
|
|
2482
|
+
code: c.invalid_enum_value,
|
|
2483
2483
|
options: a
|
|
2484
2484
|
}), g;
|
|
2485
2485
|
}
|
|
@@ -2503,7 +2503,7 @@ class K extends v {
|
|
|
2503
2503
|
const { ctx: n } = this._processInputParams(e);
|
|
2504
2504
|
if (n.parsedType !== h.promise && n.common.async === !1)
|
|
2505
2505
|
return p(n, {
|
|
2506
|
-
code:
|
|
2506
|
+
code: c.invalid_type,
|
|
2507
2507
|
expected: h.promise,
|
|
2508
2508
|
received: n.parsedType
|
|
2509
2509
|
}), g;
|
|
@@ -2538,45 +2538,45 @@ class O extends v {
|
|
|
2538
2538
|
if (i.addIssue = i.addIssue.bind(i), a.type === "preprocess") {
|
|
2539
2539
|
const o = a.transform(s.data, i);
|
|
2540
2540
|
if (s.common.async)
|
|
2541
|
-
return Promise.resolve(o).then(async (
|
|
2541
|
+
return Promise.resolve(o).then(async (d) => {
|
|
2542
2542
|
if (n.value === "aborted")
|
|
2543
2543
|
return g;
|
|
2544
2544
|
const u = await this._def.schema._parseAsync({
|
|
2545
|
-
data:
|
|
2545
|
+
data: d,
|
|
2546
2546
|
path: s.path,
|
|
2547
2547
|
parent: s
|
|
2548
2548
|
});
|
|
2549
|
-
return u.status === "aborted" ? g : u.status === "dirty" || n.value === "dirty" ?
|
|
2549
|
+
return u.status === "aborted" ? g : u.status === "dirty" || n.value === "dirty" ? G(u.value) : u;
|
|
2550
2550
|
});
|
|
2551
2551
|
{
|
|
2552
2552
|
if (n.value === "aborted")
|
|
2553
2553
|
return g;
|
|
2554
|
-
const
|
|
2554
|
+
const d = this._def.schema._parseSync({
|
|
2555
2555
|
data: o,
|
|
2556
2556
|
path: s.path,
|
|
2557
2557
|
parent: s
|
|
2558
2558
|
});
|
|
2559
|
-
return
|
|
2559
|
+
return d.status === "aborted" ? g : d.status === "dirty" || n.value === "dirty" ? G(d.value) : d;
|
|
2560
2560
|
}
|
|
2561
2561
|
}
|
|
2562
2562
|
if (a.type === "refinement") {
|
|
2563
|
-
const o = (
|
|
2564
|
-
const u = a.refinement(
|
|
2563
|
+
const o = (d) => {
|
|
2564
|
+
const u = a.refinement(d, i);
|
|
2565
2565
|
if (s.common.async)
|
|
2566
2566
|
return Promise.resolve(u);
|
|
2567
2567
|
if (u instanceof Promise)
|
|
2568
2568
|
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2569
|
-
return
|
|
2569
|
+
return d;
|
|
2570
2570
|
};
|
|
2571
2571
|
if (s.common.async === !1) {
|
|
2572
|
-
const
|
|
2572
|
+
const d = this._def.schema._parseSync({
|
|
2573
2573
|
data: s.data,
|
|
2574
2574
|
path: s.path,
|
|
2575
2575
|
parent: s
|
|
2576
2576
|
});
|
|
2577
|
-
return
|
|
2577
|
+
return d.status === "aborted" ? g : (d.status === "dirty" && n.dirty(), o(d.value), { status: n.value, value: d.value });
|
|
2578
2578
|
} else
|
|
2579
|
-
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((
|
|
2579
|
+
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((d) => d.status === "aborted" ? g : (d.status === "dirty" && n.dirty(), o(d.value).then(() => ({ status: n.value, value: d.value }))));
|
|
2580
2580
|
}
|
|
2581
2581
|
if (a.type === "transform")
|
|
2582
2582
|
if (s.common.async === !1) {
|
|
@@ -2587,12 +2587,12 @@ class O extends v {
|
|
|
2587
2587
|
});
|
|
2588
2588
|
if (!ee(o))
|
|
2589
2589
|
return o;
|
|
2590
|
-
const
|
|
2591
|
-
if (
|
|
2590
|
+
const d = a.transform(o.value, i);
|
|
2591
|
+
if (d instanceof Promise)
|
|
2592
2592
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2593
|
-
return { status: n.value, value:
|
|
2593
|
+
return { status: n.value, value: d };
|
|
2594
2594
|
} else
|
|
2595
|
-
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((o) => ee(o) ? Promise.resolve(a.transform(o.value, i)).then((
|
|
2595
|
+
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((o) => ee(o) ? Promise.resolve(a.transform(o.value, i)).then((d) => ({ status: n.value, value: d })) : o);
|
|
2596
2596
|
b.assertNever(a);
|
|
2597
2597
|
}
|
|
2598
2598
|
}
|
|
@@ -2702,7 +2702,7 @@ class ke extends v {
|
|
|
2702
2702
|
if (this._getType(e) !== h.nan) {
|
|
2703
2703
|
const s = this._getOrReturnCtx(e);
|
|
2704
2704
|
return p(s, {
|
|
2705
|
-
code:
|
|
2705
|
+
code: c.invalid_type,
|
|
2706
2706
|
expected: h.nan,
|
|
2707
2707
|
received: s.parsedType
|
|
2708
2708
|
}), g;
|
|
@@ -2738,7 +2738,7 @@ class fe extends v {
|
|
|
2738
2738
|
path: s.path,
|
|
2739
2739
|
parent: s
|
|
2740
2740
|
});
|
|
2741
|
-
return i.status === "aborted" ? g : i.status === "dirty" ? (n.dirty(),
|
|
2741
|
+
return i.status === "aborted" ? g : i.status === "dirty" ? (n.dirty(), G(i.value)) : this._def.out._parseAsync({
|
|
2742
2742
|
data: i.value,
|
|
2743
2743
|
path: s.path,
|
|
2744
2744
|
parent: s
|
|
@@ -2786,7 +2786,7 @@ function Ke(t, e = {}, n) {
|
|
|
2786
2786
|
return t ? Y.create().superRefine((s, a) => {
|
|
2787
2787
|
var i, o;
|
|
2788
2788
|
if (!t(s)) {
|
|
2789
|
-
const
|
|
2789
|
+
const d = typeof e == "function" ? e(s) : typeof e == "string" ? { message: e } : e, u = (o = (i = d.fatal) !== null && i !== void 0 ? i : n) !== null && o !== void 0 ? o : !0, l = typeof d == "string" ? { message: d } : d;
|
|
2790
2790
|
a.addIssue({ code: "custom", ...l, fatal: u });
|
|
2791
2791
|
}
|
|
2792
2792
|
}) : Y.create();
|
|
@@ -2800,7 +2800,7 @@ var _;
|
|
|
2800
2800
|
})(_ || (_ = {}));
|
|
2801
2801
|
const Nt = (t, e = {
|
|
2802
2802
|
message: `Input not instance of ${t.name}`
|
|
2803
|
-
}) => Ke((n) => n instanceof t, e), Je = E.create, Qe = P.create, Zt = ke.create, Rt = M.create, Xe = ne.create, At = V.create, Pt = ye.create, Mt = re.create, Dt = se.create, Ut = Y.create, $t = $.create, Vt = R.create, Lt = ve.create, zt = C.create, Bt = k.create, Wt = k.strictCreate,
|
|
2803
|
+
}) => Ke((n) => n instanceof t, e), Je = E.create, Qe = P.create, Zt = ke.create, Rt = M.create, Xe = ne.create, At = V.create, Pt = ye.create, Mt = re.create, Dt = se.create, Ut = Y.create, $t = $.create, Vt = R.create, Lt = ve.create, zt = C.create, Bt = k.create, Wt = k.strictCreate, Ht = ae.create, Gt = xe.create, qt = ie.create, Ft = N.create, Yt = oe.create, Kt = be.create, Jt = L.create, Qt = q.create, Xt = de.create, en = ce.create, tn = D.create, nn = le.create, rn = K.create, Be = O.create, sn = j.create, an = U.create, on = O.createWithPreprocess, dn = fe.create, cn = () => Je().optional(), ln = () => Qe().optional(), un = () => Xe().optional(), pn = {
|
|
2804
2804
|
string: (t) => E.create({ ...t, coerce: !0 }),
|
|
2805
2805
|
number: (t) => P.create({ ...t, coerce: !0 }),
|
|
2806
2806
|
boolean: (t) => ne.create({
|
|
@@ -2820,7 +2820,7 @@ var r = /* @__PURE__ */ Object.freeze({
|
|
|
2820
2820
|
addIssueToContext: p,
|
|
2821
2821
|
ParseStatus: w,
|
|
2822
2822
|
INVALID: g,
|
|
2823
|
-
DIRTY:
|
|
2823
|
+
DIRTY: G,
|
|
2824
2824
|
OK: S,
|
|
2825
2825
|
isAborted: Ze,
|
|
2826
2826
|
isDirty: Re,
|
|
@@ -2858,8 +2858,8 @@ var r = /* @__PURE__ */ Object.freeze({
|
|
|
2858
2858
|
ZodMap: be,
|
|
2859
2859
|
ZodSet: L,
|
|
2860
2860
|
ZodFunction: q,
|
|
2861
|
-
ZodLazy:
|
|
2862
|
-
ZodLiteral:
|
|
2861
|
+
ZodLazy: de,
|
|
2862
|
+
ZodLiteral: ce,
|
|
2863
2863
|
ZodEnum: D,
|
|
2864
2864
|
ZodNativeEnum: le,
|
|
2865
2865
|
ZodPromise: K,
|
|
@@ -2887,7 +2887,7 @@ var r = /* @__PURE__ */ Object.freeze({
|
|
|
2887
2887
|
bigint: Rt,
|
|
2888
2888
|
boolean: Xe,
|
|
2889
2889
|
date: At,
|
|
2890
|
-
discriminatedUnion:
|
|
2890
|
+
discriminatedUnion: Gt,
|
|
2891
2891
|
effect: Be,
|
|
2892
2892
|
enum: tn,
|
|
2893
2893
|
function: Qt,
|
|
@@ -2906,8 +2906,8 @@ var r = /* @__PURE__ */ Object.freeze({
|
|
|
2906
2906
|
oboolean: un,
|
|
2907
2907
|
onumber: ln,
|
|
2908
2908
|
optional: sn,
|
|
2909
|
-
ostring:
|
|
2910
|
-
pipeline:
|
|
2909
|
+
ostring: cn,
|
|
2910
|
+
pipeline: dn,
|
|
2911
2911
|
preprocess: on,
|
|
2912
2912
|
promise: rn,
|
|
2913
2913
|
record: Yt,
|
|
@@ -2918,11 +2918,11 @@ var r = /* @__PURE__ */ Object.freeze({
|
|
|
2918
2918
|
transformer: Be,
|
|
2919
2919
|
tuple: Ft,
|
|
2920
2920
|
undefined: Mt,
|
|
2921
|
-
union:
|
|
2921
|
+
union: Ht,
|
|
2922
2922
|
unknown: $t,
|
|
2923
2923
|
void: Lt,
|
|
2924
2924
|
NEVER: hn,
|
|
2925
|
-
ZodIssueCode:
|
|
2925
|
+
ZodIssueCode: c,
|
|
2926
2926
|
quotelessJson: ut,
|
|
2927
2927
|
ZodError: T
|
|
2928
2928
|
});
|
|
@@ -2979,7 +2979,7 @@ const Wn = r.object({
|
|
|
2979
2979
|
is_social: r.boolean(),
|
|
2980
2980
|
login_count: r.number(),
|
|
2981
2981
|
identities: r.array(mn).optional()
|
|
2982
|
-
}),
|
|
2982
|
+
}), Hn = gn, Gn = et.extend({
|
|
2983
2983
|
email: r.string(),
|
|
2984
2984
|
login_count: r.number(),
|
|
2985
2985
|
multifactor: r.array(r.string()).optional(),
|
|
@@ -3176,12 +3176,24 @@ const Cn = r.enum([
|
|
|
3176
3176
|
...Me.shape,
|
|
3177
3177
|
hook_id: r.string()
|
|
3178
3178
|
}), Nn = r.object({
|
|
3179
|
-
alg: r.
|
|
3179
|
+
alg: r.enum([
|
|
3180
|
+
"RS256",
|
|
3181
|
+
"RS384",
|
|
3182
|
+
"RS512",
|
|
3183
|
+
"ES256",
|
|
3184
|
+
"ES384",
|
|
3185
|
+
"ES512",
|
|
3186
|
+
"HS256",
|
|
3187
|
+
"HS384",
|
|
3188
|
+
"HS512"
|
|
3189
|
+
]),
|
|
3180
3190
|
e: r.string(),
|
|
3181
3191
|
kid: r.string(),
|
|
3182
|
-
kty: r.
|
|
3192
|
+
kty: r.enum(["RSA", "EC", "oct"]),
|
|
3183
3193
|
n: r.string(),
|
|
3184
|
-
|
|
3194
|
+
x5t: r.string().optional(),
|
|
3195
|
+
x5c: r.array(r.string()).optional(),
|
|
3196
|
+
use: r.enum(["sig", "enc"]).optional()
|
|
3185
3197
|
}), Qn = r.object({
|
|
3186
3198
|
keys: r.array(Nn)
|
|
3187
3199
|
}), Xn = r.object({
|
|
@@ -3319,18 +3331,12 @@ const An = r.enum([
|
|
|
3319
3331
|
created_at: r.string(),
|
|
3320
3332
|
...Dn.shape
|
|
3321
3333
|
}), sr = r.object({
|
|
3322
|
-
private_key: r.string().optional(),
|
|
3323
|
-
public_key: r.string().optional(),
|
|
3324
|
-
kid: r.string(),
|
|
3325
|
-
created_at: r.string().optional(),
|
|
3326
|
-
revoked_at: r.string().optional()
|
|
3327
|
-
}), ar = r.object({
|
|
3328
3334
|
kid: r.string().openapi({ description: "The key id of the signing key" }),
|
|
3329
3335
|
cert: r.string().openapi({ description: "The public certificate of the signing key" }),
|
|
3330
3336
|
fingerprint: r.string().openapi({ description: "The cert fingerprint" }),
|
|
3331
3337
|
thumbprint: r.string().openapi({ description: "The cert thumbprint" }),
|
|
3332
3338
|
pkcs7: r.string().optional().openapi({
|
|
3333
|
-
description: "The
|
|
3339
|
+
description: "The private key in pkcs7 format"
|
|
3334
3340
|
}),
|
|
3335
3341
|
current: r.boolean().optional().openapi({ description: "True if the key is the current key" }),
|
|
3336
3342
|
next: r.boolean().optional().openapi({ description: "True if the key is the next key" }),
|
|
@@ -3345,7 +3351,7 @@ const An = r.enum([
|
|
|
3345
3351
|
revoked_at: r.string().optional().openapi({ description: "The date and time when the key was revoked" })
|
|
3346
3352
|
});
|
|
3347
3353
|
var st = /* @__PURE__ */ ((t) => (t.RefreshToken = "refresh_token", t.AuthorizationCode = "authorization_code", t.ClientCredential = "client_credentials", t.Passwordless = "passwordless", t.Password = "password", t))(st || {});
|
|
3348
|
-
const De = r.nativeEnum(st),
|
|
3354
|
+
const De = r.nativeEnum(st), ar = r.object({
|
|
3349
3355
|
grant_type: De.refine(
|
|
3350
3356
|
(t) => t === "authorization_code"
|
|
3351
3357
|
/* AuthorizationCode */
|
|
@@ -3353,7 +3359,7 @@ const De = r.nativeEnum(st), ir = r.object({
|
|
|
3353
3359
|
code: r.string(),
|
|
3354
3360
|
client_secret: r.string(),
|
|
3355
3361
|
client_id: r.string()
|
|
3356
|
-
}),
|
|
3362
|
+
}), ir = r.object({
|
|
3357
3363
|
grant_type: De.refine(
|
|
3358
3364
|
(t) => t === "authorization_code"
|
|
3359
3365
|
/* AuthorizationCode */
|
|
@@ -3362,7 +3368,7 @@ const De = r.nativeEnum(st), ir = r.object({
|
|
|
3362
3368
|
code_verifier: r.string(),
|
|
3363
3369
|
client_id: r.string().optional(),
|
|
3364
3370
|
redirect_uri: r.string()
|
|
3365
|
-
}),
|
|
3371
|
+
}), or = r.object({
|
|
3366
3372
|
grant_type: De.refine(
|
|
3367
3373
|
(t) => t === "client_credentials"
|
|
3368
3374
|
/* ClientCredential */
|
|
@@ -3448,7 +3454,7 @@ const Un = r.object({
|
|
|
3448
3454
|
}), dr = Bn.extend({
|
|
3449
3455
|
themeId: r.string()
|
|
3450
3456
|
});
|
|
3451
|
-
function
|
|
3457
|
+
function cr(t) {
|
|
3452
3458
|
const [e, n] = t.split("|");
|
|
3453
3459
|
if (!e || !n)
|
|
3454
3460
|
throw new Error(`Invalid user_id: ${t}`);
|
|
@@ -3463,14 +3469,13 @@ export {
|
|
|
3463
3469
|
Rn as LogTypes,
|
|
3464
3470
|
vn as applicationInsertSchema,
|
|
3465
3471
|
bn as applicationSchema,
|
|
3466
|
-
|
|
3472
|
+
Hn as auth0UserResponseSchema,
|
|
3467
3473
|
kn as authParamsSchema,
|
|
3468
|
-
|
|
3474
|
+
ar as authorizationCodeGrantTypeParamsSchema,
|
|
3469
3475
|
et as baseUserSchema,
|
|
3470
3476
|
Un as bordersSchema,
|
|
3471
3477
|
qn as brandingSchema,
|
|
3472
|
-
|
|
3473
|
-
cr as clientCredentialGrantTypeParamsSchema,
|
|
3478
|
+
or as clientCredentialGrantTypeParamsSchema,
|
|
3474
3479
|
On as codeInsertSchema,
|
|
3475
3480
|
Yn as codeSchema,
|
|
3476
3481
|
Cn as codeTypeSchema,
|
|
@@ -3491,22 +3496,22 @@ export {
|
|
|
3491
3496
|
er as loginSchema,
|
|
3492
3497
|
Xn as openIDConfigurationSchema,
|
|
3493
3498
|
Ln as pageBackgroundSchema,
|
|
3494
|
-
|
|
3499
|
+
cr as parseUserId,
|
|
3495
3500
|
Mn as passwordInsertSchema,
|
|
3496
3501
|
nr as passwordSchema,
|
|
3497
|
-
|
|
3502
|
+
ir as pkceAuthorizationCodeGrantTypeParamsSchema,
|
|
3498
3503
|
fn as profileDataSchema,
|
|
3499
3504
|
yn as samlpAddon,
|
|
3500
3505
|
Dn as sessionInsertSchema,
|
|
3501
3506
|
rr as sessionSchema,
|
|
3502
|
-
|
|
3507
|
+
sr as signingKeySchema,
|
|
3503
3508
|
Sn as tenantInsertSchema,
|
|
3504
3509
|
Tn as tenantSchema,
|
|
3505
3510
|
Bn as themeInsertSchema,
|
|
3506
3511
|
dr as themeSchema,
|
|
3507
3512
|
Wn as totalsSchema,
|
|
3508
3513
|
_n as userInsertSchema,
|
|
3509
|
-
|
|
3514
|
+
Gn as userResponseSchema,
|
|
3510
3515
|
gn as userSchema,
|
|
3511
3516
|
Fn as vendorSettingsSchema,
|
|
3512
3517
|
zn as widgetSchema
|