@authhero/drizzle 0.55.0 → 0.56.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.
@@ -16328,7 +16328,11 @@ rb.superRefine(ib), rb.extend({
16328
16328
  id: V(),
16329
16329
  created_at: V(),
16330
16330
  updated_at: V()
16331
- }).superRefine(ib);
16331
+ }).superRefine(ib), q({
16332
+ id: V().optional(),
16333
+ created_at: V().datetime({ offset: !0 }).optional(),
16334
+ updated_at: V().datetime({ offset: !0 }).optional()
16335
+ });
16332
16336
  function ab(e) {
16333
16337
  return typeof e == "object" && !!e && !Array.isArray(e);
16334
16338
  }
@@ -17645,9 +17649,31 @@ function px(e) {
17645
17649
  };
17646
17650
  }
17647
17651
  //#endregion
17652
+ //#region src/adapters/atomic.ts
17653
+ function mx(e) {
17654
+ let t = e;
17655
+ return typeof t == "object" && !!t && "batch" in t && typeof t.batch == "function";
17656
+ }
17657
+ async function hx(e, t) {
17658
+ if (mx(e)) return e.batch(t);
17659
+ await e.run(p`BEGIN`);
17660
+ try {
17661
+ let n = [];
17662
+ for (let e of t) n.push(await e);
17663
+ return await e.run(p`COMMIT`), n;
17664
+ } catch (t) {
17665
+ try {
17666
+ await e.run(p`ROLLBACK`);
17667
+ } catch (e) {
17668
+ console.error("runAtomic rollback failed", e);
17669
+ }
17670
+ throw t;
17671
+ }
17672
+ }
17673
+ //#endregion
17648
17674
  //#region src/adapters/refreshTokens.ts
17649
17675
  Xe();
