@authhero/cloudflare-adapter 2.12.0 → 2.13.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/README.md +95 -32
- package/dist/cloudflare-adapter.cjs +6 -6
- package/dist/cloudflare-adapter.d.ts +3 -6
- package/dist/cloudflare-adapter.mjs +163 -160
- package/package.json +2 -2
|
@@ -12,7 +12,7 @@ function pt(n, e) {
|
|
|
12
12
|
var t;
|
|
13
13
|
return ((t = n?._def) === null || t === void 0 ? void 0 : t.typeName) === e;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function ue(n, e) {
|
|
16
16
|
const t = n.ZodType.prototype[e];
|
|
17
17
|
n.ZodType.prototype[e] = function(...s) {
|
|
18
18
|
const r = t.apply(this, s);
|
|
@@ -24,24 +24,24 @@ function mt(n) {
|
|
|
24
24
|
return;
|
|
25
25
|
n.ZodType.prototype.openapi = function(r, a) {
|
|
26
26
|
var i, o, c, u, p, b;
|
|
27
|
-
const C = typeof r == "string" ? a : r, w = C ?? {}, { param: Z } = w,
|
|
27
|
+
const C = typeof r == "string" ? a : r, w = C ?? {}, { param: Z } = w, ce = ht(w, ["param"]), M = Object.assign(Object.assign({}, (i = this._def.openapi) === null || i === void 0 ? void 0 : i._internal), typeof r == "string" ? { refId: r } : void 0), J = Object.assign(Object.assign(Object.assign({}, (o = this._def.openapi) === null || o === void 0 ? void 0 : o.metadata), ce), !((u = (c = this._def.openapi) === null || c === void 0 ? void 0 : c.metadata) === null || u === void 0) && u.param || Z ? {
|
|
28
28
|
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), Z)
|
|
29
29
|
} : void 0), D = new this.constructor(Object.assign(Object.assign({}, this._def), { openapi: Object.assign(Object.assign({}, Object.keys(M).length > 0 ? { _internal: M } : void 0), Object.keys(J).length > 0 ? { metadata: J } : void 0) }));
|
|
30
30
|
if (pt(this, "ZodObject")) {
|
|
31
31
|
const ee = this.extend;
|
|
32
|
-
D.extend = function(...
|
|
33
|
-
var
|
|
34
|
-
const
|
|
35
|
-
return
|
|
32
|
+
D.extend = function(...Q) {
|
|
33
|
+
var H, de, Me, De, Le, Ve, ze;
|
|
34
|
+
const Be = ee.apply(this, Q);
|
|
35
|
+
return Be._def.openapi = {
|
|
36
36
|
_internal: {
|
|
37
|
-
extendedFrom: !((
|
|
37
|
+
extendedFrom: !((de = (H = this._def.openapi) === null || H === void 0 ? void 0 : H._internal) === null || de === void 0) && de.refId ? { refId: (De = (Me = this._def.openapi) === null || Me === void 0 ? void 0 : Me._internal) === null || De === void 0 ? void 0 : De.refId, schema: this } : (Ve = (Le = this._def.openapi) === null || Le === void 0 ? void 0 : Le._internal) === null || Ve === void 0 ? void 0 : Ve.extendedFrom
|
|
38
38
|
},
|
|
39
|
-
metadata: (
|
|
40
|
-
},
|
|
39
|
+
metadata: (ze = Be._def.openapi) === null || ze === void 0 ? void 0 : ze.metadata
|
|
40
|
+
}, Be;
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
return D;
|
|
44
|
-
},
|
|
44
|
+
}, ue(n, "optional"), ue(n, "nullable"), ue(n, "default"), ue(n, "transform"), ue(n, "refine");
|
|
45
45
|
const e = n.ZodObject.prototype.deepPartial;
|
|
46
46
|
n.ZodObject.prototype.deepPartial = function() {
|
|
47
47
|
const r = this._def.shape(), a = e.apply(this), i = a._def.shape();
|
|
@@ -61,7 +61,7 @@ function mt(n) {
|
|
|
61
61
|
return a._def.openapi = void 0, a;
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
-
var
|
|
64
|
+
var le = class extends Error {
|
|
65
65
|
res;
|
|
66
66
|
status;
|
|
67
67
|
constructor(n = 500, e) {
|
|
@@ -246,7 +246,7 @@ class O extends Error {
|
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
O.create = (n) => new O(n);
|
|
249
|
-
const
|
|
249
|
+
const ae = (n, e) => {
|
|
250
250
|
let t;
|
|
251
251
|
switch (n.code) {
|
|
252
252
|
case d.invalid_type:
|
|
@@ -302,14 +302,14 @@ const ie = (n, e) => {
|
|
|
302
302
|
}
|
|
303
303
|
return { message: t };
|
|
304
304
|
};
|
|
305
|
-
let nt =
|
|
305
|
+
let nt = ae;
|
|
306
306
|
function _t(n) {
|
|
307
307
|
nt = n;
|
|
308
308
|
}
|
|
309
|
-
function
|
|
309
|
+
function Ae() {
|
|
310
310
|
return nt;
|
|
311
311
|
}
|
|
312
|
-
const
|
|
312
|
+
const Re = (n) => {
|
|
313
313
|
const { data: e, path: t, errorMaps: s, issueData: r } = n, a = [...t, ...r.path || []], i = {
|
|
314
314
|
...r,
|
|
315
315
|
path: a
|
|
@@ -331,7 +331,7 @@ const Ae = (n) => {
|
|
|
331
331
|
};
|
|
332
332
|
}, gt = [];
|
|
333
333
|
function l(n, e) {
|
|
334
|
-
const t =
|
|
334
|
+
const t = Ae(), s = Re({
|
|
335
335
|
issueData: e,
|
|
336
336
|
data: n.data,
|
|
337
337
|
path: n.path,
|
|
@@ -342,7 +342,7 @@ function l(n, e) {
|
|
|
342
342
|
// then schema-bound map if available
|
|
343
343
|
t,
|
|
344
344
|
// then global override map
|
|
345
|
-
t ===
|
|
345
|
+
t === ae ? void 0 : ae
|
|
346
346
|
// then global default map
|
|
347
347
|
].filter((r) => !!r)
|
|
348
348
|
});
|
|
@@ -391,7 +391,7 @@ class T {
|
|
|
391
391
|
}
|
|
392
392
|
const m = Object.freeze({
|
|
393
393
|
status: "aborted"
|
|
394
|
-
}),
|
|
394
|
+
}), se = (n) => ({ status: "dirty", value: n }), S = (n) => ({ status: "valid", value: n }), We = (n) => n.status === "aborted", Je = (n) => n.status === "dirty", G = (n) => n.status === "valid", fe = (n) => typeof Promise < "u" && n instanceof Promise;
|
|
395
395
|
var h;
|
|
396
396
|
(function(n) {
|
|
397
397
|
n.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, n.toString = (e) => typeof e == "string" ? e : e?.message;
|
|
@@ -587,7 +587,7 @@ class v {
|
|
|
587
587
|
return E.create(this);
|
|
588
588
|
}
|
|
589
589
|
promise() {
|
|
590
|
-
return
|
|
590
|
+
return oe.create(this, this._def);
|
|
591
591
|
}
|
|
592
592
|
or(e) {
|
|
593
593
|
return ye.create([this, e], this._def);
|
|
@@ -649,7 +649,7 @@ class v {
|
|
|
649
649
|
}
|
|
650
650
|
}
|
|
651
651
|
const vt = /^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-_]*$/, St = /^[-+]?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)?)??$/, Ct = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Ot = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
652
|
-
let
|
|
652
|
+
let Ue;
|
|
653
653
|
const At = /^(?:(?: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])$/, Rt = /^(?:(?: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])$/, 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]))$/, Nt = /^(([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])$/, jt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Zt = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, st = "((\\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(`^${st}$`);
|
|
654
654
|
function rt(n) {
|
|
655
655
|
let e = "[0-5]\\d";
|
|
@@ -739,7 +739,7 @@ class R extends v {
|
|
|
739
739
|
message: a.message
|
|
740
740
|
}), s.dirty());
|
|
741
741
|
else if (a.kind === "emoji")
|
|
742
|
-
|
|
742
|
+
Ue || (Ue = new RegExp(Ot, "u")), Ue.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
|
|
743
743
|
validation: "emoji",
|
|
744
744
|
code: d.invalid_string,
|
|
745
745
|
message: a.message
|
|
@@ -1472,7 +1472,7 @@ K.create = (n) => new K({
|
|
|
1472
1472
|
typeName: y.ZodDate,
|
|
1473
1473
|
..._(n)
|
|
1474
1474
|
});
|
|
1475
|
-
class
|
|
1475
|
+
class Ee extends v {
|
|
1476
1476
|
_parse(e) {
|
|
1477
1477
|
if (this._getType(e) !== f.symbol) {
|
|
1478
1478
|
const s = this._getOrReturnCtx(e);
|
|
@@ -1485,7 +1485,7 @@ class Re extends v {
|
|
|
1485
1485
|
return S(e.data);
|
|
1486
1486
|
}
|
|
1487
1487
|
}
|
|
1488
|
-
|
|
1488
|
+
Ee.create = (n) => new Ee({
|
|
1489
1489
|
typeName: y.ZodSymbol,
|
|
1490
1490
|
..._(n)
|
|
1491
1491
|
});
|
|
@@ -1523,7 +1523,7 @@ me.create = (n) => new me({
|
|
|
1523
1523
|
typeName: y.ZodNull,
|
|
1524
1524
|
..._(n)
|
|
1525
1525
|
});
|
|
1526
|
-
class
|
|
1526
|
+
class ie extends v {
|
|
1527
1527
|
constructor() {
|
|
1528
1528
|
super(...arguments), this._any = !0;
|
|
1529
1529
|
}
|
|
@@ -1531,7 +1531,7 @@ class oe extends v {
|
|
|
1531
1531
|
return S(e.data);
|
|
1532
1532
|
}
|
|
1533
1533
|
}
|
|
1534
|
-
|
|
1534
|
+
ie.create = (n) => new ie({
|
|
1535
1535
|
typeName: y.ZodAny,
|
|
1536
1536
|
..._(n)
|
|
1537
1537
|
});
|
|
@@ -1561,7 +1561,7 @@ z.create = (n) => new z({
|
|
|
1561
1561
|
typeName: y.ZodNever,
|
|
1562
1562
|
..._(n)
|
|
1563
1563
|
});
|
|
1564
|
-
class
|
|
1564
|
+
class Ne extends v {
|
|
1565
1565
|
_parse(e) {
|
|
1566
1566
|
if (this._getType(e) !== f.undefined) {
|
|
1567
1567
|
const s = this._getOrReturnCtx(e);
|
|
@@ -1574,7 +1574,7 @@ class Ee extends v {
|
|
|
1574
1574
|
return S(e.data);
|
|
1575
1575
|
}
|
|
1576
1576
|
}
|
|
1577
|
-
|
|
1577
|
+
Ne.create = (n) => new Ne({
|
|
1578
1578
|
typeName: y.ZodVoid,
|
|
1579
1579
|
..._(n)
|
|
1580
1580
|
});
|
|
@@ -1651,12 +1651,12 @@ E.create = (n, e) => new E({
|
|
|
1651
1651
|
typeName: y.ZodArray,
|
|
1652
1652
|
..._(e)
|
|
1653
1653
|
});
|
|
1654
|
-
function
|
|
1654
|
+
function ne(n) {
|
|
1655
1655
|
if (n instanceof k) {
|
|
1656
1656
|
const e = {};
|
|
1657
1657
|
for (const t in n.shape) {
|
|
1658
1658
|
const s = n.shape[t];
|
|
1659
|
-
e[t] = I.create(
|
|
1659
|
+
e[t] = I.create(ne(s));
|
|
1660
1660
|
}
|
|
1661
1661
|
return new k({
|
|
1662
1662
|
...n._def,
|
|
@@ -1664,8 +1664,8 @@ function se(n) {
|
|
|
1664
1664
|
});
|
|
1665
1665
|
} else return n instanceof E ? new E({
|
|
1666
1666
|
...n._def,
|
|
1667
|
-
type:
|
|
1668
|
-
}) : n instanceof I ? I.create(
|
|
1667
|
+
type: ne(n.element)
|
|
1668
|
+
}) : n instanceof I ? I.create(ne(n.unwrap())) : n instanceof W ? W.create(ne(n.unwrap())) : n instanceof P ? P.create(n.items.map((e) => ne(e))) : n;
|
|
1669
1669
|
}
|
|
1670
1670
|
class k extends v {
|
|
1671
1671
|
constructor() {
|
|
@@ -1900,7 +1900,7 @@ class k extends v {
|
|
|
1900
1900
|
* @deprecated
|
|
1901
1901
|
*/
|
|
1902
1902
|
deepPartial() {
|
|
1903
|
-
return
|
|
1903
|
+
return ne(this);
|
|
1904
1904
|
}
|
|
1905
1905
|
partial(e) {
|
|
1906
1906
|
const t = {};
|
|
@@ -2028,7 +2028,7 @@ ye.create = (n, e) => new ye({
|
|
|
2028
2028
|
..._(e)
|
|
2029
2029
|
});
|
|
2030
2030
|
const L = (n) => n instanceof ve ? L(n.schema) : n instanceof N ? L(n.innerType()) : n instanceof xe ? [n.value] : n instanceof q ? n.options : n instanceof be ? x.objectValues(n.enum) : n instanceof ke ? L(n._def.innerType) : n instanceof pe ? [void 0] : n instanceof me ? [null] : n instanceof I ? [void 0, ...L(n.unwrap())] : n instanceof W ? [null, ...L(n.unwrap())] : n instanceof Ye || n instanceof Te ? L(n.unwrap()) : n instanceof we ? L(n._def.innerType) : [];
|
|
2031
|
-
class
|
|
2031
|
+
class Pe extends v {
|
|
2032
2032
|
_parse(e) {
|
|
2033
2033
|
const { ctx: t } = this._processInputParams(e);
|
|
2034
2034
|
if (t.parsedType !== f.object)
|
|
@@ -2081,7 +2081,7 @@ class $e extends v {
|
|
|
2081
2081
|
r.set(o, a);
|
|
2082
2082
|
}
|
|
2083
2083
|
}
|
|
2084
|
-
return new
|
|
2084
|
+
return new Pe({
|
|
2085
2085
|
typeName: y.ZodDiscriminatedUnion,
|
|
2086
2086
|
discriminator: e,
|
|
2087
2087
|
options: t,
|
|
@@ -2090,14 +2090,14 @@ class $e extends v {
|
|
|
2090
2090
|
});
|
|
2091
2091
|
}
|
|
2092
2092
|
}
|
|
2093
|
-
function
|
|
2093
|
+
function Qe(n, e) {
|
|
2094
2094
|
const t = V(n), s = V(e);
|
|
2095
2095
|
if (n === e)
|
|
2096
2096
|
return { valid: !0, data: n };
|
|
2097
2097
|
if (t === f.object && s === f.object) {
|
|
2098
2098
|
const r = x.objectKeys(e), a = x.objectKeys(n).filter((o) => r.indexOf(o) !== -1), i = { ...n, ...e };
|
|
2099
2099
|
for (const o of a) {
|
|
2100
|
-
const c =
|
|
2100
|
+
const c = Qe(n[o], e[o]);
|
|
2101
2101
|
if (!c.valid)
|
|
2102
2102
|
return { valid: !1 };
|
|
2103
2103
|
i[o] = c.data;
|
|
@@ -2108,7 +2108,7 @@ function He(n, e) {
|
|
|
2108
2108
|
return { valid: !1 };
|
|
2109
2109
|
const r = [];
|
|
2110
2110
|
for (let a = 0; a < n.length; a++) {
|
|
2111
|
-
const i = n[a], o = e[a], c =
|
|
2111
|
+
const i = n[a], o = e[a], c = Qe(i, o);
|
|
2112
2112
|
if (!c.valid)
|
|
2113
2113
|
return { valid: !1 };
|
|
2114
2114
|
r.push(c.data);
|
|
@@ -2121,7 +2121,7 @@ class _e extends v {
|
|
|
2121
2121
|
const { status: t, ctx: s } = this._processInputParams(e), r = (a, i) => {
|
|
2122
2122
|
if (We(a) || We(i))
|
|
2123
2123
|
return m;
|
|
2124
|
-
const o =
|
|
2124
|
+
const o = Qe(a.value, i.value);
|
|
2125
2125
|
return o.valid ? ((Je(a) || Je(i)) && t.dirty(), { status: t.value, value: o.data }) : (l(s, {
|
|
2126
2126
|
code: d.invalid_intersection_types
|
|
2127
2127
|
}), m);
|
|
@@ -2245,7 +2245,7 @@ class ge extends v {
|
|
|
2245
2245
|
});
|
|
2246
2246
|
}
|
|
2247
2247
|
}
|
|
2248
|
-
class
|
|
2248
|
+
class je extends v {
|
|
2249
2249
|
get keySchema() {
|
|
2250
2250
|
return this._def.keyType;
|
|
2251
2251
|
}
|
|
@@ -2287,7 +2287,7 @@ class Ne extends v {
|
|
|
2287
2287
|
}
|
|
2288
2288
|
}
|
|
2289
2289
|
}
|
|
2290
|
-
|
|
2290
|
+
je.create = (n, e, t) => new je({
|
|
2291
2291
|
valueType: e,
|
|
2292
2292
|
keyType: n,
|
|
2293
2293
|
typeName: y.ZodMap,
|
|
@@ -2357,7 +2357,7 @@ X.create = (n, e) => new X({
|
|
|
2357
2357
|
typeName: y.ZodSet,
|
|
2358
2358
|
..._(e)
|
|
2359
2359
|
});
|
|
2360
|
-
class
|
|
2360
|
+
class re extends v {
|
|
2361
2361
|
constructor() {
|
|
2362
2362
|
super(...arguments), this.validate = this.implement;
|
|
2363
2363
|
}
|
|
@@ -2370,10 +2370,10 @@ class ae extends v {
|
|
|
2370
2370
|
received: t.parsedType
|
|
2371
2371
|
}), m;
|
|
2372
2372
|
function s(o, c) {
|
|
2373
|
-
return
|
|
2373
|
+
return Re({
|
|
2374
2374
|
data: o,
|
|
2375
2375
|
path: t.path,
|
|
2376
|
-
errorMaps: [t.common.contextualErrorMap, t.schemaErrorMap,
|
|
2376
|
+
errorMaps: [t.common.contextualErrorMap, t.schemaErrorMap, Ae(), ae].filter((u) => !!u),
|
|
2377
2377
|
issueData: {
|
|
2378
2378
|
code: d.invalid_arguments,
|
|
2379
2379
|
argumentsError: c
|
|
@@ -2381,10 +2381,10 @@ class ae extends v {
|
|
|
2381
2381
|
});
|
|
2382
2382
|
}
|
|
2383
2383
|
function r(o, c) {
|
|
2384
|
-
return
|
|
2384
|
+
return Re({
|
|
2385
2385
|
data: o,
|
|
2386
2386
|
path: t.path,
|
|
2387
|
-
errorMaps: [t.common.contextualErrorMap, t.schemaErrorMap,
|
|
2387
|
+
errorMaps: [t.common.contextualErrorMap, t.schemaErrorMap, Ae(), ae].filter((u) => !!u),
|
|
2388
2388
|
issueData: {
|
|
2389
2389
|
code: d.invalid_return_type,
|
|
2390
2390
|
returnTypeError: c
|
|
@@ -2392,7 +2392,7 @@ class ae extends v {
|
|
|
2392
2392
|
});
|
|
2393
2393
|
}
|
|
2394
2394
|
const a = { errorMap: t.common.contextualErrorMap }, i = t.data;
|
|
2395
|
-
if (this._def.returns instanceof
|
|
2395
|
+
if (this._def.returns instanceof oe) {
|
|
2396
2396
|
const o = this;
|
|
2397
2397
|
return S(async function(...c) {
|
|
2398
2398
|
const u = new O([]), p = await o._def.args.parseAsync(c, a).catch((w) => {
|
|
@@ -2422,13 +2422,13 @@ class ae extends v {
|
|
|
2422
2422
|
return this._def.returns;
|
|
2423
2423
|
}
|
|
2424
2424
|
args(...e) {
|
|
2425
|
-
return new
|
|
2425
|
+
return new re({
|
|
2426
2426
|
...this._def,
|
|
2427
2427
|
args: P.create(e).rest(Y.create())
|
|
2428
2428
|
});
|
|
2429
2429
|
}
|
|
2430
2430
|
returns(e) {
|
|
2431
|
-
return new
|
|
2431
|
+
return new re({
|
|
2432
2432
|
...this._def,
|
|
2433
2433
|
returns: e
|
|
2434
2434
|
});
|
|
@@ -2440,7 +2440,7 @@ class ae extends v {
|
|
|
2440
2440
|
return this.parse(e);
|
|
2441
2441
|
}
|
|
2442
2442
|
static create(e, t, s) {
|
|
2443
|
-
return new
|
|
2443
|
+
return new re({
|
|
2444
2444
|
args: e || P.create([]).rest(Y.create()),
|
|
2445
2445
|
returns: t || Y.create(),
|
|
2446
2446
|
typeName: y.ZodFunction,
|
|
@@ -2575,7 +2575,7 @@ be.create = (n, e) => new be({
|
|
|
2575
2575
|
typeName: y.ZodNativeEnum,
|
|
2576
2576
|
..._(e)
|
|
2577
2577
|
});
|
|
2578
|
-
class
|
|
2578
|
+
class oe extends v {
|
|
2579
2579
|
unwrap() {
|
|
2580
2580
|
return this._def.type;
|
|
2581
2581
|
}
|
|
@@ -2594,7 +2594,7 @@ class ce extends v {
|
|
|
2594
2594
|
})));
|
|
2595
2595
|
}
|
|
2596
2596
|
}
|
|
2597
|
-
|
|
2597
|
+
oe.create = (n, e) => new oe({
|
|
2598
2598
|
type: n,
|
|
2599
2599
|
typeName: y.ZodPromise,
|
|
2600
2600
|
..._(e)
|
|
@@ -2626,7 +2626,7 @@ class N extends v {
|
|
|
2626
2626
|
path: s.path,
|
|
2627
2627
|
parent: s
|
|
2628
2628
|
});
|
|
2629
|
-
return c.status === "aborted" ? m : c.status === "dirty" || t.value === "dirty" ?
|
|
2629
|
+
return c.status === "aborted" ? m : c.status === "dirty" || t.value === "dirty" ? se(c.value) : c;
|
|
2630
2630
|
});
|
|
2631
2631
|
{
|
|
2632
2632
|
if (t.value === "aborted")
|
|
@@ -2636,7 +2636,7 @@ class N extends v {
|
|
|
2636
2636
|
path: s.path,
|
|
2637
2637
|
parent: s
|
|
2638
2638
|
});
|
|
2639
|
-
return o.status === "aborted" ? m : o.status === "dirty" || t.value === "dirty" ?
|
|
2639
|
+
return o.status === "aborted" ? m : o.status === "dirty" || t.value === "dirty" ? se(o.value) : o;
|
|
2640
2640
|
}
|
|
2641
2641
|
}
|
|
2642
2642
|
if (r.type === "refinement") {
|
|
@@ -2780,7 +2780,7 @@ we.create = (n, e) => new we({
|
|
|
2780
2780
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2781
2781
|
..._(e)
|
|
2782
2782
|
});
|
|
2783
|
-
class
|
|
2783
|
+
class Ze extends v {
|
|
2784
2784
|
_parse(e) {
|
|
2785
2785
|
if (this._getType(e) !== f.nan) {
|
|
2786
2786
|
const s = this._getOrReturnCtx(e);
|
|
@@ -2793,7 +2793,7 @@ class je extends v {
|
|
|
2793
2793
|
return { status: "valid", value: e.data };
|
|
2794
2794
|
}
|
|
2795
2795
|
}
|
|
2796
|
-
|
|
2796
|
+
Ze.create = (n) => new Ze({
|
|
2797
2797
|
typeName: y.ZodNaN,
|
|
2798
2798
|
..._(n)
|
|
2799
2799
|
});
|
|
@@ -2821,7 +2821,7 @@ class Se extends v {
|
|
|
2821
2821
|
path: s.path,
|
|
2822
2822
|
parent: s
|
|
2823
2823
|
});
|
|
2824
|
-
return a.status === "aborted" ? m : a.status === "dirty" ? (t.dirty(),
|
|
2824
|
+
return a.status === "aborted" ? m : a.status === "dirty" ? (t.dirty(), se(a.value)) : this._def.out._parseAsync({
|
|
2825
2825
|
data: a.value,
|
|
2826
2826
|
path: s.path,
|
|
2827
2827
|
parent: s
|
|
@@ -2870,7 +2870,7 @@ function Xe(n, e) {
|
|
|
2870
2870
|
return typeof t == "string" ? { message: t } : t;
|
|
2871
2871
|
}
|
|
2872
2872
|
function ot(n, e = {}, t) {
|
|
2873
|
-
return n ?
|
|
2873
|
+
return n ? ie.create().superRefine((s, r) => {
|
|
2874
2874
|
const a = n(s);
|
|
2875
2875
|
if (a instanceof Promise)
|
|
2876
2876
|
return a.then((i) => {
|
|
@@ -2883,7 +2883,7 @@ function ot(n, e = {}, t) {
|
|
|
2883
2883
|
const i = Xe(e, s), o = i.fatal ?? t ?? !0;
|
|
2884
2884
|
r.addIssue({ code: "custom", ...i, fatal: o });
|
|
2885
2885
|
}
|
|
2886
|
-
}) :
|
|
2886
|
+
}) : ie.create();
|
|
2887
2887
|
}
|
|
2888
2888
|
const zt = {
|
|
2889
2889
|
object: k.lazycreate
|
|
@@ -2894,7 +2894,7 @@ var y;
|
|
|
2894
2894
|
})(y || (y = {}));
|
|
2895
2895
|
const Bt = (n, e = {
|
|
2896
2896
|
message: `Input not instance of ${n.name}`
|
|
2897
|
-
}) => ot((t) => t instanceof n, e), g = R.create, Ge = U.create, Ut =
|
|
2897
|
+
}) => ot((t) => t instanceof n, e), g = R.create, Ge = U.create, Ut = Ze.create, Ft = F.create, Ce = he.create, qt = K.create, Wt = Ee.create, Jt = pe.create, Qt = me.create, Ht = ie.create, Yt = Y.create, Gt = z.create, Kt = Ne.create, A = E.create, j = k.create, Xt = k.strictCreate, en = ye.create, tn = Pe.create, nn = _e.create, sn = P.create, ct = ge.create, rn = je.create, an = X.create, on = re.create, cn = ve.create, dn = xe.create, un = q.create, ln = be.create, fn = oe.create, et = N.create, hn = I.create, pn = W.create, mn = N.createWithPreprocess, yn = Se.create, _n = () => g().optional(), gn = () => Ge().optional(), vn = () => Ce().optional(), xn = {
|
|
2898
2898
|
string: ((n) => R.create({ ...n, coerce: !0 })),
|
|
2899
2899
|
number: ((n) => U.create({ ...n, coerce: !0 })),
|
|
2900
2900
|
boolean: ((n) => he.create({
|
|
@@ -2906,14 +2906,14 @@ const Bt = (n, e = {
|
|
|
2906
2906
|
}, bn = m, kn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2907
2907
|
__proto__: null,
|
|
2908
2908
|
BRAND: Vt,
|
|
2909
|
-
DIRTY:
|
|
2909
|
+
DIRTY: se,
|
|
2910
2910
|
EMPTY_PATH: gt,
|
|
2911
2911
|
INVALID: m,
|
|
2912
2912
|
NEVER: bn,
|
|
2913
2913
|
OK: S,
|
|
2914
2914
|
ParseStatus: T,
|
|
2915
2915
|
Schema: v,
|
|
2916
|
-
ZodAny:
|
|
2916
|
+
ZodAny: ie,
|
|
2917
2917
|
ZodArray: E,
|
|
2918
2918
|
ZodBigInt: F,
|
|
2919
2919
|
ZodBoolean: he,
|
|
@@ -2921,20 +2921,20 @@ const Bt = (n, e = {
|
|
|
2921
2921
|
ZodCatch: we,
|
|
2922
2922
|
ZodDate: K,
|
|
2923
2923
|
ZodDefault: ke,
|
|
2924
|
-
ZodDiscriminatedUnion:
|
|
2924
|
+
ZodDiscriminatedUnion: Pe,
|
|
2925
2925
|
ZodEffects: N,
|
|
2926
2926
|
ZodEnum: q,
|
|
2927
2927
|
ZodError: O,
|
|
2928
2928
|
get ZodFirstPartyTypeKind() {
|
|
2929
2929
|
return y;
|
|
2930
2930
|
},
|
|
2931
|
-
ZodFunction:
|
|
2931
|
+
ZodFunction: re,
|
|
2932
2932
|
ZodIntersection: _e,
|
|
2933
2933
|
ZodIssueCode: d,
|
|
2934
2934
|
ZodLazy: ve,
|
|
2935
2935
|
ZodLiteral: xe,
|
|
2936
|
-
ZodMap:
|
|
2937
|
-
ZodNaN:
|
|
2936
|
+
ZodMap: je,
|
|
2937
|
+
ZodNaN: Ze,
|
|
2938
2938
|
ZodNativeEnum: be,
|
|
2939
2939
|
ZodNever: z,
|
|
2940
2940
|
ZodNull: me,
|
|
@@ -2944,22 +2944,22 @@ const Bt = (n, e = {
|
|
|
2944
2944
|
ZodOptional: I,
|
|
2945
2945
|
ZodParsedType: f,
|
|
2946
2946
|
ZodPipeline: Se,
|
|
2947
|
-
ZodPromise:
|
|
2947
|
+
ZodPromise: oe,
|
|
2948
2948
|
ZodReadonly: Te,
|
|
2949
2949
|
ZodRecord: ge,
|
|
2950
2950
|
ZodSchema: v,
|
|
2951
2951
|
ZodSet: X,
|
|
2952
2952
|
ZodString: R,
|
|
2953
|
-
ZodSymbol:
|
|
2953
|
+
ZodSymbol: Ee,
|
|
2954
2954
|
ZodTransformer: N,
|
|
2955
2955
|
ZodTuple: P,
|
|
2956
2956
|
ZodType: v,
|
|
2957
2957
|
ZodUndefined: pe,
|
|
2958
2958
|
ZodUnion: ye,
|
|
2959
2959
|
ZodUnknown: Y,
|
|
2960
|
-
ZodVoid:
|
|
2960
|
+
ZodVoid: Ne,
|
|
2961
2961
|
addIssueToContext: l,
|
|
2962
|
-
any:
|
|
2962
|
+
any: Ht,
|
|
2963
2963
|
array: A,
|
|
2964
2964
|
bigint: Ft,
|
|
2965
2965
|
boolean: Ce,
|
|
@@ -2967,12 +2967,12 @@ const Bt = (n, e = {
|
|
|
2967
2967
|
custom: ot,
|
|
2968
2968
|
date: qt,
|
|
2969
2969
|
datetimeRegex: at,
|
|
2970
|
-
defaultErrorMap:
|
|
2970
|
+
defaultErrorMap: ae,
|
|
2971
2971
|
discriminatedUnion: tn,
|
|
2972
2972
|
effect: et,
|
|
2973
2973
|
enum: un,
|
|
2974
2974
|
function: on,
|
|
2975
|
-
getErrorMap:
|
|
2975
|
+
getErrorMap: Ae,
|
|
2976
2976
|
getParsedType: V,
|
|
2977
2977
|
instanceof: Bt,
|
|
2978
2978
|
intersection: nn,
|
|
@@ -2983,12 +2983,12 @@ const Bt = (n, e = {
|
|
|
2983
2983
|
late: zt,
|
|
2984
2984
|
lazy: cn,
|
|
2985
2985
|
literal: dn,
|
|
2986
|
-
makeIssue:
|
|
2986
|
+
makeIssue: Re,
|
|
2987
2987
|
map: rn,
|
|
2988
2988
|
nan: Ut,
|
|
2989
2989
|
nativeEnum: ln,
|
|
2990
2990
|
never: Gt,
|
|
2991
|
-
null:
|
|
2991
|
+
null: Qt,
|
|
2992
2992
|
nullable: pn,
|
|
2993
2993
|
number: Ge,
|
|
2994
2994
|
object: j,
|
|
@@ -3044,7 +3044,7 @@ const wn = (n, e) => e.skipDedupe || e.method !== "GET", Tn = (n, e) => e.method
|
|
|
3044
3044
|
let b = 0;
|
|
3045
3045
|
if (o && o(u, p))
|
|
3046
3046
|
return c(u, p);
|
|
3047
|
-
const C = (w, Z) => Promise.resolve(s(w, Z)).then((
|
|
3047
|
+
const C = (w, Z) => Promise.resolve(s(w, Z)).then((ce) => ce ? w && i ? w : Z ? Promise.reject(Z) : w : (b++, !t || b <= t ? new Promise((M) => {
|
|
3048
3048
|
const J = e(n, b);
|
|
3049
3049
|
setTimeout(() => {
|
|
3050
3050
|
typeof r == "function" ? Promise.resolve(r({
|
|
@@ -3054,8 +3054,8 @@ const wn = (n, e) => e.skipDedupe || e.method !== "GET", Tn = (n, e) => e.method
|
|
|
3054
3054
|
attempt: b,
|
|
3055
3055
|
options: p
|
|
3056
3056
|
})).then((D = {}) => {
|
|
3057
|
-
var ee,
|
|
3058
|
-
M(c((ee = D && D.url) !== null && ee !== void 0 ? ee : u, (
|
|
3057
|
+
var ee, Q;
|
|
3058
|
+
M(c((ee = D && D.url) !== null && ee !== void 0 ? ee : u, (Q = D && D.options) !== null && Q !== void 0 ? Q : p));
|
|
3059
3059
|
}) : M(c(u, p));
|
|
3060
3060
|
}, J);
|
|
3061
3061
|
}).then(C).catch((M) => {
|
|
@@ -3068,7 +3068,7 @@ const wn = (n, e) => e.skipDedupe || e.method !== "GET", Tn = (n, e) => e.method
|
|
|
3068
3068
|
throw w;
|
|
3069
3069
|
return C(null, w);
|
|
3070
3070
|
});
|
|
3071
|
-
},
|
|
3071
|
+
}, Ie = j({
|
|
3072
3072
|
code: Ge(),
|
|
3073
3073
|
message: g()
|
|
3074
3074
|
}), En = j({
|
|
@@ -3123,18 +3123,19 @@ const wn = (n, e) => e.skipDedupe || e.method !== "GET", Tn = (n, e) => e.method
|
|
|
3123
3123
|
status: g(),
|
|
3124
3124
|
verification_errors: A(g()).optional(),
|
|
3125
3125
|
created_at: g()
|
|
3126
|
-
}),
|
|
3127
|
-
errors: A(
|
|
3128
|
-
messages: A(
|
|
3126
|
+
}), Oe = j({
|
|
3127
|
+
errors: A(Ie),
|
|
3128
|
+
messages: A(Ie),
|
|
3129
3129
|
success: Ce(),
|
|
3130
3130
|
result: dt
|
|
3131
|
-
})
|
|
3132
|
-
|
|
3133
|
-
|
|
3131
|
+
});
|
|
3132
|
+
j({
|
|
3133
|
+
errors: A(Ie),
|
|
3134
|
+
messages: A(Ie),
|
|
3134
3135
|
success: Ce(),
|
|
3135
3136
|
result: A(dt)
|
|
3136
3137
|
});
|
|
3137
|
-
function
|
|
3138
|
+
function te(n) {
|
|
3138
3139
|
return ft(`https://api.cloudflare.com/client/v4/zones/${n.zoneId}`).headers({
|
|
3139
3140
|
"X-Auth-Email": n.authEmail,
|
|
3140
3141
|
"X-Auth-Key": n.authKey,
|
|
@@ -3165,11 +3166,11 @@ function Fe(n) {
|
|
|
3165
3166
|
}
|
|
3166
3167
|
};
|
|
3167
3168
|
}
|
|
3168
|
-
function
|
|
3169
|
+
function Pn(n) {
|
|
3169
3170
|
return {
|
|
3170
3171
|
create: async (e, t) => {
|
|
3171
|
-
const { result: s, errors: r, success: a } =
|
|
3172
|
-
await
|
|
3172
|
+
const { result: s, errors: r, success: a } = Oe.parse(
|
|
3173
|
+
await te(n).post(
|
|
3173
3174
|
{
|
|
3174
3175
|
hostname: t.domain,
|
|
3175
3176
|
ssl: {
|
|
@@ -3201,52 +3202,53 @@ function Mn(n) {
|
|
|
3201
3202
|
t
|
|
3202
3203
|
);
|
|
3203
3204
|
if (!s)
|
|
3204
|
-
throw new
|
|
3205
|
-
const r = await
|
|
3205
|
+
throw new le(404);
|
|
3206
|
+
const r = await te(n).get(`/custom_hostnames/${encodeURIComponent(t)}`).json(), { result: a, errors: i, success: o } = Oe.parse(r);
|
|
3206
3207
|
if (!o)
|
|
3207
|
-
throw new
|
|
3208
|
+
throw new le(503, {
|
|
3208
3209
|
message: JSON.stringify(i)
|
|
3209
3210
|
});
|
|
3210
3211
|
if (n.enterprise && a.custom_metadata?.tenant_id !== e)
|
|
3211
|
-
throw new
|
|
3212
|
+
throw new le(404);
|
|
3212
3213
|
return Fe({ ...s, ...a });
|
|
3213
3214
|
},
|
|
3214
3215
|
getByDomain: async (e) => n.customDomainAdapter.getByDomain(e),
|
|
3215
3216
|
list: async (e) => {
|
|
3216
|
-
const t = await n.customDomainAdapter.list(e)
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3217
|
+
const t = await n.customDomainAdapter.list(e);
|
|
3218
|
+
return (await Promise.all(
|
|
3219
|
+
t.map(async (r) => {
|
|
3220
|
+
try {
|
|
3221
|
+
const a = await te(n).get(
|
|
3222
|
+
`/custom_hostnames/${encodeURIComponent(r.custom_domain_id)}`
|
|
3223
|
+
).json(), { result: i, success: o } = Oe.parse(a);
|
|
3224
|
+
return !o || n.enterprise && i.custom_metadata?.tenant_id !== e ? null : Fe({
|
|
3225
|
+
...r,
|
|
3226
|
+
...i
|
|
3227
|
+
});
|
|
3228
|
+
} catch {
|
|
3229
|
+
return null;
|
|
3230
|
+
}
|
|
3229
3231
|
})
|
|
3230
|
-
);
|
|
3232
|
+
)).filter((r) => r !== null);
|
|
3231
3233
|
},
|
|
3232
3234
|
remove: async (e, t) => {
|
|
3233
3235
|
if (n.enterprise) {
|
|
3234
|
-
const { result: r, success: a } =
|
|
3235
|
-
await
|
|
3236
|
+
const { result: r, success: a } = Oe.parse(
|
|
3237
|
+
await te(n).get(`/custom_hostnames/${encodeURIComponent(t)}`).json()
|
|
3236
3238
|
);
|
|
3237
3239
|
if (!a || r.custom_metadata?.tenant_id !== e)
|
|
3238
|
-
throw new
|
|
3240
|
+
throw new le(404);
|
|
3239
3241
|
}
|
|
3240
|
-
const s = await
|
|
3242
|
+
const s = await te(n).delete(`/custom_hostnames/${encodeURIComponent(t)}`).res();
|
|
3241
3243
|
return s.ok && await n.customDomainAdapter.remove(e, t), s.ok;
|
|
3242
3244
|
},
|
|
3243
3245
|
update: async (e, t, s) => {
|
|
3244
|
-
const r = await
|
|
3246
|
+
const r = await te(n).patch(
|
|
3245
3247
|
s,
|
|
3246
3248
|
`/custom_hostnames/${encodeURIComponent(t)}`
|
|
3247
3249
|
).res();
|
|
3248
3250
|
if (!r.ok)
|
|
3249
|
-
throw new
|
|
3251
|
+
throw new le(503, {
|
|
3250
3252
|
message: await r.text()
|
|
3251
3253
|
});
|
|
3252
3254
|
return n.customDomainAdapter.update(
|
|
@@ -3257,7 +3259,7 @@ function Mn(n) {
|
|
|
3257
3259
|
}
|
|
3258
3260
|
};
|
|
3259
3261
|
}
|
|
3260
|
-
class
|
|
3262
|
+
class Mn {
|
|
3261
3263
|
constructor(e) {
|
|
3262
3264
|
this.config = e;
|
|
3263
3265
|
}
|
|
@@ -3320,7 +3322,7 @@ class Dn {
|
|
|
3320
3322
|
);
|
|
3321
3323
|
}
|
|
3322
3324
|
}
|
|
3323
|
-
function
|
|
3325
|
+
function Dn(n = {}) {
|
|
3324
3326
|
const e = {
|
|
3325
3327
|
defaultTtlSeconds: 300,
|
|
3326
3328
|
// 5 minutes default
|
|
@@ -3329,16 +3331,16 @@ function Ln(n = {}) {
|
|
|
3329
3331
|
...n
|
|
3330
3332
|
// user config overrides defaults
|
|
3331
3333
|
};
|
|
3332
|
-
return new
|
|
3334
|
+
return new Mn(e);
|
|
3333
3335
|
}
|
|
3334
|
-
const
|
|
3335
|
-
let
|
|
3336
|
+
const Ln = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
3337
|
+
let Vn = (n = 21) => {
|
|
3336
3338
|
let e = "", t = crypto.getRandomValues(new Uint8Array(n |= 0));
|
|
3337
3339
|
for (; n--; )
|
|
3338
|
-
e +=
|
|
3340
|
+
e += Ln[t[n] & 63];
|
|
3339
3341
|
return e;
|
|
3340
3342
|
};
|
|
3341
|
-
async function
|
|
3343
|
+
async function He(n, e) {
|
|
3342
3344
|
const t = n.timeout || 3e4, s = new AbortController(), r = setTimeout(() => s.abort(), t);
|
|
3343
3345
|
try {
|
|
3344
3346
|
const a = `https://api.sql.cloudflarestorage.com/api/v1/accounts/${n.accountId}/r2-sql/query/${n.warehouseName}`, i = await fetch(a, {
|
|
@@ -3365,7 +3367,7 @@ async function Qe(n, e) {
|
|
|
3365
3367
|
clearTimeout(r);
|
|
3366
3368
|
}
|
|
3367
3369
|
}
|
|
3368
|
-
function
|
|
3370
|
+
function $e(n) {
|
|
3369
3371
|
return `'${n.replace(/'/g, "''")}'`;
|
|
3370
3372
|
}
|
|
3371
3373
|
function B(n) {
|
|
@@ -3413,7 +3415,7 @@ function ut(n) {
|
|
|
3413
3415
|
} : void 0
|
|
3414
3416
|
};
|
|
3415
3417
|
}
|
|
3416
|
-
function
|
|
3418
|
+
function zn(n) {
|
|
3417
3419
|
return async (e, t) => {
|
|
3418
3420
|
if (console.log("createLog called with config:", n), n.baseAdapter) {
|
|
3419
3421
|
const a = await n.baseAdapter.create(e, t);
|
|
@@ -3421,7 +3423,7 @@ function Bn(n) {
|
|
|
3421
3423
|
console.error("Failed to send log to Pipeline:", i);
|
|
3422
3424
|
}), a;
|
|
3423
3425
|
}
|
|
3424
|
-
const s = t.log_id ||
|
|
3426
|
+
const s = t.log_id || Vn(), r = {
|
|
3425
3427
|
...t,
|
|
3426
3428
|
log_id: s
|
|
3427
3429
|
};
|
|
@@ -3490,62 +3492,62 @@ async function tt(n, e, t) {
|
|
|
3490
3492
|
throw console.error("Failed to send log to Pipeline:", a), a;
|
|
3491
3493
|
}
|
|
3492
3494
|
}
|
|
3493
|
-
function
|
|
3495
|
+
function Bn(n) {
|
|
3494
3496
|
return async (e, t) => {
|
|
3495
3497
|
if (n.baseAdapter)
|
|
3496
3498
|
return n.baseAdapter.get(e, t);
|
|
3497
3499
|
const s = n.namespace || "default", r = n.tableName || "logs", a = `
|
|
3498
3500
|
SELECT * FROM ${B(s)}.${B(r)}
|
|
3499
|
-
WHERE tenant_id = ${
|
|
3500
|
-
AND id = ${
|
|
3501
|
+
WHERE tenant_id = ${$e(e)}
|
|
3502
|
+
AND id = ${$e(t)}
|
|
3501
3503
|
LIMIT 1
|
|
3502
|
-
`, i = await
|
|
3504
|
+
`, i = await He(n, a);
|
|
3503
3505
|
if (i.length === 0)
|
|
3504
3506
|
return null;
|
|
3505
3507
|
const o = i[0];
|
|
3506
3508
|
return o ? ut(o) : null;
|
|
3507
3509
|
};
|
|
3508
3510
|
}
|
|
3509
|
-
function
|
|
3511
|
+
function Un(n) {
|
|
3510
3512
|
const e = {};
|
|
3511
3513
|
return (n.match(/(\w+):(\S+)/g) || []).forEach((s) => {
|
|
3512
3514
|
const [r, a] = s.split(":");
|
|
3513
3515
|
r && a && (e[r] = a);
|
|
3514
3516
|
}), e;
|
|
3515
3517
|
}
|
|
3516
|
-
function
|
|
3518
|
+
function Fn(n) {
|
|
3517
3519
|
const e = [];
|
|
3518
3520
|
for (const [t, s] of Object.entries(n)) {
|
|
3519
3521
|
const r = t.replace(/[^a-zA-Z0-9_]/g, "");
|
|
3520
3522
|
r && s && e.push(
|
|
3521
|
-
`${B(r)} = ${
|
|
3523
|
+
`${B(r)} = ${$e(s)}`
|
|
3522
3524
|
);
|
|
3523
3525
|
}
|
|
3524
3526
|
return e;
|
|
3525
3527
|
}
|
|
3526
|
-
function
|
|
3528
|
+
function qn(n) {
|
|
3527
3529
|
return async (e, t = {}) => {
|
|
3528
3530
|
if (n.baseAdapter)
|
|
3529
3531
|
return n.baseAdapter.list(e, t);
|
|
3530
3532
|
const { page: s = 0, per_page: r = 50, include_totals: a = !1, sort: i, q: o } = t, c = n.namespace || "default", u = n.tableName || "logs", p = [
|
|
3531
|
-
`tenant_id = ${
|
|
3533
|
+
`tenant_id = ${$e(e)}`
|
|
3532
3534
|
];
|
|
3533
3535
|
if (o) {
|
|
3534
|
-
const
|
|
3535
|
-
p.push(...
|
|
3536
|
+
const H = Un(o);
|
|
3537
|
+
p.push(...Fn(H));
|
|
3536
3538
|
}
|
|
3537
3539
|
const b = p.join(" AND ");
|
|
3538
3540
|
let C = "ORDER BY date DESC";
|
|
3539
3541
|
if (i && i.sort_by) {
|
|
3540
|
-
const
|
|
3541
|
-
C = `ORDER BY ${B(
|
|
3542
|
+
const H = i.sort_by.replace(/[^a-zA-Z0-9_]/g, ""), de = i.sort_order === "asc" ? "ASC" : "DESC";
|
|
3543
|
+
C = `ORDER BY ${B(H)} ${de}`;
|
|
3542
3544
|
}
|
|
3543
|
-
const w = s * r, Z = `LIMIT ${r} OFFSET ${w}`,
|
|
3545
|
+
const w = s * r, Z = `LIMIT ${r} OFFSET ${w}`, ce = `
|
|
3544
3546
|
SELECT * FROM ${B(c)}.${B(u)}
|
|
3545
3547
|
WHERE ${b}
|
|
3546
3548
|
${C}
|
|
3547
3549
|
${Z}
|
|
3548
|
-
`, J = (await
|
|
3550
|
+
`, J = (await He(n, ce)).map(ut);
|
|
3549
3551
|
if (!a)
|
|
3550
3552
|
return {
|
|
3551
3553
|
logs: J,
|
|
@@ -3556,16 +3558,16 @@ function Wn(n) {
|
|
|
3556
3558
|
const D = `
|
|
3557
3559
|
SELECT COUNT(*) as count FROM ${B(c)}.${B(u)}
|
|
3558
3560
|
WHERE ${b}
|
|
3559
|
-
`,
|
|
3561
|
+
`, Q = (await He(n, D))[0]?.count || 0;
|
|
3560
3562
|
return {
|
|
3561
3563
|
logs: J,
|
|
3562
3564
|
start: w,
|
|
3563
3565
|
limit: r,
|
|
3564
|
-
length: Number(
|
|
3566
|
+
length: Number(Q)
|
|
3565
3567
|
};
|
|
3566
3568
|
};
|
|
3567
3569
|
}
|
|
3568
|
-
function
|
|
3570
|
+
function Wn(n) {
|
|
3569
3571
|
const e = !!n.baseAdapter, t = !!n.pipelineEndpoint, s = !!n.pipelineBinding;
|
|
3570
3572
|
if (!e && !t && !s)
|
|
3571
3573
|
throw new Error(
|
|
@@ -3580,23 +3582,23 @@ function Jn(n) {
|
|
|
3580
3582
|
);
|
|
3581
3583
|
}
|
|
3582
3584
|
return {
|
|
3583
|
-
create:
|
|
3584
|
-
list:
|
|
3585
|
-
get:
|
|
3585
|
+
create: zn(n),
|
|
3586
|
+
list: qn(n),
|
|
3587
|
+
get: Bn(n)
|
|
3586
3588
|
};
|
|
3587
3589
|
}
|
|
3588
|
-
function
|
|
3590
|
+
function Jn() {
|
|
3589
3591
|
return {
|
|
3590
|
-
async getGeoInfo() {
|
|
3592
|
+
async getGeoInfo(n) {
|
|
3591
3593
|
try {
|
|
3592
|
-
const e = n
|
|
3593
|
-
return
|
|
3594
|
-
country_code:
|
|
3595
|
-
city_name:
|
|
3596
|
-
latitude:
|
|
3597
|
-
longitude:
|
|
3598
|
-
time_zone:
|
|
3599
|
-
continent_code:
|
|
3594
|
+
const e = n["cf-ipcountry"], t = n["cf-ipcity"], s = n["cf-iplatitude"], r = n["cf-iplongitude"], a = n["cf-timezone"], i = n["cf-ipcontinent"];
|
|
3595
|
+
return e ? {
|
|
3596
|
+
country_code: e,
|
|
3597
|
+
city_name: t || "",
|
|
3598
|
+
latitude: s || "",
|
|
3599
|
+
longitude: r || "",
|
|
3600
|
+
time_zone: a || "",
|
|
3601
|
+
continent_code: i || ""
|
|
3600
3602
|
} : null;
|
|
3601
3603
|
} catch (e) {
|
|
3602
3604
|
return console.warn("Failed to get geo info from Cloudflare headers:", e), null;
|
|
@@ -3604,22 +3606,23 @@ function Hn(n) {
|
|
|
3604
3606
|
}
|
|
3605
3607
|
};
|
|
3606
3608
|
}
|
|
3607
|
-
function
|
|
3609
|
+
function Yn(n) {
|
|
3608
3610
|
const e = {
|
|
3609
|
-
customDomains:
|
|
3611
|
+
customDomains: Pn(n),
|
|
3610
3612
|
// Always create a cache adapter (let createCloudflareCache apply defaults)
|
|
3611
|
-
cache:
|
|
3613
|
+
cache: Dn({
|
|
3612
3614
|
...n.cacheName && { cacheName: n.cacheName },
|
|
3613
3615
|
...n.defaultTtlSeconds !== void 0 && {
|
|
3614
3616
|
defaultTtlSeconds: n.defaultTtlSeconds
|
|
3615
3617
|
},
|
|
3616
3618
|
...n.keyPrefix && { keyPrefix: n.keyPrefix }
|
|
3617
|
-
})
|
|
3619
|
+
}),
|
|
3620
|
+
// Always create the geo adapter - it extracts location from Cloudflare headers
|
|
3621
|
+
// passed at request time via getGeoInfo(headers)
|
|
3622
|
+
geo: Jn()
|
|
3618
3623
|
};
|
|
3619
|
-
return n.r2SqlLogs && (e.logs =
|
|
3620
|
-
getHeaders: n.getHeaders
|
|
3621
|
-
})), e;
|
|
3624
|
+
return n.r2SqlLogs && (e.logs = Wn(n.r2SqlLogs)), e;
|
|
3622
3625
|
}
|
|
3623
3626
|
export {
|
|
3624
|
-
|
|
3627
|
+
Yn as default
|
|
3625
3628
|
};
|