@authhero/cloudflare-adapter 3.0.4 → 3.0.5
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 +34 -34
- package/dist/cloudflare-adapter.mjs +207 -181
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -63,8 +63,7 @@ var f = s.object({
|
|
|
63
63
|
messages: s.array(f),
|
|
64
64
|
success: s.boolean(),
|
|
65
65
|
result: v
|
|
66
|
-
})
|
|
67
|
-
s.object({
|
|
66
|
+
}), te = s.object({
|
|
68
67
|
errors: s.array(f),
|
|
69
68
|
messages: s.array(f),
|
|
70
69
|
success: s.boolean(),
|
|
@@ -127,35 +126,62 @@ function S(e) {
|
|
|
127
126
|
domain_metadata: n
|
|
128
127
|
};
|
|
129
128
|
}
|
|
130
|
-
function
|
|
129
|
+
function C(e) {
|
|
130
|
+
let t = e instanceof Error ? e.message : String(e);
|
|
131
|
+
return /duplicate/i.test(t);
|
|
132
|
+
}
|
|
133
|
+
async function ne(e, t, n) {
|
|
134
|
+
let r;
|
|
135
|
+
try {
|
|
136
|
+
r = await b(e).get(`/custom_hostnames?hostname=${encodeURIComponent(n)}`).json();
|
|
137
|
+
} catch {
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
let i = te.safeParse(r);
|
|
141
|
+
if (!i.success || !i.data.success) return null;
|
|
142
|
+
let a = i.data.result.find((e) => e.hostname.toLowerCase() === n.toLowerCase());
|
|
143
|
+
return !a || e.enterprise && a.custom_metadata?.tenant_id !== t ? null : a;
|
|
144
|
+
}
|
|
145
|
+
function re(e) {
|
|
131
146
|
return {
|
|
132
147
|
create: async (t, n) => {
|
|
133
|
-
let { sslOverrides: r, rest: i } = x(n.domain_metadata)
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
148
|
+
let { sslOverrides: r, rest: i } = x(n.domain_metadata);
|
|
149
|
+
if (await e.customDomainAdapter.getByDomain(n.domain)) throw new c(409, { message: `The domain ${n.domain} is already registered` });
|
|
150
|
+
let a;
|
|
151
|
+
try {
|
|
152
|
+
let i = y.parse(await b(e).post({
|
|
153
|
+
hostname: n.domain,
|
|
154
|
+
ssl: {
|
|
155
|
+
method: "txt",
|
|
156
|
+
type: "dv",
|
|
157
|
+
...r
|
|
158
|
+
},
|
|
159
|
+
custom_metadata: e.enterprise ? { tenant_id: t } : void 0
|
|
160
|
+
}, "/custom_hostnames").json());
|
|
161
|
+
if (!i.success) throw Error(JSON.stringify(i.errors));
|
|
162
|
+
a = i.result;
|
|
163
|
+
} catch (r) {
|
|
164
|
+
if (!C(r)) throw r;
|
|
165
|
+
let i = await ne(e, t, n.domain);
|
|
166
|
+
if (!i) throw r;
|
|
167
|
+
a = i;
|
|
168
|
+
}
|
|
169
|
+
let o = S({
|
|
144
170
|
...a,
|
|
145
171
|
primary: !1,
|
|
146
172
|
type: n.type,
|
|
147
173
|
domain_metadata: i
|
|
148
174
|
});
|
|
149
175
|
return await e.customDomainAdapter.create(t, {
|
|
150
|
-
custom_domain_id:
|
|
151
|
-
domain:
|
|
152
|
-
type:
|
|
176
|
+
custom_domain_id: o.custom_domain_id,
|
|
177
|
+
domain: o.domain,
|
|
178
|
+
type: o.type,
|
|
153
179
|
domain_metadata: n.domain_metadata
|
|
154
|
-
}), await e.customDomainAdapter.update(t,
|
|
155
|
-
status:
|
|
156
|
-
primary:
|
|
157
|
-
verification:
|
|
158
|
-
}),
|
|
180
|
+
}), await e.customDomainAdapter.update(t, o.custom_domain_id, {
|
|
181
|
+
status: o.status,
|
|
182
|
+
primary: o.primary,
|
|
183
|
+
verification: o.verification
|
|
184
|
+
}), o;
|
|
159
185
|
},
|
|
160
186
|
get: async (t, n) => {
|
|
161
187
|
let r = await e.customDomainAdapter.get(t, n);
|
|
@@ -249,7 +275,7 @@ function te(e) {
|
|
|
249
275
|
}
|
|
250
276
|
//#endregion
|
|
251
277
|
//#region src/cache/index.ts
|
|
252
|
-
var
|
|
278
|
+
var ie = class {
|
|
253
279
|
config;
|
|
254
280
|
cache = null;
|
|
255
281
|
constructor(e) {
|
|
@@ -323,8 +349,8 @@ var ne = class {
|
|
|
323
349
|
console.warn("CloudflareCache.clear() is not implemented - Cloudflare Cache API does not support clearing all entries");
|
|
324
350
|
}
|
|
325
351
|
};
|
|
326
|
-
function
|
|
327
|
-
return new
|
|
352
|
+
function ae(e = {}) {
|
|
353
|
+
return new ie({
|
|
328
354
|
defaultTtlSeconds: 300,
|
|
329
355
|
keyPrefix: "authhero",
|
|
330
356
|
getTimeoutMs: 200,
|
|
@@ -333,9 +359,9 @@ function re(e = {}) {
|
|
|
333
359
|
}
|
|
334
360
|
//#endregion
|
|
335
361
|
//#region ../../node_modules/.pnpm/nanoid@5.1.11/node_modules/nanoid/url-alphabet/index.js
|
|
336
|
-
var
|
|
362
|
+
var oe = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", w = (e = 21) => {
|
|
337
363
|
let t = "", n = crypto.getRandomValues(new Uint8Array(e |= 0));
|
|
338
|
-
for (; e--;) t +=
|
|
364
|
+
for (; e--;) t += oe[n[e] & 63];
|
|
339
365
|
return t;
|
|
340
366
|
};
|
|
341
367
|
//#endregion
|
|
@@ -408,16 +434,16 @@ function O(e) {
|
|
|
408
434
|
} : void 0
|
|
409
435
|
};
|
|
410
436
|
}
|
|
411
|
-
function
|
|
437
|
+
function se(e) {
|
|
412
438
|
return async (t, n) => {
|
|
413
439
|
let r = n.log_id || w(), i = {
|
|
414
440
|
...n,
|
|
415
441
|
log_id: r
|
|
416
442
|
};
|
|
417
|
-
return await
|
|
443
|
+
return await ce(e, t, i), i;
|
|
418
444
|
};
|
|
419
445
|
}
|
|
420
|
-
async function
|
|
446
|
+
async function ce(e, t, n) {
|
|
421
447
|
let r = (e) => e ? JSON.stringify(e) : void 0, i = {
|
|
422
448
|
id: n.log_id,
|
|
423
449
|
tenant_id: t,
|
|
@@ -468,7 +494,7 @@ async function ae(e, t, n) {
|
|
|
468
494
|
throw console.error("Failed to send log to Pipeline:", e), e;
|
|
469
495
|
}
|
|
470
496
|
}
|
|
471
|
-
function
|
|
497
|
+
function le(e) {
|
|
472
498
|
return async (t, n) => {
|
|
473
499
|
let r = e.namespace || "default", i = e.tableName || "logs", a = await T(e, `
|
|
474
500
|
SELECT * FROM ${D(r)}.${D(i)}
|
|
@@ -483,7 +509,7 @@ function k(e) {
|
|
|
483
509
|
}
|
|
484
510
|
//#endregion
|
|
485
511
|
//#region src/r2-sql-logs/list.ts
|
|
486
|
-
function
|
|
512
|
+
function ue(e) {
|
|
487
513
|
let t = {}, n = /(\w+):(?:"([^"]*)"|(\S+))/g, r;
|
|
488
514
|
for (; (r = n.exec(e)) !== null;) {
|
|
489
515
|
let e = r[1], n = r[2] === void 0 ? r[3] : r[2];
|
|
@@ -491,7 +517,7 @@ function oe(e) {
|
|
|
491
517
|
}
|
|
492
518
|
return t;
|
|
493
519
|
}
|
|
494
|
-
function
|
|
520
|
+
function de(e) {
|
|
495
521
|
let t = [];
|
|
496
522
|
for (let [n, r] of Object.entries(e)) {
|
|
497
523
|
let e = n.replace(/[^a-zA-Z0-9_]/g, "");
|
|
@@ -499,12 +525,12 @@ function se(e) {
|
|
|
499
525
|
}
|
|
500
526
|
return t;
|
|
501
527
|
}
|
|
502
|
-
function
|
|
528
|
+
function fe(e) {
|
|
503
529
|
return async (t, n = {}) => {
|
|
504
530
|
let { page: r = 0, per_page: i = 50, include_totals: a = !1, sort: o, q: s } = n, c = e.namespace || "default", l = e.tableName || "logs", u = [`tenant_id = ${E(t)}`];
|
|
505
531
|
if (s) {
|
|
506
|
-
let e =
|
|
507
|
-
u.push(...
|
|
532
|
+
let e = ue(s);
|
|
533
|
+
u.push(...de(e));
|
|
508
534
|
}
|
|
509
535
|
let d = u.join(" AND "), f = "ORDER BY date DESC";
|
|
510
536
|
if (o && o.sort_by) {
|
|
@@ -537,7 +563,7 @@ function ce(e) {
|
|
|
537
563
|
}
|
|
538
564
|
//#endregion
|
|
539
565
|
//#region src/r2-sql-logs/stats.ts
|
|
540
|
-
function
|
|
566
|
+
function pe() {
|
|
541
567
|
return {
|
|
542
568
|
async getDaily() {
|
|
543
569
|
throw Error("Stats queries are not supported by R2 SQL logs adapter. Use Analytics Engine or Kysely adapter instead.");
|
|
@@ -549,20 +575,20 @@ function le() {
|
|
|
549
575
|
}
|
|
550
576
|
//#endregion
|
|
551
577
|
//#region src/r2-sql-logs/index.ts
|
|
552
|
-
function
|
|
578
|
+
function k(e) {
|
|
553
579
|
let t = !!e.pipelineEndpoint, n = !!e.pipelineBinding;
|
|
554
580
|
if (!t && !n) throw Error("R2 SQL logs adapter requires one of: \"pipelineEndpoint\" or \"pipelineBinding\"");
|
|
555
581
|
if (!e.authToken) throw Error("R2 SQL logs adapter requires \"authToken\" configuration");
|
|
556
582
|
if (!e.warehouseName) throw Error("R2 SQL logs adapter requires \"warehouseName\" configuration");
|
|
557
583
|
return {
|
|
558
|
-
create:
|
|
559
|
-
list:
|
|
560
|
-
get:
|
|
584
|
+
create: se(e),
|
|
585
|
+
list: fe(e),
|
|
586
|
+
get: le(e)
|
|
561
587
|
};
|
|
562
588
|
}
|
|
563
589
|
//#endregion
|
|
564
590
|
//#region src/analytics-engine-logs/query.ts
|
|
565
|
-
async function
|
|
591
|
+
async function A(e, t) {
|
|
566
592
|
let n = e.timeout || 3e4, r = new AbortController(), i = setTimeout(() => r.abort(), n);
|
|
567
593
|
try {
|
|
568
594
|
let n = `https://api.cloudflare.com/client/v4/accounts/${e.accountId}/analytics_engine/sql`, i = await fetch(n, {
|
|
@@ -585,15 +611,15 @@ async function j(e, t) {
|
|
|
585
611
|
clearTimeout(i);
|
|
586
612
|
}
|
|
587
613
|
}
|
|
588
|
-
function
|
|
614
|
+
function j(e) {
|
|
589
615
|
return `'${e.replace(/'/g, "''").replace(/\\/g, "\\\\")}'`;
|
|
590
616
|
}
|
|
591
|
-
function
|
|
617
|
+
function M(e) {
|
|
592
618
|
return `"${e.replace(/"/g, "\"\"")}"`;
|
|
593
619
|
}
|
|
594
620
|
//#endregion
|
|
595
621
|
//#region src/analytics-engine-logs/logs.ts
|
|
596
|
-
function
|
|
622
|
+
function N(e) {
|
|
597
623
|
let t = (e) => {
|
|
598
624
|
if (e) try {
|
|
599
625
|
return JSON.parse(e);
|
|
@@ -625,16 +651,16 @@ function P(e) {
|
|
|
625
651
|
isMobile: e.double1 === 1
|
|
626
652
|
};
|
|
627
653
|
}
|
|
628
|
-
function
|
|
654
|
+
function me(e) {
|
|
629
655
|
return async (t, n) => {
|
|
630
656
|
let r = n.log_id || w(), i = {
|
|
631
657
|
...n,
|
|
632
658
|
log_id: r
|
|
633
659
|
};
|
|
634
|
-
return
|
|
660
|
+
return he(e, t, i), i;
|
|
635
661
|
};
|
|
636
662
|
}
|
|
637
|
-
function
|
|
663
|
+
function he(e, t, n) {
|
|
638
664
|
if (!e.analyticsEngineBinding) {
|
|
639
665
|
console.error("Analytics Engine binding not configured");
|
|
640
666
|
return;
|
|
@@ -671,24 +697,24 @@ function de(e, t, n) {
|
|
|
671
697
|
console.error("Failed to write log to Analytics Engine:", e);
|
|
672
698
|
}
|
|
673
699
|
}
|
|
674
|
-
function
|
|
700
|
+
function P(e) {
|
|
675
701
|
return async (t, n) => {
|
|
676
|
-
let r = await
|
|
702
|
+
let r = await A(e, `
|
|
677
703
|
SELECT *
|
|
678
|
-
FROM ${
|
|
679
|
-
WHERE index1 = ${
|
|
680
|
-
AND blob1 = ${
|
|
704
|
+
FROM ${M(e.dataset || "authhero_logs")}
|
|
705
|
+
WHERE index1 = ${j(t)}
|
|
706
|
+
AND blob1 = ${j(n)}
|
|
681
707
|
LIMIT 1
|
|
682
708
|
`);
|
|
683
|
-
return r.length === 0 || !r[0] ? null :
|
|
709
|
+
return r.length === 0 || !r[0] ? null : N(r[0]);
|
|
684
710
|
};
|
|
685
711
|
}
|
|
686
712
|
//#endregion
|
|
687
713
|
//#region src/analytics-engine-logs/list.ts
|
|
688
|
-
function
|
|
714
|
+
function F(e) {
|
|
689
715
|
return e.replace(/\\([\\"+\-!(){}[\]^~*?:/&|])/g, "$1");
|
|
690
716
|
}
|
|
691
|
-
function
|
|
717
|
+
function I(e) {
|
|
692
718
|
let t = [], n = "", r = !1;
|
|
693
719
|
for (let i = 0; i < e.length; i++) {
|
|
694
720
|
let a = e[i];
|
|
@@ -696,20 +722,20 @@ function me(e) {
|
|
|
696
722
|
}
|
|
697
723
|
return n.trim() && t.push(n.trim()), t;
|
|
698
724
|
}
|
|
699
|
-
function
|
|
725
|
+
function L(e) {
|
|
700
726
|
let t = e;
|
|
701
|
-
return t.startsWith("\"") && t.endsWith("\"") && t.length > 1 && (t = t.slice(1, -1)),
|
|
727
|
+
return t.startsWith("\"") && t.endsWith("\"") && t.length > 1 && (t = t.slice(1, -1)), F(t);
|
|
702
728
|
}
|
|
703
|
-
function
|
|
729
|
+
function R(e) {
|
|
704
730
|
let t = {}, n = [];
|
|
705
|
-
for (let r of
|
|
731
|
+
for (let r of I(e)) {
|
|
706
732
|
if (r === "OR" || r === "AND") continue;
|
|
707
733
|
let e = r.match(/^(\w+):([\s\S]*)$/);
|
|
708
734
|
if (e) {
|
|
709
|
-
let n = e[1], r =
|
|
735
|
+
let n = e[1], r = L(e[2]);
|
|
710
736
|
t[n] || (t[n] = []), t[n].push(r);
|
|
711
737
|
} else {
|
|
712
|
-
let e =
|
|
738
|
+
let e = L(r);
|
|
713
739
|
e && n.push(e);
|
|
714
740
|
}
|
|
715
741
|
}
|
|
@@ -718,7 +744,7 @@ function I(e) {
|
|
|
718
744
|
terms: n
|
|
719
745
|
};
|
|
720
746
|
}
|
|
721
|
-
function
|
|
747
|
+
function z(e) {
|
|
722
748
|
return {
|
|
723
749
|
log_id: "blob1",
|
|
724
750
|
tenant_id: "blob2",
|
|
@@ -739,7 +765,7 @@ function L(e) {
|
|
|
739
765
|
hostname: "blob17"
|
|
740
766
|
}[e] || null;
|
|
741
767
|
}
|
|
742
|
-
function
|
|
768
|
+
function ge(e) {
|
|
743
769
|
let t = [];
|
|
744
770
|
for (let [n, r] of Object.entries(e)) {
|
|
745
771
|
let e = r.filter((e) => e !== "");
|
|
@@ -750,41 +776,41 @@ function R(e) {
|
|
|
750
776
|
n.length > 0 && t.push(`(${n.join(" OR ")})`);
|
|
751
777
|
continue;
|
|
752
778
|
}
|
|
753
|
-
let i =
|
|
754
|
-
if (i) if (e.length === 1) t.push(`${i} = ${
|
|
779
|
+
let i = z(n);
|
|
780
|
+
if (i) if (e.length === 1) t.push(`${i} = ${j(e[0])}`);
|
|
755
781
|
else {
|
|
756
|
-
let n = e.map((e) =>
|
|
782
|
+
let n = e.map((e) => j(e)).join(", ");
|
|
757
783
|
t.push(`${i} IN (${n})`);
|
|
758
784
|
}
|
|
759
785
|
}
|
|
760
786
|
return t;
|
|
761
787
|
}
|
|
762
|
-
function
|
|
788
|
+
function _e(e) {
|
|
763
789
|
return e.filter((e) => e !== "").map((e) => {
|
|
764
|
-
let t =
|
|
790
|
+
let t = j(e), n = j(`%${e}%`);
|
|
765
791
|
return `(blob7 = ${t} OR blob5 LIKE ${n} OR blob4 LIKE ${n})`;
|
|
766
792
|
});
|
|
767
793
|
}
|
|
768
|
-
function
|
|
769
|
-
return e === "date" ? "double2" :
|
|
794
|
+
function ve(e) {
|
|
795
|
+
return e === "date" ? "double2" : z(e) || "timestamp";
|
|
770
796
|
}
|
|
771
|
-
function
|
|
797
|
+
function ye(e) {
|
|
772
798
|
return async (t, n = {}) => {
|
|
773
|
-
let { page: r = 0, per_page: i = 50, include_totals: a = !1, sort: o, q: s, from_date: c, to_date: l } = n, u = e.dataset || "authhero_logs", d = [`index1 = ${
|
|
799
|
+
let { page: r = 0, per_page: i = 50, include_totals: a = !1, sort: o, q: s, from_date: c, to_date: l } = n, u = e.dataset || "authhero_logs", d = [`index1 = ${j(t)}`];
|
|
774
800
|
if (s) {
|
|
775
|
-
let { fields: e, terms: t } =
|
|
776
|
-
d.push(...
|
|
801
|
+
let { fields: e, terms: t } = R(s);
|
|
802
|
+
d.push(...ge(e)), d.push(..._e(t));
|
|
777
803
|
}
|
|
778
804
|
typeof c == "number" && Number.isFinite(c) && d.push(`double2 >= ${Math.floor(c) * 1e3}`), typeof l == "number" && Number.isFinite(l) && d.push(`double2 <= ${Math.floor(l) * 1e3}`);
|
|
779
805
|
let f = d.join(" AND "), p = "ORDER BY timestamp DESC";
|
|
780
|
-
o && o.sort_by && (p = `ORDER BY ${
|
|
781
|
-
let m = r * i, h = `LIMIT ${i} OFFSET ${m}`, g = (await
|
|
806
|
+
o && o.sort_by && (p = `ORDER BY ${ve(o.sort_by)} ${o.sort_order === "asc" ? "ASC" : "DESC"}`);
|
|
807
|
+
let m = r * i, h = `LIMIT ${i} OFFSET ${m}`, g = (await A(e, `
|
|
782
808
|
SELECT *
|
|
783
|
-
FROM ${
|
|
809
|
+
FROM ${M(u)}
|
|
784
810
|
WHERE ${f}
|
|
785
811
|
${p}
|
|
786
812
|
${h}
|
|
787
|
-
`)).map(
|
|
813
|
+
`)).map(N);
|
|
788
814
|
if (!a) return {
|
|
789
815
|
logs: g,
|
|
790
816
|
start: 0,
|
|
@@ -793,11 +819,11 @@ function ge(e) {
|
|
|
793
819
|
};
|
|
794
820
|
let _ = `
|
|
795
821
|
SELECT count() as count
|
|
796
|
-
FROM ${
|
|
822
|
+
FROM ${M(u)}
|
|
797
823
|
WHERE ${f}
|
|
798
824
|
`;
|
|
799
825
|
try {
|
|
800
|
-
let t = (await
|
|
826
|
+
let t = (await A(e, _))[0]?.count || 0;
|
|
801
827
|
return {
|
|
802
828
|
logs: g,
|
|
803
829
|
start: m,
|
|
@@ -816,30 +842,30 @@ function ge(e) {
|
|
|
816
842
|
}
|
|
817
843
|
//#endregion
|
|
818
844
|
//#region src/analytics-engine-logs/stats.ts
|
|
819
|
-
var B = ["s"],
|
|
845
|
+
var B = ["s"], be = ["pwd_leak"];
|
|
820
846
|
function V(e) {
|
|
821
847
|
return `${e.slice(0, 4)}-${e.slice(4, 6)}-${e.slice(6, 8)}`;
|
|
822
848
|
}
|
|
823
849
|
function H(e) {
|
|
824
850
|
return e.toISOString().split("T")[0];
|
|
825
851
|
}
|
|
826
|
-
function
|
|
852
|
+
function xe(e) {
|
|
827
853
|
let t = e.dataset || "authhero_logs";
|
|
828
854
|
return {
|
|
829
855
|
async getDaily(n, r = {}) {
|
|
830
856
|
let { from: i, to: a } = r, o = /* @__PURE__ */ new Date(), s = new Date(o);
|
|
831
857
|
s.setDate(s.getDate() - 30);
|
|
832
858
|
let c = i ? V(i) : H(s), l = a ? V(a) : H(o), u = (/* @__PURE__ */ new Date(`${c}T00:00:00Z`)).getTime(), d = (/* @__PURE__ */ new Date(`${l}T23:59:59.999Z`)).getTime();
|
|
833
|
-
return (await
|
|
859
|
+
return (await A(e, `
|
|
834
860
|
SELECT
|
|
835
861
|
toDate(toDateTime(double2 / 1000)) AS date,
|
|
836
|
-
SUM(CASE WHEN blob3 IN (${B.map((e) =>
|
|
862
|
+
SUM(CASE WHEN blob3 IN (${B.map((e) => j(e)).join(", ")}) THEN 1 ELSE 0 END) AS logins,
|
|
837
863
|
SUM(CASE WHEN blob3 = 'ss' THEN 1 ELSE 0 END) AS signups,
|
|
838
|
-
SUM(CASE WHEN blob3 IN (${
|
|
864
|
+
SUM(CASE WHEN blob3 IN (${be.map((e) => j(e)).join(", ")}) THEN 1 ELSE 0 END) AS leaked_passwords,
|
|
839
865
|
MIN(double2) AS first_event,
|
|
840
866
|
MAX(double2) AS last_event
|
|
841
867
|
FROM "${t}"
|
|
842
|
-
WHERE index1 = ${
|
|
868
|
+
WHERE index1 = ${j(n)}
|
|
843
869
|
AND double2 >= ${u}
|
|
844
870
|
AND double2 <= ${d}
|
|
845
871
|
GROUP BY date
|
|
@@ -856,10 +882,10 @@ function ve(e) {
|
|
|
856
882
|
async getActiveUsers(n) {
|
|
857
883
|
let r = /* @__PURE__ */ new Date();
|
|
858
884
|
r.setDate(r.getDate() - 30);
|
|
859
|
-
let i = r.getTime(), a = B.map((e) =>
|
|
885
|
+
let i = r.getTime(), a = B.map((e) => j(e)).join(", "), o = (await A(e, `
|
|
860
886
|
SELECT COUNT(DISTINCT blob7) AS count
|
|
861
887
|
FROM "${t}"
|
|
862
|
-
WHERE index1 = ${
|
|
888
|
+
WHERE index1 = ${j(n)}
|
|
863
889
|
AND double2 >= ${i}
|
|
864
890
|
AND blob3 IN (${a})
|
|
865
891
|
AND blob7 IS NOT NULL
|
|
@@ -871,7 +897,7 @@ function ve(e) {
|
|
|
871
897
|
}
|
|
872
898
|
//#endregion
|
|
873
899
|
//#region src/analytics-engine-logs/analytics.ts
|
|
874
|
-
var
|
|
900
|
+
var Se = {
|
|
875
901
|
"active-users": ["s", "seacft"],
|
|
876
902
|
logins: [
|
|
877
903
|
"s",
|
|
@@ -901,17 +927,17 @@ var ye = {
|
|
|
901
927
|
"fvr"
|
|
902
928
|
],
|
|
903
929
|
"codes-sent": ["cls", "cs"]
|
|
904
|
-
},
|
|
930
|
+
}, Ce = {
|
|
905
931
|
connection: "blob9",
|
|
906
932
|
client_id: "blob11",
|
|
907
933
|
user_type: "blob16",
|
|
908
934
|
event: "blob3"
|
|
909
|
-
},
|
|
935
|
+
}, we = {
|
|
910
936
|
connection: "blob9",
|
|
911
937
|
client_id: "blob11",
|
|
912
938
|
user_type: "blob16",
|
|
913
939
|
user_id: "blob7"
|
|
914
|
-
},
|
|
940
|
+
}, Te = {
|
|
915
941
|
"active-users": {
|
|
916
942
|
expr: "count(DISTINCT blob7)",
|
|
917
943
|
alias: "active_users",
|
|
@@ -968,8 +994,8 @@ var ye = {
|
|
|
968
994
|
type: "UInt64"
|
|
969
995
|
}
|
|
970
996
|
};
|
|
971
|
-
function
|
|
972
|
-
let n = `toDateTime(intDiv(double2, 1000), ${
|
|
997
|
+
function Ee(e, t) {
|
|
998
|
+
let n = `toDateTime(intDiv(double2, 1000), ${j(t)})`;
|
|
973
999
|
switch (e) {
|
|
974
1000
|
case "hour": return `toStartOfHour(${n})`;
|
|
975
1001
|
case "week": return `toStartOfWeek(${n})`;
|
|
@@ -977,45 +1003,45 @@ function Ce(e, t) {
|
|
|
977
1003
|
default: return `toStartOfDay(${n})`;
|
|
978
1004
|
}
|
|
979
1005
|
}
|
|
980
|
-
function
|
|
1006
|
+
function De(e) {
|
|
981
1007
|
return e === "hour" ? "DateTime" : "Date";
|
|
982
1008
|
}
|
|
983
|
-
function
|
|
984
|
-
let r = new Date(e.from).getTime(), i = new Date(e.to).getTime(), a = n.map((e) =>
|
|
985
|
-
`index1 = ${
|
|
1009
|
+
function Oe(e, t, n) {
|
|
1010
|
+
let r = new Date(e.from).getTime(), i = new Date(e.to).getTime(), a = n.map((e) => j(e)).join(", "), o = [
|
|
1011
|
+
`index1 = ${j(t)}`,
|
|
986
1012
|
`double2 >= ${r}`,
|
|
987
1013
|
`double2 < ${i}`,
|
|
988
1014
|
`blob3 IN (${a})`
|
|
989
1015
|
];
|
|
990
|
-
for (let [t, n] of Object.entries(
|
|
1016
|
+
for (let [t, n] of Object.entries(we)) {
|
|
991
1017
|
let r = e.filters[t];
|
|
992
1018
|
if (r && r.length > 0) {
|
|
993
|
-
let e = r.map((e) =>
|
|
1019
|
+
let e = r.map((e) => j(e)).join(", ");
|
|
994
1020
|
o.push(`${n} IN (${e})`);
|
|
995
1021
|
}
|
|
996
1022
|
}
|
|
997
1023
|
return o.join(" AND ");
|
|
998
1024
|
}
|
|
999
|
-
function
|
|
1025
|
+
function ke(e, t, n) {
|
|
1000
1026
|
if (e.order_by) {
|
|
1001
1027
|
let t = e.order_by.startsWith("-");
|
|
1002
|
-
return `${
|
|
1028
|
+
return `${M(t ? e.order_by.slice(1) : e.order_by)} ${t ? "DESC" : "ASC"}`;
|
|
1003
1029
|
}
|
|
1004
|
-
return t.length > 0 && t[0] === "time" ? `${
|
|
1030
|
+
return t.length > 0 && t[0] === "time" ? `${M("time")} ASC` : `${M(n)} DESC`;
|
|
1005
1031
|
}
|
|
1006
1032
|
function U(e) {
|
|
1007
1033
|
let t = e.dataset || "authhero_logs";
|
|
1008
1034
|
return { async query(n, r, i) {
|
|
1009
|
-
let a =
|
|
1035
|
+
let a = Se[r], o = Te[r], s = [], c = [];
|
|
1010
1036
|
for (let e of i.group_by) if (e === "time") {
|
|
1011
|
-
let e =
|
|
1012
|
-
s.push(`${e} AS ${
|
|
1037
|
+
let e = Ee(i.interval, i.tz);
|
|
1038
|
+
s.push(`${e} AS ${M("time")}`), c.push({
|
|
1013
1039
|
name: "time",
|
|
1014
|
-
type:
|
|
1040
|
+
type: De(i.interval)
|
|
1015
1041
|
});
|
|
1016
1042
|
} else {
|
|
1017
|
-
let t =
|
|
1018
|
-
s.push(`${t} AS ${
|
|
1043
|
+
let t = Ce[e];
|
|
1044
|
+
s.push(`${t} AS ${M(e)}`), c.push({
|
|
1019
1045
|
name: e,
|
|
1020
1046
|
type: "String"
|
|
1021
1047
|
});
|
|
@@ -1024,10 +1050,10 @@ function U(e) {
|
|
|
1024
1050
|
name: o.alias,
|
|
1025
1051
|
type: o.type
|
|
1026
1052
|
});
|
|
1027
|
-
let l = [...s, `${o.expr} AS ${
|
|
1053
|
+
let l = [...s, `${o.expr} AS ${M(o.alias)}`], u = i.group_by.length ? `GROUP BY ${i.group_by.map((e) => M(e === "time" ? "time" : e)).join(", ")}` : "", d = ke(i, i.group_by.map((e) => e === "time" ? "time" : e), o.alias), f = `
|
|
1028
1054
|
SELECT ${l.join(", ")}
|
|
1029
|
-
FROM ${
|
|
1030
|
-
WHERE ${
|
|
1055
|
+
FROM ${M(t)}
|
|
1056
|
+
WHERE ${Oe(i, n, a)}
|
|
1031
1057
|
${u}
|
|
1032
1058
|
ORDER BY ${d}
|
|
1033
1059
|
LIMIT ${Math.max(0, i.limit)} OFFSET ${Math.max(0, i.offset)}
|
|
@@ -1066,45 +1092,45 @@ function U(e) {
|
|
|
1066
1092
|
//#region src/analytics-engine-logs/index.ts
|
|
1067
1093
|
function W(e) {
|
|
1068
1094
|
return e.analyticsEngineBinding || console.warn("Analytics Engine: No binding configured. Logs will not be written to Analytics Engine."), (!e.accountId || !e.apiToken) && console.warn("Analytics Engine: accountId and apiToken are required for querying logs via SQL API."), {
|
|
1069
|
-
create:
|
|
1070
|
-
list:
|
|
1071
|
-
get:
|
|
1095
|
+
create: me(e),
|
|
1096
|
+
list: ye(e),
|
|
1097
|
+
get: P(e)
|
|
1072
1098
|
};
|
|
1073
1099
|
}
|
|
1074
1100
|
//#endregion
|
|
1075
1101
|
//#region src/analytics-engine-action-executions/actionExecutions.ts
|
|
1076
|
-
var
|
|
1077
|
-
function
|
|
1102
|
+
var Ae = "authhero_action_executions", je = 1024, Me = "[truncated]";
|
|
1103
|
+
function G(e) {
|
|
1078
1104
|
if (!(typeof e != "string" || e.length === 0)) try {
|
|
1079
1105
|
return JSON.parse(e);
|
|
1080
1106
|
} catch {
|
|
1081
1107
|
return;
|
|
1082
1108
|
}
|
|
1083
1109
|
}
|
|
1084
|
-
function
|
|
1110
|
+
function Ne(e) {
|
|
1085
1111
|
let t = a.safeParse(e);
|
|
1086
1112
|
return t.success ? t.data : "unspecified";
|
|
1087
1113
|
}
|
|
1088
|
-
function
|
|
1089
|
-
return e.length <= t ? e : `${e.substring(0, t - 11)}${
|
|
1114
|
+
function K(e, t = je) {
|
|
1115
|
+
return e.length <= t ? e : `${e.substring(0, t - 11)}${Me}`;
|
|
1090
1116
|
}
|
|
1091
|
-
function
|
|
1117
|
+
function q(e) {
|
|
1092
1118
|
return e == null ? "" : JSON.stringify(e);
|
|
1093
1119
|
}
|
|
1094
|
-
function
|
|
1120
|
+
function Pe(e) {
|
|
1095
1121
|
let t = typeof e.blob6 == "string" && e.blob6.length > 0 ? e.blob6 : typeof e.double1 == "number" ? new Date(e.double1).toISOString() : "", n = typeof e.blob7 == "string" && e.blob7.length > 0 ? e.blob7 : t;
|
|
1096
1122
|
return {
|
|
1097
1123
|
id: typeof e.blob1 == "string" ? e.blob1 : "",
|
|
1098
1124
|
tenant_id: typeof e.index1 == "string" ? e.index1 : "",
|
|
1099
1125
|
trigger_id: typeof e.blob2 == "string" ? e.blob2 : "",
|
|
1100
|
-
status:
|
|
1101
|
-
results:
|
|
1102
|
-
logs:
|
|
1126
|
+
status: Ne(e.blob3),
|
|
1127
|
+
results: G(e.blob4) ?? [],
|
|
1128
|
+
logs: G(e.blob5),
|
|
1103
1129
|
created_at: t,
|
|
1104
1130
|
updated_at: n
|
|
1105
1131
|
};
|
|
1106
1132
|
}
|
|
1107
|
-
function
|
|
1133
|
+
function Fe(e) {
|
|
1108
1134
|
return async (t, n) => {
|
|
1109
1135
|
let r = Date.now(), i = new Date(r).toISOString(), a = {
|
|
1110
1136
|
id: n.id,
|
|
@@ -1116,10 +1142,10 @@ function je(e) {
|
|
|
1116
1142
|
created_at: i,
|
|
1117
1143
|
updated_at: i
|
|
1118
1144
|
};
|
|
1119
|
-
return
|
|
1145
|
+
return Ie(e, t, a, r), a;
|
|
1120
1146
|
};
|
|
1121
1147
|
}
|
|
1122
|
-
function
|
|
1148
|
+
function Ie(e, t, n, r) {
|
|
1123
1149
|
if (!e.analyticsEngineBinding) {
|
|
1124
1150
|
console.error("Analytics Engine action_executions binding not configured; skipping write");
|
|
1125
1151
|
return;
|
|
@@ -1127,13 +1153,13 @@ function Me(e, t, n, r) {
|
|
|
1127
1153
|
try {
|
|
1128
1154
|
e.analyticsEngineBinding.writeDataPoint({
|
|
1129
1155
|
blobs: [
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
q(
|
|
1134
|
-
q(
|
|
1135
|
-
|
|
1136
|
-
|
|
1156
|
+
K(n.id),
|
|
1157
|
+
K(n.trigger_id),
|
|
1158
|
+
K(n.status),
|
|
1159
|
+
K(q(n.results)),
|
|
1160
|
+
K(q(n.logs)),
|
|
1161
|
+
K(n.created_at),
|
|
1162
|
+
K(n.updated_at)
|
|
1137
1163
|
],
|
|
1138
1164
|
doubles: [r],
|
|
1139
1165
|
indexes: [t.substring(0, 96)]
|
|
@@ -1142,29 +1168,29 @@ function Me(e, t, n, r) {
|
|
|
1142
1168
|
console.error("Failed to write action_execution to Analytics Engine:", e);
|
|
1143
1169
|
}
|
|
1144
1170
|
}
|
|
1145
|
-
function
|
|
1171
|
+
function Le(e) {
|
|
1146
1172
|
return async (t, n) => {
|
|
1147
|
-
let r = await
|
|
1173
|
+
let r = await A(e, `
|
|
1148
1174
|
SELECT *
|
|
1149
|
-
FROM ${
|
|
1150
|
-
WHERE index1 = ${
|
|
1151
|
-
AND blob1 = ${
|
|
1175
|
+
FROM ${M(e.dataset || Ae)}
|
|
1176
|
+
WHERE index1 = ${j(t)}
|
|
1177
|
+
AND blob1 = ${j(n)}
|
|
1152
1178
|
LIMIT 1
|
|
1153
1179
|
`);
|
|
1154
|
-
return r.length === 0 || !r[0] ? null :
|
|
1180
|
+
return r.length === 0 || !r[0] ? null : Pe(r[0]);
|
|
1155
1181
|
};
|
|
1156
1182
|
}
|
|
1157
1183
|
//#endregion
|
|
1158
1184
|
//#region src/analytics-engine-action-executions/index.ts
|
|
1159
|
-
function
|
|
1185
|
+
function J(e) {
|
|
1160
1186
|
return e.analyticsEngineBinding || console.warn("Analytics Engine: No action_executions binding configured. Executions will not be written."), (!e.accountId || !e.apiToken) && console.warn("Analytics Engine: accountId and apiToken are required to read action_executions via the SQL API."), {
|
|
1161
|
-
create:
|
|
1162
|
-
get:
|
|
1187
|
+
create: Fe(e),
|
|
1188
|
+
get: Le(e)
|
|
1163
1189
|
};
|
|
1164
1190
|
}
|
|
1165
1191
|
//#endregion
|
|
1166
1192
|
//#region src/geo/index.ts
|
|
1167
|
-
function
|
|
1193
|
+
function Re() {
|
|
1168
1194
|
return { async getGeoInfo(e) {
|
|
1169
1195
|
try {
|
|
1170
1196
|
let t = e["cf-ipcountry"], n = e["cf-ipcity"], r = e["cf-iplatitude"], i = e["cf-iplongitude"], a = e["cf-timezone"], o = e["cf-ipcontinent"];
|
|
@@ -1183,7 +1209,7 @@ function Pe() {
|
|
|
1183
1209
|
}
|
|
1184
1210
|
//#endregion
|
|
1185
1211
|
//#region src/rate-limit/index.ts
|
|
1186
|
-
var
|
|
1212
|
+
var ze = class {
|
|
1187
1213
|
bindings;
|
|
1188
1214
|
constructor(e) {
|
|
1189
1215
|
this.bindings = e;
|
|
@@ -1199,12 +1225,12 @@ var Fe = class {
|
|
|
1199
1225
|
}
|
|
1200
1226
|
}
|
|
1201
1227
|
};
|
|
1202
|
-
function
|
|
1203
|
-
if (e && Object.keys(e).some((t) => e[t])) return new
|
|
1228
|
+
function Y(e) {
|
|
1229
|
+
if (e && Object.keys(e).some((t) => e[t])) return new ze(e);
|
|
1204
1230
|
}
|
|
1205
1231
|
//#endregion
|
|
1206
1232
|
//#region src/code-executor/worker-template.ts
|
|
1207
|
-
function
|
|
1233
|
+
function X(e) {
|
|
1208
1234
|
return `// Auto-generated AuthHero code hook worker
|
|
1209
1235
|
|
|
1210
1236
|
const fnNames = {
|
|
@@ -1296,7 +1322,7 @@ export default {
|
|
|
1296
1322
|
}
|
|
1297
1323
|
//#endregion
|
|
1298
1324
|
//#region src/code-executor/index.ts
|
|
1299
|
-
var
|
|
1325
|
+
var Z = class {
|
|
1300
1326
|
config;
|
|
1301
1327
|
constructor(e) {
|
|
1302
1328
|
this.config = e;
|
|
@@ -1357,7 +1383,7 @@ var Q = class {
|
|
|
1357
1383
|
}
|
|
1358
1384
|
}
|
|
1359
1385
|
async deploy(e, t) {
|
|
1360
|
-
let n = `hook-${e}`, r =
|
|
1386
|
+
let n = `hook-${e}`, r = X(t), i = `https://api.cloudflare.com/client/v4/accounts/${this.config.accountId}/workers/dispatch/namespaces/${this.config.dispatchNamespace}/scripts/${n}`, a = JSON.stringify({
|
|
1361
1387
|
main_module: "index.js",
|
|
1362
1388
|
compatibility_date: this.config.compatibilityDate ?? "2024-11-20"
|
|
1363
1389
|
}), o = new FormData();
|
|
@@ -1382,21 +1408,21 @@ var Q = class {
|
|
|
1382
1408
|
throw Error(`Failed to remove hook worker ${t}: ${r.status} ${e}`);
|
|
1383
1409
|
}
|
|
1384
1410
|
}
|
|
1385
|
-
},
|
|
1411
|
+
}, Be = Z, Ve = {
|
|
1386
1412
|
"post-user-login": "onExecutePostLogin",
|
|
1387
1413
|
"credentials-exchange": "onExecuteCredentialsExchange",
|
|
1388
1414
|
"pre-user-registration": "onExecutePreUserRegistration",
|
|
1389
1415
|
"post-user-registration": "onExecutePostUserRegistration"
|
|
1390
|
-
},
|
|
1391
|
-
async function
|
|
1416
|
+
}, He = i;
|
|
1417
|
+
async function Ue(e) {
|
|
1392
1418
|
let t = new TextEncoder().encode(e), n = await crypto.subtle.digest("SHA-256", t), r = new Uint8Array(n), i = "";
|
|
1393
1419
|
for (let e of r) i += e.toString(16).padStart(2, "0");
|
|
1394
1420
|
return i;
|
|
1395
1421
|
}
|
|
1396
|
-
function
|
|
1422
|
+
function We(e) {
|
|
1397
1423
|
return `
|
|
1398
|
-
const TRIGGER_FN_NAMES = ${JSON.stringify(
|
|
1399
|
-
const API_SHAPES = ${JSON.stringify(
|
|
1424
|
+
const TRIGGER_FN_NAMES = ${JSON.stringify(Ve)};
|
|
1425
|
+
const API_SHAPES = ${JSON.stringify(He)};
|
|
1400
1426
|
const MAX_LOG_ENTRIES = 50;
|
|
1401
1427
|
const MAX_LOG_LENGTH = 500;
|
|
1402
1428
|
|
|
@@ -1496,7 +1522,7 @@ export default {
|
|
|
1496
1522
|
};
|
|
1497
1523
|
`;
|
|
1498
1524
|
}
|
|
1499
|
-
var
|
|
1525
|
+
var Ge = class {
|
|
1500
1526
|
loader;
|
|
1501
1527
|
compatibilityDate;
|
|
1502
1528
|
constructor(e) {
|
|
@@ -1505,11 +1531,11 @@ var Ve = class {
|
|
|
1505
1531
|
async execute(e) {
|
|
1506
1532
|
let t = Date.now();
|
|
1507
1533
|
try {
|
|
1508
|
-
let t =
|
|
1534
|
+
let t = We(e.code), n = {
|
|
1509
1535
|
compatibilityDate: this.compatibilityDate,
|
|
1510
1536
|
mainModule: "hook.js",
|
|
1511
1537
|
modules: { "hook.js": t }
|
|
1512
|
-
}, r = e.hookCodeId ? `${e.hookCodeId}-${await
|
|
1538
|
+
}, r = e.hookCodeId ? `${e.hookCodeId}-${await Ue(e.code)}` : null;
|
|
1513
1539
|
return await (await (r ? this.loader.get(r, async () => n) : this.loader.load(n)).getEntrypoint().fetch(new Request("https://hook/execute", {
|
|
1514
1540
|
method: "POST",
|
|
1515
1541
|
headers: { "Content-Type": "application/json" },
|
|
@@ -1530,7 +1556,7 @@ var Ve = class {
|
|
|
1530
1556
|
};
|
|
1531
1557
|
//#endregion
|
|
1532
1558
|
//#region src/wfp-provisioner/provisioner.ts
|
|
1533
|
-
function
|
|
1559
|
+
function Q(e) {
|
|
1534
1560
|
let t = n(e);
|
|
1535
1561
|
return {
|
|
1536
1562
|
async onProvision(e) {
|
|
@@ -1551,10 +1577,10 @@ function He(e) {
|
|
|
1551
1577
|
}
|
|
1552
1578
|
//#endregion
|
|
1553
1579
|
//#region src/wfp-provisioner/tenant-hook.ts
|
|
1554
|
-
function
|
|
1580
|
+
function Ke(e) {
|
|
1555
1581
|
return e.deployment_type === "wfp";
|
|
1556
1582
|
}
|
|
1557
|
-
var
|
|
1583
|
+
var qe = 2048;
|
|
1558
1584
|
function $(e) {
|
|
1559
1585
|
let t;
|
|
1560
1586
|
if (e instanceof Error) t = e.message;
|
|
@@ -1563,10 +1589,10 @@ function $(e) {
|
|
|
1563
1589
|
} catch {
|
|
1564
1590
|
t = Object.prototype.toString.call(e);
|
|
1565
1591
|
}
|
|
1566
|
-
return t.slice(0,
|
|
1592
|
+
return t.slice(0, qe);
|
|
1567
1593
|
}
|
|
1568
|
-
function
|
|
1569
|
-
let { provisioner: t, tenants: n, syncDefaults: i } = e, a = e.shouldProvision ??
|
|
1594
|
+
function Je(e) {
|
|
1595
|
+
let { provisioner: t, tenants: n, syncDefaults: i } = e, a = e.shouldProvision ?? Ke, o = e.logger;
|
|
1570
1596
|
async function s(e, t) {
|
|
1571
1597
|
try {
|
|
1572
1598
|
await n.update(e, {
|
|
@@ -1660,15 +1686,15 @@ function Ge(e) {
|
|
|
1660
1686
|
}
|
|
1661
1687
|
//#endregion
|
|
1662
1688
|
//#region src/wfp-provisioner/wfp-forward.ts
|
|
1663
|
-
var
|
|
1664
|
-
function
|
|
1689
|
+
var Ye = "DISPATCHER", Xe = "tenant-{tenant_id}-auth", Ze = ["/u/widget/"];
|
|
1690
|
+
function Qe(e) {
|
|
1665
1691
|
return typeof e == "object" && !!e && "get" in e && typeof Reflect.get(e, "get") == "function";
|
|
1666
1692
|
}
|
|
1667
|
-
function
|
|
1693
|
+
function $e(e, t) {
|
|
1668
1694
|
return e.replace(/\{tenant_id\}/g, t);
|
|
1669
1695
|
}
|
|
1670
|
-
function
|
|
1671
|
-
let { tenants: t, controlPlaneTenantId: n, dispatcherBinding: r =
|
|
1696
|
+
function et(e) {
|
|
1697
|
+
let { tenants: t, controlPlaneTenantId: n, dispatcherBinding: r = Ye, scriptNameTemplate: i = Xe, resolveTenantId: a = (e) => e.req.header("tenant-id"), localPaths: o = Ze } = e;
|
|
1672
1698
|
return async (e, s) => {
|
|
1673
1699
|
if (o.length > 0) {
|
|
1674
1700
|
let t = e.req.path;
|
|
@@ -1679,8 +1705,8 @@ function Ze(e) {
|
|
|
1679
1705
|
let l = await t.get(c);
|
|
1680
1706
|
if (!l || l.deployment_type !== "wfp" || l.provisioning_state && l.provisioning_state !== "ready") return s();
|
|
1681
1707
|
let u = Reflect.get(e.env ?? {}, r);
|
|
1682
|
-
if (!
|
|
1683
|
-
let d =
|
|
1708
|
+
if (!Qe(u)) return s();
|
|
1709
|
+
let d = $e(i, c), f;
|
|
1684
1710
|
try {
|
|
1685
1711
|
f = await u.get(d).fetch(e.req.raw);
|
|
1686
1712
|
} catch (t) {
|
|
@@ -1703,19 +1729,19 @@ function Ze(e) {
|
|
|
1703
1729
|
}
|
|
1704
1730
|
//#endregion
|
|
1705
1731
|
//#region src/index.ts
|
|
1706
|
-
function
|
|
1732
|
+
function tt(e) {
|
|
1707
1733
|
let t = {
|
|
1708
|
-
customDomains:
|
|
1709
|
-
cache:
|
|
1734
|
+
customDomains: re(e),
|
|
1735
|
+
cache: ae({
|
|
1710
1736
|
...e.cacheName && { cacheName: e.cacheName },
|
|
1711
1737
|
...e.defaultTtlSeconds !== void 0 && { defaultTtlSeconds: e.defaultTtlSeconds },
|
|
1712
1738
|
...e.keyPrefix && { keyPrefix: e.keyPrefix }
|
|
1713
1739
|
}),
|
|
1714
|
-
geo:
|
|
1740
|
+
geo: Re()
|
|
1715
1741
|
};
|
|
1716
|
-
e.r2SqlLogs ? t.logs =
|
|
1717
|
-
let n =
|
|
1742
|
+
e.r2SqlLogs ? t.logs = k(e.r2SqlLogs) : e.analyticsEngineLogs && (t.logs = W(e.analyticsEngineLogs)), e.analyticsEngineLogs && (t.analytics = U(e.analyticsEngineLogs)), e.analyticsEngineActionExecutions && (t.actionExecutions = J(e.analyticsEngineActionExecutions));
|
|
1743
|
+
let n = Y(e.rateLimitBindings);
|
|
1718
1744
|
return n && (t.rateLimit = n), t;
|
|
1719
1745
|
}
|
|
1720
1746
|
//#endregion
|
|
1721
|
-
export { t as CloudflareApiClient, e as CloudflareApiError,
|
|
1747
|
+
export { t as CloudflareApiClient, e as CloudflareApiError, Be as CloudflareCodeExecutor, Z as DispatchNamespaceCodeExecutor, Ge as WorkerLoaderCodeExecutor, J as createAnalyticsEngineActionExecutionsAdapter, U as createAnalyticsEngineAnalyticsAdapter, W as createAnalyticsEngineLogsAdapter, xe as createAnalyticsEngineStatsAdapter, Y as createCloudflareRateLimitAdapter, Q as createCloudflareWfpD1Provisioner, k as createR2SQLLogsAdapter, pe as createR2SQLStatsAdapter, et as createWfpForwardMiddleware, n as createWfpProvisionerSteps, Je as createWfpTenantProvisioningHook, tt as default, X as generateWorkerScript };
|