@authhero/cloudflare-adapter 2.32.7 → 2.33.1

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.
@@ -237,7 +237,7 @@ function te(e, t, n) {
237
237
  };
238
238
  }
239
239
  //#endregion
240
- //#region ../../node_modules/.pnpm/hono@4.12.24/node_modules/hono/dist/http-exception.js
240
+ //#region ../../node_modules/.pnpm/hono@4.12.25/node_modules/hono/dist/http-exception.js
241
241
  var _ = class extends Error {
242
242
  res;
243
243
  status;
@@ -11288,7 +11288,7 @@ var tm = /* @__PURE__ */ i({
11288
11288
  xor: () => wf
11289
11289
  });
11290
11290
  //#endregion
11291
- //#region ../../node_modules/.pnpm/@hono+zod-openapi@1.4.0_hono@4.12.24_zod@4.4.3/node_modules/@hono/zod-openapi/dist/index.js
11291
+ //#region ../../node_modules/.pnpm/@hono+zod-openapi@1.4.0_hono@4.12.25_zod@4.4.3/node_modules/@hono/zod-openapi/dist/index.js
11292
11292
  y(Aa()), ee(tm);
11293
11293
  //#endregion
11294
11294
  //#region ../../node_modules/.pnpm/wretch@3.0.8/node_modules/wretch/dist/middlewares/dedupe.js
@@ -11479,6 +11479,10 @@ function xm(e) {
11479
11479
  domain: c.domain,
11480
11480
  type: c.type,
11481
11481
  domain_metadata: n.domain_metadata
11482
+ }), await e.customDomainAdapter.update(t, c.custom_domain_id, {
11483
+ status: c.status,
11484
+ primary: c.primary,
11485
+ verification: c.verification
11482
11486
  }), c;
11483
11487
  },
11484
11488
  get: async (t, n) => {
@@ -11488,32 +11492,26 @@ function xm(e) {
11488
11492
  try {
11489
11493
  i = await vm(e).get(`/custom_hostnames/${encodeURIComponent(n)}`).json();
11490
11494
  } catch (e) {
11491
- throw new _(503, { message: `Failed to fetch custom hostname from Cloudflare: ${e instanceof Error ? e.message : String(e)}` });
11495
+ return console.warn(`[custom-domains] CF fetch failed for ${n} (tenant=${t}); returning stale DB row:`, e instanceof Error ? e.message : e), r;
11492
11496
  }
11493
11497
  let a = _m.safeParse(i);
11494
- if (!a.success || !a.data.success) throw new _(503, { message: `Failed to parse custom hostname response: ${JSON.stringify(a.success ? a.data.errors : a.error.issues)}` });
11498
+ if (!a.success || !a.data.success) return console.warn(`[custom-domains] CF response unparseable for ${n} (tenant=${t}); returning stale DB row.`, a.success ? { cfErrors: a.data.errors } : {
11499
+ zodIssues: a.error.issues,
11500
+ body: i
11501
+ }), r;
11495
11502
  let { result: o } = a.data;
11496
11503
  if (e.enterprise && o.custom_metadata?.tenant_id !== t) throw new _(404);
11497
- return bm({
11504
+ let s = bm({
11498
11505
  ...r,
11499
11506
  ...o
11500
11507
  });
11508
+ return (s.status !== r.status || JSON.stringify(s.verification) !== JSON.stringify(r.verification)) && await e.customDomainAdapter.update(t, n, {
11509
+ status: s.status,
11510
+ verification: s.verification
11511
+ }), s;
11501
11512
  },
11502
11513
  getByDomain: async (t) => e.customDomainAdapter.getByDomain(t),
11503
- list: async (t) => {
11504
- let n = await e.customDomainAdapter.list(t);
11505
- return (await Promise.all(n.map(async (n) => {
11506
- try {
11507
- let r = await vm(e).get(`/custom_hostnames/${encodeURIComponent(n.custom_domain_id)}`).json(), { result: i, success: a } = _m.parse(r);
11508
- return !a || e.enterprise && i.custom_metadata?.tenant_id !== t ? null : bm({
11509
- ...n,
11510
- ...i
11511
- });
11512
- } catch {
11513
- return null;
11514
- }
11515
- }))).filter((e) => e !== null);
11516
- },
11514
+ list: async (t) => e.customDomainAdapter.list(t),
11517
11515
  remove: async (t, n) => {
11518
11516
  if (e.enterprise) {
11519
11517
  let { result: r, success: i } = _m.parse(await vm(e).get(`/custom_hostnames/${encodeURIComponent(n)}`).json());
@@ -11556,10 +11554,14 @@ function xm(e) {
11556
11554
  custom_key: r.private_key
11557
11555
  } }, `/custom_hostnames/${encodeURIComponent(n)}`).json(), { result: o, errors: s, success: c } = _m.parse(a);
11558
11556
  if (!c) throw new _(503, { message: JSON.stringify(s) });
11559
- return bm({
11557
+ let l = bm({
11560
11558
  ...i,
11561
11559
  ...o
11562
11560
  });
11561
+ return await e.customDomainAdapter.update(t, n, {
11562
+ status: l.status,
11563
+ verification: l.verification
11564
+ }), l;
11563
11565
  }
11564
11566
  };
11565
11567
  }