@authhero/cloudflare-adapter 2.38.15 → 3.0.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.
@@ -1,83 +1,83 @@
1
- import { a as e, i as t, n, t as r } from "./sync-defaults-errors-3BT2TYx9.mjs";
2
- import { actionExecutionStatusSchema as i, verificationMethodsSchema as a } from "@authhero/adapter-interfaces";
3
- import { z as o } from "@hono/zod-openapi";
4
- import { HTTPException as s } from "hono/http-exception";
5
- import c from "wretch";
6
- import { dedupe as l, retry as u } from "wretch/middlewares";
1
+ import { a as e, i as t, n, t as r } from "./sync-defaults-errors-BlLZh6Gt.mjs";
2
+ import { TRIGGER_API_SHAPES as i, actionExecutionStatusSchema as a, verificationMethodsSchema as o } from "@authhero/adapter-interfaces";
3
+ import { z as s } from "@hono/zod-openapi";
4
+ import { HTTPException as c } from "hono/http-exception";
5
+ import l from "wretch";
6
+ import { dedupe as u, retry as d } from "wretch/middlewares";
7
7
  //#region src/types/CustomDomain.ts
8
- var d = o.object({
9
- code: o.number(),
10
- message: o.string()
11
- }), f = o.object({ message: o.string() }), p = o.object({
12
- emails: o.array(o.string()).optional(),
13
- http_body: o.string().optional(),
14
- http_url: o.string().optional(),
15
- txt_name: o.string().optional(),
16
- txt_value: o.string().optional()
17
- }), m = o.object({
18
- ciphers: o.array(o.string()).optional(),
19
- early_hints: o.string().optional(),
20
- http2: o.string().optional(),
21
- min_tls_version: o.string().optional(),
22
- tls_1_3: o.string().optional()
23
- }), h = o.object({
24
- id: o.string(),
25
- bundle_method: o.string().optional(),
26
- certificate_authority: o.string(),
27
- custom_certificate: o.string().optional(),
28
- custom_csr_id: o.string().optional(),
29
- custom_key: o.string().optional(),
30
- expires_on: o.string().optional(),
31
- hosts: o.array(o.string()).optional(),
32
- issuer: o.string().optional(),
33
- method: o.string(),
34
- serial_number: o.string().optional(),
35
- settings: m.optional(),
36
- signature: o.string().optional(),
37
- type: o.string(),
38
- uploaded_on: o.string().optional(),
39
- validation_errors: o.array(f).optional(),
40
- validation_records: o.array(p).optional(),
41
- wildcard: o.boolean()
42
- }), g = o.object({
43
- name: o.string(),
44
- type: o.string(),
45
- value: o.string()
46
- }), _ = o.object({
47
- http_body: o.string().optional(),
48
- http_url: o.string().optional()
49
- }), v = o.object({
50
- id: o.string(),
51
- ssl: h,
52
- hostname: o.string(),
53
- custom_metadata: o.record(o.string(), o.string()).optional(),
54
- custom_origin_server: o.string().optional(),
55
- custom_origin_sni: o.string().optional(),
56
- ownership_verification: g.optional(),
57
- ownership_verification_http: _.optional(),
58
- status: o.string(),
59
- verification_errors: o.array(o.string()).optional(),
60
- created_at: o.string()
61
- }), y = o.object({
62
- errors: o.array(d),
63
- messages: o.array(d),
64
- success: o.boolean(),
8
+ var f = s.object({
9
+ code: s.number(),
10
+ message: s.string()
11
+ }), p = s.object({ message: s.string() }), m = s.object({
12
+ emails: s.array(s.string()).optional(),
13
+ http_body: s.string().optional(),
14
+ http_url: s.string().optional(),
15
+ txt_name: s.string().optional(),
16
+ txt_value: s.string().optional()
17
+ }), h = s.object({
18
+ ciphers: s.array(s.string()).optional(),
19
+ early_hints: s.string().optional(),
20
+ http2: s.string().optional(),
21
+ min_tls_version: s.string().optional(),
22
+ tls_1_3: s.string().optional()
23
+ }), g = s.object({
24
+ id: s.string(),
25
+ bundle_method: s.string().optional(),
26
+ certificate_authority: s.string(),
27
+ custom_certificate: s.string().optional(),
28
+ custom_csr_id: s.string().optional(),
29
+ custom_key: s.string().optional(),
30
+ expires_on: s.string().optional(),
31
+ hosts: s.array(s.string()).optional(),
32
+ issuer: s.string().optional(),
33
+ method: s.string(),
34
+ serial_number: s.string().optional(),
35
+ settings: h.optional(),
36
+ signature: s.string().optional(),
37
+ type: s.string(),
38
+ uploaded_on: s.string().optional(),
39
+ validation_errors: s.array(p).optional(),
40
+ validation_records: s.array(m).optional(),
41
+ wildcard: s.boolean()
42
+ }), _ = s.object({
43
+ name: s.string(),
44
+ type: s.string(),
45
+ value: s.string()
46
+ }), ee = s.object({
47
+ http_body: s.string().optional(),
48
+ http_url: s.string().optional()
49
+ }), v = s.object({
50
+ id: s.string(),
51
+ ssl: g,
52
+ hostname: s.string(),
53
+ custom_metadata: s.record(s.string(), s.string()).optional(),
54
+ custom_origin_server: s.string().optional(),
55
+ custom_origin_sni: s.string().optional(),
56
+ ownership_verification: _.optional(),
57
+ ownership_verification_http: ee.optional(),
58
+ status: s.string(),
59
+ verification_errors: s.array(s.string()).optional(),
60
+ created_at: s.string()
61
+ }), y = s.object({
62
+ errors: s.array(f),
63
+ messages: s.array(f),
64
+ success: s.boolean(),
65
65
  result: v
66
66
  });
67
- o.object({
68
- errors: o.array(d),
69
- messages: o.array(d),
70
- success: o.boolean(),
71
- result: o.array(v)
67
+ s.object({
68
+ errors: s.array(f),
69
+ messages: s.array(f),
70
+ success: s.boolean(),
71
+ result: s.array(v)
72
72
  });
73
73
  //#endregion
74
74
  //#region src/customDomains/index.ts
75
75
  function b(e) {
76
- return c(`https://api.cloudflare.com/client/v4/zones/${e.zoneId}`).headers({
76
+ return l(`https://api.cloudflare.com/client/v4/zones/${e.zoneId}`).headers({
77
77
  "X-Auth-Email": e.authEmail,
78
78
  "X-Auth-Key": e.authKey,
79
79
  "Content-Type": "application/json"
80
- }).middlewares([u(), l()]);
80
+ }).middlewares([d(), u()]);
81
81
  }
82
82
  function x(e) {
83
83
  let t = {}, n = {};
@@ -123,11 +123,11 @@ function S(e) {
123
123
  primary: e.primary,
124
124
  status: e.status === "active" ? "ready" : "pending",
125
125
  type: e.type ?? "auth0_managed_certs",
126
- verification: { methods: o.array(a).parse(t) },
126
+ verification: { methods: s.array(o).parse(t) },
127
127
  domain_metadata: n
128
128
  };
129
129
  }
130
- function ee(e) {
130
+ function te(e) {
131
131
  return {
132
132
  create: async (t, n) => {
133
133
  let { sslOverrides: r, rest: i } = x(n.domain_metadata), { result: a, errors: o, success: s } = y.parse(await b(e).post({
@@ -159,7 +159,7 @@ function ee(e) {
159
159
  },
160
160
  get: async (t, n) => {
161
161
  let r = await e.customDomainAdapter.get(t, n);
162
- if (!r) throw new s(404);
162
+ if (!r) throw new c(404);
163
163
  let i;
164
164
  try {
165
165
  i = await b(e).get(`/custom_hostnames/${encodeURIComponent(n)}`).json();
@@ -172,32 +172,32 @@ function ee(e) {
172
172
  body: i
173
173
  }), r;
174
174
  let { result: o } = a.data;
175
- if (e.enterprise && o.custom_metadata?.tenant_id !== t) throw new s(404);
176
- let c;
175
+ if (e.enterprise && o.custom_metadata?.tenant_id !== t) throw new c(404);
176
+ let s;
177
177
  try {
178
- c = S({
178
+ s = S({
179
179
  ...r,
180
180
  ...o
181
181
  });
182
182
  } catch (e) {
183
183
  return console.warn(`[custom-domains] mapCustomDomainResponse failed for ${n} (tenant=${t}); returning stale DB row.`, e instanceof Error ? e.message : e), r;
184
184
  }
185
- if (c.status !== r.status || JSON.stringify(c.verification) !== JSON.stringify(r.verification)) try {
185
+ if (s.status !== r.status || JSON.stringify(s.verification) !== JSON.stringify(r.verification)) try {
186
186
  await e.customDomainAdapter.update(t, n, {
187
- status: c.status,
188
- verification: c.verification
187
+ status: s.status,
188
+ verification: s.verification
189
189
  });
190
190
  } catch (e) {
191
191
  console.warn(`[custom-domains] DB writeback failed for ${n} (tenant=${t}); returning merged response without DB sync.`, e instanceof Error ? e.message : e);
192
192
  }
193
- return c;
193
+ return s;
194
194
  },
195
195
  getByDomain: async (t) => e.customDomainAdapter.getByDomain(t),
196
196
  list: async (t) => e.customDomainAdapter.list(t),
197
197
  remove: async (t, n) => {
198
198
  if (e.enterprise) {
199
199
  let { result: r, success: i } = y.parse(await b(e).get(`/custom_hostnames/${encodeURIComponent(n)}`).json());
200
- if (!i || r.custom_metadata?.tenant_id !== t) throw new s(404);
200
+ if (!i || r.custom_metadata?.tenant_id !== t) throw new c(404);
201
201
  }
202
202
  let r = await b(e).delete(`/custom_hostnames/${encodeURIComponent(n)}`).res();
203
203
  return r.ok && await e.customDomainAdapter.remove(t, n), r.ok;
@@ -209,10 +209,10 @@ function ee(e) {
209
209
  try {
210
210
  t = await b(e).get(`/custom_hostnames/${encodeURIComponent(n)}`).json();
211
211
  } catch (e) {
212
- throw new s(503, { message: `Failed to fetch current custom hostname state: ${e instanceof Error ? e.message : String(e)}` });
212
+ throw new c(503, { message: `Failed to fetch current custom hostname state: ${e instanceof Error ? e.message : String(e)}` });
213
213
  }
214
214
  let r = y.safeParse(t);
215
- if (!r.success || !r.data.success) throw new s(503, { message: `Failed to parse current custom hostname state: ${JSON.stringify(r.success ? r.data.errors : r.error.issues)}` });
215
+ if (!r.success || !r.data.success) throw new c(503, { message: `Failed to parse current custom hostname state: ${JSON.stringify(r.success ? r.data.errors : r.error.issues)}` });
216
216
  a.ssl = {
217
217
  method: r.data.result.ssl.method,
218
218
  type: r.data.result.ssl.type,
@@ -222,20 +222,20 @@ function ee(e) {
222
222
  }
223
223
  if (Object.keys(a).length > 0) {
224
224
  let t = await b(e).patch(a, `/custom_hostnames/${encodeURIComponent(n)}`).res().catch((e) => {
225
- throw new s(503, { message: `Failed to update custom hostname: ${e instanceof Error ? e.message : String(e)}` });
225
+ throw new c(503, { message: `Failed to update custom hostname: ${e instanceof Error ? e.message : String(e)}` });
226
226
  });
227
- if (!t.ok) throw new s(503, { message: await t.text() });
227
+ if (!t.ok) throw new c(503, { message: await t.text() });
228
228
  }
229
229
  return e.customDomainAdapter.update(t, n, r);
230
230
  },
231
231
  uploadCertificate: async (t, n, r) => {
232
232
  let i = await e.customDomainAdapter.get(t, n);
233
- if (!i) throw new s(404);
233
+ if (!i) throw new c(404);
234
234
  let a = await b(e).patch({ ssl: {
235
235
  custom_certificate: r.certificate,
236
236
  custom_key: r.private_key
237
- } }, `/custom_hostnames/${encodeURIComponent(n)}`).json(), { result: o, errors: c, success: l } = y.parse(a);
238
- if (!l) throw new s(503, { message: JSON.stringify(c) });
237
+ } }, `/custom_hostnames/${encodeURIComponent(n)}`).json(), { result: o, errors: s, success: l } = y.parse(a);
238
+ if (!l) throw new c(503, { message: JSON.stringify(s) });
239
239
  let u = S({
240
240
  ...i,
241
241
  ...o
@@ -249,7 +249,7 @@ function ee(e) {
249
249
  }
250
250
  //#endregion
251
251
  //#region src/cache/index.ts
252
- var te = class {
252
+ var ne = class {
253
253
  config;
254
254
  cache = null;
255
255
  constructor(e) {
@@ -323,8 +323,8 @@ var te = class {
323
323
  console.warn("CloudflareCache.clear() is not implemented - Cloudflare Cache API does not support clearing all entries");
324
324
  }
325
325
  };
326
- function ne(e = {}) {
327
- return new te({
326
+ function re(e = {}) {
327
+ return new ne({
328
328
  defaultTtlSeconds: 300,
329
329
  keyPrefix: "authhero",
330
330
  getTimeoutMs: 200,
@@ -332,15 +332,15 @@ function ne(e = {}) {
332
332
  });
333
333
  }
334
334
  //#endregion
335
- //#region ../../node_modules/.pnpm/nanoid@5.1.16/node_modules/nanoid/url-alphabet/index.js
336
- var re = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", C = (e = 21) => {
335
+ //#region ../../node_modules/.pnpm/nanoid@5.1.11/node_modules/nanoid/url-alphabet/index.js
336
+ var C = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", w = (e = 21) => {
337
337
  let t = "", n = crypto.getRandomValues(new Uint8Array(e |= 0));
338
- for (; e--;) t += re[n[e] & 63];
338
+ for (; e--;) t += C[n[e] & 63];
339
339
  return t;
340
340
  };
341
341
  //#endregion
342
342
  //#region src/r2-sql-logs/query.ts
343
- async function w(e, t) {
343
+ async function T(e, t) {
344
344
  let n = e.timeout || 3e4, r = new AbortController(), i = setTimeout(() => r.abort(), n);
345
345
  try {
346
346
  let n = `https://api.sql.cloudflarestorage.com/api/v1/accounts/${e.accountId}/r2-sql/query/${e.warehouseName}`, i = await fetch(n, {
@@ -360,15 +360,15 @@ async function w(e, t) {
360
360
  clearTimeout(i);
361
361
  }
362
362
  }
363
- function T(e) {
363
+ function E(e) {
364
364
  return `'${e.replace(/'/g, "''")}'`;
365
365
  }
366
- function E(e) {
366
+ function D(e) {
367
367
  return `"${e.replace(/"/g, "\"\"")}"`;
368
368
  }
369
369
  //#endregion
370
370
  //#region src/r2-sql-logs/logs.ts
371
- function D(e) {
371
+ function O(e) {
372
372
  let t = (e) => {
373
373
  if (!e) return "";
374
374
  try {
@@ -410,7 +410,7 @@ function D(e) {
410
410
  }
411
411
  function ie(e) {
412
412
  return async (t, n) => {
413
- let r = n.log_id || C(), i = {
413
+ let r = n.log_id || w(), i = {
414
414
  ...n,
415
415
  log_id: r
416
416
  };
@@ -468,22 +468,22 @@ async function ae(e, t, n) {
468
468
  throw console.error("Failed to send log to Pipeline:", e), e;
469
469
  }
470
470
  }
471
- function oe(e) {
471
+ function k(e) {
472
472
  return async (t, n) => {
473
- let r = e.namespace || "default", i = e.tableName || "logs", a = await w(e, `
474
- SELECT * FROM ${E(r)}.${E(i)}
475
- WHERE tenant_id = ${T(t)}
476
- AND id = ${T(n)}
473
+ let r = e.namespace || "default", i = e.tableName || "logs", a = await T(e, `
474
+ SELECT * FROM ${D(r)}.${D(i)}
475
+ WHERE tenant_id = ${E(t)}
476
+ AND id = ${E(n)}
477
477
  LIMIT 1
478
478
  `);
479
479
  if (a.length === 0) return null;
480
480
  let o = a[0];
481
- return o ? D(o) : null;
481
+ return o ? O(o) : null;
482
482
  };
483
483
  }
484
484
  //#endregion
485
485
  //#region src/r2-sql-logs/list.ts
486
- function O(e) {
486
+ function oe(e) {
487
487
  let t = {}, n = /(\w+):(?:"([^"]*)"|(\S+))/g, r;
488
488
  for (; (r = n.exec(e)) !== null;) {
489
489
  let e = r[1], n = r[2] === void 0 ? r[3] : r[2];
@@ -495,36 +495,36 @@ function se(e) {
495
495
  let t = [];
496
496
  for (let [n, r] of Object.entries(e)) {
497
497
  let e = n.replace(/[^a-zA-Z0-9_]/g, "");
498
- e && r && t.push(`${E(e)} = ${T(r)}`);
498
+ e && r && t.push(`${D(e)} = ${E(r)}`);
499
499
  }
500
500
  return t;
501
501
  }
502
502
  function ce(e) {
503
503
  return async (t, n = {}) => {
504
- 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 = ${T(t)}`];
504
+ 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
505
  if (s) {
506
- let e = O(s);
506
+ let e = oe(s);
507
507
  u.push(...se(e));
508
508
  }
509
509
  let d = u.join(" AND "), f = "ORDER BY date DESC";
510
510
  if (o && o.sort_by) {
511
511
  let e = o.sort_by.replace(/[^a-zA-Z0-9_]/g, ""), t = o.sort_order === "asc" ? "ASC" : "DESC";
512
- f = `ORDER BY ${E(e)} ${t}`;
512
+ f = `ORDER BY ${D(e)} ${t}`;
513
513
  }
514
- let p = r * i, m = `LIMIT ${i} OFFSET ${p}`, h = (await w(e, `
515
- SELECT * FROM ${E(c)}.${E(l)}
514
+ let p = r * i, m = `LIMIT ${i} OFFSET ${p}`, h = (await T(e, `
515
+ SELECT * FROM ${D(c)}.${D(l)}
516
516
  WHERE ${d}
517
517
  ${f}
518
518
  ${m}
519
- `)).map(D);
519
+ `)).map(O);
520
520
  if (!a) return {
521
521
  logs: h,
522
522
  start: 0,
523
523
  limit: 0,
524
524
  length: 0
525
525
  };
526
- let g = (await w(e, `
527
- SELECT COUNT(*) as count FROM ${E(c)}.${E(l)}
526
+ let g = (await T(e, `
527
+ SELECT COUNT(*) as count FROM ${D(c)}.${D(l)}
528
528
  WHERE ${d}
529
529
  `))[0]?.count || 0;
530
530
  return {
@@ -549,7 +549,7 @@ function le() {
549
549
  }
550
550
  //#endregion
551
551
  //#region src/r2-sql-logs/index.ts
552
- function k(e) {
552
+ function A(e) {
553
553
  let t = !!e.pipelineEndpoint, n = !!e.pipelineBinding;
554
554
  if (!t && !n) throw Error("R2 SQL logs adapter requires one of: \"pipelineEndpoint\" or \"pipelineBinding\"");
555
555
  if (!e.authToken) throw Error("R2 SQL logs adapter requires \"authToken\" configuration");
@@ -557,12 +557,12 @@ function k(e) {
557
557
  return {
558
558
  create: ie(e),
559
559
  list: ce(e),
560
- get: oe(e)
560
+ get: k(e)
561
561
  };
562
562
  }
563
563
  //#endregion
564
564
  //#region src/analytics-engine-logs/query.ts
565
- async function A(e, t) {
565
+ async function j(e, t) {
566
566
  let n = e.timeout || 3e4, r = new AbortController(), i = setTimeout(() => r.abort(), n);
567
567
  try {
568
568
  let n = `https://api.cloudflare.com/client/v4/accounts/${e.accountId}/analytics_engine/sql`, i = await fetch(n, {
@@ -585,15 +585,15 @@ async function A(e, t) {
585
585
  clearTimeout(i);
586
586
  }
587
587
  }
588
- function j(e) {
588
+ function M(e) {
589
589
  return `'${e.replace(/'/g, "''").replace(/\\/g, "\\\\")}'`;
590
590
  }
591
- function M(e) {
591
+ function N(e) {
592
592
  return `"${e.replace(/"/g, "\"\"")}"`;
593
593
  }
594
594
  //#endregion
595
595
  //#region src/analytics-engine-logs/logs.ts
596
- function N(e) {
596
+ function P(e) {
597
597
  let t = (e) => {
598
598
  if (e) try {
599
599
  return JSON.parse(e);
@@ -627,7 +627,7 @@ function N(e) {
627
627
  }
628
628
  function ue(e) {
629
629
  return async (t, n) => {
630
- let r = n.log_id || C(), i = {
630
+ let r = n.log_id || w(), i = {
631
631
  ...n,
632
632
  log_id: r
633
633
  };
@@ -673,14 +673,14 @@ function de(e, t, n) {
673
673
  }
674
674
  function fe(e) {
675
675
  return async (t, n) => {
676
- let r = await A(e, `
676
+ let r = await j(e, `
677
677
  SELECT *
678
- FROM ${M(e.dataset || "authhero_logs")}
679
- WHERE index1 = ${j(t)}
680
- AND blob1 = ${j(n)}
678
+ FROM ${N(e.dataset || "authhero_logs")}
679
+ WHERE index1 = ${M(t)}
680
+ AND blob1 = ${M(n)}
681
681
  LIMIT 1
682
682
  `);
683
- return r.length === 0 || !r[0] ? null : N(r[0]);
683
+ return r.length === 0 || !r[0] ? null : P(r[0]);
684
684
  };
685
685
  }
686
686
  //#endregion
@@ -696,20 +696,20 @@ function me(e) {
696
696
  }
697
697
  return n.trim() && t.push(n.trim()), t;
698
698
  }
699
- function P(e) {
699
+ function F(e) {
700
700
  let t = e;
701
701
  return t.startsWith("\"") && t.endsWith("\"") && t.length > 1 && (t = t.slice(1, -1)), pe(t);
702
702
  }
703
- function F(e) {
703
+ function I(e) {
704
704
  let t = {}, n = [];
705
705
  for (let r of me(e)) {
706
706
  if (r === "OR" || r === "AND") continue;
707
707
  let e = r.match(/^(\w+):([\s\S]*)$/);
708
708
  if (e) {
709
- let n = e[1], r = P(e[2]);
709
+ let n = e[1], r = F(e[2]);
710
710
  t[n] || (t[n] = []), t[n].push(r);
711
711
  } else {
712
- let e = P(r);
712
+ let e = F(r);
713
713
  e && n.push(e);
714
714
  }
715
715
  }
@@ -718,7 +718,7 @@ function F(e) {
718
718
  terms: n
719
719
  };
720
720
  }
721
- function I(e) {
721
+ function L(e) {
722
722
  return {
723
723
  log_id: "blob1",
724
724
  tenant_id: "blob2",
@@ -739,7 +739,7 @@ function I(e) {
739
739
  hostname: "blob17"
740
740
  }[e] || null;
741
741
  }
742
- function L(e) {
742
+ function R(e) {
743
743
  let t = [];
744
744
  for (let [n, r] of Object.entries(e)) {
745
745
  let e = r.filter((e) => e !== "");
@@ -750,41 +750,41 @@ function L(e) {
750
750
  n.length > 0 && t.push(`(${n.join(" OR ")})`);
751
751
  continue;
752
752
  }
753
- let i = I(n);
754
- if (i) if (e.length === 1) t.push(`${i} = ${j(e[0])}`);
753
+ let i = L(n);
754
+ if (i) if (e.length === 1) t.push(`${i} = ${M(e[0])}`);
755
755
  else {
756
- let n = e.map((e) => j(e)).join(", ");
756
+ let n = e.map((e) => M(e)).join(", ");
757
757
  t.push(`${i} IN (${n})`);
758
758
  }
759
759
  }
760
760
  return t;
761
761
  }
762
- function R(e) {
762
+ function z(e) {
763
763
  return e.filter((e) => e !== "").map((e) => {
764
- let t = j(e), n = j(`%${e}%`);
764
+ let t = M(e), n = M(`%${e}%`);
765
765
  return `(blob7 = ${t} OR blob5 LIKE ${n} OR blob4 LIKE ${n})`;
766
766
  });
767
767
  }
768
- function z(e) {
769
- return e === "date" ? "double2" : I(e) || "timestamp";
770
- }
771
768
  function he(e) {
769
+ return e === "date" ? "double2" : L(e) || "timestamp";
770
+ }
771
+ function ge(e) {
772
772
  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 = ${j(t)}`];
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 = ${M(t)}`];
774
774
  if (s) {
775
- let { fields: e, terms: t } = F(s);
776
- d.push(...L(e)), d.push(...R(t));
775
+ let { fields: e, terms: t } = I(s);
776
+ d.push(...R(e)), d.push(...z(t));
777
777
  }
778
778
  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
779
  let f = d.join(" AND "), p = "ORDER BY timestamp DESC";
780
- o && o.sort_by && (p = `ORDER BY ${z(o.sort_by)} ${o.sort_order === "asc" ? "ASC" : "DESC"}`);
781
- let m = r * i, h = `LIMIT ${i} OFFSET ${m}`, g = (await A(e, `
780
+ o && o.sort_by && (p = `ORDER BY ${he(o.sort_by)} ${o.sort_order === "asc" ? "ASC" : "DESC"}`);
781
+ let m = r * i, h = `LIMIT ${i} OFFSET ${m}`, g = (await j(e, `
782
782
  SELECT *
783
- FROM ${M(u)}
783
+ FROM ${N(u)}
784
784
  WHERE ${f}
785
785
  ${p}
786
786
  ${h}
787
- `)).map(N);
787
+ `)).map(P);
788
788
  if (!a) return {
789
789
  logs: g,
790
790
  start: 0,
@@ -793,11 +793,11 @@ function he(e) {
793
793
  };
794
794
  let _ = `
795
795
  SELECT count() as count
796
- FROM ${M(u)}
796
+ FROM ${N(u)}
797
797
  WHERE ${f}
798
798
  `;
799
799
  try {
800
- let t = (await A(e, _))[0]?.count || 0;
800
+ let t = (await j(e, _))[0]?.count || 0;
801
801
  return {
802
802
  logs: g,
803
803
  start: m,
@@ -816,30 +816,30 @@ function he(e) {
816
816
  }
817
817
  //#endregion
818
818
  //#region src/analytics-engine-logs/stats.ts
819
- var B = ["s"], ge = ["pwd_leak"];
819
+ var B = ["s"], _e = ["pwd_leak"];
820
820
  function V(e) {
821
821
  return `${e.slice(0, 4)}-${e.slice(4, 6)}-${e.slice(6, 8)}`;
822
822
  }
823
823
  function H(e) {
824
824
  return e.toISOString().split("T")[0];
825
825
  }
826
- function _e(e) {
826
+ function ve(e) {
827
827
  let t = e.dataset || "authhero_logs";
828
828
  return {
829
829
  async getDaily(n, r = {}) {
830
830
  let { from: i, to: a } = r, o = /* @__PURE__ */ new Date(), s = new Date(o);
831
831
  s.setDate(s.getDate() - 30);
832
832
  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 A(e, `
833
+ return (await j(e, `
834
834
  SELECT
835
835
  toDate(toDateTime(double2 / 1000)) AS date,
836
- SUM(CASE WHEN blob3 IN (${B.map((e) => j(e)).join(", ")}) THEN 1 ELSE 0 END) AS logins,
836
+ SUM(CASE WHEN blob3 IN (${B.map((e) => M(e)).join(", ")}) THEN 1 ELSE 0 END) AS logins,
837
837
  SUM(CASE WHEN blob3 = 'ss' THEN 1 ELSE 0 END) AS signups,
838
- SUM(CASE WHEN blob3 IN (${ge.map((e) => j(e)).join(", ")}) THEN 1 ELSE 0 END) AS leaked_passwords,
838
+ SUM(CASE WHEN blob3 IN (${_e.map((e) => M(e)).join(", ")}) THEN 1 ELSE 0 END) AS leaked_passwords,
839
839
  MIN(double2) AS first_event,
840
840
  MAX(double2) AS last_event
841
841
  FROM "${t}"
842
- WHERE index1 = ${j(n)}
842
+ WHERE index1 = ${M(n)}
843
843
  AND double2 >= ${u}
844
844
  AND double2 <= ${d}
845
845
  GROUP BY date
@@ -856,10 +856,10 @@ function _e(e) {
856
856
  async getActiveUsers(n) {
857
857
  let r = /* @__PURE__ */ new Date();
858
858
  r.setDate(r.getDate() - 30);
859
- let i = r.getTime(), a = B.map((e) => j(e)).join(", "), o = (await A(e, `
859
+ let i = r.getTime(), a = B.map((e) => M(e)).join(", "), o = (await j(e, `
860
860
  SELECT COUNT(DISTINCT blob7) AS count
861
861
  FROM "${t}"
862
- WHERE index1 = ${j(n)}
862
+ WHERE index1 = ${M(n)}
863
863
  AND double2 >= ${i}
864
864
  AND blob3 IN (${a})
865
865
  AND blob7 IS NOT NULL
@@ -871,7 +871,7 @@ function _e(e) {
871
871
  }
872
872
  //#endregion
873
873
  //#region src/analytics-engine-logs/analytics.ts
874
- var ve = {
874
+ var ye = {
875
875
  "active-users": ["s", "seacft"],
876
876
  logins: [
877
877
  "s",
@@ -901,17 +901,17 @@ var ve = {
901
901
  "fvr"
902
902
  ],
903
903
  "codes-sent": ["cls", "cs"]
904
- }, ye = {
904
+ }, be = {
905
905
  connection: "blob9",
906
906
  client_id: "blob11",
907
907
  user_type: "blob16",
908
908
  event: "blob3"
909
- }, be = {
909
+ }, xe = {
910
910
  connection: "blob9",
911
911
  client_id: "blob11",
912
912
  user_type: "blob16",
913
913
  user_id: "blob7"
914
- }, xe = {
914
+ }, Se = {
915
915
  "active-users": {
916
916
  expr: "count(DISTINCT blob7)",
917
917
  alias: "active_users",
@@ -968,8 +968,8 @@ var ve = {
968
968
  type: "UInt64"
969
969
  }
970
970
  };
971
- function Se(e, t) {
972
- let n = `toDateTime(intDiv(double2, 1000), ${j(t)})`;
971
+ function Ce(e, t) {
972
+ let n = `toDateTime(intDiv(double2, 1000), ${M(t)})`;
973
973
  switch (e) {
974
974
  case "hour": return `toStartOfHour(${n})`;
975
975
  case "week": return `toStartOfWeek(${n})`;
@@ -977,45 +977,45 @@ function Se(e, t) {
977
977
  default: return `toStartOfDay(${n})`;
978
978
  }
979
979
  }
980
- function Ce(e) {
980
+ function we(e) {
981
981
  return e === "hour" ? "DateTime" : "Date";
982
982
  }
983
- function we(e, t, n) {
984
- let r = new Date(e.from).getTime(), i = new Date(e.to).getTime(), a = n.map((e) => j(e)).join(", "), o = [
985
- `index1 = ${j(t)}`,
983
+ function Te(e, t, n) {
984
+ let r = new Date(e.from).getTime(), i = new Date(e.to).getTime(), a = n.map((e) => M(e)).join(", "), o = [
985
+ `index1 = ${M(t)}`,
986
986
  `double2 >= ${r}`,
987
987
  `double2 < ${i}`,
988
988
  `blob3 IN (${a})`
989
989
  ];
990
- for (let [t, n] of Object.entries(be)) {
990
+ for (let [t, n] of Object.entries(xe)) {
991
991
  let r = e.filters[t];
992
992
  if (r && r.length > 0) {
993
- let e = r.map((e) => j(e)).join(", ");
993
+ let e = r.map((e) => M(e)).join(", ");
994
994
  o.push(`${n} IN (${e})`);
995
995
  }
996
996
  }
997
997
  return o.join(" AND ");
998
998
  }
999
- function Te(e, t, n) {
999
+ function Ee(e, t, n) {
1000
1000
  if (e.order_by) {
1001
1001
  let t = e.order_by.startsWith("-");
1002
- return `${M(t ? e.order_by.slice(1) : e.order_by)} ${t ? "DESC" : "ASC"}`;
1002
+ return `${N(t ? e.order_by.slice(1) : e.order_by)} ${t ? "DESC" : "ASC"}`;
1003
1003
  }
1004
- return t.length > 0 && t[0] === "time" ? `${M("time")} ASC` : `${M(n)} DESC`;
1004
+ return t.length > 0 && t[0] === "time" ? `${N("time")} ASC` : `${N(n)} DESC`;
1005
1005
  }
1006
1006
  function U(e) {
1007
1007
  let t = e.dataset || "authhero_logs";
1008
1008
  return { async query(n, r, i) {
1009
- let a = ve[r], o = xe[r], s = [], c = [];
1009
+ let a = ye[r], o = Se[r], s = [], c = [];
1010
1010
  for (let e of i.group_by) if (e === "time") {
1011
- let e = Se(i.interval, i.tz);
1012
- s.push(`${e} AS ${M("time")}`), c.push({
1011
+ let e = Ce(i.interval, i.tz);
1012
+ s.push(`${e} AS ${N("time")}`), c.push({
1013
1013
  name: "time",
1014
- type: Ce(i.interval)
1014
+ type: we(i.interval)
1015
1015
  });
1016
1016
  } else {
1017
- let t = ye[e];
1018
- s.push(`${t} AS ${M(e)}`), c.push({
1017
+ let t = be[e];
1018
+ s.push(`${t} AS ${N(e)}`), c.push({
1019
1019
  name: e,
1020
1020
  type: "String"
1021
1021
  });
@@ -1024,10 +1024,10 @@ function U(e) {
1024
1024
  name: o.alias,
1025
1025
  type: o.type
1026
1026
  });
1027
- 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 = Te(i, i.group_by.map((e) => e === "time" ? "time" : e), o.alias), f = `
1027
+ let l = [...s, `${o.expr} AS ${N(o.alias)}`], u = i.group_by.length ? `GROUP BY ${i.group_by.map((e) => N(e === "time" ? "time" : e)).join(", ")}` : "", d = Ee(i, i.group_by.map((e) => e === "time" ? "time" : e), o.alias), f = `
1028
1028
  SELECT ${l.join(", ")}
1029
- FROM ${M(t)}
1030
- WHERE ${we(i, n, a)}
1029
+ FROM ${N(t)}
1030
+ WHERE ${Te(i, n, a)}
1031
1031
  ${u}
1032
1032
  ORDER BY ${d}
1033
1033
  LIMIT ${Math.max(0, i.limit)} OFFSET ${Math.max(0, i.offset)}
@@ -1067,13 +1067,13 @@ function U(e) {
1067
1067
  function W(e) {
1068
1068
  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
1069
  create: ue(e),
1070
- list: he(e),
1070
+ list: ge(e),
1071
1071
  get: fe(e)
1072
1072
  };
1073
1073
  }
1074
1074
  //#endregion
1075
1075
  //#region src/analytics-engine-action-executions/actionExecutions.ts
1076
- var Ee = "authhero_action_executions", De = 1024, G = "[truncated]";
1076
+ var De = "authhero_action_executions", G = 1024, Oe = "[truncated]";
1077
1077
  function K(e) {
1078
1078
  if (!(typeof e != "string" || e.length === 0)) try {
1079
1079
  return JSON.parse(e);
@@ -1081,30 +1081,30 @@ function K(e) {
1081
1081
  return;
1082
1082
  }
1083
1083
  }
1084
- function Oe(e) {
1085
- let t = i.safeParse(e);
1084
+ function ke(e) {
1085
+ let t = a.safeParse(e);
1086
1086
  return t.success ? t.data : "unspecified";
1087
1087
  }
1088
- function q(e, t = De) {
1089
- return e.length <= t ? e : `${e.substring(0, t - 11)}${G}`;
1088
+ function q(e, t = G) {
1089
+ return e.length <= t ? e : `${e.substring(0, t - 11)}${Oe}`;
1090
1090
  }
1091
1091
  function J(e) {
1092
1092
  return e == null ? "" : JSON.stringify(e);
1093
1093
  }
1094
- function ke(e) {
1094
+ function Ae(e) {
1095
1095
  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
1096
  return {
1097
1097
  id: typeof e.blob1 == "string" ? e.blob1 : "",
1098
1098
  tenant_id: typeof e.index1 == "string" ? e.index1 : "",
1099
1099
  trigger_id: typeof e.blob2 == "string" ? e.blob2 : "",
1100
- status: Oe(e.blob3),
1100
+ status: ke(e.blob3),
1101
1101
  results: K(e.blob4) ?? [],
1102
1102
  logs: K(e.blob5),
1103
1103
  created_at: t,
1104
1104
  updated_at: n
1105
1105
  };
1106
1106
  }
1107
- function Ae(e) {
1107
+ function je(e) {
1108
1108
  return async (t, n) => {
1109
1109
  let r = Date.now(), i = new Date(r).toISOString(), a = {
1110
1110
  id: n.id,
@@ -1116,10 +1116,10 @@ function Ae(e) {
1116
1116
  created_at: i,
1117
1117
  updated_at: i
1118
1118
  };
1119
- return je(e, t, a, r), a;
1119
+ return Me(e, t, a, r), a;
1120
1120
  };
1121
1121
  }
1122
- function je(e, t, n, r) {
1122
+ function Me(e, t, n, r) {
1123
1123
  if (!e.analyticsEngineBinding) {
1124
1124
  console.error("Analytics Engine action_executions binding not configured; skipping write");
1125
1125
  return;
@@ -1142,29 +1142,29 @@ function je(e, t, n, r) {
1142
1142
  console.error("Failed to write action_execution to Analytics Engine:", e);
1143
1143
  }
1144
1144
  }
1145
- function Me(e) {
1145
+ function Ne(e) {
1146
1146
  return async (t, n) => {
1147
- let r = await A(e, `
1147
+ let r = await j(e, `
1148
1148
  SELECT *
1149
- FROM ${M(e.dataset || Ee)}
1150
- WHERE index1 = ${j(t)}
1151
- AND blob1 = ${j(n)}
1149
+ FROM ${N(e.dataset || De)}
1150
+ WHERE index1 = ${M(t)}
1151
+ AND blob1 = ${M(n)}
1152
1152
  LIMIT 1
1153
1153
  `);
1154
- return r.length === 0 || !r[0] ? null : ke(r[0]);
1154
+ return r.length === 0 || !r[0] ? null : Ae(r[0]);
1155
1155
  };
1156
1156
  }
1157
1157
  //#endregion
1158
1158
  //#region src/analytics-engine-action-executions/index.ts
1159
1159
  function Y(e) {
1160
1160
  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: Ae(e),
1162
- get: Me(e)
1161
+ create: je(e),
1162
+ get: Ne(e)
1163
1163
  };
1164
1164
  }
1165
1165
  //#endregion
1166
1166
  //#region src/geo/index.ts
1167
- function Ne() {
1167
+ function Pe() {
1168
1168
  return { async getGeoInfo(e) {
1169
1169
  try {
1170
1170
  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 +1183,7 @@ function Ne() {
1183
1183
  }
1184
1184
  //#endregion
1185
1185
  //#region src/rate-limit/index.ts
1186
- var Pe = class {
1186
+ var Fe = class {
1187
1187
  bindings;
1188
1188
  constructor(e) {
1189
1189
  this.bindings = e;
@@ -1200,7 +1200,7 @@ var Pe = class {
1200
1200
  }
1201
1201
  };
1202
1202
  function X(e) {
1203
- if (e && Object.keys(e).some((t) => e[t])) return new Pe(e);
1203
+ if (e && Object.keys(e).some((t) => e[t])) return new Fe(e);
1204
1204
  }
1205
1205
  //#endregion
1206
1206
  //#region src/code-executor/worker-template.ts
@@ -1214,25 +1214,9 @@ const fnNames = {
1214
1214
  "post-user-registration": "onExecutePostUserRegistration",
1215
1215
  };
1216
1216
 
1217
- const apiShapes = {
1218
- "post-user-login": {
1219
- accessToken: ["setCustomClaim"],
1220
- idToken: ["setCustomClaim"],
1221
- access: ["deny"],
1222
- prompt: ["render"],
1223
- redirect: ["sendUserTo"],
1224
- },
1225
- "credentials-exchange": {
1226
- accessToken: ["setCustomClaim"],
1227
- idToken: ["setCustomClaim"],
1228
- access: ["deny"],
1229
- },
1230
- "pre-user-registration": {
1231
- user: ["setUserMetadata", "setLinkedTo"],
1232
- access: ["deny"],
1233
- },
1234
- "post-user-registration": {},
1235
- };
1217
+ // Shared source of truth for the per-trigger API allowlist — see
1218
+ // TRIGGER_API_SHAPES in @authhero/adapter-interfaces.
1219
+ const apiShapes = ${JSON.stringify(i)};
1236
1220
 
1237
1221
  function createRecordingApiProxy(triggerId) {
1238
1222
  const calls = [];
@@ -1398,39 +1382,21 @@ var Q = class {
1398
1382
  throw Error(`Failed to remove hook worker ${t}: ${r.status} ${e}`);
1399
1383
  }
1400
1384
  }
1401
- }, Fe = Q, Ie = {
1385
+ }, Ie = Q, Le = {
1402
1386
  "post-user-login": "onExecutePostLogin",
1403
1387
  "credentials-exchange": "onExecuteCredentialsExchange",
1404
1388
  "pre-user-registration": "onExecutePreUserRegistration",
1405
1389
  "post-user-registration": "onExecutePostUserRegistration"
1406
- }, Le = {
1407
- "post-user-login": {
1408
- accessToken: ["setCustomClaim"],
1409
- idToken: ["setCustomClaim"],
1410
- access: ["deny"],
1411
- prompt: ["render"],
1412
- redirect: ["sendUserTo"]
1413
- },
1414
- "credentials-exchange": {
1415
- accessToken: ["setCustomClaim"],
1416
- idToken: ["setCustomClaim"],
1417
- access: ["deny"]
1418
- },
1419
- "pre-user-registration": {
1420
- user: ["setUserMetadata", "setLinkedTo"],
1421
- access: ["deny"]
1422
- },
1423
- "post-user-registration": {}
1424
- };
1425
- async function Re(e) {
1390
+ }, Re = i;
1391
+ async function ze(e) {
1426
1392
  let t = new TextEncoder().encode(e), n = await crypto.subtle.digest("SHA-256", t), r = new Uint8Array(n), i = "";
1427
1393
  for (let e of r) i += e.toString(16).padStart(2, "0");
1428
1394
  return i;
1429
1395
  }
1430
- function ze(e) {
1396
+ function Be(e) {
1431
1397
  return `
1432
- const TRIGGER_FN_NAMES = ${JSON.stringify(Ie)};
1433
- const API_SHAPES = ${JSON.stringify(Le)};
1398
+ const TRIGGER_FN_NAMES = ${JSON.stringify(Le)};
1399
+ const API_SHAPES = ${JSON.stringify(Re)};
1434
1400
  const MAX_LOG_ENTRIES = 50;
1435
1401
  const MAX_LOG_LENGTH = 500;
1436
1402
 
@@ -1530,7 +1496,7 @@ export default {
1530
1496
  };
1531
1497
  `;
1532
1498
  }
1533
- var Be = class {
1499
+ var Ve = class {
1534
1500
  loader;
1535
1501
  compatibilityDate;
1536
1502
  constructor(e) {
@@ -1539,11 +1505,11 @@ var Be = class {
1539
1505
  async execute(e) {
1540
1506
  let t = Date.now();
1541
1507
  try {
1542
- let t = ze(e.code), n = {
1508
+ let t = Be(e.code), n = {
1543
1509
  compatibilityDate: this.compatibilityDate,
1544
1510
  mainModule: "hook.js",
1545
1511
  modules: { "hook.js": t }
1546
- }, r = e.hookCodeId ? `${e.hookCodeId}-${await Re(e.code)}` : null;
1512
+ }, r = e.hookCodeId ? `${e.hookCodeId}-${await ze(e.code)}` : null;
1547
1513
  return await (await (r ? this.loader.get(r, async () => n) : this.loader.load(n)).getEntrypoint().fetch(new Request("https://hook/execute", {
1548
1514
  method: "POST",
1549
1515
  headers: { "Content-Type": "application/json" },
@@ -1564,7 +1530,7 @@ var Be = class {
1564
1530
  };
1565
1531
  //#endregion
1566
1532
  //#region src/wfp-provisioner/provisioner.ts
1567
- function Ve(e) {
1533
+ function He(e) {
1568
1534
  let t = n(e);
1569
1535
  return {
1570
1536
  async onProvision(e) {
@@ -1585,10 +1551,10 @@ function Ve(e) {
1585
1551
  }
1586
1552
  //#endregion
1587
1553
  //#region src/wfp-provisioner/tenant-hook.ts
1588
- function He(e) {
1554
+ function Ue(e) {
1589
1555
  return e.deployment_type === "wfp";
1590
1556
  }
1591
- var Ue = 2048;
1557
+ var We = 2048;
1592
1558
  function $(e) {
1593
1559
  let t;
1594
1560
  if (e instanceof Error) t = e.message;
@@ -1597,10 +1563,10 @@ function $(e) {
1597
1563
  } catch {
1598
1564
  t = Object.prototype.toString.call(e);
1599
1565
  }
1600
- return t.slice(0, Ue);
1566
+ return t.slice(0, We);
1601
1567
  }
1602
- function We(e) {
1603
- let { provisioner: t, tenants: n, syncDefaults: i } = e, a = e.shouldProvision ?? He, o = e.logger;
1568
+ function Ge(e) {
1569
+ let { provisioner: t, tenants: n, syncDefaults: i } = e, a = e.shouldProvision ?? Ue, o = e.logger;
1604
1570
  async function s(e, t) {
1605
1571
  try {
1606
1572
  await n.update(e, {
@@ -1694,15 +1660,15 @@ function We(e) {
1694
1660
  }
1695
1661
  //#endregion
1696
1662
  //#region src/wfp-provisioner/wfp-forward.ts
1697
- var Ge = "DISPATCHER", Ke = "tenant-{tenant_id}-auth", qe = ["/u/widget/"];
1698
- function Je(e) {
1663
+ var Ke = "DISPATCHER", qe = "tenant-{tenant_id}-auth", Je = ["/u/widget/"];
1664
+ function Ye(e) {
1699
1665
  return typeof e == "object" && !!e && "get" in e && typeof Reflect.get(e, "get") == "function";
1700
1666
  }
1701
- function Ye(e, t) {
1667
+ function Xe(e, t) {
1702
1668
  return e.replace(/\{tenant_id\}/g, t);
1703
1669
  }
1704
- function Xe(e) {
1705
- let { tenants: t, controlPlaneTenantId: n, dispatcherBinding: r = Ge, scriptNameTemplate: i = Ke, resolveTenantId: a = (e) => e.req.header("tenant-id"), localPaths: o = qe } = e;
1670
+ function Ze(e) {
1671
+ let { tenants: t, controlPlaneTenantId: n, dispatcherBinding: r = Ke, scriptNameTemplate: i = qe, resolveTenantId: a = (e) => e.req.header("tenant-id"), localPaths: o = Je } = e;
1706
1672
  return async (e, s) => {
1707
1673
  if (o.length > 0) {
1708
1674
  let t = e.req.path;
@@ -1713,8 +1679,8 @@ function Xe(e) {
1713
1679
  let l = await t.get(c);
1714
1680
  if (!l || l.deployment_type !== "wfp" || l.provisioning_state && l.provisioning_state !== "ready") return s();
1715
1681
  let u = Reflect.get(e.env ?? {}, r);
1716
- if (!Je(u)) return s();
1717
- let d = Ye(i, c), f;
1682
+ if (!Ye(u)) return s();
1683
+ let d = Xe(i, c), f;
1718
1684
  try {
1719
1685
  f = await u.get(d).fetch(e.req.raw);
1720
1686
  } catch (t) {
@@ -1737,19 +1703,19 @@ function Xe(e) {
1737
1703
  }
1738
1704
  //#endregion
1739
1705
  //#region src/index.ts
1740
- function Ze(e) {
1706
+ function Qe(e) {
1741
1707
  let t = {
1742
- customDomains: ee(e),
1743
- cache: ne({
1708
+ customDomains: te(e),
1709
+ cache: re({
1744
1710
  ...e.cacheName && { cacheName: e.cacheName },
1745
1711
  ...e.defaultTtlSeconds !== void 0 && { defaultTtlSeconds: e.defaultTtlSeconds },
1746
1712
  ...e.keyPrefix && { keyPrefix: e.keyPrefix }
1747
1713
  }),
1748
- geo: Ne()
1714
+ geo: Pe()
1749
1715
  };
1750
- 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 = Y(e.analyticsEngineActionExecutions));
1716
+ e.r2SqlLogs ? t.logs = A(e.r2SqlLogs) : e.analyticsEngineLogs && (t.logs = W(e.analyticsEngineLogs)), e.analyticsEngineLogs && (t.analytics = U(e.analyticsEngineLogs)), e.analyticsEngineActionExecutions && (t.actionExecutions = Y(e.analyticsEngineActionExecutions));
1751
1717
  let n = X(e.rateLimitBindings);
1752
1718
  return n && (t.rateLimit = n), t;
1753
1719
  }
1754
1720
  //#endregion
1755
- export { t as CloudflareApiClient, e as CloudflareApiError, Fe as CloudflareCodeExecutor, Q as DispatchNamespaceCodeExecutor, Be as WorkerLoaderCodeExecutor, Y as createAnalyticsEngineActionExecutionsAdapter, U as createAnalyticsEngineAnalyticsAdapter, W as createAnalyticsEngineLogsAdapter, _e as createAnalyticsEngineStatsAdapter, X as createCloudflareRateLimitAdapter, Ve as createCloudflareWfpD1Provisioner, k as createR2SQLLogsAdapter, le as createR2SQLStatsAdapter, Xe as createWfpForwardMiddleware, n as createWfpProvisionerSteps, We as createWfpTenantProvisioningHook, Ze as default, Z as generateWorkerScript };
1721
+ export { t as CloudflareApiClient, e as CloudflareApiError, Ie as CloudflareCodeExecutor, Q as DispatchNamespaceCodeExecutor, Ve as WorkerLoaderCodeExecutor, Y as createAnalyticsEngineActionExecutionsAdapter, U as createAnalyticsEngineAnalyticsAdapter, W as createAnalyticsEngineLogsAdapter, ve as createAnalyticsEngineStatsAdapter, X as createCloudflareRateLimitAdapter, He as createCloudflareWfpD1Provisioner, A as createR2SQLLogsAdapter, le as createR2SQLStatsAdapter, Ze as createWfpForwardMiddleware, n as createWfpProvisionerSteps, Ge as createWfpTenantProvisioningHook, Qe as default, Z as generateWorkerScript };