@authhero/cloudflare-adapter 1.25.0 → 1.26.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 +49 -0
- package/dist/cloudflare-adapter.mjs +387 -319
- package/package.json +4 -4
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var dt = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var Ve = (r, e, t) =>
|
|
4
|
-
import { verificationMethodsSchema as
|
|
5
|
-
import
|
|
6
|
-
function
|
|
2
|
+
var ut = (r, e, t) => e in r ? dt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var Ve = (r, e, t) => ut(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { verificationMethodsSchema as lt } from "@authhero/adapter-interfaces";
|
|
5
|
+
import ft from "wretch";
|
|
6
|
+
function ht(r, e) {
|
|
7
7
|
var t = {};
|
|
8
8
|
for (var n in r) Object.prototype.hasOwnProperty.call(r, n) && e.indexOf(n) < 0 && (t[n] = r[n]);
|
|
9
9
|
if (r != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -11,7 +11,7 @@ function ft(r, e) {
|
|
|
11
11
|
e.indexOf(n[s]) < 0 && Object.prototype.propertyIsEnumerable.call(r, n[s]) && (t[n[s]] = r[n[s]]);
|
|
12
12
|
return t;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function pt(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
|
}
|
|
@@ -22,24 +22,24 @@ function se(r, e) {
|
|
|
22
22
|
return s._def.openapi = this._def.openapi, s;
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function mt(r) {
|
|
26
26
|
if (typeof r.ZodType.prototype.openapi < "u")
|
|
27
27
|
return;
|
|
28
28
|
r.ZodType.prototype.openapi = function(s, a) {
|
|
29
|
-
var i, o,
|
|
30
|
-
const
|
|
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),
|
|
29
|
+
var i, o, c, d, p, b;
|
|
30
|
+
const S = typeof s == "string" ? a : s, w = S ?? {}, { param: M } = w, Ee = ht(w, ["param"]), D = 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), Ee), !((d = (c = this._def.openapi) === null || c === void 0 ? void 0 : c.metadata) === null || d === void 0) && d.param || M ? {
|
|
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), M)
|
|
32
32
|
} : void 0), B = new this.constructor(Object.assign(Object.assign({}, this._def), { openapi: Object.assign(Object.assign({}, Object.keys(D).length > 0 ? { _internal: D } : void 0), Object.keys(be).length > 0 ? { metadata: be } : void 0) }));
|
|
33
|
-
if (
|
|
33
|
+
if (pt(this, "ZodObject")) {
|
|
34
34
|
const re = this.extend;
|
|
35
35
|
B.extend = function(...ne) {
|
|
36
|
-
var Re, Ne, Ie, $e,
|
|
36
|
+
var Re, Ne, Ie, $e, Pe, Me;
|
|
37
37
|
const De = re.apply(this, ne);
|
|
38
38
|
return De._def.openapi = {
|
|
39
39
|
_internal: {
|
|
40
|
-
extendedFrom: !((Ne = (Re = this._def.openapi) === null || Re === void 0 ? void 0 : Re._internal) === null || Ne === void 0) && Ne.refId ? { refId: ($e = (Ie = this._def.openapi) === null || Ie === void 0 ? void 0 : Ie._internal) === null || $e === void 0 ? void 0 : $e.refId, schema: this } : (
|
|
40
|
+
extendedFrom: !((Ne = (Re = this._def.openapi) === null || Re === void 0 ? void 0 : Re._internal) === null || Ne === void 0) && Ne.refId ? { refId: ($e = (Ie = this._def.openapi) === null || Ie === void 0 ? void 0 : Ie._internal) === null || $e === void 0 ? void 0 : $e.refId, schema: this } : (Pe = this._def.openapi) === null || Pe === void 0 ? void 0 : Pe._internal.extendedFrom
|
|
41
41
|
},
|
|
42
|
-
metadata: (
|
|
42
|
+
metadata: (Me = De._def.openapi) === null || Me === void 0 ? void 0 : Me.metadata
|
|
43
43
|
}, De;
|
|
44
44
|
};
|
|
45
45
|
}
|
|
@@ -48,9 +48,9 @@ function pt(r) {
|
|
|
48
48
|
const e = r.ZodObject.prototype.deepPartial;
|
|
49
49
|
r.ZodObject.prototype.deepPartial = function() {
|
|
50
50
|
const s = this._def.shape(), a = e.apply(this), i = a._def.shape();
|
|
51
|
-
return Object.entries(i).forEach(([o,
|
|
52
|
-
var
|
|
53
|
-
|
|
51
|
+
return Object.entries(i).forEach(([o, c]) => {
|
|
52
|
+
var d, p;
|
|
53
|
+
c._def.openapi = (p = (d = s[o]) === null || d === void 0 ? void 0 : d._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;
|
|
@@ -184,8 +184,8 @@ const f = x.arrayToEnum([
|
|
|
184
184
|
"invalid_intersection_types",
|
|
185
185
|
"not_multiple_of",
|
|
186
186
|
"not_finite"
|
|
187
|
-
]),
|
|
188
|
-
class
|
|
187
|
+
]), _t = (r) => JSON.stringify(r, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
188
|
+
class O extends Error {
|
|
189
189
|
get errors() {
|
|
190
190
|
return this.issues;
|
|
191
191
|
}
|
|
@@ -212,17 +212,17 @@ class S extends Error {
|
|
|
212
212
|
else if (i.path.length === 0)
|
|
213
213
|
n._errors.push(t(i));
|
|
214
214
|
else {
|
|
215
|
-
let o = n,
|
|
216
|
-
for (;
|
|
217
|
-
const
|
|
218
|
-
|
|
215
|
+
let o = n, c = 0;
|
|
216
|
+
for (; c < i.path.length; ) {
|
|
217
|
+
const d = i.path[c];
|
|
218
|
+
c === i.path.length - 1 ? (o[d] = o[d] || { _errors: [] }, o[d]._errors.push(t(i))) : o[d] = o[d] || { _errors: [] }, o = o[d], c++;
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
};
|
|
222
222
|
return s(this), n;
|
|
223
223
|
}
|
|
224
224
|
static assert(e) {
|
|
225
|
-
if (!(e instanceof
|
|
225
|
+
if (!(e instanceof O))
|
|
226
226
|
throw new Error(`Not a ZodError: ${e}`);
|
|
227
227
|
}
|
|
228
228
|
toString() {
|
|
@@ -244,7 +244,7 @@ class S extends Error {
|
|
|
244
244
|
return this.flatten();
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
|
-
|
|
247
|
+
O.create = (r) => new O(r);
|
|
248
248
|
const Q = (r, e) => {
|
|
249
249
|
let t;
|
|
250
250
|
switch (r.code) {
|
|
@@ -301,12 +301,12 @@ const Q = (r, e) => {
|
|
|
301
301
|
}
|
|
302
302
|
return { message: t };
|
|
303
303
|
};
|
|
304
|
-
let
|
|
305
|
-
function
|
|
306
|
-
|
|
304
|
+
let Ke = Q;
|
|
305
|
+
function yt(r) {
|
|
306
|
+
Ke = r;
|
|
307
307
|
}
|
|
308
308
|
function ke() {
|
|
309
|
-
return
|
|
309
|
+
return Ke;
|
|
310
310
|
}
|
|
311
311
|
const we = (r) => {
|
|
312
312
|
const { data: e, path: t, errorMaps: n, issueData: s } = r, a = [...t, ...s.path || []], i = {
|
|
@@ -320,15 +320,15 @@ const we = (r) => {
|
|
|
320
320
|
message: s.message
|
|
321
321
|
};
|
|
322
322
|
let o = "";
|
|
323
|
-
const
|
|
324
|
-
for (const
|
|
325
|
-
o =
|
|
323
|
+
const c = n.filter((d) => !!d).slice().reverse();
|
|
324
|
+
for (const d of c)
|
|
325
|
+
o = d(i, { data: e, defaultError: o }).message;
|
|
326
326
|
return {
|
|
327
327
|
...s,
|
|
328
328
|
path: a,
|
|
329
329
|
message: o
|
|
330
330
|
};
|
|
331
|
-
},
|
|
331
|
+
}, vt = [];
|
|
332
332
|
function l(r, e) {
|
|
333
333
|
const t = ke(), n = we({
|
|
334
334
|
issueData: e,
|
|
@@ -390,12 +390,12 @@ class T {
|
|
|
390
390
|
}
|
|
391
391
|
const y = Object.freeze({
|
|
392
392
|
status: "aborted"
|
|
393
|
-
}),
|
|
393
|
+
}), K = (r) => ({ status: "dirty", value: r }), Z = (r) => ({ status: "valid", value: r }), Fe = (r) => r.status === "aborted", qe = (r) => r.status === "dirty", q = (r) => r.status === "valid", oe = (r) => typeof Promise < "u" && r instanceof Promise;
|
|
394
394
|
function Te(r, e, t, n) {
|
|
395
395
|
if (typeof e == "function" ? r !== e || !n : !e.has(r)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
396
396
|
return e.get(r);
|
|
397
397
|
}
|
|
398
|
-
function
|
|
398
|
+
function Xe(r, e, t, n, s) {
|
|
399
399
|
if (typeof e == "function" ? r !== e || !s : !e.has(r)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
400
400
|
return e.set(r, t), t;
|
|
401
401
|
}
|
|
@@ -413,7 +413,7 @@ class R {
|
|
|
413
413
|
}
|
|
414
414
|
}
|
|
415
415
|
const He = (r, e) => {
|
|
416
|
-
if (
|
|
416
|
+
if (q(e))
|
|
417
417
|
return { success: !0, data: e.value };
|
|
418
418
|
if (!r.common.issues.length)
|
|
419
419
|
throw new Error("Validation failed but no issues detected.");
|
|
@@ -422,7 +422,7 @@ const He = (r, e) => {
|
|
|
422
422
|
get error() {
|
|
423
423
|
if (this._error)
|
|
424
424
|
return this._error;
|
|
425
|
-
const t = new
|
|
425
|
+
const t = new O(r.common.issues);
|
|
426
426
|
return this._error = t, this._error;
|
|
427
427
|
}
|
|
428
428
|
};
|
|
@@ -434,9 +434,9 @@ function v(r) {
|
|
|
434
434
|
if (e && (t || n))
|
|
435
435
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
436
436
|
return e ? { errorMap: e, description: s } : { errorMap: (i, o) => {
|
|
437
|
-
var
|
|
437
|
+
var c, d;
|
|
438
438
|
const { message: p } = r;
|
|
439
|
-
return i.code === "invalid_enum_value" ? { message: p ?? o.defaultError } : typeof o.data > "u" ? { message: (
|
|
439
|
+
return i.code === "invalid_enum_value" ? { message: p ?? o.defaultError } : typeof o.data > "u" ? { message: (c = p ?? n) !== null && c !== void 0 ? c : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (d = p ?? t) !== null && d !== void 0 ? d : o.defaultError };
|
|
440
440
|
}, description: s };
|
|
441
441
|
}
|
|
442
442
|
class g {
|
|
@@ -517,7 +517,7 @@ class g {
|
|
|
517
517
|
if (!this["~standard"].async)
|
|
518
518
|
try {
|
|
519
519
|
const a = this._parseSync({ data: e, path: [], parent: s });
|
|
520
|
-
return
|
|
520
|
+
return q(a) ? {
|
|
521
521
|
value: a.value
|
|
522
522
|
} : {
|
|
523
523
|
issues: s.common.issues
|
|
@@ -528,7 +528,7 @@ class g {
|
|
|
528
528
|
async: !0
|
|
529
529
|
};
|
|
530
530
|
}
|
|
531
|
-
return this._parseAsync({ data: e, path: [], parent: s }).then((a) =>
|
|
531
|
+
return this._parseAsync({ data: e, path: [], parent: s }).then((a) => q(a) ? {
|
|
532
532
|
value: a.value
|
|
533
533
|
} : {
|
|
534
534
|
issues: s.common.issues
|
|
@@ -562,7 +562,7 @@ class g {
|
|
|
562
562
|
code: u.custom,
|
|
563
563
|
...n(s)
|
|
564
564
|
});
|
|
565
|
-
return typeof Promise < "u" && i instanceof Promise ? i.then((
|
|
565
|
+
return typeof Promise < "u" && i instanceof Promise ? i.then((c) => c ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
|
|
566
566
|
});
|
|
567
567
|
}
|
|
568
568
|
refinement(e, t) {
|
|
@@ -595,7 +595,7 @@ class g {
|
|
|
595
595
|
return this.nullable().optional();
|
|
596
596
|
}
|
|
597
597
|
array() {
|
|
598
|
-
return
|
|
598
|
+
return j.create(this);
|
|
599
599
|
}
|
|
600
600
|
promise() {
|
|
601
601
|
return te.create(this, this._def);
|
|
@@ -659,16 +659,16 @@ class g {
|
|
|
659
659
|
return this.safeParse(null).success;
|
|
660
660
|
}
|
|
661
661
|
}
|
|
662
|
-
const
|
|
662
|
+
const gt = /^c[^\s-]{8,}$/i, xt = /^[0-9a-z]+$/, bt = /^[0-9A-HJKMNP-TV-Z]{26}$/i, kt = /^[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, wt = /^[a-z0-9_-]{21}$/i, Tt = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Zt = /^[-+]?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)?)??$/, St = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Ot = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
663
663
|
let Le;
|
|
664
|
-
const
|
|
664
|
+
const Ct = /^(?:(?: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])$/, jt = /^(?:(?: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]))$/, Et = /^(([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}(=)?))?$/, 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])))", It = new RegExp(`^${Qe}$`);
|
|
665
665
|
function et(r) {
|
|
666
666
|
let e = "[0-5]\\d";
|
|
667
667
|
r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`);
|
|
668
668
|
const t = r.precision ? "+" : "?";
|
|
669
669
|
return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`;
|
|
670
670
|
}
|
|
671
|
-
function
|
|
671
|
+
function $t(r) {
|
|
672
672
|
return new RegExp(`^${et(r)}$`);
|
|
673
673
|
}
|
|
674
674
|
function tt(r) {
|
|
@@ -676,11 +676,11 @@ function tt(r) {
|
|
|
676
676
|
const t = [];
|
|
677
677
|
return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
678
678
|
}
|
|
679
|
-
function
|
|
680
|
-
return !!((e === "v4" || !e) &&
|
|
679
|
+
function Pt(r, e) {
|
|
680
|
+
return !!((e === "v4" || !e) && Ct.test(r) || (e === "v6" || !e) && At.test(r));
|
|
681
681
|
}
|
|
682
682
|
function Mt(r, e) {
|
|
683
|
-
if (!
|
|
683
|
+
if (!Tt.test(r))
|
|
684
684
|
return !1;
|
|
685
685
|
try {
|
|
686
686
|
const [t] = r.split("."), n = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), s = JSON.parse(atob(n));
|
|
@@ -689,10 +689,10 @@ function Mt(r, e) {
|
|
|
689
689
|
return !1;
|
|
690
690
|
}
|
|
691
691
|
}
|
|
692
|
-
function
|
|
693
|
-
return !!((e === "v4" || !e) && jt.test(r) || (e === "v6" || !e) &&
|
|
692
|
+
function Dt(r, e) {
|
|
693
|
+
return !!((e === "v4" || !e) && jt.test(r) || (e === "v6" || !e) && Et.test(r));
|
|
694
694
|
}
|
|
695
|
-
class
|
|
695
|
+
class C extends g {
|
|
696
696
|
_parse(e) {
|
|
697
697
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== f.string) {
|
|
698
698
|
const a = this._getOrReturnCtx(e);
|
|
@@ -741,7 +741,7 @@ class j extends g {
|
|
|
741
741
|
message: a.message
|
|
742
742
|
}), n.dirty());
|
|
743
743
|
} else if (a.kind === "email")
|
|
744
|
-
|
|
744
|
+
St.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
745
745
|
validation: "email",
|
|
746
746
|
code: u.invalid_string,
|
|
747
747
|
message: a.message
|
|
@@ -753,31 +753,31 @@ class j extends g {
|
|
|
753
753
|
message: a.message
|
|
754
754
|
}), n.dirty());
|
|
755
755
|
else if (a.kind === "uuid")
|
|
756
|
-
|
|
756
|
+
kt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
757
757
|
validation: "uuid",
|
|
758
758
|
code: u.invalid_string,
|
|
759
759
|
message: a.message
|
|
760
760
|
}), n.dirty());
|
|
761
761
|
else if (a.kind === "nanoid")
|
|
762
|
-
|
|
762
|
+
wt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
763
763
|
validation: "nanoid",
|
|
764
764
|
code: u.invalid_string,
|
|
765
765
|
message: a.message
|
|
766
766
|
}), n.dirty());
|
|
767
767
|
else if (a.kind === "cuid")
|
|
768
|
-
|
|
768
|
+
gt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
769
769
|
validation: "cuid",
|
|
770
770
|
code: u.invalid_string,
|
|
771
771
|
message: a.message
|
|
772
772
|
}), n.dirty());
|
|
773
773
|
else if (a.kind === "cuid2")
|
|
774
|
-
|
|
774
|
+
xt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
775
775
|
validation: "cuid2",
|
|
776
776
|
code: u.invalid_string,
|
|
777
777
|
message: a.message
|
|
778
778
|
}), n.dirty());
|
|
779
779
|
else if (a.kind === "ulid")
|
|
780
|
-
|
|
780
|
+
bt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
781
781
|
validation: "ulid",
|
|
782
782
|
code: u.invalid_string,
|
|
783
783
|
message: a.message
|
|
@@ -812,19 +812,19 @@ class j extends g {
|
|
|
812
812
|
code: u.invalid_string,
|
|
813
813
|
validation: "datetime",
|
|
814
814
|
message: a.message
|
|
815
|
-
}), n.dirty()) : a.kind === "date" ?
|
|
815
|
+
}), n.dirty()) : a.kind === "date" ? It.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
816
816
|
code: u.invalid_string,
|
|
817
817
|
validation: "date",
|
|
818
818
|
message: a.message
|
|
819
|
-
}), n.dirty()) : a.kind === "time" ?
|
|
819
|
+
}), n.dirty()) : a.kind === "time" ? $t(a).test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
820
820
|
code: u.invalid_string,
|
|
821
821
|
validation: "time",
|
|
822
822
|
message: a.message
|
|
823
|
-
}), n.dirty()) : a.kind === "duration" ?
|
|
823
|
+
}), n.dirty()) : a.kind === "duration" ? Zt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
824
824
|
validation: "duration",
|
|
825
825
|
code: u.invalid_string,
|
|
826
826
|
message: a.message
|
|
827
|
-
}), n.dirty()) : a.kind === "ip" ?
|
|
827
|
+
}), n.dirty()) : a.kind === "ip" ? Pt(e.data, a.version) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
828
828
|
validation: "ip",
|
|
829
829
|
code: u.invalid_string,
|
|
830
830
|
message: a.message
|
|
@@ -832,15 +832,15 @@ class j extends g {
|
|
|
832
832
|
validation: "jwt",
|
|
833
833
|
code: u.invalid_string,
|
|
834
834
|
message: a.message
|
|
835
|
-
}), n.dirty()) : a.kind === "cidr" ?
|
|
835
|
+
}), n.dirty()) : a.kind === "cidr" ? Dt(e.data, a.version) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
836
836
|
validation: "cidr",
|
|
837
837
|
code: u.invalid_string,
|
|
838
838
|
message: a.message
|
|
839
|
-
}), n.dirty()) : a.kind === "base64" ?
|
|
839
|
+
}), n.dirty()) : a.kind === "base64" ? Rt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
840
840
|
validation: "base64",
|
|
841
841
|
code: u.invalid_string,
|
|
842
842
|
message: a.message
|
|
843
|
-
}), n.dirty()) : a.kind === "base64url" ?
|
|
843
|
+
}), n.dirty()) : a.kind === "base64url" ? Nt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
844
844
|
validation: "base64url",
|
|
845
845
|
code: u.invalid_string,
|
|
846
846
|
message: a.message
|
|
@@ -855,7 +855,7 @@ class j extends g {
|
|
|
855
855
|
});
|
|
856
856
|
}
|
|
857
857
|
_addCheck(e) {
|
|
858
|
-
return new
|
|
858
|
+
return new C({
|
|
859
859
|
...this._def,
|
|
860
860
|
checks: [...this._def.checks, e]
|
|
861
861
|
});
|
|
@@ -992,19 +992,19 @@ class j extends g {
|
|
|
992
992
|
return this.min(1, m.errToObj(e));
|
|
993
993
|
}
|
|
994
994
|
trim() {
|
|
995
|
-
return new
|
|
995
|
+
return new C({
|
|
996
996
|
...this._def,
|
|
997
997
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
998
998
|
});
|
|
999
999
|
}
|
|
1000
1000
|
toLowerCase() {
|
|
1001
|
-
return new
|
|
1001
|
+
return new C({
|
|
1002
1002
|
...this._def,
|
|
1003
1003
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
1004
1004
|
});
|
|
1005
1005
|
}
|
|
1006
1006
|
toUpperCase() {
|
|
1007
|
-
return new
|
|
1007
|
+
return new C({
|
|
1008
1008
|
...this._def,
|
|
1009
1009
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
1010
1010
|
});
|
|
@@ -1070,16 +1070,16 @@ class j extends g {
|
|
|
1070
1070
|
return e;
|
|
1071
1071
|
}
|
|
1072
1072
|
}
|
|
1073
|
-
|
|
1073
|
+
C.create = (r) => {
|
|
1074
1074
|
var e;
|
|
1075
|
-
return new
|
|
1075
|
+
return new C({
|
|
1076
1076
|
checks: [],
|
|
1077
1077
|
typeName: _.ZodString,
|
|
1078
1078
|
coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
|
|
1079
1079
|
...v(r)
|
|
1080
1080
|
});
|
|
1081
1081
|
};
|
|
1082
|
-
function
|
|
1082
|
+
function Vt(r, e) {
|
|
1083
1083
|
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(".", ""));
|
|
1084
1084
|
return a % i / Math.pow(10, s);
|
|
1085
1085
|
}
|
|
@@ -1118,7 +1118,7 @@ class V extends g {
|
|
|
1118
1118
|
inclusive: a.inclusive,
|
|
1119
1119
|
exact: !1,
|
|
1120
1120
|
message: a.message
|
|
1121
|
-
}), s.dirty()) : a.kind === "multipleOf" ?
|
|
1121
|
+
}), s.dirty()) : a.kind === "multipleOf" ? Vt(e.data, a.value) !== 0 && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1122
1122
|
code: u.not_multiple_of,
|
|
1123
1123
|
multipleOf: a.value,
|
|
1124
1124
|
message: a.message
|
|
@@ -1391,7 +1391,7 @@ L.create = (r) => {
|
|
|
1391
1391
|
...v(r)
|
|
1392
1392
|
});
|
|
1393
1393
|
};
|
|
1394
|
-
class
|
|
1394
|
+
class ce extends g {
|
|
1395
1395
|
_parse(e) {
|
|
1396
1396
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== f.boolean) {
|
|
1397
1397
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1404,12 +1404,12 @@ class de extends g {
|
|
|
1404
1404
|
return Z(e.data);
|
|
1405
1405
|
}
|
|
1406
1406
|
}
|
|
1407
|
-
|
|
1407
|
+
ce.create = (r) => new ce({
|
|
1408
1408
|
typeName: _.ZodBoolean,
|
|
1409
1409
|
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1410
1410
|
...v(r)
|
|
1411
1411
|
});
|
|
1412
|
-
class
|
|
1412
|
+
class W extends g {
|
|
1413
1413
|
_parse(e) {
|
|
1414
1414
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== f.date) {
|
|
1415
1415
|
const a = this._getOrReturnCtx(e);
|
|
@@ -1449,7 +1449,7 @@ class q extends g {
|
|
|
1449
1449
|
};
|
|
1450
1450
|
}
|
|
1451
1451
|
_addCheck(e) {
|
|
1452
|
-
return new
|
|
1452
|
+
return new W({
|
|
1453
1453
|
...this._def,
|
|
1454
1454
|
checks: [...this._def.checks, e]
|
|
1455
1455
|
});
|
|
@@ -1481,7 +1481,7 @@ class q extends g {
|
|
|
1481
1481
|
return e != null ? new Date(e) : null;
|
|
1482
1482
|
}
|
|
1483
1483
|
}
|
|
1484
|
-
|
|
1484
|
+
W.create = (r) => new W({
|
|
1485
1485
|
checks: [],
|
|
1486
1486
|
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1487
1487
|
typeName: _.ZodDate,
|
|
@@ -1504,7 +1504,7 @@ Ze.create = (r) => new Ze({
|
|
|
1504
1504
|
typeName: _.ZodSymbol,
|
|
1505
1505
|
...v(r)
|
|
1506
1506
|
});
|
|
1507
|
-
class
|
|
1507
|
+
class de extends g {
|
|
1508
1508
|
_parse(e) {
|
|
1509
1509
|
if (this._getType(e) !== f.undefined) {
|
|
1510
1510
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1517,7 +1517,7 @@ class ce extends g {
|
|
|
1517
1517
|
return Z(e.data);
|
|
1518
1518
|
}
|
|
1519
1519
|
}
|
|
1520
|
-
|
|
1520
|
+
de.create = (r) => new de({
|
|
1521
1521
|
typeName: _.ZodUndefined,
|
|
1522
1522
|
...v(r)
|
|
1523
1523
|
});
|
|
@@ -1562,7 +1562,7 @@ F.create = (r) => new F({
|
|
|
1562
1562
|
typeName: _.ZodUnknown,
|
|
1563
1563
|
...v(r)
|
|
1564
1564
|
});
|
|
1565
|
-
class
|
|
1565
|
+
class P extends g {
|
|
1566
1566
|
_parse(e) {
|
|
1567
1567
|
const t = this._getOrReturnCtx(e);
|
|
1568
1568
|
return l(t, {
|
|
@@ -1572,11 +1572,11 @@ class M extends g {
|
|
|
1572
1572
|
}), y;
|
|
1573
1573
|
}
|
|
1574
1574
|
}
|
|
1575
|
-
|
|
1575
|
+
P.create = (r) => new P({
|
|
1576
1576
|
typeName: _.ZodNever,
|
|
1577
1577
|
...v(r)
|
|
1578
1578
|
});
|
|
1579
|
-
class
|
|
1579
|
+
class Se extends g {
|
|
1580
1580
|
_parse(e) {
|
|
1581
1581
|
if (this._getType(e) !== f.undefined) {
|
|
1582
1582
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1589,11 +1589,11 @@ class Oe extends g {
|
|
|
1589
1589
|
return Z(e.data);
|
|
1590
1590
|
}
|
|
1591
1591
|
}
|
|
1592
|
-
|
|
1592
|
+
Se.create = (r) => new Se({
|
|
1593
1593
|
typeName: _.ZodVoid,
|
|
1594
1594
|
...v(r)
|
|
1595
1595
|
});
|
|
1596
|
-
class
|
|
1596
|
+
class j extends g {
|
|
1597
1597
|
_parse(e) {
|
|
1598
1598
|
const { ctx: t, status: n } = this._processInputParams(e), s = this._def;
|
|
1599
1599
|
if (t.parsedType !== f.array)
|
|
@@ -1637,19 +1637,19 @@ class C extends g {
|
|
|
1637
1637
|
return this._def.type;
|
|
1638
1638
|
}
|
|
1639
1639
|
min(e, t) {
|
|
1640
|
-
return new
|
|
1640
|
+
return new j({
|
|
1641
1641
|
...this._def,
|
|
1642
1642
|
minLength: { value: e, message: m.toString(t) }
|
|
1643
1643
|
});
|
|
1644
1644
|
}
|
|
1645
1645
|
max(e, t) {
|
|
1646
|
-
return new
|
|
1646
|
+
return new j({
|
|
1647
1647
|
...this._def,
|
|
1648
1648
|
maxLength: { value: e, message: m.toString(t) }
|
|
1649
1649
|
});
|
|
1650
1650
|
}
|
|
1651
1651
|
length(e, t) {
|
|
1652
|
-
return new
|
|
1652
|
+
return new j({
|
|
1653
1653
|
...this._def,
|
|
1654
1654
|
exactLength: { value: e, message: m.toString(t) }
|
|
1655
1655
|
});
|
|
@@ -1658,7 +1658,7 @@ class C extends g {
|
|
|
1658
1658
|
return this.min(1, e);
|
|
1659
1659
|
}
|
|
1660
1660
|
}
|
|
1661
|
-
|
|
1661
|
+
j.create = (r, e) => new j({
|
|
1662
1662
|
type: r,
|
|
1663
1663
|
minLength: null,
|
|
1664
1664
|
maxLength: null,
|
|
@@ -1677,7 +1677,7 @@ function G(r) {
|
|
|
1677
1677
|
...r._def,
|
|
1678
1678
|
shape: () => e
|
|
1679
1679
|
});
|
|
1680
|
-
} else return r instanceof
|
|
1680
|
+
} else return r instanceof j ? new j({
|
|
1681
1681
|
...r._def,
|
|
1682
1682
|
type: G(r.element)
|
|
1683
1683
|
}) : r instanceof E ? E.create(G(r.unwrap())) : r instanceof U ? U.create(G(r.unwrap())) : r instanceof N ? N.create(r.items.map((e) => G(e))) : r;
|
|
@@ -1694,47 +1694,47 @@ class k extends g {
|
|
|
1694
1694
|
}
|
|
1695
1695
|
_parse(e) {
|
|
1696
1696
|
if (this._getType(e) !== f.object) {
|
|
1697
|
-
const
|
|
1698
|
-
return l(
|
|
1697
|
+
const d = this._getOrReturnCtx(e);
|
|
1698
|
+
return l(d, {
|
|
1699
1699
|
code: u.invalid_type,
|
|
1700
1700
|
expected: f.object,
|
|
1701
|
-
received:
|
|
1701
|
+
received: d.parsedType
|
|
1702
1702
|
}), y;
|
|
1703
1703
|
}
|
|
1704
1704
|
const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
|
|
1705
|
-
if (!(this._def.catchall instanceof
|
|
1706
|
-
for (const
|
|
1707
|
-
i.includes(
|
|
1708
|
-
const
|
|
1709
|
-
for (const
|
|
1710
|
-
const p = a[
|
|
1711
|
-
|
|
1712
|
-
key: { status: "valid", value:
|
|
1713
|
-
value: p._parse(new R(s, b, s.path,
|
|
1714
|
-
alwaysSet:
|
|
1705
|
+
if (!(this._def.catchall instanceof P && this._def.unknownKeys === "strip"))
|
|
1706
|
+
for (const d in s.data)
|
|
1707
|
+
i.includes(d) || o.push(d);
|
|
1708
|
+
const c = [];
|
|
1709
|
+
for (const d of i) {
|
|
1710
|
+
const p = a[d], b = s.data[d];
|
|
1711
|
+
c.push({
|
|
1712
|
+
key: { status: "valid", value: d },
|
|
1713
|
+
value: p._parse(new R(s, b, s.path, d)),
|
|
1714
|
+
alwaysSet: d in s.data
|
|
1715
1715
|
});
|
|
1716
1716
|
}
|
|
1717
|
-
if (this._def.catchall instanceof
|
|
1718
|
-
const
|
|
1719
|
-
if (
|
|
1717
|
+
if (this._def.catchall instanceof P) {
|
|
1718
|
+
const d = this._def.unknownKeys;
|
|
1719
|
+
if (d === "passthrough")
|
|
1720
1720
|
for (const p of o)
|
|
1721
|
-
|
|
1721
|
+
c.push({
|
|
1722
1722
|
key: { status: "valid", value: p },
|
|
1723
1723
|
value: { status: "valid", value: s.data[p] }
|
|
1724
1724
|
});
|
|
1725
|
-
else if (
|
|
1725
|
+
else if (d === "strict")
|
|
1726
1726
|
o.length > 0 && (l(s, {
|
|
1727
1727
|
code: u.unrecognized_keys,
|
|
1728
1728
|
keys: o
|
|
1729
1729
|
}), n.dirty());
|
|
1730
|
-
else if (
|
|
1730
|
+
else if (d !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
1731
1731
|
} else {
|
|
1732
|
-
const
|
|
1732
|
+
const d = this._def.catchall;
|
|
1733
1733
|
for (const p of o) {
|
|
1734
1734
|
const b = s.data[p];
|
|
1735
|
-
|
|
1735
|
+
c.push({
|
|
1736
1736
|
key: { status: "valid", value: p },
|
|
1737
|
-
value:
|
|
1737
|
+
value: d._parse(
|
|
1738
1738
|
new R(s, b, s.path, p)
|
|
1739
1739
|
//, ctx.child(key), value, getParsedType(value)
|
|
1740
1740
|
),
|
|
@@ -1743,17 +1743,17 @@ class k extends g {
|
|
|
1743
1743
|
}
|
|
1744
1744
|
}
|
|
1745
1745
|
return s.common.async ? Promise.resolve().then(async () => {
|
|
1746
|
-
const
|
|
1747
|
-
for (const p of
|
|
1748
|
-
const b = await p.key,
|
|
1749
|
-
|
|
1746
|
+
const d = [];
|
|
1747
|
+
for (const p of c) {
|
|
1748
|
+
const b = await p.key, S = await p.value;
|
|
1749
|
+
d.push({
|
|
1750
1750
|
key: b,
|
|
1751
|
-
value:
|
|
1751
|
+
value: S,
|
|
1752
1752
|
alwaysSet: p.alwaysSet
|
|
1753
1753
|
});
|
|
1754
1754
|
}
|
|
1755
|
-
return
|
|
1756
|
-
}).then((
|
|
1755
|
+
return d;
|
|
1756
|
+
}).then((d) => T.mergeObjectSync(n, d)) : T.mergeObjectSync(n, c);
|
|
1757
1757
|
}
|
|
1758
1758
|
get shape() {
|
|
1759
1759
|
return this._def.shape();
|
|
@@ -1765,11 +1765,11 @@ class k extends g {
|
|
|
1765
1765
|
...e !== void 0 ? {
|
|
1766
1766
|
errorMap: (t, n) => {
|
|
1767
1767
|
var s, a, i, o;
|
|
1768
|
-
const
|
|
1768
|
+
const c = (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;
|
|
1769
1769
|
return t.code === "unrecognized_keys" ? {
|
|
1770
|
-
message: (o = m.errToObj(e).message) !== null && o !== void 0 ? o :
|
|
1770
|
+
message: (o = m.errToObj(e).message) !== null && o !== void 0 ? o : c
|
|
1771
1771
|
} : {
|
|
1772
|
-
message:
|
|
1772
|
+
message: c
|
|
1773
1773
|
};
|
|
1774
1774
|
}
|
|
1775
1775
|
} : {}
|
|
@@ -1951,21 +1951,21 @@ class k extends g {
|
|
|
1951
1951
|
k.create = (r, e) => new k({
|
|
1952
1952
|
shape: () => r,
|
|
1953
1953
|
unknownKeys: "strip",
|
|
1954
|
-
catchall:
|
|
1954
|
+
catchall: P.create(),
|
|
1955
1955
|
typeName: _.ZodObject,
|
|
1956
1956
|
...v(e)
|
|
1957
1957
|
});
|
|
1958
1958
|
k.strictCreate = (r, e) => new k({
|
|
1959
1959
|
shape: () => r,
|
|
1960
1960
|
unknownKeys: "strict",
|
|
1961
|
-
catchall:
|
|
1961
|
+
catchall: P.create(),
|
|
1962
1962
|
typeName: _.ZodObject,
|
|
1963
1963
|
...v(e)
|
|
1964
1964
|
});
|
|
1965
1965
|
k.lazycreate = (r, e) => new k({
|
|
1966
1966
|
shape: r,
|
|
1967
1967
|
unknownKeys: "strip",
|
|
1968
|
-
catchall:
|
|
1968
|
+
catchall: P.create(),
|
|
1969
1969
|
typeName: _.ZodObject,
|
|
1970
1970
|
...v(e)
|
|
1971
1971
|
});
|
|
@@ -1979,7 +1979,7 @@ class le extends g {
|
|
|
1979
1979
|
for (const o of a)
|
|
1980
1980
|
if (o.result.status === "dirty")
|
|
1981
1981
|
return t.common.issues.push(...o.ctx.common.issues), o.result;
|
|
1982
|
-
const i = a.map((o) => new
|
|
1982
|
+
const i = a.map((o) => new O(o.ctx.common.issues));
|
|
1983
1983
|
return l(t, {
|
|
1984
1984
|
code: u.invalid_union,
|
|
1985
1985
|
unionErrors: i
|
|
@@ -2007,26 +2007,26 @@ class le extends g {
|
|
|
2007
2007
|
{
|
|
2008
2008
|
let a;
|
|
2009
2009
|
const i = [];
|
|
2010
|
-
for (const
|
|
2011
|
-
const
|
|
2010
|
+
for (const c of n) {
|
|
2011
|
+
const d = {
|
|
2012
2012
|
...t,
|
|
2013
2013
|
common: {
|
|
2014
2014
|
...t.common,
|
|
2015
2015
|
issues: []
|
|
2016
2016
|
},
|
|
2017
2017
|
parent: null
|
|
2018
|
-
}, p =
|
|
2018
|
+
}, p = c._parseSync({
|
|
2019
2019
|
data: t.data,
|
|
2020
2020
|
path: t.path,
|
|
2021
|
-
parent:
|
|
2021
|
+
parent: d
|
|
2022
2022
|
});
|
|
2023
2023
|
if (p.status === "valid")
|
|
2024
2024
|
return p;
|
|
2025
|
-
p.status === "dirty" && !a && (a = { result: p, ctx:
|
|
2025
|
+
p.status === "dirty" && !a && (a = { result: p, ctx: d }), d.common.issues.length && i.push(d.common.issues);
|
|
2026
2026
|
}
|
|
2027
2027
|
if (a)
|
|
2028
2028
|
return t.common.issues.push(...a.ctx.common.issues), a.result;
|
|
2029
|
-
const o = i.map((
|
|
2029
|
+
const o = i.map((c) => new O(c));
|
|
2030
2030
|
return l(t, {
|
|
2031
2031
|
code: u.invalid_union,
|
|
2032
2032
|
unionErrors: o
|
|
@@ -2042,7 +2042,7 @@ le.create = (r, e) => new le({
|
|
|
2042
2042
|
typeName: _.ZodUnion,
|
|
2043
2043
|
...v(e)
|
|
2044
2044
|
});
|
|
2045
|
-
const I = (r) => r instanceof pe ? I(r.schema) : r instanceof A ? I(r.innerType()) : r instanceof me ? [r.value] : r instanceof z ? r.options : r instanceof _e ? x.objectValues(r.enum) : r instanceof ye ? I(r._def.innerType) : r instanceof
|
|
2045
|
+
const I = (r) => r instanceof pe ? I(r.schema) : r instanceof A ? I(r.innerType()) : r instanceof me ? [r.value] : r instanceof z ? r.options : r instanceof _e ? x.objectValues(r.enum) : r instanceof ye ? I(r._def.innerType) : r instanceof de ? [void 0] : r instanceof ue ? [null] : r instanceof E ? [void 0, ...I(r.unwrap())] : r instanceof U ? [null, ...I(r.unwrap())] : r instanceof Je || r instanceof ge ? I(r.unwrap()) : r instanceof ve ? I(r._def.innerType) : [];
|
|
2046
2046
|
class Ae extends g {
|
|
2047
2047
|
_parse(e) {
|
|
2048
2048
|
const { ctx: t } = this._processInputParams(e);
|
|
@@ -2105,17 +2105,17 @@ class Ae extends g {
|
|
|
2105
2105
|
});
|
|
2106
2106
|
}
|
|
2107
2107
|
}
|
|
2108
|
-
function
|
|
2108
|
+
function We(r, e) {
|
|
2109
2109
|
const t = $(r), n = $(e);
|
|
2110
2110
|
if (r === e)
|
|
2111
2111
|
return { valid: !0, data: r };
|
|
2112
2112
|
if (t === f.object && n === f.object) {
|
|
2113
2113
|
const s = x.objectKeys(e), a = x.objectKeys(r).filter((o) => s.indexOf(o) !== -1), i = { ...r, ...e };
|
|
2114
2114
|
for (const o of a) {
|
|
2115
|
-
const
|
|
2116
|
-
if (!
|
|
2115
|
+
const c = We(r[o], e[o]);
|
|
2116
|
+
if (!c.valid)
|
|
2117
2117
|
return { valid: !1 };
|
|
2118
|
-
i[o] =
|
|
2118
|
+
i[o] = c.data;
|
|
2119
2119
|
}
|
|
2120
2120
|
return { valid: !0, data: i };
|
|
2121
2121
|
} else if (t === f.array && n === f.array) {
|
|
@@ -2123,10 +2123,10 @@ function qe(r, e) {
|
|
|
2123
2123
|
return { valid: !1 };
|
|
2124
2124
|
const s = [];
|
|
2125
2125
|
for (let a = 0; a < r.length; a++) {
|
|
2126
|
-
const i = r[a], o = e[a],
|
|
2127
|
-
if (!
|
|
2126
|
+
const i = r[a], o = e[a], c = We(i, o);
|
|
2127
|
+
if (!c.valid)
|
|
2128
2128
|
return { valid: !1 };
|
|
2129
|
-
s.push(
|
|
2129
|
+
s.push(c.data);
|
|
2130
2130
|
}
|
|
2131
2131
|
return { valid: !0, data: s };
|
|
2132
2132
|
} else return t === f.date && n === f.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
|
|
@@ -2136,8 +2136,8 @@ class fe extends g {
|
|
|
2136
2136
|
const { status: t, ctx: n } = this._processInputParams(e), s = (a, i) => {
|
|
2137
2137
|
if (Fe(a) || Fe(i))
|
|
2138
2138
|
return y;
|
|
2139
|
-
const o =
|
|
2140
|
-
return o.valid ? ((
|
|
2139
|
+
const o = We(a.value, i.value);
|
|
2140
|
+
return o.valid ? ((qe(a) || qe(i)) && t.dirty(), { status: t.value, value: o.data }) : (l(n, {
|
|
2141
2141
|
code: u.invalid_intersection_types
|
|
2142
2142
|
}), y);
|
|
2143
2143
|
};
|
|
@@ -2194,8 +2194,8 @@ class N extends g {
|
|
|
2194
2194
|
type: "array"
|
|
2195
2195
|
}), t.dirty());
|
|
2196
2196
|
const a = [...n.data].map((i, o) => {
|
|
2197
|
-
const
|
|
2198
|
-
return
|
|
2197
|
+
const c = this._def.items[o] || this._def.rest;
|
|
2198
|
+
return c ? c._parse(new R(n, i, n.path, o)) : null;
|
|
2199
2199
|
}).filter((i) => !!i);
|
|
2200
2200
|
return n.common.async ? Promise.all(a).then((i) => T.mergeArray(t, i)) : T.mergeArray(t, a);
|
|
2201
2201
|
}
|
|
@@ -2253,14 +2253,14 @@ class he extends g {
|
|
|
2253
2253
|
typeName: _.ZodRecord,
|
|
2254
2254
|
...v(n)
|
|
2255
2255
|
}) : new he({
|
|
2256
|
-
keyType:
|
|
2256
|
+
keyType: C.create(),
|
|
2257
2257
|
valueType: e,
|
|
2258
2258
|
typeName: _.ZodRecord,
|
|
2259
2259
|
...v(t)
|
|
2260
2260
|
});
|
|
2261
2261
|
}
|
|
2262
2262
|
}
|
|
2263
|
-
class
|
|
2263
|
+
class Oe extends g {
|
|
2264
2264
|
get keySchema() {
|
|
2265
2265
|
return this._def.keyType;
|
|
2266
2266
|
}
|
|
@@ -2275,34 +2275,34 @@ class Se extends g {
|
|
|
2275
2275
|
expected: f.map,
|
|
2276
2276
|
received: n.parsedType
|
|
2277
2277
|
}), y;
|
|
2278
|
-
const s = this._def.keyType, a = this._def.valueType, i = [...n.data.entries()].map(([o,
|
|
2279
|
-
key: s._parse(new R(n, o, n.path, [
|
|
2280
|
-
value: a._parse(new R(n,
|
|
2278
|
+
const s = this._def.keyType, a = this._def.valueType, i = [...n.data.entries()].map(([o, c], d) => ({
|
|
2279
|
+
key: s._parse(new R(n, o, n.path, [d, "key"])),
|
|
2280
|
+
value: a._parse(new R(n, c, n.path, [d, "value"]))
|
|
2281
2281
|
}));
|
|
2282
2282
|
if (n.common.async) {
|
|
2283
2283
|
const o = /* @__PURE__ */ new Map();
|
|
2284
2284
|
return Promise.resolve().then(async () => {
|
|
2285
|
-
for (const
|
|
2286
|
-
const
|
|
2287
|
-
if (
|
|
2285
|
+
for (const c of i) {
|
|
2286
|
+
const d = await c.key, p = await c.value;
|
|
2287
|
+
if (d.status === "aborted" || p.status === "aborted")
|
|
2288
2288
|
return y;
|
|
2289
|
-
(
|
|
2289
|
+
(d.status === "dirty" || p.status === "dirty") && t.dirty(), o.set(d.value, p.value);
|
|
2290
2290
|
}
|
|
2291
2291
|
return { status: t.value, value: o };
|
|
2292
2292
|
});
|
|
2293
2293
|
} else {
|
|
2294
2294
|
const o = /* @__PURE__ */ new Map();
|
|
2295
|
-
for (const
|
|
2296
|
-
const
|
|
2297
|
-
if (
|
|
2295
|
+
for (const c of i) {
|
|
2296
|
+
const d = c.key, p = c.value;
|
|
2297
|
+
if (d.status === "aborted" || p.status === "aborted")
|
|
2298
2298
|
return y;
|
|
2299
|
-
(
|
|
2299
|
+
(d.status === "dirty" || p.status === "dirty") && t.dirty(), o.set(d.value, p.value);
|
|
2300
2300
|
}
|
|
2301
2301
|
return { status: t.value, value: o };
|
|
2302
2302
|
}
|
|
2303
2303
|
}
|
|
2304
2304
|
}
|
|
2305
|
-
|
|
2305
|
+
Oe.create = (r, e, t) => new Oe({
|
|
2306
2306
|
valueType: e,
|
|
2307
2307
|
keyType: r,
|
|
2308
2308
|
typeName: _.ZodMap,
|
|
@@ -2334,17 +2334,17 @@ class J extends g {
|
|
|
2334
2334
|
message: s.maxSize.message
|
|
2335
2335
|
}), t.dirty());
|
|
2336
2336
|
const a = this._def.valueType;
|
|
2337
|
-
function i(
|
|
2338
|
-
const
|
|
2339
|
-
for (const p of
|
|
2337
|
+
function i(c) {
|
|
2338
|
+
const d = /* @__PURE__ */ new Set();
|
|
2339
|
+
for (const p of c) {
|
|
2340
2340
|
if (p.status === "aborted")
|
|
2341
2341
|
return y;
|
|
2342
|
-
p.status === "dirty" && t.dirty(),
|
|
2342
|
+
p.status === "dirty" && t.dirty(), d.add(p.value);
|
|
2343
2343
|
}
|
|
2344
|
-
return { status: t.value, value:
|
|
2344
|
+
return { status: t.value, value: d };
|
|
2345
2345
|
}
|
|
2346
|
-
const o = [...n.data.values()].map((
|
|
2347
|
-
return n.common.async ? Promise.all(o).then((
|
|
2346
|
+
const o = [...n.data.values()].map((c, d) => a._parse(new R(n, c, n.path, d)));
|
|
2347
|
+
return n.common.async ? Promise.all(o).then((c) => i(c)) : i(o);
|
|
2348
2348
|
}
|
|
2349
2349
|
min(e, t) {
|
|
2350
2350
|
return new J({
|
|
@@ -2372,7 +2372,7 @@ J.create = (r, e) => new J({
|
|
|
2372
2372
|
typeName: _.ZodSet,
|
|
2373
2373
|
...v(e)
|
|
2374
2374
|
});
|
|
2375
|
-
class
|
|
2375
|
+
class X extends g {
|
|
2376
2376
|
constructor() {
|
|
2377
2377
|
super(...arguments), this.validate = this.implement;
|
|
2378
2378
|
}
|
|
@@ -2384,7 +2384,7 @@ class K extends g {
|
|
|
2384
2384
|
expected: f.function,
|
|
2385
2385
|
received: t.parsedType
|
|
2386
2386
|
}), y;
|
|
2387
|
-
function n(o,
|
|
2387
|
+
function n(o, c) {
|
|
2388
2388
|
return we({
|
|
2389
2389
|
data: o,
|
|
2390
2390
|
path: t.path,
|
|
@@ -2393,14 +2393,14 @@ class K extends g {
|
|
|
2393
2393
|
t.schemaErrorMap,
|
|
2394
2394
|
ke(),
|
|
2395
2395
|
Q
|
|
2396
|
-
].filter((
|
|
2396
|
+
].filter((d) => !!d),
|
|
2397
2397
|
issueData: {
|
|
2398
2398
|
code: u.invalid_arguments,
|
|
2399
|
-
argumentsError:
|
|
2399
|
+
argumentsError: c
|
|
2400
2400
|
}
|
|
2401
2401
|
});
|
|
2402
2402
|
}
|
|
2403
|
-
function s(o,
|
|
2403
|
+
function s(o, c) {
|
|
2404
2404
|
return we({
|
|
2405
2405
|
data: o,
|
|
2406
2406
|
path: t.path,
|
|
@@ -2409,33 +2409,33 @@ class K extends g {
|
|
|
2409
2409
|
t.schemaErrorMap,
|
|
2410
2410
|
ke(),
|
|
2411
2411
|
Q
|
|
2412
|
-
].filter((
|
|
2412
|
+
].filter((d) => !!d),
|
|
2413
2413
|
issueData: {
|
|
2414
2414
|
code: u.invalid_return_type,
|
|
2415
|
-
returnTypeError:
|
|
2415
|
+
returnTypeError: c
|
|
2416
2416
|
}
|
|
2417
2417
|
});
|
|
2418
2418
|
}
|
|
2419
2419
|
const a = { errorMap: t.common.contextualErrorMap }, i = t.data;
|
|
2420
2420
|
if (this._def.returns instanceof te) {
|
|
2421
2421
|
const o = this;
|
|
2422
|
-
return Z(async function(...
|
|
2423
|
-
const
|
|
2424
|
-
throw
|
|
2422
|
+
return Z(async function(...c) {
|
|
2423
|
+
const d = new O([]), p = await o._def.args.parseAsync(c, a).catch((w) => {
|
|
2424
|
+
throw d.addIssue(n(c, w)), d;
|
|
2425
2425
|
}), b = await Reflect.apply(i, this, p);
|
|
2426
2426
|
return await o._def.returns._def.type.parseAsync(b, a).catch((w) => {
|
|
2427
|
-
throw
|
|
2427
|
+
throw d.addIssue(s(b, w)), d;
|
|
2428
2428
|
});
|
|
2429
2429
|
});
|
|
2430
2430
|
} else {
|
|
2431
2431
|
const o = this;
|
|
2432
|
-
return Z(function(...
|
|
2433
|
-
const
|
|
2434
|
-
if (!
|
|
2435
|
-
throw new
|
|
2436
|
-
const p = Reflect.apply(i, this,
|
|
2432
|
+
return Z(function(...c) {
|
|
2433
|
+
const d = o._def.args.safeParse(c, a);
|
|
2434
|
+
if (!d.success)
|
|
2435
|
+
throw new O([n(c, d.error)]);
|
|
2436
|
+
const p = Reflect.apply(i, this, d.data), b = o._def.returns.safeParse(p, a);
|
|
2437
2437
|
if (!b.success)
|
|
2438
|
-
throw new
|
|
2438
|
+
throw new O([s(p, b.error)]);
|
|
2439
2439
|
return b.data;
|
|
2440
2440
|
});
|
|
2441
2441
|
}
|
|
@@ -2447,13 +2447,13 @@ class K extends g {
|
|
|
2447
2447
|
return this._def.returns;
|
|
2448
2448
|
}
|
|
2449
2449
|
args(...e) {
|
|
2450
|
-
return new
|
|
2450
|
+
return new X({
|
|
2451
2451
|
...this._def,
|
|
2452
2452
|
args: N.create(e).rest(F.create())
|
|
2453
2453
|
});
|
|
2454
2454
|
}
|
|
2455
2455
|
returns(e) {
|
|
2456
|
-
return new
|
|
2456
|
+
return new X({
|
|
2457
2457
|
...this._def,
|
|
2458
2458
|
returns: e
|
|
2459
2459
|
});
|
|
@@ -2465,7 +2465,7 @@ class K extends g {
|
|
|
2465
2465
|
return this.parse(e);
|
|
2466
2466
|
}
|
|
2467
2467
|
static create(e, t, n) {
|
|
2468
|
-
return new
|
|
2468
|
+
return new X({
|
|
2469
2469
|
args: e || N.create([]).rest(F.create()),
|
|
2470
2470
|
returns: t || F.create(),
|
|
2471
2471
|
typeName: _.ZodFunction,
|
|
@@ -2528,7 +2528,7 @@ class z extends g {
|
|
|
2528
2528
|
code: u.invalid_type
|
|
2529
2529
|
}), y;
|
|
2530
2530
|
}
|
|
2531
|
-
if (Te(this, ae) ||
|
|
2531
|
+
if (Te(this, ae) || Xe(this, ae, new Set(this._def.values)), !Te(this, ae).has(e.data)) {
|
|
2532
2532
|
const t = this._getOrReturnCtx(e), n = this._def.values;
|
|
2533
2533
|
return l(t, {
|
|
2534
2534
|
received: t.data,
|
|
@@ -2588,7 +2588,7 @@ class _e extends g {
|
|
|
2588
2588
|
code: u.invalid_type
|
|
2589
2589
|
}), y;
|
|
2590
2590
|
}
|
|
2591
|
-
if (Te(this, ie) ||
|
|
2591
|
+
if (Te(this, ie) || Xe(this, ie, new Set(x.getValidEnumValues(this._def.values))), !Te(this, ie).has(e.data)) {
|
|
2592
2592
|
const s = x.objectValues(t);
|
|
2593
2593
|
return l(n, {
|
|
2594
2594
|
received: n.data,
|
|
@@ -2654,12 +2654,12 @@ class A extends g {
|
|
|
2654
2654
|
return Promise.resolve(i).then(async (o) => {
|
|
2655
2655
|
if (t.value === "aborted")
|
|
2656
2656
|
return y;
|
|
2657
|
-
const
|
|
2657
|
+
const c = await this._def.schema._parseAsync({
|
|
2658
2658
|
data: o,
|
|
2659
2659
|
path: n.path,
|
|
2660
2660
|
parent: n
|
|
2661
2661
|
});
|
|
2662
|
-
return
|
|
2662
|
+
return c.status === "aborted" ? y : c.status === "dirty" || t.value === "dirty" ? K(c.value) : c;
|
|
2663
2663
|
});
|
|
2664
2664
|
{
|
|
2665
2665
|
if (t.value === "aborted")
|
|
@@ -2669,15 +2669,15 @@ class A extends g {
|
|
|
2669
2669
|
path: n.path,
|
|
2670
2670
|
parent: n
|
|
2671
2671
|
});
|
|
2672
|
-
return o.status === "aborted" ? y : o.status === "dirty" || t.value === "dirty" ?
|
|
2672
|
+
return o.status === "aborted" ? y : o.status === "dirty" || t.value === "dirty" ? K(o.value) : o;
|
|
2673
2673
|
}
|
|
2674
2674
|
}
|
|
2675
2675
|
if (s.type === "refinement") {
|
|
2676
2676
|
const i = (o) => {
|
|
2677
|
-
const
|
|
2677
|
+
const c = s.refinement(o, a);
|
|
2678
2678
|
if (n.common.async)
|
|
2679
|
-
return Promise.resolve(
|
|
2680
|
-
if (
|
|
2679
|
+
return Promise.resolve(c);
|
|
2680
|
+
if (c instanceof Promise)
|
|
2681
2681
|
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2682
2682
|
return o;
|
|
2683
2683
|
};
|
|
@@ -2698,14 +2698,14 @@ class A extends g {
|
|
|
2698
2698
|
path: n.path,
|
|
2699
2699
|
parent: n
|
|
2700
2700
|
});
|
|
2701
|
-
if (!
|
|
2701
|
+
if (!q(i))
|
|
2702
2702
|
return i;
|
|
2703
2703
|
const o = s.transform(i.value, a);
|
|
2704
2704
|
if (o instanceof Promise)
|
|
2705
2705
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2706
2706
|
return { status: t.value, value: o };
|
|
2707
2707
|
} else
|
|
2708
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) =>
|
|
2708
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) => q(i) ? Promise.resolve(s.transform(i.value, a)).then((o) => ({ status: t.value, value: o })) : i);
|
|
2709
2709
|
x.assertNever(s);
|
|
2710
2710
|
}
|
|
2711
2711
|
}
|
|
@@ -2786,7 +2786,7 @@ class ve extends g {
|
|
|
2786
2786
|
status: "valid",
|
|
2787
2787
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
2788
2788
|
get error() {
|
|
2789
|
-
return new
|
|
2789
|
+
return new O(n.common.issues);
|
|
2790
2790
|
},
|
|
2791
2791
|
input: n.data
|
|
2792
2792
|
})
|
|
@@ -2794,7 +2794,7 @@ class ve extends g {
|
|
|
2794
2794
|
status: "valid",
|
|
2795
2795
|
value: s.status === "valid" ? s.value : this._def.catchValue({
|
|
2796
2796
|
get error() {
|
|
2797
|
-
return new
|
|
2797
|
+
return new O(n.common.issues);
|
|
2798
2798
|
},
|
|
2799
2799
|
input: n.data
|
|
2800
2800
|
})
|
|
@@ -2810,7 +2810,7 @@ ve.create = (r, e) => new ve({
|
|
|
2810
2810
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2811
2811
|
...v(e)
|
|
2812
2812
|
});
|
|
2813
|
-
class
|
|
2813
|
+
class Ce extends g {
|
|
2814
2814
|
_parse(e) {
|
|
2815
2815
|
if (this._getType(e) !== f.nan) {
|
|
2816
2816
|
const n = this._getOrReturnCtx(e);
|
|
@@ -2823,11 +2823,11 @@ class je extends g {
|
|
|
2823
2823
|
return { status: "valid", value: e.data };
|
|
2824
2824
|
}
|
|
2825
2825
|
}
|
|
2826
|
-
|
|
2826
|
+
Ce.create = (r) => new Ce({
|
|
2827
2827
|
typeName: _.ZodNaN,
|
|
2828
2828
|
...v(r)
|
|
2829
2829
|
});
|
|
2830
|
-
const
|
|
2830
|
+
const Lt = Symbol("zod_brand");
|
|
2831
2831
|
class Je extends g {
|
|
2832
2832
|
_parse(e) {
|
|
2833
2833
|
const { ctx: t } = this._processInputParams(e), n = t.data;
|
|
@@ -2851,7 +2851,7 @@ class xe extends g {
|
|
|
2851
2851
|
path: n.path,
|
|
2852
2852
|
parent: n
|
|
2853
2853
|
});
|
|
2854
|
-
return a.status === "aborted" ? y : a.status === "dirty" ? (t.dirty(),
|
|
2854
|
+
return a.status === "aborted" ? y : a.status === "dirty" ? (t.dirty(), K(a.value)) : this._def.out._parseAsync({
|
|
2855
2855
|
data: a.value,
|
|
2856
2856
|
path: n.path,
|
|
2857
2857
|
parent: n
|
|
@@ -2883,7 +2883,7 @@ class xe extends g {
|
|
|
2883
2883
|
}
|
|
2884
2884
|
class ge extends g {
|
|
2885
2885
|
_parse(e) {
|
|
2886
|
-
const t = this._def.innerType._parse(e), n = (s) => (
|
|
2886
|
+
const t = this._def.innerType._parse(e), n = (s) => (q(s) && (s.value = Object.freeze(s.value)), s);
|
|
2887
2887
|
return oe(t) ? t.then((s) => n(s)) : n(t);
|
|
2888
2888
|
}
|
|
2889
2889
|
unwrap() {
|
|
@@ -2904,53 +2904,53 @@ function nt(r, e = {}, t) {
|
|
|
2904
2904
|
var a, i;
|
|
2905
2905
|
const o = r(n);
|
|
2906
2906
|
if (o instanceof Promise)
|
|
2907
|
-
return o.then((
|
|
2908
|
-
var
|
|
2909
|
-
if (!
|
|
2910
|
-
const b = Ye(e, n),
|
|
2911
|
-
s.addIssue({ code: "custom", ...b, fatal:
|
|
2907
|
+
return o.then((c) => {
|
|
2908
|
+
var d, p;
|
|
2909
|
+
if (!c) {
|
|
2910
|
+
const b = Ye(e, n), S = (p = (d = b.fatal) !== null && d !== void 0 ? d : t) !== null && p !== void 0 ? p : !0;
|
|
2911
|
+
s.addIssue({ code: "custom", ...b, fatal: S });
|
|
2912
2912
|
}
|
|
2913
2913
|
});
|
|
2914
2914
|
if (!o) {
|
|
2915
|
-
const
|
|
2916
|
-
s.addIssue({ code: "custom", ...
|
|
2915
|
+
const c = Ye(e, n), d = (i = (a = c.fatal) !== null && a !== void 0 ? a : t) !== null && i !== void 0 ? i : !0;
|
|
2916
|
+
s.addIssue({ code: "custom", ...c, fatal: d });
|
|
2917
2917
|
}
|
|
2918
2918
|
}) : ee.create();
|
|
2919
2919
|
}
|
|
2920
|
-
const
|
|
2920
|
+
const zt = {
|
|
2921
2921
|
object: k.lazycreate
|
|
2922
2922
|
};
|
|
2923
2923
|
var _;
|
|
2924
2924
|
(function(r) {
|
|
2925
2925
|
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
2926
|
})(_ || (_ = {}));
|
|
2927
|
-
const
|
|
2927
|
+
const Ut = (r, e = {
|
|
2928
2928
|
message: `Input not instance of ${r.name}`
|
|
2929
|
-
}) => nt((t) => t instanceof r, e), st =
|
|
2930
|
-
string: (r) =>
|
|
2929
|
+
}) => nt((t) => t instanceof r, e), st = C.create, at = V.create, Bt = Ce.create, Ft = L.create, it = ce.create, qt = W.create, Wt = Ze.create, Jt = de.create, Ht = ue.create, Yt = ee.create, Gt = F.create, Kt = P.create, Xt = Se.create, Qt = j.create, er = k.create, tr = k.strictCreate, rr = le.create, nr = Ae.create, sr = fe.create, ar = N.create, ir = he.create, or = Oe.create, cr = J.create, dr = X.create, ur = pe.create, lr = me.create, fr = z.create, hr = _e.create, pr = te.create, Ge = A.create, mr = E.create, _r = U.create, yr = A.createWithPreprocess, vr = xe.create, gr = () => st().optional(), xr = () => at().optional(), br = () => it().optional(), kr = {
|
|
2930
|
+
string: (r) => C.create({ ...r, coerce: !0 }),
|
|
2931
2931
|
number: (r) => V.create({ ...r, coerce: !0 }),
|
|
2932
|
-
boolean: (r) =>
|
|
2932
|
+
boolean: (r) => ce.create({
|
|
2933
2933
|
...r,
|
|
2934
2934
|
coerce: !0
|
|
2935
2935
|
}),
|
|
2936
2936
|
bigint: (r) => L.create({ ...r, coerce: !0 }),
|
|
2937
|
-
date: (r) =>
|
|
2938
|
-
},
|
|
2937
|
+
date: (r) => W.create({ ...r, coerce: !0 })
|
|
2938
|
+
}, wr = y;
|
|
2939
2939
|
var h = /* @__PURE__ */ Object.freeze({
|
|
2940
2940
|
__proto__: null,
|
|
2941
2941
|
defaultErrorMap: Q,
|
|
2942
|
-
setErrorMap:
|
|
2942
|
+
setErrorMap: yt,
|
|
2943
2943
|
getErrorMap: ke,
|
|
2944
2944
|
makeIssue: we,
|
|
2945
|
-
EMPTY_PATH:
|
|
2945
|
+
EMPTY_PATH: vt,
|
|
2946
2946
|
addIssueToContext: l,
|
|
2947
2947
|
ParseStatus: T,
|
|
2948
2948
|
INVALID: y,
|
|
2949
|
-
DIRTY:
|
|
2949
|
+
DIRTY: K,
|
|
2950
2950
|
OK: Z,
|
|
2951
2951
|
isAborted: Fe,
|
|
2952
|
-
isDirty:
|
|
2953
|
-
isValid:
|
|
2952
|
+
isDirty: qe,
|
|
2953
|
+
isValid: q,
|
|
2954
2954
|
isAsync: oe,
|
|
2955
2955
|
get util() {
|
|
2956
2956
|
return x;
|
|
@@ -2962,28 +2962,28 @@ var h = /* @__PURE__ */ Object.freeze({
|
|
|
2962
2962
|
getParsedType: $,
|
|
2963
2963
|
ZodType: g,
|
|
2964
2964
|
datetimeRegex: tt,
|
|
2965
|
-
ZodString:
|
|
2965
|
+
ZodString: C,
|
|
2966
2966
|
ZodNumber: V,
|
|
2967
2967
|
ZodBigInt: L,
|
|
2968
|
-
ZodBoolean:
|
|
2969
|
-
ZodDate:
|
|
2968
|
+
ZodBoolean: ce,
|
|
2969
|
+
ZodDate: W,
|
|
2970
2970
|
ZodSymbol: Ze,
|
|
2971
|
-
ZodUndefined:
|
|
2971
|
+
ZodUndefined: de,
|
|
2972
2972
|
ZodNull: ue,
|
|
2973
2973
|
ZodAny: ee,
|
|
2974
2974
|
ZodUnknown: F,
|
|
2975
|
-
ZodNever:
|
|
2976
|
-
ZodVoid:
|
|
2977
|
-
ZodArray:
|
|
2975
|
+
ZodNever: P,
|
|
2976
|
+
ZodVoid: Se,
|
|
2977
|
+
ZodArray: j,
|
|
2978
2978
|
ZodObject: k,
|
|
2979
2979
|
ZodUnion: le,
|
|
2980
2980
|
ZodDiscriminatedUnion: Ae,
|
|
2981
2981
|
ZodIntersection: fe,
|
|
2982
2982
|
ZodTuple: N,
|
|
2983
2983
|
ZodRecord: he,
|
|
2984
|
-
ZodMap:
|
|
2984
|
+
ZodMap: Oe,
|
|
2985
2985
|
ZodSet: J,
|
|
2986
|
-
ZodFunction:
|
|
2986
|
+
ZodFunction: X,
|
|
2987
2987
|
ZodLazy: pe,
|
|
2988
2988
|
ZodLiteral: me,
|
|
2989
2989
|
ZodEnum: z,
|
|
@@ -2995,65 +2995,65 @@ var h = /* @__PURE__ */ Object.freeze({
|
|
|
2995
2995
|
ZodNullable: U,
|
|
2996
2996
|
ZodDefault: ye,
|
|
2997
2997
|
ZodCatch: ve,
|
|
2998
|
-
ZodNaN:
|
|
2999
|
-
BRAND:
|
|
2998
|
+
ZodNaN: Ce,
|
|
2999
|
+
BRAND: Lt,
|
|
3000
3000
|
ZodBranded: Je,
|
|
3001
3001
|
ZodPipeline: xe,
|
|
3002
3002
|
ZodReadonly: ge,
|
|
3003
3003
|
custom: nt,
|
|
3004
3004
|
Schema: g,
|
|
3005
3005
|
ZodSchema: g,
|
|
3006
|
-
late:
|
|
3006
|
+
late: zt,
|
|
3007
3007
|
get ZodFirstPartyTypeKind() {
|
|
3008
3008
|
return _;
|
|
3009
3009
|
},
|
|
3010
|
-
coerce:
|
|
3011
|
-
any:
|
|
3012
|
-
array:
|
|
3013
|
-
bigint:
|
|
3010
|
+
coerce: kr,
|
|
3011
|
+
any: Yt,
|
|
3012
|
+
array: Qt,
|
|
3013
|
+
bigint: Ft,
|
|
3014
3014
|
boolean: it,
|
|
3015
|
-
date:
|
|
3016
|
-
discriminatedUnion:
|
|
3015
|
+
date: qt,
|
|
3016
|
+
discriminatedUnion: nr,
|
|
3017
3017
|
effect: Ge,
|
|
3018
|
-
enum:
|
|
3018
|
+
enum: fr,
|
|
3019
3019
|
function: dr,
|
|
3020
|
-
instanceof:
|
|
3021
|
-
intersection:
|
|
3022
|
-
lazy:
|
|
3023
|
-
literal:
|
|
3024
|
-
map:
|
|
3025
|
-
nan:
|
|
3026
|
-
nativeEnum:
|
|
3027
|
-
never:
|
|
3028
|
-
null:
|
|
3029
|
-
nullable:
|
|
3020
|
+
instanceof: Ut,
|
|
3021
|
+
intersection: sr,
|
|
3022
|
+
lazy: ur,
|
|
3023
|
+
literal: lr,
|
|
3024
|
+
map: or,
|
|
3025
|
+
nan: Bt,
|
|
3026
|
+
nativeEnum: hr,
|
|
3027
|
+
never: Kt,
|
|
3028
|
+
null: Ht,
|
|
3029
|
+
nullable: _r,
|
|
3030
3030
|
number: at,
|
|
3031
|
-
object:
|
|
3032
|
-
oboolean:
|
|
3033
|
-
onumber:
|
|
3034
|
-
optional:
|
|
3035
|
-
ostring:
|
|
3036
|
-
pipeline:
|
|
3037
|
-
preprocess:
|
|
3038
|
-
promise:
|
|
3039
|
-
record:
|
|
3040
|
-
set:
|
|
3041
|
-
strictObject:
|
|
3031
|
+
object: er,
|
|
3032
|
+
oboolean: br,
|
|
3033
|
+
onumber: xr,
|
|
3034
|
+
optional: mr,
|
|
3035
|
+
ostring: gr,
|
|
3036
|
+
pipeline: vr,
|
|
3037
|
+
preprocess: yr,
|
|
3038
|
+
promise: pr,
|
|
3039
|
+
record: ir,
|
|
3040
|
+
set: cr,
|
|
3041
|
+
strictObject: tr,
|
|
3042
3042
|
string: st,
|
|
3043
3043
|
symbol: Wt,
|
|
3044
3044
|
transformer: Ge,
|
|
3045
|
-
tuple:
|
|
3046
|
-
undefined:
|
|
3047
|
-
union:
|
|
3048
|
-
unknown:
|
|
3045
|
+
tuple: ar,
|
|
3046
|
+
undefined: Jt,
|
|
3047
|
+
union: rr,
|
|
3048
|
+
unknown: Gt,
|
|
3049
3049
|
void: Xt,
|
|
3050
|
-
NEVER:
|
|
3050
|
+
NEVER: wr,
|
|
3051
3051
|
ZodIssueCode: u,
|
|
3052
|
-
quotelessJson:
|
|
3053
|
-
ZodError:
|
|
3052
|
+
quotelessJson: _t,
|
|
3053
|
+
ZodError: O
|
|
3054
3054
|
});
|
|
3055
|
-
|
|
3056
|
-
const
|
|
3055
|
+
mt(h);
|
|
3056
|
+
const Tr = (r, e) => e.skipDedupe || e.method !== "GET", Zr = (r, e) => e.method + "@" + r, Sr = (r) => r.clone(), Or = ({ skip: r = Tr, key: e = Zr, resolver: t = Sr } = {}) => {
|
|
3057
3057
|
const n = /* @__PURE__ */ new Map();
|
|
3058
3058
|
return (s) => (a, i) => {
|
|
3059
3059
|
if (r(a, i))
|
|
@@ -3062,62 +3062,62 @@ const wr = (r, e) => e.skipDedupe || e.method !== "GET", Tr = (r, e) => e.method
|
|
|
3062
3062
|
if (!n.has(o))
|
|
3063
3063
|
n.set(o, []);
|
|
3064
3064
|
else
|
|
3065
|
-
return new Promise((
|
|
3066
|
-
n.get(o).push([
|
|
3065
|
+
return new Promise((c, d) => {
|
|
3066
|
+
n.get(o).push([c, d]);
|
|
3067
3067
|
});
|
|
3068
3068
|
try {
|
|
3069
|
-
return s(a, i).then((
|
|
3070
|
-
throw n.get(o).forEach(([,
|
|
3069
|
+
return s(a, i).then((c) => (n.get(o).forEach(([d]) => d(t(c))), n.delete(o), c)).catch((c) => {
|
|
3070
|
+
throw n.get(o).forEach(([, d]) => d(c)), n.delete(o), c;
|
|
3071
3071
|
});
|
|
3072
|
-
} catch (
|
|
3073
|
-
return n.delete(o), Promise.reject(
|
|
3072
|
+
} catch (c) {
|
|
3073
|
+
return n.delete(o), Promise.reject(c);
|
|
3074
3074
|
}
|
|
3075
3075
|
};
|
|
3076
|
-
},
|
|
3076
|
+
}, Cr = (r, e) => r * e, jr = (r) => r && r.ok, Ar = ({ delayTimer: r = 500, delayRamp: e = Cr, maxAttempts: t = 10, until: n = jr, onRetry: s = null, retryOnNetworkError: a = !1, resolveWithLatestResponse: i = !1, skip: o } = {}) => (c) => (d, p) => {
|
|
3077
3077
|
let b = 0;
|
|
3078
|
-
if (o && o(
|
|
3079
|
-
return d
|
|
3080
|
-
const
|
|
3078
|
+
if (o && o(d, p))
|
|
3079
|
+
return c(d, p);
|
|
3080
|
+
const S = (w, M) => Promise.resolve(n(w, M)).then((Ee) => Ee ? w && i ? w : M ? Promise.reject(M) : w : (b++, !t || b <= t ? new Promise((D) => {
|
|
3081
3081
|
const be = e(r, b);
|
|
3082
3082
|
setTimeout(() => {
|
|
3083
3083
|
typeof s == "function" ? Promise.resolve(s({
|
|
3084
3084
|
response: w,
|
|
3085
|
-
error:
|
|
3086
|
-
url:
|
|
3085
|
+
error: M,
|
|
3086
|
+
url: d,
|
|
3087
3087
|
options: p
|
|
3088
3088
|
})).then((B = {}) => {
|
|
3089
3089
|
var re, ne;
|
|
3090
|
-
D(
|
|
3091
|
-
}) : D(d
|
|
3090
|
+
D(c((re = B && B.url) !== null && re !== void 0 ? re : d, (ne = B && B.options) !== null && ne !== void 0 ? ne : p));
|
|
3091
|
+
}) : D(c(d, p));
|
|
3092
3092
|
}, be);
|
|
3093
|
-
}).then(
|
|
3093
|
+
}).then(S).catch((D) => {
|
|
3094
3094
|
if (!a)
|
|
3095
3095
|
throw D;
|
|
3096
|
-
return
|
|
3097
|
-
}) : w && i ? w : Promise.reject(
|
|
3098
|
-
return d
|
|
3096
|
+
return S(null, D);
|
|
3097
|
+
}) : w && i ? w : Promise.reject(M || new Error("Number of attempts exceeded."))));
|
|
3098
|
+
return c(d, p).then(S).catch((w) => {
|
|
3099
3099
|
if (!a)
|
|
3100
3100
|
throw w;
|
|
3101
|
-
return
|
|
3101
|
+
return S(null, w);
|
|
3102
3102
|
});
|
|
3103
|
-
},
|
|
3103
|
+
}, je = h.object({
|
|
3104
3104
|
code: h.number(),
|
|
3105
3105
|
message: h.string()
|
|
3106
|
-
}), Ar = h.object({
|
|
3107
|
-
message: h.string()
|
|
3108
3106
|
}), Er = h.object({
|
|
3107
|
+
message: h.string()
|
|
3108
|
+
}), Rr = h.object({
|
|
3109
3109
|
emails: h.array(h.string()).optional(),
|
|
3110
3110
|
http_body: h.string().optional(),
|
|
3111
3111
|
http_url: h.string().optional(),
|
|
3112
3112
|
txt_name: h.string().optional(),
|
|
3113
3113
|
txt_value: h.string().optional()
|
|
3114
|
-
}),
|
|
3114
|
+
}), Nr = h.object({
|
|
3115
3115
|
ciphers: h.array(h.string()).optional(),
|
|
3116
3116
|
early_hints: h.string().optional(),
|
|
3117
3117
|
http2: h.string().optional(),
|
|
3118
3118
|
min_tls_version: h.string().optional(),
|
|
3119
3119
|
tls_1_3: h.string().optional()
|
|
3120
|
-
}),
|
|
3120
|
+
}), Ir = h.object({
|
|
3121
3121
|
id: h.string(),
|
|
3122
3122
|
bundle_method: h.string().optional(),
|
|
3123
3123
|
certificate_authority: h.string(),
|
|
@@ -3129,49 +3129,49 @@ const wr = (r, e) => e.skipDedupe || e.method !== "GET", Tr = (r, e) => e.method
|
|
|
3129
3129
|
issuer: h.string().optional(),
|
|
3130
3130
|
method: h.string(),
|
|
3131
3131
|
serial_number: h.string().optional(),
|
|
3132
|
-
settings:
|
|
3132
|
+
settings: Nr.optional(),
|
|
3133
3133
|
signature: h.string().optional(),
|
|
3134
3134
|
type: h.string(),
|
|
3135
3135
|
uploaded_on: h.string().optional(),
|
|
3136
|
-
validation_errors: h.array(
|
|
3137
|
-
validation_records: h.array(
|
|
3136
|
+
validation_errors: h.array(Er).optional(),
|
|
3137
|
+
validation_records: h.array(Rr).optional(),
|
|
3138
3138
|
wildcard: h.boolean()
|
|
3139
|
-
}),
|
|
3139
|
+
}), $r = h.object({
|
|
3140
3140
|
name: h.string(),
|
|
3141
3141
|
type: h.string(),
|
|
3142
3142
|
value: h.string()
|
|
3143
|
-
}),
|
|
3143
|
+
}), Pr = h.object({
|
|
3144
3144
|
http_body: h.string().optional(),
|
|
3145
3145
|
http_url: h.string().optional()
|
|
3146
3146
|
}), ot = h.object({
|
|
3147
3147
|
id: h.string(),
|
|
3148
|
-
ssl:
|
|
3148
|
+
ssl: Ir,
|
|
3149
3149
|
hostname: h.string(),
|
|
3150
3150
|
custom_metadata: h.record(h.string()).optional(),
|
|
3151
3151
|
custom_origin_server: h.string().optional(),
|
|
3152
3152
|
custom_origin_sni: h.string().optional(),
|
|
3153
|
-
ownership_verification:
|
|
3154
|
-
ownership_verification_http:
|
|
3153
|
+
ownership_verification: $r.optional(),
|
|
3154
|
+
ownership_verification_http: Pr.optional(),
|
|
3155
3155
|
status: h.string(),
|
|
3156
3156
|
verification_errors: h.array(h.string()).optional(),
|
|
3157
3157
|
created_at: h.string()
|
|
3158
3158
|
}), ze = h.object({
|
|
3159
|
-
errors: h.array(
|
|
3160
|
-
messages: h.array(
|
|
3159
|
+
errors: h.array(je),
|
|
3160
|
+
messages: h.array(je),
|
|
3161
3161
|
success: h.boolean(),
|
|
3162
3162
|
result: ot
|
|
3163
3163
|
}), Mr = h.object({
|
|
3164
|
-
errors: h.array(
|
|
3165
|
-
messages: h.array(
|
|
3164
|
+
errors: h.array(je),
|
|
3165
|
+
messages: h.array(je),
|
|
3166
3166
|
success: h.boolean(),
|
|
3167
3167
|
result: h.array(ot)
|
|
3168
3168
|
});
|
|
3169
3169
|
function Y(r) {
|
|
3170
|
-
return
|
|
3170
|
+
return ft(`https://api.cloudflare.com/client/v4/zones/${r.zoneId}`).headers({
|
|
3171
3171
|
"X-Auth-Email": r.authEmail,
|
|
3172
3172
|
"X-Auth-Key": r.authKey,
|
|
3173
3173
|
"Content-Type": "application/json"
|
|
3174
|
-
}).middlewares([
|
|
3174
|
+
}).middlewares([Ar(), Or()]);
|
|
3175
3175
|
}
|
|
3176
3176
|
function Ue(r) {
|
|
3177
3177
|
const e = [];
|
|
@@ -3193,11 +3193,11 @@ function Ue(r) {
|
|
|
3193
3193
|
status: r.status === "active" ? "ready" : "pending",
|
|
3194
3194
|
type: "auth0_managed_certs",
|
|
3195
3195
|
verification: {
|
|
3196
|
-
methods: h.array(
|
|
3196
|
+
methods: h.array(lt).parse(e)
|
|
3197
3197
|
}
|
|
3198
3198
|
};
|
|
3199
3199
|
}
|
|
3200
|
-
function
|
|
3200
|
+
function Dr(r) {
|
|
3201
3201
|
return {
|
|
3202
3202
|
create: async (e, t) => {
|
|
3203
3203
|
const { result: n, errors: s, success: a } = ze.parse(
|
|
@@ -3228,7 +3228,7 @@ function Pr(r) {
|
|
|
3228
3228
|
}), i;
|
|
3229
3229
|
},
|
|
3230
3230
|
get: async (e, t) => {
|
|
3231
|
-
var
|
|
3231
|
+
var c;
|
|
3232
3232
|
const n = await r.customDomainAdapter.get(
|
|
3233
3233
|
e,
|
|
3234
3234
|
t
|
|
@@ -3240,7 +3240,7 @@ function Pr(r) {
|
|
|
3240
3240
|
throw new H(503, {
|
|
3241
3241
|
message: JSON.stringify(i)
|
|
3242
3242
|
});
|
|
3243
|
-
if (r.enterprise && ((
|
|
3243
|
+
if (r.enterprise && ((c = a.custom_metadata) == null ? void 0 : c.tenant_id) !== e)
|
|
3244
3244
|
throw new H(404);
|
|
3245
3245
|
return Ue({ ...n, ...a });
|
|
3246
3246
|
},
|
|
@@ -3252,15 +3252,15 @@ function Pr(r) {
|
|
|
3252
3252
|
message: JSON.stringify(a)
|
|
3253
3253
|
});
|
|
3254
3254
|
return s.filter(
|
|
3255
|
-
(o) => t.find((
|
|
3255
|
+
(o) => t.find((c) => c.custom_domain_id === o.id)
|
|
3256
3256
|
).filter(
|
|
3257
3257
|
(o) => {
|
|
3258
|
-
var
|
|
3259
|
-
return !(r.enterprise && ((
|
|
3258
|
+
var c;
|
|
3259
|
+
return !(r.enterprise && ((c = o.custom_metadata) == null ? void 0 : c.tenant_id) !== e);
|
|
3260
3260
|
}
|
|
3261
3261
|
).map(
|
|
3262
3262
|
(o) => Ue({
|
|
3263
|
-
...t.find((
|
|
3263
|
+
...t.find((c) => c.custom_domain_id === o.id),
|
|
3264
3264
|
...o
|
|
3265
3265
|
})
|
|
3266
3266
|
);
|
|
@@ -3294,11 +3294,79 @@ function Pr(r) {
|
|
|
3294
3294
|
}
|
|
3295
3295
|
};
|
|
3296
3296
|
}
|
|
3297
|
-
|
|
3297
|
+
class ct {
|
|
3298
|
+
constructor(e) {
|
|
3299
|
+
this.config = e;
|
|
3300
|
+
}
|
|
3301
|
+
getKey(e) {
|
|
3302
|
+
return this.config.keyPrefix ? `${this.config.keyPrefix}:${e}` : e;
|
|
3303
|
+
}
|
|
3304
|
+
createRequest(e) {
|
|
3305
|
+
return new Request(`https://cache.internal/${this.getKey(e)}`);
|
|
3306
|
+
}
|
|
3307
|
+
async get(e) {
|
|
3308
|
+
try {
|
|
3309
|
+
const t = this.createRequest(e), n = await this.config.cache.match(t);
|
|
3310
|
+
if (!n)
|
|
3311
|
+
return null;
|
|
3312
|
+
const s = await n.json();
|
|
3313
|
+
return s.expiresAt && new Date(s.expiresAt) < /* @__PURE__ */ new Date() ? (await this.delete(e), null) : s.value;
|
|
3314
|
+
} catch (t) {
|
|
3315
|
+
return console.warn(`Cache get error for key ${e}:`, t), null;
|
|
3316
|
+
}
|
|
3317
|
+
}
|
|
3318
|
+
async set(e, t, n) {
|
|
3319
|
+
try {
|
|
3320
|
+
const s = n ?? this.config.defaultTtlSeconds, a = {
|
|
3321
|
+
value: t,
|
|
3322
|
+
expiresAt: s ? new Date(Date.now() + s * 1e3).toISOString() : void 0,
|
|
3323
|
+
cachedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
3324
|
+
}, i = this.createRequest(e), o = new Response(JSON.stringify(a), {
|
|
3325
|
+
headers: {
|
|
3326
|
+
"Content-Type": "application/json",
|
|
3327
|
+
...s && { "Cache-Control": `max-age=${s}` }
|
|
3328
|
+
}
|
|
3329
|
+
});
|
|
3330
|
+
await this.config.cache.put(i, o);
|
|
3331
|
+
} catch (s) {
|
|
3332
|
+
console.warn(`Cache set error for key ${e}:`, s);
|
|
3333
|
+
}
|
|
3334
|
+
}
|
|
3335
|
+
async delete(e) {
|
|
3336
|
+
try {
|
|
3337
|
+
const t = this.createRequest(e);
|
|
3338
|
+
return await this.config.cache.delete(t);
|
|
3339
|
+
} catch (t) {
|
|
3340
|
+
return console.warn(`Cache delete error for key ${e}:`, t), !1;
|
|
3341
|
+
}
|
|
3342
|
+
}
|
|
3343
|
+
async clear() {
|
|
3344
|
+
console.warn(
|
|
3345
|
+
"CloudflareCache.clear() is not implemented - Cloudflare Cache API does not support clearing all entries"
|
|
3346
|
+
);
|
|
3347
|
+
}
|
|
3348
|
+
}
|
|
3349
|
+
function Ur(r) {
|
|
3350
|
+
return new ct(r);
|
|
3351
|
+
}
|
|
3352
|
+
async function Br(r = "default", e = {}) {
|
|
3353
|
+
if (typeof caches > "u")
|
|
3354
|
+
throw new Error(
|
|
3355
|
+
"caches API is not available - this function should only be used in Cloudflare Workers"
|
|
3356
|
+
);
|
|
3357
|
+
const t = await caches.open(r);
|
|
3358
|
+
return new ct({
|
|
3359
|
+
cache: t,
|
|
3360
|
+
...e
|
|
3361
|
+
});
|
|
3362
|
+
}
|
|
3363
|
+
function Fr(r) {
|
|
3298
3364
|
return {
|
|
3299
|
-
customDomains:
|
|
3365
|
+
customDomains: Dr(r)
|
|
3300
3366
|
};
|
|
3301
3367
|
}
|
|
3302
3368
|
export {
|
|
3303
|
-
|
|
3369
|
+
Ur as createCloudflareCache,
|
|
3370
|
+
Br as createGlobalCloudflareCache,
|
|
3371
|
+
Fr as default
|
|
3304
3372
|
};
|