17650
- function mx(e) {
17676
+ function gx(e) {
17651
17677
  let { tenant_id: t, created_at_ts: n, expires_at_ts: r, idle_expires_at_ts: i, last_exchanged_at_ts: a, revoked_at_ts: o, rotated_at_ts: s, device: c, resource_servers: l, rotating: u, ...d } = e, f = Ab({
17652
17678
  created_at_ts: n,
17653
17679
  expires_at_ts: r,
@@ -17670,10 +17696,10 @@ function mx(e) {
17670
17696
  resource_servers: A(l, [])
17671
17697
  });
17672
17698
  }
17673
- function hx(e, t) {
17699
+ function _x(e, t) {
17674
17700
  return Math.max(e ?? 0, t ?? 0);
17675
17701
  }
17676
- function gx(e) {
17702
+ function vx(e) {
17677
17703
  return {
17678
17704
  async create(t, n) {
17679
17705
  let r = Date.now(), i = {
@@ -17694,30 +17720,22 @@ function gx(e) {
17694
17720
  expires_at_ts: $(n.expires_at),
17695
17721
  idle_expires_at_ts: $(n.idle_expires_at),
17696
17722
  last_exchanged_at_ts: $(n.last_exchanged_at)
17697
- };
17698
- await e.run(p`BEGIN`);
17699
- try {
17700
- await e.insert(S).values(i);
17701
- let n = hx(i.expires_at_ts, i.idle_expires_at_ts);
17702
- n > 0 && i.login_id && await e.update(C).set({
17703
- expires_at_ts: n,
17704
- updated_at_ts: r
17705
- }).where(h(m(C.tenant_id, t), m(C.id, i.login_id), je(C.expires_at_ts, n))), await e.run(p`COMMIT`);
17706
- } catch (t) {
17707
- throw await e.run(p`ROLLBACK`), t;
17708
- }
17709
- return mx({
17723
+ }, a = [e.insert(S).values(i)], o = _x(i.expires_at_ts, i.idle_expires_at_ts);
17724
+ return o > 0 && i.login_id && a.push(e.update(C).set({
17725
+ expires_at_ts: o,
17726
+ updated_at_ts: r
17727
+ }).where(h(m(C.tenant_id, t), m(C.id, i.login_id), je(C.expires_at_ts, o)))), await hx(e, a), gx({
17710
17728
  ...i,
17711
17729
  tenant_id: t
17712
17730
  });
17713
17731
  },
17714
17732
  async get(t, n) {
17715
17733
  let r = await e.select().from(S).where(h(m(S.tenant_id, t), m(S.id, n))).get();
17716
- return r ? mx(r) : null;
17734
+ return r ? gx(r) : null;
17717
17735
  },
17718
17736
  async getByLookup(t, n) {
17719
17737
  let r = await e.select().from(S).where(h(m(S.tenant_id, t), m(S.token_lookup, n))).get();
17720
- return r ? mx(r) : null;
17738
+ return r ? gx(r) : null;
17721
17739
  },
17722
17740
  async update(t, n, r, i) {
17723
17741
  let a = {};
@@ -17738,7 +17756,7 @@ function gx(e) {
17738
17756
  let e = S[o.sort_by];
17739
17757
  e && (c = c.orderBy(o.sort_order === "desc" ? ze(e) : Re(e)));
17740
17758
  }
17741
- let l = (await c.offset(r * i).limit(i)).map(mx);
17759
+ let l = (await c.offset(r * i).limit(i)).map(gx);
17742
17760
  if (!a) return { refresh_tokens: l };
17743
17761
  let [u] = await e.select({ count: Be() }).from(S).where(m(S.tenant_id, t));
17744
17762
  return {
@@ -17761,16 +17779,16 @@ function gx(e) {
17761
17779
  }
17762
17780
  //#endregion
17763
17781
  //#region src/adapters/resourceServers.ts
17764
- var _x = ["name", "identifier"];
17765
- function vx() {
17782
+ var yx = ["name", "identifier"];
17783
+ function bx() {
17766
17784
  let { customAlphabet: e } = (Xe(), s(Ge));
17767
17785
  return `api_${e("0123456789abcdefghijklmnopqrstuvwxyz", 17)()}`;
17768
17786
  }
17769
- var yx = [
17787
+ var xx = [
17770
17788
  "skip_consent_for_verifiable_first_party_clients",
17771
17789
  "allow_offline_access",
17772
17790
  "is_system"
17773
- ], bx = /* @__PURE__ */ new Set([
17791
+ ], Sx = /* @__PURE__ */ new Set([
17774
17792
  "id",
17775
17793
  "tenant_id",
17776
17794
  "identifier",
@@ -17789,17 +17807,17 @@ var yx = [
17789
17807
  "created_at",
17790
17808
  "updated_at"
17791
17809
  ]);
17792
- function xx(e) {
17810
+ function Cx(e) {
17793
17811
  let { tenant_id: t, verification_key: n, scopes: r, options: i, metadata: a, ...o } = e, s = { ...o };
17794
17812
  s.scopes = A(r, []), s.options = A(i, {}), s.metadata = A(a), n !== void 0 && (s.verificationKey = n);
17795
- for (let e of yx) o[e] !== void 0 && o[e] !== null && (s[e] = !!o[e]);
17813
+ for (let e of xx) o[e] !== void 0 && o[e] !== null && (s[e] = !!o[e]);
17796
17814
  return k(s);
17797
17815
  }
17798
- function Sx(e) {
17816
+ function wx(e) {
17799
17817
  return {
17800
17818
  async create(t, n) {
17801
17819
  let r = (/* @__PURE__ */ new Date()).toISOString(), i = {
17802
- id: n.id || vx(),
17820
+ id: n.id || bx(),
17803
17821
  tenant_id: t,
17804
17822
  identifier: n.identifier,
17805
17823
  name: n.name,
@@ -17814,37 +17832,37 @@ function Sx(e) {
17814
17832
  created_at: r,
17815
17833
  updated_at: r
17816
17834
  };
17817
- for (let e of yx) n[e] !== void 0 && (i[e] = +!!n[e]);
17818
- return i.is_system === void 0 && (i.is_system = 0), await e.insert(fn).values(i), xx({
17835
+ for (let e of xx) n[e] !== void 0 && (i[e] = +!!n[e]);
17836
+ return i.is_system === void 0 && (i.is_system = 0), await e.insert(fn).values(i), Cx({
17819
17837
  ...i,
17820
17838
  tenant_id: t
17821
17839
  });
17822
17840
  },
17823
17841
  async get(t, n) {
17824
17842
  let r = await e.select().from(fn).where(h(m(fn.tenant_id, t), m(fn.id, n))).get();
17825
- return r ? xx(r) : null;
17843
+ return r ? Cx(r) : null;
17826
17844
  },
17827
17845
  async update(t, n, r) {
17828
17846
  let i = { updated_at: (/* @__PURE__ */ new Date()).toISOString() };
17829
17847
  r.name !== void 0 && (i.name = r.name), r.identifier !== void 0 && (i.identifier = r.identifier), r.signing_alg !== void 0 && (i.signing_alg = r.signing_alg), r.signing_secret !== void 0 && (i.signing_secret = r.signing_secret), r.token_lifetime !== void 0 && (i.token_lifetime = r.token_lifetime), r.token_lifetime_for_web !== void 0 && (i.token_lifetime_for_web = r.token_lifetime_for_web), r.scopes !== void 0 && (i.scopes = JSON.stringify(r.scopes)), r.options !== void 0 && (i.options = p`json_patch(COALESCE(${fn.options}, '{}'), ${JSON.stringify(r.options)})`), r.metadata !== void 0 && (i.metadata = JSON.stringify(r.metadata)), r.verificationKey !== void 0 && (i.verification_key = r.verificationKey);
17830
- for (let e of yx) r[e] !== void 0 && (i[e] = +!!r[e]);
17848
+ for (let e of xx) r[e] !== void 0 && (i[e] = +!!r[e]);
17831
17849
  return (await e.update(fn).set(i).where(h(m(fn.tenant_id, t), m(fn.id, n))).returning()).length > 0;
17832
17850
  },
17833
17851
  async list(t, n) {
17834
17852
  let { page: r = 0, per_page: i = 50, include_totals: a = !1, sort: o, q: s } = n || {}, c = Math.max(0, Math.floor(Number(r) || 0)), l = Math.min(Math.max(1, Math.floor(Number(i) || 50)), 500), u = [m(fn.tenant_id, t)];
17835
17853
  if (s) {
17836
- let e = Nn(s, _x);
17854
+ let e = Nn(s, yx);
17837
17855
  if (e) {
17838
- let t = Pn(fn, e, _x, ["name", "identifier"]);
17856
+ let t = Pn(fn, e, yx, ["name", "identifier"]);
17839
17857
  t && u.push(t);
17840
17858
  }
17841
17859
  }
17842
17860
  let d = e.select().from(fn).where(h(...u)).$dynamic();
17843
- if (o?.sort_by && bx.has(o.sort_by)) {
17861
+ if (o?.sort_by && Sx.has(o.sort_by)) {
17844
17862
  let e = fn[o.sort_by];
17845
17863
  d = d.orderBy(o.sort_order === "desc" ? ze(e) : Re(e));
17846
17864
  }
17847
- let f = (await d.offset(c * l).limit(l)).map(xx);
17865
+ let f = (await d.offset(c * l).limit(l)).map(Cx);
17848
17866
  if (!a) return { resource_servers: f };
17849
17867
  let [ee] = await e.select({ count: Be() }).from(fn).where(h(...u));
17850
17868
  return {
@@ -17861,7 +17879,7 @@ function Sx(e) {
17861
17879
  }
17862
17880
  //#endregion
17863
17881
  //#region src/adapters/rolePermissions.ts
17864
- function Cx(e) {
17882
+ function Tx(e) {
17865
17883
  return {
17866
17884
  async assign(t, n, r) {
17867
17885
  let i = (/* @__PURE__ */ new Date()).toISOString();
@@ -17899,7 +17917,7 @@ function Cx(e) {
17899
17917
  }
17900
17918
  //#endregion
17901
17919
  //#region src/adapters/userPermissions.ts
17902
- function wx(e) {
17920
+ function Ex(e) {
17903
17921
  return {
17904
17922
  async create(t, n, r, i) {
17905
17923
  try {
@@ -17939,7 +17957,7 @@ function wx(e) {
17939
17957
  //#endregion
17940
17958
  //#region src/adapters/roles.ts
17941
17959
  Xe();
17942
- function Tx(e) {
17960
+ function Dx(e) {
17943
17961
  let { tenant_id: t, is_system: n, metadata: r, ...i } = e;
17944
17962
  return k({
17945
17963
  ...i,
@@ -17947,7 +17965,7 @@ function Tx(e) {
17947
17965
  metadata: A(r)
17948
17966
  });
17949
17967
  }
17950
- function Ex(e) {
17968
+ function Ox(e) {
17951
17969
  return {
17952
17970
  async create(t, n) {
17953
17971
  let r = (/* @__PURE__ */ new Date()).toISOString(), i = {
@@ -17960,14 +17978,14 @@ function Ex(e) {
17960
17978
  created_at: r,
17961
17979
  updated_at: r
17962
17980
  };
17963
- return await e.insert(cn).values(i), Tx({
17981
+ return await e.insert(cn).values(i), Dx({
17964
17982
  ...i,
17965
17983
  tenant_id: t
17966
17984
  });
17967
17985
  },
17968
17986
  async get(t, n) {
17969
17987
  let r = await e.select().from(cn).where(h(m(cn.tenant_id, t), m(cn.id, n))).get();
17970
- return r ? Tx(r) : null;
17988
+ return r ? Dx(r) : null;
17971
17989
  },
17972
17990
  async update(t, n, r) {
17973
17991
  let i = { updated_at: (/* @__PURE__ */ new Date()).toISOString() };
@@ -17979,7 +17997,7 @@ function Ex(e) {
17979
17997
  let e = cn[o.sort_by];
17980
17998
  e && (u = u.orderBy(o.sort_order === "desc" ? ze(e) : Re(e)));
17981
17999
  }
17982
- let d = (await u.offset(r * i).limit(i)).map(Tx);
18000
+ let d = (await u.offset(r * i).limit(i)).map(Dx);
17983
18001
  if (!a) return { roles: d };
17984
18002
  let [f] = await e.select({ count: Be() }).from(cn).where(l);
17985
18003
  return {
@@ -17997,7 +18015,7 @@ function Ex(e) {
17997
18015
  //#endregion
17998
18016
  //#region src/adapters/sessions.ts
17999
18017
  Xe();
18000
- var Dx = ["created_at_ts", "updated_at_ts"], Ox = [
18018
+ var kx = ["created_at_ts", "updated_at_ts"], Ax = [
18001
18019
  "expires_at_ts",
18002
18020
  "idle_expires_at_ts",
18003
18021
  "authenticated_at_ts",
@@ -18005,7 +18023,7 @@ var Dx = ["created_at_ts", "updated_at_ts"], Ox = [
18005
18023
  "used_at_ts",
18006
18024
  "revoked_at_ts"
18007
18025
  ];
18008
- function kx(e) {
18026
+ function jx(e) {
18009
18027
  let { tenant_id: t, created_at_ts: n, updated_at_ts: r, expires_at_ts: i, idle_expires_at_ts: a, authenticated_at_ts: o, last_interaction_at_ts: s, used_at_ts: c, revoked_at_ts: l, device: u, clients: d, ...f } = e, ee = Ab({
18010
18028
  created_at_ts: n,
18011
18029
  updated_at_ts: r,
@@ -18015,7 +18033,7 @@ function kx(e) {
18015
18033
  last_interaction_at_ts: s,
18016
18034
  used_at_ts: c,
18017
18035
  revoked_at_ts: l
18018
- }, [...Dx], [...Ox]);
18036
+ }, [...kx], [...Ax]);
18019
18037
  return k({
18020
18038
  ...f,
18021
18039
  ...ee,
@@ -18023,10 +18041,10 @@ function kx(e) {
18023
18041
  clients: A(d, [])
18024
18042
  });
18025
18043
  }
18026
- function Ax(e, t) {
18044
+ function Mx(e, t) {
18027
18045
  return Math.max(e ?? 0, t ?? 0);
18028
18046
  }
18029
- function jx(e) {
18047
+ function Nx(e) {
18030
18048
  return {
18031
18049
  async create(t, n) {
18032
18050
  let r = Date.now(), i = {
@@ -18044,31 +18062,23 @@ function jx(e) {
18044
18062
  last_interaction_at_ts: n.last_interaction_at ? $(n.last_interaction_at) : r,
18045
18063
  used_at_ts: $(n.used_at),
18046
18064
  revoked_at_ts: $(n.revoked_at)
18047
- };
18048
- await e.run(p`BEGIN`);
18049
- try {
18050
- await e.insert(Yt).values(i);
18051
- let n = Ax(i.expires_at_ts, i.idle_expires_at_ts);
18052
- n > 0 && i.login_session_id && await e.update(C).set({
18053
- expires_at_ts: n,
18054
- updated_at_ts: r
18055
- }).where(h(m(C.tenant_id, t), m(C.id, i.login_session_id), je(C.expires_at_ts, n))), await e.run(p`COMMIT`);
18056
- } catch (t) {
18057
- throw await e.run(p`ROLLBACK`), t;
18058
- }
18059
- return kx({
18065
+ }, a = [e.insert(Yt).values(i)], o = Mx(i.expires_at_ts, i.idle_expires_at_ts);
18066
+ return o > 0 && i.login_session_id && a.push(e.update(C).set({
18067
+ expires_at_ts: o,
18068
+ updated_at_ts: r
18069
+ }).where(h(m(C.tenant_id, t), m(C.id, i.login_session_id), je(C.expires_at_ts, o)))), await hx(e, a), jx({
18060
18070
  ...i,
18061
18071
  tenant_id: t
18062
18072
  });
18063
18073
  },
18064
18074
  async get(t, n) {
18065
18075
  let r = await e.select().from(Yt).where(h(m(Yt.tenant_id, t), m(Yt.id, n))).get();
18066
- return r ? kx(r) : null;
18076
+ return r ? jx(r) : null;
18067
18077
  },
18068
18078
  async update(t, n, r) {
18069
18079
  let i = { updated_at_ts: Date.now() };
18070
18080
  r.user_id !== void 0 && (i.user_id = r.user_id), r.login_session_id !== void 0 && (i.login_session_id = r.login_session_id), r.device !== void 0 && (i.device = JSON.stringify(r.device)), r.clients !== void 0 && (i.clients = JSON.stringify(r.clients)), r.expires_at !== void 0 && (i.expires_at_ts = $(r.expires_at)), r.idle_expires_at !== void 0 && (i.idle_expires_at_ts = $(r.idle_expires_at)), r.authenticated_at !== void 0 && (i.authenticated_at_ts = $(r.authenticated_at)), r.last_interaction_at !== void 0 && (i.last_interaction_at_ts = $(r.last_interaction_at)), r.used_at !== void 0 && (i.used_at_ts = $(r.used_at)), r.revoked_at !== void 0 && (i.revoked_at_ts = $(r.revoked_at));
18071
- let a = await e.update(Yt).set(i).where(h(m(Yt.tenant_id, t), m(Yt.id, n))).returning(), o = Ax(i.expires_at_ts, i.idle_expires_at_ts), s = a[0];
18081
+ let a = await e.update(Yt).set(i).where(h(m(Yt.tenant_id, t), m(Yt.id, n))).returning(), o = Mx(i.expires_at_ts, i.idle_expires_at_ts), s = a[0];
18072
18082
  if (o > 0 && s) {
18073
18083
  let n = r.login_session_id ?? s.login_session_id;
18074
18084
  n && await e.update(C).set({
@@ -18084,7 +18094,7 @@ function jx(e) {
18084
18094
  let e = Yt[o.sort_by];
18085
18095
  e && (u = u.orderBy(o.sort_order === "desc" ? ze(e) : Re(e)));
18086
18096
  }
18087
- let d = (await u.offset(r * i).limit(i)).map(kx);
18097
+ let d = (await u.offset(r * i).limit(i)).map(jx);
18088
18098
  if (!a) return { sessions: d };
18089
18099
  let [f] = await e.select({ count: Be() }).from(Yt).where(l);
18090
18100
  return {
@@ -18102,7 +18112,7 @@ function jx(e) {
18102
18112
  //#endregion
18103
18113
  //#region src/adapters/tenants.ts
18104
18114
  Xe();
18105
- var Mx = [
18115
+ var Px = [
18106
18116
  "session_cookie",
18107
18117
  "enabled_locales",
18108
18118
  "error_page",
@@ -18118,25 +18128,25 @@ var Mx = [
18118
18128
  "acr_values_supported",
18119
18129
  "mtls",
18120
18130
  "mfa"
18121
- ], Nx = [
18131
+ ], Fx = [
18122
18132
  "allow_organization_name_in_authentication_api",
18123
18133
  "customize_mfa_in_postlogin_action",
18124
18134
  "pushed_authorization_requests_supported",
18125
18135
  "authorization_response_iss_parameter_supported"
18126
18136
  ];
18127
- function Px(e) {
18137
+ function Ix(e) {
18128
18138
  let t = { ...e };
18129
- for (let e of Mx) typeof t[e] == "string" && (t[e] = A(t[e]));
18130
- for (let e of Nx) t[e] !== void 0 && t[e] !== null && (t[e] = t[e] === 1);
18139
+ for (let e of Px) typeof t[e] == "string" && (t[e] = A(t[e]));
18140
+ for (let e of Fx) t[e] !== void 0 && t[e] !== null && (t[e] = t[e] === 1);
18131
18141
  return k(t);
18132
18142
  }
18133
- function Fx(e) {
18143
+ function Lx(e) {
18134
18144
  let t = { ...e };
18135
- Dn(e, Mx, t);
18136
- for (let n of Nx) e[n] !== void 0 && (t[n] = +!!e[n]);
18145
+ Dn(e, Px, t);
18146
+ for (let n of Fx) e[n] !== void 0 && (t[n] = +!!e[n]);
18137
18147
  return kn(t);
18138
18148
  }
18139
- function Ix(e) {
18149
+ function Rx(e) {
18140
18150
  return {
18141
18151
  async create(t) {
18142
18152
  let n = {
@@ -18144,7 +18154,7 @@ function Ix(e) {
18144
18154
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
18145
18155
  updated_at: (/* @__PURE__ */ new Date()).toISOString(),
18146
18156
  ...t
18147
- }, r = Fx(n);
18157
+ }, r = Lx(n);
18148
18158
  try {
18149
18159
  await e.insert(b).values(r);
18150
18160
  } catch (e) {
@@ -18155,7 +18165,7 @@ function Ix(e) {
18155
18165
  },
18156
18166
  async get(t) {
18157
18167
  let n = await e.select().from(b).where(m(b.id, t)).get();
18158
- return n ? Px(n) : null;
18168
+ return n ? Ix(n) : null;
18159
18169
  },
18160
18170
  async list(t) {
18161
18171
  let { page: n = 0, per_page: r = 50, include_totals: i = !1, sort: a, q: o } = t || {}, s = e.select().from(b).$dynamic();
@@ -18167,7 +18177,7 @@ function Ix(e) {
18167
18177
  let e = b[a.sort_by];
18168
18178
  e && (s = s.orderBy(a.sort_order === "desc" ? ze(e) : Re(e)));
18169
18179
  }
18170
- let c = (await s.offset(n * r).limit(r)).map(Px);
18180
+ let c = (await s.offset(n * r).limit(r)).map(Ix);
18171
18181
  if (!i) return { tenants: c };
18172
18182
  let [l] = await e.select({ count: Be() }).from(b);
18173
18183
  return {
@@ -18178,7 +18188,7 @@ function Ix(e) {
18178
18188
  };
18179
18189
  },
18180
18190
  async update(t, n) {
18181
- let r = Fx({
18191
+ let r = Lx({
18182
18192
  ...n,
18183
18193
  id: t,
18184
18194
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
@@ -18193,35 +18203,38 @@ function Ix(e) {
18193
18203
  //#endregion
18194
18204
  //#region src/adapters/themes.ts
18195
18205
  Xe();
18196
- var Lx = [
18206
+ var zx = [
18197
18207
  "colors",
18198
18208
  "borders",
18199
18209
  "fonts",
18200
18210
  "page_background",
18201
18211
  "widget"
18202
18212
  ];
18203
- function Rx(e) {
18204
- let { tenant_id: t, ...n } = e, r = jn(n, Lx);
18205
- return r.borders && (r.borders.show_widget_shadow = !!r.borders.show_widget_shadow), r.fonts && (r.fonts.links_bold = !!r.fonts.links_bold, r.fonts.subtitle_bold = !!r.fonts.subtitle_bold, r.fonts.title_bold = !!r.fonts.title_bold), k(r);
18213
+ function Bx(e) {
18214
+ let { tenant_id: t, ...n } = e, r = jn(n, zx);
18215
+ return r.borders && (r.borders.show_widget_shadow = !!r.borders.show_widget_shadow), r.fonts && (r.fonts.body_text_bold = !!r.fonts.body_text_bold, r.fonts.buttons_text_bold = !!r.fonts.buttons_text_bold, r.fonts.input_labels_bold = !!r.fonts.input_labels_bold, r.fonts.links_bold = !!r.fonts.links_bold, r.fonts.subtitle_bold = !!r.fonts.subtitle_bold, r.fonts.title_bold = !!r.fonts.title_bold), k(r);
18206
18216
  }
18207
- function zx(e) {
18217
+ function Vx(e) {
18208
18218
  return {
18209
- async create(t, n, r) {
18210
- let i = (/* @__PURE__ */ new Date()).toISOString(), a = r || Ye(), o = {
18219
+ async create(t, n, r, i) {
18220
+ let a = i?.importMetadata, o = (/* @__PURE__ */ new Date()).toISOString(), s = a?.id || r || Ye(), c = {
18211
18221
  ...An(n),
18212
18222
  tenant_id: t,
18213
- themeId: a,
18214
- created_at: i,
18215
- updated_at: i
18223
+ themeId: s,
18224
+ created_at: a?.created_at ?? o,
18225
+ updated_at: a?.updated_at ?? o
18216
18226
  };
18217
- return await e.insert(hn).values(o), Rx({
18218
- ...o,
18227
+ return await e.insert(hn).values(c), Bx({
18228
+ ...c,
18219
18229
  tenant_id: t
18220
18230
  });
18221
18231
  },
18222
18232
  async get(t, n) {
18223
18233
  let r = await e.select().from(hn).where(h(m(hn.tenant_id, t), m(hn.themeId, n))).get();
18224
- return r ? Rx(r) : null;
18234
+ return r ? Bx(r) : null;
18235
+ },
18236
+ async list(t) {
18237
+ return (await e.select().from(hn).where(m(hn.tenant_id, t)).all()).map(Bx);
18225
18238
  },
18226
18239
  async update(t, n, r) {
18227
18240
  let i = An(r);
@@ -18234,7 +18247,7 @@ function zx(e) {
18234
18247
  }
18235
18248
  //#endregion
18236
18249
  //#region src/adapters/universalLoginTemplates.ts
18237
- function Bx(e) {
18250
+ function Hx(e) {
18238
18251
  return {
18239
18252
  async get(t) {
18240
18253
  let n = await e.select({ body: mn.body }).from(mn).where(m(mn.tenant_id, t)).get();
@@ -18263,7 +18276,7 @@ function Bx(e) {
18263
18276
  //#endregion
18264
18277
  //#region src/adapters/users.ts
18265
18278
  Xe();
18266
- var Vx = [
18279
+ var Ux = [
18267
18280
  "user_id",
18268
18281
  "email",
18269
18282
  "email_verified",
@@ -18285,13 +18298,13 @@ var Vx = [
18285
18298
  "login_count",
18286
18299
  "created_at",
18287
18300
  "updated_at"
18288
- ], Hx = [
18301
+ ], Wx = [
18289
18302
  "email",
18290
18303
  "name",
18291
18304
  "phone_number",
18292
18305
  "user_id"
18293
18306
  ];
18294
- function Ux(e, t) {
18307
+ function Gx(e, t) {
18295
18308
  let n = {
18296
18309
  connection: e.connection,
18297
18310
  provider: e.provider,
@@ -18304,8 +18317,8 @@ function Ux(e, t) {
18304
18317
  ...typeof e.profileData == "string" ? A(e.profileData, {}) : {}
18305
18318
  }, n;
18306
18319
  }
18307
- function Wx(e, t = []) {
18308
- let { tenant_id: n, app_metadata: r, user_metadata: i, address: a, email_verified: o, phone_verified: s, is_social: c, linked_to: l, profileData: u, ...d } = e, f = Ux(e, !0), ee = t.map((e) => Ux(e, !1));
18320
+ function Kx(e, t = []) {
18321
+ let { tenant_id: n, app_metadata: r, user_metadata: i, address: a, email_verified: o, phone_verified: s, is_social: c, linked_to: l, profileData: u, ...d } = e, f = Gx(e, !0), ee = t.map((e) => Gx(e, !1));
18309
18322
  return k({
18310
18323
  ...d,
18311
18324
  email: e.email || "",
@@ -18318,7 +18331,7 @@ function Wx(e, t = []) {
18318
18331
  identities: [f, ...ee]
18319
18332
  });
18320
18333
  }
18321
- function Gx(e) {
18334
+ function qx(e) {
18322
18335
  let t = async (t, n) => {
18323
18336
  let r = (/* @__PURE__ */ new Date()).toISOString(), i = {
18324
18337
  user_id: n.user_id,
@@ -18357,34 +18370,27 @@ function Gx(e) {
18357
18370
  updated_at: n.updated_at || r
18358
18371
  }, a = n.password ? Ye() : void 0;
18359
18372
  try {
18360
- if (n.password && a) {
18361
- await e.run(p`BEGIN`);
18362
- try {
18363
- await e.insert(x).values(i), await e.insert(Jt).values({
18364
- id: a,
18365
- tenant_id: t,
18366
- user_id: n.user_id,
18367
- password: n.password.hash || n.password,
18368
- algorithm: n.password.algorithm || "bcrypt",
18369
- is_current: 1,
18370
- created_at: r,
18371
- updated_at: r
18372
- }), await e.run(p`COMMIT`);
18373
- } catch (t) {
18374
- throw await e.run(p`ROLLBACK`), t;
18375
- }
18376
- } else await e.insert(x).values(i);
18373
+ n.password && a ? await hx(e, [e.insert(x).values(i), e.insert(Jt).values({
18374
+ id: a,
18375
+ tenant_id: t,
18376
+ user_id: n.user_id,
18377
+ password: n.password.hash || n.password,
18378
+ algorithm: n.password.algorithm || "bcrypt",
18379
+ is_current: 1,
18380
+ created_at: r,
18381
+ updated_at: r
18382
+ })]) : await e.insert(x).values(i);
18377
18383
  } catch (e) {
18378
18384
  throw e?.message?.includes("UNIQUE constraint") || e?.message?.includes("AlreadyExists") ? new Un(409, { message: "User already exists" }) : (console.error("User upsert failed:", e?.code, e?.message), new Un(500, { message: "Internal server error" }));
18379
18385
  }
18380
- return Wx(i);
18386
+ return Kx(i);
18381
18387
  };
18382
18388
  return {
18383
18389
  create: t,
18384
18390
  rawCreate: t,
18385
18391
  async get(t, n) {
18386
18392
  let r = await e.select().from(x).where(h(m(x.tenant_id, t), m(x.user_id, n))).get();
18387
- return r ? Wx(r, await e.select().from(x).where(h(m(x.tenant_id, t), m(x.linked_to, n))).all()) : null;
18393
+ return r ? Kx(r, await e.select().from(x).where(h(m(x.tenant_id, t), m(x.linked_to, n))).all()) : null;
18388
18394
  },
18389
18395
  async update(t, n, r) {
18390
18396
  let i = { updated_at: (/* @__PURE__ */ new Date()).toISOString() };
@@ -18418,9 +18424,9 @@ function Gx(e) {
18418
18424
  async list(t, n) {
18419
18425
  let { page: r = 0, per_page: i = 50, include_totals: a = !1, sort: o, q: s } = n || {}, c = [m(x.tenant_id, t), Pe(x.linked_to)];
18420
18426
  if (s) {
18421
- let e = Nn(s, Vx);
18427
+ let e = Nn(s, Ux);
18422
18428
  if (e) {
18423
- let t = Pn(x, e, Hx);
18429
+ let t = Pn(x, e, Wx);
18424
18430
  t && c.push(t);
18425
18431
  }
18426
18432
  }
@@ -18431,7 +18437,7 @@ function Gx(e) {
18431
18437
  }
18432
18438
  let d = await u.offset(r * i).limit(i), f = d.map((e) => e.user_id), ee = [];
18433
18439
  f.length > 0 && (ee = await e.select().from(x).where(h(m(x.tenant_id, t), Ne(x.linked_to, f))));
18434
- let te = d.map((e) => Wx(e, ee.filter((t) => t.linked_to === e.user_id)));
18440
+ let te = d.map((e) => Kx(e, ee.filter((t) => t.linked_to === e.user_id)));
18435
18441
  if (!a) return { users: te };
18436
18442
  let [ne] = await e.select({ count: Be() }).from(x).where(l);
18437
18443
  return {
@@ -18442,15 +18448,13 @@ function Gx(e) {
18442
18448
  };
18443
18449
  },
18444
18450
  async remove(t, n) {
18445
- await e.run(p`BEGIN`);
18446
- try {
18447
- let r = [n, ...(await e.select({ user_id: x.user_id }).from(x).where(h(m(x.tenant_id, t), m(x.linked_to, n)))).map((e) => e.user_id)];
18448
- await e.delete(Tn).where(h(m(Tn.tenant_id, t), Ne(Tn.user_id, r))), await e.delete(Jt).where(h(m(Jt.tenant_id, t), Ne(Jt.user_id, r))), await e.delete(x).where(h(m(x.tenant_id, t), m(x.linked_to, n)));
18449
- let i = await e.delete(x).where(h(m(x.tenant_id, t), m(x.user_id, n))).returning();
18450
- return await e.run(p`COMMIT`), i.length > 0;
18451
- } catch (t) {
18452
- throw await e.run(p`ROLLBACK`), t;
18453
- }
18451
+ let r = (await e.select({ user_id: x.user_id }).from(x).where(h(m(x.tenant_id, t), m(x.linked_to, n)))).map((e) => e.user_id), i = [n, ...r], a = await hx(e, [
18452
+ e.delete(Tn).where(h(m(Tn.tenant_id, t), Ne(Tn.user_id, i))),
18453
+ e.delete(Jt).where(h(m(Jt.tenant_id, t), Ne(Jt.user_id, i))),
18454
+ e.delete(x).where(h(m(x.tenant_id, t), Ne(x.user_id, r))),
18455
+ e.delete(x).where(h(m(x.tenant_id, t), m(x.user_id, n))).returning()
18456
+ ]), o = a[a.length - 1];
18457
+ return Array.isArray(o) && o.length > 0;
18454
18458
  },
18455
18459
  async unlink(t, n, r, i) {
18456
18460
  let a = `${r}|${i}`;
@@ -18460,7 +18464,7 @@ function Gx(e) {
18460
18464
  }
18461
18465
  //#endregion
18462
18466
  //#region src/adapters/userRoles.ts
18463
- function Kx(e) {
18467
+ function Jx(e) {
18464
18468
  return {
18465
18469
  async create(t, n, r, i) {
18466
18470
  try {
@@ -18500,7 +18504,7 @@ function Kx(e) {
18500
18504
  //#endregion
18501
18505
  //#region src/adapters/userOrganizations.ts
18502
18506
  Xe();
18503
- function qx(e) {
18507
+ function Yx(e) {
18504
18508
  return {
18505
18509
  async create(t, n) {
18506
18510
  let r = (/* @__PURE__ */ new Date()).toISOString(), i = {
@@ -18577,19 +18581,19 @@ function qx(e) {
18577
18581
  }
18578
18582
  //#endregion
18579
18583
  //#region src/adapters/stats.ts
18580
- var Jx = ["s"], Yx = ["pwd_leak"];
18581
- function Xx(e) {
18584
+ var Xx = ["s"], Zx = ["pwd_leak"];
18585
+ function Qx(e) {
18582
18586
  return /^\d{8}$/.test(e) ? `${e.slice(0, 4)}-${e.slice(4, 6)}-${e.slice(6, 8)}` : e;
18583
18587
  }
18584
- function Zx(e) {
18588
+ function $x(e) {
18585
18589
  return {
18586
18590
  async getDaily(t, n) {
18587
- let r = /* @__PURE__ */ new Date(), i = n?.from ? Xx(n.from) : (/* @__PURE__ */ new Date(r.getTime() - 720 * 60 * 60 * 1e3)).toISOString().split("T")[0], a = n?.to ? Xx(n.to) : r.toISOString().split("T")[0];
18591
+ let r = /* @__PURE__ */ new Date(), i = n?.from ? Qx(n.from) : (/* @__PURE__ */ new Date(r.getTime() - 720 * 60 * 60 * 1e3)).toISOString().split("T")[0], a = n?.to ? Qx(n.to) : r.toISOString().split("T")[0];
18588
18592
  return (await e.select({
18589
18593
  date: p`substr(${E.date}, 1, 10)`.as("date"),
18590
- logins: p`SUM(CASE WHEN ${E.type} IN (${p.join(Jx.map((e) => p`${e}`), p`, `)}) THEN 1 ELSE 0 END)`.as("logins"),
18594
+ logins: p`SUM(CASE WHEN ${E.type} IN (${p.join(Xx.map((e) => p`${e}`), p`, `)}) THEN 1 ELSE 0 END)`.as("logins"),
18591
18595
  signups: p`SUM(CASE WHEN ${E.type} = 'ss' THEN 1 ELSE 0 END)`.as("signups"),
18592
- leaked_passwords: p`SUM(CASE WHEN ${E.type} IN (${p.join(Yx.map((e) => p`${e}`), p`, `)}) THEN 1 ELSE 0 END)`.as("leaked_passwords")
18596
+ leaked_passwords: p`SUM(CASE WHEN ${E.type} IN (${p.join(Zx.map((e) => p`${e}`), p`, `)}) THEN 1 ELSE 0 END)`.as("leaked_passwords")
18593
18597
  }).from(E).where(h(m(E.tenant_id, t), Ae(E.date, i), Me(E.date, `${a}T23:59:59.999Z`))).groupBy(p`substr(${E.date}, 1, 10)`).orderBy(p`substr(${E.date}, 1, 10)`).all()).map((e) => ({
18594
18598
  date: e.date,
18595
18599
  logins: Number(e.logins) || 0,
@@ -18600,14 +18604,14 @@ function Zx(e) {
18600
18604
  }));
18601
18605
  },
18602
18606
  async getActiveUsers(t) {
18603
- let n = (/* @__PURE__ */ new Date(Date.now() - 720 * 60 * 60 * 1e3)).toISOString(), [r] = await e.select({ count: p`COUNT(DISTINCT ${E.user_id})`.as("count") }).from(E).where(h(m(E.tenant_id, t), Ae(E.date, n), p`${E.type} IN (${p.join(Jx.map((e) => p`${e}`), p`, `)})`));
18607
+ let n = (/* @__PURE__ */ new Date(Date.now() - 720 * 60 * 60 * 1e3)).toISOString(), [r] = await e.select({ count: p`COUNT(DISTINCT ${E.user_id})`.as("count") }).from(E).where(h(m(E.tenant_id, t), Ae(E.date, n), p`${E.type} IN (${p.join(Xx.map((e) => p`${e}`), p`, `)})`));
18604
18608
  return Number(r?.count) || 0;
18605
18609
  }
18606
18610
  };
18607
18611
  }
18608
18612
  //#endregion
18609
18613
  //#region src/adapters/analytics.ts
18610
- var Qx = {
18614
+ var eS = {
18611
18615
  "active-users": ["s", "seacft"],
18612
18616
  logins: [
18613
18617
  "s",
@@ -18617,7 +18621,7 @@ var Qx = {
18617
18621
  signups: ["ss", "fs"],
18618
18622
  "refresh-tokens": ["seacft", "fertft"],
18619
18623
  sessions: ["slo"]
18620
- }, $x = {
18624
+ }, tS = {
18621
18625
  "active-users": {
18622
18626
  alias: "active_users",
18623
18627
  type: "UInt64",
@@ -18644,7 +18648,7 @@ var Qx = {
18644
18648
  agg: "count"
18645
18649
  }
18646
18650
  };
18647
- function eS(e) {
18651
+ function nS(e) {
18648
18652
  switch (e) {
18649
18653
  case "hour": return p`substr(${E.date}, 1, 13)`;
18650
18654
  case "month": return p`substr(${E.date}, 1, 7)`;
@@ -18653,10 +18657,10 @@ function eS(e) {
18653
18657
  default: throw Error(`Unsupported interval '${e}' for SQL analytics adapter`);
18654
18658
  }
18655
18659
  }
18656
- function tS(e) {
18660
+ function rS(e) {
18657
18661
  return `"${e.replace(/"/g, "\"\"")}"`;
18658
18662
  }
18659
- function nS(e) {
18663
+ function iS(e) {
18660
18664
  switch (e) {
18661
18665
  case "connection": return E.connection;
18662
18666
  case "client_id": return E.client_id;
@@ -18665,9 +18669,9 @@ function nS(e) {
18665
18669
  case "time": throw Error("time dimension handled separately");
18666
18670
  }
18667
18671
  }
18668
- function rS(e) {
18672
+ function aS(e) {
18669
18673
  return { async query(t, n, r) {
18670
- let i = Date.now(), a = Qx[n], o = $x[n], s = [
18674
+ let i = Date.now(), a = eS[n], o = tS[n], s = [
18671
18675
  m(E.tenant_id, t),
18672
18676
  Ae(E.date, r.from),
18673
18677
  je(E.date, r.to),
@@ -18676,13 +18680,13 @@ function rS(e) {
18676
18680
  r.filters.connection?.length && s.push(Ne(E.connection, r.filters.connection)), r.filters.client_id?.length && s.push(Ne(E.client_id, r.filters.client_id)), r.filters.user_type?.length && s.push(Ne(E.strategy_type, r.filters.user_type)), r.filters.user_id?.length && s.push(Ne(E.user_id, r.filters.user_id));
18677
18681
  let c = {}, l = [], u = [];
18678
18682
  for (let e of r.group_by) if (e === "time") {
18679
- let e = eS(r.interval);
18683
+ let e = nS(r.interval);
18680
18684
  c.time = e, l.push(e), u.push({
18681
18685
  name: "time",
18682
18686
  type: r.interval === "hour" ? "DateTime" : "Date"
18683
18687
  });
18684
18688
  } else {
18685
- let t = nS(e);
18689
+ let t = iS(e);
18686
18690
  c[e] = t, l.push(t), u.push({
18687
18691
  name: e,
18688
18692
  type: "String"
@@ -18698,9 +18702,9 @@ function rS(e) {
18698
18702
  if (r.order_by) {
18699
18703
  let e = r.order_by.startsWith("-"), t = e ? r.order_by.slice(1) : r.order_by;
18700
18704
  if (!f.has(t)) throw Error(`Invalid order_by column '${t}' for analytics query`);
18701
- let n = tS(t);
18705
+ let n = rS(t);
18702
18706
  d = d.orderBy(p.raw(`${n} ${e ? "DESC" : "ASC"}`));
18703
- } else d = r.group_by[0] === "time" ? d.orderBy(p.raw(`${tS("time")} ASC`)) : d.orderBy(p.raw(`${tS(o.alias)} DESC`));
18707
+ } else d = r.group_by[0] === "time" ? d.orderBy(p.raw(`${rS("time")} ASC`)) : d.orderBy(p.raw(`${rS(o.alias)} DESC`));
18704
18708
  d = d.limit(r.limit).offset(r.offset);
18705
18709
  let ee = (await d.all()).map((e) => {
18706
18710
  let t = {};
@@ -18722,13 +18726,13 @@ function rS(e) {
18722
18726
  //#endregion
18723
18727
  //#region src/adapters/outbox.ts
18724
18728
  Xe();
18725
- function iS(e) {
18729
+ function oS(e) {
18726
18730
  return {
18727
18731
  ...e,
18728
18732
  payload: A(e.payload, {})
18729
18733
  };
18730
18734
  }
18731
- function aS(e) {
18735
+ function sS(e) {
18732
18736
  return {
18733
18737
  async create(t, n) {
18734
18738
  let r = Ye(), i = (/* @__PURE__ */ new Date()).toISOString();
@@ -18753,11 +18757,11 @@ function aS(e) {
18753
18757
  }), r;
18754
18758
  },
18755
18759
  async getByIds(t) {
18756
- return t.length === 0 ? [] : (await e.select().from(D).where(Ne(D.id, t)).all()).map(iS);
18760
+ return t.length === 0 ? [] : (await e.select().from(D).where(Ne(D.id, t)).all()).map(oS);
18757
18761
  },
18758
18762
  async getUnprocessed(t) {
18759
18763
  let n = (/* @__PURE__ */ new Date()).toISOString();
18760
- return (await e.select().from(D).where(h(Pe(D.processed_at), Oe(Pe(D.next_retry_at), Me(D.next_retry_at, n)), Oe(Pe(D.claimed_by), Me(D.claim_expires_at, n)))).orderBy(D.created_at, D.id).limit(t).all()).map(iS);
18764
+ return (await e.select().from(D).where(h(Pe(D.processed_at), Oe(Pe(D.next_retry_at), Me(D.next_retry_at, n)), Oe(Pe(D.claimed_by), Me(D.claim_expires_at, n)))).orderBy(D.created_at, D.id).limit(t).all()).map(oS);
18761
18765
  },
18762
18766
  async claimEvents(t, n, r) {
18763
18767
  if (t.length === 0) return [];
@@ -18827,10 +18831,10 @@ function aS(e) {
18827
18831
  }
18828
18832
  //#endregion
18829
18833
  //#region src/adapters/cleanup.ts
18830
- var oS = 10080 * 60 * 1e3;
18831
- function sS(e) {
18834
+ var cS = 10080 * 60 * 1e3;
18835
+ function lS(e) {
18832
18836
  return async (t) => {
18833
- let n = Date.now() - oS;
18837
+ let n = Date.now() - cS;
18834
18838
  try {
18835
18839
  let r = [Oe(je(S.expires_at_ts, n), je(S.idle_expires_at_ts, n))];
18836
18840
  t?.tenant_id && r.push(m(S.tenant_id, t.tenant_id)), await e.delete(S).where(h(...r)), r = [Oe(je(Yt.expires_at_ts, n), je(Yt.idle_expires_at_ts, n))], t?.tenant_id && r.push(m(Yt.tenant_id, t.tenant_id)), t?.user_id && r.push(m(Yt.user_id, t.user_id)), await e.delete(Yt).where(h(...r)), r = [je(C.expires_at_ts, n)], t?.tenant_id && r.push(m(C.tenant_id, t.tenant_id)), await e.delete(C).where(h(...r));
@@ -18841,7 +18845,7 @@ function sS(e) {
18841
18845
  }
18842
18846
  //#endregion
18843
18847
  //#region src/adapters/index.ts
18844
- function cS(e, t = { useTransactions: !0 }) {
18848
+ function uS(e, t = { useTransactions: !0 }) {
18845
18849
  let n = {
18846
18850
  actions: Ln(e),
18847
18851
  actionExecutions: Rn(e),
@@ -18870,22 +18874,22 @@ function cS(e, t = { useTransactions: !0 }) {
18870
18874
  passwords: cx(e),
18871
18875
  promptSettings: lx(e),
18872
18876
  proxyRoutes: px(e),
18873
- refreshTokens: gx(e),
18874
- resourceServers: Sx(e),
18875
- rolePermissions: Cx(e),
18876
- userPermissions: wx(e),
18877
- roles: Ex(e),
18878
- sessions: jx(e),
18879
- sessionCleanup: sS(e),
18880
- tenants: Ix(e),
18881
- themes: zx(e),
18882
- universalLoginTemplates: Bx(e),
18883
- users: Gx(e),
18884
- userRoles: Kx(e),
18885
- userOrganizations: qx(e),
18886
- stats: Zx(e),
18887
- analytics: rS(e),
18888
- outbox: aS(e),
18877
+ refreshTokens: vx(e),
18878
+ resourceServers: wx(e),
18879
+ rolePermissions: Tx(e),
18880
+ userPermissions: Ex(e),
18881
+ roles: Ox(e),
18882
+ sessions: Nx(e),
18883
+ sessionCleanup: lS(e),
18884
+ tenants: Rx(e),
18885
+ themes: Vx(e),
18886
+ universalLoginTemplates: Hx(e),
18887
+ users: qx(e),
18888
+ userRoles: Jx(e),
18889
+ userOrganizations: Yx(e),
18890
+ stats: $x(e),
18891
+ analytics: aS(e),
18892
+ outbox: sS(e),
18889
18893
  async transaction(r) {
18890
18894
  if (t.useTransactions === !1) return r(n);
18891
18895
  await e.run(p`BEGIN`);
@@ -18901,7 +18905,7 @@ function cS(e, t = { useTransactions: !0 }) {
18901
18905
  }
18902
18906
  //#endregion
18903
18907
  //#region src/adapters/resolveHost.ts
18904
- function lS(e) {
18908
+ function dS(e) {
18905
18909
  if (!e) return { path: "/*" };
18906
18910
  try {
18907
18911
  let t = JSON.parse(e), n = Wy.safeParse(t);
@@ -18909,7 +18913,7 @@ function lS(e) {
18909
18913
  } catch {}
18910
18914
  return { path: "/*" };
18911
18915
  }
18912
- function uS(e) {
18916
+ function fS(e) {
18913
18917
  if (!e) return [];
18914
18918
  try {
18915
18919
  let t = JSON.parse(e);
@@ -18924,7 +18928,7 @@ function uS(e) {
18924
18928
  return [];
18925
18929
  }
18926
18930
  }
18927
- async function dS(e, t) {
18931
+ async function pS(e, t) {
18928
18932
  let n = t.toLowerCase(), r = (await e.select({
18929
18933
  custom_domain_id: nn.custom_domain_id,
18930
18934
  tenant_id: nn.tenant_id,
@@ -18936,8 +18940,8 @@ async function dS(e, t) {
18936
18940
  tenant_id: e.tenant_id,
18937
18941
  custom_domain_id: e.custom_domain_id,
18938
18942
  priority: e.priority,
18939
- match: lS(e.match),
18940
- handlers: uS(e.handlers),
18943
+ match: dS(e.match),
18944
+ handlers: fS(e.handlers),
18941
18945
  created_at: e.created_at,
18942
18946
  updated_at: e.updated_at
18943
18947
  }));
@@ -18950,11 +18954,11 @@ async function dS(e, t) {
18950
18954
  }
18951
18955
  //#endregion
18952
18956
  //#region src/adapters/proxyData.ts
18953
- function fS(e) {
18957
+ function mS(e) {
18954
18958
  return {
18955
18959
  proxyRoutes: px(e),
18956
- resolveHost: (t) => dS(e, t)
18960
+ resolveHost: (t) => pS(e, t)
18957
18961
  };
18958
18962
  }
18959
18963
  //#endregion
18960
- export { fS as createProxyDataAdapter, px as createProxyRoutesAdapter, cS as default, En as sqlite };
18964
+ export { mS as createProxyDataAdapter, px as createProxyRoutesAdapter, uS as default, En as sqlite };