@authhero/kysely-adapter 10.47.0 → 10.48.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.
@@ -3,9 +3,9 @@ var wn = (t) => {
3
3
  throw TypeError(t);
4
4
  };
5
5
  var Rr = (t, e, n) => e in t ? Dr(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
6
- var oe = (t, e, n) => Rr(t, typeof e != "symbol" ? e + "" : e, n), Bt = (t, e, n) => e.has(t) || wn("Cannot " + n);
7
- var i = (t, e, n) => (Bt(t, e, "read from private field"), n ? n.call(t) : e.get(t)), C = (t, e, n) => e.has(t) ? wn("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), O = (t, e, n, r) => (Bt(t, e, "write to private field"), r ? r.call(t, n) : e.set(t, n), n), w = (t, e, n) => (Bt(t, e, "access private method"), n);
8
- import { parseUserId as ln, codeSchema as zr, connectionSchema as Fr, loginSessionSchema as qr, promptSettingSchema as jr, formSchema as bt, resourceServerSchema as Lr } from "@authhero/adapter-interfaces";
6
+ var oe = (t, e, n) => Rr(t, typeof e != "symbol" ? e + "" : e, n), Wt = (t, e, n) => e.has(t) || wn("Cannot " + n);
7
+ var i = (t, e, n) => (Wt(t, e, "read from private field"), n ? n.call(t) : e.get(t)), C = (t, e, n) => e.has(t) ? wn("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), O = (t, e, n, r) => (Wt(t, e, "write to private field"), r ? r.call(t, n) : e.set(t, n), n), w = (t, e, n) => (Wt(t, e, "access private method"), n);
8
+ import { parseUserId as ln, codeSchema as zr, connectionSchema as Fr, loginSessionSchema as jr, promptSettingSchema as qr, formSchema as bt, resourceServerSchema as Lr } from "@authhero/adapter-interfaces";
9
9
  import "@hono/zod-openapi";
10
10
  var lt = class extends Error {
11
11
  constructor(e = 500, n) {
@@ -50,26 +50,26 @@ function Jr(t) {
50
50
  };
51
51
  };
52
52
  }
53
- function S(t) {
53
+ function T(t) {
54
54
  if (t == null || typeof t != "object")
55
55
  return t;
56
56
  if (Array.isArray(t))
57
57
  return t.map(
58
58
  (n) => (
59
59
  // Only recurse into objects; leave primitives untouched
60
- n !== null && typeof n == "object" ? S(n) : n
60
+ n !== null && typeof n == "object" ? T(n) : n
61
61
  )
62
62
  );
63
63
  const e = { ...t };
64
64
  for (const n in e) {
65
65
  const r = e[n];
66
66
  r === null ? delete e[n] : r !== null && typeof r == "object" && (Array.isArray(r) ? e[n] = r.map(
67
- (a) => a !== null && typeof a == "object" ? S(a) : a
68
- ) : e[n] = S(r));
67
+ (a) => a !== null && typeof a == "object" ? T(a) : a
68
+ ) : e[n] = T(r));
69
69
  }
70
70
  return e;
71
71
  }
72
- function Wn(t) {
72
+ function Bn(t) {
73
73
  let e = {};
74
74
  try {
75
75
  e = JSON.parse(t.profileData || "{}");
@@ -110,10 +110,10 @@ function Mr(t) {
110
110
  user_id: ln(r.user_id).id,
111
111
  isSocial: !!r.is_social
112
112
  },
113
- ...a.map(Wn)
113
+ ...a.map(Bn)
114
114
  ]
115
115
  };
116
- return S(d);
116
+ return T(d);
117
117
  };
118
118
  }
119
119
  function L(t, e, n, r) {
@@ -171,11 +171,11 @@ function L(t, e, n, r) {
171
171
  function F(t) {
172
172
  return typeof t == "string" ? parseInt(t, 10) : typeof t == "bigint" ? Number(t) : t;
173
173
  }
174
- function Wr(t) {
174
+ function Br(t) {
175
175
  return async (e, n = {}) => {
176
176
  const { page: r = 0, per_page: a = 50, include_totals: o = !1, sort: u, q: d } = n;
177
177
  let c = t.selectFrom("users").where("users.tenant_id", "=", e);
178
- if (d && (c = L(t, c, d, ["email", "name"])), u && u.sort_by) {
178
+ if (d && (c = L(t, c, d, ["email", "name", "phone_number"])), u && u.sort_by) {
179
179
  const { ref: b } = t.dynamic;
180
180
  c = c.orderBy(b(u.sort_by), u.sort_order);
181
181
  }
@@ -183,7 +183,7 @@ function Wr(t) {
183
183
  const E = y.filter(
184
184
  (D) => D.linked_to === b.user_id
185
185
  );
186
- return S({
186
+ return T({
187
187
  ...b,
188
188
  email_verified: b.email_verified === 1,
189
189
  is_social: b.is_social === 1,
@@ -196,7 +196,7 @@ function Wr(t) {
196
196
  user_id: ln(b.user_id).id,
197
197
  isSocial: !!b.is_social
198
198
  },
199
- ...E.map(Wn)
199
+ ...E.map(Bn)
200
200
  ]
201
201
  });
202
202
  });
@@ -216,7 +216,7 @@ function Wr(t) {
216
216
  };
217
217
  };
218
218
  }
219
- function Br(t) {
219
+ function Wr(t) {
220
220
  return async (e, n) => (await t.deleteFrom("users").where("users.tenant_id", "=", e).where("users.linked_to", "=", n).execute(), (await t.deleteFrom("users").where("users.tenant_id", "=", e).where("users.user_id", "=", n).execute()).length === 1);
221
221
  }
222
222
  function et(t, e = "", n = {}) {
@@ -227,7 +227,7 @@ function et(t, e = "", n = {}) {
227
227
  }
228
228
  return n;
229
229
  }
230
- function Bn(t, e) {
230
+ function Wn(t, e) {
231
231
  const n = {};
232
232
  for (const [r, a] of Object.entries(t)) {
233
233
  const o = e.find(
@@ -265,9 +265,9 @@ function Ur(t) {
265
265
  function Qr(t) {
266
266
  return {
267
267
  create: Jr(t),
268
- remove: Br(t),
268
+ remove: Wr(t),
269
269
  get: Mr(t),
270
- list: Wr(t),
270
+ list: Br(t),
271
271
  update: Kr(t),
272
272
  // TODO - think about this more when other issues fixed
273
273
  unlink: Ur(t)
@@ -304,7 +304,7 @@ function Xr(t) {
304
304
  function Zr(t) {
305
305
  return async (e) => {
306
306
  const n = await t.selectFrom("tenants").where("tenants.id", "=", e).selectAll().executeTakeFirst();
307
- return n ? S(n) : null;
307
+ return n ? T(n) : null;
308
308
  };
309
309
  }
310
310
  function ea(t) {
@@ -316,7 +316,7 @@ function ea(t) {
316
316
  n = n.orderBy(f(u.sort_by), u.sort_order);
317
317
  }
318
318
  d && (n = n.where((f) => f.or([f("name", "like", `%${d}%`)])));
319
- const p = (await n.offset(r * a).limit(a).selectAll().execute()).map(S);
319
+ const p = (await n.offset(r * a).limit(a).selectAll().execute()).map(T);
320
320
  if (!o)
321
321
  return {
322
322
  tenants: p
@@ -566,7 +566,7 @@ function wa(t) {
566
566
  u && (d = L(t, d, u, ["code", "login_id"]));
567
567
  const p = (await d.offset(r * a).limit(a).selectAll().execute()).map((y) => {
568
568
  const { tenant_id: f, ...v } = y;
569
- return zr.parse(S(v));
569
+ return zr.parse(T(v));
570
570
  });
571
571
  if (!o)
572
572
  return {
@@ -604,7 +604,7 @@ function Ca(t) {
604
604
  let a = t.selectFrom("codes").where("codes.code_id", "=", n).where("codes.code_type", "=", r);
605
605
  e.length && (a = a.where("codes.tenant_id", "=", e));
606
606
  const o = await a.selectAll().executeTakeFirst();
607
- return o ? S(o) : null;
607
+ return o ? T(o) : null;
608
608
  };
609
609
  }
610
610
  function ba(t) {
@@ -619,7 +619,7 @@ function Oa(t) {
619
619
  get: Ca(t)
620
620
  };
621
621
  }
622
- const Ta = 17, Sa = {
622
+ const xa = 17, Ta = {
623
623
  organization: "org_",
624
624
  connection: "con_",
625
625
  action: "act_",
@@ -629,10 +629,10 @@ const Ta = 17, Sa = {
629
629
  guardian_factor: "gfa_"
630
630
  };
631
631
  function Ft(t) {
632
- const r = Hr("0123456789abcdefghijklmnopqrstuvwxyz", Ta)();
633
- return `${Sa[t]}${r}`;
632
+ const r = Hr("0123456789abcdefghijklmnopqrstuvwxyz", xa)();
633
+ return `${Ta[t]}${r}`;
634
634
  }
635
- function xa() {
635
+ function Sa() {
636
636
  return Ft("organization");
637
637
  }
638
638
  function ka() {
@@ -666,7 +666,7 @@ function Pa(t) {
666
666
  let d = t.selectFrom("connections").where("connections.tenant_id", "=", e);
667
667
  u && (d = L(t, d, u, ["user_id", "ip"]));
668
668
  const p = (await d.offset(r * a).limit(a).selectAll().execute()).map(
669
- (y) => S({
669
+ (y) => T({
670
670
  ...y,
671
671
  options: JSON.parse(y.options)
672
672
  })
@@ -693,7 +693,7 @@ function $a(t) {
693
693
  function Da(t) {
694
694
  return async (e, n) => {
695
695
  const r = await t.selectFrom("connections").where("connections.tenant_id", "=", e).where("connections.id", "=", n).selectAll().executeTakeFirst();
696
- return r ? S({
696
+ return r ? T({
697
697
  ...r,
698
698
  options: JSON.parse(r.options)
699
699
  }) : null;
@@ -779,13 +779,13 @@ function Fa(t) {
779
779
  }).execute(), r;
780
780
  };
781
781
  }
782
- function qa(t) {
782
+ function ja(t) {
783
783
  return async (e, n) => {
784
784
  const r = await t.selectFrom("clients").where("clients.tenant_id", "=", e).where("clients.client_id", "=", n).selectAll().executeTakeFirst();
785
785
  if (!r)
786
786
  return null;
787
787
  const { tenant_id: a, ...o } = r;
788
- return S({
788
+ return T({
789
789
  ...o,
790
790
  // Convert integer fields back to booleans
791
791
  global: !!r.global,
@@ -824,7 +824,7 @@ function qa(t) {
824
824
  });
825
825
  };
826
826
  }
827
- function ja(t) {
827
+ function qa(t) {
828
828
  return async (e, n) => {
829
829
  let r = t.selectFrom("clients").where("clients.tenant_id", "=", e);
830
830
  return n != null && n.per_page && (r = r.limit(n.per_page)), n != null && n.page && (n != null && n.per_page) && (r = r.offset((n.page - 1) * n.per_page)), {
@@ -893,13 +893,13 @@ function Ja(t) {
893
893
  function Ma(t) {
894
894
  return {
895
895
  create: Fa(t),
896
- get: qa(t),
897
- list: ja(t),
896
+ get: ja(t),
897
+ list: qa(t),
898
898
  remove: La(t),
899
899
  update: Ja(t)
900
900
  };
901
901
  }
902
- function Wa(t) {
902
+ function Ba(t) {
903
903
  return async (e, n) => {
904
904
  const r = (/* @__PURE__ */ new Date()).toISOString(), a = re(), { scope: o, authorization_details_types: u, ...d } = n, c = {
905
905
  id: a,
@@ -913,7 +913,7 @@ function Wa(t) {
913
913
  created_at: r,
914
914
  updated_at: r
915
915
  };
916
- return await t.insertInto("client_grants").values(c).execute(), S({
916
+ return await t.insertInto("client_grants").values(c).execute(), T({
917
917
  id: a,
918
918
  tenant_id: e,
919
919
  ...d,
@@ -927,7 +927,7 @@ function Wa(t) {
927
927
  });
928
928
  };
929
929
  }
930
- function Ba(t) {
930
+ function Wa(t) {
931
931
  return async (e, n) => {
932
932
  const r = await t.selectFrom("client_grants").selectAll().where("client_grants.tenant_id", "=", e).where("client_grants.id", "=", n).executeTakeFirst();
933
933
  if (!r)
@@ -946,7 +946,7 @@ function Ba(t) {
946
946
  created_at: r.created_at,
947
947
  updated_at: r.updated_at
948
948
  };
949
- return S(a);
949
+ return T(a);
950
950
  };
951
951
  }
952
952
  function Ka(t) {
@@ -987,7 +987,7 @@ function Ka(t) {
987
987
  created_at: f.created_at,
988
988
  updated_at: f.updated_at
989
989
  };
990
- return S(v);
990
+ return T(v);
991
991
  });
992
992
  if (!o)
993
993
  return {
@@ -1021,8 +1021,8 @@ function Qa(t) {
1021
1021
  }
1022
1022
  function Va(t) {
1023
1023
  return {
1024
- create: Wa(t),
1025
- get: Ba(t),
1024
+ create: Ba(t),
1025
+ get: Wa(t),
1026
1026
  list: Ka(t),
1027
1027
  remove: Ua(t),
1028
1028
  update: Qa(t)
@@ -1053,7 +1053,7 @@ function Ga(t) {
1053
1053
  // Parse JSON string fields back to objects/arrays
1054
1054
  connections: a.map(
1055
1055
  (d) => Fr.parse(
1056
- S({
1056
+ T({
1057
1057
  ...d,
1058
1058
  options: d.options ? JSON.parse(d.options) : {}
1059
1059
  })
@@ -1080,7 +1080,7 @@ function Ga(t) {
1080
1080
  client_authentication_methods: n.client_authentication_methods ? JSON.parse(n.client_authentication_methods) : {},
1081
1081
  signed_request_object: n.signed_request_object ? JSON.parse(n.signed_request_object) : {},
1082
1082
  token_quota: n.token_quota ? JSON.parse(n.token_quota) : {},
1083
- tenant: S(r),
1083
+ tenant: T(r),
1084
1084
  // Extract legacy fields from client_metadata
1085
1085
  disable_sign_ups: o.disable_sign_ups === "true",
1086
1086
  email_validation: o.email_validation || "disabled"
@@ -1224,7 +1224,7 @@ function so(t) {
1224
1224
  font_url: h,
1225
1225
  ...p
1226
1226
  } = n;
1227
- return S({
1227
+ return T({
1228
1228
  ...p,
1229
1229
  colors: {
1230
1230
  primary: a,
@@ -1280,7 +1280,7 @@ function lo(t) {
1280
1280
  u && (d = L(t, d, u, ["url", "form_id"]));
1281
1281
  const p = (await d.offset(r * a).limit(a).selectAll().execute()).map((y) => {
1282
1282
  const { tenant_id: f, enabled: v, synchronous: b, ...E } = y;
1283
- return S({
1283
+ return T({
1284
1284
  ...E,
1285
1285
  enabled: !!v,
1286
1286
  synchronous: !!b
@@ -1305,7 +1305,7 @@ function lo(t) {
1305
1305
  function _o(t) {
1306
1306
  return async (e, n) => {
1307
1307
  const r = await t.selectFrom("hooks").where("hooks.tenant_id", "=", e).where("hooks.hook_id", "=", n).selectAll().executeTakeFirst();
1308
- return r ? S({
1308
+ return r ? T({
1309
1309
  ...r,
1310
1310
  enabled: !!r.enabled,
1311
1311
  synchronous: !!r.synchronous
@@ -1383,8 +1383,8 @@ function wo(t) {
1383
1383
  fonts_subtitle_bold: !!r.fonts_subtitle_bold,
1384
1384
  fonts_title_bold: !!r.fonts_title_bold
1385
1385
  };
1386
- return S(
1387
- Bn(a, [
1386
+ return T(
1387
+ Wn(a, [
1388
1388
  "widget",
1389
1389
  "colors",
1390
1390
  "borders",
@@ -1414,9 +1414,9 @@ function vo(t) {
1414
1414
  function Co(t) {
1415
1415
  return async (e, n) => {
1416
1416
  const r = await t.selectFrom("login_sessions").where("login_sessions.id", "=", n).selectAll().executeTakeFirst();
1417
- return r ? qr.parse(
1418
- Bn(
1419
- S({
1417
+ return r ? jr.parse(
1418
+ Wn(
1419
+ T({
1420
1420
  ...r,
1421
1421
  login_completed: !!r.login_completed
1422
1422
  }),
@@ -1449,21 +1449,21 @@ function Oo(t) {
1449
1449
  })
1450
1450
  ).where("login_sessions.id", "=", n).where("login_sessions.tenant_id", "=", e).execute()).length === 1;
1451
1451
  }
1452
- function To(t) {
1452
+ function xo(t) {
1453
1453
  return async (e, n) => (await t.deleteFrom("login_sessions").where("login_sessions.tenant_id", "=", e).where("login_sessions.id", "=", n).execute()).length > 0;
1454
1454
  }
1455
- function So(t) {
1455
+ function To(t) {
1456
1456
  return {
1457
1457
  create: bo(t),
1458
1458
  get: Co(t),
1459
1459
  update: Oo(t),
1460
- remove: To(t)
1460
+ remove: xo(t)
1461
1461
  };
1462
1462
  }
1463
- function xo(t) {
1463
+ function So(t) {
1464
1464
  return async (e) => {
1465
1465
  const [n] = await t.selectFrom("prompt_settings").where("prompt_settings.tenant_id", "=", e).selectAll().execute();
1466
- return S({
1466
+ return T({
1467
1467
  identifier_first: !!(n != null && n.identifier_first),
1468
1468
  password_first: !!(n != null && n.password_first),
1469
1469
  webauthn_platform_first_factor: !!(n != null && n.webauthn_platform_first_factor),
@@ -1472,7 +1472,7 @@ function xo(t) {
1472
1472
  };
1473
1473
  }
1474
1474
  function Cn(t) {
1475
- return S({
1475
+ return T({
1476
1476
  ...t,
1477
1477
  webauthn_platform_first_factor: t.webauthn_platform_first_factor ? !!t.webauthn_platform_first_factor : void 0,
1478
1478
  identifier_first: t.identifier_first ? !!t.identifier_first : void 0,
@@ -1483,7 +1483,7 @@ function Cn(t) {
1483
1483
  function ko(t) {
1484
1484
  return async (e, n) => {
1485
1485
  try {
1486
- const r = jr.parse(n);
1486
+ const r = qr.parse(n);
1487
1487
  await t.insertInto("prompt_settings").values({
1488
1488
  ...Cn(r),
1489
1489
  tenant_id: e
@@ -1495,7 +1495,7 @@ function ko(t) {
1495
1495
  }
1496
1496
  function Eo(t) {
1497
1497
  return {
1498
- get: xo(t),
1498
+ get: So(t),
1499
1499
  set: ko(t)
1500
1500
  };
1501
1501
  }
@@ -1511,7 +1511,7 @@ function Io(t) {
1511
1511
  enabled: u,
1512
1512
  ...d
1513
1513
  } = n;
1514
- return S({
1514
+ return T({
1515
1515
  ...d,
1516
1516
  credentials: JSON.parse(a),
1517
1517
  settings: JSON.parse(o),
@@ -1591,7 +1591,7 @@ function Fo(t) {
1591
1591
  return !!(await t.updateTable("refresh_tokens").set(a).where("tenant_id", "=", e).where("refresh_tokens.id", "=", n).execute()).length;
1592
1592
  };
1593
1593
  }
1594
- function qo(t) {
1594
+ function jo(t) {
1595
1595
  return async (e, n = {}) => {
1596
1596
  const { page: r = 0, per_page: a = 50, include_totals: o = !1, sort: u, q: d } = n;
1597
1597
  let c = t.selectFrom("refresh_tokens").where("refresh_tokens.tenant_id", "=", e);
@@ -1624,11 +1624,11 @@ function qo(t) {
1624
1624
  };
1625
1625
  };
1626
1626
  }
1627
- function jo(t) {
1627
+ function qo(t) {
1628
1628
  return {
1629
1629
  create: Ro(t),
1630
1630
  get: Do(t),
1631
- list: qo(t),
1631
+ list: jo(t),
1632
1632
  remove: zo(t),
1633
1633
  update: Fo(t)
1634
1634
  };
@@ -1703,7 +1703,7 @@ function Mo(t) {
1703
1703
  f.ending = JSON.parse(f.ending);
1704
1704
  } catch {
1705
1705
  }
1706
- return bt.parse(S(f));
1706
+ return bt.parse(T(f));
1707
1707
  });
1708
1708
  if (!o)
1709
1709
  return {
@@ -1721,13 +1721,13 @@ function Mo(t) {
1721
1721
  };
1722
1722
  };
1723
1723
  }
1724
- function Wo(t) {
1724
+ function Bo(t) {
1725
1725
  return async (e, n) => {
1726
1726
  const { numDeletedRows: r } = await t.deleteFrom("forms").where("id", "=", n).where("tenant_id", "=", e).executeTakeFirst();
1727
1727
  return r > 0;
1728
1728
  };
1729
1729
  }
1730
- function Bo(t) {
1730
+ function Wo(t) {
1731
1731
  return async (e, n) => {
1732
1732
  const r = await t.selectFrom("forms").selectAll().where("forms.id", "=", n).where("tenant_id", "=", e).executeTakeFirst();
1733
1733
  if (!r) return null;
@@ -1747,7 +1747,7 @@ function Bo(t) {
1747
1747
  a.ending = JSON.parse(a.ending);
1748
1748
  } catch {
1749
1749
  }
1750
- return bt.parse(S(a));
1750
+ return bt.parse(T(a));
1751
1751
  };
1752
1752
  }
1753
1753
  function Ko(t) {
@@ -1764,9 +1764,9 @@ function Ko(t) {
1764
1764
  function Uo(t) {
1765
1765
  return {
1766
1766
  create: Jo(t),
1767
- get: Bo(t),
1767
+ get: Wo(t),
1768
1768
  list: Mo(t),
1769
- remove: Wo(t),
1769
+ remove: Bo(t),
1770
1770
  update: Ko(t)
1771
1771
  };
1772
1772
  }
@@ -1795,7 +1795,7 @@ function Qo(t) {
1795
1795
  created_at: r,
1796
1796
  updated_at: r
1797
1797
  };
1798
- return await t.insertInto("resource_servers").values(y).execute(), S(o);
1798
+ return await t.insertInto("resource_servers").values(y).execute(), T(o);
1799
1799
  };
1800
1800
  }
1801
1801
  function Vo(t) {
@@ -1818,7 +1818,7 @@ function Vo(t) {
1818
1818
  // Convert verification_key back to verificationKey for API
1819
1819
  verificationKey: o
1820
1820
  };
1821
- return S(l);
1821
+ return T(l);
1822
1822
  };
1823
1823
  }
1824
1824
  function Go(t) {
@@ -1853,7 +1853,7 @@ function Go(t) {
1853
1853
  // Convert verification_key back to verificationKey for API
1854
1854
  verificationKey: v
1855
1855
  };
1856
- return S(pe);
1856
+ return T(pe);
1857
1857
  });
1858
1858
  if (!o)
1859
1859
  return {
@@ -2214,7 +2214,7 @@ function wi(t) {
2214
2214
  return async (e, n) => {
2215
2215
  const r = {
2216
2216
  ...n,
2217
- id: n.id || xa(),
2217
+ id: n.id || Sa(),
2218
2218
  tenant_id: e,
2219
2219
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
2220
2220
  updated_at: (/* @__PURE__ */ new Date()).toISOString(),
@@ -2243,7 +2243,7 @@ function wi(t) {
2243
2243
  function Ni(t) {
2244
2244
  return async (e, n) => {
2245
2245
  const r = await t.selectFrom("organizations").selectAll().where("tenant_id", "=", e).where("id", "=", n).executeTakeFirst();
2246
- return r ? S({
2246
+ return r ? T({
2247
2247
  ...r,
2248
2248
  branding: r.branding ? JSON.parse(r.branding) : {},
2249
2249
  metadata: r.metadata ? JSON.parse(r.metadata) : {},
@@ -2260,7 +2260,7 @@ function vi(t) {
2260
2260
  r = r.offset(u);
2261
2261
  }
2262
2262
  const o = (await r.execute()).map(
2263
- (u) => S({
2263
+ (u) => T({
2264
2264
  ...u,
2265
2265
  branding: u.branding ? JSON.parse(u.branding) : {},
2266
2266
  metadata: u.metadata ? JSON.parse(u.metadata) : {},
@@ -2297,7 +2297,7 @@ function Oi(t) {
2297
2297
  update: bi(t)
2298
2298
  };
2299
2299
  }
2300
- function Ti(t) {
2300
+ function xi(t) {
2301
2301
  return async (e, n) => {
2302
2302
  const r = {
2303
2303
  id: re(),
@@ -2319,7 +2319,7 @@ function Ti(t) {
2319
2319
  };
2320
2320
  };
2321
2321
  }
2322
- function Si(t) {
2322
+ function Ti(t) {
2323
2323
  return async (e, n) => {
2324
2324
  const r = await t.selectFrom("user_organizations").selectAll().where("id", "=", n).where("tenant_id", "=", e).executeTakeFirst();
2325
2325
  return r ? {
@@ -2331,7 +2331,7 @@ function Si(t) {
2331
2331
  } : null;
2332
2332
  };
2333
2333
  }
2334
- function xi(t) {
2334
+ function Si(t) {
2335
2335
  return async (e, n) => {
2336
2336
  const r = (n == null ? void 0 : n.page) || 0, a = (n == null ? void 0 : n.per_page) || 50, o = r * a;
2337
2337
  let u = t.selectFrom("user_organizations").selectAll().where("tenant_id", "=", e);
@@ -2431,9 +2431,9 @@ function Ii(t) {
2431
2431
  function Ai(t) {
2432
2432
  return {
2433
2433
  // CRUD operations
2434
- create: Ti(t),
2435
- get: Si(t),
2436
- list: xi(t),
2434
+ create: xi(t),
2435
+ get: Ti(t),
2436
+ list: Si(t),
2437
2437
  listUserOrganizations: ki(t),
2438
2438
  remove: Ei(t),
2439
2439
  update: Ii(t)
@@ -2460,7 +2460,7 @@ function Vn(t) {
2460
2460
  function Ee(t) {
2461
2461
  return typeof t == "function";
2462
2462
  }
2463
- function qt(t) {
2463
+ function jt(t) {
2464
2464
  return typeof t == "object" && t !== null;
2465
2465
  }
2466
2466
  function Pi(t) {
@@ -2513,7 +2513,7 @@ const z = s({
2513
2513
  alias: e
2514
2514
  });
2515
2515
  }
2516
- }), xe = s({
2516
+ }), Se = s({
2517
2517
  is(t) {
2518
2518
  return t.kind === "TableNode";
2519
2519
  },
@@ -2531,13 +2531,13 @@ const z = s({
2531
2531
  }
2532
2532
  });
2533
2533
  function J(t) {
2534
- return qt(t) && Ee(t.toOperationNode);
2534
+ return jt(t) && Ee(t.toOperationNode);
2535
2535
  }
2536
2536
  function $i(t) {
2537
- return qt(t) && "expressionType" in t && J(t);
2537
+ return jt(t) && "expressionType" in t && J(t);
2538
2538
  }
2539
2539
  function Di(t) {
2540
- return qt(t) && "expression" in t && G(t.alias) && J(t);
2540
+ return jt(t) && "expression" in t && G(t.alias) && J(t);
2541
2541
  }
2542
2542
  const Y = s({
2543
2543
  is(t) {
@@ -2688,10 +2688,10 @@ const Y = s({
2688
2688
  ...zi,
2689
2689
  "&&",
2690
2690
  "||"
2691
- ], qi = ["exists", "not exists"], ji = ["not", "-", ...qi], Li = [
2691
+ ], ji = ["exists", "not exists"], qi = ["not", "-", ...ji], Li = [
2692
2692
  ...Fi,
2693
2693
  ...Gn,
2694
- ...ji,
2694
+ ...qi,
2695
2695
  "between",
2696
2696
  "between symmetric"
2697
2697
  ], ke = s({
@@ -2727,7 +2727,7 @@ const mn = s({
2727
2727
  kind: "SelectAllNode"
2728
2728
  });
2729
2729
  }
2730
- }), jt = s({
2730
+ }), qt = s({
2731
2731
  is(t) {
2732
2732
  return t.kind === "ReferenceNode";
2733
2733
  },
@@ -2747,7 +2747,7 @@ const mn = s({
2747
2747
  }
2748
2748
  });
2749
2749
  function Hn(t) {
2750
- return qt(t) && J(t) && G(t.dynamicReference);
2750
+ return jt(t) && J(t) && G(t.dynamicReference);
2751
2751
  }
2752
2752
  const Yt = s({
2753
2753
  is(t) {
@@ -2803,7 +2803,7 @@ function Ut(t, e) {
2803
2803
  return Yt.create(n, Zn(e));
2804
2804
  }
2805
2805
  function Mi(t) {
2806
- if (Wt(t))
2806
+ if (Bt(t))
2807
2807
  return Mt(t);
2808
2808
  if (Hn(t))
2809
2809
  return t.toOperationNode();
@@ -2819,7 +2819,7 @@ function Zn(t) {
2819
2819
  if (t)
2820
2820
  return t === "asc" || t === "desc" ? R.createWithSql(t) : t.toOperationNode();
2821
2821
  }
2822
- const Tt = s({
2822
+ const xt = s({
2823
2823
  is(t) {
2824
2824
  return t.kind === "JSONReferenceNode";
2825
2825
  },
@@ -2871,28 +2871,28 @@ const Tt = s({
2871
2871
  });
2872
2872
  }
2873
2873
  });
2874
- function Wi(t) {
2874
+ function Bi(t) {
2875
2875
  return G(t) ? me(t) : t.toOperationNode();
2876
2876
  }
2877
2877
  function _t(t) {
2878
- return le(t) ? t.map((e) => q(e)) : [q(t)];
2878
+ return le(t) ? t.map((e) => j(e)) : [j(t)];
2879
2879
  }
2880
- function q(t) {
2881
- return Wt(t) ? Mt(t) : Wi(t);
2880
+ function j(t) {
2881
+ return Bt(t) ? Mt(t) : Bi(t);
2882
2882
  }
2883
- function Bi(t, e) {
2883
+ function Wi(t, e) {
2884
2884
  const n = me(t);
2885
2885
  if (bn(e))
2886
- return Tt.create(n, er.create(ke.create(e)));
2886
+ return xt.create(n, er.create(ke.create(e)));
2887
2887
  const r = e.slice(0, -1);
2888
2888
  if (bn(r))
2889
- return Tt.create(n, it.create(ke.create(r)));
2889
+ return xt.create(n, it.create(ke.create(r)));
2890
2890
  throw new Error(`Invalid JSON operator: ${e}`);
2891
2891
  }
2892
2892
  function me(t) {
2893
2893
  const e = ".";
2894
2894
  if (!t.includes(e))
2895
- return jt.create(mn.create(t));
2895
+ return qt.create(mn.create(t));
2896
2896
  const n = t.split(e).map(tr);
2897
2897
  if (n.length === 3)
2898
2898
  return Ui(n);
@@ -2910,11 +2910,11 @@ function Ki(t) {
2910
2910
  }
2911
2911
  function Ui(t) {
2912
2912
  const [e, n, r] = t;
2913
- return jt.create(mn.create(r), xe.createWithSchema(e, n));
2913
+ return qt.create(mn.create(r), Se.createWithSchema(e, n));
2914
2914
  }
2915
2915
  function Qi(t) {
2916
2916
  const [e, n] = t;
2917
- return jt.create(mn.create(n), xe.create(e));
2917
+ return qt.create(mn.create(n), Se.create(e));
2918
2918
  }
2919
2919
  function tr(t) {
2920
2920
  return t.trim();
@@ -2961,7 +2961,7 @@ function Yi(t) {
2961
2961
  return le(t) ? Hi(t) : $(t);
2962
2962
  }
2963
2963
  function $(t) {
2964
- return Wt(t) ? Mt(t) : he.create(t);
2964
+ return Bt(t) ? Mt(t) : he.create(t);
2965
2965
  }
2966
2966
  function hn(t) {
2967
2967
  return _n(t) || Un(t) || Qn(t);
@@ -2972,7 +2972,7 @@ function fn(t) {
2972
2972
  return he.createImmediate(t);
2973
2973
  }
2974
2974
  function Hi(t) {
2975
- return t.some(Wt) ? Gi.create(t.map((e) => $(e))) : Vi.create(t);
2975
+ return t.some(Bt) ? Gi.create(t.map((e) => $(e))) : Vi.create(t);
2976
2976
  }
2977
2977
  const mt = s({
2978
2978
  is(t) {
@@ -2993,10 +2993,10 @@ function K(t) {
2993
2993
  throw new Error(`invalid arguments: ${JSON.stringify(t)}`);
2994
2994
  }
2995
2995
  function pn(t, e, n) {
2996
- return Xi(e) && nr(n) ? Xe.create(q(t), Xt(e), he.createImmediate(n)) : Xe.create(q(t), Xt(e), Yi(n));
2996
+ return Xi(e) && nr(n) ? Xe.create(j(t), Xt(e), he.createImmediate(n)) : Xe.create(j(t), Xt(e), Yi(n));
2997
2997
  }
2998
2998
  function ht(t, e, n) {
2999
- return Xe.create(q(t), Xt(e), q(n));
2999
+ return Xe.create(j(t), Xt(e), j(n));
3000
3000
  }
3001
3001
  function On(t, e) {
3002
3002
  return Ht(Object.entries(t).filter(([, n]) => !Ot(n)).map(([n, r]) => pn(n, nr(r) ? "is" : "=", r)), e);
@@ -3005,9 +3005,9 @@ function Ht(t, e, n = !0) {
3005
3005
  const r = e === "and" ? _e.create : tt.create;
3006
3006
  if (t.length === 0)
3007
3007
  return Xe.create(he.createImmediate(1), ke.create("="), he.createImmediate(e === "and" ? 1 : 0));
3008
- let a = Tn(t[0]);
3008
+ let a = xn(t[0]);
3009
3009
  for (let o = 1; o < t.length; ++o)
3010
- a = r(a, Tn(t[o]));
3010
+ a = r(a, xn(t[o]));
3011
3011
  return t.length > 1 && n ? mt.create(a) : a;
3012
3012
  }
3013
3013
  function Xi(t) {
@@ -3023,7 +3023,7 @@ function Xt(t) {
3023
3023
  return t.toOperationNode();
3024
3024
  throw new Error(`invalid operator ${JSON.stringify(t)}`);
3025
3025
  }
3026
- function Tn(t) {
3026
+ function xn(t) {
3027
3027
  return J(t) ? t.toOperationNode() : t;
3028
3028
  }
3029
3029
  const Ze = s({
@@ -3042,7 +3042,7 @@ const Ze = s({
3042
3042
  items: s([...t.items, ...e])
3043
3043
  });
3044
3044
  }
3045
- }), Sn = s({
3045
+ }), Tn = s({
3046
3046
  is(t) {
3047
3047
  return t.kind === "PartitionByNode";
3048
3048
  },
@@ -3076,10 +3076,10 @@ const Ze = s({
3076
3076
  cloneWithPartitionByItems(t, e) {
3077
3077
  return s({
3078
3078
  ...t,
3079
- partitionBy: t.partitionBy ? Sn.cloneWithItems(t.partitionBy, e) : Sn.create(e)
3079
+ partitionBy: t.partitionBy ? Tn.cloneWithItems(t.partitionBy, e) : Tn.create(e)
3080
3080
  });
3081
3081
  }
3082
- }), St = s({
3082
+ }), Tt = s({
3083
3083
  is(t) {
3084
3084
  return t.kind === "FromNode";
3085
3085
  },
@@ -3095,7 +3095,7 @@ const Ze = s({
3095
3095
  froms: s([...t.froms, ...e])
3096
3096
  });
3097
3097
  }
3098
- }), xn = s({
3098
+ }), Sn = s({
3099
3099
  is(t) {
3100
3100
  return t.kind === "GroupByNode";
3101
3101
  },
@@ -3127,7 +3127,7 @@ const Ze = s({
3127
3127
  having: e === "And" ? _e.create(t.having, n) : tt.create(t.having, n)
3128
3128
  });
3129
3129
  }
3130
- }), T = s({
3130
+ }), x = s({
3131
3131
  is(t) {
3132
3132
  return t.kind === "SelectQueryNode";
3133
3133
  },
@@ -3140,7 +3140,7 @@ const Ze = s({
3140
3140
  createFrom(t, e) {
3141
3141
  return s({
3142
3142
  kind: "SelectQueryNode",
3143
- from: St.create(t),
3143
+ from: Tt.create(t),
3144
3144
  ...e && { with: e }
3145
3145
  });
3146
3146
  },
@@ -3177,7 +3177,7 @@ const Ze = s({
3177
3177
  cloneWithGroupByItems(t, e) {
3178
3178
  return s({
3179
3179
  ...t,
3180
- groupBy: t.groupBy ? xn.cloneWithItems(t.groupBy, e) : xn.create(e)
3180
+ groupBy: t.groupBy ? Sn.cloneWithItems(t.groupBy, e) : Sn.create(e)
3181
3181
  });
3182
3182
  },
3183
3183
  cloneWithLimit(t, e) {
@@ -3251,16 +3251,16 @@ function Ie(t, e) {
3251
3251
  }
3252
3252
  });
3253
3253
  }
3254
- var W;
3254
+ var B;
3255
3255
  const dt = class dt {
3256
3256
  constructor(e) {
3257
- C(this, W);
3258
- O(this, W, s(e));
3257
+ C(this, B);
3258
+ O(this, B, s(e));
3259
3259
  }
3260
3260
  on(...e) {
3261
3261
  return new dt({
3262
- ...i(this, W),
3263
- joinNode: ot.cloneWithOn(i(this, W).joinNode, K(e))
3262
+ ...i(this, B),
3263
+ joinNode: ot.cloneWithOn(i(this, B).joinNode, K(e))
3264
3264
  });
3265
3265
  }
3266
3266
  /**
@@ -3271,8 +3271,8 @@ const dt = class dt {
3271
3271
  */
3272
3272
  onRef(e, n, r) {
3273
3273
  return new dt({
3274
- ...i(this, W),
3275
- joinNode: ot.cloneWithOn(i(this, W).joinNode, ht(e, n, r))
3274
+ ...i(this, B),
3275
+ joinNode: ot.cloneWithOn(i(this, B).joinNode, ht(e, n, r))
3276
3276
  });
3277
3277
  }
3278
3278
  /**
@@ -3280,8 +3280,8 @@ const dt = class dt {
3280
3280
  */
3281
3281
  onTrue() {
3282
3282
  return new dt({
3283
- ...i(this, W),
3284
- joinNode: ot.cloneWithOn(i(this, W).joinNode, R.createWithSql("true"))
3283
+ ...i(this, B),
3284
+ joinNode: ot.cloneWithOn(i(this, B).joinNode, R.createWithSql("true"))
3285
3285
  });
3286
3286
  }
3287
3287
  /**
@@ -3292,12 +3292,12 @@ const dt = class dt {
3292
3292
  return e(this);
3293
3293
  }
3294
3294
  toOperationNode() {
3295
- return i(this, W).joinNode;
3295
+ return i(this, B).joinNode;
3296
3296
  }
3297
3297
  };
3298
- W = new WeakMap();
3299
- let xt = dt;
3300
- Ie(xt, "don't await JoinBuilder instances. They are never executed directly and are always just a part of a query.");
3298
+ B = new WeakMap();
3299
+ let St = dt;
3300
+ Ie(St, "don't await JoinBuilder instances. They are never executed directly and are always just a part of a query.");
3301
3301
  const Zi = s({
3302
3302
  is(t) {
3303
3303
  return t.kind === "PartitionByItemNode";
@@ -3382,7 +3382,7 @@ const st = s({
3382
3382
  createSelectAllFromTable(t) {
3383
3383
  return s({
3384
3384
  kind: "SelectionNode",
3385
- selection: jt.createSelectAll(t)
3385
+ selection: qt.createSelectAll(t)
3386
3386
  });
3387
3387
  }
3388
3388
  });
@@ -3397,7 +3397,7 @@ function ar(t) {
3397
3397
  }
3398
3398
  function In(t) {
3399
3399
  if (G(t))
3400
- return st.createSelectAllFromTable(B(t));
3400
+ return st.createSelectAllFromTable(W(t));
3401
3401
  throw new Error(`invalid value selectAll expression: ${JSON.stringify(t)}`);
3402
3402
  }
3403
3403
  const ts = s({
@@ -3442,7 +3442,7 @@ const ts = s({
3442
3442
  cloneWithFromItems(t, e) {
3443
3443
  return s({
3444
3444
  ...t,
3445
- from: t.from ? St.cloneWithFroms(t.from, e) : St.create(e)
3445
+ from: t.from ? Tt.cloneWithFroms(t.from, e) : Tt.create(e)
3446
3446
  });
3447
3447
  },
3448
3448
  cloneWithUpdates(t, e) {
@@ -3480,7 +3480,7 @@ const ts = s({
3480
3480
  create(t, e) {
3481
3481
  return s({
3482
3482
  kind: "DeleteQueryNode",
3483
- from: St.create(t),
3483
+ from: Tt.create(t),
3484
3484
  ...e && { with: e }
3485
3485
  });
3486
3486
  },
@@ -3623,7 +3623,7 @@ const ts = s({
3623
3623
  }
3624
3624
  }), M = s({
3625
3625
  is(t) {
3626
- return T.is(t) || ts.is(t) || ns.is(t) || rs.is(t) || os.is(t);
3626
+ return x.is(t) || ts.is(t) || ns.is(t) || rs.is(t) || os.is(t);
3627
3627
  },
3628
3628
  cloneWithWhere(t, e) {
3629
3629
  return s({
@@ -3795,16 +3795,16 @@ function ms() {
3795
3795
  function H() {
3796
3796
  return new hs();
3797
3797
  }
3798
- var je;
3798
+ var qe;
3799
3799
  class hs {
3800
3800
  constructor() {
3801
- C(this, je);
3801
+ C(this, qe);
3802
3802
  }
3803
3803
  get queryId() {
3804
- return i(this, je) === void 0 && O(this, je, _s(8)), i(this, je);
3804
+ return i(this, qe) === void 0 && O(this, qe, _s(8)), i(this, qe);
3805
3805
  }
3806
3806
  }
3807
- je = new WeakMap();
3807
+ qe = new WeakMap();
3808
3808
  var $t;
3809
3809
  class fs {
3810
3810
  constructor() {
@@ -4696,7 +4696,7 @@ class gs extends fs {
4696
4696
  const r = super.transformReferences(n);
4697
4697
  return r.table.table.schema ? r : {
4698
4698
  ...r,
4699
- table: xe.createWithSchema(i(this, Le), r.table.table.identifier.name)
4699
+ table: Se.createWithSchema(i(this, Le), r.table.table.identifier.name)
4700
4700
  };
4701
4701
  }
4702
4702
  }
@@ -4715,7 +4715,7 @@ Le = new WeakMap(), Ne = new WeakMap(), ve = new WeakMap(), I = new WeakSet(), o
4715
4715
  const r = /* @__PURE__ */ new Set();
4716
4716
  return "with" in n && n.with && w(this, I, ur).call(this, n.with, r), r;
4717
4717
  }, $e = function(n, r) {
4718
- const a = xe.is(n) ? n : fe.is(n) && xe.is(n.node) ? n.node : null;
4718
+ const a = Se.is(n) ? n : fe.is(n) && Se.is(n.node) ? n.node : null;
4719
4719
  a && w(this, I, en).call(this, a.table, r);
4720
4720
  }, en = function(n, r) {
4721
4721
  const a = n.identifier.name;
@@ -4846,7 +4846,7 @@ class Fe extends Ns {
4846
4846
  }
4847
4847
  const cr = new Fe();
4848
4848
  function Cs(t, e) {
4849
- return new xt({
4849
+ return new St({
4850
4850
  joinNode: ot.create(t, It(e))
4851
4851
  });
4852
4852
  }
@@ -4857,7 +4857,7 @@ function bs() {
4857
4857
  }
4858
4858
  function Ae(t, e) {
4859
4859
  if (e.length === 3)
4860
- return Ts(t, e[0], e[1], e[2]);
4860
+ return xs(t, e[0], e[1], e[2]);
4861
4861
  if (e.length === 2)
4862
4862
  return Os(t, e[0], e[1]);
4863
4863
  throw new Error("not implemented");
@@ -4865,10 +4865,10 @@ function Ae(t, e) {
4865
4865
  function Os(t, e, n) {
4866
4866
  return n(Cs(t, e)).toOperationNode();
4867
4867
  }
4868
- function Ts(t, e, n, r) {
4868
+ function xs(t, e, n, r) {
4869
4869
  return ot.createWithOn(t, It(e), ht(n, "=", r));
4870
4870
  }
4871
- const Ss = s({
4871
+ const Ts = s({
4872
4872
  is(t) {
4873
4873
  return t.kind === "OffsetNode";
4874
4874
  },
@@ -4878,7 +4878,7 @@ const Ss = s({
4878
4878
  offset: t
4879
4879
  });
4880
4880
  }
4881
- }), xs = s({
4881
+ }), Ss = s({
4882
4882
  is(t) {
4883
4883
  return t.kind === "GroupByItemNode";
4884
4884
  },
@@ -4890,7 +4890,7 @@ const Ss = s({
4890
4890
  }
4891
4891
  });
4892
4892
  function ks(t) {
4893
- return t = Ee(t) ? t(Jt()) : t, _t(t).map(xs.create);
4893
+ return t = Ee(t) ? t(Jt()) : t, _t(t).map(Ss.create);
4894
4894
  }
4895
4895
  const Es = s({
4896
4896
  is(t) {
@@ -4952,27 +4952,27 @@ const Dt = class Dt {
4952
4952
  }
4953
4953
  };
4954
4954
  te = new WeakMap();
4955
- let x = Dt;
4956
- var We, ue;
4955
+ let S = Dt;
4956
+ var Be, ue;
4957
4957
  class gn {
4958
4958
  constructor(e, n) {
4959
- C(this, We);
4959
+ C(this, Be);
4960
4960
  C(this, ue);
4961
- O(this, We, e), O(this, ue, n);
4961
+ O(this, Be, e), O(this, ue, n);
4962
4962
  }
4963
4963
  /** @private */
4964
4964
  get expression() {
4965
- return i(this, We);
4965
+ return i(this, Be);
4966
4966
  }
4967
4967
  /** @private */
4968
4968
  get alias() {
4969
4969
  return i(this, ue);
4970
4970
  }
4971
4971
  toOperationNode() {
4972
- return fe.create(i(this, We).toOperationNode(), J(i(this, ue)) ? i(this, ue).toOperationNode() : z.create(i(this, ue)));
4972
+ return fe.create(i(this, Be).toOperationNode(), J(i(this, ue)) ? i(this, ue).toOperationNode() : z.create(i(this, ue)));
4973
4973
  }
4974
4974
  }
4975
- We = new WeakMap(), ue = new WeakMap();
4975
+ Be = new WeakMap(), ue = new WeakMap();
4976
4976
  var be;
4977
4977
  const Rt = class Rt {
4978
4978
  constructor(e) {
@@ -5081,85 +5081,85 @@ const N = class N {
5081
5081
  having(...e) {
5082
5082
  return new N({
5083
5083
  ...i(this, _),
5084
- queryNode: T.cloneWithHaving(i(this, _).queryNode, K(e))
5084
+ queryNode: x.cloneWithHaving(i(this, _).queryNode, K(e))
5085
5085
  });
5086
5086
  }
5087
5087
  havingRef(e, n, r) {
5088
5088
  return new N({
5089
5089
  ...i(this, _),
5090
- queryNode: T.cloneWithHaving(i(this, _).queryNode, ht(e, n, r))
5090
+ queryNode: x.cloneWithHaving(i(this, _).queryNode, ht(e, n, r))
5091
5091
  });
5092
5092
  }
5093
5093
  select(e) {
5094
5094
  return new N({
5095
5095
  ...i(this, _),
5096
- queryNode: T.cloneWithSelections(i(this, _).queryNode, rr(e))
5096
+ queryNode: x.cloneWithSelections(i(this, _).queryNode, rr(e))
5097
5097
  });
5098
5098
  }
5099
5099
  distinctOn(e) {
5100
5100
  return new N({
5101
5101
  ...i(this, _),
5102
- queryNode: T.cloneWithDistinctOn(i(this, _).queryNode, _t(e))
5102
+ queryNode: x.cloneWithDistinctOn(i(this, _).queryNode, _t(e))
5103
5103
  });
5104
5104
  }
5105
5105
  modifyFront(e) {
5106
5106
  return new N({
5107
5107
  ...i(this, _),
5108
- queryNode: T.cloneWithFrontModifier(i(this, _).queryNode, Y.createWithExpression(e.toOperationNode()))
5108
+ queryNode: x.cloneWithFrontModifier(i(this, _).queryNode, Y.createWithExpression(e.toOperationNode()))
5109
5109
  });
5110
5110
  }
5111
5111
  modifyEnd(e) {
5112
5112
  return new N({
5113
5113
  ...i(this, _),
5114
- queryNode: T.cloneWithEndModifier(i(this, _).queryNode, Y.createWithExpression(e.toOperationNode()))
5114
+ queryNode: x.cloneWithEndModifier(i(this, _).queryNode, Y.createWithExpression(e.toOperationNode()))
5115
5115
  });
5116
5116
  }
5117
5117
  distinct() {
5118
5118
  return new N({
5119
5119
  ...i(this, _),
5120
- queryNode: T.cloneWithFrontModifier(i(this, _).queryNode, Y.create("Distinct"))
5120
+ queryNode: x.cloneWithFrontModifier(i(this, _).queryNode, Y.create("Distinct"))
5121
5121
  });
5122
5122
  }
5123
5123
  forUpdate(e) {
5124
5124
  return new N({
5125
5125
  ...i(this, _),
5126
- queryNode: T.cloneWithEndModifier(i(this, _).queryNode, Y.create("ForUpdate", e ? vt(e).map(B) : void 0))
5126
+ queryNode: x.cloneWithEndModifier(i(this, _).queryNode, Y.create("ForUpdate", e ? vt(e).map(W) : void 0))
5127
5127
  });
5128
5128
  }
5129
5129
  forShare(e) {
5130
5130
  return new N({
5131
5131
  ...i(this, _),
5132
- queryNode: T.cloneWithEndModifier(i(this, _).queryNode, Y.create("ForShare", e ? vt(e).map(B) : void 0))
5132
+ queryNode: x.cloneWithEndModifier(i(this, _).queryNode, Y.create("ForShare", e ? vt(e).map(W) : void 0))
5133
5133
  });
5134
5134
  }
5135
5135
  forKeyShare(e) {
5136
5136
  return new N({
5137
5137
  ...i(this, _),
5138
- queryNode: T.cloneWithEndModifier(i(this, _).queryNode, Y.create("ForKeyShare", e ? vt(e).map(B) : void 0))
5138
+ queryNode: x.cloneWithEndModifier(i(this, _).queryNode, Y.create("ForKeyShare", e ? vt(e).map(W) : void 0))
5139
5139
  });
5140
5140
  }
5141
5141
  forNoKeyUpdate(e) {
5142
5142
  return new N({
5143
5143
  ...i(this, _),
5144
- queryNode: T.cloneWithEndModifier(i(this, _).queryNode, Y.create("ForNoKeyUpdate", e ? vt(e).map(B) : void 0))
5144
+ queryNode: x.cloneWithEndModifier(i(this, _).queryNode, Y.create("ForNoKeyUpdate", e ? vt(e).map(W) : void 0))
5145
5145
  });
5146
5146
  }
5147
5147
  skipLocked() {
5148
5148
  return new N({
5149
5149
  ...i(this, _),
5150
- queryNode: T.cloneWithEndModifier(i(this, _).queryNode, Y.create("SkipLocked"))
5150
+ queryNode: x.cloneWithEndModifier(i(this, _).queryNode, Y.create("SkipLocked"))
5151
5151
  });
5152
5152
  }
5153
5153
  noWait() {
5154
5154
  return new N({
5155
5155
  ...i(this, _),
5156
- queryNode: T.cloneWithEndModifier(i(this, _).queryNode, Y.create("NoWait"))
5156
+ queryNode: x.cloneWithEndModifier(i(this, _).queryNode, Y.create("NoWait"))
5157
5157
  });
5158
5158
  }
5159
5159
  selectAll(e) {
5160
5160
  return new N({
5161
5161
  ...i(this, _),
5162
- queryNode: T.cloneWithSelections(i(this, _).queryNode, ar(e))
5162
+ queryNode: x.cloneWithSelections(i(this, _).queryNode, ar(e))
5163
5163
  });
5164
5164
  }
5165
5165
  innerJoin(...e) {
@@ -5201,31 +5201,31 @@ const N = class N {
5201
5201
  orderBy(...e) {
5202
5202
  return new N({
5203
5203
  ...i(this, _),
5204
- queryNode: T.cloneWithOrderByItems(i(this, _).queryNode, Xn(e))
5204
+ queryNode: x.cloneWithOrderByItems(i(this, _).queryNode, Xn(e))
5205
5205
  });
5206
5206
  }
5207
5207
  groupBy(e) {
5208
5208
  return new N({
5209
5209
  ...i(this, _),
5210
- queryNode: T.cloneWithGroupByItems(i(this, _).queryNode, ks(e))
5210
+ queryNode: x.cloneWithGroupByItems(i(this, _).queryNode, ks(e))
5211
5211
  });
5212
5212
  }
5213
5213
  limit(e) {
5214
5214
  return new N({
5215
5215
  ...i(this, _),
5216
- queryNode: T.cloneWithLimit(i(this, _).queryNode, ls.create($(e)))
5216
+ queryNode: x.cloneWithLimit(i(this, _).queryNode, ls.create($(e)))
5217
5217
  });
5218
5218
  }
5219
5219
  offset(e) {
5220
5220
  return new N({
5221
5221
  ...i(this, _),
5222
- queryNode: T.cloneWithOffset(i(this, _).queryNode, Ss.create($(e)))
5222
+ queryNode: x.cloneWithOffset(i(this, _).queryNode, Ts.create($(e)))
5223
5223
  });
5224
5224
  }
5225
5225
  fetch(e, n = "only") {
5226
5226
  return new N({
5227
5227
  ...i(this, _),
5228
- queryNode: T.cloneWithFetch(i(this, _).queryNode, As(e, n))
5228
+ queryNode: x.cloneWithFetch(i(this, _).queryNode, As(e, n))
5229
5229
  });
5230
5230
  }
5231
5231
  top(e, n) {
@@ -5237,37 +5237,37 @@ const N = class N {
5237
5237
  union(e) {
5238
5238
  return new N({
5239
5239
  ...i(this, _),
5240
- queryNode: T.cloneWithSetOperations(i(this, _).queryNode, Pe("union", e, !1))
5240
+ queryNode: x.cloneWithSetOperations(i(this, _).queryNode, Pe("union", e, !1))
5241
5241
  });
5242
5242
  }
5243
5243
  unionAll(e) {
5244
5244
  return new N({
5245
5245
  ...i(this, _),
5246
- queryNode: T.cloneWithSetOperations(i(this, _).queryNode, Pe("union", e, !0))
5246
+ queryNode: x.cloneWithSetOperations(i(this, _).queryNode, Pe("union", e, !0))
5247
5247
  });
5248
5248
  }
5249
5249
  intersect(e) {
5250
5250
  return new N({
5251
5251
  ...i(this, _),
5252
- queryNode: T.cloneWithSetOperations(i(this, _).queryNode, Pe("intersect", e, !1))
5252
+ queryNode: x.cloneWithSetOperations(i(this, _).queryNode, Pe("intersect", e, !1))
5253
5253
  });
5254
5254
  }
5255
5255
  intersectAll(e) {
5256
5256
  return new N({
5257
5257
  ...i(this, _),
5258
- queryNode: T.cloneWithSetOperations(i(this, _).queryNode, Pe("intersect", e, !0))
5258
+ queryNode: x.cloneWithSetOperations(i(this, _).queryNode, Pe("intersect", e, !0))
5259
5259
  });
5260
5260
  }
5261
5261
  except(e) {
5262
5262
  return new N({
5263
5263
  ...i(this, _),
5264
- queryNode: T.cloneWithSetOperations(i(this, _).queryNode, Pe("except", e, !1))
5264
+ queryNode: x.cloneWithSetOperations(i(this, _).queryNode, Pe("except", e, !1))
5265
5265
  });
5266
5266
  }
5267
5267
  exceptAll(e) {
5268
5268
  return new N({
5269
5269
  ...i(this, _),
5270
- queryNode: T.cloneWithSetOperations(i(this, _).queryNode, Pe("except", e, !0))
5270
+ queryNode: x.cloneWithSetOperations(i(this, _).queryNode, Pe("except", e, !0))
5271
5271
  });
5272
5272
  }
5273
5273
  as(e) {
@@ -5276,7 +5276,7 @@ const N = class N {
5276
5276
  clearSelect() {
5277
5277
  return new N({
5278
5278
  ...i(this, _),
5279
- queryNode: T.cloneWithoutSelections(i(this, _).queryNode)
5279
+ queryNode: x.cloneWithoutSelections(i(this, _).queryNode)
5280
5280
  });
5281
5281
  }
5282
5282
  clearWhere() {
@@ -5288,25 +5288,25 @@ const N = class N {
5288
5288
  clearLimit() {
5289
5289
  return new N({
5290
5290
  ...i(this, _),
5291
- queryNode: T.cloneWithoutLimit(i(this, _).queryNode)
5291
+ queryNode: x.cloneWithoutLimit(i(this, _).queryNode)
5292
5292
  });
5293
5293
  }
5294
5294
  clearOffset() {
5295
5295
  return new N({
5296
5296
  ...i(this, _),
5297
- queryNode: T.cloneWithoutOffset(i(this, _).queryNode)
5297
+ queryNode: x.cloneWithoutOffset(i(this, _).queryNode)
5298
5298
  });
5299
5299
  }
5300
5300
  clearOrderBy() {
5301
5301
  return new N({
5302
5302
  ...i(this, _),
5303
- queryNode: T.cloneWithoutOrderBy(i(this, _).queryNode)
5303
+ queryNode: x.cloneWithoutOrderBy(i(this, _).queryNode)
5304
5304
  });
5305
5305
  }
5306
5306
  clearGroupBy() {
5307
5307
  return new N({
5308
5308
  ...i(this, _),
5309
- queryNode: T.cloneWithoutGroupBy(i(this, _).queryNode)
5309
+ queryNode: x.cloneWithoutGroupBy(i(this, _).queryNode)
5310
5310
  });
5311
5311
  }
5312
5312
  $call(e) {
@@ -5327,7 +5327,7 @@ const N = class N {
5327
5327
  return new N(i(this, _));
5328
5328
  }
5329
5329
  $asTuple() {
5330
- return new x(this.toOperationNode());
5330
+ return new S(this.toOperationNode());
5331
5331
  }
5332
5332
  withPlugin(e) {
5333
5333
  return new N({
@@ -5373,15 +5373,15 @@ Ie(Et, "don't await SelectQueryBuilder instances directly. To execute the query
5373
5373
  function $s(t) {
5374
5374
  return new Et(t);
5375
5375
  }
5376
- var Be, Ke;
5376
+ var We, Ke;
5377
5377
  class lr {
5378
5378
  constructor(e, n) {
5379
- C(this, Be);
5379
+ C(this, We);
5380
5380
  C(this, Ke);
5381
- O(this, Be, e), O(this, Ke, n);
5381
+ O(this, We, e), O(this, Ke, n);
5382
5382
  }
5383
5383
  get expression() {
5384
- return i(this, Be);
5384
+ return i(this, We);
5385
5385
  }
5386
5386
  get alias() {
5387
5387
  return i(this, Ke);
@@ -5390,10 +5390,10 @@ class lr {
5390
5390
  return !0;
5391
5391
  }
5392
5392
  toOperationNode() {
5393
- return fe.create(i(this, Be).toOperationNode(), z.create(i(this, Ke)));
5393
+ return fe.create(i(this, We).toOperationNode(), z.create(i(this, Ke)));
5394
5394
  }
5395
5395
  }
5396
- Be = new WeakMap(), Ke = new WeakMap();
5396
+ We = new WeakMap(), Ke = new WeakMap();
5397
5397
  Ie(lr, "don't await AliasedSelectQueryBuilder instances directly. AliasedSelectQueryBuilder should never be executed directly since it's always a part of another query.");
5398
5398
  const ye = s({
5399
5399
  is(t) {
@@ -5632,8 +5632,8 @@ const se = class se {
5632
5632
  }
5633
5633
  };
5634
5634
  A = new WeakMap();
5635
- let qe = se;
5636
- Ie(qe, "don't await AggregateFunctionBuilder instances. They are never executed directly and are always just a part of a query.");
5635
+ let je = se;
5636
+ Ie(je, "don't await AggregateFunctionBuilder instances. They are never executed directly and are always just a part of a query.");
5637
5637
  var Ue, Qe;
5638
5638
  class Ds {
5639
5639
  constructor(e, n) {
@@ -5655,7 +5655,7 @@ class Ds {
5655
5655
  }
5656
5656
  Ue = new WeakMap(), Qe = new WeakMap();
5657
5657
  function Rs() {
5658
- const t = (n, r) => new x(Fn.create(n, _t(r ?? []))), e = (n, r) => new qe({
5658
+ const t = (n, r) => new S(Fn.create(n, _t(r ?? []))), e = (n, r) => new je({
5659
5659
  aggregateFunctionNode: ye.create(n, r ? _t(r) : void 0)
5660
5660
  });
5661
5661
  return Object.assign(t, {
@@ -5670,7 +5670,7 @@ function Rs() {
5670
5670
  return e("count", [n]);
5671
5671
  },
5672
5672
  countAll(n) {
5673
- return new qe({
5673
+ return new je({
5674
5674
  aggregateFunctionNode: ye.create("count", ar(n))
5675
5675
  });
5676
5676
  },
@@ -5687,15 +5687,15 @@ function Rs() {
5687
5687
  return t("any", [n]);
5688
5688
  },
5689
5689
  jsonAgg(n) {
5690
- return new qe({
5690
+ return new je({
5691
5691
  aggregateFunctionNode: ye.create("json_agg", [
5692
- G(n) ? B(n) : n.toOperationNode()
5692
+ G(n) ? W(n) : n.toOperationNode()
5693
5693
  ])
5694
5694
  });
5695
5695
  },
5696
5696
  toJson(n) {
5697
- return new x(Fn.create("to_json", [
5698
- G(n) ? B(n) : n.toOperationNode()
5697
+ return new S(Fn.create("to_json", [
5698
+ G(n) ? W(n) : n.toOperationNode()
5699
5699
  ]));
5700
5700
  }
5701
5701
  });
@@ -5713,7 +5713,7 @@ const zs = s({
5713
5713
  }
5714
5714
  });
5715
5715
  function Fs(t, e) {
5716
- return zs.create(ke.create(t), q(e));
5716
+ return zs.create(ke.create(t), j(e));
5717
5717
  }
5718
5718
  const ne = s({
5719
5719
  is(t) {
@@ -5748,7 +5748,7 @@ const ne = s({
5748
5748
  }
5749
5749
  });
5750
5750
  var Ve;
5751
- class qs {
5751
+ class js {
5752
5752
  constructor(e) {
5753
5753
  C(this, Ve);
5754
5754
  O(this, Ve, s(e));
@@ -5768,7 +5768,7 @@ class _r {
5768
5768
  O(this, Ge, s(e));
5769
5769
  }
5770
5770
  then(e) {
5771
- return new js({
5771
+ return new qs({
5772
5772
  ...i(this, Ge),
5773
5773
  node: ne.cloneWithThen(i(this, Ge).node, hn(e) ? fn(e) : $(e))
5774
5774
  });
@@ -5776,7 +5776,7 @@ class _r {
5776
5776
  }
5777
5777
  Ge = new WeakMap();
5778
5778
  var Q;
5779
- class js {
5779
+ class qs {
5780
5780
  constructor(e) {
5781
5781
  C(this, Q);
5782
5782
  O(this, Q, s(e));
@@ -5796,10 +5796,10 @@ class js {
5796
5796
  });
5797
5797
  }
5798
5798
  end() {
5799
- return new x(ne.cloneWith(i(this, Q).node, { isStatement: !1 }));
5799
+ return new S(ne.cloneWith(i(this, Q).node, { isStatement: !1 }));
5800
5800
  }
5801
5801
  endCase() {
5802
- return new x(ne.cloneWith(i(this, Q).node, { isStatement: !0 }));
5802
+ return new S(ne.cloneWith(i(this, Q).node, { isStatement: !0 }));
5803
5803
  }
5804
5804
  }
5805
5805
  Q = new WeakMap();
@@ -5810,14 +5810,14 @@ class Ls {
5810
5810
  O(this, Ye, s(e));
5811
5811
  }
5812
5812
  end() {
5813
- return new x(ne.cloneWith(i(this, Ye).node, { isStatement: !1 }));
5813
+ return new S(ne.cloneWith(i(this, Ye).node, { isStatement: !1 }));
5814
5814
  }
5815
5815
  endCase() {
5816
- return new x(ne.cloneWith(i(this, Ye).node, { isStatement: !0 }));
5816
+ return new S(ne.cloneWith(i(this, Ye).node, { isStatement: !0 }));
5817
5817
  }
5818
5818
  }
5819
5819
  Ye = new WeakMap();
5820
- const qn = s({
5820
+ const jn = s({
5821
5821
  is(t) {
5822
5822
  return t.kind === "JSONPathLegNode";
5823
5823
  },
@@ -5957,14 +5957,14 @@ class ut {
5957
5957
  }
5958
5958
  }
5959
5959
  V = new WeakMap(), yt = new WeakSet(), an = function(e, n) {
5960
- return Tt.is(i(this, V)) ? new jn(Tt.cloneWithTraversal(i(this, V), it.is(i(this, V).traversal) ? it.cloneWithLeg(i(this, V).traversal, qn.create(e, n)) : er.cloneWithValue(i(this, V).traversal, he.createImmediate(n)))) : new jn(it.cloneWithLeg(i(this, V), qn.create(e, n)));
5960
+ return xt.is(i(this, V)) ? new qn(xt.cloneWithTraversal(i(this, V), it.is(i(this, V).traversal) ? it.cloneWithLeg(i(this, V).traversal, jn.create(e, n)) : er.cloneWithValue(i(this, V).traversal, he.createImmediate(n)))) : new qn(it.cloneWithLeg(i(this, V), jn.create(e, n)));
5961
5961
  };
5962
- var Te;
5963
- class jn extends ut {
5962
+ var xe;
5963
+ class qn extends ut {
5964
5964
  constructor(n) {
5965
5965
  super(n);
5966
- C(this, Te);
5967
- O(this, Te, n);
5966
+ C(this, xe);
5967
+ O(this, xe, n);
5968
5968
  }
5969
5969
  /** @private */
5970
5970
  get expressionType() {
@@ -5979,16 +5979,16 @@ class jn extends ut {
5979
5979
  * returns a copy of this `JSONPathBuilder` with a new output type.
5980
5980
  */
5981
5981
  $castTo() {
5982
- return new ut(i(this, Te));
5982
+ return new ut(i(this, xe));
5983
5983
  }
5984
5984
  $notNull() {
5985
- return new ut(i(this, Te));
5985
+ return new ut(i(this, xe));
5986
5986
  }
5987
5987
  toOperationNode() {
5988
- return i(this, Te);
5988
+ return i(this, xe);
5989
5989
  }
5990
5990
  }
5991
- Te = new WeakMap();
5991
+ xe = new WeakMap();
5992
5992
  var He, de;
5993
5993
  class Js {
5994
5994
  constructor(e, n) {
@@ -6051,7 +6051,7 @@ const Ln = s({
6051
6051
  "jsonb",
6052
6052
  "blob",
6053
6053
  "varbinary"
6054
- ], Ws = [
6054
+ ], Bs = [
6055
6055
  /^varchar\(\d+\)$/,
6056
6056
  /^char\(\d+\)$/,
6057
6057
  /^decimal\(\d+, \d+\)$/,
@@ -6063,7 +6063,7 @@ const Ln = s({
6063
6063
  /^timestamp\(\d+\)$/,
6064
6064
  /^timestamptz\(\d+\)$/,
6065
6065
  /^varbinary\(\d+\)$/
6066
- ], Bs = s({
6066
+ ], Ws = s({
6067
6067
  is(t) {
6068
6068
  return t.kind === "DataTypeNode";
6069
6069
  },
@@ -6075,13 +6075,13 @@ const Ln = s({
6075
6075
  }
6076
6076
  });
6077
6077
  function Ks(t) {
6078
- return !!(Ms.includes(t) || Ws.some((e) => e.test(t)));
6078
+ return !!(Ms.includes(t) || Bs.some((e) => e.test(t)));
6079
6079
  }
6080
6080
  function Us(t) {
6081
6081
  if (J(t))
6082
6082
  return t.toOperationNode();
6083
6083
  if (Ks(t))
6084
- return Bs.create(t);
6084
+ return Ws.create(t);
6085
6085
  throw new Error(`invalid column data type ${JSON.stringify(t)}`);
6086
6086
  }
6087
6087
  const Qs = s({
@@ -6098,10 +6098,10 @@ const Qs = s({
6098
6098
  });
6099
6099
  function yn(t = cr) {
6100
6100
  function e(a, o, u) {
6101
- return new x(pn(a, o, u));
6101
+ return new S(pn(a, o, u));
6102
6102
  }
6103
6103
  function n(a, o) {
6104
- return new x(Fs(a, o));
6104
+ return new S(Fs(a, o));
6105
6105
  }
6106
6106
  const r = Object.assign(e, {
6107
6107
  fn: void 0,
@@ -6110,34 +6110,34 @@ function yn(t = cr) {
6110
6110
  return $s({
6111
6111
  queryId: H(),
6112
6112
  executor: t,
6113
- queryNode: T.createFrom(Vs(a))
6113
+ queryNode: x.createFrom(Vs(a))
6114
6114
  });
6115
6115
  },
6116
6116
  case(a) {
6117
- return new qs({
6118
- node: ne.create(Ot(a) ? void 0 : q(a))
6117
+ return new js({
6118
+ node: ne.create(Ot(a) ? void 0 : j(a))
6119
6119
  });
6120
6120
  },
6121
6121
  ref(a, o) {
6122
- return Ot(o) ? new x(me(a)) : new ut(Bi(a, o));
6122
+ return Ot(o) ? new S(me(a)) : new ut(Wi(a, o));
6123
6123
  },
6124
6124
  jsonPath() {
6125
6125
  return new ut(it.create());
6126
6126
  },
6127
6127
  table(a) {
6128
- return new x(B(a));
6128
+ return new S(W(a));
6129
6129
  },
6130
6130
  val(a) {
6131
- return new x($(a));
6131
+ return new S($(a));
6132
6132
  },
6133
6133
  refTuple(...a) {
6134
- return new x(Ln.create(a.map(q)));
6134
+ return new S(Ln.create(a.map(j)));
6135
6135
  },
6136
6136
  tuple(...a) {
6137
- return new x(Ln.create(a.map($)));
6137
+ return new S(Ln.create(a.map($)));
6138
6138
  },
6139
6139
  lit(a) {
6140
- return new x(fn(a));
6140
+ return new S(fn(a));
6141
6141
  },
6142
6142
  unary: n,
6143
6143
  not(a) {
@@ -6150,23 +6150,23 @@ function yn(t = cr) {
6150
6150
  return n("-", a);
6151
6151
  },
6152
6152
  between(a, o, u) {
6153
- return new x(Xe.create(q(a), ke.create("between"), _e.create($(o), $(u))));
6153
+ return new S(Xe.create(j(a), ke.create("between"), _e.create($(o), $(u))));
6154
6154
  },
6155
6155
  betweenSymmetric(a, o, u) {
6156
- return new x(Xe.create(q(a), ke.create("between symmetric"), _e.create($(o), $(u))));
6156
+ return new S(Xe.create(j(a), ke.create("between symmetric"), _e.create($(o), $(u))));
6157
6157
  },
6158
6158
  and(a) {
6159
- return le(a) ? new x(Ht(a, "and")) : new x(On(a, "and"));
6159
+ return le(a) ? new S(Ht(a, "and")) : new S(On(a, "and"));
6160
6160
  },
6161
6161
  or(a) {
6162
- return le(a) ? new x(Ht(a, "or")) : new x(On(a, "or"));
6162
+ return le(a) ? new S(Ht(a, "or")) : new S(On(a, "or"));
6163
6163
  },
6164
6164
  parens(...a) {
6165
6165
  const o = K(a);
6166
- return mt.is(o) ? new x(o) : new x(mt.create(o));
6166
+ return mt.is(o) ? new S(o) : new S(mt.create(o));
6167
6167
  },
6168
6168
  cast(a, o) {
6169
- return new x(Qs.create(q(a), Us(o)));
6169
+ return new S(Qs.create(j(a), Us(o)));
6170
6170
  },
6171
6171
  withSchema(a) {
6172
6172
  return yn(t.withPluginAtFront(new dr(a)));
@@ -6191,7 +6191,7 @@ function mr(t) {
6191
6191
  return t(Jt()).toOperationNode();
6192
6192
  throw new Error(`invalid aliased expression: ${JSON.stringify(t)}`);
6193
6193
  }
6194
- function Wt(t) {
6194
+ function Bt(t) {
6195
6195
  return $i(t) || Di(t) || Ee(t);
6196
6196
  }
6197
6197
  function Vs(t) {
@@ -6204,25 +6204,25 @@ function Gs(t) {
6204
6204
  const e = " as ";
6205
6205
  if (t.includes(e)) {
6206
6206
  const [n, r] = t.split(e).map(hr);
6207
- return fe.create(B(n), z.create(r));
6207
+ return fe.create(W(n), z.create(r));
6208
6208
  } else
6209
- return B(t);
6209
+ return W(t);
6210
6210
  }
6211
- function B(t) {
6211
+ function W(t) {
6212
6212
  const e = ".";
6213
6213
  if (t.includes(e)) {
6214
6214
  const [n, r] = t.split(e).map(hr);
6215
- return xe.createWithSchema(n, r);
6215
+ return Se.createWithSchema(n, r);
6216
6216
  } else
6217
- return xe.create(t);
6217
+ return Se.create(t);
6218
6218
  }
6219
6219
  function hr(t) {
6220
6220
  return t.trim();
6221
6221
  }
6222
- var P, j, Ct, on, sn;
6222
+ var P, q, Ct, on, sn;
6223
6223
  const ct = class ct {
6224
6224
  constructor(e) {
6225
- C(this, j);
6225
+ C(this, q);
6226
6226
  C(this, P);
6227
6227
  O(this, P, s(e));
6228
6228
  }
@@ -6247,50 +6247,50 @@ const ct = class ct {
6247
6247
  });
6248
6248
  }
6249
6249
  toOperationNode() {
6250
- return w(this, j, on).call(this, w(this, j, Ct).call(this));
6250
+ return w(this, q, on).call(this, w(this, q, Ct).call(this));
6251
6251
  }
6252
6252
  compile(e) {
6253
- return w(this, j, sn).call(this, w(this, j, Ct).call(this, e));
6253
+ return w(this, q, sn).call(this, w(this, q, Ct).call(this, e));
6254
6254
  }
6255
6255
  async execute(e) {
6256
- const n = w(this, j, Ct).call(this, e);
6257
- return n.executeQuery(w(this, j, sn).call(this, n), i(this, P).queryId);
6256
+ const n = w(this, q, Ct).call(this, e);
6257
+ return n.executeQuery(w(this, q, sn).call(this, n), i(this, P).queryId);
6258
6258
  }
6259
6259
  };
6260
- P = new WeakMap(), j = new WeakSet(), Ct = function(e) {
6260
+ P = new WeakMap(), q = new WeakSet(), Ct = function(e) {
6261
6261
  const n = e !== void 0 ? e.getExecutor() : cr;
6262
6262
  return i(this, P).plugins !== void 0 ? n.withPlugins(i(this, P).plugins) : n;
6263
6263
  }, on = function(e) {
6264
6264
  return e.transformQuery(i(this, P).rawNode, i(this, P).queryId);
6265
6265
  }, sn = function(e) {
6266
- return e.compileQuery(w(this, j, on).call(this, e), i(this, P).queryId);
6266
+ return e.compileQuery(w(this, q, on).call(this, e), i(this, P).queryId);
6267
6267
  };
6268
6268
  let At = ct;
6269
6269
  function ie(t) {
6270
6270
  return new At(t);
6271
6271
  }
6272
6272
  Ie(At, "don't await RawBuilder instances directly. To execute the query you need to call `execute`");
6273
- var Se, ce;
6273
+ var Te, ce;
6274
6274
  class fr {
6275
6275
  constructor(e, n) {
6276
- C(this, Se);
6276
+ C(this, Te);
6277
6277
  C(this, ce);
6278
- O(this, Se, e), O(this, ce, n);
6278
+ O(this, Te, e), O(this, ce, n);
6279
6279
  }
6280
6280
  get expression() {
6281
- return i(this, Se);
6281
+ return i(this, Te);
6282
6282
  }
6283
6283
  get alias() {
6284
6284
  return i(this, ce);
6285
6285
  }
6286
6286
  get rawBuilder() {
6287
- return i(this, Se);
6287
+ return i(this, Te);
6288
6288
  }
6289
6289
  toOperationNode() {
6290
- return fe.create(i(this, Se).toOperationNode(), J(i(this, ce)) ? i(this, ce).toOperationNode() : z.create(i(this, ce)));
6290
+ return fe.create(i(this, Te).toOperationNode(), J(i(this, ce)) ? i(this, ce).toOperationNode() : z.create(i(this, ce)));
6291
6291
  }
6292
6292
  }
6293
- Se = new WeakMap(), ce = new WeakMap();
6293
+ Te = new WeakMap(), ce = new WeakMap();
6294
6294
  Ie(fr, "don't await AliasedRawBuilder instances directly. AliasedRawBuilder should never be executed directly since it's always a part of another query.");
6295
6295
  const g = Object.assign((t, ...e) => ie({
6296
6296
  queryId: H(),
@@ -6314,7 +6314,7 @@ const g = Object.assign((t, ...e) => ie({
6314
6314
  table(t) {
6315
6315
  return ie({
6316
6316
  queryId: H(),
6317
- rawNode: R.createWithChild(B(t))
6317
+ rawNode: R.createWithChild(W(t))
6318
6318
  });
6319
6319
  },
6320
6320
  id(...t) {
@@ -6361,7 +6361,7 @@ class Ys {
6361
6361
  }
6362
6362
  }
6363
6363
  const Hs = "kysely_migration", Mn = "kysely_migration_lock", Xs = !1, Qt = "migration_lock", Zs = s({ __noMigrations__: !0 });
6364
- var k, m, rt, X, Z, De, gr, ee, yr, wr, Nr, vr, Cr, un, Re, dn, br, Or, Tr, cn, Sr, xr, kr, Er, Ir, at;
6364
+ var k, m, rt, X, Z, De, gr, ee, yr, wr, Nr, vr, Cr, un, Re, dn, br, Or, xr, cn, Tr, Sr, kr, Er, Ir, at;
6365
6365
  class pr {
6366
6366
  constructor(e) {
6367
6367
  C(this, m);
@@ -6587,16 +6587,16 @@ k = new WeakMap(), m = new WeakSet(), rt = async function(e) {
6587
6587
  };
6588
6588
  return n.supportsTransactionalDdl ? i(this, k).db.transaction().execute(a) : i(this, k).db.connection().execute(a);
6589
6589
  }, Or = async function(e) {
6590
- const n = await w(this, m, cn).call(this), r = await w(this, m, Sr).call(this, e);
6591
- w(this, m, xr).call(this, n, r), i(this, m, gr) || w(this, m, kr).call(this, n, r);
6592
- const a = w(this, m, Tr).call(this, n, r);
6590
+ const n = await w(this, m, cn).call(this), r = await w(this, m, Tr).call(this, e);
6591
+ w(this, m, Sr).call(this, n, r), i(this, m, gr) || w(this, m, kr).call(this, n, r);
6592
+ const a = w(this, m, xr).call(this, n, r);
6593
6593
  return s({
6594
6594
  migrations: n,
6595
6595
  executedMigrations: r,
6596
6596
  lastMigration: Pi(r),
6597
6597
  pendingMigrations: a
6598
6598
  });
6599
- }, Tr = function(e, n) {
6599
+ }, xr = function(e, n) {
6600
6600
  return e.filter((r) => !n.includes(r.name));
6601
6601
  }, cn = async function() {
6602
6602
  const e = await i(this, k).provider.getMigrations();
@@ -6604,9 +6604,9 @@ k = new WeakMap(), m = new WeakSet(), rt = async function(e) {
6604
6604
  ...e[n],
6605
6605
  name: n
6606
6606
  }));
6607
- }, Sr = async function(e) {
6607
+ }, Tr = async function(e) {
6608
6608
  return (await e.withPlugin(i(this, m, ee)).selectFrom(i(this, m, Z)).select("name").orderBy(["timestamp", "name"]).execute()).map((r) => r.name);
6609
- }, xr = function(e, n) {
6609
+ }, Sr = function(e, n) {
6610
6610
  for (const r of n)
6611
6611
  if (!e.some((a) => a.name === r))
6612
6612
  throw new Error(`corrupted migrations: previously executed migration ${r} is missing`);
@@ -6892,22 +6892,22 @@ async function Ou(t) {
6892
6892
  (e) => e.notNull()
6893
6893
  ).execute();
6894
6894
  }
6895
- async function Tu(t) {
6895
+ async function xu(t) {
6896
6896
  await t.schema.alterTable("passwords").dropColumn("password").execute();
6897
6897
  }
6898
- const Su = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6898
+ const Tu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6899
6899
  __proto__: null,
6900
- down: Tu,
6900
+ down: xu,
6901
6901
  up: Ou
6902
6902
  }, Symbol.toStringTag, { value: "Module" }));
6903
- async function xu(t) {
6903
+ async function Su(t) {
6904
6904
  }
6905
6905
  async function ku(t) {
6906
6906
  }
6907
6907
  const Eu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6908
6908
  __proto__: null,
6909
6909
  down: ku,
6910
- up: xu
6910
+ up: Su
6911
6911
  }, Symbol.toStringTag, { value: "Module" }));
6912
6912
  async function Iu(t) {
6913
6913
  }
@@ -6933,12 +6933,12 @@ async function zu(t) {
6933
6933
  async function Fu(t) {
6934
6934
  await t.schema.dropIndex("users_email_index").execute();
6935
6935
  }
6936
- const qu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6936
+ const ju = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6937
6937
  __proto__: null,
6938
6938
  down: Fu,
6939
6939
  up: zu
6940
6940
  }, Symbol.toStringTag, { value: "Module" }));
6941
- async function ju(t) {
6941
+ async function qu(t) {
6942
6942
  await t.schema.alterTable("users").addColumn("profileData", "varchar(2048)").execute();
6943
6943
  }
6944
6944
  async function Lu(t) {
@@ -6947,17 +6947,17 @@ async function Lu(t) {
6947
6947
  const Ju = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6948
6948
  __proto__: null,
6949
6949
  down: Lu,
6950
- up: ju
6950
+ up: qu
6951
6951
  }, Symbol.toStringTag, { value: "Module" }));
6952
6952
  async function Mu(t) {
6953
6953
  await t.schema.createIndex("users_linked_to_index").on("users").column("linked_to").execute();
6954
6954
  }
6955
- async function Wu(t) {
6955
+ async function Bu(t) {
6956
6956
  await t.schema.dropIndex("users_linked_to_index");
6957
6957
  }
6958
- const Bu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6958
+ const Wu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6959
6959
  __proto__: null,
6960
- down: Wu,
6960
+ down: Bu,
6961
6961
  up: Mu
6962
6962
  }, Symbol.toStringTag, { value: "Module" }));
6963
6963
  async function Ku(t) {
@@ -7090,15 +7090,15 @@ const bd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7090
7090
  async function Od(t) {
7091
7091
  await t.schema.createIndex("users_name_index").on("users").column("name").execute();
7092
7092
  }
7093
- async function Td(t) {
7093
+ async function xd(t) {
7094
7094
  await t.schema.dropIndex("users_name_index").execute();
7095
7095
  }
7096
- const Sd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7096
+ const Td = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7097
7097
  __proto__: null,
7098
- down: Td,
7098
+ down: xd,
7099
7099
  up: Od
7100
7100
  }, Symbol.toStringTag, { value: "Module" }));
7101
- async function xd(t) {
7101
+ async function Sd(t) {
7102
7102
  }
7103
7103
  async function kd(t) {
7104
7104
  await t.schema.alterTable("users").dropConstraint("unique_email_provider").execute();
@@ -7106,7 +7106,7 @@ async function kd(t) {
7106
7106
  const Ed = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7107
7107
  __proto__: null,
7108
7108
  down: kd,
7109
- up: xd
7109
+ up: Sd
7110
7110
  }, Symbol.toStringTag, { value: "Module" }));
7111
7111
  async function Id(t) {
7112
7112
  await t.schema.alterTable("otps").dropColumn("state").execute(), await t.schema.alterTable("otps").addColumn("state", "varchar(8192)").execute();
@@ -7140,27 +7140,27 @@ async function zd(t) {
7140
7140
  async function Fd(t) {
7141
7141
  await t.schema.dropTable("branding").execute();
7142
7142
  }
7143
- const qd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7143
+ const jd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7144
7144
  __proto__: null,
7145
7145
  down: Fd,
7146
7146
  up: zd
7147
7147
  }, Symbol.toStringTag, { value: "Module" }));
7148
- async function jd(t) {
7148
+ async function qd(t) {
7149
7149
  }
7150
7150
  async function Ld(t) {
7151
7151
  }
7152
7152
  const Jd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7153
7153
  __proto__: null,
7154
7154
  down: Ld,
7155
- up: jd
7155
+ up: qd
7156
7156
  }, Symbol.toStringTag, { value: "Module" }));
7157
7157
  async function Md(t) {
7158
7158
  }
7159
- async function Wd(t) {
7159
+ async function Bd(t) {
7160
7160
  }
7161
- const Bd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7161
+ const Wd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7162
7162
  __proto__: null,
7163
- down: Wd,
7163
+ down: Bd,
7164
7164
  up: Md
7165
7165
  }, Symbol.toStringTag, { value: "Module" }));
7166
7166
  async function Kd(t) {
@@ -7310,14 +7310,14 @@ const bc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7310
7310
  }, Symbol.toStringTag, { value: "Module" }));
7311
7311
  async function Oc(t) {
7312
7312
  }
7313
- async function Tc(t) {
7313
+ async function xc(t) {
7314
7314
  }
7315
- const Sc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7315
+ const Tc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7316
7316
  __proto__: null,
7317
- down: Tc,
7317
+ down: xc,
7318
7318
  up: Oc
7319
7319
  }, Symbol.toStringTag, { value: "Module" }));
7320
- async function xc(t) {
7320
+ async function Sc(t) {
7321
7321
  await t.schema.alterTable("logins").addColumn("auth0Client", "varchar(256)").execute();
7322
7322
  }
7323
7323
  async function kc(t) {
@@ -7326,7 +7326,7 @@ async function kc(t) {
7326
7326
  const Ec = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7327
7327
  __proto__: null,
7328
7328
  down: kc,
7329
- up: xc
7329
+ up: Sc
7330
7330
  }, Symbol.toStringTag, { value: "Module" }));
7331
7331
  async function Ic(t) {
7332
7332
  await t.schema.alterTable("logins").dropColumn("authParams_state").execute(), await t.schema.alterTable("logins").addColumn("authParams_state", "varchar(8192)").execute();
@@ -7352,12 +7352,12 @@ async function zc(t) {
7352
7352
  }
7353
7353
  async function Fc(t) {
7354
7354
  }
7355
- const qc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7355
+ const jc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7356
7356
  __proto__: null,
7357
7357
  down: Fc,
7358
7358
  up: zc
7359
7359
  }, Symbol.toStringTag, { value: "Module" }));
7360
- async function jc(t) {
7360
+ async function qc(t) {
7361
7361
  await t.schema.alterTable("logins").addColumn("authParams_nonce", "varchar(255)").execute();
7362
7362
  }
7363
7363
  async function Lc(t) {
@@ -7366,15 +7366,15 @@ async function Lc(t) {
7366
7366
  const Jc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7367
7367
  __proto__: null,
7368
7368
  down: Lc,
7369
- up: jc
7369
+ up: qc
7370
7370
  }, Symbol.toStringTag, { value: "Module" }));
7371
7371
  async function Mc(t) {
7372
7372
  }
7373
- async function Wc(t) {
7373
+ async function Bc(t) {
7374
7374
  }
7375
- const Bc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7375
+ const Wc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7376
7376
  __proto__: null,
7377
- down: Wc,
7377
+ down: Bc,
7378
7378
  up: Mc
7379
7379
  }, Symbol.toStringTag, { value: "Module" }));
7380
7380
  async function Kc(t) {
@@ -7545,14 +7545,14 @@ const bl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7545
7545
  }, Symbol.toStringTag, { value: "Module" }));
7546
7546
  async function Ol(t) {
7547
7547
  }
7548
- async function Tl(t) {
7548
+ async function xl(t) {
7549
7549
  }
7550
- const Sl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7550
+ const Tl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7551
7551
  __proto__: null,
7552
- down: Tl,
7552
+ down: xl,
7553
7553
  up: Ol
7554
7554
  }, Symbol.toStringTag, { value: "Module" }));
7555
- async function xl(t) {
7555
+ async function Sl(t) {
7556
7556
  await t.schema.alterTable("logins").addColumn("authParams_act_as", "varchar(255)").execute();
7557
7557
  }
7558
7558
  async function kl(t) {
@@ -7561,7 +7561,7 @@ async function kl(t) {
7561
7561
  const El = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7562
7562
  __proto__: null,
7563
7563
  down: kl,
7564
- up: xl
7564
+ up: Sl
7565
7565
  }, Symbol.toStringTag, { value: "Module" }));
7566
7566
  async function Il(t) {
7567
7567
  await t.schema.alterTable("codes").addColumn("code_verifier", "varchar(128)").execute();
@@ -7607,12 +7607,12 @@ async function Fl(t) {
7607
7607
  (e) => e.references("applications.id").onDelete("cascade").notNull()
7608
7608
  ).addColumn("email", "varchar(255)", (e) => e.notNull()).addColumn("nonce", "varchar(255)").addColumn("state", "varchar(1024)").addColumn("scope", "varchar(1024)").addColumn("response_type", "varchar(256)").addColumn("response_mode", "varchar(256)").addColumn("redirect_uri", "varchar(1024)").addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("expires_at", "varchar(255)", (e) => e.notNull()).addColumn("used_at", "varchar(255)").execute();
7609
7609
  }
7610
- const ql = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7610
+ const jl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7611
7611
  __proto__: null,
7612
7612
  down: Fl,
7613
7613
  up: zl
7614
7614
  }, Symbol.toStringTag, { value: "Module" }));
7615
- async function jl(t) {
7615
+ async function ql(t) {
7616
7616
  }
7617
7617
  async function Ll(t) {
7618
7618
  await t.schema.alterTable("logins").dropColumn("ip").dropColumn("useragent").execute();
@@ -7620,7 +7620,7 @@ async function Ll(t) {
7620
7620
  const Jl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7621
7621
  __proto__: null,
7622
7622
  down: Ll,
7623
- up: jl
7623
+ up: ql
7624
7624
  }, Symbol.toStringTag, { value: "Module" }));
7625
7625
  async function Ml(t) {
7626
7626
  await t.schema.createTable("refresh_tokens").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn(
@@ -7635,12 +7635,12 @@ async function Ml(t) {
7635
7635
  (e) => e.onDelete("cascade")
7636
7636
  ).addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("expires_at", "varchar(35)").addColumn("idle_expires_at", "varchar(35)").addColumn("last_exchanged_at", "varchar(35)").addColumn("device", "varchar(2048)", (e) => e.notNull()).addColumn("resource_servers", "varchar(2048)", (e) => e.notNull()).addColumn("rotating", "boolean", (e) => e.notNull()).execute();
7637
7637
  }
7638
- async function Wl(t) {
7638
+ async function Bl(t) {
7639
7639
  await t.schema.dropTable("refresh_tokens").execute();
7640
7640
  }
7641
- const Bl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7641
+ const Wl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7642
7642
  __proto__: null,
7643
- down: Wl,
7643
+ down: Bl,
7644
7644
  up: Ml
7645
7645
  }, Symbol.toStringTag, { value: "Module" }));
7646
7646
  async function Kl(t) {
@@ -7835,15 +7835,15 @@ const b_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7835
7835
  async function O_(t) {
7836
7836
  await t.schema.createTable("forms").addColumn("id", "varchar(255)", (e) => e.primaryKey()).addColumn("name", "varchar(255)", (e) => e.notNull()).addColumn("tenant_id", "varchar(255)", (e) => e.notNull()).addColumn("messages", "varchar(255)").addColumn("languages", "varchar(255)").addColumn("translations", "varchar(4096)").addColumn("nodes", "varchar(4096)").addColumn("start", "varchar(255)").addColumn("ending", "varchar(255)").addColumn("style", "varchar(1042)").addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("updated_at", "varchar(255)", (e) => e.notNull()).execute(), await t.schema.createIndex("forms_tenant_id_idx").on("forms").column("tenant_id").execute();
7837
7837
  }
7838
- async function T_(t) {
7838
+ async function x_(t) {
7839
7839
  await t.schema.dropTable("forms").execute();
7840
7840
  }
7841
- const S_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7841
+ const T_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7842
7842
  __proto__: null,
7843
- down: T_,
7843
+ down: x_,
7844
7844
  up: O_
7845
7845
  }, Symbol.toStringTag, { value: "Module" }));
7846
- async function x_(t) {
7846
+ async function S_(t) {
7847
7847
  await t.schema.alterTable("hooks").addColumn("form_id", "text").execute(), await t.schema.alterTable("hooks").addColumn("url_tmp", "varchar(512)").execute(), await t.updateTable("hooks").set((e) => ({ url_tmp: e.ref("url") })).execute(), await t.schema.alterTable("hooks").dropColumn("url").execute(), await t.schema.alterTable("hooks").renameColumn("url_tmp", "url").execute();
7848
7848
  }
7849
7849
  async function k_(t) {
@@ -7852,7 +7852,7 @@ async function k_(t) {
7852
7852
  const E_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7853
7853
  __proto__: null,
7854
7854
  down: k_,
7855
- up: x_
7855
+ up: S_
7856
7856
  }, Symbol.toStringTag, { value: "Module" }));
7857
7857
  async function I_(t) {
7858
7858
  await t.schema.alterTable("login_sessions").addColumn(
@@ -7890,12 +7890,12 @@ async function z_(t) {
7890
7890
  async function F_(t) {
7891
7891
  await t.schema.dropIndex("IDX_sessions_login_session_id").on("sessions").execute();
7892
7892
  }
7893
- const q_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7893
+ const j_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7894
7894
  __proto__: null,
7895
7895
  down: F_,
7896
7896
  up: z_
7897
7897
  }, Symbol.toStringTag, { value: "Module" }));
7898
- async function j_(t) {
7898
+ async function q_(t) {
7899
7899
  await t.schema.alterTable("codes").addColumn("code_challenge", "varchar(128)").execute(), await t.schema.alterTable("codes").addColumn("code_challenge_method", "varchar(5)").execute();
7900
7900
  }
7901
7901
  async function L_(t) {
@@ -7904,17 +7904,17 @@ async function L_(t) {
7904
7904
  const J_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7905
7905
  __proto__: null,
7906
7906
  down: L_,
7907
- up: j_
7907
+ up: q_
7908
7908
  }, Symbol.toStringTag, { value: "Module" }));
7909
7909
  async function M_(t) {
7910
7910
  await t.schema.alterTable("codes").addColumn("redirect_uri", "varchar(1024)").execute();
7911
7911
  }
7912
- async function W_(t) {
7912
+ async function B_(t) {
7913
7913
  await t.schema.alterTable("codes").dropColumn("redirect_uri").execute();
7914
7914
  }
7915
- const B_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7915
+ const W_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7916
7916
  __proto__: null,
7917
- down: W_,
7917
+ down: B_,
7918
7918
  up: M_
7919
7919
  }, Symbol.toStringTag, { value: "Module" }));
7920
7920
  async function K_(t) {
@@ -8357,9 +8357,9 @@ async function bm(t) {
8357
8357
  });
8358
8358
  }
8359
8359
  async function Om(t) {
8360
- await Pr(t) === "mysql" ? await Tm(t) : await Sm(t);
8360
+ await Pr(t) === "mysql" ? await xm(t) : await Tm(t);
8361
8361
  }
8362
- async function Tm(t) {
8362
+ async function xm(t) {
8363
8363
  await t.transaction().execute(async (e) => {
8364
8364
  await g`ALTER TABLE refresh_tokens DROP FOREIGN KEY refresh_tokens_client_fk`.execute(
8365
8365
  e
@@ -8376,7 +8376,7 @@ async function Tm(t) {
8376
8376
  );
8377
8377
  });
8378
8378
  }
8379
- async function Sm(t) {
8379
+ async function Tm(t) {
8380
8380
  await t.transaction().execute(async (e) => {
8381
8381
  await g`CREATE TABLE refresh_tokens_temp AS SELECT * FROM refresh_tokens`.execute(
8382
8382
  e
@@ -8406,7 +8406,7 @@ async function Sm(t) {
8406
8406
  FROM login_sessions_temp`.execute(e), await g`DROP TABLE login_sessions_temp`.execute(e);
8407
8407
  });
8408
8408
  }
8409
- const xm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8409
+ const Sm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8410
8410
  __proto__: null,
8411
8411
  down: Om,
8412
8412
  up: vm
@@ -8450,6 +8450,50 @@ const $m = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8450
8450
  __proto__: null,
8451
8451
  down: Pm,
8452
8452
  up: Am
8453
+ }, Symbol.toStringTag, { value: "Module" }));
8454
+ async function Dm(t) {
8455
+ await t.schema.createIndex("users_phone_tenant_provider_index").on("users").columns(["tenant_id", "phone_number", "provider"]).execute();
8456
+ }
8457
+ async function Rm(t) {
8458
+ await t.schema.dropIndex("users_phone_tenant_provider_index").execute();
8459
+ }
8460
+ const zm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8461
+ __proto__: null,
8462
+ down: Rm,
8463
+ up: Dm
8464
+ }, Symbol.toStringTag, { value: "Module" }));
8465
+ async function Fm(t) {
8466
+ await t.schema.createIndex("login_sessions_id_index").on("login_sessions").column("id").execute();
8467
+ }
8468
+ async function jm(t) {
8469
+ await t.schema.dropIndex("login_sessions_id_index").execute();
8470
+ }
8471
+ const qm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8472
+ __proto__: null,
8473
+ down: jm,
8474
+ up: Fm
8475
+ }, Symbol.toStringTag, { value: "Module" }));
8476
+ async function Lm(t) {
8477
+ await t.schema.createIndex("connections_tenant_id_index").on("connections").column("tenant_id").execute();
8478
+ }
8479
+ async function Jm(t) {
8480
+ await t.schema.dropIndex("connections_tenant_id_index").execute();
8481
+ }
8482
+ const Mm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8483
+ __proto__: null,
8484
+ down: Jm,
8485
+ up: Lm
8486
+ }, Symbol.toStringTag, { value: "Module" }));
8487
+ async function Bm(t) {
8488
+ await t.schema.dropIndex("idx_user_organizations_tenant_id").execute();
8489
+ }
8490
+ async function Wm(t) {
8491
+ await t.schema.createIndex("idx_user_organizations_tenant_id").on("user_organizations").column("tenant_id").execute();
8492
+ }
8493
+ const Km = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8494
+ __proto__: null,
8495
+ down: Wm,
8496
+ up: Bm
8453
8497
  }, Symbol.toStringTag, { value: "Module" })), $r = {
8454
8498
  m1_init: nu,
8455
8499
  m2_magicLink: ou,
@@ -8459,13 +8503,13 @@ const $m = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8459
8503
  m6_sessions: gu,
8460
8504
  m7_passwords: Nu,
8461
8505
  m8_logsTableNewFields: bu,
8462
- m9_passwordTableNewField: Su,
8506
+ m9_passwordTableNewField: Tu,
8463
8507
  n01_codesTable: Eu,
8464
8508
  n11_universalLoginSession: Pu,
8465
8509
  n12_userFields: Ru,
8466
- n13_userEmailIndex: qu,
8510
+ n13_userEmailIndex: ju,
8467
8511
  n14_profileDataField: Ju,
8468
- n15_userEmailIndex: Bu,
8512
+ n15_userEmailIndex: Wu,
8469
8513
  n16_userLocale: Qu,
8470
8514
  n17_signingKeys: Yu,
8471
8515
  n18_logsFields: Zu,
@@ -8477,13 +8521,13 @@ const $m = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8477
8521
  n24_logsIndexes: gd,
8478
8522
  n25_logDescMaxLength: Nd,
8479
8523
  n26_logsTableExtraFields: bd,
8480
- n27_usersTableNameIndex: Sd,
8524
+ n27_usersTableNameIndex: Td,
8481
8525
  n28_usersEmailConstrain: Ed,
8482
8526
  n29_increaseOtpStateLength: Pd,
8483
8527
  n30_increaseTicketStateLength: Rd,
8484
- n31_branding: qd,
8528
+ n31_branding: jd,
8485
8529
  n32_indexesAndNotNull: Jd,
8486
- n33_vendorIdInUniversalLoginSession: Bd,
8530
+ n33_vendorIdInUniversalLoginSession: Wd,
8487
8531
  n34_auth0ClientInUniversalLoginSession: Qd,
8488
8532
  n35_increaseUniversalSessionStateLength: Yd,
8489
8533
  n36_authenticationCodes: Zd,
@@ -8495,13 +8539,13 @@ const $m = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8495
8539
  n42_userIdIndexes: gc,
8496
8540
  n43_userIdIndexes: Nc,
8497
8541
  n44_codes: bc,
8498
- n45_hookProperties: Sc,
8542
+ n45_hookProperties: Tc,
8499
8543
  n46_loginAuth0Client: Ec,
8500
8544
  n47_loginAuth0Client: Pc,
8501
8545
  n48_saml: Rc,
8502
- n49_removeFields: qc,
8546
+ n49_removeFields: jc,
8503
8547
  n50_authParamsNonce: Jc,
8504
- n51_connectionid: Bc,
8548
+ n51_connectionid: Wc,
8505
8549
  n52_cert: Qc,
8506
8550
  n53_codes_primary_key: Yc,
8507
8551
  n54_cleanup_tables: Zc,
@@ -8513,13 +8557,13 @@ const $m = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8513
8557
  n60_users_metadata: gl,
8514
8558
  n61_userLocales: Nl,
8515
8559
  n62_prompt: bl,
8516
- n63_connection_cleanup: Sl,
8560
+ n63_connection_cleanup: Tl,
8517
8561
  n64_act_as: El,
8518
8562
  n65_code_verifier: Pl,
8519
8563
  n66_email_providers: Rl,
8520
- n67_drop_tickets: ql,
8564
+ n67_drop_tickets: jl,
8521
8565
  n68_login_useragents: Jl,
8522
- n70_refresh_tokens: Bl,
8566
+ n70_refresh_tokens: Wl,
8523
8567
  n71_session_new_fields: Ql,
8524
8568
  n72_session_primary_key: Yl,
8525
8569
  n73_drop_sessions: Zl,
@@ -8531,13 +8575,13 @@ const $m = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8531
8575
  n79_drop_sessions_2: g_,
8532
8576
  n80_recreate_custom_domains: N_,
8533
8577
  n81_phone: b_,
8534
- n82_forms: S_,
8578
+ n82_forms: T_,
8535
8579
  n83_addFormsIdToHooks: E_,
8536
8580
  n84_login_completed: P_,
8537
8581
  n85_add_login_session_id_to_sessions: R_,
8538
- n86_index_sessions_login_session_id: q_,
8582
+ n86_index_sessions_login_session_id: j_,
8539
8583
  n87_code_challenge: J_,
8540
- n88_add_redirect_uri_to_codes: B_,
8584
+ n88_add_redirect_uri_to_codes: W_,
8541
8585
  n89_add_nonce_and_state_to_codes: Q_,
8542
8586
  n90_themes: Y_,
8543
8587
  n91_resource_servers_rules_permissions: Z_,
@@ -8548,11 +8592,15 @@ const $m = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8548
8592
  n96_create_user_organizations_table: hm,
8549
8593
  n97_add_organization_to_user_permissions_and_roles: gm,
8550
8594
  n98_clients: Nm,
8551
- n99_update_client_foreign_keys: xm,
8595
+ n99_update_client_foreign_keys: Sm,
8552
8596
  o001_client_grants: Im,
8553
- o002_drop_applications: $m
8597
+ o002_drop_applications: $m,
8598
+ o003_phone_number_index: zm,
8599
+ o004_login_sessions_id_index: qm,
8600
+ o005_connections_tenant_index: Mm,
8601
+ o006_remove_redundant_user_organizations_tenant_index: Km
8554
8602
  };
8555
- async function qm(t, e = !1) {
8603
+ async function Ym(t, e = !1) {
8556
8604
  e && console.log("migrating...");
8557
8605
  const n = new Ar($r), r = new pr({
8558
8606
  db: t,
@@ -8565,7 +8613,7 @@ async function qm(t, e = !1) {
8565
8613
  }), a)
8566
8614
  throw console.error("failed to migrate"), console.error(a), a;
8567
8615
  }
8568
- async function jm(t) {
8616
+ async function Hm(t) {
8569
8617
  console.log("migrating...");
8570
8618
  const e = new Ar($r), n = new pr({
8571
8619
  db: t,
@@ -8576,7 +8624,7 @@ async function jm(t) {
8576
8624
  }), r)
8577
8625
  throw console.error("failed to migrate"), console.error(r), r;
8578
8626
  }
8579
- function Lm(t) {
8627
+ function Xm(t) {
8580
8628
  return {
8581
8629
  branding: co(t),
8582
8630
  cleanup: Lo(t),
@@ -8590,11 +8638,11 @@ function Lm(t) {
8590
8638
  forms: Uo(t),
8591
8639
  hooks: po(t),
8592
8640
  keys: Za(t),
8593
- loginSessions: So(t),
8641
+ loginSessions: To(t),
8594
8642
  logs: ua(t),
8595
8643
  passwords: ya(t),
8596
8644
  promptSettings: Eo(t),
8597
- refreshTokens: jo(t),
8645
+ refreshTokens: qo(t),
8598
8646
  resourceServers: Xo(t),
8599
8647
  rolePermissions: ui(t),
8600
8648
  userPermissions: mi(t),
@@ -8609,7 +8657,7 @@ function Lm(t) {
8609
8657
  };
8610
8658
  }
8611
8659
  export {
8612
- Lm as default,
8613
- jm as migrateDown,
8614
- qm as migrateToLatest
8660
+ Xm as default,
8661
+ Hm as migrateDown,
8662
+ Ym as migrateToLatest
8615
8663
  };