@authhero/cloudflare-adapter 2.7.5 → 2.7.6
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/dist/cloudflare-adapter.cjs +1 -1
- package/dist/cloudflare-adapter.mjs +904 -931
- package/package.json +6 -7
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { verificationMethodsSchema as
|
|
5
|
-
import
|
|
6
|
-
function
|
|
1
|
+
var ot = Object.defineProperty;
|
|
2
|
+
var ct = (r, e, t) => e in r ? ot(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var we = (r, e, t) => ct(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { verificationMethodsSchema as dt } from "@authhero/adapter-interfaces";
|
|
5
|
+
import ut from "wretch";
|
|
6
|
+
function lt(r, e) {
|
|
7
7
|
var t = {};
|
|
8
8
|
for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && e.indexOf(s) < 0 && (t[s] = r[s]);
|
|
9
9
|
if (r != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -11,46 +11,46 @@ function ft(r, e) {
|
|
|
11
11
|
e.indexOf(s[n]) < 0 && Object.prototype.propertyIsEnumerable.call(r, s[n]) && (t[s[n]] = r[s[n]]);
|
|
12
12
|
return t;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function ft(r, e) {
|
|
15
15
|
var t;
|
|
16
16
|
return ((t = r == null ? void 0 : r._def) === null || t === void 0 ? void 0 : t.typeName) === e;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function ie(r, e) {
|
|
19
19
|
const t = r.ZodType.prototype[e];
|
|
20
20
|
r.ZodType.prototype[e] = function(...s) {
|
|
21
21
|
const n = t.apply(this, s);
|
|
22
22
|
return n._def.openapi = this._def.openapi, n;
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function ht(r) {
|
|
26
26
|
if (typeof r.ZodType.prototype.openapi < "u")
|
|
27
27
|
return;
|
|
28
28
|
r.ZodType.prototype.openapi = function(n, a) {
|
|
29
|
-
var i, o, c,
|
|
30
|
-
const
|
|
31
|
-
param: Object.assign(Object.assign({}, (b = (
|
|
32
|
-
} : void 0),
|
|
33
|
-
if (
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
var
|
|
37
|
-
const
|
|
38
|
-
return
|
|
29
|
+
var i, o, c, u, p, b;
|
|
30
|
+
const A = typeof n == "string" ? a : n, w = A ?? {}, { param: V } = w, Ze = lt(w, ["param"]), L = Object.assign(Object.assign({}, (i = this._def.openapi) === null || i === void 0 ? void 0 : i._internal), typeof n == "string" ? { refId: n } : void 0), be = Object.assign(Object.assign(Object.assign({}, (o = this._def.openapi) === null || o === void 0 ? void 0 : o.metadata), Ze), !((u = (c = this._def.openapi) === null || c === void 0 ? void 0 : c.metadata) === null || u === void 0) && u.param || V ? {
|
|
31
|
+
param: Object.assign(Object.assign({}, (b = (p = this._def.openapi) === null || p === void 0 ? void 0 : p.metadata) === null || b === void 0 ? void 0 : b.param), V)
|
|
32
|
+
} : void 0), q = new this.constructor(Object.assign(Object.assign({}, this._def), { openapi: Object.assign(Object.assign({}, Object.keys(L).length > 0 ? { _internal: L } : void 0), Object.keys(be).length > 0 ? { metadata: be } : void 0) }));
|
|
33
|
+
if (ft(this, "ZodObject")) {
|
|
34
|
+
const ne = this.extend;
|
|
35
|
+
q.extend = function(...ae) {
|
|
36
|
+
var Ee, Ie, $e, Pe, Me, De, Ve;
|
|
37
|
+
const Le = ne.apply(this, ae);
|
|
38
|
+
return Le._def.openapi = {
|
|
39
39
|
_internal: {
|
|
40
|
-
extendedFrom: !((Ie = (
|
|
40
|
+
extendedFrom: !((Ie = (Ee = this._def.openapi) === null || Ee === void 0 ? void 0 : Ee._internal) === null || Ie === void 0) && Ie.refId ? { refId: (Pe = ($e = this._def.openapi) === null || $e === void 0 ? void 0 : $e._internal) === null || Pe === void 0 ? void 0 : Pe.refId, schema: this } : (De = (Me = this._def.openapi) === null || Me === void 0 ? void 0 : Me._internal) === null || De === void 0 ? void 0 : De.extendedFrom
|
|
41
41
|
},
|
|
42
|
-
metadata: (
|
|
43
|
-
},
|
|
42
|
+
metadata: (Ve = Le._def.openapi) === null || Ve === void 0 ? void 0 : Ve.metadata
|
|
43
|
+
}, Le;
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
-
return
|
|
47
|
-
},
|
|
46
|
+
return q;
|
|
47
|
+
}, ie(r, "optional"), ie(r, "nullable"), ie(r, "default"), ie(r, "transform"), ie(r, "refine");
|
|
48
48
|
const e = r.ZodObject.prototype.deepPartial;
|
|
49
49
|
r.ZodObject.prototype.deepPartial = function() {
|
|
50
50
|
const n = this._def.shape(), a = e.apply(this), i = a._def.shape();
|
|
51
51
|
return Object.entries(i).forEach(([o, c]) => {
|
|
52
|
-
var
|
|
53
|
-
c._def.openapi = (
|
|
52
|
+
var u, p;
|
|
53
|
+
c._def.openapi = (p = (u = n[o]) === null || u === void 0 ? void 0 : u._def) === null || p === void 0 ? void 0 : p.openapi;
|
|
54
54
|
}), a._def.openapi = void 0, a;
|
|
55
55
|
};
|
|
56
56
|
const t = r.ZodObject.prototype.pick;
|
|
@@ -64,11 +64,11 @@ function pt(r) {
|
|
|
64
64
|
return a._def.openapi = void 0, a;
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
|
-
var
|
|
67
|
+
var G = class extends Error {
|
|
68
68
|
constructor(e = 500, t) {
|
|
69
69
|
super(t == null ? void 0 : t.message, { cause: t == null ? void 0 : t.cause });
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
we(this, "res");
|
|
71
|
+
we(this, "status");
|
|
72
72
|
this.res = t == null ? void 0 : t.res, this.status = e;
|
|
73
73
|
}
|
|
74
74
|
getResponse() {
|
|
@@ -83,7 +83,8 @@ var H = class extends Error {
|
|
|
83
83
|
new Set(".\\+*[^]$()");
|
|
84
84
|
var x;
|
|
85
85
|
(function(r) {
|
|
86
|
-
r.assertEqual = (n) =>
|
|
86
|
+
r.assertEqual = (n) => {
|
|
87
|
+
};
|
|
87
88
|
function e(n) {
|
|
88
89
|
}
|
|
89
90
|
r.assertIs = e;
|
|
@@ -111,20 +112,20 @@ var x;
|
|
|
111
112
|
for (const i of n)
|
|
112
113
|
if (a(i))
|
|
113
114
|
return i;
|
|
114
|
-
}, r.isInteger = typeof Number.isInteger == "function" ? (n) => Number.isInteger(n) : (n) => typeof n == "number" && isFinite(n) && Math.floor(n) === n;
|
|
115
|
+
}, r.isInteger = typeof Number.isInteger == "function" ? (n) => Number.isInteger(n) : (n) => typeof n == "number" && Number.isFinite(n) && Math.floor(n) === n;
|
|
115
116
|
function s(n, a = " | ") {
|
|
116
117
|
return n.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
|
|
117
118
|
}
|
|
118
119
|
r.joinValues = s, r.jsonStringifyReplacer = (n, a) => typeof a == "bigint" ? a.toString() : a;
|
|
119
120
|
})(x || (x = {}));
|
|
120
|
-
var
|
|
121
|
+
var Fe;
|
|
121
122
|
(function(r) {
|
|
122
123
|
r.mergeShapes = (e, t) => ({
|
|
123
124
|
...e,
|
|
124
125
|
...t
|
|
125
126
|
// second overwrites first
|
|
126
127
|
});
|
|
127
|
-
})(
|
|
128
|
+
})(Fe || (Fe = {}));
|
|
128
129
|
const f = x.arrayToEnum([
|
|
129
130
|
"string",
|
|
130
131
|
"nan",
|
|
@@ -146,14 +147,14 @@ const f = x.arrayToEnum([
|
|
|
146
147
|
"never",
|
|
147
148
|
"map",
|
|
148
149
|
"set"
|
|
149
|
-
]),
|
|
150
|
+
]), M = (r) => {
|
|
150
151
|
switch (typeof r) {
|
|
151
152
|
case "undefined":
|
|
152
153
|
return f.undefined;
|
|
153
154
|
case "string":
|
|
154
155
|
return f.string;
|
|
155
156
|
case "number":
|
|
156
|
-
return isNaN(r) ? f.nan : f.number;
|
|
157
|
+
return Number.isNaN(r) ? f.nan : f.number;
|
|
157
158
|
case "boolean":
|
|
158
159
|
return f.boolean;
|
|
159
160
|
case "function":
|
|
@@ -167,7 +168,7 @@ const f = x.arrayToEnum([
|
|
|
167
168
|
default:
|
|
168
169
|
return f.unknown;
|
|
169
170
|
}
|
|
170
|
-
},
|
|
171
|
+
}, d = x.arrayToEnum([
|
|
171
172
|
"invalid_type",
|
|
172
173
|
"invalid_literal",
|
|
173
174
|
"custom",
|
|
@@ -184,8 +185,8 @@ const f = x.arrayToEnum([
|
|
|
184
185
|
"invalid_intersection_types",
|
|
185
186
|
"not_multiple_of",
|
|
186
187
|
"not_finite"
|
|
187
|
-
]),
|
|
188
|
-
class
|
|
188
|
+
]), pt = (r) => JSON.stringify(r, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
189
|
+
class S extends Error {
|
|
189
190
|
get errors() {
|
|
190
191
|
return this.issues;
|
|
191
192
|
}
|
|
@@ -214,15 +215,15 @@ class Z extends Error {
|
|
|
214
215
|
else {
|
|
215
216
|
let o = s, c = 0;
|
|
216
217
|
for (; c < i.path.length; ) {
|
|
217
|
-
const
|
|
218
|
-
c === i.path.length - 1 ? (o[
|
|
218
|
+
const u = i.path[c];
|
|
219
|
+
c === i.path.length - 1 ? (o[u] = o[u] || { _errors: [] }, o[u]._errors.push(t(i))) : o[u] = o[u] || { _errors: [] }, o = o[u], c++;
|
|
219
220
|
}
|
|
220
221
|
}
|
|
221
222
|
};
|
|
222
223
|
return n(this), s;
|
|
223
224
|
}
|
|
224
225
|
static assert(e) {
|
|
225
|
-
if (!(e instanceof
|
|
226
|
+
if (!(e instanceof S))
|
|
226
227
|
throw new Error(`Not a ZodError: ${e}`);
|
|
227
228
|
}
|
|
228
229
|
toString() {
|
|
@@ -237,63 +238,67 @@ class Z extends Error {
|
|
|
237
238
|
flatten(e = (t) => t.message) {
|
|
238
239
|
const t = {}, s = [];
|
|
239
240
|
for (const n of this.issues)
|
|
240
|
-
n.path.length > 0
|
|
241
|
+
if (n.path.length > 0) {
|
|
242
|
+
const a = n.path[0];
|
|
243
|
+
t[a] = t[a] || [], t[a].push(e(n));
|
|
244
|
+
} else
|
|
245
|
+
s.push(e(n));
|
|
241
246
|
return { formErrors: s, fieldErrors: t };
|
|
242
247
|
}
|
|
243
248
|
get formErrors() {
|
|
244
249
|
return this.flatten();
|
|
245
250
|
}
|
|
246
251
|
}
|
|
247
|
-
|
|
248
|
-
const
|
|
252
|
+
S.create = (r) => new S(r);
|
|
253
|
+
const te = (r, e) => {
|
|
249
254
|
let t;
|
|
250
255
|
switch (r.code) {
|
|
251
|
-
case
|
|
256
|
+
case d.invalid_type:
|
|
252
257
|
r.received === f.undefined ? t = "Required" : t = `Expected ${r.expected}, received ${r.received}`;
|
|
253
258
|
break;
|
|
254
|
-
case
|
|
259
|
+
case d.invalid_literal:
|
|
255
260
|
t = `Invalid literal value, expected ${JSON.stringify(r.expected, x.jsonStringifyReplacer)}`;
|
|
256
261
|
break;
|
|
257
|
-
case
|
|
262
|
+
case d.unrecognized_keys:
|
|
258
263
|
t = `Unrecognized key(s) in object: ${x.joinValues(r.keys, ", ")}`;
|
|
259
264
|
break;
|
|
260
|
-
case
|
|
265
|
+
case d.invalid_union:
|
|
261
266
|
t = "Invalid input";
|
|
262
267
|
break;
|
|
263
|
-
case
|
|
268
|
+
case d.invalid_union_discriminator:
|
|
264
269
|
t = `Invalid discriminator value. Expected ${x.joinValues(r.options)}`;
|
|
265
270
|
break;
|
|
266
|
-
case
|
|
271
|
+
case d.invalid_enum_value:
|
|
267
272
|
t = `Invalid enum value. Expected ${x.joinValues(r.options)}, received '${r.received}'`;
|
|
268
273
|
break;
|
|
269
|
-
case
|
|
274
|
+
case d.invalid_arguments:
|
|
270
275
|
t = "Invalid function arguments";
|
|
271
276
|
break;
|
|
272
|
-
case
|
|
277
|
+
case d.invalid_return_type:
|
|
273
278
|
t = "Invalid function return type";
|
|
274
279
|
break;
|
|
275
|
-
case
|
|
280
|
+
case d.invalid_date:
|
|
276
281
|
t = "Invalid date";
|
|
277
282
|
break;
|
|
278
|
-
case
|
|
283
|
+
case d.invalid_string:
|
|
279
284
|
typeof r.validation == "object" ? "includes" in r.validation ? (t = `Invalid input: must include "${r.validation.includes}"`, typeof r.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${r.validation.position}`)) : "startsWith" in r.validation ? t = `Invalid input: must start with "${r.validation.startsWith}"` : "endsWith" in r.validation ? t = `Invalid input: must end with "${r.validation.endsWith}"` : x.assertNever(r.validation) : r.validation !== "regex" ? t = `Invalid ${r.validation}` : t = "Invalid";
|
|
280
285
|
break;
|
|
281
|
-
case
|
|
282
|
-
r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "more than"} ${r.minimum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "over"} ${r.minimum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${r.minimum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(r.minimum))}` : t = "Invalid input";
|
|
286
|
+
case d.too_small:
|
|
287
|
+
r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "more than"} ${r.minimum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "over"} ${r.minimum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${r.minimum}` : r.type === "bigint" ? t = `Number must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${r.minimum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(r.minimum))}` : t = "Invalid input";
|
|
283
288
|
break;
|
|
284
|
-
case
|
|
289
|
+
case d.too_big:
|
|
285
290
|
r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "less than"} ${r.maximum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "under"} ${r.maximum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "bigint" ? t = `BigInt must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly" : r.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(r.maximum))}` : t = "Invalid input";
|
|
286
291
|
break;
|
|
287
|
-
case
|
|
292
|
+
case d.custom:
|
|
288
293
|
t = "Invalid input";
|
|
289
294
|
break;
|
|
290
|
-
case
|
|
295
|
+
case d.invalid_intersection_types:
|
|
291
296
|
t = "Intersection results could not be merged";
|
|
292
297
|
break;
|
|
293
|
-
case
|
|
298
|
+
case d.not_multiple_of:
|
|
294
299
|
t = `Number must be a multiple of ${r.multipleOf}`;
|
|
295
300
|
break;
|
|
296
|
-
case
|
|
301
|
+
case d.not_finite:
|
|
297
302
|
t = "Number must be finite";
|
|
298
303
|
break;
|
|
299
304
|
default:
|
|
@@ -301,14 +306,14 @@ const Q = (r, e) => {
|
|
|
301
306
|
}
|
|
302
307
|
return { message: t };
|
|
303
308
|
};
|
|
304
|
-
let
|
|
305
|
-
function
|
|
306
|
-
|
|
309
|
+
let Qe = te;
|
|
310
|
+
function mt(r) {
|
|
311
|
+
Qe = r;
|
|
307
312
|
}
|
|
308
|
-
function
|
|
309
|
-
return
|
|
313
|
+
function Te() {
|
|
314
|
+
return Qe;
|
|
310
315
|
}
|
|
311
|
-
const
|
|
316
|
+
const Ce = (r) => {
|
|
312
317
|
const { data: e, path: t, errorMaps: s, issueData: n } = r, a = [...t, ...n.path || []], i = {
|
|
313
318
|
...n,
|
|
314
319
|
path: a
|
|
@@ -320,9 +325,9 @@ const Te = (r) => {
|
|
|
320
325
|
message: n.message
|
|
321
326
|
};
|
|
322
327
|
let o = "";
|
|
323
|
-
const c = s.filter((
|
|
324
|
-
for (const
|
|
325
|
-
o =
|
|
328
|
+
const c = s.filter((u) => !!u).slice().reverse();
|
|
329
|
+
for (const u of c)
|
|
330
|
+
o = u(i, { data: e, defaultError: o }).message;
|
|
326
331
|
return {
|
|
327
332
|
...n,
|
|
328
333
|
path: a,
|
|
@@ -330,7 +335,7 @@ const Te = (r) => {
|
|
|
330
335
|
};
|
|
331
336
|
}, yt = [];
|
|
332
337
|
function l(r, e) {
|
|
333
|
-
const t =
|
|
338
|
+
const t = Te(), s = Ce({
|
|
334
339
|
issueData: e,
|
|
335
340
|
data: r.data,
|
|
336
341
|
path: r.path,
|
|
@@ -341,7 +346,7 @@ function l(r, e) {
|
|
|
341
346
|
// then schema-bound map if available
|
|
342
347
|
t,
|
|
343
348
|
// then global override map
|
|
344
|
-
t ===
|
|
349
|
+
t === te ? void 0 : te
|
|
345
350
|
// then global default map
|
|
346
351
|
].filter((n) => !!n)
|
|
347
352
|
});
|
|
@@ -361,7 +366,7 @@ class T {
|
|
|
361
366
|
const s = [];
|
|
362
367
|
for (const n of t) {
|
|
363
368
|
if (n.status === "aborted")
|
|
364
|
-
return
|
|
369
|
+
return m;
|
|
365
370
|
n.status === "dirty" && e.dirty(), s.push(n.value);
|
|
366
371
|
}
|
|
367
372
|
return { status: e.value, value: s };
|
|
@@ -382,38 +387,29 @@ class T {
|
|
|
382
387
|
for (const n of t) {
|
|
383
388
|
const { key: a, value: i } = n;
|
|
384
389
|
if (a.status === "aborted" || i.status === "aborted")
|
|
385
|
-
return
|
|
390
|
+
return m;
|
|
386
391
|
a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value < "u" || n.alwaysSet) && (s[a.value] = i.value);
|
|
387
392
|
}
|
|
388
393
|
return { status: e.value, value: s };
|
|
389
394
|
}
|
|
390
395
|
}
|
|
391
|
-
const
|
|
396
|
+
const m = Object.freeze({
|
|
392
397
|
status: "aborted"
|
|
393
|
-
}),
|
|
394
|
-
|
|
395
|
-
if (typeof e == "function" ? r !== e || !s : !e.has(r)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
396
|
-
return e.get(r);
|
|
397
|
-
}
|
|
398
|
-
function Xe(r, e, t, s, n) {
|
|
399
|
-
if (typeof e == "function" ? r !== e || !n : !e.has(r)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
400
|
-
return e.set(r, t), t;
|
|
401
|
-
}
|
|
402
|
-
var m;
|
|
398
|
+
}), Q = (r) => ({ status: "dirty", value: r }), C = (r) => ({ status: "valid", value: r }), qe = (r) => r.status === "aborted", We = (r) => r.status === "dirty", J = (r) => r.status === "valid", oe = (r) => typeof Promise < "u" && r instanceof Promise;
|
|
399
|
+
var h;
|
|
403
400
|
(function(r) {
|
|
404
401
|
r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
405
|
-
})(
|
|
406
|
-
|
|
407
|
-
class R {
|
|
402
|
+
})(h || (h = {}));
|
|
403
|
+
class I {
|
|
408
404
|
constructor(e, t, s, n) {
|
|
409
405
|
this._cachedPath = [], this.parent = e, this.data = t, this._path = s, this._key = n;
|
|
410
406
|
}
|
|
411
407
|
get path() {
|
|
412
|
-
return this._cachedPath.length || (this._key
|
|
408
|
+
return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
413
409
|
}
|
|
414
410
|
}
|
|
415
|
-
const
|
|
416
|
-
if (
|
|
411
|
+
const Ge = (r, e) => {
|
|
412
|
+
if (J(e))
|
|
417
413
|
return { success: !0, data: e.value };
|
|
418
414
|
if (!r.common.issues.length)
|
|
419
415
|
throw new Error("Validation failed but no issues detected.");
|
|
@@ -422,35 +418,34 @@ const He = (r, e) => {
|
|
|
422
418
|
get error() {
|
|
423
419
|
if (this._error)
|
|
424
420
|
return this._error;
|
|
425
|
-
const t = new
|
|
421
|
+
const t = new S(r.common.issues);
|
|
426
422
|
return this._error = t, this._error;
|
|
427
423
|
}
|
|
428
424
|
};
|
|
429
425
|
};
|
|
430
|
-
function
|
|
426
|
+
function _(r) {
|
|
431
427
|
if (!r)
|
|
432
428
|
return {};
|
|
433
429
|
const { errorMap: e, invalid_type_error: t, required_error: s, description: n } = r;
|
|
434
430
|
if (e && (t || s))
|
|
435
431
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
436
432
|
return e ? { errorMap: e, description: n } : { errorMap: (i, o) => {
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
return i.code === "invalid_enum_value" ? { message: h ?? o.defaultError } : typeof o.data > "u" ? { message: (c = h ?? s) !== null && c !== void 0 ? c : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (d = h ?? t) !== null && d !== void 0 ? d : o.defaultError };
|
|
433
|
+
const { message: c } = r;
|
|
434
|
+
return i.code === "invalid_enum_value" ? { message: c ?? o.defaultError } : typeof o.data > "u" ? { message: c ?? s ?? o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: c ?? t ?? o.defaultError };
|
|
440
435
|
}, description: n };
|
|
441
436
|
}
|
|
442
|
-
class
|
|
437
|
+
class v {
|
|
443
438
|
get description() {
|
|
444
439
|
return this._def.description;
|
|
445
440
|
}
|
|
446
441
|
_getType(e) {
|
|
447
|
-
return
|
|
442
|
+
return M(e.data);
|
|
448
443
|
}
|
|
449
444
|
_getOrReturnCtx(e, t) {
|
|
450
445
|
return t || {
|
|
451
446
|
common: e.parent.common,
|
|
452
447
|
data: e.data,
|
|
453
|
-
parsedType:
|
|
448
|
+
parsedType: M(e.data),
|
|
454
449
|
schemaErrorMap: this._def.errorMap,
|
|
455
450
|
path: e.path,
|
|
456
451
|
parent: e.parent
|
|
@@ -462,7 +457,7 @@ class g {
|
|
|
462
457
|
ctx: {
|
|
463
458
|
common: e.parent.common,
|
|
464
459
|
data: e.data,
|
|
465
|
-
parsedType:
|
|
460
|
+
parsedType: M(e.data),
|
|
466
461
|
schemaErrorMap: this._def.errorMap,
|
|
467
462
|
path: e.path,
|
|
468
463
|
parent: e.parent
|
|
@@ -486,24 +481,23 @@ class g {
|
|
|
486
481
|
throw s.error;
|
|
487
482
|
}
|
|
488
483
|
safeParse(e, t) {
|
|
489
|
-
|
|
490
|
-
const n = {
|
|
484
|
+
const s = {
|
|
491
485
|
common: {
|
|
492
486
|
issues: [],
|
|
493
|
-
async: (
|
|
487
|
+
async: (t == null ? void 0 : t.async) ?? !1,
|
|
494
488
|
contextualErrorMap: t == null ? void 0 : t.errorMap
|
|
495
489
|
},
|
|
496
490
|
path: (t == null ? void 0 : t.path) || [],
|
|
497
491
|
schemaErrorMap: this._def.errorMap,
|
|
498
492
|
parent: null,
|
|
499
493
|
data: e,
|
|
500
|
-
parsedType:
|
|
501
|
-
},
|
|
502
|
-
return
|
|
494
|
+
parsedType: M(e)
|
|
495
|
+
}, n = this._parseSync({ data: e, path: s.path, parent: s });
|
|
496
|
+
return Ge(s, n);
|
|
503
497
|
}
|
|
504
498
|
"~validate"(e) {
|
|
505
|
-
var
|
|
506
|
-
const
|
|
499
|
+
var s, n;
|
|
500
|
+
const t = {
|
|
507
501
|
common: {
|
|
508
502
|
issues: [],
|
|
509
503
|
async: !!this["~standard"].async
|
|
@@ -512,26 +506,26 @@ class g {
|
|
|
512
506
|
schemaErrorMap: this._def.errorMap,
|
|
513
507
|
parent: null,
|
|
514
508
|
data: e,
|
|
515
|
-
parsedType:
|
|
509
|
+
parsedType: M(e)
|
|
516
510
|
};
|
|
517
511
|
if (!this["~standard"].async)
|
|
518
512
|
try {
|
|
519
|
-
const a = this._parseSync({ data: e, path: [], parent:
|
|
520
|
-
return
|
|
513
|
+
const a = this._parseSync({ data: e, path: [], parent: t });
|
|
514
|
+
return J(a) ? {
|
|
521
515
|
value: a.value
|
|
522
516
|
} : {
|
|
523
|
-
issues:
|
|
517
|
+
issues: t.common.issues
|
|
524
518
|
};
|
|
525
519
|
} catch (a) {
|
|
526
|
-
|
|
520
|
+
(n = (s = a == null ? void 0 : a.message) == null ? void 0 : s.toLowerCase()) != null && n.includes("encountered") && (this["~standard"].async = !0), t.common = {
|
|
527
521
|
issues: [],
|
|
528
522
|
async: !0
|
|
529
523
|
};
|
|
530
524
|
}
|
|
531
|
-
return this._parseAsync({ data: e, path: [], parent:
|
|
525
|
+
return this._parseAsync({ data: e, path: [], parent: t }).then((a) => J(a) ? {
|
|
532
526
|
value: a.value
|
|
533
527
|
} : {
|
|
534
|
-
issues:
|
|
528
|
+
issues: t.common.issues
|
|
535
529
|
});
|
|
536
530
|
}
|
|
537
531
|
async parseAsync(e, t) {
|
|
@@ -551,15 +545,15 @@ class g {
|
|
|
551
545
|
schemaErrorMap: this._def.errorMap,
|
|
552
546
|
parent: null,
|
|
553
547
|
data: e,
|
|
554
|
-
parsedType:
|
|
548
|
+
parsedType: M(e)
|
|
555
549
|
}, n = this._parse({ data: e, path: s.path, parent: s }), a = await (oe(n) ? n : Promise.resolve(n));
|
|
556
|
-
return
|
|
550
|
+
return Ge(s, a);
|
|
557
551
|
}
|
|
558
552
|
refine(e, t) {
|
|
559
553
|
const s = (n) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(n) : t;
|
|
560
554
|
return this._refinement((n, a) => {
|
|
561
555
|
const i = e(n), o = () => a.addIssue({
|
|
562
|
-
code:
|
|
556
|
+
code: d.custom,
|
|
563
557
|
...s(n)
|
|
564
558
|
});
|
|
565
559
|
return typeof Promise < "u" && i instanceof Promise ? i.then((c) => c ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
|
|
@@ -569,9 +563,9 @@ class g {
|
|
|
569
563
|
return this._refinement((s, n) => e(s) ? !0 : (n.addIssue(typeof t == "function" ? t(s, n) : t), !1));
|
|
570
564
|
}
|
|
571
565
|
_refinement(e) {
|
|
572
|
-
return new
|
|
566
|
+
return new N({
|
|
573
567
|
schema: this,
|
|
574
|
-
typeName:
|
|
568
|
+
typeName: y.ZodEffects,
|
|
575
569
|
effect: { type: "refinement", refinement: e }
|
|
576
570
|
});
|
|
577
571
|
}
|
|
@@ -589,16 +583,16 @@ class g {
|
|
|
589
583
|
return E.create(this, this._def);
|
|
590
584
|
}
|
|
591
585
|
nullable() {
|
|
592
|
-
return
|
|
586
|
+
return F.create(this, this._def);
|
|
593
587
|
}
|
|
594
588
|
nullish() {
|
|
595
589
|
return this.nullable().optional();
|
|
596
590
|
}
|
|
597
591
|
array() {
|
|
598
|
-
return
|
|
592
|
+
return R.create(this);
|
|
599
593
|
}
|
|
600
594
|
promise() {
|
|
601
|
-
return
|
|
595
|
+
return se.create(this, this._def);
|
|
602
596
|
}
|
|
603
597
|
or(e) {
|
|
604
598
|
return le.create([this, e], this._def);
|
|
@@ -607,36 +601,36 @@ class g {
|
|
|
607
601
|
return fe.create(this, e, this._def);
|
|
608
602
|
}
|
|
609
603
|
transform(e) {
|
|
610
|
-
return new
|
|
611
|
-
...
|
|
604
|
+
return new N({
|
|
605
|
+
..._(this._def),
|
|
612
606
|
schema: this,
|
|
613
|
-
typeName:
|
|
607
|
+
typeName: y.ZodEffects,
|
|
614
608
|
effect: { type: "transform", transform: e }
|
|
615
609
|
});
|
|
616
610
|
}
|
|
617
611
|
default(e) {
|
|
618
612
|
const t = typeof e == "function" ? e : () => e;
|
|
619
|
-
return new
|
|
620
|
-
...
|
|
613
|
+
return new _e({
|
|
614
|
+
..._(this._def),
|
|
621
615
|
innerType: this,
|
|
622
616
|
defaultValue: t,
|
|
623
|
-
typeName:
|
|
617
|
+
typeName: y.ZodDefault
|
|
624
618
|
});
|
|
625
619
|
}
|
|
626
620
|
brand() {
|
|
627
|
-
return new
|
|
628
|
-
typeName:
|
|
621
|
+
return new He({
|
|
622
|
+
typeName: y.ZodBranded,
|
|
629
623
|
type: this,
|
|
630
|
-
...
|
|
624
|
+
..._(this._def)
|
|
631
625
|
});
|
|
632
626
|
}
|
|
633
627
|
catch(e) {
|
|
634
628
|
const t = typeof e == "function" ? e : () => e;
|
|
635
|
-
return new
|
|
636
|
-
...
|
|
629
|
+
return new ge({
|
|
630
|
+
..._(this._def),
|
|
637
631
|
innerType: this,
|
|
638
632
|
catchValue: t,
|
|
639
|
-
typeName:
|
|
633
|
+
typeName: y.ZodCatch
|
|
640
634
|
});
|
|
641
635
|
}
|
|
642
636
|
describe(e) {
|
|
@@ -650,7 +644,7 @@ class g {
|
|
|
650
644
|
return xe.create(this, e);
|
|
651
645
|
}
|
|
652
646
|
readonly() {
|
|
653
|
-
return
|
|
647
|
+
return ve.create(this);
|
|
654
648
|
}
|
|
655
649
|
isOptional() {
|
|
656
650
|
return this.safeParse(void 0).success;
|
|
@@ -659,55 +653,58 @@ class g {
|
|
|
659
653
|
return this.safeParse(null).success;
|
|
660
654
|
}
|
|
661
655
|
}
|
|
662
|
-
const
|
|
663
|
-
let
|
|
664
|
-
const
|
|
665
|
-
function
|
|
656
|
+
const _t = /^c[^\s-]{8,}$/i, gt = /^[0-9a-z]+$/, vt = /^[0-9A-HJKMNP-TV-Z]{26}$/i, xt = /^[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, kt = /^[a-z0-9_-]{21}$/i, bt = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, wt = /^[-+]?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)?)??$/, Tt = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Ct = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
657
|
+
let ze;
|
|
658
|
+
const St = /^(?:(?: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])$/, Ot = /^(?:(?: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])$/, At = /^(([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]))$/, jt = /^(([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])$/, Rt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Nt = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, et = "((\\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])))", Zt = new RegExp(`^${et}$`);
|
|
659
|
+
function tt(r) {
|
|
666
660
|
let e = "[0-5]\\d";
|
|
667
661
|
r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`);
|
|
668
662
|
const t = r.precision ? "+" : "?";
|
|
669
663
|
return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`;
|
|
670
664
|
}
|
|
671
|
-
function
|
|
672
|
-
return new RegExp(`^${
|
|
665
|
+
function Et(r) {
|
|
666
|
+
return new RegExp(`^${tt(r)}$`);
|
|
673
667
|
}
|
|
674
|
-
function
|
|
675
|
-
let e = `${
|
|
668
|
+
function rt(r) {
|
|
669
|
+
let e = `${et}T${tt(r)}`;
|
|
676
670
|
const t = [];
|
|
677
671
|
return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
678
672
|
}
|
|
679
|
-
function
|
|
680
|
-
return !!((e === "v4" || !e) &&
|
|
673
|
+
function It(r, e) {
|
|
674
|
+
return !!((e === "v4" || !e) && St.test(r) || (e === "v6" || !e) && At.test(r));
|
|
681
675
|
}
|
|
682
|
-
function
|
|
683
|
-
if (!
|
|
676
|
+
function $t(r, e) {
|
|
677
|
+
if (!bt.test(r))
|
|
684
678
|
return !1;
|
|
685
679
|
try {
|
|
686
|
-
const [t] = r.split(".")
|
|
687
|
-
|
|
680
|
+
const [t] = r.split(".");
|
|
681
|
+
if (!t)
|
|
682
|
+
return !1;
|
|
683
|
+
const s = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), n = JSON.parse(atob(s));
|
|
684
|
+
return !(typeof n != "object" || n === null || "typ" in n && (n == null ? void 0 : n.typ) !== "JWT" || !n.alg || e && n.alg !== e);
|
|
688
685
|
} catch {
|
|
689
686
|
return !1;
|
|
690
687
|
}
|
|
691
688
|
}
|
|
692
|
-
function
|
|
693
|
-
return !!((e === "v4" || !e) && Ot.test(r) || (e === "v6" || !e) &&
|
|
689
|
+
function Pt(r, e) {
|
|
690
|
+
return !!((e === "v4" || !e) && Ot.test(r) || (e === "v6" || !e) && jt.test(r));
|
|
694
691
|
}
|
|
695
|
-
class
|
|
692
|
+
class j extends v {
|
|
696
693
|
_parse(e) {
|
|
697
694
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== f.string) {
|
|
698
695
|
const a = this._getOrReturnCtx(e);
|
|
699
696
|
return l(a, {
|
|
700
|
-
code:
|
|
697
|
+
code: d.invalid_type,
|
|
701
698
|
expected: f.string,
|
|
702
699
|
received: a.parsedType
|
|
703
|
-
}),
|
|
700
|
+
}), m;
|
|
704
701
|
}
|
|
705
702
|
const s = new T();
|
|
706
703
|
let n;
|
|
707
704
|
for (const a of this._def.checks)
|
|
708
705
|
if (a.kind === "min")
|
|
709
706
|
e.data.length < a.value && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
710
|
-
code:
|
|
707
|
+
code: d.too_small,
|
|
711
708
|
minimum: a.value,
|
|
712
709
|
type: "string",
|
|
713
710
|
inclusive: !0,
|
|
@@ -716,7 +713,7 @@ class O extends g {
|
|
|
716
713
|
}), s.dirty());
|
|
717
714
|
else if (a.kind === "max")
|
|
718
715
|
e.data.length > a.value && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
719
|
-
code:
|
|
716
|
+
code: d.too_big,
|
|
720
717
|
maximum: a.value,
|
|
721
718
|
type: "string",
|
|
722
719
|
inclusive: !0,
|
|
@@ -726,14 +723,14 @@ class O extends g {
|
|
|
726
723
|
else if (a.kind === "length") {
|
|
727
724
|
const i = e.data.length > a.value, o = e.data.length < a.value;
|
|
728
725
|
(i || o) && (n = this._getOrReturnCtx(e, n), i ? l(n, {
|
|
729
|
-
code:
|
|
726
|
+
code: d.too_big,
|
|
730
727
|
maximum: a.value,
|
|
731
728
|
type: "string",
|
|
732
729
|
inclusive: !0,
|
|
733
730
|
exact: !0,
|
|
734
731
|
message: a.message
|
|
735
732
|
}) : o && l(n, {
|
|
736
|
-
code:
|
|
733
|
+
code: d.too_small,
|
|
737
734
|
minimum: a.value,
|
|
738
735
|
type: "string",
|
|
739
736
|
inclusive: !0,
|
|
@@ -741,45 +738,45 @@ class O extends g {
|
|
|
741
738
|
message: a.message
|
|
742
739
|
}), s.dirty());
|
|
743
740
|
} else if (a.kind === "email")
|
|
744
|
-
|
|
741
|
+
Tt.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
745
742
|
validation: "email",
|
|
746
|
-
code:
|
|
743
|
+
code: d.invalid_string,
|
|
747
744
|
message: a.message
|
|
748
745
|
}), s.dirty());
|
|
749
746
|
else if (a.kind === "emoji")
|
|
750
|
-
|
|
747
|
+
ze || (ze = new RegExp(Ct, "u")), ze.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
751
748
|
validation: "emoji",
|
|
752
|
-
code:
|
|
749
|
+
code: d.invalid_string,
|
|
753
750
|
message: a.message
|
|
754
751
|
}), s.dirty());
|
|
755
752
|
else if (a.kind === "uuid")
|
|
756
|
-
|
|
753
|
+
xt.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
757
754
|
validation: "uuid",
|
|
758
|
-
code:
|
|
755
|
+
code: d.invalid_string,
|
|
759
756
|
message: a.message
|
|
760
757
|
}), s.dirty());
|
|
761
758
|
else if (a.kind === "nanoid")
|
|
762
759
|
kt.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
763
760
|
validation: "nanoid",
|
|
764
|
-
code:
|
|
761
|
+
code: d.invalid_string,
|
|
765
762
|
message: a.message
|
|
766
763
|
}), s.dirty());
|
|
767
764
|
else if (a.kind === "cuid")
|
|
768
|
-
|
|
765
|
+
_t.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
769
766
|
validation: "cuid",
|
|
770
|
-
code:
|
|
767
|
+
code: d.invalid_string,
|
|
771
768
|
message: a.message
|
|
772
769
|
}), s.dirty());
|
|
773
770
|
else if (a.kind === "cuid2")
|
|
774
771
|
gt.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
775
772
|
validation: "cuid2",
|
|
776
|
-
code:
|
|
773
|
+
code: d.invalid_string,
|
|
777
774
|
message: a.message
|
|
778
775
|
}), s.dirty());
|
|
779
776
|
else if (a.kind === "ulid")
|
|
780
|
-
|
|
777
|
+
vt.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
781
778
|
validation: "ulid",
|
|
782
|
-
code:
|
|
779
|
+
code: d.invalid_string,
|
|
783
780
|
message: a.message
|
|
784
781
|
}), s.dirty());
|
|
785
782
|
else if (a.kind === "url")
|
|
@@ -788,61 +785,61 @@ class O extends g {
|
|
|
788
785
|
} catch {
|
|
789
786
|
n = this._getOrReturnCtx(e, n), l(n, {
|
|
790
787
|
validation: "url",
|
|
791
|
-
code:
|
|
788
|
+
code: d.invalid_string,
|
|
792
789
|
message: a.message
|
|
793
790
|
}), s.dirty();
|
|
794
791
|
}
|
|
795
792
|
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
796
793
|
validation: "regex",
|
|
797
|
-
code:
|
|
794
|
+
code: d.invalid_string,
|
|
798
795
|
message: a.message
|
|
799
796
|
}), s.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
800
|
-
code:
|
|
797
|
+
code: d.invalid_string,
|
|
801
798
|
validation: { includes: a.value, position: a.position },
|
|
802
799
|
message: a.message
|
|
803
800
|
}), s.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
804
|
-
code:
|
|
801
|
+
code: d.invalid_string,
|
|
805
802
|
validation: { startsWith: a.value },
|
|
806
803
|
message: a.message
|
|
807
804
|
}), s.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
808
|
-
code:
|
|
805
|
+
code: d.invalid_string,
|
|
809
806
|
validation: { endsWith: a.value },
|
|
810
807
|
message: a.message
|
|
811
|
-
}), s.dirty()) : a.kind === "datetime" ?
|
|
812
|
-
code:
|
|
808
|
+
}), s.dirty()) : a.kind === "datetime" ? rt(a).test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
809
|
+
code: d.invalid_string,
|
|
813
810
|
validation: "datetime",
|
|
814
811
|
message: a.message
|
|
815
|
-
}), s.dirty()) : a.kind === "date" ?
|
|
816
|
-
code:
|
|
812
|
+
}), s.dirty()) : a.kind === "date" ? Zt.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
813
|
+
code: d.invalid_string,
|
|
817
814
|
validation: "date",
|
|
818
815
|
message: a.message
|
|
819
|
-
}), s.dirty()) : a.kind === "time" ?
|
|
820
|
-
code:
|
|
816
|
+
}), s.dirty()) : a.kind === "time" ? Et(a).test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
817
|
+
code: d.invalid_string,
|
|
821
818
|
validation: "time",
|
|
822
819
|
message: a.message
|
|
823
|
-
}), s.dirty()) : a.kind === "duration" ?
|
|
820
|
+
}), s.dirty()) : a.kind === "duration" ? wt.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
824
821
|
validation: "duration",
|
|
825
|
-
code:
|
|
822
|
+
code: d.invalid_string,
|
|
826
823
|
message: a.message
|
|
827
|
-
}), s.dirty()) : a.kind === "ip" ?
|
|
824
|
+
}), s.dirty()) : a.kind === "ip" ? It(e.data, a.version) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
828
825
|
validation: "ip",
|
|
829
|
-
code:
|
|
826
|
+
code: d.invalid_string,
|
|
830
827
|
message: a.message
|
|
831
|
-
}), s.dirty()) : a.kind === "jwt" ?
|
|
828
|
+
}), s.dirty()) : a.kind === "jwt" ? $t(e.data, a.alg) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
832
829
|
validation: "jwt",
|
|
833
|
-
code:
|
|
830
|
+
code: d.invalid_string,
|
|
834
831
|
message: a.message
|
|
835
|
-
}), s.dirty()) : a.kind === "cidr" ?
|
|
832
|
+
}), s.dirty()) : a.kind === "cidr" ? Pt(e.data, a.version) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
836
833
|
validation: "cidr",
|
|
837
|
-
code:
|
|
834
|
+
code: d.invalid_string,
|
|
838
835
|
message: a.message
|
|
839
|
-
}), s.dirty()) : a.kind === "base64" ?
|
|
836
|
+
}), s.dirty()) : a.kind === "base64" ? Rt.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
840
837
|
validation: "base64",
|
|
841
|
-
code:
|
|
838
|
+
code: d.invalid_string,
|
|
842
839
|
message: a.message
|
|
843
|
-
}), s.dirty()) : a.kind === "base64url" ?
|
|
840
|
+
}), s.dirty()) : a.kind === "base64url" ? Nt.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
844
841
|
validation: "base64url",
|
|
845
|
-
code:
|
|
842
|
+
code: d.invalid_string,
|
|
846
843
|
message: a.message
|
|
847
844
|
}), s.dirty()) : x.assertNever(a);
|
|
848
845
|
return { status: s.value, value: e.data };
|
|
@@ -850,60 +847,59 @@ class O extends g {
|
|
|
850
847
|
_regex(e, t, s) {
|
|
851
848
|
return this.refinement((n) => e.test(n), {
|
|
852
849
|
validation: t,
|
|
853
|
-
code:
|
|
854
|
-
...
|
|
850
|
+
code: d.invalid_string,
|
|
851
|
+
...h.errToObj(s)
|
|
855
852
|
});
|
|
856
853
|
}
|
|
857
854
|
_addCheck(e) {
|
|
858
|
-
return new
|
|
855
|
+
return new j({
|
|
859
856
|
...this._def,
|
|
860
857
|
checks: [...this._def.checks, e]
|
|
861
858
|
});
|
|
862
859
|
}
|
|
863
860
|
email(e) {
|
|
864
|
-
return this._addCheck({ kind: "email", ...
|
|
861
|
+
return this._addCheck({ kind: "email", ...h.errToObj(e) });
|
|
865
862
|
}
|
|
866
863
|
url(e) {
|
|
867
|
-
return this._addCheck({ kind: "url", ...
|
|
864
|
+
return this._addCheck({ kind: "url", ...h.errToObj(e) });
|
|
868
865
|
}
|
|
869
866
|
emoji(e) {
|
|
870
|
-
return this._addCheck({ kind: "emoji", ...
|
|
867
|
+
return this._addCheck({ kind: "emoji", ...h.errToObj(e) });
|
|
871
868
|
}
|
|
872
869
|
uuid(e) {
|
|
873
|
-
return this._addCheck({ kind: "uuid", ...
|
|
870
|
+
return this._addCheck({ kind: "uuid", ...h.errToObj(e) });
|
|
874
871
|
}
|
|
875
872
|
nanoid(e) {
|
|
876
|
-
return this._addCheck({ kind: "nanoid", ...
|
|
873
|
+
return this._addCheck({ kind: "nanoid", ...h.errToObj(e) });
|
|
877
874
|
}
|
|
878
875
|
cuid(e) {
|
|
879
|
-
return this._addCheck({ kind: "cuid", ...
|
|
876
|
+
return this._addCheck({ kind: "cuid", ...h.errToObj(e) });
|
|
880
877
|
}
|
|
881
878
|
cuid2(e) {
|
|
882
|
-
return this._addCheck({ kind: "cuid2", ...
|
|
879
|
+
return this._addCheck({ kind: "cuid2", ...h.errToObj(e) });
|
|
883
880
|
}
|
|
884
881
|
ulid(e) {
|
|
885
|
-
return this._addCheck({ kind: "ulid", ...
|
|
882
|
+
return this._addCheck({ kind: "ulid", ...h.errToObj(e) });
|
|
886
883
|
}
|
|
887
884
|
base64(e) {
|
|
888
|
-
return this._addCheck({ kind: "base64", ...
|
|
885
|
+
return this._addCheck({ kind: "base64", ...h.errToObj(e) });
|
|
889
886
|
}
|
|
890
887
|
base64url(e) {
|
|
891
888
|
return this._addCheck({
|
|
892
889
|
kind: "base64url",
|
|
893
|
-
...
|
|
890
|
+
...h.errToObj(e)
|
|
894
891
|
});
|
|
895
892
|
}
|
|
896
893
|
jwt(e) {
|
|
897
|
-
return this._addCheck({ kind: "jwt", ...
|
|
894
|
+
return this._addCheck({ kind: "jwt", ...h.errToObj(e) });
|
|
898
895
|
}
|
|
899
896
|
ip(e) {
|
|
900
|
-
return this._addCheck({ kind: "ip", ...
|
|
897
|
+
return this._addCheck({ kind: "ip", ...h.errToObj(e) });
|
|
901
898
|
}
|
|
902
899
|
cidr(e) {
|
|
903
|
-
return this._addCheck({ kind: "cidr", ...
|
|
900
|
+
return this._addCheck({ kind: "cidr", ...h.errToObj(e) });
|
|
904
901
|
}
|
|
905
902
|
datetime(e) {
|
|
906
|
-
var t, s;
|
|
907
903
|
return typeof e == "string" ? this._addCheck({
|
|
908
904
|
kind: "datetime",
|
|
909
905
|
precision: null,
|
|
@@ -913,9 +909,9 @@ class O extends g {
|
|
|
913
909
|
}) : this._addCheck({
|
|
914
910
|
kind: "datetime",
|
|
915
911
|
precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
|
|
916
|
-
offset: (
|
|
917
|
-
local: (
|
|
918
|
-
...
|
|
912
|
+
offset: (e == null ? void 0 : e.offset) ?? !1,
|
|
913
|
+
local: (e == null ? void 0 : e.local) ?? !1,
|
|
914
|
+
...h.errToObj(e == null ? void 0 : e.message)
|
|
919
915
|
});
|
|
920
916
|
}
|
|
921
917
|
date(e) {
|
|
@@ -929,17 +925,17 @@ class O extends g {
|
|
|
929
925
|
}) : this._addCheck({
|
|
930
926
|
kind: "time",
|
|
931
927
|
precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
|
|
932
|
-
...
|
|
928
|
+
...h.errToObj(e == null ? void 0 : e.message)
|
|
933
929
|
});
|
|
934
930
|
}
|
|
935
931
|
duration(e) {
|
|
936
|
-
return this._addCheck({ kind: "duration", ...
|
|
932
|
+
return this._addCheck({ kind: "duration", ...h.errToObj(e) });
|
|
937
933
|
}
|
|
938
934
|
regex(e, t) {
|
|
939
935
|
return this._addCheck({
|
|
940
936
|
kind: "regex",
|
|
941
937
|
regex: e,
|
|
942
|
-
...
|
|
938
|
+
...h.errToObj(t)
|
|
943
939
|
});
|
|
944
940
|
}
|
|
945
941
|
includes(e, t) {
|
|
@@ -947,64 +943,64 @@ class O extends g {
|
|
|
947
943
|
kind: "includes",
|
|
948
944
|
value: e,
|
|
949
945
|
position: t == null ? void 0 : t.position,
|
|
950
|
-
...
|
|
946
|
+
...h.errToObj(t == null ? void 0 : t.message)
|
|
951
947
|
});
|
|
952
948
|
}
|
|
953
949
|
startsWith(e, t) {
|
|
954
950
|
return this._addCheck({
|
|
955
951
|
kind: "startsWith",
|
|
956
952
|
value: e,
|
|
957
|
-
...
|
|
953
|
+
...h.errToObj(t)
|
|
958
954
|
});
|
|
959
955
|
}
|
|
960
956
|
endsWith(e, t) {
|
|
961
957
|
return this._addCheck({
|
|
962
958
|
kind: "endsWith",
|
|
963
959
|
value: e,
|
|
964
|
-
...
|
|
960
|
+
...h.errToObj(t)
|
|
965
961
|
});
|
|
966
962
|
}
|
|
967
963
|
min(e, t) {
|
|
968
964
|
return this._addCheck({
|
|
969
965
|
kind: "min",
|
|
970
966
|
value: e,
|
|
971
|
-
...
|
|
967
|
+
...h.errToObj(t)
|
|
972
968
|
});
|
|
973
969
|
}
|
|
974
970
|
max(e, t) {
|
|
975
971
|
return this._addCheck({
|
|
976
972
|
kind: "max",
|
|
977
973
|
value: e,
|
|
978
|
-
...
|
|
974
|
+
...h.errToObj(t)
|
|
979
975
|
});
|
|
980
976
|
}
|
|
981
977
|
length(e, t) {
|
|
982
978
|
return this._addCheck({
|
|
983
979
|
kind: "length",
|
|
984
980
|
value: e,
|
|
985
|
-
...
|
|
981
|
+
...h.errToObj(t)
|
|
986
982
|
});
|
|
987
983
|
}
|
|
988
984
|
/**
|
|
989
985
|
* Equivalent to `.min(1)`
|
|
990
986
|
*/
|
|
991
987
|
nonempty(e) {
|
|
992
|
-
return this.min(1,
|
|
988
|
+
return this.min(1, h.errToObj(e));
|
|
993
989
|
}
|
|
994
990
|
trim() {
|
|
995
|
-
return new
|
|
991
|
+
return new j({
|
|
996
992
|
...this._def,
|
|
997
993
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
998
994
|
});
|
|
999
995
|
}
|
|
1000
996
|
toLowerCase() {
|
|
1001
|
-
return new
|
|
997
|
+
return new j({
|
|
1002
998
|
...this._def,
|
|
1003
999
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
1004
1000
|
});
|
|
1005
1001
|
}
|
|
1006
1002
|
toUpperCase() {
|
|
1007
|
-
return new
|
|
1003
|
+
return new j({
|
|
1008
1004
|
...this._def,
|
|
1009
1005
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
1010
1006
|
});
|
|
@@ -1070,20 +1066,17 @@ class O extends g {
|
|
|
1070
1066
|
return e;
|
|
1071
1067
|
}
|
|
1072
1068
|
}
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
function Dt(r, e) {
|
|
1083
|
-
const t = (r.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, n = t > s ? t : s, a = parseInt(r.toFixed(n).replace(".", "")), i = parseInt(e.toFixed(n).replace(".", ""));
|
|
1084
|
-
return a % i / Math.pow(10, n);
|
|
1069
|
+
j.create = (r) => new j({
|
|
1070
|
+
checks: [],
|
|
1071
|
+
typeName: y.ZodString,
|
|
1072
|
+
coerce: (r == null ? void 0 : r.coerce) ?? !1,
|
|
1073
|
+
..._(r)
|
|
1074
|
+
});
|
|
1075
|
+
function Mt(r, e) {
|
|
1076
|
+
const t = (r.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, n = t > s ? t : s, a = Number.parseInt(r.toFixed(n).replace(".", "")), i = Number.parseInt(e.toFixed(n).replace(".", ""));
|
|
1077
|
+
return a % i / 10 ** n;
|
|
1085
1078
|
}
|
|
1086
|
-
class
|
|
1079
|
+
class z extends v {
|
|
1087
1080
|
constructor() {
|
|
1088
1081
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1089
1082
|
}
|
|
@@ -1091,57 +1084,57 @@ class V extends g {
|
|
|
1091
1084
|
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== f.number) {
|
|
1092
1085
|
const a = this._getOrReturnCtx(e);
|
|
1093
1086
|
return l(a, {
|
|
1094
|
-
code:
|
|
1087
|
+
code: d.invalid_type,
|
|
1095
1088
|
expected: f.number,
|
|
1096
1089
|
received: a.parsedType
|
|
1097
|
-
}),
|
|
1090
|
+
}), m;
|
|
1098
1091
|
}
|
|
1099
1092
|
let s;
|
|
1100
1093
|
const n = new T();
|
|
1101
1094
|
for (const a of this._def.checks)
|
|
1102
1095
|
a.kind === "int" ? x.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1103
|
-
code:
|
|
1096
|
+
code: d.invalid_type,
|
|
1104
1097
|
expected: "integer",
|
|
1105
1098
|
received: "float",
|
|
1106
1099
|
message: a.message
|
|
1107
1100
|
}), n.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1108
|
-
code:
|
|
1101
|
+
code: d.too_small,
|
|
1109
1102
|
minimum: a.value,
|
|
1110
1103
|
type: "number",
|
|
1111
1104
|
inclusive: a.inclusive,
|
|
1112
1105
|
exact: !1,
|
|
1113
1106
|
message: a.message
|
|
1114
1107
|
}), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1115
|
-
code:
|
|
1108
|
+
code: d.too_big,
|
|
1116
1109
|
maximum: a.value,
|
|
1117
1110
|
type: "number",
|
|
1118
1111
|
inclusive: a.inclusive,
|
|
1119
1112
|
exact: !1,
|
|
1120
1113
|
message: a.message
|
|
1121
|
-
}), n.dirty()) : a.kind === "multipleOf" ?
|
|
1122
|
-
code:
|
|
1114
|
+
}), n.dirty()) : a.kind === "multipleOf" ? Mt(e.data, a.value) !== 0 && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1115
|
+
code: d.not_multiple_of,
|
|
1123
1116
|
multipleOf: a.value,
|
|
1124
1117
|
message: a.message
|
|
1125
1118
|
}), n.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1126
|
-
code:
|
|
1119
|
+
code: d.not_finite,
|
|
1127
1120
|
message: a.message
|
|
1128
1121
|
}), n.dirty()) : x.assertNever(a);
|
|
1129
1122
|
return { status: n.value, value: e.data };
|
|
1130
1123
|
}
|
|
1131
1124
|
gte(e, t) {
|
|
1132
|
-
return this.setLimit("min", e, !0,
|
|
1125
|
+
return this.setLimit("min", e, !0, h.toString(t));
|
|
1133
1126
|
}
|
|
1134
1127
|
gt(e, t) {
|
|
1135
|
-
return this.setLimit("min", e, !1,
|
|
1128
|
+
return this.setLimit("min", e, !1, h.toString(t));
|
|
1136
1129
|
}
|
|
1137
1130
|
lte(e, t) {
|
|
1138
|
-
return this.setLimit("max", e, !0,
|
|
1131
|
+
return this.setLimit("max", e, !0, h.toString(t));
|
|
1139
1132
|
}
|
|
1140
1133
|
lt(e, t) {
|
|
1141
|
-
return this.setLimit("max", e, !1,
|
|
1134
|
+
return this.setLimit("max", e, !1, h.toString(t));
|
|
1142
1135
|
}
|
|
1143
1136
|
setLimit(e, t, s, n) {
|
|
1144
|
-
return new
|
|
1137
|
+
return new z({
|
|
1145
1138
|
...this._def,
|
|
1146
1139
|
checks: [
|
|
1147
1140
|
...this._def.checks,
|
|
@@ -1149,13 +1142,13 @@ class V extends g {
|
|
|
1149
1142
|
kind: e,
|
|
1150
1143
|
value: t,
|
|
1151
1144
|
inclusive: s,
|
|
1152
|
-
message:
|
|
1145
|
+
message: h.toString(n)
|
|
1153
1146
|
}
|
|
1154
1147
|
]
|
|
1155
1148
|
});
|
|
1156
1149
|
}
|
|
1157
1150
|
_addCheck(e) {
|
|
1158
|
-
return new
|
|
1151
|
+
return new z({
|
|
1159
1152
|
...this._def,
|
|
1160
1153
|
checks: [...this._def.checks, e]
|
|
1161
1154
|
});
|
|
@@ -1163,7 +1156,7 @@ class V extends g {
|
|
|
1163
1156
|
int(e) {
|
|
1164
1157
|
return this._addCheck({
|
|
1165
1158
|
kind: "int",
|
|
1166
|
-
message:
|
|
1159
|
+
message: h.toString(e)
|
|
1167
1160
|
});
|
|
1168
1161
|
}
|
|
1169
1162
|
positive(e) {
|
|
@@ -1171,7 +1164,7 @@ class V extends g {
|
|
|
1171
1164
|
kind: "min",
|
|
1172
1165
|
value: 0,
|
|
1173
1166
|
inclusive: !1,
|
|
1174
|
-
message:
|
|
1167
|
+
message: h.toString(e)
|
|
1175
1168
|
});
|
|
1176
1169
|
}
|
|
1177
1170
|
negative(e) {
|
|
@@ -1179,7 +1172,7 @@ class V extends g {
|
|
|
1179
1172
|
kind: "max",
|
|
1180
1173
|
value: 0,
|
|
1181
1174
|
inclusive: !1,
|
|
1182
|
-
message:
|
|
1175
|
+
message: h.toString(e)
|
|
1183
1176
|
});
|
|
1184
1177
|
}
|
|
1185
1178
|
nonpositive(e) {
|
|
@@ -1187,7 +1180,7 @@ class V extends g {
|
|
|
1187
1180
|
kind: "max",
|
|
1188
1181
|
value: 0,
|
|
1189
1182
|
inclusive: !0,
|
|
1190
|
-
message:
|
|
1183
|
+
message: h.toString(e)
|
|
1191
1184
|
});
|
|
1192
1185
|
}
|
|
1193
1186
|
nonnegative(e) {
|
|
@@ -1195,20 +1188,20 @@ class V extends g {
|
|
|
1195
1188
|
kind: "min",
|
|
1196
1189
|
value: 0,
|
|
1197
1190
|
inclusive: !0,
|
|
1198
|
-
message:
|
|
1191
|
+
message: h.toString(e)
|
|
1199
1192
|
});
|
|
1200
1193
|
}
|
|
1201
1194
|
multipleOf(e, t) {
|
|
1202
1195
|
return this._addCheck({
|
|
1203
1196
|
kind: "multipleOf",
|
|
1204
1197
|
value: e,
|
|
1205
|
-
message:
|
|
1198
|
+
message: h.toString(t)
|
|
1206
1199
|
});
|
|
1207
1200
|
}
|
|
1208
1201
|
finite(e) {
|
|
1209
1202
|
return this._addCheck({
|
|
1210
1203
|
kind: "finite",
|
|
1211
|
-
message:
|
|
1204
|
+
message: h.toString(e)
|
|
1212
1205
|
});
|
|
1213
1206
|
}
|
|
1214
1207
|
safe(e) {
|
|
@@ -1216,12 +1209,12 @@ class V extends g {
|
|
|
1216
1209
|
kind: "min",
|
|
1217
1210
|
inclusive: !0,
|
|
1218
1211
|
value: Number.MIN_SAFE_INTEGER,
|
|
1219
|
-
message:
|
|
1212
|
+
message: h.toString(e)
|
|
1220
1213
|
})._addCheck({
|
|
1221
1214
|
kind: "max",
|
|
1222
1215
|
inclusive: !0,
|
|
1223
1216
|
value: Number.MAX_SAFE_INTEGER,
|
|
1224
|
-
message:
|
|
1217
|
+
message: h.toString(e)
|
|
1225
1218
|
});
|
|
1226
1219
|
}
|
|
1227
1220
|
get minValue() {
|
|
@@ -1249,13 +1242,13 @@ class V extends g {
|
|
|
1249
1242
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
1250
1243
|
}
|
|
1251
1244
|
}
|
|
1252
|
-
|
|
1245
|
+
z.create = (r) => new z({
|
|
1253
1246
|
checks: [],
|
|
1254
|
-
typeName:
|
|
1247
|
+
typeName: y.ZodNumber,
|
|
1255
1248
|
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1256
|
-
...
|
|
1249
|
+
..._(r)
|
|
1257
1250
|
});
|
|
1258
|
-
class
|
|
1251
|
+
class U extends v {
|
|
1259
1252
|
constructor() {
|
|
1260
1253
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1261
1254
|
}
|
|
@@ -1272,19 +1265,19 @@ class L extends g {
|
|
|
1272
1265
|
const n = new T();
|
|
1273
1266
|
for (const a of this._def.checks)
|
|
1274
1267
|
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1275
|
-
code:
|
|
1268
|
+
code: d.too_small,
|
|
1276
1269
|
type: "bigint",
|
|
1277
1270
|
minimum: a.value,
|
|
1278
1271
|
inclusive: a.inclusive,
|
|
1279
1272
|
message: a.message
|
|
1280
1273
|
}), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1281
|
-
code:
|
|
1274
|
+
code: d.too_big,
|
|
1282
1275
|
type: "bigint",
|
|
1283
1276
|
maximum: a.value,
|
|
1284
1277
|
inclusive: a.inclusive,
|
|
1285
1278
|
message: a.message
|
|
1286
1279
|
}), n.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1287
|
-
code:
|
|
1280
|
+
code: d.not_multiple_of,
|
|
1288
1281
|
multipleOf: a.value,
|
|
1289
1282
|
message: a.message
|
|
1290
1283
|
}), n.dirty()) : x.assertNever(a);
|
|
@@ -1293,25 +1286,25 @@ class L extends g {
|
|
|
1293
1286
|
_getInvalidInput(e) {
|
|
1294
1287
|
const t = this._getOrReturnCtx(e);
|
|
1295
1288
|
return l(t, {
|
|
1296
|
-
code:
|
|
1289
|
+
code: d.invalid_type,
|
|
1297
1290
|
expected: f.bigint,
|
|
1298
1291
|
received: t.parsedType
|
|
1299
|
-
}),
|
|
1292
|
+
}), m;
|
|
1300
1293
|
}
|
|
1301
1294
|
gte(e, t) {
|
|
1302
|
-
return this.setLimit("min", e, !0,
|
|
1295
|
+
return this.setLimit("min", e, !0, h.toString(t));
|
|
1303
1296
|
}
|
|
1304
1297
|
gt(e, t) {
|
|
1305
|
-
return this.setLimit("min", e, !1,
|
|
1298
|
+
return this.setLimit("min", e, !1, h.toString(t));
|
|
1306
1299
|
}
|
|
1307
1300
|
lte(e, t) {
|
|
1308
|
-
return this.setLimit("max", e, !0,
|
|
1301
|
+
return this.setLimit("max", e, !0, h.toString(t));
|
|
1309
1302
|
}
|
|
1310
1303
|
lt(e, t) {
|
|
1311
|
-
return this.setLimit("max", e, !1,
|
|
1304
|
+
return this.setLimit("max", e, !1, h.toString(t));
|
|
1312
1305
|
}
|
|
1313
1306
|
setLimit(e, t, s, n) {
|
|
1314
|
-
return new
|
|
1307
|
+
return new U({
|
|
1315
1308
|
...this._def,
|
|
1316
1309
|
checks: [
|
|
1317
1310
|
...this._def.checks,
|
|
@@ -1319,13 +1312,13 @@ class L extends g {
|
|
|
1319
1312
|
kind: e,
|
|
1320
1313
|
value: t,
|
|
1321
1314
|
inclusive: s,
|
|
1322
|
-
message:
|
|
1315
|
+
message: h.toString(n)
|
|
1323
1316
|
}
|
|
1324
1317
|
]
|
|
1325
1318
|
});
|
|
1326
1319
|
}
|
|
1327
1320
|
_addCheck(e) {
|
|
1328
|
-
return new
|
|
1321
|
+
return new U({
|
|
1329
1322
|
...this._def,
|
|
1330
1323
|
checks: [...this._def.checks, e]
|
|
1331
1324
|
});
|
|
@@ -1335,7 +1328,7 @@ class L extends g {
|
|
|
1335
1328
|
kind: "min",
|
|
1336
1329
|
value: BigInt(0),
|
|
1337
1330
|
inclusive: !1,
|
|
1338
|
-
message:
|
|
1331
|
+
message: h.toString(e)
|
|
1339
1332
|
});
|
|
1340
1333
|
}
|
|
1341
1334
|
negative(e) {
|
|
@@ -1343,7 +1336,7 @@ class L extends g {
|
|
|
1343
1336
|
kind: "max",
|
|
1344
1337
|
value: BigInt(0),
|
|
1345
1338
|
inclusive: !1,
|
|
1346
|
-
message:
|
|
1339
|
+
message: h.toString(e)
|
|
1347
1340
|
});
|
|
1348
1341
|
}
|
|
1349
1342
|
nonpositive(e) {
|
|
@@ -1351,7 +1344,7 @@ class L extends g {
|
|
|
1351
1344
|
kind: "max",
|
|
1352
1345
|
value: BigInt(0),
|
|
1353
1346
|
inclusive: !0,
|
|
1354
|
-
message:
|
|
1347
|
+
message: h.toString(e)
|
|
1355
1348
|
});
|
|
1356
1349
|
}
|
|
1357
1350
|
nonnegative(e) {
|
|
@@ -1359,14 +1352,14 @@ class L extends g {
|
|
|
1359
1352
|
kind: "min",
|
|
1360
1353
|
value: BigInt(0),
|
|
1361
1354
|
inclusive: !0,
|
|
1362
|
-
message:
|
|
1355
|
+
message: h.toString(e)
|
|
1363
1356
|
});
|
|
1364
1357
|
}
|
|
1365
1358
|
multipleOf(e, t) {
|
|
1366
1359
|
return this._addCheck({
|
|
1367
1360
|
kind: "multipleOf",
|
|
1368
1361
|
value: e,
|
|
1369
|
-
message:
|
|
1362
|
+
message: h.toString(t)
|
|
1370
1363
|
});
|
|
1371
1364
|
}
|
|
1372
1365
|
get minValue() {
|
|
@@ -1382,61 +1375,58 @@ class L extends g {
|
|
|
1382
1375
|
return e;
|
|
1383
1376
|
}
|
|
1384
1377
|
}
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
});
|
|
1393
|
-
};
|
|
1394
|
-
class ce extends g {
|
|
1378
|
+
U.create = (r) => new U({
|
|
1379
|
+
checks: [],
|
|
1380
|
+
typeName: y.ZodBigInt,
|
|
1381
|
+
coerce: (r == null ? void 0 : r.coerce) ?? !1,
|
|
1382
|
+
..._(r)
|
|
1383
|
+
});
|
|
1384
|
+
class ce extends v {
|
|
1395
1385
|
_parse(e) {
|
|
1396
1386
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== f.boolean) {
|
|
1397
1387
|
const s = this._getOrReturnCtx(e);
|
|
1398
1388
|
return l(s, {
|
|
1399
|
-
code:
|
|
1389
|
+
code: d.invalid_type,
|
|
1400
1390
|
expected: f.boolean,
|
|
1401
1391
|
received: s.parsedType
|
|
1402
|
-
}),
|
|
1392
|
+
}), m;
|
|
1403
1393
|
}
|
|
1404
|
-
return
|
|
1394
|
+
return C(e.data);
|
|
1405
1395
|
}
|
|
1406
1396
|
}
|
|
1407
1397
|
ce.create = (r) => new ce({
|
|
1408
|
-
typeName:
|
|
1398
|
+
typeName: y.ZodBoolean,
|
|
1409
1399
|
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1410
|
-
...
|
|
1400
|
+
..._(r)
|
|
1411
1401
|
});
|
|
1412
|
-
class
|
|
1402
|
+
class H extends v {
|
|
1413
1403
|
_parse(e) {
|
|
1414
1404
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== f.date) {
|
|
1415
1405
|
const a = this._getOrReturnCtx(e);
|
|
1416
1406
|
return l(a, {
|
|
1417
|
-
code:
|
|
1407
|
+
code: d.invalid_type,
|
|
1418
1408
|
expected: f.date,
|
|
1419
1409
|
received: a.parsedType
|
|
1420
|
-
}),
|
|
1410
|
+
}), m;
|
|
1421
1411
|
}
|
|
1422
|
-
if (isNaN(e.data.getTime())) {
|
|
1412
|
+
if (Number.isNaN(e.data.getTime())) {
|
|
1423
1413
|
const a = this._getOrReturnCtx(e);
|
|
1424
1414
|
return l(a, {
|
|
1425
|
-
code:
|
|
1426
|
-
}),
|
|
1415
|
+
code: d.invalid_date
|
|
1416
|
+
}), m;
|
|
1427
1417
|
}
|
|
1428
1418
|
const s = new T();
|
|
1429
1419
|
let n;
|
|
1430
1420
|
for (const a of this._def.checks)
|
|
1431
1421
|
a.kind === "min" ? e.data.getTime() < a.value && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1432
|
-
code:
|
|
1422
|
+
code: d.too_small,
|
|
1433
1423
|
message: a.message,
|
|
1434
1424
|
inclusive: !0,
|
|
1435
1425
|
exact: !1,
|
|
1436
1426
|
minimum: a.value,
|
|
1437
1427
|
type: "date"
|
|
1438
1428
|
}), s.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1439
|
-
code:
|
|
1429
|
+
code: d.too_big,
|
|
1440
1430
|
message: a.message,
|
|
1441
1431
|
inclusive: !0,
|
|
1442
1432
|
exact: !1,
|
|
@@ -1449,7 +1439,7 @@ class W extends g {
|
|
|
1449
1439
|
};
|
|
1450
1440
|
}
|
|
1451
1441
|
_addCheck(e) {
|
|
1452
|
-
return new
|
|
1442
|
+
return new H({
|
|
1453
1443
|
...this._def,
|
|
1454
1444
|
checks: [...this._def.checks, e]
|
|
1455
1445
|
});
|
|
@@ -1458,14 +1448,14 @@ class W extends g {
|
|
|
1458
1448
|
return this._addCheck({
|
|
1459
1449
|
kind: "min",
|
|
1460
1450
|
value: e.getTime(),
|
|
1461
|
-
message:
|
|
1451
|
+
message: h.toString(t)
|
|
1462
1452
|
});
|
|
1463
1453
|
}
|
|
1464
1454
|
max(e, t) {
|
|
1465
1455
|
return this._addCheck({
|
|
1466
1456
|
kind: "max",
|
|
1467
1457
|
value: e.getTime(),
|
|
1468
|
-
message:
|
|
1458
|
+
message: h.toString(t)
|
|
1469
1459
|
});
|
|
1470
1460
|
}
|
|
1471
1461
|
get minDate() {
|
|
@@ -1481,131 +1471,131 @@ class W extends g {
|
|
|
1481
1471
|
return e != null ? new Date(e) : null;
|
|
1482
1472
|
}
|
|
1483
1473
|
}
|
|
1484
|
-
|
|
1474
|
+
H.create = (r) => new H({
|
|
1485
1475
|
checks: [],
|
|
1486
1476
|
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1487
|
-
typeName:
|
|
1488
|
-
...
|
|
1477
|
+
typeName: y.ZodDate,
|
|
1478
|
+
..._(r)
|
|
1489
1479
|
});
|
|
1490
|
-
class
|
|
1480
|
+
class Se extends v {
|
|
1491
1481
|
_parse(e) {
|
|
1492
1482
|
if (this._getType(e) !== f.symbol) {
|
|
1493
1483
|
const s = this._getOrReturnCtx(e);
|
|
1494
1484
|
return l(s, {
|
|
1495
|
-
code:
|
|
1485
|
+
code: d.invalid_type,
|
|
1496
1486
|
expected: f.symbol,
|
|
1497
1487
|
received: s.parsedType
|
|
1498
|
-
}),
|
|
1488
|
+
}), m;
|
|
1499
1489
|
}
|
|
1500
|
-
return
|
|
1490
|
+
return C(e.data);
|
|
1501
1491
|
}
|
|
1502
1492
|
}
|
|
1503
|
-
|
|
1504
|
-
typeName:
|
|
1505
|
-
...
|
|
1493
|
+
Se.create = (r) => new Se({
|
|
1494
|
+
typeName: y.ZodSymbol,
|
|
1495
|
+
..._(r)
|
|
1506
1496
|
});
|
|
1507
|
-
class de extends
|
|
1497
|
+
class de extends v {
|
|
1508
1498
|
_parse(e) {
|
|
1509
1499
|
if (this._getType(e) !== f.undefined) {
|
|
1510
1500
|
const s = this._getOrReturnCtx(e);
|
|
1511
1501
|
return l(s, {
|
|
1512
|
-
code:
|
|
1502
|
+
code: d.invalid_type,
|
|
1513
1503
|
expected: f.undefined,
|
|
1514
1504
|
received: s.parsedType
|
|
1515
|
-
}),
|
|
1505
|
+
}), m;
|
|
1516
1506
|
}
|
|
1517
|
-
return
|
|
1507
|
+
return C(e.data);
|
|
1518
1508
|
}
|
|
1519
1509
|
}
|
|
1520
1510
|
de.create = (r) => new de({
|
|
1521
|
-
typeName:
|
|
1522
|
-
...
|
|
1511
|
+
typeName: y.ZodUndefined,
|
|
1512
|
+
..._(r)
|
|
1523
1513
|
});
|
|
1524
|
-
class ue extends
|
|
1514
|
+
class ue extends v {
|
|
1525
1515
|
_parse(e) {
|
|
1526
1516
|
if (this._getType(e) !== f.null) {
|
|
1527
1517
|
const s = this._getOrReturnCtx(e);
|
|
1528
1518
|
return l(s, {
|
|
1529
|
-
code:
|
|
1519
|
+
code: d.invalid_type,
|
|
1530
1520
|
expected: f.null,
|
|
1531
1521
|
received: s.parsedType
|
|
1532
|
-
}),
|
|
1522
|
+
}), m;
|
|
1533
1523
|
}
|
|
1534
|
-
return
|
|
1524
|
+
return C(e.data);
|
|
1535
1525
|
}
|
|
1536
1526
|
}
|
|
1537
1527
|
ue.create = (r) => new ue({
|
|
1538
|
-
typeName:
|
|
1539
|
-
...
|
|
1528
|
+
typeName: y.ZodNull,
|
|
1529
|
+
..._(r)
|
|
1540
1530
|
});
|
|
1541
|
-
class
|
|
1531
|
+
class re extends v {
|
|
1542
1532
|
constructor() {
|
|
1543
1533
|
super(...arguments), this._any = !0;
|
|
1544
1534
|
}
|
|
1545
1535
|
_parse(e) {
|
|
1546
|
-
return
|
|
1536
|
+
return C(e.data);
|
|
1547
1537
|
}
|
|
1548
1538
|
}
|
|
1549
|
-
|
|
1550
|
-
typeName:
|
|
1551
|
-
...
|
|
1539
|
+
re.create = (r) => new re({
|
|
1540
|
+
typeName: y.ZodAny,
|
|
1541
|
+
..._(r)
|
|
1552
1542
|
});
|
|
1553
|
-
class
|
|
1543
|
+
class W extends v {
|
|
1554
1544
|
constructor() {
|
|
1555
1545
|
super(...arguments), this._unknown = !0;
|
|
1556
1546
|
}
|
|
1557
1547
|
_parse(e) {
|
|
1558
|
-
return
|
|
1548
|
+
return C(e.data);
|
|
1559
1549
|
}
|
|
1560
1550
|
}
|
|
1561
|
-
|
|
1562
|
-
typeName:
|
|
1563
|
-
...
|
|
1551
|
+
W.create = (r) => new W({
|
|
1552
|
+
typeName: y.ZodUnknown,
|
|
1553
|
+
..._(r)
|
|
1564
1554
|
});
|
|
1565
|
-
class
|
|
1555
|
+
class D extends v {
|
|
1566
1556
|
_parse(e) {
|
|
1567
1557
|
const t = this._getOrReturnCtx(e);
|
|
1568
1558
|
return l(t, {
|
|
1569
|
-
code:
|
|
1559
|
+
code: d.invalid_type,
|
|
1570
1560
|
expected: f.never,
|
|
1571
1561
|
received: t.parsedType
|
|
1572
|
-
}),
|
|
1562
|
+
}), m;
|
|
1573
1563
|
}
|
|
1574
1564
|
}
|
|
1575
|
-
|
|
1576
|
-
typeName:
|
|
1577
|
-
...
|
|
1565
|
+
D.create = (r) => new D({
|
|
1566
|
+
typeName: y.ZodNever,
|
|
1567
|
+
..._(r)
|
|
1578
1568
|
});
|
|
1579
|
-
class
|
|
1569
|
+
class Oe extends v {
|
|
1580
1570
|
_parse(e) {
|
|
1581
1571
|
if (this._getType(e) !== f.undefined) {
|
|
1582
1572
|
const s = this._getOrReturnCtx(e);
|
|
1583
1573
|
return l(s, {
|
|
1584
|
-
code:
|
|
1574
|
+
code: d.invalid_type,
|
|
1585
1575
|
expected: f.void,
|
|
1586
1576
|
received: s.parsedType
|
|
1587
|
-
}),
|
|
1577
|
+
}), m;
|
|
1588
1578
|
}
|
|
1589
|
-
return
|
|
1579
|
+
return C(e.data);
|
|
1590
1580
|
}
|
|
1591
1581
|
}
|
|
1592
|
-
|
|
1593
|
-
typeName:
|
|
1594
|
-
...
|
|
1582
|
+
Oe.create = (r) => new Oe({
|
|
1583
|
+
typeName: y.ZodVoid,
|
|
1584
|
+
..._(r)
|
|
1595
1585
|
});
|
|
1596
|
-
class
|
|
1586
|
+
class R extends v {
|
|
1597
1587
|
_parse(e) {
|
|
1598
1588
|
const { ctx: t, status: s } = this._processInputParams(e), n = this._def;
|
|
1599
1589
|
if (t.parsedType !== f.array)
|
|
1600
1590
|
return l(t, {
|
|
1601
|
-
code:
|
|
1591
|
+
code: d.invalid_type,
|
|
1602
1592
|
expected: f.array,
|
|
1603
1593
|
received: t.parsedType
|
|
1604
|
-
}),
|
|
1594
|
+
}), m;
|
|
1605
1595
|
if (n.exactLength !== null) {
|
|
1606
1596
|
const i = t.data.length > n.exactLength.value, o = t.data.length < n.exactLength.value;
|
|
1607
1597
|
(i || o) && (l(t, {
|
|
1608
|
-
code: i ?
|
|
1598
|
+
code: i ? d.too_big : d.too_small,
|
|
1609
1599
|
minimum: o ? n.exactLength.value : void 0,
|
|
1610
1600
|
maximum: i ? n.exactLength.value : void 0,
|
|
1611
1601
|
type: "array",
|
|
@@ -1615,74 +1605,74 @@ class j extends g {
|
|
|
1615
1605
|
}), s.dirty());
|
|
1616
1606
|
}
|
|
1617
1607
|
if (n.minLength !== null && t.data.length < n.minLength.value && (l(t, {
|
|
1618
|
-
code:
|
|
1608
|
+
code: d.too_small,
|
|
1619
1609
|
minimum: n.minLength.value,
|
|
1620
1610
|
type: "array",
|
|
1621
1611
|
inclusive: !0,
|
|
1622
1612
|
exact: !1,
|
|
1623
1613
|
message: n.minLength.message
|
|
1624
1614
|
}), s.dirty()), n.maxLength !== null && t.data.length > n.maxLength.value && (l(t, {
|
|
1625
|
-
code:
|
|
1615
|
+
code: d.too_big,
|
|
1626
1616
|
maximum: n.maxLength.value,
|
|
1627
1617
|
type: "array",
|
|
1628
1618
|
inclusive: !0,
|
|
1629
1619
|
exact: !1,
|
|
1630
1620
|
message: n.maxLength.message
|
|
1631
1621
|
}), s.dirty()), t.common.async)
|
|
1632
|
-
return Promise.all([...t.data].map((i, o) => n.type._parseAsync(new
|
|
1633
|
-
const a = [...t.data].map((i, o) => n.type._parseSync(new
|
|
1622
|
+
return Promise.all([...t.data].map((i, o) => n.type._parseAsync(new I(t, i, t.path, o)))).then((i) => T.mergeArray(s, i));
|
|
1623
|
+
const a = [...t.data].map((i, o) => n.type._parseSync(new I(t, i, t.path, o)));
|
|
1634
1624
|
return T.mergeArray(s, a);
|
|
1635
1625
|
}
|
|
1636
1626
|
get element() {
|
|
1637
1627
|
return this._def.type;
|
|
1638
1628
|
}
|
|
1639
1629
|
min(e, t) {
|
|
1640
|
-
return new
|
|
1630
|
+
return new R({
|
|
1641
1631
|
...this._def,
|
|
1642
|
-
minLength: { value: e, message:
|
|
1632
|
+
minLength: { value: e, message: h.toString(t) }
|
|
1643
1633
|
});
|
|
1644
1634
|
}
|
|
1645
1635
|
max(e, t) {
|
|
1646
|
-
return new
|
|
1636
|
+
return new R({
|
|
1647
1637
|
...this._def,
|
|
1648
|
-
maxLength: { value: e, message:
|
|
1638
|
+
maxLength: { value: e, message: h.toString(t) }
|
|
1649
1639
|
});
|
|
1650
1640
|
}
|
|
1651
1641
|
length(e, t) {
|
|
1652
|
-
return new
|
|
1642
|
+
return new R({
|
|
1653
1643
|
...this._def,
|
|
1654
|
-
exactLength: { value: e, message:
|
|
1644
|
+
exactLength: { value: e, message: h.toString(t) }
|
|
1655
1645
|
});
|
|
1656
1646
|
}
|
|
1657
1647
|
nonempty(e) {
|
|
1658
1648
|
return this.min(1, e);
|
|
1659
1649
|
}
|
|
1660
1650
|
}
|
|
1661
|
-
|
|
1651
|
+
R.create = (r, e) => new R({
|
|
1662
1652
|
type: r,
|
|
1663
1653
|
minLength: null,
|
|
1664
1654
|
maxLength: null,
|
|
1665
1655
|
exactLength: null,
|
|
1666
|
-
typeName:
|
|
1667
|
-
...
|
|
1656
|
+
typeName: y.ZodArray,
|
|
1657
|
+
..._(e)
|
|
1668
1658
|
});
|
|
1669
|
-
function
|
|
1659
|
+
function X(r) {
|
|
1670
1660
|
if (r instanceof k) {
|
|
1671
1661
|
const e = {};
|
|
1672
1662
|
for (const t in r.shape) {
|
|
1673
1663
|
const s = r.shape[t];
|
|
1674
|
-
e[t] = E.create(
|
|
1664
|
+
e[t] = E.create(X(s));
|
|
1675
1665
|
}
|
|
1676
1666
|
return new k({
|
|
1677
1667
|
...r._def,
|
|
1678
1668
|
shape: () => e
|
|
1679
1669
|
});
|
|
1680
|
-
} else return r instanceof
|
|
1670
|
+
} else return r instanceof R ? new R({
|
|
1681
1671
|
...r._def,
|
|
1682
|
-
type:
|
|
1683
|
-
}) : r instanceof E ? E.create(
|
|
1672
|
+
type: X(r.element)
|
|
1673
|
+
}) : r instanceof E ? E.create(X(r.unwrap())) : r instanceof F ? F.create(X(r.unwrap())) : r instanceof $ ? $.create(r.items.map((e) => X(e))) : r;
|
|
1684
1674
|
}
|
|
1685
|
-
class k extends
|
|
1675
|
+
class k extends v {
|
|
1686
1676
|
constructor() {
|
|
1687
1677
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
1688
1678
|
}
|
|
@@ -1690,86 +1680,86 @@ class k extends g {
|
|
|
1690
1680
|
if (this._cached !== null)
|
|
1691
1681
|
return this._cached;
|
|
1692
1682
|
const e = this._def.shape(), t = x.objectKeys(e);
|
|
1693
|
-
return this._cached = { shape: e, keys: t };
|
|
1683
|
+
return this._cached = { shape: e, keys: t }, this._cached;
|
|
1694
1684
|
}
|
|
1695
1685
|
_parse(e) {
|
|
1696
1686
|
if (this._getType(e) !== f.object) {
|
|
1697
|
-
const
|
|
1698
|
-
return l(
|
|
1699
|
-
code:
|
|
1687
|
+
const u = this._getOrReturnCtx(e);
|
|
1688
|
+
return l(u, {
|
|
1689
|
+
code: d.invalid_type,
|
|
1700
1690
|
expected: f.object,
|
|
1701
|
-
received:
|
|
1702
|
-
}),
|
|
1691
|
+
received: u.parsedType
|
|
1692
|
+
}), m;
|
|
1703
1693
|
}
|
|
1704
1694
|
const { status: s, ctx: n } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
|
|
1705
|
-
if (!(this._def.catchall instanceof
|
|
1706
|
-
for (const
|
|
1707
|
-
i.includes(
|
|
1695
|
+
if (!(this._def.catchall instanceof D && this._def.unknownKeys === "strip"))
|
|
1696
|
+
for (const u in n.data)
|
|
1697
|
+
i.includes(u) || o.push(u);
|
|
1708
1698
|
const c = [];
|
|
1709
|
-
for (const
|
|
1710
|
-
const
|
|
1699
|
+
for (const u of i) {
|
|
1700
|
+
const p = a[u], b = n.data[u];
|
|
1711
1701
|
c.push({
|
|
1712
|
-
key: { status: "valid", value:
|
|
1713
|
-
value:
|
|
1714
|
-
alwaysSet:
|
|
1702
|
+
key: { status: "valid", value: u },
|
|
1703
|
+
value: p._parse(new I(n, b, n.path, u)),
|
|
1704
|
+
alwaysSet: u in n.data
|
|
1715
1705
|
});
|
|
1716
1706
|
}
|
|
1717
|
-
if (this._def.catchall instanceof
|
|
1718
|
-
const
|
|
1719
|
-
if (
|
|
1720
|
-
for (const
|
|
1707
|
+
if (this._def.catchall instanceof D) {
|
|
1708
|
+
const u = this._def.unknownKeys;
|
|
1709
|
+
if (u === "passthrough")
|
|
1710
|
+
for (const p of o)
|
|
1721
1711
|
c.push({
|
|
1722
|
-
key: { status: "valid", value:
|
|
1723
|
-
value: { status: "valid", value: n.data[
|
|
1712
|
+
key: { status: "valid", value: p },
|
|
1713
|
+
value: { status: "valid", value: n.data[p] }
|
|
1724
1714
|
});
|
|
1725
|
-
else if (
|
|
1715
|
+
else if (u === "strict")
|
|
1726
1716
|
o.length > 0 && (l(n, {
|
|
1727
|
-
code:
|
|
1717
|
+
code: d.unrecognized_keys,
|
|
1728
1718
|
keys: o
|
|
1729
1719
|
}), s.dirty());
|
|
1730
|
-
else if (
|
|
1720
|
+
else if (u !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
1731
1721
|
} else {
|
|
1732
|
-
const
|
|
1733
|
-
for (const
|
|
1734
|
-
const b = n.data[
|
|
1722
|
+
const u = this._def.catchall;
|
|
1723
|
+
for (const p of o) {
|
|
1724
|
+
const b = n.data[p];
|
|
1735
1725
|
c.push({
|
|
1736
|
-
key: { status: "valid", value:
|
|
1737
|
-
value:
|
|
1738
|
-
new
|
|
1726
|
+
key: { status: "valid", value: p },
|
|
1727
|
+
value: u._parse(
|
|
1728
|
+
new I(n, b, n.path, p)
|
|
1739
1729
|
//, ctx.child(key), value, getParsedType(value)
|
|
1740
1730
|
),
|
|
1741
|
-
alwaysSet:
|
|
1731
|
+
alwaysSet: p in n.data
|
|
1742
1732
|
});
|
|
1743
1733
|
}
|
|
1744
1734
|
}
|
|
1745
1735
|
return n.common.async ? Promise.resolve().then(async () => {
|
|
1746
|
-
const
|
|
1747
|
-
for (const
|
|
1748
|
-
const b = await
|
|
1749
|
-
|
|
1736
|
+
const u = [];
|
|
1737
|
+
for (const p of c) {
|
|
1738
|
+
const b = await p.key, A = await p.value;
|
|
1739
|
+
u.push({
|
|
1750
1740
|
key: b,
|
|
1751
|
-
value:
|
|
1752
|
-
alwaysSet:
|
|
1741
|
+
value: A,
|
|
1742
|
+
alwaysSet: p.alwaysSet
|
|
1753
1743
|
});
|
|
1754
1744
|
}
|
|
1755
|
-
return
|
|
1756
|
-
}).then((
|
|
1745
|
+
return u;
|
|
1746
|
+
}).then((u) => T.mergeObjectSync(s, u)) : T.mergeObjectSync(s, c);
|
|
1757
1747
|
}
|
|
1758
1748
|
get shape() {
|
|
1759
1749
|
return this._def.shape();
|
|
1760
1750
|
}
|
|
1761
1751
|
strict(e) {
|
|
1762
|
-
return
|
|
1752
|
+
return h.errToObj, new k({
|
|
1763
1753
|
...this._def,
|
|
1764
1754
|
unknownKeys: "strict",
|
|
1765
1755
|
...e !== void 0 ? {
|
|
1766
1756
|
errorMap: (t, s) => {
|
|
1767
|
-
var
|
|
1768
|
-
const
|
|
1757
|
+
var a, i;
|
|
1758
|
+
const n = ((i = (a = this._def).errorMap) == null ? void 0 : i.call(a, t, s).message) ?? s.defaultError;
|
|
1769
1759
|
return t.code === "unrecognized_keys" ? {
|
|
1770
|
-
message:
|
|
1760
|
+
message: h.errToObj(e).message ?? n
|
|
1771
1761
|
} : {
|
|
1772
|
-
message:
|
|
1762
|
+
message: n
|
|
1773
1763
|
};
|
|
1774
1764
|
}
|
|
1775
1765
|
} : {}
|
|
@@ -1826,7 +1816,7 @@ class k extends g {
|
|
|
1826
1816
|
...this._def.shape(),
|
|
1827
1817
|
...e._def.shape()
|
|
1828
1818
|
}),
|
|
1829
|
-
typeName:
|
|
1819
|
+
typeName: y.ZodObject
|
|
1830
1820
|
});
|
|
1831
1821
|
}
|
|
1832
1822
|
// merge<
|
|
@@ -1896,18 +1886,18 @@ class k extends g {
|
|
|
1896
1886
|
}
|
|
1897
1887
|
pick(e) {
|
|
1898
1888
|
const t = {};
|
|
1899
|
-
|
|
1889
|
+
for (const s of x.objectKeys(e))
|
|
1900
1890
|
e[s] && this.shape[s] && (t[s] = this.shape[s]);
|
|
1901
|
-
|
|
1891
|
+
return new k({
|
|
1902
1892
|
...this._def,
|
|
1903
1893
|
shape: () => t
|
|
1904
1894
|
});
|
|
1905
1895
|
}
|
|
1906
1896
|
omit(e) {
|
|
1907
1897
|
const t = {};
|
|
1908
|
-
|
|
1898
|
+
for (const s of x.objectKeys(this.shape))
|
|
1909
1899
|
e[s] || (t[s] = this.shape[s]);
|
|
1910
|
-
|
|
1900
|
+
return new k({
|
|
1911
1901
|
...this._def,
|
|
1912
1902
|
shape: () => t
|
|
1913
1903
|
});
|
|
@@ -1916,21 +1906,22 @@ class k extends g {
|
|
|
1916
1906
|
* @deprecated
|
|
1917
1907
|
*/
|
|
1918
1908
|
deepPartial() {
|
|
1919
|
-
return
|
|
1909
|
+
return X(this);
|
|
1920
1910
|
}
|
|
1921
1911
|
partial(e) {
|
|
1922
1912
|
const t = {};
|
|
1923
|
-
|
|
1913
|
+
for (const s of x.objectKeys(this.shape)) {
|
|
1924
1914
|
const n = this.shape[s];
|
|
1925
1915
|
e && !e[s] ? t[s] = n : t[s] = n.optional();
|
|
1926
|
-
}
|
|
1916
|
+
}
|
|
1917
|
+
return new k({
|
|
1927
1918
|
...this._def,
|
|
1928
1919
|
shape: () => t
|
|
1929
1920
|
});
|
|
1930
1921
|
}
|
|
1931
1922
|
required(e) {
|
|
1932
1923
|
const t = {};
|
|
1933
|
-
|
|
1924
|
+
for (const s of x.objectKeys(this.shape))
|
|
1934
1925
|
if (e && !e[s])
|
|
1935
1926
|
t[s] = this.shape[s];
|
|
1936
1927
|
else {
|
|
@@ -1939,37 +1930,37 @@ class k extends g {
|
|
|
1939
1930
|
a = a._def.innerType;
|
|
1940
1931
|
t[s] = a;
|
|
1941
1932
|
}
|
|
1942
|
-
|
|
1933
|
+
return new k({
|
|
1943
1934
|
...this._def,
|
|
1944
1935
|
shape: () => t
|
|
1945
1936
|
});
|
|
1946
1937
|
}
|
|
1947
1938
|
keyof() {
|
|
1948
|
-
return
|
|
1939
|
+
return st(x.objectKeys(this.shape));
|
|
1949
1940
|
}
|
|
1950
1941
|
}
|
|
1951
1942
|
k.create = (r, e) => new k({
|
|
1952
1943
|
shape: () => r,
|
|
1953
1944
|
unknownKeys: "strip",
|
|
1954
|
-
catchall:
|
|
1955
|
-
typeName:
|
|
1956
|
-
...
|
|
1945
|
+
catchall: D.create(),
|
|
1946
|
+
typeName: y.ZodObject,
|
|
1947
|
+
..._(e)
|
|
1957
1948
|
});
|
|
1958
1949
|
k.strictCreate = (r, e) => new k({
|
|
1959
1950
|
shape: () => r,
|
|
1960
1951
|
unknownKeys: "strict",
|
|
1961
|
-
catchall:
|
|
1962
|
-
typeName:
|
|
1963
|
-
...
|
|
1952
|
+
catchall: D.create(),
|
|
1953
|
+
typeName: y.ZodObject,
|
|
1954
|
+
..._(e)
|
|
1964
1955
|
});
|
|
1965
1956
|
k.lazycreate = (r, e) => new k({
|
|
1966
1957
|
shape: r,
|
|
1967
1958
|
unknownKeys: "strip",
|
|
1968
|
-
catchall:
|
|
1969
|
-
typeName:
|
|
1970
|
-
...
|
|
1959
|
+
catchall: D.create(),
|
|
1960
|
+
typeName: y.ZodObject,
|
|
1961
|
+
..._(e)
|
|
1971
1962
|
});
|
|
1972
|
-
class le extends
|
|
1963
|
+
class le extends v {
|
|
1973
1964
|
_parse(e) {
|
|
1974
1965
|
const { ctx: t } = this._processInputParams(e), s = this._def.options;
|
|
1975
1966
|
function n(a) {
|
|
@@ -1979,11 +1970,11 @@ class le extends g {
|
|
|
1979
1970
|
for (const o of a)
|
|
1980
1971
|
if (o.result.status === "dirty")
|
|
1981
1972
|
return t.common.issues.push(...o.ctx.common.issues), o.result;
|
|
1982
|
-
const i = a.map((o) => new
|
|
1973
|
+
const i = a.map((o) => new S(o.ctx.common.issues));
|
|
1983
1974
|
return l(t, {
|
|
1984
|
-
code:
|
|
1975
|
+
code: d.invalid_union,
|
|
1985
1976
|
unionErrors: i
|
|
1986
|
-
}),
|
|
1977
|
+
}), m;
|
|
1987
1978
|
}
|
|
1988
1979
|
if (t.common.async)
|
|
1989
1980
|
return Promise.all(s.map(async (a) => {
|
|
@@ -2008,29 +1999,29 @@ class le extends g {
|
|
|
2008
1999
|
let a;
|
|
2009
2000
|
const i = [];
|
|
2010
2001
|
for (const c of s) {
|
|
2011
|
-
const
|
|
2002
|
+
const u = {
|
|
2012
2003
|
...t,
|
|
2013
2004
|
common: {
|
|
2014
2005
|
...t.common,
|
|
2015
2006
|
issues: []
|
|
2016
2007
|
},
|
|
2017
2008
|
parent: null
|
|
2018
|
-
},
|
|
2009
|
+
}, p = c._parseSync({
|
|
2019
2010
|
data: t.data,
|
|
2020
2011
|
path: t.path,
|
|
2021
|
-
parent:
|
|
2012
|
+
parent: u
|
|
2022
2013
|
});
|
|
2023
|
-
if (
|
|
2024
|
-
return
|
|
2025
|
-
|
|
2014
|
+
if (p.status === "valid")
|
|
2015
|
+
return p;
|
|
2016
|
+
p.status === "dirty" && !a && (a = { result: p, ctx: u }), u.common.issues.length && i.push(u.common.issues);
|
|
2026
2017
|
}
|
|
2027
2018
|
if (a)
|
|
2028
2019
|
return t.common.issues.push(...a.ctx.common.issues), a.result;
|
|
2029
|
-
const o = i.map((c) => new
|
|
2020
|
+
const o = i.map((c) => new S(c));
|
|
2030
2021
|
return l(t, {
|
|
2031
|
-
code:
|
|
2022
|
+
code: d.invalid_union,
|
|
2032
2023
|
unionErrors: o
|
|
2033
|
-
}),
|
|
2024
|
+
}), m;
|
|
2034
2025
|
}
|
|
2035
2026
|
}
|
|
2036
2027
|
get options() {
|
|
@@ -2039,19 +2030,19 @@ class le extends g {
|
|
|
2039
2030
|
}
|
|
2040
2031
|
le.create = (r, e) => new le({
|
|
2041
2032
|
options: r,
|
|
2042
|
-
typeName:
|
|
2043
|
-
...
|
|
2033
|
+
typeName: y.ZodUnion,
|
|
2034
|
+
..._(e)
|
|
2044
2035
|
});
|
|
2045
|
-
const
|
|
2046
|
-
class
|
|
2036
|
+
const P = (r) => r instanceof pe ? P(r.schema) : r instanceof N ? P(r.innerType()) : r instanceof me ? [r.value] : r instanceof B ? r.options : r instanceof ye ? x.objectValues(r.enum) : r instanceof _e ? P(r._def.innerType) : r instanceof de ? [void 0] : r instanceof ue ? [null] : r instanceof E ? [void 0, ...P(r.unwrap())] : r instanceof F ? [null, ...P(r.unwrap())] : r instanceof He || r instanceof ve ? P(r.unwrap()) : r instanceof ge ? P(r._def.innerType) : [];
|
|
2037
|
+
class Ne extends v {
|
|
2047
2038
|
_parse(e) {
|
|
2048
2039
|
const { ctx: t } = this._processInputParams(e);
|
|
2049
2040
|
if (t.parsedType !== f.object)
|
|
2050
2041
|
return l(t, {
|
|
2051
|
-
code:
|
|
2042
|
+
code: d.invalid_type,
|
|
2052
2043
|
expected: f.object,
|
|
2053
2044
|
received: t.parsedType
|
|
2054
|
-
}),
|
|
2045
|
+
}), m;
|
|
2055
2046
|
const s = this.discriminator, n = t.data[s], a = this.optionsMap.get(n);
|
|
2056
2047
|
return a ? t.common.async ? a._parseAsync({
|
|
2057
2048
|
data: t.data,
|
|
@@ -2062,10 +2053,10 @@ class Ee extends g {
|
|
|
2062
2053
|
path: t.path,
|
|
2063
2054
|
parent: t
|
|
2064
2055
|
}) : (l(t, {
|
|
2065
|
-
code:
|
|
2056
|
+
code: d.invalid_union_discriminator,
|
|
2066
2057
|
options: Array.from(this.optionsMap.keys()),
|
|
2067
2058
|
path: [s]
|
|
2068
|
-
}),
|
|
2059
|
+
}), m);
|
|
2069
2060
|
}
|
|
2070
2061
|
get discriminator() {
|
|
2071
2062
|
return this._def.discriminator;
|
|
@@ -2087,7 +2078,7 @@ class Ee extends g {
|
|
|
2087
2078
|
static create(e, t, s) {
|
|
2088
2079
|
const n = /* @__PURE__ */ new Map();
|
|
2089
2080
|
for (const a of t) {
|
|
2090
|
-
const i =
|
|
2081
|
+
const i = P(a.shape[e]);
|
|
2091
2082
|
if (!i.length)
|
|
2092
2083
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
2093
2084
|
for (const o of i) {
|
|
@@ -2096,23 +2087,23 @@ class Ee extends g {
|
|
|
2096
2087
|
n.set(o, a);
|
|
2097
2088
|
}
|
|
2098
2089
|
}
|
|
2099
|
-
return new
|
|
2100
|
-
typeName:
|
|
2090
|
+
return new Ne({
|
|
2091
|
+
typeName: y.ZodDiscriminatedUnion,
|
|
2101
2092
|
discriminator: e,
|
|
2102
2093
|
options: t,
|
|
2103
2094
|
optionsMap: n,
|
|
2104
|
-
...
|
|
2095
|
+
..._(s)
|
|
2105
2096
|
});
|
|
2106
2097
|
}
|
|
2107
2098
|
}
|
|
2108
|
-
function
|
|
2109
|
-
const t =
|
|
2099
|
+
function Je(r, e) {
|
|
2100
|
+
const t = M(r), s = M(e);
|
|
2110
2101
|
if (r === e)
|
|
2111
2102
|
return { valid: !0, data: r };
|
|
2112
2103
|
if (t === f.object && s === f.object) {
|
|
2113
2104
|
const n = x.objectKeys(e), a = x.objectKeys(r).filter((o) => n.indexOf(o) !== -1), i = { ...r, ...e };
|
|
2114
2105
|
for (const o of a) {
|
|
2115
|
-
const c =
|
|
2106
|
+
const c = Je(r[o], e[o]);
|
|
2116
2107
|
if (!c.valid)
|
|
2117
2108
|
return { valid: !1 };
|
|
2118
2109
|
i[o] = c.data;
|
|
@@ -2123,7 +2114,7 @@ function We(r, e) {
|
|
|
2123
2114
|
return { valid: !1 };
|
|
2124
2115
|
const n = [];
|
|
2125
2116
|
for (let a = 0; a < r.length; a++) {
|
|
2126
|
-
const i = r[a], o = e[a], c =
|
|
2117
|
+
const i = r[a], o = e[a], c = Je(i, o);
|
|
2127
2118
|
if (!c.valid)
|
|
2128
2119
|
return { valid: !1 };
|
|
2129
2120
|
n.push(c.data);
|
|
@@ -2131,15 +2122,15 @@ function We(r, e) {
|
|
|
2131
2122
|
return { valid: !0, data: n };
|
|
2132
2123
|
} else return t === f.date && s === f.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
|
|
2133
2124
|
}
|
|
2134
|
-
class fe extends
|
|
2125
|
+
class fe extends v {
|
|
2135
2126
|
_parse(e) {
|
|
2136
2127
|
const { status: t, ctx: s } = this._processInputParams(e), n = (a, i) => {
|
|
2137
|
-
if (
|
|
2138
|
-
return
|
|
2139
|
-
const o =
|
|
2140
|
-
return o.valid ? ((
|
|
2141
|
-
code:
|
|
2142
|
-
}),
|
|
2128
|
+
if (qe(a) || qe(i))
|
|
2129
|
+
return m;
|
|
2130
|
+
const o = Je(a.value, i.value);
|
|
2131
|
+
return o.valid ? ((We(a) || We(i)) && t.dirty(), { status: t.value, value: o.data }) : (l(s, {
|
|
2132
|
+
code: d.invalid_intersection_types
|
|
2133
|
+
}), m);
|
|
2143
2134
|
};
|
|
2144
2135
|
return s.common.async ? Promise.all([
|
|
2145
2136
|
this._def.left._parseAsync({
|
|
@@ -2166,28 +2157,28 @@ class fe extends g {
|
|
|
2166
2157
|
fe.create = (r, e, t) => new fe({
|
|
2167
2158
|
left: r,
|
|
2168
2159
|
right: e,
|
|
2169
|
-
typeName:
|
|
2170
|
-
...
|
|
2160
|
+
typeName: y.ZodIntersection,
|
|
2161
|
+
..._(t)
|
|
2171
2162
|
});
|
|
2172
|
-
class
|
|
2163
|
+
class $ extends v {
|
|
2173
2164
|
_parse(e) {
|
|
2174
2165
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2175
2166
|
if (s.parsedType !== f.array)
|
|
2176
2167
|
return l(s, {
|
|
2177
|
-
code:
|
|
2168
|
+
code: d.invalid_type,
|
|
2178
2169
|
expected: f.array,
|
|
2179
2170
|
received: s.parsedType
|
|
2180
|
-
}),
|
|
2171
|
+
}), m;
|
|
2181
2172
|
if (s.data.length < this._def.items.length)
|
|
2182
2173
|
return l(s, {
|
|
2183
|
-
code:
|
|
2174
|
+
code: d.too_small,
|
|
2184
2175
|
minimum: this._def.items.length,
|
|
2185
2176
|
inclusive: !0,
|
|
2186
2177
|
exact: !1,
|
|
2187
2178
|
type: "array"
|
|
2188
|
-
}),
|
|
2179
|
+
}), m;
|
|
2189
2180
|
!this._def.rest && s.data.length > this._def.items.length && (l(s, {
|
|
2190
|
-
code:
|
|
2181
|
+
code: d.too_big,
|
|
2191
2182
|
maximum: this._def.items.length,
|
|
2192
2183
|
inclusive: !0,
|
|
2193
2184
|
exact: !1,
|
|
@@ -2195,7 +2186,7 @@ class N extends g {
|
|
|
2195
2186
|
}), t.dirty());
|
|
2196
2187
|
const a = [...s.data].map((i, o) => {
|
|
2197
2188
|
const c = this._def.items[o] || this._def.rest;
|
|
2198
|
-
return c ? c._parse(new
|
|
2189
|
+
return c ? c._parse(new I(s, i, s.path, o)) : null;
|
|
2199
2190
|
}).filter((i) => !!i);
|
|
2200
2191
|
return s.common.async ? Promise.all(a).then((i) => T.mergeArray(t, i)) : T.mergeArray(t, a);
|
|
2201
2192
|
}
|
|
@@ -2203,23 +2194,23 @@ class N extends g {
|
|
|
2203
2194
|
return this._def.items;
|
|
2204
2195
|
}
|
|
2205
2196
|
rest(e) {
|
|
2206
|
-
return new
|
|
2197
|
+
return new $({
|
|
2207
2198
|
...this._def,
|
|
2208
2199
|
rest: e
|
|
2209
2200
|
});
|
|
2210
2201
|
}
|
|
2211
2202
|
}
|
|
2212
|
-
|
|
2203
|
+
$.create = (r, e) => {
|
|
2213
2204
|
if (!Array.isArray(r))
|
|
2214
2205
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2215
|
-
return new
|
|
2206
|
+
return new $({
|
|
2216
2207
|
items: r,
|
|
2217
|
-
typeName:
|
|
2208
|
+
typeName: y.ZodTuple,
|
|
2218
2209
|
rest: null,
|
|
2219
|
-
...
|
|
2210
|
+
..._(e)
|
|
2220
2211
|
});
|
|
2221
2212
|
};
|
|
2222
|
-
class he extends
|
|
2213
|
+
class he extends v {
|
|
2223
2214
|
get keySchema() {
|
|
2224
2215
|
return this._def.keyType;
|
|
2225
2216
|
}
|
|
@@ -2230,15 +2221,15 @@ class he extends g {
|
|
|
2230
2221
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2231
2222
|
if (s.parsedType !== f.object)
|
|
2232
2223
|
return l(s, {
|
|
2233
|
-
code:
|
|
2224
|
+
code: d.invalid_type,
|
|
2234
2225
|
expected: f.object,
|
|
2235
2226
|
received: s.parsedType
|
|
2236
|
-
}),
|
|
2227
|
+
}), m;
|
|
2237
2228
|
const n = [], a = this._def.keyType, i = this._def.valueType;
|
|
2238
2229
|
for (const o in s.data)
|
|
2239
2230
|
n.push({
|
|
2240
|
-
key: a._parse(new
|
|
2241
|
-
value: i._parse(new
|
|
2231
|
+
key: a._parse(new I(s, o, s.path, o)),
|
|
2232
|
+
value: i._parse(new I(s, s.data[o], s.path, o)),
|
|
2242
2233
|
alwaysSet: o in s.data
|
|
2243
2234
|
});
|
|
2244
2235
|
return s.common.async ? T.mergeObjectAsync(t, n) : T.mergeObjectSync(t, n);
|
|
@@ -2247,20 +2238,20 @@ class he extends g {
|
|
|
2247
2238
|
return this._def.valueType;
|
|
2248
2239
|
}
|
|
2249
2240
|
static create(e, t, s) {
|
|
2250
|
-
return t instanceof
|
|
2241
|
+
return t instanceof v ? new he({
|
|
2251
2242
|
keyType: e,
|
|
2252
2243
|
valueType: t,
|
|
2253
|
-
typeName:
|
|
2254
|
-
...
|
|
2244
|
+
typeName: y.ZodRecord,
|
|
2245
|
+
..._(s)
|
|
2255
2246
|
}) : new he({
|
|
2256
|
-
keyType:
|
|
2247
|
+
keyType: j.create(),
|
|
2257
2248
|
valueType: e,
|
|
2258
|
-
typeName:
|
|
2259
|
-
...
|
|
2249
|
+
typeName: y.ZodRecord,
|
|
2250
|
+
..._(t)
|
|
2260
2251
|
});
|
|
2261
2252
|
}
|
|
2262
2253
|
}
|
|
2263
|
-
class
|
|
2254
|
+
class Ae extends v {
|
|
2264
2255
|
get keySchema() {
|
|
2265
2256
|
return this._def.keyType;
|
|
2266
2257
|
}
|
|
@@ -2271,62 +2262,62 @@ class Oe extends g {
|
|
|
2271
2262
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2272
2263
|
if (s.parsedType !== f.map)
|
|
2273
2264
|
return l(s, {
|
|
2274
|
-
code:
|
|
2265
|
+
code: d.invalid_type,
|
|
2275
2266
|
expected: f.map,
|
|
2276
2267
|
received: s.parsedType
|
|
2277
|
-
}),
|
|
2278
|
-
const n = this._def.keyType, a = this._def.valueType, i = [...s.data.entries()].map(([o, c],
|
|
2279
|
-
key: n._parse(new
|
|
2280
|
-
value: a._parse(new
|
|
2268
|
+
}), m;
|
|
2269
|
+
const n = this._def.keyType, a = this._def.valueType, i = [...s.data.entries()].map(([o, c], u) => ({
|
|
2270
|
+
key: n._parse(new I(s, o, s.path, [u, "key"])),
|
|
2271
|
+
value: a._parse(new I(s, c, s.path, [u, "value"]))
|
|
2281
2272
|
}));
|
|
2282
2273
|
if (s.common.async) {
|
|
2283
2274
|
const o = /* @__PURE__ */ new Map();
|
|
2284
2275
|
return Promise.resolve().then(async () => {
|
|
2285
2276
|
for (const c of i) {
|
|
2286
|
-
const
|
|
2287
|
-
if (
|
|
2288
|
-
return
|
|
2289
|
-
(
|
|
2277
|
+
const u = await c.key, p = await c.value;
|
|
2278
|
+
if (u.status === "aborted" || p.status === "aborted")
|
|
2279
|
+
return m;
|
|
2280
|
+
(u.status === "dirty" || p.status === "dirty") && t.dirty(), o.set(u.value, p.value);
|
|
2290
2281
|
}
|
|
2291
2282
|
return { status: t.value, value: o };
|
|
2292
2283
|
});
|
|
2293
2284
|
} else {
|
|
2294
2285
|
const o = /* @__PURE__ */ new Map();
|
|
2295
2286
|
for (const c of i) {
|
|
2296
|
-
const
|
|
2297
|
-
if (
|
|
2298
|
-
return
|
|
2299
|
-
(
|
|
2287
|
+
const u = c.key, p = c.value;
|
|
2288
|
+
if (u.status === "aborted" || p.status === "aborted")
|
|
2289
|
+
return m;
|
|
2290
|
+
(u.status === "dirty" || p.status === "dirty") && t.dirty(), o.set(u.value, p.value);
|
|
2300
2291
|
}
|
|
2301
2292
|
return { status: t.value, value: o };
|
|
2302
2293
|
}
|
|
2303
2294
|
}
|
|
2304
2295
|
}
|
|
2305
|
-
|
|
2296
|
+
Ae.create = (r, e, t) => new Ae({
|
|
2306
2297
|
valueType: e,
|
|
2307
2298
|
keyType: r,
|
|
2308
|
-
typeName:
|
|
2309
|
-
...
|
|
2299
|
+
typeName: y.ZodMap,
|
|
2300
|
+
..._(t)
|
|
2310
2301
|
});
|
|
2311
|
-
class
|
|
2302
|
+
class Y extends v {
|
|
2312
2303
|
_parse(e) {
|
|
2313
2304
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2314
2305
|
if (s.parsedType !== f.set)
|
|
2315
2306
|
return l(s, {
|
|
2316
|
-
code:
|
|
2307
|
+
code: d.invalid_type,
|
|
2317
2308
|
expected: f.set,
|
|
2318
2309
|
received: s.parsedType
|
|
2319
|
-
}),
|
|
2310
|
+
}), m;
|
|
2320
2311
|
const n = this._def;
|
|
2321
2312
|
n.minSize !== null && s.data.size < n.minSize.value && (l(s, {
|
|
2322
|
-
code:
|
|
2313
|
+
code: d.too_small,
|
|
2323
2314
|
minimum: n.minSize.value,
|
|
2324
2315
|
type: "set",
|
|
2325
2316
|
inclusive: !0,
|
|
2326
2317
|
exact: !1,
|
|
2327
2318
|
message: n.minSize.message
|
|
2328
2319
|
}), t.dirty()), n.maxSize !== null && s.data.size > n.maxSize.value && (l(s, {
|
|
2329
|
-
code:
|
|
2320
|
+
code: d.too_big,
|
|
2330
2321
|
maximum: n.maxSize.value,
|
|
2331
2322
|
type: "set",
|
|
2332
2323
|
inclusive: !0,
|
|
@@ -2335,27 +2326,27 @@ class J extends g {
|
|
|
2335
2326
|
}), t.dirty());
|
|
2336
2327
|
const a = this._def.valueType;
|
|
2337
2328
|
function i(c) {
|
|
2338
|
-
const
|
|
2339
|
-
for (const
|
|
2340
|
-
if (
|
|
2341
|
-
return
|
|
2342
|
-
|
|
2329
|
+
const u = /* @__PURE__ */ new Set();
|
|
2330
|
+
for (const p of c) {
|
|
2331
|
+
if (p.status === "aborted")
|
|
2332
|
+
return m;
|
|
2333
|
+
p.status === "dirty" && t.dirty(), u.add(p.value);
|
|
2343
2334
|
}
|
|
2344
|
-
return { status: t.value, value:
|
|
2335
|
+
return { status: t.value, value: u };
|
|
2345
2336
|
}
|
|
2346
|
-
const o = [...s.data.values()].map((c,
|
|
2337
|
+
const o = [...s.data.values()].map((c, u) => a._parse(new I(s, c, s.path, u)));
|
|
2347
2338
|
return s.common.async ? Promise.all(o).then((c) => i(c)) : i(o);
|
|
2348
2339
|
}
|
|
2349
2340
|
min(e, t) {
|
|
2350
|
-
return new
|
|
2341
|
+
return new Y({
|
|
2351
2342
|
...this._def,
|
|
2352
|
-
minSize: { value: e, message:
|
|
2343
|
+
minSize: { value: e, message: h.toString(t) }
|
|
2353
2344
|
});
|
|
2354
2345
|
}
|
|
2355
2346
|
max(e, t) {
|
|
2356
|
-
return new
|
|
2347
|
+
return new Y({
|
|
2357
2348
|
...this._def,
|
|
2358
|
-
maxSize: { value: e, message:
|
|
2349
|
+
maxSize: { value: e, message: h.toString(t) }
|
|
2359
2350
|
});
|
|
2360
2351
|
}
|
|
2361
2352
|
size(e, t) {
|
|
@@ -2365,14 +2356,14 @@ class J extends g {
|
|
|
2365
2356
|
return this.min(1, e);
|
|
2366
2357
|
}
|
|
2367
2358
|
}
|
|
2368
|
-
|
|
2359
|
+
Y.create = (r, e) => new Y({
|
|
2369
2360
|
valueType: r,
|
|
2370
2361
|
minSize: null,
|
|
2371
2362
|
maxSize: null,
|
|
2372
|
-
typeName:
|
|
2373
|
-
...
|
|
2363
|
+
typeName: y.ZodSet,
|
|
2364
|
+
..._(e)
|
|
2374
2365
|
});
|
|
2375
|
-
class
|
|
2366
|
+
class ee extends v {
|
|
2376
2367
|
constructor() {
|
|
2377
2368
|
super(...arguments), this.validate = this.implement;
|
|
2378
2369
|
}
|
|
@@ -2380,62 +2371,52 @@ class X extends g {
|
|
|
2380
2371
|
const { ctx: t } = this._processInputParams(e);
|
|
2381
2372
|
if (t.parsedType !== f.function)
|
|
2382
2373
|
return l(t, {
|
|
2383
|
-
code:
|
|
2374
|
+
code: d.invalid_type,
|
|
2384
2375
|
expected: f.function,
|
|
2385
2376
|
received: t.parsedType
|
|
2386
|
-
}),
|
|
2377
|
+
}), m;
|
|
2387
2378
|
function s(o, c) {
|
|
2388
|
-
return
|
|
2379
|
+
return Ce({
|
|
2389
2380
|
data: o,
|
|
2390
2381
|
path: t.path,
|
|
2391
|
-
errorMaps: [
|
|
2392
|
-
t.common.contextualErrorMap,
|
|
2393
|
-
t.schemaErrorMap,
|
|
2394
|
-
we(),
|
|
2395
|
-
Q
|
|
2396
|
-
].filter((d) => !!d),
|
|
2382
|
+
errorMaps: [t.common.contextualErrorMap, t.schemaErrorMap, Te(), te].filter((u) => !!u),
|
|
2397
2383
|
issueData: {
|
|
2398
|
-
code:
|
|
2384
|
+
code: d.invalid_arguments,
|
|
2399
2385
|
argumentsError: c
|
|
2400
2386
|
}
|
|
2401
2387
|
});
|
|
2402
2388
|
}
|
|
2403
2389
|
function n(o, c) {
|
|
2404
|
-
return
|
|
2390
|
+
return Ce({
|
|
2405
2391
|
data: o,
|
|
2406
2392
|
path: t.path,
|
|
2407
|
-
errorMaps: [
|
|
2408
|
-
t.common.contextualErrorMap,
|
|
2409
|
-
t.schemaErrorMap,
|
|
2410
|
-
we(),
|
|
2411
|
-
Q
|
|
2412
|
-
].filter((d) => !!d),
|
|
2393
|
+
errorMaps: [t.common.contextualErrorMap, t.schemaErrorMap, Te(), te].filter((u) => !!u),
|
|
2413
2394
|
issueData: {
|
|
2414
|
-
code:
|
|
2395
|
+
code: d.invalid_return_type,
|
|
2415
2396
|
returnTypeError: c
|
|
2416
2397
|
}
|
|
2417
2398
|
});
|
|
2418
2399
|
}
|
|
2419
2400
|
const a = { errorMap: t.common.contextualErrorMap }, i = t.data;
|
|
2420
|
-
if (this._def.returns instanceof
|
|
2401
|
+
if (this._def.returns instanceof se) {
|
|
2421
2402
|
const o = this;
|
|
2422
|
-
return
|
|
2423
|
-
const
|
|
2424
|
-
throw
|
|
2425
|
-
}), b = await Reflect.apply(i, this,
|
|
2403
|
+
return C(async function(...c) {
|
|
2404
|
+
const u = new S([]), p = await o._def.args.parseAsync(c, a).catch((w) => {
|
|
2405
|
+
throw u.addIssue(s(c, w)), u;
|
|
2406
|
+
}), b = await Reflect.apply(i, this, p);
|
|
2426
2407
|
return await o._def.returns._def.type.parseAsync(b, a).catch((w) => {
|
|
2427
|
-
throw
|
|
2408
|
+
throw u.addIssue(n(b, w)), u;
|
|
2428
2409
|
});
|
|
2429
2410
|
});
|
|
2430
2411
|
} else {
|
|
2431
2412
|
const o = this;
|
|
2432
|
-
return
|
|
2433
|
-
const
|
|
2434
|
-
if (!
|
|
2435
|
-
throw new
|
|
2436
|
-
const
|
|
2413
|
+
return C(function(...c) {
|
|
2414
|
+
const u = o._def.args.safeParse(c, a);
|
|
2415
|
+
if (!u.success)
|
|
2416
|
+
throw new S([s(c, u.error)]);
|
|
2417
|
+
const p = Reflect.apply(i, this, u.data), b = o._def.returns.safeParse(p, a);
|
|
2437
2418
|
if (!b.success)
|
|
2438
|
-
throw new
|
|
2419
|
+
throw new S([n(p, b.error)]);
|
|
2439
2420
|
return b.data;
|
|
2440
2421
|
});
|
|
2441
2422
|
}
|
|
@@ -2447,13 +2428,13 @@ class X extends g {
|
|
|
2447
2428
|
return this._def.returns;
|
|
2448
2429
|
}
|
|
2449
2430
|
args(...e) {
|
|
2450
|
-
return new
|
|
2431
|
+
return new ee({
|
|
2451
2432
|
...this._def,
|
|
2452
|
-
args:
|
|
2433
|
+
args: $.create(e).rest(W.create())
|
|
2453
2434
|
});
|
|
2454
2435
|
}
|
|
2455
2436
|
returns(e) {
|
|
2456
|
-
return new
|
|
2437
|
+
return new ee({
|
|
2457
2438
|
...this._def,
|
|
2458
2439
|
returns: e
|
|
2459
2440
|
});
|
|
@@ -2465,15 +2446,15 @@ class X extends g {
|
|
|
2465
2446
|
return this.parse(e);
|
|
2466
2447
|
}
|
|
2467
2448
|
static create(e, t, s) {
|
|
2468
|
-
return new
|
|
2469
|
-
args: e ||
|
|
2470
|
-
returns: t ||
|
|
2471
|
-
typeName:
|
|
2472
|
-
...
|
|
2449
|
+
return new ee({
|
|
2450
|
+
args: e || $.create([]).rest(W.create()),
|
|
2451
|
+
returns: t || W.create(),
|
|
2452
|
+
typeName: y.ZodFunction,
|
|
2453
|
+
..._(s)
|
|
2473
2454
|
});
|
|
2474
2455
|
}
|
|
2475
2456
|
}
|
|
2476
|
-
class pe extends
|
|
2457
|
+
class pe extends v {
|
|
2477
2458
|
get schema() {
|
|
2478
2459
|
return this._def.getter();
|
|
2479
2460
|
}
|
|
@@ -2484,18 +2465,18 @@ class pe extends g {
|
|
|
2484
2465
|
}
|
|
2485
2466
|
pe.create = (r, e) => new pe({
|
|
2486
2467
|
getter: r,
|
|
2487
|
-
typeName:
|
|
2488
|
-
...
|
|
2468
|
+
typeName: y.ZodLazy,
|
|
2469
|
+
..._(e)
|
|
2489
2470
|
});
|
|
2490
|
-
class me extends
|
|
2471
|
+
class me extends v {
|
|
2491
2472
|
_parse(e) {
|
|
2492
2473
|
if (e.data !== this._def.value) {
|
|
2493
2474
|
const t = this._getOrReturnCtx(e);
|
|
2494
2475
|
return l(t, {
|
|
2495
2476
|
received: t.data,
|
|
2496
|
-
code:
|
|
2477
|
+
code: d.invalid_literal,
|
|
2497
2478
|
expected: this._def.value
|
|
2498
|
-
}),
|
|
2479
|
+
}), m;
|
|
2499
2480
|
}
|
|
2500
2481
|
return { status: "valid", value: e.data };
|
|
2501
2482
|
}
|
|
@@ -2505,38 +2486,35 @@ class me extends g {
|
|
|
2505
2486
|
}
|
|
2506
2487
|
me.create = (r, e) => new me({
|
|
2507
2488
|
value: r,
|
|
2508
|
-
typeName:
|
|
2509
|
-
...
|
|
2489
|
+
typeName: y.ZodLiteral,
|
|
2490
|
+
..._(e)
|
|
2510
2491
|
});
|
|
2511
|
-
function
|
|
2512
|
-
return new
|
|
2492
|
+
function st(r, e) {
|
|
2493
|
+
return new B({
|
|
2513
2494
|
values: r,
|
|
2514
|
-
typeName:
|
|
2515
|
-
...
|
|
2495
|
+
typeName: y.ZodEnum,
|
|
2496
|
+
..._(e)
|
|
2516
2497
|
});
|
|
2517
2498
|
}
|
|
2518
|
-
class
|
|
2519
|
-
constructor() {
|
|
2520
|
-
super(...arguments), ae.set(this, void 0);
|
|
2521
|
-
}
|
|
2499
|
+
class B extends v {
|
|
2522
2500
|
_parse(e) {
|
|
2523
2501
|
if (typeof e.data != "string") {
|
|
2524
2502
|
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
2525
2503
|
return l(t, {
|
|
2526
2504
|
expected: x.joinValues(s),
|
|
2527
2505
|
received: t.parsedType,
|
|
2528
|
-
code:
|
|
2529
|
-
}),
|
|
2506
|
+
code: d.invalid_type
|
|
2507
|
+
}), m;
|
|
2530
2508
|
}
|
|
2531
|
-
if (
|
|
2509
|
+
if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
|
|
2532
2510
|
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
2533
2511
|
return l(t, {
|
|
2534
2512
|
received: t.data,
|
|
2535
|
-
code:
|
|
2513
|
+
code: d.invalid_enum_value,
|
|
2536
2514
|
options: s
|
|
2537
|
-
}),
|
|
2515
|
+
}), m;
|
|
2538
2516
|
}
|
|
2539
|
-
return
|
|
2517
|
+
return C(e.data);
|
|
2540
2518
|
}
|
|
2541
2519
|
get options() {
|
|
2542
2520
|
return this._def.values;
|
|
@@ -2560,24 +2538,20 @@ class z extends g {
|
|
|
2560
2538
|
return e;
|
|
2561
2539
|
}
|
|
2562
2540
|
extract(e, t = this._def) {
|
|
2563
|
-
return
|
|
2541
|
+
return B.create(e, {
|
|
2564
2542
|
...this._def,
|
|
2565
2543
|
...t
|
|
2566
2544
|
});
|
|
2567
2545
|
}
|
|
2568
2546
|
exclude(e, t = this._def) {
|
|
2569
|
-
return
|
|
2547
|
+
return B.create(this.options.filter((s) => !e.includes(s)), {
|
|
2570
2548
|
...this._def,
|
|
2571
2549
|
...t
|
|
2572
2550
|
});
|
|
2573
2551
|
}
|
|
2574
2552
|
}
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
class _e extends g {
|
|
2578
|
-
constructor() {
|
|
2579
|
-
super(...arguments), ie.set(this, void 0);
|
|
2580
|
-
}
|
|
2553
|
+
B.create = st;
|
|
2554
|
+
class ye extends v {
|
|
2581
2555
|
_parse(e) {
|
|
2582
2556
|
const t = x.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
|
|
2583
2557
|
if (s.parsedType !== f.string && s.parsedType !== f.number) {
|
|
@@ -2585,30 +2559,29 @@ class _e extends g {
|
|
|
2585
2559
|
return l(s, {
|
|
2586
2560
|
expected: x.joinValues(n),
|
|
2587
2561
|
received: s.parsedType,
|
|
2588
|
-
code:
|
|
2589
|
-
}),
|
|
2562
|
+
code: d.invalid_type
|
|
2563
|
+
}), m;
|
|
2590
2564
|
}
|
|
2591
|
-
if (
|
|
2565
|
+
if (this._cache || (this._cache = new Set(x.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
|
|
2592
2566
|
const n = x.objectValues(t);
|
|
2593
2567
|
return l(s, {
|
|
2594
2568
|
received: s.data,
|
|
2595
|
-
code:
|
|
2569
|
+
code: d.invalid_enum_value,
|
|
2596
2570
|
options: n
|
|
2597
|
-
}),
|
|
2571
|
+
}), m;
|
|
2598
2572
|
}
|
|
2599
|
-
return
|
|
2573
|
+
return C(e.data);
|
|
2600
2574
|
}
|
|
2601
2575
|
get enum() {
|
|
2602
2576
|
return this._def.values;
|
|
2603
2577
|
}
|
|
2604
2578
|
}
|
|
2605
|
-
|
|
2606
|
-
_e.create = (r, e) => new _e({
|
|
2579
|
+
ye.create = (r, e) => new ye({
|
|
2607
2580
|
values: r,
|
|
2608
|
-
typeName:
|
|
2609
|
-
...
|
|
2581
|
+
typeName: y.ZodNativeEnum,
|
|
2582
|
+
..._(e)
|
|
2610
2583
|
});
|
|
2611
|
-
class
|
|
2584
|
+
class se extends v {
|
|
2612
2585
|
unwrap() {
|
|
2613
2586
|
return this._def.type;
|
|
2614
2587
|
}
|
|
@@ -2616,28 +2589,28 @@ class te extends g {
|
|
|
2616
2589
|
const { ctx: t } = this._processInputParams(e);
|
|
2617
2590
|
if (t.parsedType !== f.promise && t.common.async === !1)
|
|
2618
2591
|
return l(t, {
|
|
2619
|
-
code:
|
|
2592
|
+
code: d.invalid_type,
|
|
2620
2593
|
expected: f.promise,
|
|
2621
2594
|
received: t.parsedType
|
|
2622
|
-
}),
|
|
2595
|
+
}), m;
|
|
2623
2596
|
const s = t.parsedType === f.promise ? t.data : Promise.resolve(t.data);
|
|
2624
|
-
return
|
|
2597
|
+
return C(s.then((n) => this._def.type.parseAsync(n, {
|
|
2625
2598
|
path: t.path,
|
|
2626
2599
|
errorMap: t.common.contextualErrorMap
|
|
2627
2600
|
})));
|
|
2628
2601
|
}
|
|
2629
2602
|
}
|
|
2630
|
-
|
|
2603
|
+
se.create = (r, e) => new se({
|
|
2631
2604
|
type: r,
|
|
2632
|
-
typeName:
|
|
2633
|
-
...
|
|
2605
|
+
typeName: y.ZodPromise,
|
|
2606
|
+
..._(e)
|
|
2634
2607
|
});
|
|
2635
|
-
class
|
|
2608
|
+
class N extends v {
|
|
2636
2609
|
innerType() {
|
|
2637
2610
|
return this._def.schema;
|
|
2638
2611
|
}
|
|
2639
2612
|
sourceType() {
|
|
2640
|
-
return this._def.schema._def.typeName ===
|
|
2613
|
+
return this._def.schema._def.typeName === y.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
2641
2614
|
}
|
|
2642
2615
|
_parse(e) {
|
|
2643
2616
|
const { status: t, ctx: s } = this._processInputParams(e), n = this._def.effect || null, a = {
|
|
@@ -2653,23 +2626,23 @@ class A extends g {
|
|
|
2653
2626
|
if (s.common.async)
|
|
2654
2627
|
return Promise.resolve(i).then(async (o) => {
|
|
2655
2628
|
if (t.value === "aborted")
|
|
2656
|
-
return
|
|
2629
|
+
return m;
|
|
2657
2630
|
const c = await this._def.schema._parseAsync({
|
|
2658
2631
|
data: o,
|
|
2659
2632
|
path: s.path,
|
|
2660
2633
|
parent: s
|
|
2661
2634
|
});
|
|
2662
|
-
return c.status === "aborted" ?
|
|
2635
|
+
return c.status === "aborted" ? m : c.status === "dirty" || t.value === "dirty" ? Q(c.value) : c;
|
|
2663
2636
|
});
|
|
2664
2637
|
{
|
|
2665
2638
|
if (t.value === "aborted")
|
|
2666
|
-
return
|
|
2639
|
+
return m;
|
|
2667
2640
|
const o = this._def.schema._parseSync({
|
|
2668
2641
|
data: i,
|
|
2669
2642
|
path: s.path,
|
|
2670
2643
|
parent: s
|
|
2671
2644
|
});
|
|
2672
|
-
return o.status === "aborted" ?
|
|
2645
|
+
return o.status === "aborted" ? m : o.status === "dirty" || t.value === "dirty" ? Q(o.value) : o;
|
|
2673
2646
|
}
|
|
2674
2647
|
}
|
|
2675
2648
|
if (n.type === "refinement") {
|
|
@@ -2687,9 +2660,9 @@ class A extends g {
|
|
|
2687
2660
|
path: s.path,
|
|
2688
2661
|
parent: s
|
|
2689
2662
|
});
|
|
2690
|
-
return o.status === "aborted" ?
|
|
2663
|
+
return o.status === "aborted" ? m : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
|
|
2691
2664
|
} else
|
|
2692
|
-
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((o) => o.status === "aborted" ?
|
|
2665
|
+
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((o) => o.status === "aborted" ? m : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
|
|
2693
2666
|
}
|
|
2694
2667
|
if (n.type === "transform")
|
|
2695
2668
|
if (s.common.async === !1) {
|
|
@@ -2698,32 +2671,35 @@ class A extends g {
|
|
|
2698
2671
|
path: s.path,
|
|
2699
2672
|
parent: s
|
|
2700
2673
|
});
|
|
2701
|
-
if (!
|
|
2702
|
-
return
|
|
2674
|
+
if (!J(i))
|
|
2675
|
+
return m;
|
|
2703
2676
|
const o = n.transform(i.value, a);
|
|
2704
2677
|
if (o instanceof Promise)
|
|
2705
2678
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2706
2679
|
return { status: t.value, value: o };
|
|
2707
2680
|
} else
|
|
2708
|
-
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) =>
|
|
2681
|
+
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) => J(i) ? Promise.resolve(n.transform(i.value, a)).then((o) => ({
|
|
2682
|
+
status: t.value,
|
|
2683
|
+
value: o
|
|
2684
|
+
})) : m);
|
|
2709
2685
|
x.assertNever(n);
|
|
2710
2686
|
}
|
|
2711
2687
|
}
|
|
2712
|
-
|
|
2688
|
+
N.create = (r, e, t) => new N({
|
|
2713
2689
|
schema: r,
|
|
2714
|
-
typeName:
|
|
2690
|
+
typeName: y.ZodEffects,
|
|
2715
2691
|
effect: e,
|
|
2716
|
-
...
|
|
2692
|
+
..._(t)
|
|
2717
2693
|
});
|
|
2718
|
-
|
|
2694
|
+
N.createWithPreprocess = (r, e, t) => new N({
|
|
2719
2695
|
schema: e,
|
|
2720
2696
|
effect: { type: "preprocess", transform: r },
|
|
2721
|
-
typeName:
|
|
2722
|
-
...
|
|
2697
|
+
typeName: y.ZodEffects,
|
|
2698
|
+
..._(t)
|
|
2723
2699
|
});
|
|
2724
|
-
class E extends
|
|
2700
|
+
class E extends v {
|
|
2725
2701
|
_parse(e) {
|
|
2726
|
-
return this._getType(e) === f.undefined ?
|
|
2702
|
+
return this._getType(e) === f.undefined ? C(void 0) : this._def.innerType._parse(e);
|
|
2727
2703
|
}
|
|
2728
2704
|
unwrap() {
|
|
2729
2705
|
return this._def.innerType;
|
|
@@ -2731,23 +2707,23 @@ class E extends g {
|
|
|
2731
2707
|
}
|
|
2732
2708
|
E.create = (r, e) => new E({
|
|
2733
2709
|
innerType: r,
|
|
2734
|
-
typeName:
|
|
2735
|
-
...
|
|
2710
|
+
typeName: y.ZodOptional,
|
|
2711
|
+
..._(e)
|
|
2736
2712
|
});
|
|
2737
|
-
class
|
|
2713
|
+
class F extends v {
|
|
2738
2714
|
_parse(e) {
|
|
2739
|
-
return this._getType(e) === f.null ?
|
|
2715
|
+
return this._getType(e) === f.null ? C(null) : this._def.innerType._parse(e);
|
|
2740
2716
|
}
|
|
2741
2717
|
unwrap() {
|
|
2742
2718
|
return this._def.innerType;
|
|
2743
2719
|
}
|
|
2744
2720
|
}
|
|
2745
|
-
|
|
2721
|
+
F.create = (r, e) => new F({
|
|
2746
2722
|
innerType: r,
|
|
2747
|
-
typeName:
|
|
2748
|
-
...
|
|
2723
|
+
typeName: y.ZodNullable,
|
|
2724
|
+
..._(e)
|
|
2749
2725
|
});
|
|
2750
|
-
class
|
|
2726
|
+
class _e extends v {
|
|
2751
2727
|
_parse(e) {
|
|
2752
2728
|
const { ctx: t } = this._processInputParams(e);
|
|
2753
2729
|
let s = t.data;
|
|
@@ -2761,13 +2737,13 @@ class ye extends g {
|
|
|
2761
2737
|
return this._def.innerType;
|
|
2762
2738
|
}
|
|
2763
2739
|
}
|
|
2764
|
-
|
|
2740
|
+
_e.create = (r, e) => new _e({
|
|
2765
2741
|
innerType: r,
|
|
2766
|
-
typeName:
|
|
2742
|
+
typeName: y.ZodDefault,
|
|
2767
2743
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
2768
|
-
...
|
|
2744
|
+
..._(e)
|
|
2769
2745
|
});
|
|
2770
|
-
class
|
|
2746
|
+
class ge extends v {
|
|
2771
2747
|
_parse(e) {
|
|
2772
2748
|
const { ctx: t } = this._processInputParams(e), s = {
|
|
2773
2749
|
...t,
|
|
@@ -2786,7 +2762,7 @@ class ve extends g {
|
|
|
2786
2762
|
status: "valid",
|
|
2787
2763
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
2788
2764
|
get error() {
|
|
2789
|
-
return new
|
|
2765
|
+
return new S(s.common.issues);
|
|
2790
2766
|
},
|
|
2791
2767
|
input: s.data
|
|
2792
2768
|
})
|
|
@@ -2794,7 +2770,7 @@ class ve extends g {
|
|
|
2794
2770
|
status: "valid",
|
|
2795
2771
|
value: n.status === "valid" ? n.value : this._def.catchValue({
|
|
2796
2772
|
get error() {
|
|
2797
|
-
return new
|
|
2773
|
+
return new S(s.common.issues);
|
|
2798
2774
|
},
|
|
2799
2775
|
input: s.data
|
|
2800
2776
|
})
|
|
@@ -2804,31 +2780,31 @@ class ve extends g {
|
|
|
2804
2780
|
return this._def.innerType;
|
|
2805
2781
|
}
|
|
2806
2782
|
}
|
|
2807
|
-
|
|
2783
|
+
ge.create = (r, e) => new ge({
|
|
2808
2784
|
innerType: r,
|
|
2809
|
-
typeName:
|
|
2785
|
+
typeName: y.ZodCatch,
|
|
2810
2786
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2811
|
-
...
|
|
2787
|
+
..._(e)
|
|
2812
2788
|
});
|
|
2813
|
-
class je extends
|
|
2789
|
+
class je extends v {
|
|
2814
2790
|
_parse(e) {
|
|
2815
2791
|
if (this._getType(e) !== f.nan) {
|
|
2816
2792
|
const s = this._getOrReturnCtx(e);
|
|
2817
2793
|
return l(s, {
|
|
2818
|
-
code:
|
|
2794
|
+
code: d.invalid_type,
|
|
2819
2795
|
expected: f.nan,
|
|
2820
2796
|
received: s.parsedType
|
|
2821
|
-
}),
|
|
2797
|
+
}), m;
|
|
2822
2798
|
}
|
|
2823
2799
|
return { status: "valid", value: e.data };
|
|
2824
2800
|
}
|
|
2825
2801
|
}
|
|
2826
2802
|
je.create = (r) => new je({
|
|
2827
|
-
typeName:
|
|
2828
|
-
...
|
|
2803
|
+
typeName: y.ZodNaN,
|
|
2804
|
+
..._(r)
|
|
2829
2805
|
});
|
|
2830
|
-
const
|
|
2831
|
-
class
|
|
2806
|
+
const Dt = Symbol("zod_brand");
|
|
2807
|
+
class He extends v {
|
|
2832
2808
|
_parse(e) {
|
|
2833
2809
|
const { ctx: t } = this._processInputParams(e), s = t.data;
|
|
2834
2810
|
return this._def.type._parse({
|
|
@@ -2841,7 +2817,7 @@ class Je extends g {
|
|
|
2841
2817
|
return this._def.type;
|
|
2842
2818
|
}
|
|
2843
2819
|
}
|
|
2844
|
-
class xe extends
|
|
2820
|
+
class xe extends v {
|
|
2845
2821
|
_parse(e) {
|
|
2846
2822
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2847
2823
|
if (s.common.async)
|
|
@@ -2851,7 +2827,7 @@ class xe extends g {
|
|
|
2851
2827
|
path: s.path,
|
|
2852
2828
|
parent: s
|
|
2853
2829
|
});
|
|
2854
|
-
return a.status === "aborted" ?
|
|
2830
|
+
return a.status === "aborted" ? m : a.status === "dirty" ? (t.dirty(), Q(a.value)) : this._def.out._parseAsync({
|
|
2855
2831
|
data: a.value,
|
|
2856
2832
|
path: s.path,
|
|
2857
2833
|
parent: s
|
|
@@ -2863,7 +2839,7 @@ class xe extends g {
|
|
|
2863
2839
|
path: s.path,
|
|
2864
2840
|
parent: s
|
|
2865
2841
|
});
|
|
2866
|
-
return n.status === "aborted" ?
|
|
2842
|
+
return n.status === "aborted" ? m : n.status === "dirty" ? (t.dirty(), {
|
|
2867
2843
|
status: "dirty",
|
|
2868
2844
|
value: n.value
|
|
2869
2845
|
}) : this._def.out._parseSync({
|
|
@@ -2877,183 +2853,180 @@ class xe extends g {
|
|
|
2877
2853
|
return new xe({
|
|
2878
2854
|
in: e,
|
|
2879
2855
|
out: t,
|
|
2880
|
-
typeName:
|
|
2856
|
+
typeName: y.ZodPipeline
|
|
2881
2857
|
});
|
|
2882
2858
|
}
|
|
2883
2859
|
}
|
|
2884
|
-
class
|
|
2860
|
+
class ve extends v {
|
|
2885
2861
|
_parse(e) {
|
|
2886
|
-
const t = this._def.innerType._parse(e), s = (n) => (
|
|
2862
|
+
const t = this._def.innerType._parse(e), s = (n) => (J(n) && (n.value = Object.freeze(n.value)), n);
|
|
2887
2863
|
return oe(t) ? t.then((n) => s(n)) : s(t);
|
|
2888
2864
|
}
|
|
2889
2865
|
unwrap() {
|
|
2890
2866
|
return this._def.innerType;
|
|
2891
2867
|
}
|
|
2892
2868
|
}
|
|
2893
|
-
|
|
2869
|
+
ve.create = (r, e) => new ve({
|
|
2894
2870
|
innerType: r,
|
|
2895
|
-
typeName:
|
|
2896
|
-
...
|
|
2871
|
+
typeName: y.ZodReadonly,
|
|
2872
|
+
..._(e)
|
|
2897
2873
|
});
|
|
2898
|
-
function
|
|
2874
|
+
function Ke(r, e) {
|
|
2899
2875
|
const t = typeof r == "function" ? r(e) : typeof r == "string" ? { message: r } : r;
|
|
2900
2876
|
return typeof t == "string" ? { message: t } : t;
|
|
2901
2877
|
}
|
|
2902
|
-
function
|
|
2903
|
-
return r ?
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
const b = Ye(e, s), C = (h = (d = b.fatal) !== null && d !== void 0 ? d : t) !== null && h !== void 0 ? h : !0;
|
|
2911
|
-
n.addIssue({ code: "custom", ...b, fatal: C });
|
|
2878
|
+
function nt(r, e = {}, t) {
|
|
2879
|
+
return r ? re.create().superRefine((s, n) => {
|
|
2880
|
+
const a = r(s);
|
|
2881
|
+
if (a instanceof Promise)
|
|
2882
|
+
return a.then((i) => {
|
|
2883
|
+
if (!i) {
|
|
2884
|
+
const o = Ke(e, s), c = o.fatal ?? t ?? !0;
|
|
2885
|
+
n.addIssue({ code: "custom", ...o, fatal: c });
|
|
2912
2886
|
}
|
|
2913
2887
|
});
|
|
2914
|
-
if (!
|
|
2915
|
-
const
|
|
2916
|
-
n.addIssue({ code: "custom", ...
|
|
2888
|
+
if (!a) {
|
|
2889
|
+
const i = Ke(e, s), o = i.fatal ?? t ?? !0;
|
|
2890
|
+
n.addIssue({ code: "custom", ...i, fatal: o });
|
|
2917
2891
|
}
|
|
2918
|
-
}) :
|
|
2892
|
+
}) : re.create();
|
|
2919
2893
|
}
|
|
2920
|
-
const
|
|
2894
|
+
const Vt = {
|
|
2921
2895
|
object: k.lazycreate
|
|
2922
2896
|
};
|
|
2923
|
-
var
|
|
2897
|
+
var y;
|
|
2924
2898
|
(function(r) {
|
|
2925
2899
|
r.ZodString = "ZodString", r.ZodNumber = "ZodNumber", r.ZodNaN = "ZodNaN", r.ZodBigInt = "ZodBigInt", r.ZodBoolean = "ZodBoolean", r.ZodDate = "ZodDate", r.ZodSymbol = "ZodSymbol", r.ZodUndefined = "ZodUndefined", r.ZodNull = "ZodNull", r.ZodAny = "ZodAny", r.ZodUnknown = "ZodUnknown", r.ZodNever = "ZodNever", r.ZodVoid = "ZodVoid", r.ZodArray = "ZodArray", r.ZodObject = "ZodObject", r.ZodUnion = "ZodUnion", r.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", r.ZodIntersection = "ZodIntersection", r.ZodTuple = "ZodTuple", r.ZodRecord = "ZodRecord", r.ZodMap = "ZodMap", r.ZodSet = "ZodSet", r.ZodFunction = "ZodFunction", r.ZodLazy = "ZodLazy", r.ZodLiteral = "ZodLiteral", r.ZodEnum = "ZodEnum", r.ZodEffects = "ZodEffects", r.ZodNativeEnum = "ZodNativeEnum", r.ZodOptional = "ZodOptional", r.ZodNullable = "ZodNullable", r.ZodDefault = "ZodDefault", r.ZodCatch = "ZodCatch", r.ZodPromise = "ZodPromise", r.ZodBranded = "ZodBranded", r.ZodPipeline = "ZodPipeline", r.ZodReadonly = "ZodReadonly";
|
|
2926
|
-
})(
|
|
2927
|
-
const
|
|
2900
|
+
})(y || (y = {}));
|
|
2901
|
+
const Lt = (r, e = {
|
|
2928
2902
|
message: `Input not instance of ${r.name}`
|
|
2929
|
-
}) =>
|
|
2930
|
-
string: (r) =>
|
|
2931
|
-
number: (r) =>
|
|
2903
|
+
}) => nt((t) => t instanceof r, e), g = j.create, Ye = z.create, zt = je.create, Ut = U.create, ke = ce.create, Bt = H.create, Ft = Se.create, qt = de.create, Wt = ue.create, Jt = re.create, Ht = W.create, Yt = D.create, Gt = Oe.create, O = R.create, Z = k.create, Kt = k.strictCreate, Xt = le.create, Qt = Ne.create, er = fe.create, tr = $.create, at = he.create, rr = Ae.create, sr = Y.create, nr = ee.create, ar = pe.create, ir = me.create, or = B.create, cr = ye.create, dr = se.create, Xe = N.create, ur = E.create, lr = F.create, fr = N.createWithPreprocess, hr = xe.create, pr = () => g().optional(), mr = () => Ye().optional(), yr = () => ke().optional(), _r = {
|
|
2904
|
+
string: (r) => j.create({ ...r, coerce: !0 }),
|
|
2905
|
+
number: (r) => z.create({ ...r, coerce: !0 }),
|
|
2932
2906
|
boolean: (r) => ce.create({
|
|
2933
2907
|
...r,
|
|
2934
2908
|
coerce: !0
|
|
2935
2909
|
}),
|
|
2936
|
-
bigint: (r) =>
|
|
2937
|
-
date: (r) =>
|
|
2938
|
-
},
|
|
2939
|
-
var p = /* @__PURE__ */ Object.freeze({
|
|
2910
|
+
bigint: (r) => U.create({ ...r, coerce: !0 }),
|
|
2911
|
+
date: (r) => H.create({ ...r, coerce: !0 })
|
|
2912
|
+
}, gr = m, vr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2940
2913
|
__proto__: null,
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
getErrorMap: we,
|
|
2944
|
-
makeIssue: Te,
|
|
2914
|
+
BRAND: Dt,
|
|
2915
|
+
DIRTY: Q,
|
|
2945
2916
|
EMPTY_PATH: yt,
|
|
2946
|
-
|
|
2917
|
+
INVALID: m,
|
|
2918
|
+
NEVER: gr,
|
|
2919
|
+
OK: C,
|
|
2947
2920
|
ParseStatus: T,
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
isDirty: qe,
|
|
2953
|
-
isValid: q,
|
|
2954
|
-
isAsync: oe,
|
|
2955
|
-
get util() {
|
|
2956
|
-
return x;
|
|
2957
|
-
},
|
|
2958
|
-
get objectUtil() {
|
|
2959
|
-
return Be;
|
|
2960
|
-
},
|
|
2961
|
-
ZodParsedType: f,
|
|
2962
|
-
getParsedType: $,
|
|
2963
|
-
ZodType: g,
|
|
2964
|
-
datetimeRegex: tt,
|
|
2965
|
-
ZodString: O,
|
|
2966
|
-
ZodNumber: V,
|
|
2967
|
-
ZodBigInt: L,
|
|
2921
|
+
Schema: v,
|
|
2922
|
+
ZodAny: re,
|
|
2923
|
+
ZodArray: R,
|
|
2924
|
+
ZodBigInt: U,
|
|
2968
2925
|
ZodBoolean: ce,
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2926
|
+
ZodBranded: He,
|
|
2927
|
+
ZodCatch: ge,
|
|
2928
|
+
ZodDate: H,
|
|
2929
|
+
ZodDefault: _e,
|
|
2930
|
+
ZodDiscriminatedUnion: Ne,
|
|
2931
|
+
ZodEffects: N,
|
|
2932
|
+
ZodEnum: B,
|
|
2933
|
+
ZodError: S,
|
|
2934
|
+
get ZodFirstPartyTypeKind() {
|
|
2935
|
+
return y;
|
|
2936
|
+
},
|
|
2937
|
+
ZodFunction: ee,
|
|
2981
2938
|
ZodIntersection: fe,
|
|
2982
|
-
|
|
2983
|
-
ZodRecord: he,
|
|
2984
|
-
ZodMap: Oe,
|
|
2985
|
-
ZodSet: J,
|
|
2986
|
-
ZodFunction: X,
|
|
2939
|
+
ZodIssueCode: d,
|
|
2987
2940
|
ZodLazy: pe,
|
|
2988
2941
|
ZodLiteral: me,
|
|
2989
|
-
|
|
2990
|
-
ZodNativeEnum: _e,
|
|
2991
|
-
ZodPromise: te,
|
|
2992
|
-
ZodEffects: A,
|
|
2993
|
-
ZodTransformer: A,
|
|
2994
|
-
ZodOptional: E,
|
|
2995
|
-
ZodNullable: U,
|
|
2996
|
-
ZodDefault: ye,
|
|
2997
|
-
ZodCatch: ve,
|
|
2942
|
+
ZodMap: Ae,
|
|
2998
2943
|
ZodNaN: je,
|
|
2999
|
-
|
|
3000
|
-
|
|
2944
|
+
ZodNativeEnum: ye,
|
|
2945
|
+
ZodNever: D,
|
|
2946
|
+
ZodNull: ue,
|
|
2947
|
+
ZodNullable: F,
|
|
2948
|
+
ZodNumber: z,
|
|
2949
|
+
ZodObject: k,
|
|
2950
|
+
ZodOptional: E,
|
|
2951
|
+
ZodParsedType: f,
|
|
3001
2952
|
ZodPipeline: xe,
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
ZodSchema:
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
2953
|
+
ZodPromise: se,
|
|
2954
|
+
ZodReadonly: ve,
|
|
2955
|
+
ZodRecord: he,
|
|
2956
|
+
ZodSchema: v,
|
|
2957
|
+
ZodSet: Y,
|
|
2958
|
+
ZodString: j,
|
|
2959
|
+
ZodSymbol: Se,
|
|
2960
|
+
ZodTransformer: N,
|
|
2961
|
+
ZodTuple: $,
|
|
2962
|
+
ZodType: v,
|
|
2963
|
+
ZodUndefined: de,
|
|
2964
|
+
ZodUnion: le,
|
|
2965
|
+
ZodUnknown: W,
|
|
2966
|
+
ZodVoid: Oe,
|
|
2967
|
+
addIssueToContext: l,
|
|
2968
|
+
any: Jt,
|
|
2969
|
+
array: O,
|
|
2970
|
+
bigint: Ut,
|
|
2971
|
+
boolean: ke,
|
|
2972
|
+
coerce: _r,
|
|
2973
|
+
custom: nt,
|
|
2974
|
+
date: Bt,
|
|
2975
|
+
datetimeRegex: rt,
|
|
2976
|
+
defaultErrorMap: te,
|
|
2977
|
+
discriminatedUnion: Qt,
|
|
2978
|
+
effect: Xe,
|
|
2979
|
+
enum: or,
|
|
2980
|
+
function: nr,
|
|
2981
|
+
getErrorMap: Te,
|
|
2982
|
+
getParsedType: M,
|
|
2983
|
+
instanceof: Lt,
|
|
2984
|
+
intersection: er,
|
|
2985
|
+
isAborted: qe,
|
|
2986
|
+
isAsync: oe,
|
|
2987
|
+
isDirty: We,
|
|
2988
|
+
isValid: J,
|
|
2989
|
+
late: Vt,
|
|
2990
|
+
lazy: ar,
|
|
2991
|
+
literal: ir,
|
|
2992
|
+
makeIssue: Ce,
|
|
2993
|
+
map: rr,
|
|
2994
|
+
nan: zt,
|
|
2995
|
+
nativeEnum: cr,
|
|
2996
|
+
never: Yt,
|
|
2997
|
+
null: Wt,
|
|
2998
|
+
nullable: lr,
|
|
2999
|
+
number: Ye,
|
|
3000
|
+
object: Z,
|
|
3001
|
+
get objectUtil() {
|
|
3002
|
+
return Fe;
|
|
3009
3003
|
},
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
pipeline: yr,
|
|
3037
|
-
preprocess: _r,
|
|
3038
|
-
promise: hr,
|
|
3039
|
-
record: ar,
|
|
3040
|
-
set: or,
|
|
3041
|
-
strictObject: er,
|
|
3042
|
-
string: nt,
|
|
3043
|
-
symbol: qt,
|
|
3044
|
-
transformer: Ge,
|
|
3045
|
-
tuple: nr,
|
|
3046
|
-
undefined: Wt,
|
|
3047
|
-
union: tr,
|
|
3048
|
-
unknown: Yt,
|
|
3049
|
-
void: Kt,
|
|
3050
|
-
NEVER: kr,
|
|
3051
|
-
ZodIssueCode: u,
|
|
3052
|
-
quotelessJson: mt,
|
|
3053
|
-
ZodError: Z
|
|
3054
|
-
});
|
|
3055
|
-
pt(p);
|
|
3056
|
-
const wr = (r, e) => e.skipDedupe || e.method !== "GET", Tr = (r, e) => e.method + "@" + r, Sr = (r) => r.clone(), Cr = ({ skip: r = wr, key: e = Tr, resolver: t = Sr } = {}) => {
|
|
3004
|
+
oboolean: yr,
|
|
3005
|
+
onumber: mr,
|
|
3006
|
+
optional: ur,
|
|
3007
|
+
ostring: pr,
|
|
3008
|
+
pipeline: hr,
|
|
3009
|
+
preprocess: fr,
|
|
3010
|
+
promise: dr,
|
|
3011
|
+
quotelessJson: pt,
|
|
3012
|
+
record: at,
|
|
3013
|
+
set: sr,
|
|
3014
|
+
setErrorMap: mt,
|
|
3015
|
+
strictObject: Kt,
|
|
3016
|
+
string: g,
|
|
3017
|
+
symbol: Ft,
|
|
3018
|
+
transformer: Xe,
|
|
3019
|
+
tuple: tr,
|
|
3020
|
+
undefined: qt,
|
|
3021
|
+
union: Xt,
|
|
3022
|
+
unknown: Ht,
|
|
3023
|
+
get util() {
|
|
3024
|
+
return x;
|
|
3025
|
+
},
|
|
3026
|
+
void: Gt
|
|
3027
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
3028
|
+
ht(vr);
|
|
3029
|
+
const xr = (r, e) => e.skipDedupe || e.method !== "GET", kr = (r, e) => e.method + "@" + r, br = (r) => r.clone(), wr = ({ skip: r = xr, key: e = kr, resolver: t = br } = {}) => {
|
|
3057
3030
|
const s = /* @__PURE__ */ new Map();
|
|
3058
3031
|
return (n) => (a, i) => {
|
|
3059
3032
|
if (r(a, i))
|
|
@@ -3062,118 +3035,118 @@ const wr = (r, e) => e.skipDedupe || e.method !== "GET", Tr = (r, e) => e.method
|
|
|
3062
3035
|
if (!s.has(o))
|
|
3063
3036
|
s.set(o, []);
|
|
3064
3037
|
else
|
|
3065
|
-
return new Promise((c,
|
|
3066
|
-
s.get(o).push([c,
|
|
3038
|
+
return new Promise((c, u) => {
|
|
3039
|
+
s.get(o).push([c, u]);
|
|
3067
3040
|
});
|
|
3068
3041
|
try {
|
|
3069
|
-
return n(a, i).then((c) => (s.get(o).forEach(([
|
|
3070
|
-
throw s.get(o).forEach(([,
|
|
3042
|
+
return n(a, i).then((c) => (s.get(o).forEach(([u]) => u(t(c))), s.delete(o), c)).catch((c) => {
|
|
3043
|
+
throw s.get(o).forEach(([, u]) => u(c)), s.delete(o), c;
|
|
3071
3044
|
});
|
|
3072
3045
|
} catch (c) {
|
|
3073
3046
|
return s.delete(o), Promise.reject(c);
|
|
3074
3047
|
}
|
|
3075
3048
|
};
|
|
3076
|
-
},
|
|
3049
|
+
}, Tr = (r, e) => r * e, Cr = (r) => r && r.ok, Sr = ({ delayTimer: r = 500, delayRamp: e = Tr, maxAttempts: t = 10, until: s = Cr, onRetry: n = null, retryOnNetworkError: a = !1, resolveWithLatestResponse: i = !1, skip: o } = {}) => (c) => (u, p) => {
|
|
3077
3050
|
let b = 0;
|
|
3078
|
-
if (o && o(
|
|
3079
|
-
return c(
|
|
3080
|
-
const
|
|
3051
|
+
if (o && o(u, p))
|
|
3052
|
+
return c(u, p);
|
|
3053
|
+
const A = (w, V) => Promise.resolve(s(w, V)).then((Ze) => Ze ? w && i ? w : V ? Promise.reject(V) : w : (b++, !t || b <= t ? new Promise((L) => {
|
|
3081
3054
|
const be = e(r, b);
|
|
3082
3055
|
setTimeout(() => {
|
|
3083
3056
|
typeof n == "function" ? Promise.resolve(n({
|
|
3084
3057
|
response: w,
|
|
3085
|
-
error:
|
|
3086
|
-
url:
|
|
3087
|
-
options:
|
|
3088
|
-
})).then((
|
|
3089
|
-
var
|
|
3090
|
-
|
|
3091
|
-
}) :
|
|
3058
|
+
error: V,
|
|
3059
|
+
url: u,
|
|
3060
|
+
options: p
|
|
3061
|
+
})).then((q = {}) => {
|
|
3062
|
+
var ne, ae;
|
|
3063
|
+
L(c((ne = q && q.url) !== null && ne !== void 0 ? ne : u, (ae = q && q.options) !== null && ae !== void 0 ? ae : p));
|
|
3064
|
+
}) : L(c(u, p));
|
|
3092
3065
|
}, be);
|
|
3093
|
-
}).then(
|
|
3066
|
+
}).then(A).catch((L) => {
|
|
3094
3067
|
if (!a)
|
|
3095
|
-
throw
|
|
3096
|
-
return
|
|
3097
|
-
}) : w && i ? w : Promise.reject(
|
|
3098
|
-
return c(
|
|
3068
|
+
throw L;
|
|
3069
|
+
return A(null, L);
|
|
3070
|
+
}) : w && i ? w : Promise.reject(V || new Error("Number of attempts exceeded."))));
|
|
3071
|
+
return c(u, p).then(A).catch((w) => {
|
|
3099
3072
|
if (!a)
|
|
3100
3073
|
throw w;
|
|
3101
|
-
return
|
|
3074
|
+
return A(null, w);
|
|
3102
3075
|
});
|
|
3103
|
-
},
|
|
3104
|
-
code:
|
|
3105
|
-
message:
|
|
3106
|
-
}),
|
|
3107
|
-
message:
|
|
3108
|
-
}),
|
|
3109
|
-
emails:
|
|
3110
|
-
http_body:
|
|
3111
|
-
http_url:
|
|
3112
|
-
txt_name:
|
|
3113
|
-
txt_value:
|
|
3114
|
-
}),
|
|
3115
|
-
ciphers:
|
|
3116
|
-
early_hints:
|
|
3117
|
-
http2:
|
|
3118
|
-
min_tls_version:
|
|
3119
|
-
tls_1_3:
|
|
3120
|
-
}),
|
|
3121
|
-
id:
|
|
3122
|
-
bundle_method:
|
|
3123
|
-
certificate_authority:
|
|
3124
|
-
custom_certificate:
|
|
3125
|
-
custom_csr_id:
|
|
3126
|
-
custom_key:
|
|
3127
|
-
expires_on:
|
|
3128
|
-
hosts:
|
|
3129
|
-
issuer:
|
|
3130
|
-
method:
|
|
3131
|
-
serial_number:
|
|
3132
|
-
settings:
|
|
3133
|
-
signature:
|
|
3134
|
-
type:
|
|
3135
|
-
uploaded_on:
|
|
3136
|
-
validation_errors:
|
|
3137
|
-
validation_records:
|
|
3138
|
-
wildcard:
|
|
3139
|
-
}),
|
|
3140
|
-
name:
|
|
3141
|
-
type:
|
|
3142
|
-
value:
|
|
3143
|
-
}),
|
|
3144
|
-
http_body:
|
|
3145
|
-
http_url:
|
|
3146
|
-
}),
|
|
3147
|
-
id:
|
|
3148
|
-
ssl:
|
|
3149
|
-
hostname:
|
|
3150
|
-
custom_metadata:
|
|
3151
|
-
custom_origin_server:
|
|
3152
|
-
custom_origin_sni:
|
|
3153
|
-
ownership_verification:
|
|
3154
|
-
ownership_verification_http:
|
|
3155
|
-
status:
|
|
3156
|
-
verification_errors:
|
|
3157
|
-
created_at:
|
|
3158
|
-
}),
|
|
3159
|
-
errors:
|
|
3160
|
-
messages:
|
|
3161
|
-
success:
|
|
3162
|
-
result:
|
|
3163
|
-
}),
|
|
3164
|
-
errors:
|
|
3165
|
-
messages:
|
|
3166
|
-
success:
|
|
3167
|
-
result:
|
|
3076
|
+
}, Re = Z({
|
|
3077
|
+
code: Ye(),
|
|
3078
|
+
message: g()
|
|
3079
|
+
}), Or = Z({
|
|
3080
|
+
message: g()
|
|
3081
|
+
}), Ar = Z({
|
|
3082
|
+
emails: O(g()).optional(),
|
|
3083
|
+
http_body: g().optional(),
|
|
3084
|
+
http_url: g().optional(),
|
|
3085
|
+
txt_name: g().optional(),
|
|
3086
|
+
txt_value: g().optional()
|
|
3087
|
+
}), jr = Z({
|
|
3088
|
+
ciphers: O(g()).optional(),
|
|
3089
|
+
early_hints: g().optional(),
|
|
3090
|
+
http2: g().optional(),
|
|
3091
|
+
min_tls_version: g().optional(),
|
|
3092
|
+
tls_1_3: g().optional()
|
|
3093
|
+
}), Rr = Z({
|
|
3094
|
+
id: g(),
|
|
3095
|
+
bundle_method: g().optional(),
|
|
3096
|
+
certificate_authority: g(),
|
|
3097
|
+
custom_certificate: g().optional(),
|
|
3098
|
+
custom_csr_id: g().optional(),
|
|
3099
|
+
custom_key: g().optional(),
|
|
3100
|
+
expires_on: g().optional(),
|
|
3101
|
+
hosts: O(g()).optional(),
|
|
3102
|
+
issuer: g().optional(),
|
|
3103
|
+
method: g(),
|
|
3104
|
+
serial_number: g().optional(),
|
|
3105
|
+
settings: jr.optional(),
|
|
3106
|
+
signature: g().optional(),
|
|
3107
|
+
type: g(),
|
|
3108
|
+
uploaded_on: g().optional(),
|
|
3109
|
+
validation_errors: O(Or).optional(),
|
|
3110
|
+
validation_records: O(Ar).optional(),
|
|
3111
|
+
wildcard: ke()
|
|
3112
|
+
}), Nr = Z({
|
|
3113
|
+
name: g(),
|
|
3114
|
+
type: g(),
|
|
3115
|
+
value: g()
|
|
3116
|
+
}), Zr = Z({
|
|
3117
|
+
http_body: g().optional(),
|
|
3118
|
+
http_url: g().optional()
|
|
3119
|
+
}), it = Z({
|
|
3120
|
+
id: g(),
|
|
3121
|
+
ssl: Rr,
|
|
3122
|
+
hostname: g(),
|
|
3123
|
+
custom_metadata: at(g()).optional(),
|
|
3124
|
+
custom_origin_server: g().optional(),
|
|
3125
|
+
custom_origin_sni: g().optional(),
|
|
3126
|
+
ownership_verification: Nr.optional(),
|
|
3127
|
+
ownership_verification_http: Zr.optional(),
|
|
3128
|
+
status: g(),
|
|
3129
|
+
verification_errors: O(g()).optional(),
|
|
3130
|
+
created_at: g()
|
|
3131
|
+
}), Ue = Z({
|
|
3132
|
+
errors: O(Re),
|
|
3133
|
+
messages: O(Re),
|
|
3134
|
+
success: ke(),
|
|
3135
|
+
result: it
|
|
3136
|
+
}), Er = Z({
|
|
3137
|
+
errors: O(Re),
|
|
3138
|
+
messages: O(Re),
|
|
3139
|
+
success: ke(),
|
|
3140
|
+
result: O(it)
|
|
3168
3141
|
});
|
|
3169
|
-
function
|
|
3170
|
-
return
|
|
3142
|
+
function K(r) {
|
|
3143
|
+
return ut(`https://api.cloudflare.com/client/v4/zones/${r.zoneId}`).headers({
|
|
3171
3144
|
"X-Auth-Email": r.authEmail,
|
|
3172
3145
|
"X-Auth-Key": r.authKey,
|
|
3173
3146
|
"Content-Type": "application/json"
|
|
3174
|
-
}).middlewares([
|
|
3147
|
+
}).middlewares([Sr(), wr()]);
|
|
3175
3148
|
}
|
|
3176
|
-
function
|
|
3149
|
+
function Be(r) {
|
|
3177
3150
|
const e = [];
|
|
3178
3151
|
if (r.ssl.validation_records)
|
|
3179
3152
|
for (const t of r.ssl.validation_records)
|
|
@@ -3193,15 +3166,15 @@ function Ue(r) {
|
|
|
3193
3166
|
status: r.status === "active" ? "ready" : "pending",
|
|
3194
3167
|
type: "auth0_managed_certs",
|
|
3195
3168
|
verification: {
|
|
3196
|
-
methods:
|
|
3169
|
+
methods: O(dt).parse(e)
|
|
3197
3170
|
}
|
|
3198
3171
|
};
|
|
3199
3172
|
}
|
|
3200
|
-
function
|
|
3173
|
+
function Ir(r) {
|
|
3201
3174
|
return {
|
|
3202
3175
|
create: async (e, t) => {
|
|
3203
|
-
const { result: s, errors: n, success: a } =
|
|
3204
|
-
await
|
|
3176
|
+
const { result: s, errors: n, success: a } = Ue.parse(
|
|
3177
|
+
await K(r).post(
|
|
3205
3178
|
{
|
|
3206
3179
|
hostname: t.domain,
|
|
3207
3180
|
ssl: {
|
|
@@ -3217,7 +3190,7 @@ function Mr(r) {
|
|
|
3217
3190
|
);
|
|
3218
3191
|
if (!a)
|
|
3219
3192
|
throw new Error(JSON.stringify(n));
|
|
3220
|
-
const i =
|
|
3193
|
+
const i = Be({
|
|
3221
3194
|
...s,
|
|
3222
3195
|
primary: !1
|
|
3223
3196
|
});
|
|
@@ -3234,21 +3207,21 @@ function Mr(r) {
|
|
|
3234
3207
|
t
|
|
3235
3208
|
);
|
|
3236
3209
|
if (!s)
|
|
3237
|
-
throw new
|
|
3238
|
-
const n = await
|
|
3210
|
+
throw new G(404);
|
|
3211
|
+
const n = await K(r).get(`/custom_hostnames/${encodeURIComponent(t)}`).json(), { result: a, errors: i, success: o } = Ue.parse(n);
|
|
3239
3212
|
if (!o)
|
|
3240
|
-
throw new
|
|
3213
|
+
throw new G(503, {
|
|
3241
3214
|
message: JSON.stringify(i)
|
|
3242
3215
|
});
|
|
3243
3216
|
if (r.enterprise && ((c = a.custom_metadata) == null ? void 0 : c.tenant_id) !== e)
|
|
3244
|
-
throw new
|
|
3245
|
-
return
|
|
3217
|
+
throw new G(404);
|
|
3218
|
+
return Be({ ...s, ...a });
|
|
3246
3219
|
},
|
|
3247
3220
|
getByDomain: async (e) => r.customDomainAdapter.getByDomain(e),
|
|
3248
3221
|
list: async (e) => {
|
|
3249
|
-
const t = await r.customDomainAdapter.list(e), s = await
|
|
3222
|
+
const t = await r.customDomainAdapter.list(e), s = await K(r).get("/custom_hostnames").json(), { result: n, errors: a, success: i } = Er.parse(s);
|
|
3250
3223
|
if (!i)
|
|
3251
|
-
throw new
|
|
3224
|
+
throw new G(503, {
|
|
3252
3225
|
message: JSON.stringify(a)
|
|
3253
3226
|
});
|
|
3254
3227
|
return n.filter(
|
|
@@ -3259,7 +3232,7 @@ function Mr(r) {
|
|
|
3259
3232
|
return !(r.enterprise && ((c = o.custom_metadata) == null ? void 0 : c.tenant_id) !== e);
|
|
3260
3233
|
}
|
|
3261
3234
|
).map(
|
|
3262
|
-
(o) =>
|
|
3235
|
+
(o) => Be({
|
|
3263
3236
|
...t.find((c) => c.custom_domain_id === o.id),
|
|
3264
3237
|
...o
|
|
3265
3238
|
})
|
|
@@ -3268,22 +3241,22 @@ function Mr(r) {
|
|
|
3268
3241
|
remove: async (e, t) => {
|
|
3269
3242
|
var n;
|
|
3270
3243
|
if (r.enterprise) {
|
|
3271
|
-
const { result: a, success: i } =
|
|
3272
|
-
await
|
|
3244
|
+
const { result: a, success: i } = Ue.parse(
|
|
3245
|
+
await K(r).get(`/custom_hostnames/${encodeURIComponent(t)}`).json()
|
|
3273
3246
|
);
|
|
3274
3247
|
if (!i || ((n = a.custom_metadata) == null ? void 0 : n.tenant_id) !== e)
|
|
3275
|
-
throw new
|
|
3248
|
+
throw new G(404);
|
|
3276
3249
|
}
|
|
3277
|
-
const s = await
|
|
3250
|
+
const s = await K(r).delete(`/custom_hostnames/${encodeURIComponent(t)}`).res();
|
|
3278
3251
|
return s.ok && await r.customDomainAdapter.remove(e, t), s.ok;
|
|
3279
3252
|
},
|
|
3280
3253
|
update: async (e, t, s) => {
|
|
3281
|
-
const n = await
|
|
3254
|
+
const n = await K(r).patch(
|
|
3282
3255
|
s,
|
|
3283
3256
|
`/custom_hostnames/${encodeURIComponent(t)}`
|
|
3284
3257
|
).res();
|
|
3285
3258
|
if (!n.ok)
|
|
3286
|
-
throw new
|
|
3259
|
+
throw new G(503, {
|
|
3287
3260
|
message: await n.text()
|
|
3288
3261
|
});
|
|
3289
3262
|
return r.customDomainAdapter.update(
|
|
@@ -3294,9 +3267,9 @@ function Mr(r) {
|
|
|
3294
3267
|
}
|
|
3295
3268
|
};
|
|
3296
3269
|
}
|
|
3297
|
-
class
|
|
3270
|
+
class $r {
|
|
3298
3271
|
constructor(e) {
|
|
3299
|
-
|
|
3272
|
+
we(this, "cache", null);
|
|
3300
3273
|
this.config = e;
|
|
3301
3274
|
}
|
|
3302
3275
|
async getCache() {
|
|
@@ -3331,14 +3304,14 @@ class Dr {
|
|
|
3331
3304
|
value: t,
|
|
3332
3305
|
expiresAt: i ? new Date(Date.now() + (o > 0 ? o * 1e3 : -1)).toISOString() : void 0,
|
|
3333
3306
|
cachedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
3334
|
-
},
|
|
3307
|
+
}, u = this.createRequest(e), p = {
|
|
3335
3308
|
"Content-Type": "application/json"
|
|
3336
3309
|
};
|
|
3337
|
-
i && o > 0 && (
|
|
3310
|
+
i && o > 0 && (p["Cache-Control"] = `max-age=${o}`);
|
|
3338
3311
|
const b = new Response(JSON.stringify(c), {
|
|
3339
|
-
headers:
|
|
3312
|
+
headers: p
|
|
3340
3313
|
});
|
|
3341
|
-
await n.put(
|
|
3314
|
+
await n.put(u, b);
|
|
3342
3315
|
} catch (n) {
|
|
3343
3316
|
console.error(`CloudflareCache: set error for key ${e}:`, n);
|
|
3344
3317
|
}
|
|
@@ -3357,7 +3330,7 @@ class Dr {
|
|
|
3357
3330
|
);
|
|
3358
3331
|
}
|
|
3359
3332
|
}
|
|
3360
|
-
function
|
|
3333
|
+
function Pr(r = {}) {
|
|
3361
3334
|
const e = {
|
|
3362
3335
|
defaultTtlSeconds: 300,
|
|
3363
3336
|
// 5 minutes default
|
|
@@ -3366,13 +3339,13 @@ function Vr(r = {}) {
|
|
|
3366
3339
|
...r
|
|
3367
3340
|
// user config overrides defaults
|
|
3368
3341
|
};
|
|
3369
|
-
return new
|
|
3342
|
+
return new $r(e);
|
|
3370
3343
|
}
|
|
3371
|
-
function
|
|
3344
|
+
function Lr(r) {
|
|
3372
3345
|
return {
|
|
3373
|
-
customDomains:
|
|
3346
|
+
customDomains: Ir(r),
|
|
3374
3347
|
// Always create a cache adapter (let createCloudflareCache apply defaults)
|
|
3375
|
-
cache:
|
|
3348
|
+
cache: Pr({
|
|
3376
3349
|
...r.cacheName && { cacheName: r.cacheName },
|
|
3377
3350
|
...r.defaultTtlSeconds !== void 0 && {
|
|
3378
3351
|
defaultTtlSeconds: r.defaultTtlSeconds
|
|
@@ -3382,5 +3355,5 @@ function Br(r) {
|
|
|
3382
3355
|
};
|
|
3383
3356
|
}
|
|
3384
3357
|
export {
|
|
3385
|
-
|
|
3358
|
+
Lr as default
|
|
3386
3359
|
};
|