@authhero/cloudflare-adapter 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cloudflare-adapter.cjs +1 -1
- package/dist/cloudflare-adapter.d.ts +41 -3
- package/dist/cloudflare-adapter.mjs +497 -478
- package/package.json +4 -4
|
@@ -1,72 +1,9 @@
|
|
|
1
1
|
var ot = Object.defineProperty;
|
|
2
2
|
var dt = (r, e, t) => e in r ? ot(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
3
|
var Ve = (r, e, t) => dt(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import ct from "
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
super(t == null ? void 0 : t.message, { cause: t == null ? void 0 : t.cause });
|
|
8
|
-
Ve(this, "res");
|
|
9
|
-
Ve(this, "status");
|
|
10
|
-
this.res = t == null ? void 0 : t.res, this.status = e;
|
|
11
|
-
}
|
|
12
|
-
getResponse() {
|
|
13
|
-
return this.res ? new Response(this.res.body, {
|
|
14
|
-
status: this.status,
|
|
15
|
-
headers: this.res.headers
|
|
16
|
-
}) : new Response(this.message, {
|
|
17
|
-
status: this.status
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
const ut = (r, e) => e.skipDedupe || e.method !== "GET", lt = (r, e) => e.method + "@" + r, ft = (r) => r.clone(), ht = ({ skip: r = ut, key: e = lt, resolver: t = ft } = {}) => {
|
|
22
|
-
const n = /* @__PURE__ */ new Map();
|
|
23
|
-
return (s) => (a, i) => {
|
|
24
|
-
if (r(a, i))
|
|
25
|
-
return s(a, i);
|
|
26
|
-
const o = e(a, i);
|
|
27
|
-
if (!n.has(o))
|
|
28
|
-
n.set(o, []);
|
|
29
|
-
else
|
|
30
|
-
return new Promise((u, d) => {
|
|
31
|
-
n.get(o).push([u, d]);
|
|
32
|
-
});
|
|
33
|
-
try {
|
|
34
|
-
return s(a, i).then((u) => (n.get(o).forEach(([d]) => d(t(u))), n.delete(o), u)).catch((u) => {
|
|
35
|
-
throw n.get(o).forEach(([, d]) => d(u)), n.delete(o), u;
|
|
36
|
-
});
|
|
37
|
-
} catch (u) {
|
|
38
|
-
return n.delete(o), Promise.reject(u);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
}, pt = (r, e) => r * e, mt = (r) => r && r.ok, yt = ({ delayTimer: r = 500, delayRamp: e = pt, maxAttempts: t = 10, until: n = mt, onRetry: s = null, retryOnNetworkError: a = !1, resolveWithLatestResponse: i = !1, skip: o } = {}) => (u) => (d, p) => {
|
|
42
|
-
let k = 0;
|
|
43
|
-
if (o && o(d, p))
|
|
44
|
-
return u(d, p);
|
|
45
|
-
const O = (w, P) => Promise.resolve(n(w, P)).then((Ne) => Ne ? w && i ? w : P ? Promise.reject(P) : w : (k++, !t || k <= t ? new Promise(($) => {
|
|
46
|
-
const be = e(r, k);
|
|
47
|
-
setTimeout(() => {
|
|
48
|
-
typeof s == "function" ? Promise.resolve(s({
|
|
49
|
-
response: w,
|
|
50
|
-
error: P,
|
|
51
|
-
url: d,
|
|
52
|
-
options: p
|
|
53
|
-
})).then((B = {}) => {
|
|
54
|
-
var te, re;
|
|
55
|
-
$(u((te = B && B.url) !== null && te !== void 0 ? te : d, (re = B && B.options) !== null && re !== void 0 ? re : p));
|
|
56
|
-
}) : $(u(d, p));
|
|
57
|
-
}, be);
|
|
58
|
-
}).then(O).catch(($) => {
|
|
59
|
-
if (!a)
|
|
60
|
-
throw $;
|
|
61
|
-
return O(null, $);
|
|
62
|
-
}) : w && i ? w : Promise.reject(P || new Error("Number of attempts exceeded."))));
|
|
63
|
-
return u(d, p).then(O).catch((w) => {
|
|
64
|
-
if (!a)
|
|
65
|
-
throw w;
|
|
66
|
-
return O(null, w);
|
|
67
|
-
});
|
|
68
|
-
};
|
|
69
|
-
function _t(r, e) {
|
|
4
|
+
import { verificationMethodsSchema as ct } from "@authhero/adapter-interfaces";
|
|
5
|
+
import ut from "wretch";
|
|
6
|
+
function lt(r, e) {
|
|
70
7
|
var t = {};
|
|
71
8
|
for (var n in r) Object.prototype.hasOwnProperty.call(r, n) && e.indexOf(n) < 0 && (t[n] = r[n]);
|
|
72
9
|
if (r != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -74,7 +11,7 @@ function _t(r, e) {
|
|
|
74
11
|
e.indexOf(n[s]) < 0 && Object.prototype.propertyIsEnumerable.call(r, n[s]) && (t[n[s]] = r[n[s]]);
|
|
75
12
|
return t;
|
|
76
13
|
}
|
|
77
|
-
function
|
|
14
|
+
function ft(r, e) {
|
|
78
15
|
var t;
|
|
79
16
|
return ((t = r == null ? void 0 : r._def) === null || t === void 0 ? void 0 : t.typeName) === e;
|
|
80
17
|
}
|
|
@@ -85,15 +22,15 @@ function ne(r, e) {
|
|
|
85
22
|
return s._def.openapi = this._def.openapi, s;
|
|
86
23
|
};
|
|
87
24
|
}
|
|
88
|
-
function
|
|
25
|
+
function ht(r) {
|
|
89
26
|
if (typeof r.ZodType.prototype.openapi < "u")
|
|
90
27
|
return;
|
|
91
28
|
r.ZodType.prototype.openapi = function(s, a) {
|
|
92
|
-
var i, o,
|
|
93
|
-
const O = typeof s == "string" ? a : s, w = O ?? {}, { param: P } = w, Ne =
|
|
29
|
+
var i, o, d, c, p, k;
|
|
30
|
+
const O = typeof s == "string" ? a : s, w = O ?? {}, { param: P } = w, Ne = lt(w, ["param"]), $ = Object.assign(Object.assign({}, (i = this._def.openapi) === null || i === void 0 ? void 0 : i._internal), typeof s == "string" ? { refId: s } : void 0), be = Object.assign(Object.assign(Object.assign({}, (o = this._def.openapi) === null || o === void 0 ? void 0 : o.metadata), Ne), !((c = (d = this._def.openapi) === null || d === void 0 ? void 0 : d.metadata) === null || c === void 0) && c.param || P ? {
|
|
94
31
|
param: Object.assign(Object.assign({}, (k = (p = this._def.openapi) === null || p === void 0 ? void 0 : p.metadata) === null || k === void 0 ? void 0 : k.param), P)
|
|
95
32
|
} : void 0), B = new this.constructor(Object.assign(Object.assign({}, this._def), { openapi: Object.assign(Object.assign({}, Object.keys($).length > 0 ? { _internal: $ } : void 0), Object.keys(be).length > 0 ? { metadata: be } : void 0) }));
|
|
96
|
-
if (
|
|
33
|
+
if (ft(this, "ZodObject")) {
|
|
97
34
|
const te = this.extend;
|
|
98
35
|
B.extend = function(...re) {
|
|
99
36
|
var Re, Ie, Ae, Me, Pe, $e;
|
|
@@ -111,9 +48,9 @@ function gt(r) {
|
|
|
111
48
|
const e = r.ZodObject.prototype.deepPartial;
|
|
112
49
|
r.ZodObject.prototype.deepPartial = function() {
|
|
113
50
|
const s = this._def.shape(), a = e.apply(this), i = a._def.shape();
|
|
114
|
-
return Object.entries(i).forEach(([o,
|
|
115
|
-
var
|
|
116
|
-
|
|
51
|
+
return Object.entries(i).forEach(([o, d]) => {
|
|
52
|
+
var c, p;
|
|
53
|
+
d._def.openapi = (p = (c = s[o]) === null || c === void 0 ? void 0 : c._def) === null || p === void 0 ? void 0 : p.openapi;
|
|
117
54
|
}), a._def.openapi = void 0, a;
|
|
118
55
|
};
|
|
119
56
|
const t = r.ZodObject.prototype.pick;
|
|
@@ -127,6 +64,22 @@ function gt(r) {
|
|
|
127
64
|
return a._def.openapi = void 0, a;
|
|
128
65
|
};
|
|
129
66
|
}
|
|
67
|
+
var H = class extends Error {
|
|
68
|
+
constructor(e = 500, t) {
|
|
69
|
+
super(t == null ? void 0 : t.message, { cause: t == null ? void 0 : t.cause });
|
|
70
|
+
Ve(this, "res");
|
|
71
|
+
Ve(this, "status");
|
|
72
|
+
this.res = t == null ? void 0 : t.res, this.status = e;
|
|
73
|
+
}
|
|
74
|
+
getResponse() {
|
|
75
|
+
return this.res ? new Response(this.res.body, {
|
|
76
|
+
status: this.status,
|
|
77
|
+
headers: this.res.headers
|
|
78
|
+
}) : new Response(this.message, {
|
|
79
|
+
status: this.status
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
};
|
|
130
83
|
new Set(".\\+*[^]$()");
|
|
131
84
|
var x;
|
|
132
85
|
(function(r) {
|
|
@@ -214,7 +167,7 @@ const f = x.arrayToEnum([
|
|
|
214
167
|
default:
|
|
215
168
|
return f.unknown;
|
|
216
169
|
}
|
|
217
|
-
},
|
|
170
|
+
}, u = x.arrayToEnum([
|
|
218
171
|
"invalid_type",
|
|
219
172
|
"invalid_literal",
|
|
220
173
|
"custom",
|
|
@@ -231,7 +184,7 @@ const f = x.arrayToEnum([
|
|
|
231
184
|
"invalid_intersection_types",
|
|
232
185
|
"not_multiple_of",
|
|
233
186
|
"not_finite"
|
|
234
|
-
]),
|
|
187
|
+
]), pt = (r) => JSON.stringify(r, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
235
188
|
class S extends Error {
|
|
236
189
|
constructor(e) {
|
|
237
190
|
super(), this.issues = [], this.addIssue = (n) => {
|
|
@@ -259,10 +212,10 @@ class S extends Error {
|
|
|
259
212
|
else if (i.path.length === 0)
|
|
260
213
|
n._errors.push(t(i));
|
|
261
214
|
else {
|
|
262
|
-
let o = n,
|
|
263
|
-
for (;
|
|
264
|
-
const
|
|
265
|
-
|
|
215
|
+
let o = n, d = 0;
|
|
216
|
+
for (; d < i.path.length; ) {
|
|
217
|
+
const c = i.path[d];
|
|
218
|
+
d === i.path.length - 1 ? (o[c] = o[c] || { _errors: [] }, o[c]._errors.push(t(i))) : o[c] = o[c] || { _errors: [] }, o = o[c], d++;
|
|
266
219
|
}
|
|
267
220
|
}
|
|
268
221
|
};
|
|
@@ -295,52 +248,52 @@ S.create = (r) => new S(r);
|
|
|
295
248
|
const Q = (r, e) => {
|
|
296
249
|
let t;
|
|
297
250
|
switch (r.code) {
|
|
298
|
-
case
|
|
251
|
+
case u.invalid_type:
|
|
299
252
|
r.received === f.undefined ? t = "Required" : t = `Expected ${r.expected}, received ${r.received}`;
|
|
300
253
|
break;
|
|
301
|
-
case
|
|
254
|
+
case u.invalid_literal:
|
|
302
255
|
t = `Invalid literal value, expected ${JSON.stringify(r.expected, x.jsonStringifyReplacer)}`;
|
|
303
256
|
break;
|
|
304
|
-
case
|
|
257
|
+
case u.unrecognized_keys:
|
|
305
258
|
t = `Unrecognized key(s) in object: ${x.joinValues(r.keys, ", ")}`;
|
|
306
259
|
break;
|
|
307
|
-
case
|
|
260
|
+
case u.invalid_union:
|
|
308
261
|
t = "Invalid input";
|
|
309
262
|
break;
|
|
310
|
-
case
|
|
263
|
+
case u.invalid_union_discriminator:
|
|
311
264
|
t = `Invalid discriminator value. Expected ${x.joinValues(r.options)}`;
|
|
312
265
|
break;
|
|
313
|
-
case
|
|
266
|
+
case u.invalid_enum_value:
|
|
314
267
|
t = `Invalid enum value. Expected ${x.joinValues(r.options)}, received '${r.received}'`;
|
|
315
268
|
break;
|
|
316
|
-
case
|
|
269
|
+
case u.invalid_arguments:
|
|
317
270
|
t = "Invalid function arguments";
|
|
318
271
|
break;
|
|
319
|
-
case
|
|
272
|
+
case u.invalid_return_type:
|
|
320
273
|
t = "Invalid function return type";
|
|
321
274
|
break;
|
|
322
|
-
case
|
|
275
|
+
case u.invalid_date:
|
|
323
276
|
t = "Invalid date";
|
|
324
277
|
break;
|
|
325
|
-
case
|
|
278
|
+
case u.invalid_string:
|
|
326
279
|
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";
|
|
327
280
|
break;
|
|
328
|
-
case
|
|
281
|
+
case u.too_small:
|
|
329
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";
|
|
330
283
|
break;
|
|
331
|
-
case
|
|
284
|
+
case u.too_big:
|
|
332
285
|
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";
|
|
333
286
|
break;
|
|
334
|
-
case
|
|
287
|
+
case u.custom:
|
|
335
288
|
t = "Invalid input";
|
|
336
289
|
break;
|
|
337
|
-
case
|
|
290
|
+
case u.invalid_intersection_types:
|
|
338
291
|
t = "Intersection results could not be merged";
|
|
339
292
|
break;
|
|
340
|
-
case
|
|
293
|
+
case u.not_multiple_of:
|
|
341
294
|
t = `Number must be a multiple of ${r.multipleOf}`;
|
|
342
295
|
break;
|
|
343
|
-
case
|
|
296
|
+
case u.not_finite:
|
|
344
297
|
t = "Number must be finite";
|
|
345
298
|
break;
|
|
346
299
|
default:
|
|
@@ -349,7 +302,7 @@ const Q = (r, e) => {
|
|
|
349
302
|
return { message: t };
|
|
350
303
|
};
|
|
351
304
|
let Xe = Q;
|
|
352
|
-
function
|
|
305
|
+
function mt(r) {
|
|
353
306
|
Xe = r;
|
|
354
307
|
}
|
|
355
308
|
function ke() {
|
|
@@ -367,15 +320,15 @@ const we = (r) => {
|
|
|
367
320
|
message: s.message
|
|
368
321
|
};
|
|
369
322
|
let o = "";
|
|
370
|
-
const
|
|
371
|
-
for (const
|
|
372
|
-
o =
|
|
323
|
+
const d = n.filter((c) => !!c).slice().reverse();
|
|
324
|
+
for (const c of d)
|
|
325
|
+
o = c(i, { data: e, defaultError: o }).message;
|
|
373
326
|
return {
|
|
374
327
|
...s,
|
|
375
328
|
path: a,
|
|
376
329
|
message: o
|
|
377
330
|
};
|
|
378
|
-
},
|
|
331
|
+
}, _t = [];
|
|
379
332
|
function l(r, e) {
|
|
380
333
|
const t = ke(), n = we({
|
|
381
334
|
issueData: e,
|
|
@@ -405,7 +358,7 @@ class T {
|
|
|
405
358
|
const n = [];
|
|
406
359
|
for (const s of t) {
|
|
407
360
|
if (s.status === "aborted")
|
|
408
|
-
return
|
|
361
|
+
return y;
|
|
409
362
|
s.status === "dirty" && e.dirty(), n.push(s.value);
|
|
410
363
|
}
|
|
411
364
|
return { status: e.value, value: n };
|
|
@@ -426,13 +379,13 @@ class T {
|
|
|
426
379
|
for (const s of t) {
|
|
427
380
|
const { key: a, value: i } = s;
|
|
428
381
|
if (a.status === "aborted" || i.status === "aborted")
|
|
429
|
-
return
|
|
382
|
+
return y;
|
|
430
383
|
a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value < "u" || s.alwaysSet) && (n[a.value] = i.value);
|
|
431
384
|
}
|
|
432
385
|
return { status: e.value, value: n };
|
|
433
386
|
}
|
|
434
387
|
}
|
|
435
|
-
const
|
|
388
|
+
const y = Object.freeze({
|
|
436
389
|
status: "aborted"
|
|
437
390
|
}), X = (r) => ({ status: "dirty", value: r }), Z = (r) => ({ status: "valid", value: r }), We = (r) => r.status === "aborted", qe = (r) => r.status === "dirty", ie = (r) => r.status === "valid", oe = (r) => typeof Promise < "u" && r instanceof Promise;
|
|
438
391
|
function Te(r, e, t, n) {
|
|
@@ -478,9 +431,9 @@ function v(r) {
|
|
|
478
431
|
if (e && (t || n))
|
|
479
432
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
480
433
|
return e ? { errorMap: e, description: s } : { errorMap: (i, o) => {
|
|
481
|
-
var
|
|
434
|
+
var d, c;
|
|
482
435
|
const { message: p } = r;
|
|
483
|
-
return i.code === "invalid_enum_value" ? { message: p ?? o.defaultError } : typeof o.data > "u" ? { message: (
|
|
436
|
+
return i.code === "invalid_enum_value" ? { message: p ?? o.defaultError } : typeof o.data > "u" ? { message: (d = p ?? n) !== null && d !== void 0 ? d : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (c = p ?? t) !== null && c !== void 0 ? c : o.defaultError };
|
|
484
437
|
}, description: s };
|
|
485
438
|
}
|
|
486
439
|
class g {
|
|
@@ -573,10 +526,10 @@ class g {
|
|
|
573
526
|
const n = (s) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(s) : t;
|
|
574
527
|
return this._refinement((s, a) => {
|
|
575
528
|
const i = e(s), o = () => a.addIssue({
|
|
576
|
-
code:
|
|
529
|
+
code: u.custom,
|
|
577
530
|
...n(s)
|
|
578
531
|
});
|
|
579
|
-
return typeof Promise < "u" && i instanceof Promise ? i.then((
|
|
532
|
+
return typeof Promise < "u" && i instanceof Promise ? i.then((d) => d ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
|
|
580
533
|
});
|
|
581
534
|
}
|
|
582
535
|
refinement(e, t) {
|
|
@@ -585,7 +538,7 @@ class g {
|
|
|
585
538
|
_refinement(e) {
|
|
586
539
|
return new C({
|
|
587
540
|
schema: this,
|
|
588
|
-
typeName:
|
|
541
|
+
typeName: _.ZodEffects,
|
|
589
542
|
effect: { type: "refinement", refinement: e }
|
|
590
543
|
});
|
|
591
544
|
}
|
|
@@ -617,22 +570,22 @@ class g {
|
|
|
617
570
|
return new C({
|
|
618
571
|
...v(this._def),
|
|
619
572
|
schema: this,
|
|
620
|
-
typeName:
|
|
573
|
+
typeName: _.ZodEffects,
|
|
621
574
|
effect: { type: "transform", transform: e }
|
|
622
575
|
});
|
|
623
576
|
}
|
|
624
577
|
default(e) {
|
|
625
578
|
const t = typeof e == "function" ? e : () => e;
|
|
626
|
-
return new
|
|
579
|
+
return new ye({
|
|
627
580
|
...v(this._def),
|
|
628
581
|
innerType: this,
|
|
629
582
|
defaultValue: t,
|
|
630
|
-
typeName:
|
|
583
|
+
typeName: _.ZodDefault
|
|
631
584
|
});
|
|
632
585
|
}
|
|
633
586
|
brand() {
|
|
634
587
|
return new He({
|
|
635
|
-
typeName:
|
|
588
|
+
typeName: _.ZodBranded,
|
|
636
589
|
type: this,
|
|
637
590
|
...v(this._def)
|
|
638
591
|
});
|
|
@@ -643,7 +596,7 @@ class g {
|
|
|
643
596
|
...v(this._def),
|
|
644
597
|
innerType: this,
|
|
645
598
|
catchValue: t,
|
|
646
|
-
typeName:
|
|
599
|
+
typeName: _.ZodCatch
|
|
647
600
|
});
|
|
648
601
|
}
|
|
649
602
|
describe(e) {
|
|
@@ -666,14 +619,14 @@ class g {
|
|
|
666
619
|
return this.safeParse(null).success;
|
|
667
620
|
}
|
|
668
621
|
}
|
|
669
|
-
const
|
|
622
|
+
const yt = /^c[^\s-]{8,}$/i, vt = /^[0-9a-z]+$/, gt = /^[0-9A-HJKMNP-TV-Z]{26}$/, 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, bt = /^[a-z0-9_-]{21}$/i, kt = /^[-+]?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)?)??$/, wt = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Tt = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
670
623
|
let Le;
|
|
671
|
-
const
|
|
624
|
+
const Zt = /^(?:(?: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])$/, St = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/, Ot = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Qe = "((\\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])))", jt = new RegExp(`^${Qe}$`);
|
|
672
625
|
function Fe(r) {
|
|
673
626
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
674
627
|
return r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
675
628
|
}
|
|
676
|
-
function
|
|
629
|
+
function Et(r) {
|
|
677
630
|
return new RegExp(`^${Fe(r)}$`);
|
|
678
631
|
}
|
|
679
632
|
function et(r) {
|
|
@@ -681,25 +634,25 @@ function et(r) {
|
|
|
681
634
|
const t = [];
|
|
682
635
|
return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
683
636
|
}
|
|
684
|
-
function
|
|
685
|
-
return !!((e === "v4" || !e) &&
|
|
637
|
+
function Ct(r, e) {
|
|
638
|
+
return !!((e === "v4" || !e) && Zt.test(r) || (e === "v6" || !e) && St.test(r));
|
|
686
639
|
}
|
|
687
640
|
class j extends g {
|
|
688
641
|
_parse(e) {
|
|
689
642
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== f.string) {
|
|
690
643
|
const a = this._getOrReturnCtx(e);
|
|
691
644
|
return l(a, {
|
|
692
|
-
code:
|
|
645
|
+
code: u.invalid_type,
|
|
693
646
|
expected: f.string,
|
|
694
647
|
received: a.parsedType
|
|
695
|
-
}),
|
|
648
|
+
}), y;
|
|
696
649
|
}
|
|
697
650
|
const n = new T();
|
|
698
651
|
let s;
|
|
699
652
|
for (const a of this._def.checks)
|
|
700
653
|
if (a.kind === "min")
|
|
701
654
|
e.data.length < a.value && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
702
|
-
code:
|
|
655
|
+
code: u.too_small,
|
|
703
656
|
minimum: a.value,
|
|
704
657
|
type: "string",
|
|
705
658
|
inclusive: !0,
|
|
@@ -708,7 +661,7 @@ class j extends g {
|
|
|
708
661
|
}), n.dirty());
|
|
709
662
|
else if (a.kind === "max")
|
|
710
663
|
e.data.length > a.value && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
711
|
-
code:
|
|
664
|
+
code: u.too_big,
|
|
712
665
|
maximum: a.value,
|
|
713
666
|
type: "string",
|
|
714
667
|
inclusive: !0,
|
|
@@ -718,14 +671,14 @@ class j extends g {
|
|
|
718
671
|
else if (a.kind === "length") {
|
|
719
672
|
const i = e.data.length > a.value, o = e.data.length < a.value;
|
|
720
673
|
(i || o) && (s = this._getOrReturnCtx(e, s), i ? l(s, {
|
|
721
|
-
code:
|
|
674
|
+
code: u.too_big,
|
|
722
675
|
maximum: a.value,
|
|
723
676
|
type: "string",
|
|
724
677
|
inclusive: !0,
|
|
725
678
|
exact: !0,
|
|
726
679
|
message: a.message
|
|
727
680
|
}) : o && l(s, {
|
|
728
|
-
code:
|
|
681
|
+
code: u.too_small,
|
|
729
682
|
minimum: a.value,
|
|
730
683
|
type: "string",
|
|
731
684
|
inclusive: !0,
|
|
@@ -733,45 +686,45 @@ class j extends g {
|
|
|
733
686
|
message: a.message
|
|
734
687
|
}), n.dirty());
|
|
735
688
|
} else if (a.kind === "email")
|
|
736
|
-
|
|
689
|
+
wt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
737
690
|
validation: "email",
|
|
738
|
-
code:
|
|
691
|
+
code: u.invalid_string,
|
|
739
692
|
message: a.message
|
|
740
693
|
}), n.dirty());
|
|
741
694
|
else if (a.kind === "emoji")
|
|
742
|
-
Le || (Le = new RegExp(
|
|
695
|
+
Le || (Le = new RegExp(Tt, "u")), Le.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
743
696
|
validation: "emoji",
|
|
744
|
-
code:
|
|
697
|
+
code: u.invalid_string,
|
|
745
698
|
message: a.message
|
|
746
699
|
}), n.dirty());
|
|
747
700
|
else if (a.kind === "uuid")
|
|
748
|
-
|
|
701
|
+
xt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
749
702
|
validation: "uuid",
|
|
750
|
-
code:
|
|
703
|
+
code: u.invalid_string,
|
|
751
704
|
message: a.message
|
|
752
705
|
}), n.dirty());
|
|
753
706
|
else if (a.kind === "nanoid")
|
|
754
|
-
|
|
707
|
+
bt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
755
708
|
validation: "nanoid",
|
|
756
|
-
code:
|
|
709
|
+
code: u.invalid_string,
|
|
757
710
|
message: a.message
|
|
758
711
|
}), n.dirty());
|
|
759
712
|
else if (a.kind === "cuid")
|
|
760
|
-
|
|
713
|
+
yt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
761
714
|
validation: "cuid",
|
|
762
|
-
code:
|
|
715
|
+
code: u.invalid_string,
|
|
763
716
|
message: a.message
|
|
764
717
|
}), n.dirty());
|
|
765
718
|
else if (a.kind === "cuid2")
|
|
766
|
-
|
|
719
|
+
vt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
767
720
|
validation: "cuid2",
|
|
768
|
-
code:
|
|
721
|
+
code: u.invalid_string,
|
|
769
722
|
message: a.message
|
|
770
723
|
}), n.dirty());
|
|
771
724
|
else if (a.kind === "ulid")
|
|
772
|
-
|
|
725
|
+
gt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
773
726
|
validation: "ulid",
|
|
774
|
-
code:
|
|
727
|
+
code: u.invalid_string,
|
|
775
728
|
message: a.message
|
|
776
729
|
}), n.dirty());
|
|
777
730
|
else if (a.kind === "url")
|
|
@@ -780,49 +733,49 @@ class j extends g {
|
|
|
780
733
|
} catch {
|
|
781
734
|
s = this._getOrReturnCtx(e, s), l(s, {
|
|
782
735
|
validation: "url",
|
|
783
|
-
code:
|
|
736
|
+
code: u.invalid_string,
|
|
784
737
|
message: a.message
|
|
785
738
|
}), n.dirty();
|
|
786
739
|
}
|
|
787
740
|
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
788
741
|
validation: "regex",
|
|
789
|
-
code:
|
|
742
|
+
code: u.invalid_string,
|
|
790
743
|
message: a.message
|
|
791
744
|
}), n.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
792
|
-
code:
|
|
745
|
+
code: u.invalid_string,
|
|
793
746
|
validation: { includes: a.value, position: a.position },
|
|
794
747
|
message: a.message
|
|
795
748
|
}), n.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) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
796
|
-
code:
|
|
749
|
+
code: u.invalid_string,
|
|
797
750
|
validation: { startsWith: a.value },
|
|
798
751
|
message: a.message
|
|
799
752
|
}), n.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
800
|
-
code:
|
|
753
|
+
code: u.invalid_string,
|
|
801
754
|
validation: { endsWith: a.value },
|
|
802
755
|
message: a.message
|
|
803
756
|
}), n.dirty()) : a.kind === "datetime" ? et(a).test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
804
|
-
code:
|
|
757
|
+
code: u.invalid_string,
|
|
805
758
|
validation: "datetime",
|
|
806
759
|
message: a.message
|
|
807
|
-
}), n.dirty()) : a.kind === "date" ?
|
|
808
|
-
code:
|
|
760
|
+
}), n.dirty()) : a.kind === "date" ? jt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
761
|
+
code: u.invalid_string,
|
|
809
762
|
validation: "date",
|
|
810
763
|
message: a.message
|
|
811
|
-
}), n.dirty()) : a.kind === "time" ?
|
|
812
|
-
code:
|
|
764
|
+
}), n.dirty()) : a.kind === "time" ? Et(a).test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
765
|
+
code: u.invalid_string,
|
|
813
766
|
validation: "time",
|
|
814
767
|
message: a.message
|
|
815
|
-
}), n.dirty()) : a.kind === "duration" ?
|
|
768
|
+
}), n.dirty()) : a.kind === "duration" ? kt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
816
769
|
validation: "duration",
|
|
817
|
-
code:
|
|
770
|
+
code: u.invalid_string,
|
|
818
771
|
message: a.message
|
|
819
|
-
}), n.dirty()) : a.kind === "ip" ?
|
|
772
|
+
}), n.dirty()) : a.kind === "ip" ? Ct(e.data, a.version) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
820
773
|
validation: "ip",
|
|
821
|
-
code:
|
|
774
|
+
code: u.invalid_string,
|
|
822
775
|
message: a.message
|
|
823
|
-
}), n.dirty()) : a.kind === "base64" ?
|
|
776
|
+
}), n.dirty()) : a.kind === "base64" ? Ot.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
824
777
|
validation: "base64",
|
|
825
|
-
code:
|
|
778
|
+
code: u.invalid_string,
|
|
826
779
|
message: a.message
|
|
827
780
|
}), n.dirty()) : x.assertNever(a);
|
|
828
781
|
return { status: n.value, value: e.data };
|
|
@@ -830,7 +783,7 @@ class j extends g {
|
|
|
830
783
|
_regex(e, t, n) {
|
|
831
784
|
return this.refinement((s) => e.test(s), {
|
|
832
785
|
validation: t,
|
|
833
|
-
code:
|
|
786
|
+
code: u.invalid_string,
|
|
834
787
|
...m.errToObj(n)
|
|
835
788
|
});
|
|
836
789
|
}
|
|
@@ -1037,12 +990,12 @@ j.create = (r) => {
|
|
|
1037
990
|
var e;
|
|
1038
991
|
return new j({
|
|
1039
992
|
checks: [],
|
|
1040
|
-
typeName:
|
|
993
|
+
typeName: _.ZodString,
|
|
1041
994
|
coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
|
|
1042
995
|
...v(r)
|
|
1043
996
|
});
|
|
1044
997
|
};
|
|
1045
|
-
function
|
|
998
|
+
function Nt(r, e) {
|
|
1046
999
|
const t = (r.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = t > n ? t : n, a = parseInt(r.toFixed(s).replace(".", "")), i = parseInt(e.toFixed(s).replace(".", ""));
|
|
1047
1000
|
return a % i / Math.pow(10, s);
|
|
1048
1001
|
}
|
|
@@ -1054,39 +1007,39 @@ class V extends g {
|
|
|
1054
1007
|
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== f.number) {
|
|
1055
1008
|
const a = this._getOrReturnCtx(e);
|
|
1056
1009
|
return l(a, {
|
|
1057
|
-
code:
|
|
1010
|
+
code: u.invalid_type,
|
|
1058
1011
|
expected: f.number,
|
|
1059
1012
|
received: a.parsedType
|
|
1060
|
-
}),
|
|
1013
|
+
}), y;
|
|
1061
1014
|
}
|
|
1062
1015
|
let n;
|
|
1063
1016
|
const s = new T();
|
|
1064
1017
|
for (const a of this._def.checks)
|
|
1065
1018
|
a.kind === "int" ? x.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1066
|
-
code:
|
|
1019
|
+
code: u.invalid_type,
|
|
1067
1020
|
expected: "integer",
|
|
1068
1021
|
received: "float",
|
|
1069
1022
|
message: a.message
|
|
1070
1023
|
}), s.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1071
|
-
code:
|
|
1024
|
+
code: u.too_small,
|
|
1072
1025
|
minimum: a.value,
|
|
1073
1026
|
type: "number",
|
|
1074
1027
|
inclusive: a.inclusive,
|
|
1075
1028
|
exact: !1,
|
|
1076
1029
|
message: a.message
|
|
1077
1030
|
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1078
|
-
code:
|
|
1031
|
+
code: u.too_big,
|
|
1079
1032
|
maximum: a.value,
|
|
1080
1033
|
type: "number",
|
|
1081
1034
|
inclusive: a.inclusive,
|
|
1082
1035
|
exact: !1,
|
|
1083
1036
|
message: a.message
|
|
1084
|
-
}), s.dirty()) : a.kind === "multipleOf" ?
|
|
1085
|
-
code:
|
|
1037
|
+
}), s.dirty()) : a.kind === "multipleOf" ? Nt(e.data, a.value) !== 0 && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1038
|
+
code: u.not_multiple_of,
|
|
1086
1039
|
multipleOf: a.value,
|
|
1087
1040
|
message: a.message
|
|
1088
1041
|
}), s.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1089
|
-
code:
|
|
1042
|
+
code: u.not_finite,
|
|
1090
1043
|
message: a.message
|
|
1091
1044
|
}), s.dirty()) : x.assertNever(a);
|
|
1092
1045
|
return { status: s.value, value: e.data };
|
|
@@ -1214,7 +1167,7 @@ class V extends g {
|
|
|
1214
1167
|
}
|
|
1215
1168
|
V.create = (r) => new V({
|
|
1216
1169
|
checks: [],
|
|
1217
|
-
typeName:
|
|
1170
|
+
typeName: _.ZodNumber,
|
|
1218
1171
|
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1219
1172
|
...v(r)
|
|
1220
1173
|
});
|
|
@@ -1226,28 +1179,28 @@ class L extends g {
|
|
|
1226
1179
|
if (this._def.coerce && (e.data = BigInt(e.data)), this._getType(e) !== f.bigint) {
|
|
1227
1180
|
const a = this._getOrReturnCtx(e);
|
|
1228
1181
|
return l(a, {
|
|
1229
|
-
code:
|
|
1182
|
+
code: u.invalid_type,
|
|
1230
1183
|
expected: f.bigint,
|
|
1231
1184
|
received: a.parsedType
|
|
1232
|
-
}),
|
|
1185
|
+
}), y;
|
|
1233
1186
|
}
|
|
1234
1187
|
let n;
|
|
1235
1188
|
const s = new T();
|
|
1236
1189
|
for (const a of this._def.checks)
|
|
1237
1190
|
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1238
|
-
code:
|
|
1191
|
+
code: u.too_small,
|
|
1239
1192
|
type: "bigint",
|
|
1240
1193
|
minimum: a.value,
|
|
1241
1194
|
inclusive: a.inclusive,
|
|
1242
1195
|
message: a.message
|
|
1243
1196
|
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1244
|
-
code:
|
|
1197
|
+
code: u.too_big,
|
|
1245
1198
|
type: "bigint",
|
|
1246
1199
|
maximum: a.value,
|
|
1247
1200
|
inclusive: a.inclusive,
|
|
1248
1201
|
message: a.message
|
|
1249
1202
|
}), s.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1250
|
-
code:
|
|
1203
|
+
code: u.not_multiple_of,
|
|
1251
1204
|
multipleOf: a.value,
|
|
1252
1205
|
message: a.message
|
|
1253
1206
|
}), s.dirty()) : x.assertNever(a);
|
|
@@ -1341,7 +1294,7 @@ L.create = (r) => {
|
|
|
1341
1294
|
var e;
|
|
1342
1295
|
return new L({
|
|
1343
1296
|
checks: [],
|
|
1344
|
-
typeName:
|
|
1297
|
+
typeName: _.ZodBigInt,
|
|
1345
1298
|
coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
|
|
1346
1299
|
...v(r)
|
|
1347
1300
|
});
|
|
@@ -1351,16 +1304,16 @@ class de extends g {
|
|
|
1351
1304
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== f.boolean) {
|
|
1352
1305
|
const n = this._getOrReturnCtx(e);
|
|
1353
1306
|
return l(n, {
|
|
1354
|
-
code:
|
|
1307
|
+
code: u.invalid_type,
|
|
1355
1308
|
expected: f.boolean,
|
|
1356
1309
|
received: n.parsedType
|
|
1357
|
-
}),
|
|
1310
|
+
}), y;
|
|
1358
1311
|
}
|
|
1359
1312
|
return Z(e.data);
|
|
1360
1313
|
}
|
|
1361
1314
|
}
|
|
1362
1315
|
de.create = (r) => new de({
|
|
1363
|
-
typeName:
|
|
1316
|
+
typeName: _.ZodBoolean,
|
|
1364
1317
|
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1365
1318
|
...v(r)
|
|
1366
1319
|
});
|
|
@@ -1369,29 +1322,29 @@ class q extends g {
|
|
|
1369
1322
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== f.date) {
|
|
1370
1323
|
const a = this._getOrReturnCtx(e);
|
|
1371
1324
|
return l(a, {
|
|
1372
|
-
code:
|
|
1325
|
+
code: u.invalid_type,
|
|
1373
1326
|
expected: f.date,
|
|
1374
1327
|
received: a.parsedType
|
|
1375
|
-
}),
|
|
1328
|
+
}), y;
|
|
1376
1329
|
}
|
|
1377
1330
|
if (isNaN(e.data.getTime())) {
|
|
1378
1331
|
const a = this._getOrReturnCtx(e);
|
|
1379
1332
|
return l(a, {
|
|
1380
|
-
code:
|
|
1381
|
-
}),
|
|
1333
|
+
code: u.invalid_date
|
|
1334
|
+
}), y;
|
|
1382
1335
|
}
|
|
1383
1336
|
const n = new T();
|
|
1384
1337
|
let s;
|
|
1385
1338
|
for (const a of this._def.checks)
|
|
1386
1339
|
a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1387
|
-
code:
|
|
1340
|
+
code: u.too_small,
|
|
1388
1341
|
message: a.message,
|
|
1389
1342
|
inclusive: !0,
|
|
1390
1343
|
exact: !1,
|
|
1391
1344
|
minimum: a.value,
|
|
1392
1345
|
type: "date"
|
|
1393
1346
|
}), n.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1394
|
-
code:
|
|
1347
|
+
code: u.too_big,
|
|
1395
1348
|
message: a.message,
|
|
1396
1349
|
inclusive: !0,
|
|
1397
1350
|
exact: !1,
|
|
@@ -1439,7 +1392,7 @@ class q extends g {
|
|
|
1439
1392
|
q.create = (r) => new q({
|
|
1440
1393
|
checks: [],
|
|
1441
1394
|
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1442
|
-
typeName:
|
|
1395
|
+
typeName: _.ZodDate,
|
|
1443
1396
|
...v(r)
|
|
1444
1397
|
});
|
|
1445
1398
|
class Ze extends g {
|
|
@@ -1447,16 +1400,16 @@ class Ze extends g {
|
|
|
1447
1400
|
if (this._getType(e) !== f.symbol) {
|
|
1448
1401
|
const n = this._getOrReturnCtx(e);
|
|
1449
1402
|
return l(n, {
|
|
1450
|
-
code:
|
|
1403
|
+
code: u.invalid_type,
|
|
1451
1404
|
expected: f.symbol,
|
|
1452
1405
|
received: n.parsedType
|
|
1453
|
-
}),
|
|
1406
|
+
}), y;
|
|
1454
1407
|
}
|
|
1455
1408
|
return Z(e.data);
|
|
1456
1409
|
}
|
|
1457
1410
|
}
|
|
1458
1411
|
Ze.create = (r) => new Ze({
|
|
1459
|
-
typeName:
|
|
1412
|
+
typeName: _.ZodSymbol,
|
|
1460
1413
|
...v(r)
|
|
1461
1414
|
});
|
|
1462
1415
|
class ce extends g {
|
|
@@ -1464,16 +1417,16 @@ class ce extends g {
|
|
|
1464
1417
|
if (this._getType(e) !== f.undefined) {
|
|
1465
1418
|
const n = this._getOrReturnCtx(e);
|
|
1466
1419
|
return l(n, {
|
|
1467
|
-
code:
|
|
1420
|
+
code: u.invalid_type,
|
|
1468
1421
|
expected: f.undefined,
|
|
1469
1422
|
received: n.parsedType
|
|
1470
|
-
}),
|
|
1423
|
+
}), y;
|
|
1471
1424
|
}
|
|
1472
1425
|
return Z(e.data);
|
|
1473
1426
|
}
|
|
1474
1427
|
}
|
|
1475
1428
|
ce.create = (r) => new ce({
|
|
1476
|
-
typeName:
|
|
1429
|
+
typeName: _.ZodUndefined,
|
|
1477
1430
|
...v(r)
|
|
1478
1431
|
});
|
|
1479
1432
|
class ue extends g {
|
|
@@ -1481,16 +1434,16 @@ class ue extends g {
|
|
|
1481
1434
|
if (this._getType(e) !== f.null) {
|
|
1482
1435
|
const n = this._getOrReturnCtx(e);
|
|
1483
1436
|
return l(n, {
|
|
1484
|
-
code:
|
|
1437
|
+
code: u.invalid_type,
|
|
1485
1438
|
expected: f.null,
|
|
1486
1439
|
received: n.parsedType
|
|
1487
|
-
}),
|
|
1440
|
+
}), y;
|
|
1488
1441
|
}
|
|
1489
1442
|
return Z(e.data);
|
|
1490
1443
|
}
|
|
1491
1444
|
}
|
|
1492
1445
|
ue.create = (r) => new ue({
|
|
1493
|
-
typeName:
|
|
1446
|
+
typeName: _.ZodNull,
|
|
1494
1447
|
...v(r)
|
|
1495
1448
|
});
|
|
1496
1449
|
class F extends g {
|
|
@@ -1502,7 +1455,7 @@ class F extends g {
|
|
|
1502
1455
|
}
|
|
1503
1456
|
}
|
|
1504
1457
|
F.create = (r) => new F({
|
|
1505
|
-
typeName:
|
|
1458
|
+
typeName: _.ZodAny,
|
|
1506
1459
|
...v(r)
|
|
1507
1460
|
});
|
|
1508
1461
|
class W extends g {
|
|
@@ -1514,21 +1467,21 @@ class W extends g {
|
|
|
1514
1467
|
}
|
|
1515
1468
|
}
|
|
1516
1469
|
W.create = (r) => new W({
|
|
1517
|
-
typeName:
|
|
1470
|
+
typeName: _.ZodUnknown,
|
|
1518
1471
|
...v(r)
|
|
1519
1472
|
});
|
|
1520
1473
|
class M extends g {
|
|
1521
1474
|
_parse(e) {
|
|
1522
1475
|
const t = this._getOrReturnCtx(e);
|
|
1523
1476
|
return l(t, {
|
|
1524
|
-
code:
|
|
1477
|
+
code: u.invalid_type,
|
|
1525
1478
|
expected: f.never,
|
|
1526
1479
|
received: t.parsedType
|
|
1527
|
-
}),
|
|
1480
|
+
}), y;
|
|
1528
1481
|
}
|
|
1529
1482
|
}
|
|
1530
1483
|
M.create = (r) => new M({
|
|
1531
|
-
typeName:
|
|
1484
|
+
typeName: _.ZodNever,
|
|
1532
1485
|
...v(r)
|
|
1533
1486
|
});
|
|
1534
1487
|
class Se extends g {
|
|
@@ -1536,16 +1489,16 @@ class Se extends g {
|
|
|
1536
1489
|
if (this._getType(e) !== f.undefined) {
|
|
1537
1490
|
const n = this._getOrReturnCtx(e);
|
|
1538
1491
|
return l(n, {
|
|
1539
|
-
code:
|
|
1492
|
+
code: u.invalid_type,
|
|
1540
1493
|
expected: f.void,
|
|
1541
1494
|
received: n.parsedType
|
|
1542
|
-
}),
|
|
1495
|
+
}), y;
|
|
1543
1496
|
}
|
|
1544
1497
|
return Z(e.data);
|
|
1545
1498
|
}
|
|
1546
1499
|
}
|
|
1547
1500
|
Se.create = (r) => new Se({
|
|
1548
|
-
typeName:
|
|
1501
|
+
typeName: _.ZodVoid,
|
|
1549
1502
|
...v(r)
|
|
1550
1503
|
});
|
|
1551
1504
|
class E extends g {
|
|
@@ -1553,14 +1506,14 @@ class E extends g {
|
|
|
1553
1506
|
const { ctx: t, status: n } = this._processInputParams(e), s = this._def;
|
|
1554
1507
|
if (t.parsedType !== f.array)
|
|
1555
1508
|
return l(t, {
|
|
1556
|
-
code:
|
|
1509
|
+
code: u.invalid_type,
|
|
1557
1510
|
expected: f.array,
|
|
1558
1511
|
received: t.parsedType
|
|
1559
|
-
}),
|
|
1512
|
+
}), y;
|
|
1560
1513
|
if (s.exactLength !== null) {
|
|
1561
1514
|
const i = t.data.length > s.exactLength.value, o = t.data.length < s.exactLength.value;
|
|
1562
1515
|
(i || o) && (l(t, {
|
|
1563
|
-
code: i ?
|
|
1516
|
+
code: i ? u.too_big : u.too_small,
|
|
1564
1517
|
minimum: o ? s.exactLength.value : void 0,
|
|
1565
1518
|
maximum: i ? s.exactLength.value : void 0,
|
|
1566
1519
|
type: "array",
|
|
@@ -1570,14 +1523,14 @@ class E extends g {
|
|
|
1570
1523
|
}), n.dirty());
|
|
1571
1524
|
}
|
|
1572
1525
|
if (s.minLength !== null && t.data.length < s.minLength.value && (l(t, {
|
|
1573
|
-
code:
|
|
1526
|
+
code: u.too_small,
|
|
1574
1527
|
minimum: s.minLength.value,
|
|
1575
1528
|
type: "array",
|
|
1576
1529
|
inclusive: !0,
|
|
1577
1530
|
exact: !1,
|
|
1578
1531
|
message: s.minLength.message
|
|
1579
1532
|
}), n.dirty()), s.maxLength !== null && t.data.length > s.maxLength.value && (l(t, {
|
|
1580
|
-
code:
|
|
1533
|
+
code: u.too_big,
|
|
1581
1534
|
maximum: s.maxLength.value,
|
|
1582
1535
|
type: "array",
|
|
1583
1536
|
inclusive: !0,
|
|
@@ -1618,7 +1571,7 @@ E.create = (r, e) => new E({
|
|
|
1618
1571
|
minLength: null,
|
|
1619
1572
|
maxLength: null,
|
|
1620
1573
|
exactLength: null,
|
|
1621
|
-
typeName:
|
|
1574
|
+
typeName: _.ZodArray,
|
|
1622
1575
|
...v(e)
|
|
1623
1576
|
});
|
|
1624
1577
|
function G(r) {
|
|
@@ -1649,47 +1602,47 @@ class b extends g {
|
|
|
1649
1602
|
}
|
|
1650
1603
|
_parse(e) {
|
|
1651
1604
|
if (this._getType(e) !== f.object) {
|
|
1652
|
-
const
|
|
1653
|
-
return l(
|
|
1654
|
-
code:
|
|
1605
|
+
const c = this._getOrReturnCtx(e);
|
|
1606
|
+
return l(c, {
|
|
1607
|
+
code: u.invalid_type,
|
|
1655
1608
|
expected: f.object,
|
|
1656
|
-
received:
|
|
1657
|
-
}),
|
|
1609
|
+
received: c.parsedType
|
|
1610
|
+
}), y;
|
|
1658
1611
|
}
|
|
1659
1612
|
const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
|
|
1660
1613
|
if (!(this._def.catchall instanceof M && this._def.unknownKeys === "strip"))
|
|
1661
|
-
for (const
|
|
1662
|
-
i.includes(
|
|
1663
|
-
const
|
|
1664
|
-
for (const
|
|
1665
|
-
const p = a[
|
|
1666
|
-
|
|
1667
|
-
key: { status: "valid", value:
|
|
1668
|
-
value: p._parse(new R(s, k, s.path,
|
|
1669
|
-
alwaysSet:
|
|
1614
|
+
for (const c in s.data)
|
|
1615
|
+
i.includes(c) || o.push(c);
|
|
1616
|
+
const d = [];
|
|
1617
|
+
for (const c of i) {
|
|
1618
|
+
const p = a[c], k = s.data[c];
|
|
1619
|
+
d.push({
|
|
1620
|
+
key: { status: "valid", value: c },
|
|
1621
|
+
value: p._parse(new R(s, k, s.path, c)),
|
|
1622
|
+
alwaysSet: c in s.data
|
|
1670
1623
|
});
|
|
1671
1624
|
}
|
|
1672
1625
|
if (this._def.catchall instanceof M) {
|
|
1673
|
-
const
|
|
1674
|
-
if (
|
|
1626
|
+
const c = this._def.unknownKeys;
|
|
1627
|
+
if (c === "passthrough")
|
|
1675
1628
|
for (const p of o)
|
|
1676
|
-
|
|
1629
|
+
d.push({
|
|
1677
1630
|
key: { status: "valid", value: p },
|
|
1678
1631
|
value: { status: "valid", value: s.data[p] }
|
|
1679
1632
|
});
|
|
1680
|
-
else if (
|
|
1633
|
+
else if (c === "strict")
|
|
1681
1634
|
o.length > 0 && (l(s, {
|
|
1682
|
-
code:
|
|
1635
|
+
code: u.unrecognized_keys,
|
|
1683
1636
|
keys: o
|
|
1684
1637
|
}), n.dirty());
|
|
1685
|
-
else if (
|
|
1638
|
+
else if (c !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
1686
1639
|
} else {
|
|
1687
|
-
const
|
|
1640
|
+
const c = this._def.catchall;
|
|
1688
1641
|
for (const p of o) {
|
|
1689
1642
|
const k = s.data[p];
|
|
1690
|
-
|
|
1643
|
+
d.push({
|
|
1691
1644
|
key: { status: "valid", value: p },
|
|
1692
|
-
value:
|
|
1645
|
+
value: c._parse(
|
|
1693
1646
|
new R(s, k, s.path, p)
|
|
1694
1647
|
//, ctx.child(key), value, getParsedType(value)
|
|
1695
1648
|
),
|
|
@@ -1698,17 +1651,17 @@ class b extends g {
|
|
|
1698
1651
|
}
|
|
1699
1652
|
}
|
|
1700
1653
|
return s.common.async ? Promise.resolve().then(async () => {
|
|
1701
|
-
const
|
|
1702
|
-
for (const p of
|
|
1654
|
+
const c = [];
|
|
1655
|
+
for (const p of d) {
|
|
1703
1656
|
const k = await p.key, O = await p.value;
|
|
1704
|
-
|
|
1657
|
+
c.push({
|
|
1705
1658
|
key: k,
|
|
1706
1659
|
value: O,
|
|
1707
1660
|
alwaysSet: p.alwaysSet
|
|
1708
1661
|
});
|
|
1709
1662
|
}
|
|
1710
|
-
return
|
|
1711
|
-
}).then((
|
|
1663
|
+
return c;
|
|
1664
|
+
}).then((c) => T.mergeObjectSync(n, c)) : T.mergeObjectSync(n, d);
|
|
1712
1665
|
}
|
|
1713
1666
|
get shape() {
|
|
1714
1667
|
return this._def.shape();
|
|
@@ -1720,11 +1673,11 @@ class b extends g {
|
|
|
1720
1673
|
...e !== void 0 ? {
|
|
1721
1674
|
errorMap: (t, n) => {
|
|
1722
1675
|
var s, a, i, o;
|
|
1723
|
-
const
|
|
1676
|
+
const d = (i = (a = (s = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(s, t, n).message) !== null && i !== void 0 ? i : n.defaultError;
|
|
1724
1677
|
return t.code === "unrecognized_keys" ? {
|
|
1725
|
-
message: (o = m.errToObj(e).message) !== null && o !== void 0 ? o :
|
|
1678
|
+
message: (o = m.errToObj(e).message) !== null && o !== void 0 ? o : d
|
|
1726
1679
|
} : {
|
|
1727
|
-
message:
|
|
1680
|
+
message: d
|
|
1728
1681
|
};
|
|
1729
1682
|
}
|
|
1730
1683
|
} : {}
|
|
@@ -1781,7 +1734,7 @@ class b extends g {
|
|
|
1781
1734
|
...this._def.shape(),
|
|
1782
1735
|
...e._def.shape()
|
|
1783
1736
|
}),
|
|
1784
|
-
typeName:
|
|
1737
|
+
typeName: _.ZodObject
|
|
1785
1738
|
});
|
|
1786
1739
|
}
|
|
1787
1740
|
// merge<
|
|
@@ -1907,21 +1860,21 @@ b.create = (r, e) => new b({
|
|
|
1907
1860
|
shape: () => r,
|
|
1908
1861
|
unknownKeys: "strip",
|
|
1909
1862
|
catchall: M.create(),
|
|
1910
|
-
typeName:
|
|
1863
|
+
typeName: _.ZodObject,
|
|
1911
1864
|
...v(e)
|
|
1912
1865
|
});
|
|
1913
1866
|
b.strictCreate = (r, e) => new b({
|
|
1914
1867
|
shape: () => r,
|
|
1915
1868
|
unknownKeys: "strict",
|
|
1916
1869
|
catchall: M.create(),
|
|
1917
|
-
typeName:
|
|
1870
|
+
typeName: _.ZodObject,
|
|
1918
1871
|
...v(e)
|
|
1919
1872
|
});
|
|
1920
1873
|
b.lazycreate = (r, e) => new b({
|
|
1921
1874
|
shape: r,
|
|
1922
1875
|
unknownKeys: "strip",
|
|
1923
1876
|
catchall: M.create(),
|
|
1924
|
-
typeName:
|
|
1877
|
+
typeName: _.ZodObject,
|
|
1925
1878
|
...v(e)
|
|
1926
1879
|
});
|
|
1927
1880
|
class le extends g {
|
|
@@ -1936,9 +1889,9 @@ class le extends g {
|
|
|
1936
1889
|
return t.common.issues.push(...o.ctx.common.issues), o.result;
|
|
1937
1890
|
const i = a.map((o) => new S(o.ctx.common.issues));
|
|
1938
1891
|
return l(t, {
|
|
1939
|
-
code:
|
|
1892
|
+
code: u.invalid_union,
|
|
1940
1893
|
unionErrors: i
|
|
1941
|
-
}),
|
|
1894
|
+
}), y;
|
|
1942
1895
|
}
|
|
1943
1896
|
if (t.common.async)
|
|
1944
1897
|
return Promise.all(n.map(async (a) => {
|
|
@@ -1962,30 +1915,30 @@ class le extends g {
|
|
|
1962
1915
|
{
|
|
1963
1916
|
let a;
|
|
1964
1917
|
const i = [];
|
|
1965
|
-
for (const
|
|
1966
|
-
const
|
|
1918
|
+
for (const d of n) {
|
|
1919
|
+
const c = {
|
|
1967
1920
|
...t,
|
|
1968
1921
|
common: {
|
|
1969
1922
|
...t.common,
|
|
1970
1923
|
issues: []
|
|
1971
1924
|
},
|
|
1972
1925
|
parent: null
|
|
1973
|
-
}, p =
|
|
1926
|
+
}, p = d._parseSync({
|
|
1974
1927
|
data: t.data,
|
|
1975
1928
|
path: t.path,
|
|
1976
|
-
parent:
|
|
1929
|
+
parent: c
|
|
1977
1930
|
});
|
|
1978
1931
|
if (p.status === "valid")
|
|
1979
1932
|
return p;
|
|
1980
|
-
p.status === "dirty" && !a && (a = { result: p, ctx:
|
|
1933
|
+
p.status === "dirty" && !a && (a = { result: p, ctx: c }), c.common.issues.length && i.push(c.common.issues);
|
|
1981
1934
|
}
|
|
1982
1935
|
if (a)
|
|
1983
1936
|
return t.common.issues.push(...a.ctx.common.issues), a.result;
|
|
1984
|
-
const o = i.map((
|
|
1937
|
+
const o = i.map((d) => new S(d));
|
|
1985
1938
|
return l(t, {
|
|
1986
|
-
code:
|
|
1939
|
+
code: u.invalid_union,
|
|
1987
1940
|
unionErrors: o
|
|
1988
|
-
}),
|
|
1941
|
+
}), y;
|
|
1989
1942
|
}
|
|
1990
1943
|
}
|
|
1991
1944
|
get options() {
|
|
@@ -1994,19 +1947,19 @@ class le extends g {
|
|
|
1994
1947
|
}
|
|
1995
1948
|
le.create = (r, e) => new le({
|
|
1996
1949
|
options: r,
|
|
1997
|
-
typeName:
|
|
1950
|
+
typeName: _.ZodUnion,
|
|
1998
1951
|
...v(e)
|
|
1999
1952
|
});
|
|
2000
|
-
const A = (r) => r instanceof pe ? A(r.schema) : r instanceof C ? A(r.innerType()) : r instanceof me ? [r.value] : r instanceof U ? r.options : r instanceof
|
|
1953
|
+
const A = (r) => r instanceof pe ? A(r.schema) : r instanceof C ? A(r.innerType()) : r instanceof me ? [r.value] : r instanceof U ? r.options : r instanceof _e ? x.objectValues(r.enum) : r instanceof ye ? A(r._def.innerType) : r instanceof ce ? [void 0] : r instanceof ue ? [null] : r instanceof N ? [void 0, ...A(r.unwrap())] : r instanceof z ? [null, ...A(r.unwrap())] : r instanceof He || r instanceof ge ? A(r.unwrap()) : r instanceof ve ? A(r._def.innerType) : [];
|
|
2001
1954
|
class Ce extends g {
|
|
2002
1955
|
_parse(e) {
|
|
2003
1956
|
const { ctx: t } = this._processInputParams(e);
|
|
2004
1957
|
if (t.parsedType !== f.object)
|
|
2005
1958
|
return l(t, {
|
|
2006
|
-
code:
|
|
1959
|
+
code: u.invalid_type,
|
|
2007
1960
|
expected: f.object,
|
|
2008
1961
|
received: t.parsedType
|
|
2009
|
-
}),
|
|
1962
|
+
}), y;
|
|
2010
1963
|
const n = this.discriminator, s = t.data[n], a = this.optionsMap.get(s);
|
|
2011
1964
|
return a ? t.common.async ? a._parseAsync({
|
|
2012
1965
|
data: t.data,
|
|
@@ -2017,10 +1970,10 @@ class Ce extends g {
|
|
|
2017
1970
|
path: t.path,
|
|
2018
1971
|
parent: t
|
|
2019
1972
|
}) : (l(t, {
|
|
2020
|
-
code:
|
|
1973
|
+
code: u.invalid_union_discriminator,
|
|
2021
1974
|
options: Array.from(this.optionsMap.keys()),
|
|
2022
1975
|
path: [n]
|
|
2023
|
-
}),
|
|
1976
|
+
}), y);
|
|
2024
1977
|
}
|
|
2025
1978
|
get discriminator() {
|
|
2026
1979
|
return this._def.discriminator;
|
|
@@ -2052,7 +2005,7 @@ class Ce extends g {
|
|
|
2052
2005
|
}
|
|
2053
2006
|
}
|
|
2054
2007
|
return new Ce({
|
|
2055
|
-
typeName:
|
|
2008
|
+
typeName: _.ZodDiscriminatedUnion,
|
|
2056
2009
|
discriminator: e,
|
|
2057
2010
|
options: t,
|
|
2058
2011
|
optionsMap: s,
|
|
@@ -2067,10 +2020,10 @@ function Je(r, e) {
|
|
|
2067
2020
|
if (t === f.object && n === f.object) {
|
|
2068
2021
|
const s = x.objectKeys(e), a = x.objectKeys(r).filter((o) => s.indexOf(o) !== -1), i = { ...r, ...e };
|
|
2069
2022
|
for (const o of a) {
|
|
2070
|
-
const
|
|
2071
|
-
if (!
|
|
2023
|
+
const d = Je(r[o], e[o]);
|
|
2024
|
+
if (!d.valid)
|
|
2072
2025
|
return { valid: !1 };
|
|
2073
|
-
i[o] =
|
|
2026
|
+
i[o] = d.data;
|
|
2074
2027
|
}
|
|
2075
2028
|
return { valid: !0, data: i };
|
|
2076
2029
|
} else if (t === f.array && n === f.array) {
|
|
@@ -2078,10 +2031,10 @@ function Je(r, e) {
|
|
|
2078
2031
|
return { valid: !1 };
|
|
2079
2032
|
const s = [];
|
|
2080
2033
|
for (let a = 0; a < r.length; a++) {
|
|
2081
|
-
const i = r[a], o = e[a],
|
|
2082
|
-
if (!
|
|
2034
|
+
const i = r[a], o = e[a], d = Je(i, o);
|
|
2035
|
+
if (!d.valid)
|
|
2083
2036
|
return { valid: !1 };
|
|
2084
|
-
s.push(
|
|
2037
|
+
s.push(d.data);
|
|
2085
2038
|
}
|
|
2086
2039
|
return { valid: !0, data: s };
|
|
2087
2040
|
} else return t === f.date && n === f.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
|
|
@@ -2090,11 +2043,11 @@ class fe extends g {
|
|
|
2090
2043
|
_parse(e) {
|
|
2091
2044
|
const { status: t, ctx: n } = this._processInputParams(e), s = (a, i) => {
|
|
2092
2045
|
if (We(a) || We(i))
|
|
2093
|
-
return
|
|
2046
|
+
return y;
|
|
2094
2047
|
const o = Je(a.value, i.value);
|
|
2095
2048
|
return o.valid ? ((qe(a) || qe(i)) && t.dirty(), { status: t.value, value: o.data }) : (l(n, {
|
|
2096
|
-
code:
|
|
2097
|
-
}),
|
|
2049
|
+
code: u.invalid_intersection_types
|
|
2050
|
+
}), y);
|
|
2098
2051
|
};
|
|
2099
2052
|
return n.common.async ? Promise.all([
|
|
2100
2053
|
this._def.left._parseAsync({
|
|
@@ -2121,7 +2074,7 @@ class fe extends g {
|
|
|
2121
2074
|
fe.create = (r, e, t) => new fe({
|
|
2122
2075
|
left: r,
|
|
2123
2076
|
right: e,
|
|
2124
|
-
typeName:
|
|
2077
|
+
typeName: _.ZodIntersection,
|
|
2125
2078
|
...v(t)
|
|
2126
2079
|
});
|
|
2127
2080
|
class I extends g {
|
|
@@ -2129,28 +2082,28 @@ class I extends g {
|
|
|
2129
2082
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2130
2083
|
if (n.parsedType !== f.array)
|
|
2131
2084
|
return l(n, {
|
|
2132
|
-
code:
|
|
2085
|
+
code: u.invalid_type,
|
|
2133
2086
|
expected: f.array,
|
|
2134
2087
|
received: n.parsedType
|
|
2135
|
-
}),
|
|
2088
|
+
}), y;
|
|
2136
2089
|
if (n.data.length < this._def.items.length)
|
|
2137
2090
|
return l(n, {
|
|
2138
|
-
code:
|
|
2091
|
+
code: u.too_small,
|
|
2139
2092
|
minimum: this._def.items.length,
|
|
2140
2093
|
inclusive: !0,
|
|
2141
2094
|
exact: !1,
|
|
2142
2095
|
type: "array"
|
|
2143
|
-
}),
|
|
2096
|
+
}), y;
|
|
2144
2097
|
!this._def.rest && n.data.length > this._def.items.length && (l(n, {
|
|
2145
|
-
code:
|
|
2098
|
+
code: u.too_big,
|
|
2146
2099
|
maximum: this._def.items.length,
|
|
2147
2100
|
inclusive: !0,
|
|
2148
2101
|
exact: !1,
|
|
2149
2102
|
type: "array"
|
|
2150
2103
|
}), t.dirty());
|
|
2151
2104
|
const a = [...n.data].map((i, o) => {
|
|
2152
|
-
const
|
|
2153
|
-
return
|
|
2105
|
+
const d = this._def.items[o] || this._def.rest;
|
|
2106
|
+
return d ? d._parse(new R(n, i, n.path, o)) : null;
|
|
2154
2107
|
}).filter((i) => !!i);
|
|
2155
2108
|
return n.common.async ? Promise.all(a).then((i) => T.mergeArray(t, i)) : T.mergeArray(t, a);
|
|
2156
2109
|
}
|
|
@@ -2169,7 +2122,7 @@ I.create = (r, e) => {
|
|
|
2169
2122
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2170
2123
|
return new I({
|
|
2171
2124
|
items: r,
|
|
2172
|
-
typeName:
|
|
2125
|
+
typeName: _.ZodTuple,
|
|
2173
2126
|
rest: null,
|
|
2174
2127
|
...v(e)
|
|
2175
2128
|
});
|
|
@@ -2185,10 +2138,10 @@ class he extends g {
|
|
|
2185
2138
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2186
2139
|
if (n.parsedType !== f.object)
|
|
2187
2140
|
return l(n, {
|
|
2188
|
-
code:
|
|
2141
|
+
code: u.invalid_type,
|
|
2189
2142
|
expected: f.object,
|
|
2190
2143
|
received: n.parsedType
|
|
2191
|
-
}),
|
|
2144
|
+
}), y;
|
|
2192
2145
|
const s = [], a = this._def.keyType, i = this._def.valueType;
|
|
2193
2146
|
for (const o in n.data)
|
|
2194
2147
|
s.push({
|
|
@@ -2205,12 +2158,12 @@ class he extends g {
|
|
|
2205
2158
|
return t instanceof g ? new he({
|
|
2206
2159
|
keyType: e,
|
|
2207
2160
|
valueType: t,
|
|
2208
|
-
typeName:
|
|
2161
|
+
typeName: _.ZodRecord,
|
|
2209
2162
|
...v(n)
|
|
2210
2163
|
}) : new he({
|
|
2211
2164
|
keyType: j.create(),
|
|
2212
2165
|
valueType: e,
|
|
2213
|
-
typeName:
|
|
2166
|
+
typeName: _.ZodRecord,
|
|
2214
2167
|
...v(t)
|
|
2215
2168
|
});
|
|
2216
2169
|
}
|
|
@@ -2226,32 +2179,32 @@ class Oe extends g {
|
|
|
2226
2179
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2227
2180
|
if (n.parsedType !== f.map)
|
|
2228
2181
|
return l(n, {
|
|
2229
|
-
code:
|
|
2182
|
+
code: u.invalid_type,
|
|
2230
2183
|
expected: f.map,
|
|
2231
2184
|
received: n.parsedType
|
|
2232
|
-
}),
|
|
2233
|
-
const s = this._def.keyType, a = this._def.valueType, i = [...n.data.entries()].map(([o,
|
|
2234
|
-
key: s._parse(new R(n, o, n.path, [
|
|
2235
|
-
value: a._parse(new R(n,
|
|
2185
|
+
}), y;
|
|
2186
|
+
const s = this._def.keyType, a = this._def.valueType, i = [...n.data.entries()].map(([o, d], c) => ({
|
|
2187
|
+
key: s._parse(new R(n, o, n.path, [c, "key"])),
|
|
2188
|
+
value: a._parse(new R(n, d, n.path, [c, "value"]))
|
|
2236
2189
|
}));
|
|
2237
2190
|
if (n.common.async) {
|
|
2238
2191
|
const o = /* @__PURE__ */ new Map();
|
|
2239
2192
|
return Promise.resolve().then(async () => {
|
|
2240
|
-
for (const
|
|
2241
|
-
const
|
|
2242
|
-
if (
|
|
2243
|
-
return
|
|
2244
|
-
(
|
|
2193
|
+
for (const d of i) {
|
|
2194
|
+
const c = await d.key, p = await d.value;
|
|
2195
|
+
if (c.status === "aborted" || p.status === "aborted")
|
|
2196
|
+
return y;
|
|
2197
|
+
(c.status === "dirty" || p.status === "dirty") && t.dirty(), o.set(c.value, p.value);
|
|
2245
2198
|
}
|
|
2246
2199
|
return { status: t.value, value: o };
|
|
2247
2200
|
});
|
|
2248
2201
|
} else {
|
|
2249
2202
|
const o = /* @__PURE__ */ new Map();
|
|
2250
|
-
for (const
|
|
2251
|
-
const
|
|
2252
|
-
if (
|
|
2253
|
-
return
|
|
2254
|
-
(
|
|
2203
|
+
for (const d of i) {
|
|
2204
|
+
const c = d.key, p = d.value;
|
|
2205
|
+
if (c.status === "aborted" || p.status === "aborted")
|
|
2206
|
+
return y;
|
|
2207
|
+
(c.status === "dirty" || p.status === "dirty") && t.dirty(), o.set(c.value, p.value);
|
|
2255
2208
|
}
|
|
2256
2209
|
return { status: t.value, value: o };
|
|
2257
2210
|
}
|
|
@@ -2260,7 +2213,7 @@ class Oe extends g {
|
|
|
2260
2213
|
Oe.create = (r, e, t) => new Oe({
|
|
2261
2214
|
valueType: e,
|
|
2262
2215
|
keyType: r,
|
|
2263
|
-
typeName:
|
|
2216
|
+
typeName: _.ZodMap,
|
|
2264
2217
|
...v(t)
|
|
2265
2218
|
});
|
|
2266
2219
|
class J extends g {
|
|
@@ -2268,20 +2221,20 @@ class J extends g {
|
|
|
2268
2221
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2269
2222
|
if (n.parsedType !== f.set)
|
|
2270
2223
|
return l(n, {
|
|
2271
|
-
code:
|
|
2224
|
+
code: u.invalid_type,
|
|
2272
2225
|
expected: f.set,
|
|
2273
2226
|
received: n.parsedType
|
|
2274
|
-
}),
|
|
2227
|
+
}), y;
|
|
2275
2228
|
const s = this._def;
|
|
2276
2229
|
s.minSize !== null && n.data.size < s.minSize.value && (l(n, {
|
|
2277
|
-
code:
|
|
2230
|
+
code: u.too_small,
|
|
2278
2231
|
minimum: s.minSize.value,
|
|
2279
2232
|
type: "set",
|
|
2280
2233
|
inclusive: !0,
|
|
2281
2234
|
exact: !1,
|
|
2282
2235
|
message: s.minSize.message
|
|
2283
2236
|
}), t.dirty()), s.maxSize !== null && n.data.size > s.maxSize.value && (l(n, {
|
|
2284
|
-
code:
|
|
2237
|
+
code: u.too_big,
|
|
2285
2238
|
maximum: s.maxSize.value,
|
|
2286
2239
|
type: "set",
|
|
2287
2240
|
inclusive: !0,
|
|
@@ -2289,17 +2242,17 @@ class J extends g {
|
|
|
2289
2242
|
message: s.maxSize.message
|
|
2290
2243
|
}), t.dirty());
|
|
2291
2244
|
const a = this._def.valueType;
|
|
2292
|
-
function i(
|
|
2293
|
-
const
|
|
2294
|
-
for (const p of
|
|
2245
|
+
function i(d) {
|
|
2246
|
+
const c = /* @__PURE__ */ new Set();
|
|
2247
|
+
for (const p of d) {
|
|
2295
2248
|
if (p.status === "aborted")
|
|
2296
|
-
return
|
|
2297
|
-
p.status === "dirty" && t.dirty(),
|
|
2249
|
+
return y;
|
|
2250
|
+
p.status === "dirty" && t.dirty(), c.add(p.value);
|
|
2298
2251
|
}
|
|
2299
|
-
return { status: t.value, value:
|
|
2252
|
+
return { status: t.value, value: c };
|
|
2300
2253
|
}
|
|
2301
|
-
const o = [...n.data.values()].map((
|
|
2302
|
-
return n.common.async ? Promise.all(o).then((
|
|
2254
|
+
const o = [...n.data.values()].map((d, c) => a._parse(new R(n, d, n.path, c)));
|
|
2255
|
+
return n.common.async ? Promise.all(o).then((d) => i(d)) : i(o);
|
|
2303
2256
|
}
|
|
2304
2257
|
min(e, t) {
|
|
2305
2258
|
return new J({
|
|
@@ -2324,7 +2277,7 @@ J.create = (r, e) => new J({
|
|
|
2324
2277
|
valueType: r,
|
|
2325
2278
|
minSize: null,
|
|
2326
2279
|
maxSize: null,
|
|
2327
|
-
typeName:
|
|
2280
|
+
typeName: _.ZodSet,
|
|
2328
2281
|
...v(e)
|
|
2329
2282
|
});
|
|
2330
2283
|
class K extends g {
|
|
@@ -2335,11 +2288,11 @@ class K extends g {
|
|
|
2335
2288
|
const { ctx: t } = this._processInputParams(e);
|
|
2336
2289
|
if (t.parsedType !== f.function)
|
|
2337
2290
|
return l(t, {
|
|
2338
|
-
code:
|
|
2291
|
+
code: u.invalid_type,
|
|
2339
2292
|
expected: f.function,
|
|
2340
2293
|
received: t.parsedType
|
|
2341
|
-
}),
|
|
2342
|
-
function n(o,
|
|
2294
|
+
}), y;
|
|
2295
|
+
function n(o, d) {
|
|
2343
2296
|
return we({
|
|
2344
2297
|
data: o,
|
|
2345
2298
|
path: t.path,
|
|
@@ -2348,14 +2301,14 @@ class K extends g {
|
|
|
2348
2301
|
t.schemaErrorMap,
|
|
2349
2302
|
ke(),
|
|
2350
2303
|
Q
|
|
2351
|
-
].filter((
|
|
2304
|
+
].filter((c) => !!c),
|
|
2352
2305
|
issueData: {
|
|
2353
|
-
code:
|
|
2354
|
-
argumentsError:
|
|
2306
|
+
code: u.invalid_arguments,
|
|
2307
|
+
argumentsError: d
|
|
2355
2308
|
}
|
|
2356
2309
|
});
|
|
2357
2310
|
}
|
|
2358
|
-
function s(o,
|
|
2311
|
+
function s(o, d) {
|
|
2359
2312
|
return we({
|
|
2360
2313
|
data: o,
|
|
2361
2314
|
path: t.path,
|
|
@@ -2364,31 +2317,31 @@ class K extends g {
|
|
|
2364
2317
|
t.schemaErrorMap,
|
|
2365
2318
|
ke(),
|
|
2366
2319
|
Q
|
|
2367
|
-
].filter((
|
|
2320
|
+
].filter((c) => !!c),
|
|
2368
2321
|
issueData: {
|
|
2369
|
-
code:
|
|
2370
|
-
returnTypeError:
|
|
2322
|
+
code: u.invalid_return_type,
|
|
2323
|
+
returnTypeError: d
|
|
2371
2324
|
}
|
|
2372
2325
|
});
|
|
2373
2326
|
}
|
|
2374
2327
|
const a = { errorMap: t.common.contextualErrorMap }, i = t.data;
|
|
2375
2328
|
if (this._def.returns instanceof ee) {
|
|
2376
2329
|
const o = this;
|
|
2377
|
-
return Z(async function(...
|
|
2378
|
-
const
|
|
2379
|
-
throw
|
|
2330
|
+
return Z(async function(...d) {
|
|
2331
|
+
const c = new S([]), p = await o._def.args.parseAsync(d, a).catch((w) => {
|
|
2332
|
+
throw c.addIssue(n(d, w)), c;
|
|
2380
2333
|
}), k = await Reflect.apply(i, this, p);
|
|
2381
2334
|
return await o._def.returns._def.type.parseAsync(k, a).catch((w) => {
|
|
2382
|
-
throw
|
|
2335
|
+
throw c.addIssue(s(k, w)), c;
|
|
2383
2336
|
});
|
|
2384
2337
|
});
|
|
2385
2338
|
} else {
|
|
2386
2339
|
const o = this;
|
|
2387
|
-
return Z(function(...
|
|
2388
|
-
const
|
|
2389
|
-
if (!
|
|
2390
|
-
throw new S([n(
|
|
2391
|
-
const p = Reflect.apply(i, this,
|
|
2340
|
+
return Z(function(...d) {
|
|
2341
|
+
const c = o._def.args.safeParse(d, a);
|
|
2342
|
+
if (!c.success)
|
|
2343
|
+
throw new S([n(d, c.error)]);
|
|
2344
|
+
const p = Reflect.apply(i, this, c.data), k = o._def.returns.safeParse(p, a);
|
|
2392
2345
|
if (!k.success)
|
|
2393
2346
|
throw new S([s(p, k.error)]);
|
|
2394
2347
|
return k.data;
|
|
@@ -2423,7 +2376,7 @@ class K extends g {
|
|
|
2423
2376
|
return new K({
|
|
2424
2377
|
args: e || I.create([]).rest(W.create()),
|
|
2425
2378
|
returns: t || W.create(),
|
|
2426
|
-
typeName:
|
|
2379
|
+
typeName: _.ZodFunction,
|
|
2427
2380
|
...v(n)
|
|
2428
2381
|
});
|
|
2429
2382
|
}
|
|
@@ -2439,7 +2392,7 @@ class pe extends g {
|
|
|
2439
2392
|
}
|
|
2440
2393
|
pe.create = (r, e) => new pe({
|
|
2441
2394
|
getter: r,
|
|
2442
|
-
typeName:
|
|
2395
|
+
typeName: _.ZodLazy,
|
|
2443
2396
|
...v(e)
|
|
2444
2397
|
});
|
|
2445
2398
|
class me extends g {
|
|
@@ -2448,9 +2401,9 @@ class me extends g {
|
|
|
2448
2401
|
const t = this._getOrReturnCtx(e);
|
|
2449
2402
|
return l(t, {
|
|
2450
2403
|
received: t.data,
|
|
2451
|
-
code:
|
|
2404
|
+
code: u.invalid_literal,
|
|
2452
2405
|
expected: this._def.value
|
|
2453
|
-
}),
|
|
2406
|
+
}), y;
|
|
2454
2407
|
}
|
|
2455
2408
|
return { status: "valid", value: e.data };
|
|
2456
2409
|
}
|
|
@@ -2460,13 +2413,13 @@ class me extends g {
|
|
|
2460
2413
|
}
|
|
2461
2414
|
me.create = (r, e) => new me({
|
|
2462
2415
|
value: r,
|
|
2463
|
-
typeName:
|
|
2416
|
+
typeName: _.ZodLiteral,
|
|
2464
2417
|
...v(e)
|
|
2465
2418
|
});
|
|
2466
2419
|
function tt(r, e) {
|
|
2467
2420
|
return new U({
|
|
2468
2421
|
values: r,
|
|
2469
|
-
typeName:
|
|
2422
|
+
typeName: _.ZodEnum,
|
|
2470
2423
|
...v(e)
|
|
2471
2424
|
});
|
|
2472
2425
|
}
|
|
@@ -2480,16 +2433,16 @@ class U extends g {
|
|
|
2480
2433
|
return l(t, {
|
|
2481
2434
|
expected: x.joinValues(n),
|
|
2482
2435
|
received: t.parsedType,
|
|
2483
|
-
code:
|
|
2484
|
-
}),
|
|
2436
|
+
code: u.invalid_type
|
|
2437
|
+
}), y;
|
|
2485
2438
|
}
|
|
2486
2439
|
if (Te(this, se) || Ke(this, se, new Set(this._def.values)), !Te(this, se).has(e.data)) {
|
|
2487
2440
|
const t = this._getOrReturnCtx(e), n = this._def.values;
|
|
2488
2441
|
return l(t, {
|
|
2489
2442
|
received: t.data,
|
|
2490
|
-
code:
|
|
2443
|
+
code: u.invalid_enum_value,
|
|
2491
2444
|
options: n
|
|
2492
|
-
}),
|
|
2445
|
+
}), y;
|
|
2493
2446
|
}
|
|
2494
2447
|
return Z(e.data);
|
|
2495
2448
|
}
|
|
@@ -2529,7 +2482,7 @@ class U extends g {
|
|
|
2529
2482
|
}
|
|
2530
2483
|
se = /* @__PURE__ */ new WeakMap();
|
|
2531
2484
|
U.create = tt;
|
|
2532
|
-
class
|
|
2485
|
+
class _e extends g {
|
|
2533
2486
|
constructor() {
|
|
2534
2487
|
super(...arguments), ae.set(this, void 0);
|
|
2535
2488
|
}
|
|
@@ -2540,16 +2493,16 @@ class ye extends g {
|
|
|
2540
2493
|
return l(n, {
|
|
2541
2494
|
expected: x.joinValues(s),
|
|
2542
2495
|
received: n.parsedType,
|
|
2543
|
-
code:
|
|
2544
|
-
}),
|
|
2496
|
+
code: u.invalid_type
|
|
2497
|
+
}), y;
|
|
2545
2498
|
}
|
|
2546
2499
|
if (Te(this, ae) || Ke(this, ae, new Set(x.getValidEnumValues(this._def.values))), !Te(this, ae).has(e.data)) {
|
|
2547
2500
|
const s = x.objectValues(t);
|
|
2548
2501
|
return l(n, {
|
|
2549
2502
|
received: n.data,
|
|
2550
|
-
code:
|
|
2503
|
+
code: u.invalid_enum_value,
|
|
2551
2504
|
options: s
|
|
2552
|
-
}),
|
|
2505
|
+
}), y;
|
|
2553
2506
|
}
|
|
2554
2507
|
return Z(e.data);
|
|
2555
2508
|
}
|
|
@@ -2558,9 +2511,9 @@ class ye extends g {
|
|
|
2558
2511
|
}
|
|
2559
2512
|
}
|
|
2560
2513
|
ae = /* @__PURE__ */ new WeakMap();
|
|
2561
|
-
|
|
2514
|
+
_e.create = (r, e) => new _e({
|
|
2562
2515
|
values: r,
|
|
2563
|
-
typeName:
|
|
2516
|
+
typeName: _.ZodNativeEnum,
|
|
2564
2517
|
...v(e)
|
|
2565
2518
|
});
|
|
2566
2519
|
class ee extends g {
|
|
@@ -2571,10 +2524,10 @@ class ee extends g {
|
|
|
2571
2524
|
const { ctx: t } = this._processInputParams(e);
|
|
2572
2525
|
if (t.parsedType !== f.promise && t.common.async === !1)
|
|
2573
2526
|
return l(t, {
|
|
2574
|
-
code:
|
|
2527
|
+
code: u.invalid_type,
|
|
2575
2528
|
expected: f.promise,
|
|
2576
2529
|
received: t.parsedType
|
|
2577
|
-
}),
|
|
2530
|
+
}), y;
|
|
2578
2531
|
const n = t.parsedType === f.promise ? t.data : Promise.resolve(t.data);
|
|
2579
2532
|
return Z(n.then((s) => this._def.type.parseAsync(s, {
|
|
2580
2533
|
path: t.path,
|
|
@@ -2584,7 +2537,7 @@ class ee extends g {
|
|
|
2584
2537
|
}
|
|
2585
2538
|
ee.create = (r, e) => new ee({
|
|
2586
2539
|
type: r,
|
|
2587
|
-
typeName:
|
|
2540
|
+
typeName: _.ZodPromise,
|
|
2588
2541
|
...v(e)
|
|
2589
2542
|
});
|
|
2590
2543
|
class C extends g {
|
|
@@ -2592,7 +2545,7 @@ class C extends g {
|
|
|
2592
2545
|
return this._def.schema;
|
|
2593
2546
|
}
|
|
2594
2547
|
sourceType() {
|
|
2595
|
-
return this._def.schema._def.typeName ===
|
|
2548
|
+
return this._def.schema._def.typeName === _.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
2596
2549
|
}
|
|
2597
2550
|
_parse(e) {
|
|
2598
2551
|
const { status: t, ctx: n } = this._processInputParams(e), s = this._def.effect || null, a = {
|
|
@@ -2608,31 +2561,31 @@ class C extends g {
|
|
|
2608
2561
|
if (n.common.async)
|
|
2609
2562
|
return Promise.resolve(i).then(async (o) => {
|
|
2610
2563
|
if (t.value === "aborted")
|
|
2611
|
-
return
|
|
2612
|
-
const
|
|
2564
|
+
return y;
|
|
2565
|
+
const d = await this._def.schema._parseAsync({
|
|
2613
2566
|
data: o,
|
|
2614
2567
|
path: n.path,
|
|
2615
2568
|
parent: n
|
|
2616
2569
|
});
|
|
2617
|
-
return
|
|
2570
|
+
return d.status === "aborted" ? y : d.status === "dirty" || t.value === "dirty" ? X(d.value) : d;
|
|
2618
2571
|
});
|
|
2619
2572
|
{
|
|
2620
2573
|
if (t.value === "aborted")
|
|
2621
|
-
return
|
|
2574
|
+
return y;
|
|
2622
2575
|
const o = this._def.schema._parseSync({
|
|
2623
2576
|
data: i,
|
|
2624
2577
|
path: n.path,
|
|
2625
2578
|
parent: n
|
|
2626
2579
|
});
|
|
2627
|
-
return o.status === "aborted" ?
|
|
2580
|
+
return o.status === "aborted" ? y : o.status === "dirty" || t.value === "dirty" ? X(o.value) : o;
|
|
2628
2581
|
}
|
|
2629
2582
|
}
|
|
2630
2583
|
if (s.type === "refinement") {
|
|
2631
2584
|
const i = (o) => {
|
|
2632
|
-
const
|
|
2585
|
+
const d = s.refinement(o, a);
|
|
2633
2586
|
if (n.common.async)
|
|
2634
|
-
return Promise.resolve(
|
|
2635
|
-
if (
|
|
2587
|
+
return Promise.resolve(d);
|
|
2588
|
+
if (d instanceof Promise)
|
|
2636
2589
|
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2637
2590
|
return o;
|
|
2638
2591
|
};
|
|
@@ -2642,9 +2595,9 @@ class C extends g {
|
|
|
2642
2595
|
path: n.path,
|
|
2643
2596
|
parent: n
|
|
2644
2597
|
});
|
|
2645
|
-
return o.status === "aborted" ?
|
|
2598
|
+
return o.status === "aborted" ? y : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
|
|
2646
2599
|
} else
|
|
2647
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => o.status === "aborted" ?
|
|
2600
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => o.status === "aborted" ? y : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
|
|
2648
2601
|
}
|
|
2649
2602
|
if (s.type === "transform")
|
|
2650
2603
|
if (n.common.async === !1) {
|
|
@@ -2666,14 +2619,14 @@ class C extends g {
|
|
|
2666
2619
|
}
|
|
2667
2620
|
C.create = (r, e, t) => new C({
|
|
2668
2621
|
schema: r,
|
|
2669
|
-
typeName:
|
|
2622
|
+
typeName: _.ZodEffects,
|
|
2670
2623
|
effect: e,
|
|
2671
2624
|
...v(t)
|
|
2672
2625
|
});
|
|
2673
2626
|
C.createWithPreprocess = (r, e, t) => new C({
|
|
2674
2627
|
schema: e,
|
|
2675
2628
|
effect: { type: "preprocess", transform: r },
|
|
2676
|
-
typeName:
|
|
2629
|
+
typeName: _.ZodEffects,
|
|
2677
2630
|
...v(t)
|
|
2678
2631
|
});
|
|
2679
2632
|
class N extends g {
|
|
@@ -2686,7 +2639,7 @@ class N extends g {
|
|
|
2686
2639
|
}
|
|
2687
2640
|
N.create = (r, e) => new N({
|
|
2688
2641
|
innerType: r,
|
|
2689
|
-
typeName:
|
|
2642
|
+
typeName: _.ZodOptional,
|
|
2690
2643
|
...v(e)
|
|
2691
2644
|
});
|
|
2692
2645
|
class z extends g {
|
|
@@ -2699,10 +2652,10 @@ class z extends g {
|
|
|
2699
2652
|
}
|
|
2700
2653
|
z.create = (r, e) => new z({
|
|
2701
2654
|
innerType: r,
|
|
2702
|
-
typeName:
|
|
2655
|
+
typeName: _.ZodNullable,
|
|
2703
2656
|
...v(e)
|
|
2704
2657
|
});
|
|
2705
|
-
class
|
|
2658
|
+
class ye extends g {
|
|
2706
2659
|
_parse(e) {
|
|
2707
2660
|
const { ctx: t } = this._processInputParams(e);
|
|
2708
2661
|
let n = t.data;
|
|
@@ -2716,9 +2669,9 @@ class _e extends g {
|
|
|
2716
2669
|
return this._def.innerType;
|
|
2717
2670
|
}
|
|
2718
2671
|
}
|
|
2719
|
-
|
|
2672
|
+
ye.create = (r, e) => new ye({
|
|
2720
2673
|
innerType: r,
|
|
2721
|
-
typeName:
|
|
2674
|
+
typeName: _.ZodDefault,
|
|
2722
2675
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
2723
2676
|
...v(e)
|
|
2724
2677
|
});
|
|
@@ -2761,7 +2714,7 @@ class ve extends g {
|
|
|
2761
2714
|
}
|
|
2762
2715
|
ve.create = (r, e) => new ve({
|
|
2763
2716
|
innerType: r,
|
|
2764
|
-
typeName:
|
|
2717
|
+
typeName: _.ZodCatch,
|
|
2765
2718
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2766
2719
|
...v(e)
|
|
2767
2720
|
});
|
|
@@ -2770,19 +2723,19 @@ class je extends g {
|
|
|
2770
2723
|
if (this._getType(e) !== f.nan) {
|
|
2771
2724
|
const n = this._getOrReturnCtx(e);
|
|
2772
2725
|
return l(n, {
|
|
2773
|
-
code:
|
|
2726
|
+
code: u.invalid_type,
|
|
2774
2727
|
expected: f.nan,
|
|
2775
2728
|
received: n.parsedType
|
|
2776
|
-
}),
|
|
2729
|
+
}), y;
|
|
2777
2730
|
}
|
|
2778
2731
|
return { status: "valid", value: e.data };
|
|
2779
2732
|
}
|
|
2780
2733
|
}
|
|
2781
2734
|
je.create = (r) => new je({
|
|
2782
|
-
typeName:
|
|
2735
|
+
typeName: _.ZodNaN,
|
|
2783
2736
|
...v(r)
|
|
2784
2737
|
});
|
|
2785
|
-
const
|
|
2738
|
+
const Rt = Symbol("zod_brand");
|
|
2786
2739
|
class He extends g {
|
|
2787
2740
|
_parse(e) {
|
|
2788
2741
|
const { ctx: t } = this._processInputParams(e), n = t.data;
|
|
@@ -2806,7 +2759,7 @@ class xe extends g {
|
|
|
2806
2759
|
path: n.path,
|
|
2807
2760
|
parent: n
|
|
2808
2761
|
});
|
|
2809
|
-
return a.status === "aborted" ?
|
|
2762
|
+
return a.status === "aborted" ? y : a.status === "dirty" ? (t.dirty(), X(a.value)) : this._def.out._parseAsync({
|
|
2810
2763
|
data: a.value,
|
|
2811
2764
|
path: n.path,
|
|
2812
2765
|
parent: n
|
|
@@ -2818,7 +2771,7 @@ class xe extends g {
|
|
|
2818
2771
|
path: n.path,
|
|
2819
2772
|
parent: n
|
|
2820
2773
|
});
|
|
2821
|
-
return s.status === "aborted" ?
|
|
2774
|
+
return s.status === "aborted" ? y : s.status === "dirty" ? (t.dirty(), {
|
|
2822
2775
|
status: "dirty",
|
|
2823
2776
|
value: s.value
|
|
2824
2777
|
}) : this._def.out._parseSync({
|
|
@@ -2832,7 +2785,7 @@ class xe extends g {
|
|
|
2832
2785
|
return new xe({
|
|
2833
2786
|
in: e,
|
|
2834
2787
|
out: t,
|
|
2835
|
-
typeName:
|
|
2788
|
+
typeName: _.ZodPipeline
|
|
2836
2789
|
});
|
|
2837
2790
|
}
|
|
2838
2791
|
}
|
|
@@ -2847,28 +2800,28 @@ class ge extends g {
|
|
|
2847
2800
|
}
|
|
2848
2801
|
ge.create = (r, e) => new ge({
|
|
2849
2802
|
innerType: r,
|
|
2850
|
-
typeName:
|
|
2803
|
+
typeName: _.ZodReadonly,
|
|
2851
2804
|
...v(e)
|
|
2852
2805
|
});
|
|
2853
2806
|
function rt(r, e = {}, t) {
|
|
2854
2807
|
return r ? F.create().superRefine((n, s) => {
|
|
2855
2808
|
var a, i;
|
|
2856
2809
|
if (!r(n)) {
|
|
2857
|
-
const o = typeof e == "function" ? e(n) : typeof e == "string" ? { message: e } : e,
|
|
2858
|
-
s.addIssue({ code: "custom", ...
|
|
2810
|
+
const o = typeof e == "function" ? e(n) : typeof e == "string" ? { message: e } : e, d = (i = (a = o.fatal) !== null && a !== void 0 ? a : t) !== null && i !== void 0 ? i : !0, c = typeof o == "string" ? { message: o } : o;
|
|
2811
|
+
s.addIssue({ code: "custom", ...c, fatal: d });
|
|
2859
2812
|
}
|
|
2860
2813
|
}) : F.create();
|
|
2861
2814
|
}
|
|
2862
|
-
const
|
|
2815
|
+
const It = {
|
|
2863
2816
|
object: b.lazycreate
|
|
2864
2817
|
};
|
|
2865
|
-
var
|
|
2818
|
+
var _;
|
|
2866
2819
|
(function(r) {
|
|
2867
2820
|
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";
|
|
2868
|
-
})(
|
|
2869
|
-
const
|
|
2821
|
+
})(_ || (_ = {}));
|
|
2822
|
+
const At = (r, e = {
|
|
2870
2823
|
message: `Input not instance of ${r.name}`
|
|
2871
|
-
}) => rt((t) => t instanceof r, e), nt = j.create, st = V.create,
|
|
2824
|
+
}) => rt((t) => t instanceof r, e), nt = j.create, st = V.create, Mt = je.create, Pt = L.create, at = de.create, $t = q.create, Dt = Ze.create, Vt = ce.create, Lt = ue.create, Ut = F.create, zt = W.create, Bt = M.create, Wt = Se.create, qt = E.create, Jt = b.create, Ht = b.strictCreate, Yt = le.create, Gt = Ce.create, Xt = fe.create, Kt = I.create, Qt = he.create, Ft = Oe.create, er = J.create, tr = K.create, rr = pe.create, nr = me.create, sr = U.create, ar = _e.create, ir = ee.create, Ge = C.create, or = N.create, dr = z.create, cr = C.createWithPreprocess, ur = xe.create, lr = () => nt().optional(), fr = () => st().optional(), hr = () => at().optional(), pr = {
|
|
2872
2825
|
string: (r) => j.create({ ...r, coerce: !0 }),
|
|
2873
2826
|
number: (r) => V.create({ ...r, coerce: !0 }),
|
|
2874
2827
|
boolean: (r) => de.create({
|
|
@@ -2877,17 +2830,17 @@ const Lt = (r, e = {
|
|
|
2877
2830
|
}),
|
|
2878
2831
|
bigint: (r) => L.create({ ...r, coerce: !0 }),
|
|
2879
2832
|
date: (r) => q.create({ ...r, coerce: !0 })
|
|
2880
|
-
},
|
|
2833
|
+
}, mr = y;
|
|
2881
2834
|
var h = /* @__PURE__ */ Object.freeze({
|
|
2882
2835
|
__proto__: null,
|
|
2883
2836
|
defaultErrorMap: Q,
|
|
2884
|
-
setErrorMap:
|
|
2837
|
+
setErrorMap: mt,
|
|
2885
2838
|
getErrorMap: ke,
|
|
2886
2839
|
makeIssue: we,
|
|
2887
|
-
EMPTY_PATH:
|
|
2840
|
+
EMPTY_PATH: _t,
|
|
2888
2841
|
addIssueToContext: l,
|
|
2889
2842
|
ParseStatus: T,
|
|
2890
|
-
INVALID:
|
|
2843
|
+
INVALID: y,
|
|
2891
2844
|
DIRTY: X,
|
|
2892
2845
|
OK: Z,
|
|
2893
2846
|
isAborted: We,
|
|
@@ -2929,90 +2882,137 @@ var h = /* @__PURE__ */ Object.freeze({
|
|
|
2929
2882
|
ZodLazy: pe,
|
|
2930
2883
|
ZodLiteral: me,
|
|
2931
2884
|
ZodEnum: U,
|
|
2932
|
-
ZodNativeEnum:
|
|
2885
|
+
ZodNativeEnum: _e,
|
|
2933
2886
|
ZodPromise: ee,
|
|
2934
2887
|
ZodEffects: C,
|
|
2935
2888
|
ZodTransformer: C,
|
|
2936
2889
|
ZodOptional: N,
|
|
2937
2890
|
ZodNullable: z,
|
|
2938
|
-
ZodDefault:
|
|
2891
|
+
ZodDefault: ye,
|
|
2939
2892
|
ZodCatch: ve,
|
|
2940
2893
|
ZodNaN: je,
|
|
2941
|
-
BRAND:
|
|
2894
|
+
BRAND: Rt,
|
|
2942
2895
|
ZodBranded: He,
|
|
2943
2896
|
ZodPipeline: xe,
|
|
2944
2897
|
ZodReadonly: ge,
|
|
2945
2898
|
custom: rt,
|
|
2946
2899
|
Schema: g,
|
|
2947
2900
|
ZodSchema: g,
|
|
2948
|
-
late:
|
|
2901
|
+
late: It,
|
|
2949
2902
|
get ZodFirstPartyTypeKind() {
|
|
2950
|
-
return
|
|
2903
|
+
return _;
|
|
2951
2904
|
},
|
|
2952
|
-
coerce:
|
|
2953
|
-
any:
|
|
2954
|
-
array:
|
|
2955
|
-
bigint:
|
|
2905
|
+
coerce: pr,
|
|
2906
|
+
any: Ut,
|
|
2907
|
+
array: qt,
|
|
2908
|
+
bigint: Pt,
|
|
2956
2909
|
boolean: at,
|
|
2957
|
-
date:
|
|
2958
|
-
discriminatedUnion:
|
|
2910
|
+
date: $t,
|
|
2911
|
+
discriminatedUnion: Gt,
|
|
2959
2912
|
effect: Ge,
|
|
2960
|
-
enum:
|
|
2961
|
-
function:
|
|
2962
|
-
instanceof:
|
|
2963
|
-
intersection:
|
|
2964
|
-
lazy:
|
|
2965
|
-
literal:
|
|
2966
|
-
map:
|
|
2967
|
-
nan:
|
|
2968
|
-
nativeEnum:
|
|
2969
|
-
never:
|
|
2970
|
-
null:
|
|
2971
|
-
nullable:
|
|
2913
|
+
enum: sr,
|
|
2914
|
+
function: tr,
|
|
2915
|
+
instanceof: At,
|
|
2916
|
+
intersection: Xt,
|
|
2917
|
+
lazy: rr,
|
|
2918
|
+
literal: nr,
|
|
2919
|
+
map: Ft,
|
|
2920
|
+
nan: Mt,
|
|
2921
|
+
nativeEnum: ar,
|
|
2922
|
+
never: Bt,
|
|
2923
|
+
null: Lt,
|
|
2924
|
+
nullable: dr,
|
|
2972
2925
|
number: st,
|
|
2973
|
-
object:
|
|
2974
|
-
oboolean:
|
|
2975
|
-
onumber:
|
|
2976
|
-
optional:
|
|
2977
|
-
ostring:
|
|
2978
|
-
pipeline:
|
|
2979
|
-
preprocess:
|
|
2980
|
-
promise:
|
|
2981
|
-
record:
|
|
2982
|
-
set:
|
|
2983
|
-
strictObject:
|
|
2926
|
+
object: Jt,
|
|
2927
|
+
oboolean: hr,
|
|
2928
|
+
onumber: fr,
|
|
2929
|
+
optional: or,
|
|
2930
|
+
ostring: lr,
|
|
2931
|
+
pipeline: ur,
|
|
2932
|
+
preprocess: cr,
|
|
2933
|
+
promise: ir,
|
|
2934
|
+
record: Qt,
|
|
2935
|
+
set: er,
|
|
2936
|
+
strictObject: Ht,
|
|
2984
2937
|
string: nt,
|
|
2985
|
-
symbol:
|
|
2938
|
+
symbol: Dt,
|
|
2986
2939
|
transformer: Ge,
|
|
2987
|
-
tuple:
|
|
2988
|
-
undefined:
|
|
2989
|
-
union:
|
|
2990
|
-
unknown:
|
|
2991
|
-
void:
|
|
2992
|
-
NEVER:
|
|
2993
|
-
ZodIssueCode:
|
|
2994
|
-
quotelessJson:
|
|
2940
|
+
tuple: Kt,
|
|
2941
|
+
undefined: Vt,
|
|
2942
|
+
union: Yt,
|
|
2943
|
+
unknown: zt,
|
|
2944
|
+
void: Wt,
|
|
2945
|
+
NEVER: mr,
|
|
2946
|
+
ZodIssueCode: u,
|
|
2947
|
+
quotelessJson: pt,
|
|
2995
2948
|
ZodError: S
|
|
2996
2949
|
});
|
|
2997
|
-
|
|
2998
|
-
const
|
|
2950
|
+
ht(h);
|
|
2951
|
+
const _r = (r, e) => e.skipDedupe || e.method !== "GET", yr = (r, e) => e.method + "@" + r, vr = (r) => r.clone(), gr = ({ skip: r = _r, key: e = yr, resolver: t = vr } = {}) => {
|
|
2952
|
+
const n = /* @__PURE__ */ new Map();
|
|
2953
|
+
return (s) => (a, i) => {
|
|
2954
|
+
if (r(a, i))
|
|
2955
|
+
return s(a, i);
|
|
2956
|
+
const o = e(a, i);
|
|
2957
|
+
if (!n.has(o))
|
|
2958
|
+
n.set(o, []);
|
|
2959
|
+
else
|
|
2960
|
+
return new Promise((d, c) => {
|
|
2961
|
+
n.get(o).push([d, c]);
|
|
2962
|
+
});
|
|
2963
|
+
try {
|
|
2964
|
+
return s(a, i).then((d) => (n.get(o).forEach(([c]) => c(t(d))), n.delete(o), d)).catch((d) => {
|
|
2965
|
+
throw n.get(o).forEach(([, c]) => c(d)), n.delete(o), d;
|
|
2966
|
+
});
|
|
2967
|
+
} catch (d) {
|
|
2968
|
+
return n.delete(o), Promise.reject(d);
|
|
2969
|
+
}
|
|
2970
|
+
};
|
|
2971
|
+
}, xr = (r, e) => r * e, br = (r) => r && r.ok, kr = ({ delayTimer: r = 500, delayRamp: e = xr, maxAttempts: t = 10, until: n = br, onRetry: s = null, retryOnNetworkError: a = !1, resolveWithLatestResponse: i = !1, skip: o } = {}) => (d) => (c, p) => {
|
|
2972
|
+
let k = 0;
|
|
2973
|
+
if (o && o(c, p))
|
|
2974
|
+
return d(c, p);
|
|
2975
|
+
const O = (w, P) => Promise.resolve(n(w, P)).then((Ne) => Ne ? w && i ? w : P ? Promise.reject(P) : w : (k++, !t || k <= t ? new Promise(($) => {
|
|
2976
|
+
const be = e(r, k);
|
|
2977
|
+
setTimeout(() => {
|
|
2978
|
+
typeof s == "function" ? Promise.resolve(s({
|
|
2979
|
+
response: w,
|
|
2980
|
+
error: P,
|
|
2981
|
+
url: c,
|
|
2982
|
+
options: p
|
|
2983
|
+
})).then((B = {}) => {
|
|
2984
|
+
var te, re;
|
|
2985
|
+
$(d((te = B && B.url) !== null && te !== void 0 ? te : c, (re = B && B.options) !== null && re !== void 0 ? re : p));
|
|
2986
|
+
}) : $(d(c, p));
|
|
2987
|
+
}, be);
|
|
2988
|
+
}).then(O).catch(($) => {
|
|
2989
|
+
if (!a)
|
|
2990
|
+
throw $;
|
|
2991
|
+
return O(null, $);
|
|
2992
|
+
}) : w && i ? w : Promise.reject(P || new Error("Number of attempts exceeded."))));
|
|
2993
|
+
return d(c, p).then(O).catch((w) => {
|
|
2994
|
+
if (!a)
|
|
2995
|
+
throw w;
|
|
2996
|
+
return O(null, w);
|
|
2997
|
+
});
|
|
2998
|
+
}, Ee = h.object({
|
|
2999
2999
|
code: h.number(),
|
|
3000
3000
|
message: h.string()
|
|
3001
|
-
}), kr = h.object({
|
|
3002
|
-
message: h.string()
|
|
3003
3001
|
}), wr = h.object({
|
|
3002
|
+
message: h.string()
|
|
3003
|
+
}), Tr = h.object({
|
|
3004
3004
|
emails: h.array(h.string()).optional(),
|
|
3005
|
-
http_body: h.string(),
|
|
3006
|
-
http_url: h.string(),
|
|
3005
|
+
http_body: h.string().optional(),
|
|
3006
|
+
http_url: h.string().optional(),
|
|
3007
3007
|
txt_name: h.string().optional(),
|
|
3008
3008
|
txt_value: h.string().optional()
|
|
3009
|
-
}), Tr = h.object({
|
|
3010
|
-
ciphers: h.array(h.string()),
|
|
3011
|
-
early_hints: h.string(),
|
|
3012
|
-
http2: h.string(),
|
|
3013
|
-
min_tls_version: h.string(),
|
|
3014
|
-
tls_1_3: h.string()
|
|
3015
3009
|
}), Zr = h.object({
|
|
3010
|
+
ciphers: h.array(h.string()).optional(),
|
|
3011
|
+
early_hints: h.string().optional(),
|
|
3012
|
+
http2: h.string().optional(),
|
|
3013
|
+
min_tls_version: h.string(),
|
|
3014
|
+
tls_1_3: h.string().optional()
|
|
3015
|
+
}), Sr = h.object({
|
|
3016
3016
|
id: h.string(),
|
|
3017
3017
|
bundle_method: h.string().optional(),
|
|
3018
3018
|
certificate_authority: h.string(),
|
|
@@ -3024,29 +3024,29 @@ const Ee = h.object({
|
|
|
3024
3024
|
issuer: h.string().optional(),
|
|
3025
3025
|
method: h.string(),
|
|
3026
3026
|
serial_number: h.string().optional(),
|
|
3027
|
-
settings:
|
|
3027
|
+
settings: Zr.optional(),
|
|
3028
3028
|
signature: h.string().optional(),
|
|
3029
3029
|
type: h.string(),
|
|
3030
3030
|
uploaded_on: h.string().optional(),
|
|
3031
|
-
validation_errors: h.array(
|
|
3032
|
-
validation_records: h.array(
|
|
3031
|
+
validation_errors: h.array(wr).optional(),
|
|
3032
|
+
validation_records: h.array(Tr).optional(),
|
|
3033
3033
|
wildcard: h.boolean()
|
|
3034
|
-
}),
|
|
3034
|
+
}), Or = h.object({
|
|
3035
3035
|
name: h.string(),
|
|
3036
3036
|
type: h.string(),
|
|
3037
3037
|
value: h.string()
|
|
3038
|
-
}),
|
|
3039
|
-
http_body: h.string(),
|
|
3040
|
-
http_url: h.string()
|
|
3038
|
+
}), jr = h.object({
|
|
3039
|
+
http_body: h.string().optional(),
|
|
3040
|
+
http_url: h.string().optional()
|
|
3041
3041
|
}), it = h.object({
|
|
3042
3042
|
id: h.string(),
|
|
3043
|
-
ssl:
|
|
3043
|
+
ssl: Sr,
|
|
3044
3044
|
hostname: h.string(),
|
|
3045
3045
|
custom_metadata: h.record(h.string()).optional(),
|
|
3046
3046
|
custom_origin_server: h.string().optional(),
|
|
3047
3047
|
custom_origin_sni: h.string().optional(),
|
|
3048
|
-
ownership_verification:
|
|
3049
|
-
ownership_verification_http:
|
|
3048
|
+
ownership_verification: Or,
|
|
3049
|
+
ownership_verification_http: jr,
|
|
3050
3050
|
status: h.string(),
|
|
3051
3051
|
verification_errors: h.array(h.string()).optional(),
|
|
3052
3052
|
created_at: h.string()
|
|
@@ -3055,29 +3055,45 @@ const Ee = h.object({
|
|
|
3055
3055
|
messages: h.array(Ee),
|
|
3056
3056
|
success: h.boolean(),
|
|
3057
3057
|
result: it
|
|
3058
|
-
}),
|
|
3058
|
+
}), Er = h.object({
|
|
3059
3059
|
errors: h.array(Ee),
|
|
3060
3060
|
messages: h.array(Ee),
|
|
3061
3061
|
success: h.boolean(),
|
|
3062
3062
|
result: h.array(it)
|
|
3063
3063
|
});
|
|
3064
3064
|
function Y(r) {
|
|
3065
|
-
return
|
|
3065
|
+
return ut(`https://api.cloudflare.com/client/v4/zones/${r.zoneId}`).headers({
|
|
3066
3066
|
"X-Auth-Email": r.authEmail,
|
|
3067
3067
|
"X-Auth-Key": r.authKey,
|
|
3068
3068
|
"Content-Type": "application/json"
|
|
3069
|
-
}).middlewares([
|
|
3069
|
+
}).middlewares([kr(), gr()]);
|
|
3070
3070
|
}
|
|
3071
3071
|
function ze(r) {
|
|
3072
|
+
var t;
|
|
3073
|
+
const e = [
|
|
3074
|
+
...((t = r.ssl.validation_records) == null ? void 0 : t.map((n) => ({
|
|
3075
|
+
name: "txt",
|
|
3076
|
+
record: n.txt_value,
|
|
3077
|
+
domain: n.txt_name
|
|
3078
|
+
}))) || [],
|
|
3079
|
+
{
|
|
3080
|
+
name: "txt",
|
|
3081
|
+
record: r.ownership_verification.value,
|
|
3082
|
+
domain: r.ownership_verification.name
|
|
3083
|
+
}
|
|
3084
|
+
];
|
|
3072
3085
|
return {
|
|
3073
3086
|
custom_domain_id: r.id,
|
|
3074
3087
|
domain: r.hostname,
|
|
3075
3088
|
primary: r.primary,
|
|
3076
3089
|
status: r.status === "active" ? "ready" : "pending",
|
|
3077
|
-
type: "auth0_managed_certs"
|
|
3090
|
+
type: "auth0_managed_certs",
|
|
3091
|
+
verification: {
|
|
3092
|
+
methods: h.array(ct).parse(e)
|
|
3093
|
+
}
|
|
3078
3094
|
};
|
|
3079
3095
|
}
|
|
3080
|
-
function
|
|
3096
|
+
function Cr(r) {
|
|
3081
3097
|
return {
|
|
3082
3098
|
create: async (e, t) => {
|
|
3083
3099
|
const { result: n, errors: s, success: a } = Ue.parse(
|
|
@@ -3085,7 +3101,7 @@ function Er(r) {
|
|
|
3085
3101
|
{
|
|
3086
3102
|
hostname: t.domain,
|
|
3087
3103
|
ssl: {
|
|
3088
|
-
method: "
|
|
3104
|
+
method: "txt",
|
|
3089
3105
|
type: "dv"
|
|
3090
3106
|
},
|
|
3091
3107
|
custom_metadata: r.enterprise ? {
|
|
@@ -3108,38 +3124,41 @@ function Er(r) {
|
|
|
3108
3124
|
}), i;
|
|
3109
3125
|
},
|
|
3110
3126
|
get: async (e, t) => {
|
|
3111
|
-
var
|
|
3127
|
+
var d;
|
|
3112
3128
|
const n = await r.customDomainAdapter.get(
|
|
3113
3129
|
e,
|
|
3114
3130
|
t
|
|
3115
3131
|
);
|
|
3116
3132
|
if (!n)
|
|
3117
3133
|
throw new H(404);
|
|
3118
|
-
const { result:
|
|
3119
|
-
|
|
3120
|
-
);
|
|
3121
|
-
if (!i)
|
|
3134
|
+
const s = await Y(r).get(`/custom_hostnames/${encodeURIComponent(t)}`).json(), { result: a, errors: i, success: o } = Ue.parse(s);
|
|
3135
|
+
if (!o)
|
|
3122
3136
|
throw new H(503, {
|
|
3123
|
-
message: JSON.stringify(
|
|
3137
|
+
message: JSON.stringify(i)
|
|
3124
3138
|
});
|
|
3125
|
-
if (r.enterprise && ((
|
|
3139
|
+
if (r.enterprise && ((d = a.custom_metadata) == null ? void 0 : d.tenant_id) !== e)
|
|
3126
3140
|
throw new H(404);
|
|
3127
|
-
return ze({ ...n, ...
|
|
3141
|
+
return ze({ ...n, ...a });
|
|
3128
3142
|
},
|
|
3129
3143
|
list: async (e) => {
|
|
3130
|
-
const { result:
|
|
3131
|
-
|
|
3132
|
-
);
|
|
3133
|
-
if (!s)
|
|
3144
|
+
const t = await r.customDomainAdapter.list(e), n = await Y(r).get("/custom_hostnames").json(), { result: s, errors: a, success: i } = Er.parse(n);
|
|
3145
|
+
if (!i)
|
|
3134
3146
|
throw new H(503, {
|
|
3135
|
-
message: JSON.stringify(
|
|
3147
|
+
message: JSON.stringify(a)
|
|
3136
3148
|
});
|
|
3137
|
-
return
|
|
3138
|
-
(
|
|
3139
|
-
|
|
3140
|
-
|
|
3149
|
+
return s.filter(
|
|
3150
|
+
(o) => t.find((d) => d.custom_domain_id === o.id)
|
|
3151
|
+
).filter(
|
|
3152
|
+
(o) => {
|
|
3153
|
+
var d;
|
|
3154
|
+
return !(r.enterprise && ((d = o.custom_metadata) == null ? void 0 : d.tenant_id) !== e);
|
|
3141
3155
|
}
|
|
3142
|
-
).map(
|
|
3156
|
+
).map(
|
|
3157
|
+
(o) => ze({
|
|
3158
|
+
...t.find((d) => d.custom_domain_id === o.id),
|
|
3159
|
+
...o
|
|
3160
|
+
})
|
|
3161
|
+
);
|
|
3143
3162
|
},
|
|
3144
3163
|
remove: async (e, t) => {
|
|
3145
3164
|
var s;
|
|
@@ -3170,11 +3189,11 @@ function Er(r) {
|
|
|
3170
3189
|
}
|
|
3171
3190
|
};
|
|
3172
3191
|
}
|
|
3173
|
-
function
|
|
3192
|
+
function Ar(r) {
|
|
3174
3193
|
return {
|
|
3175
|
-
customDomains:
|
|
3194
|
+
customDomains: Cr(r)
|
|
3176
3195
|
};
|
|
3177
3196
|
}
|
|
3178
3197
|
export {
|
|
3179
|
-
|
|
3198
|
+
Ar as default
|
|
3180
3199
|
};
|