@authhero/kysely-adapter 10.113.0 → 10.115.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  var Oe = Object.defineProperty;
2
2
  var ke = (e, t, a) => t in e ? Oe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a;
3
3
  var K = (e, t, a) => ke(e, typeof t != "symbol" ? t + "" : t, a);
4
- import { nanoid as k, customAlphabet as $e } from "nanoid";
4
+ import { nanoid as b, customAlphabet as $e } from "nanoid";
5
5
  import { parseUserId as Ee, flowSchema as B, codeSchema as Ie, loginSessionSchema as ze, LoginSessionState as ie, promptSettingSchema as Pe, formSchema as q, resourceServerSchema as De } from "@authhero/adapter-interfaces";
6
6
  import "@hono/zod-openapi";
7
7
  import { sql as h, Migrator as ce } from "kysely";
@@ -50,7 +50,7 @@ function Ae(e, t) {
50
50
  if (t.useTransactions === !1) {
51
51
  if (await e.insertInto("users").values(c).execute(), s && c.user_id) {
52
52
  const d = {
53
- id: k(),
53
+ id: b(),
54
54
  user_id: c.user_id,
55
55
  password: s.hash,
56
56
  algorithm: s.algorithm,
@@ -65,7 +65,7 @@ function Ae(e, t) {
65
65
  await e.transaction().execute(async (d) => {
66
66
  if (await d.insertInto("users").values(c).execute(), s && c.user_id) {
67
67
  const u = {
68
- id: k(),
68
+ id: b(),
69
69
  user_id: c.user_id,
70
70
  password: s.hash,
71
71
  algorithm: s.algorithm,
@@ -167,7 +167,7 @@ function Fe(e) {
167
167
  return w(i);
168
168
  };
169
169
  }
170
- function b(e, t, a, n) {
170
+ function O(e, t, a, n) {
171
171
  const o = a.split(/ OR /i);
172
172
  if (o.length > 1)
173
173
  return t.where((d) => {
@@ -229,27 +229,27 @@ function b(e, t, a, n) {
229
229
  t = t.where(
230
230
  (g) => g.or(
231
231
  f.map(
232
- (v) => v === "user_id" ? g(p(v), "=", u) : g(p(v), "like", `%${u}%`)
232
+ (y) => y === "user_id" ? g(p(y), "=", u) : g(p(y), "like", `%${u}%`)
233
233
  )
234
234
  )
235
235
  );
236
236
  }
237
237
  }), t;
238
238
  }
239
- function O(e) {
239
+ function k(e) {
240
240
  return typeof e == "string" ? parseInt(e, 10) : typeof e == "bigint" ? Number(e) : e;
241
241
  }
242
242
  function Re(e) {
243
243
  return async (t, a = {}) => {
244
244
  const { page: n = 0, per_page: o = 50, include_totals: r = !1, sort: s, q: i } = a;
245
245
  let c = e.selectFrom("users").where("users.tenant_id", "=", t);
246
- if (i && (c = b(e, c, i, ["email", "name", "phone_number"])), s && s.sort_by) {
246
+ if (i && (c = O(e, c, i, ["email", "name", "phone_number"])), s && s.sort_by) {
247
247
  const { ref: f } = e.dynamic;
248
248
  c = c.orderBy(f(s.sort_by), s.sort_order);
249
249
  }
250
250
  const u = await c.offset(n * o).limit(o).selectAll().execute(), l = u.map((f) => f.user_id), m = l.length ? await e.selectFrom("users").selectAll().where("users.tenant_id", "=", t).where("users.linked_to", "in", l).orderBy("created_at", "asc").execute() : [], _ = u.map((f) => {
251
251
  const g = m.filter(
252
- (v) => v.linked_to === f.user_id
252
+ (y) => y.linked_to === f.user_id
253
253
  );
254
254
  return w({
255
255
  ...f,
@@ -261,7 +261,7 @@ function Re(e) {
261
261
  address: f.address ? JSON.parse(f.address) : void 0,
262
262
  identities: [
263
263
  U(f, !0),
264
- ...g.map((v) => U(v))
264
+ ...g.map((y) => U(y))
265
265
  ]
266
266
  });
267
267
  });
@@ -277,7 +277,7 @@ function Re(e) {
277
277
  users: _,
278
278
  start: n * o,
279
279
  limit: o,
280
- length: O(p)
280
+ length: k(p)
281
281
  };
282
282
  };
283
283
  }
@@ -352,7 +352,7 @@ function Ke(e, t) {
352
352
  function qe(e) {
353
353
  return async (t, a) => {
354
354
  const n = (/* @__PURE__ */ new Date()).toISOString(), o = B.parse({
355
- id: `af_${k()}`,
355
+ id: `af_${b()}`,
356
356
  ...a,
357
357
  actions: a.actions || [],
358
358
  created_at: n,
@@ -398,7 +398,7 @@ function Be(e) {
398
398
  return async (t, a = {}) => {
399
399
  const { page: n = 0, per_page: o = 50, include_totals: r = !1, q: s } = a;
400
400
  let i = e.selectFrom("flows").where("tenant_id", "=", t);
401
- s && (i = b(e, i, s, []));
401
+ s && (i = O(e, i, s, []));
402
402
  const u = (await i.offset(n * o).limit(o).selectAll().execute()).map((m) => {
403
403
  const _ = {
404
404
  ...m,
@@ -418,7 +418,7 @@ function Be(e) {
418
418
  flows: u,
419
419
  start: n * o,
420
420
  limit: o,
421
- length: O(l)
421
+ length: k(l)
422
422
  };
423
423
  };
424
424
  }
@@ -504,7 +504,7 @@ function Ge(e) {
504
504
  return async (t) => {
505
505
  var o, r;
506
506
  const a = {
507
- id: t.id || k(),
507
+ id: t.id || b(),
508
508
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
509
509
  updated_at: (/* @__PURE__ */ new Date()).toISOString(),
510
510
  ...t
@@ -539,13 +539,13 @@ function Xe(e) {
539
539
  const { ref: _ } = e.dynamic;
540
540
  a = a.orderBy(_(s.sort_by), s.sort_order);
541
541
  }
542
- i && (a = b(e, a, i, ["friendly_name"]));
542
+ i && (a = O(e, a, i, ["friendly_name"]));
543
543
  const u = (await a.offset(n * o).limit(o).selectAll().execute()).map(_e);
544
544
  if (!r)
545
545
  return {
546
546
  tenants: u
547
547
  };
548
- const { count: l } = await a.select((_) => _.fn.countAll().as("count")).executeTakeFirstOrThrow(), m = O(l);
548
+ const { count: l } = await a.select((_) => _.fn.countAll().as("count")).executeTakeFirstOrThrow(), m = k(l);
549
549
  return {
550
550
  tenants: u,
551
551
  start: n * o,
@@ -583,7 +583,7 @@ const at = 256;
583
583
  function nt(e) {
584
584
  return async (t, a) => {
585
585
  var i, c, d;
586
- const n = (i = a.user_agent) == null ? void 0 : i.slice(0, at), o = a.log_id || k(), { location_info: r, ...s } = a;
586
+ const n = (i = a.user_agent) == null ? void 0 : i.slice(0, at), o = a.log_id || b(), { location_info: r, ...s } = a;
587
587
  return await e.insertInto("logs").values({
588
588
  ...s,
589
589
  log_id: o,
@@ -642,7 +642,7 @@ function ot(e) {
642
642
  return async (t, a = {}) => {
643
643
  const { page: n = 0, per_page: o = 50, include_totals: r = !1, sort: s, q: i } = a;
644
644
  let c = e.selectFrom("logs").where("logs.tenant_id", "=", t);
645
- i && (c = b(e, c, i, ["user_id", "ip"]));
645
+ i && (c = O(e, c, i, ["user_id", "ip"]));
646
646
  let d = c;
647
647
  if (s && s.sort_by) {
648
648
  const { ref: _ } = e.dynamic;
@@ -662,7 +662,7 @@ function ot(e) {
662
662
  logs: l,
663
663
  start: n * o,
664
664
  limit: o,
665
- length: O(m)
665
+ length: k(m)
666
666
  };
667
667
  };
668
668
  }
@@ -694,7 +694,7 @@ function pe(e) {
694
694
  function M(e, t = (/* @__PURE__ */ new Date(0)).toISOString()) {
695
695
  return pe(e) ?? t;
696
696
  }
697
- function y(e) {
697
+ function v(e) {
698
698
  if (!e || e === "")
699
699
  return null;
700
700
  const t = new Date(e);
@@ -784,10 +784,10 @@ function ct(e) {
784
784
  updated_at_ts: n,
785
785
  authenticated_at_ts: n,
786
786
  last_interaction_at_ts: n,
787
- expires_at_ts: y(s),
788
- idle_expires_at_ts: y(i),
789
- used_at_ts: y(c),
790
- revoked_at_ts: y(d),
787
+ expires_at_ts: v(s),
788
+ idle_expires_at_ts: v(i),
789
+ used_at_ts: v(c),
790
+ revoked_at_ts: v(d),
791
791
  device: JSON.stringify(u),
792
792
  clients: JSON.stringify(l)
793
793
  }).execute(), r;
@@ -803,16 +803,16 @@ function dt(e) {
803
803
  device: n.device ? JSON.stringify(n.device) : void 0,
804
804
  clients: n.clients ? JSON.stringify(n.clients) : void 0
805
805
  };
806
- return n.expires_at !== void 0 && (o.expires_at_ts = y(n.expires_at)), n.idle_expires_at !== void 0 && (o.idle_expires_at_ts = y(n.idle_expires_at)), n.authenticated_at !== void 0 && (o.authenticated_at_ts = y(n.authenticated_at)), n.last_interaction_at !== void 0 && (o.last_interaction_at_ts = y(
806
+ return n.expires_at !== void 0 && (o.expires_at_ts = v(n.expires_at)), n.idle_expires_at !== void 0 && (o.idle_expires_at_ts = v(n.idle_expires_at)), n.authenticated_at !== void 0 && (o.authenticated_at_ts = v(n.authenticated_at)), n.last_interaction_at !== void 0 && (o.last_interaction_at_ts = v(
807
807
  n.last_interaction_at
808
- )), n.used_at !== void 0 && (o.used_at_ts = y(n.used_at)), n.revoked_at !== void 0 && (o.revoked_at_ts = y(n.revoked_at)), n.user_id !== void 0 && (o.user_id = n.user_id), n.login_session_id !== void 0 && (o.login_session_id = n.login_session_id), !!(await e.updateTable("sessions").set(o).where("tenant_id", "=", t).where("sessions.id", "=", a).execute()).length;
808
+ )), n.used_at !== void 0 && (o.used_at_ts = v(n.used_at)), n.revoked_at !== void 0 && (o.revoked_at_ts = v(n.revoked_at)), n.user_id !== void 0 && (o.user_id = n.user_id), n.login_session_id !== void 0 && (o.login_session_id = n.login_session_id), !!(await e.updateTable("sessions").set(o).where("tenant_id", "=", t).where("sessions.id", "=", a).execute()).length;
809
809
  };
810
810
  }
811
811
  function ut(e) {
812
812
  return async (t, a = {}) => {
813
813
  const { page: n = 0, per_page: o = 50, include_totals: r = !1, sort: s, q: i } = a;
814
814
  let c = e.selectFrom("sessions").where("sessions.tenant_id", "=", t);
815
- i && (c = b(e, c, i, ["user_id", "session_id"]));
815
+ i && (c = O(e, c, i, ["user_id", "session_id"]));
816
816
  let d = c;
817
817
  if (s && s.sort_by) {
818
818
  const { ref: p } = e.dynamic;
@@ -823,7 +823,7 @@ function ut(e) {
823
823
  const {
824
824
  tenant_id: f,
825
825
  device: g,
826
- clients: v,
826
+ clients: y,
827
827
  created_at_ts: S,
828
828
  updated_at_ts: C,
829
829
  expires_at_ts: $,
@@ -856,7 +856,7 @@ function ut(e) {
856
856
  ...Se,
857
857
  ...be,
858
858
  device: JSON.parse(g),
859
- clients: JSON.parse(v)
859
+ clients: JSON.parse(y)
860
860
  };
861
861
  });
862
862
  if (!r)
@@ -866,7 +866,7 @@ function ut(e) {
866
866
  limit: 0,
867
867
  length: 0
868
868
  };
869
- const { count: m } = await c.select((p) => p.fn.countAll().as("count")).executeTakeFirstOrThrow(), _ = O(m);
869
+ const { count: m } = await c.select((p) => p.fn.countAll().as("count")).executeTakeFirstOrThrow(), _ = k(m);
870
870
  return {
871
871
  sessions: l,
872
872
  start: n * o,
@@ -898,7 +898,7 @@ function mt(e) {
898
898
  }
899
899
  function ht(e) {
900
900
  return async (t, a) => {
901
- const n = a.id || k(), o = a.is_current ?? !0, r = {
901
+ const n = a.id || b(), o = a.is_current ?? !0, r = {
902
902
  id: n,
903
903
  ...a,
904
904
  is_current: o,
@@ -944,7 +944,7 @@ function wt(e) {
944
944
  return async (t, a = {}) => {
945
945
  const { page: n = 0, per_page: o = 50, include_totals: r = !1, q: s } = a;
946
946
  let i = e.selectFrom("codes").where("codes.tenant_id", "=", t);
947
- s && (i = b(e, i, s, ["code", "login_id"]));
947
+ s && (i = O(e, i, s, ["code", "login_id"]));
948
948
  const u = (await i.offset(n * o).limit(o).selectAll().execute()).map((m) => {
949
949
  const { tenant_id: _, ...p } = m;
950
950
  return Ie.parse(w(p));
@@ -961,11 +961,11 @@ function wt(e) {
961
961
  codes: u,
962
962
  start: n * o,
963
963
  limit: o,
964
- length: O(l)
964
+ length: k(l)
965
965
  };
966
966
  };
967
967
  }
968
- function vt(e) {
968
+ function yt(e) {
969
969
  return async (t, a) => {
970
970
  const n = {
971
971
  ...a,
@@ -977,7 +977,7 @@ function vt(e) {
977
977
  }).execute(), n;
978
978
  };
979
979
  }
980
- function yt(e) {
980
+ function vt(e) {
981
981
  return async (t, a) => (await e.deleteFrom("codes").where("codes.tenant_id", "=", t).where("codes.code_id", "=", a).executeTakeFirst()).numDeletedRows > 0;
982
982
  }
983
983
  function Ct(e) {
@@ -996,9 +996,9 @@ function Tt(e) {
996
996
  }
997
997
  function Nt(e) {
998
998
  return {
999
- create: vt(e),
999
+ create: yt(e),
1000
1000
  list: wt(e),
1001
- remove: yt(e),
1001
+ remove: vt(e),
1002
1002
  used: xt(e),
1003
1003
  consume: Tt(e),
1004
1004
  get: Ct(e)
@@ -1066,7 +1066,7 @@ function Dt(e) {
1066
1066
  return async (t, a = {}) => {
1067
1067
  const { page: n = 0, per_page: o = 50, include_totals: r = !1, q: s } = a;
1068
1068
  let i = e.selectFrom("connections").where("connections.tenant_id", "=", t);
1069
- s && (i = b(e, i, s, ["user_id", "ip"]));
1069
+ s && (i = O(e, i, s, ["user_id", "ip"]));
1070
1070
  const d = await i.offset(n * o).limit(o).selectAll().execute(), u = Pt(d);
1071
1071
  if (!r)
1072
1072
  return {
@@ -1080,7 +1080,7 @@ function Dt(e) {
1080
1080
  connections: u,
1081
1081
  start: n * o,
1082
1082
  limit: o,
1083
- length: O(l)
1083
+ length: k(l)
1084
1084
  };
1085
1085
  };
1086
1086
  }
@@ -1445,7 +1445,7 @@ function Vt(e) {
1445
1445
  }
1446
1446
  function Xt(e) {
1447
1447
  return async (t, a) => {
1448
- const n = (/* @__PURE__ */ new Date()).toISOString(), o = k(), { scope: r, authorization_details_types: s, ...i } = a, c = {
1448
+ const n = (/* @__PURE__ */ new Date()).toISOString(), o = b(), { scope: r, authorization_details_types: s, ...i } = a, c = {
1449
1449
  id: o,
1450
1450
  tenant_id: t,
1451
1451
  ...i,
@@ -1498,16 +1498,16 @@ function ea(e) {
1498
1498
  const { page: n = 0, per_page: o = 50, include_totals: r = !1, q: s, sort: i } = a;
1499
1499
  let c = e.selectFrom("client_grants").where("client_grants.tenant_id", "=", t);
1500
1500
  if (s) {
1501
- const _ = s.trim(), p = _.split(/\s+/), f = p.length === 1 ? p[0] : void 0, g = f ? f.match(/^(-)?([a-zA-Z_][a-zA-Z0-9_]*):"?([^"]*)"?$/) : null, v = g ? g[3] : "", S = /^(>=|>|<=|<)/.test(v || "");
1502
- if (g && !S && v) {
1501
+ const _ = s.trim(), p = _.split(/\s+/), f = p.length === 1 ? p[0] : void 0, g = f ? f.match(/^(-)?([a-zA-Z_][a-zA-Z0-9_]*):"?([^"]*)"?$/) : null, y = g ? g[3] : "", S = /^(>=|>|<=|<)/.test(y || "");
1502
+ if (g && !S && y) {
1503
1503
  const C = !!g[1], $ = g[2], { ref: I } = e.dynamic, E = I(`client_grants.${$}`);
1504
1504
  if ($ === "allow_any_organization") {
1505
- const z = v === "true" ? 1 : 0;
1505
+ const z = y === "true" ? 1 : 0;
1506
1506
  C ? c = c.where(E, "!=", z) : c = c.where(E, "=", z);
1507
1507
  } else
1508
- C ? c = c.where(E, "!=", v) : c = c.where(E, "=", v);
1508
+ C ? c = c.where(E, "!=", y) : c = c.where(E, "=", y);
1509
1509
  } else
1510
- c = b(e, c, _, []);
1510
+ c = O(e, c, _, []);
1511
1511
  }
1512
1512
  let d = c;
1513
1513
  if (i) {
@@ -1545,7 +1545,7 @@ function ea(e) {
1545
1545
  client_grants: l,
1546
1546
  start: n * o,
1547
1547
  limit: o,
1548
- length: O(m)
1548
+ length: k(m)
1549
1549
  };
1550
1550
  };
1551
1551
  }
@@ -1587,7 +1587,7 @@ function oa(e) {
1587
1587
  _("revoked_at", "is", null)
1588
1588
  ])
1589
1589
  );
1590
- s && (i = b(e, i, s, [
1590
+ s && (i = O(e, i, s, [
1591
1591
  "kid",
1592
1592
  "connection",
1593
1593
  "fingerprint",
@@ -1605,7 +1605,7 @@ function oa(e) {
1605
1605
  limit: 0,
1606
1606
  length: 0
1607
1607
  };
1608
- const l = await c.executeTakeFirst(), m = O((l == null ? void 0 : l.count) ?? 0);
1608
+ const l = await c.executeTakeFirst(), m = k((l == null ? void 0 : l.count) ?? 0);
1609
1609
  return {
1610
1610
  signingKeys: u,
1611
1611
  start: d,
@@ -1632,7 +1632,7 @@ function ia(e) {
1632
1632
  function ca(e) {
1633
1633
  return async (t, a) => {
1634
1634
  const n = {
1635
- custom_domain_id: a.custom_domain_id || k(),
1635
+ custom_domain_id: a.custom_domain_id || b(),
1636
1636
  status: "pending",
1637
1637
  primary: !1,
1638
1638
  ...a
@@ -1748,7 +1748,7 @@ function pa(e) {
1748
1748
  }
1749
1749
  function fa(e) {
1750
1750
  return async (t, a) => {
1751
- var s, i, c, d, u, l, m, _, p, f, g, v, S, C, $, I, E, z;
1751
+ var s, i, c, d, u, l, m, _, p, f, g, y, S, C, $, I, E, z;
1752
1752
  const { colors: n, font: o, ...r } = a;
1753
1753
  try {
1754
1754
  await e.insertInto("branding").values({
@@ -1766,7 +1766,7 @@ function fa(e) {
1766
1766
  ...r,
1767
1767
  colors_primary: n == null ? void 0 : n.primary,
1768
1768
  colors_page_background_type: (g = (f = a.colors) == null ? void 0 : f.page_background) == null ? void 0 : g.type,
1769
- colors_page_background_start: (S = (v = a.colors) == null ? void 0 : v.page_background) == null ? void 0 : S.start,
1769
+ colors_page_background_start: (S = (y = a.colors) == null ? void 0 : y.page_background) == null ? void 0 : S.start,
1770
1770
  colors_page_background_end: ($ = (C = a.colors) == null ? void 0 : C.page_background) == null ? void 0 : $.end,
1771
1771
  colors_page_background_angle_dev: (E = (I = a.colors) == null ? void 0 : I.page_background) == null ? void 0 : E.angle_deg,
1772
1772
  font_url: (z = a.font) == null ? void 0 : z.url
@@ -1788,7 +1788,7 @@ function wa(e) {
1788
1788
  } : null;
1789
1789
  };
1790
1790
  }
1791
- function va(e) {
1791
+ function ya(e) {
1792
1792
  return async (t, a) => {
1793
1793
  const n = Date.now();
1794
1794
  try {
@@ -1806,7 +1806,7 @@ function va(e) {
1806
1806
  }
1807
1807
  };
1808
1808
  }
1809
- function ya(e) {
1809
+ function va(e) {
1810
1810
  return async (t) => {
1811
1811
  await e.deleteFrom("universal_login_templates").where("tenant_id", "=", t).execute();
1812
1812
  };
@@ -1814,24 +1814,24 @@ function ya(e) {
1814
1814
  function Ca(e) {
1815
1815
  return {
1816
1816
  get: wa(e),
1817
- set: va(e),
1818
- delete: ya(e)
1817
+ set: ya(e),
1818
+ delete: va(e)
1819
1819
  };
1820
1820
  }
1821
1821
  function xa(e) {
1822
1822
  return async (t, a = {}) => {
1823
1823
  const { page: n = 0, per_page: o = 50, include_totals: r = !1, q: s } = a;
1824
1824
  let i = e.selectFrom("hooks").where("hooks.tenant_id", "=", t);
1825
- s && (i = b(e, i, s, ["url", "form_id", "template_id"]));
1825
+ s && (i = O(e, i, s, ["url", "form_id", "template_id"]));
1826
1826
  const u = (await i.offset(n * o).limit(o).selectAll().execute()).map((m) => {
1827
1827
  const {
1828
1828
  tenant_id: _,
1829
1829
  enabled: p,
1830
1830
  synchronous: f,
1831
1831
  created_at_ts: g,
1832
- updated_at_ts: v,
1832
+ updated_at_ts: y,
1833
1833
  ...S
1834
- } = m, C = D({ created_at_ts: g, updated_at_ts: v }, [
1834
+ } = m, C = D({ created_at_ts: g, updated_at_ts: y }, [
1835
1835
  "created_at_ts",
1836
1836
  "updated_at_ts"
1837
1837
  ]);
@@ -1854,7 +1854,7 @@ function xa(e) {
1854
1854
  hooks: u,
1855
1855
  start: n * o,
1856
1856
  limit: o,
1857
- length: O(l)
1857
+ length: k(l)
1858
1858
  };
1859
1859
  };
1860
1860
  }
@@ -1927,7 +1927,7 @@ function Oa(e) {
1927
1927
  function ka(e) {
1928
1928
  return async (t, a, n) => {
1929
1929
  const o = {
1930
- themeId: n || k(),
1930
+ themeId: n || b(),
1931
1931
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
1932
1932
  updated_at: (/* @__PURE__ */ new Date()).toISOString(),
1933
1933
  ...a
@@ -2042,8 +2042,8 @@ function Fa(e) {
2042
2042
  tenant_id: t,
2043
2043
  created_at_ts: r,
2044
2044
  updated_at_ts: r,
2045
- expires_at_ts: r + 1e3 * 60 * 60 * 24
2046
- // 24 hours from now
2045
+ expires_at_ts: a.expires_at ? new Date(a.expires_at).getTime() : r + 1e3 * 60 * 60 * 24
2046
+ // default: 24 hours from now
2047
2047
  }).execute(), o;
2048
2048
  };
2049
2049
  }
@@ -2055,7 +2055,7 @@ function Ra(e) {
2055
2055
  updated_at_ts: Date.now(),
2056
2056
  // Only update expires_at_ts if a new expires_at was provided
2057
2057
  // Use !== undefined to preserve null values (which mean "doesn't expire")
2058
- ...s !== void 0 ? { expires_at_ts: y(s) } : {}
2058
+ ...s !== void 0 ? { expires_at_ts: v(s) } : {}
2059
2059
  }).where("login_sessions.id", "=", a).where("login_sessions.tenant_id", "=", t).execute()).length === 1;
2060
2060
  };
2061
2061
  }
@@ -2219,9 +2219,9 @@ function Ga(e) {
2219
2219
  device: JSON.stringify(c),
2220
2220
  resource_servers: JSON.stringify(d),
2221
2221
  created_at_ts: m,
2222
- expires_at_ts: y(r),
2223
- idle_expires_at_ts: s ? y(s) : null,
2224
- last_exchanged_at_ts: i ? y(i) : null
2222
+ expires_at_ts: v(r),
2223
+ idle_expires_at_ts: s ? v(s) : null,
2224
+ last_exchanged_at_ts: i ? v(i) : null
2225
2225
  }).execute(), { ...a, ...o };
2226
2226
  };
2227
2227
  }
@@ -2246,9 +2246,9 @@ function Xa(e) {
2246
2246
  rotating: u !== void 0 ? u ? 1 : 0 : void 0,
2247
2247
  // Convert date fields to bigint format
2248
2248
  // Use !== undefined to preserve null values (which mean "doesn't expire")
2249
- expires_at_ts: r !== void 0 ? y(r) : void 0,
2250
- idle_expires_at_ts: s !== void 0 ? y(s) : void 0,
2251
- last_exchanged_at_ts: i !== void 0 ? y(i) : void 0
2249
+ expires_at_ts: r !== void 0 ? v(r) : void 0,
2250
+ idle_expires_at_ts: s !== void 0 ? v(s) : void 0,
2251
+ last_exchanged_at_ts: i !== void 0 ? v(i) : void 0
2252
2252
  };
2253
2253
  return !!(await e.updateTable("refresh_tokens").set(m).where("tenant_id", "=", t).where("refresh_tokens.id", "=", a).execute()).length;
2254
2254
  };
@@ -2257,7 +2257,7 @@ function Za(e) {
2257
2257
  return async (t, a = {}) => {
2258
2258
  const { page: n = 0, per_page: o = 50, include_totals: r = !1, sort: s, q: i } = a;
2259
2259
  let c = e.selectFrom("refresh_tokens").where("refresh_tokens.tenant_id", "=", t);
2260
- i && (c = b(e, c, i, ["token", "login_id"]));
2260
+ i && (c = O(e, c, i, ["token", "login_id"]));
2261
2261
  let d = c;
2262
2262
  if (s && s.sort_by) {
2263
2263
  const { ref: p } = e.dynamic;
@@ -2268,14 +2268,14 @@ function Za(e) {
2268
2268
  const {
2269
2269
  tenant_id: f,
2270
2270
  created_at_ts: g,
2271
- expires_at_ts: v,
2271
+ expires_at_ts: y,
2272
2272
  idle_expires_at_ts: S,
2273
2273
  last_exchanged_at_ts: C,
2274
2274
  ...$
2275
2275
  } = p, I = D(
2276
2276
  {
2277
2277
  created_at_ts: g,
2278
- expires_at_ts: v,
2278
+ expires_at_ts: y,
2279
2279
  idle_expires_at_ts: S,
2280
2280
  last_exchanged_at_ts: C
2281
2281
  },
@@ -2297,7 +2297,7 @@ function Za(e) {
2297
2297
  limit: 0,
2298
2298
  length: 0
2299
2299
  };
2300
- const { count: m } = await c.select((p) => p.fn.countAll().as("count")).executeTakeFirstOrThrow(), _ = O(m);
2300
+ const { count: m } = await c.select((p) => p.fn.countAll().as("count")).executeTakeFirstOrThrow(), _ = k(m);
2301
2301
  return {
2302
2302
  refresh_tokens: l,
2303
2303
  start: n * o,
@@ -2379,7 +2379,7 @@ function an(e) {
2379
2379
  function nn(e) {
2380
2380
  return async (t, a) => {
2381
2381
  const n = q.parse({
2382
- id: k(),
2382
+ id: b(),
2383
2383
  ...a,
2384
2384
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
2385
2385
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
@@ -2398,7 +2398,7 @@ function on(e) {
2398
2398
  return async (t, a = {}) => {
2399
2399
  const { page: n = 0, per_page: o = 50, include_totals: r = !1, q: s } = a;
2400
2400
  let i = e.selectFrom("forms").where("tenant_id", "=", t);
2401
- s && (i = b(e, i, s, []));
2401
+ s && (i = O(e, i, s, []));
2402
2402
  const u = (await i.offset(n * o).limit(o).selectAll().execute()).map((m) => {
2403
2403
  const _ = { ...m };
2404
2404
  if (typeof _.nodes == "string")
@@ -2430,7 +2430,7 @@ function on(e) {
2430
2430
  forms: u,
2431
2431
  start: n * o,
2432
2432
  limit: o,
2433
- length: O(l)
2433
+ length: k(l)
2434
2434
  };
2435
2435
  };
2436
2436
  }
@@ -2547,12 +2547,12 @@ function _n(e) {
2547
2547
  const { page: n = 0, per_page: o = 50, include_totals: r = !1, q: s } = a;
2548
2548
  let i = e.selectFrom("resource_servers").where("resource_servers.tenant_id", "=", t);
2549
2549
  if (s) {
2550
- const m = s.trim(), _ = m.split(/\s+/), p = _.length === 1 ? _[0] : void 0, f = p ? p.match(/^(-)?(name|identifier):(.*)$/) : null, g = f ? f[3] : "", v = /^(>=|>|<=|<)/.test(g || "");
2551
- if (f && !v) {
2550
+ const m = s.trim(), _ = m.split(/\s+/), p = _.length === 1 ? _[0] : void 0, f = p ? p.match(/^(-)?(name|identifier):(.*)$/) : null, g = f ? f[3] : "", y = /^(>=|>|<=|<)/.test(g || "");
2551
+ if (f && !y) {
2552
2552
  const S = !!f[1], C = f[2] === "name" ? "resource_servers.name" : "resource_servers.identifier";
2553
2553
  i = S ? i.where(C, "not like", `%${g}%`) : i.where(C, "like", `%${g}%`);
2554
2554
  } else
2555
- i = b(e, i, m, [
2555
+ i = O(e, i, m, [
2556
2556
  "resource_servers.name",
2557
2557
  "resource_servers.identifier"
2558
2558
  ]);
@@ -2562,7 +2562,7 @@ function _n(e) {
2562
2562
  verification_key: p,
2563
2563
  scopes: f,
2564
2564
  options: g,
2565
- skip_consent_for_verifiable_first_party_clients: v,
2565
+ skip_consent_for_verifiable_first_party_clients: y,
2566
2566
  allow_offline_access: S,
2567
2567
  is_system: C,
2568
2568
  metadata: $,
@@ -2571,7 +2571,7 @@ function _n(e) {
2571
2571
  ...I,
2572
2572
  scopes: f ? JSON.parse(f) : [],
2573
2573
  options: g ? JSON.parse(g) : {},
2574
- skip_consent_for_verifiable_first_party_clients: !!v,
2574
+ skip_consent_for_verifiable_first_party_clients: !!y,
2575
2575
  allow_offline_access: !!S,
2576
2576
  is_system: C ? !0 : void 0,
2577
2577
  metadata: $ ? JSON.parse($) : void 0,
@@ -2592,7 +2592,7 @@ function _n(e) {
2592
2592
  resource_servers: u,
2593
2593
  start: n * o,
2594
2594
  limit: o,
2595
- length: O(l)
2595
+ length: k(l)
2596
2596
  };
2597
2597
  };
2598
2598
  }
@@ -2637,7 +2637,7 @@ function pn(e) {
2637
2637
  }
2638
2638
  function fn(e) {
2639
2639
  return async (t, a) => {
2640
- const n = (/* @__PURE__ */ new Date()).toISOString(), o = a.id || k(), { is_system: r, id: s, metadata: i, ...c } = a, d = {
2640
+ const n = (/* @__PURE__ */ new Date()).toISOString(), o = a.id || b(), { is_system: r, id: s, metadata: i, ...c } = a, d = {
2641
2641
  id: o,
2642
2642
  ...c,
2643
2643
  tenant_id: t,
@@ -2672,7 +2672,7 @@ function wn(e) {
2672
2672
  return async (t, a) => {
2673
2673
  let n = e.selectFrom("roles").where("roles.tenant_id", "=", t);
2674
2674
  const { page: o = 0, per_page: r = 50, include_totals: s = !1 } = a;
2675
- a.q && (n = b(e, n, a.q, ["name"]));
2675
+ a.q && (n = O(e, n, a.q, ["name"]));
2676
2676
  const d = (await n.offset(o * r).limit(r).selectAll().execute()).map((l) => {
2677
2677
  const m = l, { is_system: _, tenant_id: p, metadata: f, ...g } = m;
2678
2678
  return {
@@ -2693,11 +2693,11 @@ function wn(e) {
2693
2693
  roles: d,
2694
2694
  start: o * r,
2695
2695
  limit: r,
2696
- length: O(u)
2696
+ length: k(u)
2697
2697
  };
2698
2698
  };
2699
2699
  }
2700
- function vn(e) {
2700
+ function yn(e) {
2701
2701
  return async (t, a, n) => {
2702
2702
  const { is_system: o, metadata: r, ...s } = n, i = {
2703
2703
  ...s,
@@ -2708,7 +2708,7 @@ function vn(e) {
2708
2708
  return Number(c.numUpdatedRows) > 0;
2709
2709
  };
2710
2710
  }
2711
- function yn(e) {
2711
+ function vn(e) {
2712
2712
  return async (t, a) => {
2713
2713
  const n = await e.deleteFrom("roles").where("tenant_id", "=", t).where("id", "=", a).executeTakeFirst();
2714
2714
  return Number(n.numDeletedRows) > 0;
@@ -2719,8 +2719,8 @@ function Cn(e) {
2719
2719
  create: fn(e),
2720
2720
  get: gn(e),
2721
2721
  list: wn(e),
2722
- update: vn(e),
2723
- remove: yn(e)
2722
+ update: yn(e),
2723
+ remove: vn(e)
2724
2724
  };
2725
2725
  }
2726
2726
  function xn(e) {
@@ -3077,7 +3077,7 @@ function Ln(e) {
3077
3077
  function Kn(e) {
3078
3078
  return async (t, a) => {
3079
3079
  const n = {
3080
- id: k(),
3080
+ id: b(),
3081
3081
  tenant_id: t,
3082
3082
  user_id: a.user_id,
3083
3083
  organization_id: a.organization_id,
@@ -3522,6 +3522,95 @@ function co(e) {
3522
3522
  remove: io(e)
3523
3523
  };
3524
3524
  }
3525
+ function lo(e) {
3526
+ return async (t, a) => {
3527
+ const n = b();
3528
+ await e.insertInto("outbox_events").values({
3529
+ id: n,
3530
+ tenant_id: t,
3531
+ event_type: a.event_type,
3532
+ log_type: a.log_type,
3533
+ aggregate_type: a.target.type,
3534
+ aggregate_id: a.target.id,
3535
+ payload: JSON.stringify({ ...a, id: n }),
3536
+ created_at: (/* @__PURE__ */ new Date()).toISOString(),
3537
+ processed_at: null,
3538
+ retry_count: 0,
3539
+ next_retry_at: null,
3540
+ error: null
3541
+ }).execute();
3542
+ };
3543
+ }
3544
+ function uo(e) {
3545
+ return async (t) => {
3546
+ const a = (/* @__PURE__ */ new Date()).toISOString();
3547
+ return (await e.selectFrom("outbox_events").selectAll().where("processed_at", "is", null).where(
3548
+ (o) => o.or([
3549
+ o("next_retry_at", "is", null),
3550
+ o("next_retry_at", "<=", a)
3551
+ ])
3552
+ ).where(
3553
+ (o) => o.or([
3554
+ o("claimed_by", "is", null),
3555
+ o("claim_expires_at", "<=", a)
3556
+ ])
3557
+ ).orderBy("created_at", "asc").orderBy("id", "asc").limit(t).execute()).map((o) => ({
3558
+ ...JSON.parse(o.payload),
3559
+ created_at: o.created_at,
3560
+ processed_at: o.processed_at,
3561
+ retry_count: o.retry_count,
3562
+ next_retry_at: o.next_retry_at,
3563
+ error: o.error
3564
+ }));
3565
+ };
3566
+ }
3567
+ function _o(e) {
3568
+ return async (t, a, n) => {
3569
+ if (t.length === 0) return [];
3570
+ const o = (/* @__PURE__ */ new Date()).toISOString(), r = new Date(Date.now() + n).toISOString();
3571
+ return await e.updateTable("outbox_events").set({
3572
+ claimed_by: a,
3573
+ claim_expires_at: r
3574
+ }).where("id", "in", t).where("processed_at", "is", null).where(
3575
+ (i) => i.or([
3576
+ i("claimed_by", "is", null),
3577
+ i("claim_expires_at", "<=", o)
3578
+ ])
3579
+ ).execute(), (await e.selectFrom("outbox_events").select("id").where("id", "in", t).where("claimed_by", "=", a).where("claim_expires_at", "=", r).execute()).map((i) => i.id);
3580
+ };
3581
+ }
3582
+ function mo(e) {
3583
+ return async (t) => {
3584
+ if (t.length === 0) return;
3585
+ const a = (/* @__PURE__ */ new Date()).toISOString();
3586
+ await e.updateTable("outbox_events").set({ processed_at: a }).where("id", "in", t).execute();
3587
+ };
3588
+ }
3589
+ function ho(e) {
3590
+ return async (t, a, n) => {
3591
+ await e.updateTable("outbox_events").set({
3592
+ error: a,
3593
+ next_retry_at: n,
3594
+ retry_count: h`retry_count + 1`
3595
+ }).where("id", "=", t).execute();
3596
+ };
3597
+ }
3598
+ function po(e) {
3599
+ return async (t) => {
3600
+ const a = await e.deleteFrom("outbox_events").where("processed_at", "is not", null).where("processed_at", "<", t).executeTakeFirst();
3601
+ return Number(a.numDeletedRows);
3602
+ };
3603
+ }
3604
+ function fo(e) {
3605
+ return {
3606
+ create: lo(e),
3607
+ getUnprocessed: uo(e),
3608
+ claimEvents: _o(e),
3609
+ markProcessed: mo(e),
3610
+ markRetry: ho(e),
3611
+ cleanup: po(e)
3612
+ };
3613
+ }
3525
3614
  class we {
3526
3615
  constructor(t) {
3527
3616
  K(this, "migrations");
@@ -3531,7 +3620,7 @@ class we {
3531
3620
  return this.migrations;
3532
3621
  }
3533
3622
  }
3534
- async function lo(e) {
3623
+ async function go(e) {
3535
3624
  await e.schema.createTable("tenants").addColumn("id", "varchar(255)", (t) => t.primaryKey()).addColumn("name", "varchar(255)").addColumn("audience", "varchar(255)").addColumn("sender_email", "varchar(255)").addColumn("sender_name", "varchar(255)").addColumn("language", "varchar(255)").addColumn("logo", "varchar(255)").addColumn("primary_color", "varchar(255)").addColumn("secondary_color", "varchar(255)").addColumn("created_at", "varchar(255)", (t) => t.notNull()).addColumn("updated_at", "varchar(255)", (t) => t.notNull()).execute(), await e.schema.createTable("users").addColumn("user_id", "varchar(255)", (t) => t.notNull()).addColumn(
3536
3625
  "tenant_id",
3537
3626
  "varchar(255)",
@@ -3603,35 +3692,35 @@ async function lo(e) {
3603
3692
  (t) => t.references("tenants.id").onDelete("cascade").notNull()
3604
3693
  ).addColumn("domain", "varchar(255)", (t) => t.notNull()).addColumn("email_service", "varchar(255)").addColumn("email_api_key", "varchar(255)").addColumn("dkim_private_key", "varchar(2048)").addColumn("dkim_public_key", "varchar(2048)").addColumn("created_at", "varchar(255)", (t) => t.notNull()).addColumn("updated_at", "varchar(255)", (t) => t.notNull()).execute();
3605
3694
  }
3606
- async function uo(e) {
3695
+ async function wo(e) {
3607
3696
  await e.schema.dropTable("domains").execute(), await e.schema.dropTable("members").execute(), await e.schema.dropTable("users").execute(), await e.schema.dropTable("connections").execute(), await e.schema.dropTable("applications").execute(), await e.schema.dropTable("migrations").execute(), await e.schema.dropTable("tenants").execute();
3608
3697
  }
3609
- const _o = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3698
+ const yo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3610
3699
  __proto__: null,
3611
- down: uo,
3612
- up: lo
3700
+ down: wo,
3701
+ up: go
3613
3702
  }, Symbol.toStringTag, { value: "Module" }));
3614
- async function mo(e) {
3703
+ async function vo(e) {
3615
3704
  await e.schema.alterTable("tenants").addColumn("support_url", "varchar(255)").execute();
3616
3705
  }
3617
- async function ho(e) {
3706
+ async function Co(e) {
3618
3707
  await e.schema.alterTable("tenants").dropColumn("support_url").execute();
3619
3708
  }
3620
- const po = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3709
+ const xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3621
3710
  __proto__: null,
3622
- down: ho,
3623
- up: mo
3711
+ down: Co,
3712
+ up: vo
3624
3713
  }, Symbol.toStringTag, { value: "Module" }));
3625
- async function fo(e) {
3714
+ async function To(e) {
3626
3715
  }
3627
- async function go(e) {
3716
+ async function No(e) {
3628
3717
  }
3629
- const wo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3718
+ const So = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3630
3719
  __proto__: null,
3631
- down: go,
3632
- up: fo
3720
+ down: No,
3721
+ up: To
3633
3722
  }, Symbol.toStringTag, { value: "Module" }));
3634
- async function vo(e) {
3723
+ async function bo(e) {
3635
3724
  await e.schema.createTable("logs").addColumn("id", "varchar(255)", (t) => t.notNull().primaryKey()).addColumn("category", "varchar(255)", (t) => t.notNull()).addColumn("tenant_id", "varchar(64)").addColumn("user_id", "varchar(64)").addForeignKeyConstraint(
3636
3725
  "tenant_id_constraint",
3637
3726
  ["tenant_id"],
@@ -3640,24 +3729,24 @@ async function vo(e) {
3640
3729
  (t) => t.onDelete("cascade")
3641
3730
  ).addColumn("ip", "varchar(255)").addColumn("type", "varchar(8)", (t) => t.notNull()).addColumn("date", "varchar(25)", (t) => t.notNull()).addColumn("client_id", "varchar(255)").addColumn("client_name", "varchar(255)").addColumn("user_agent", "varchar(255)").addColumn("description", "varchar(255)").addColumn("details", "varchar(2048)").execute();
3642
3731
  }
3643
- async function yo(e) {
3732
+ async function Oo(e) {
3644
3733
  await e.schema.dropTable("logs").execute();
3645
3734
  }
3646
- const Co = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3735
+ const ko = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3647
3736
  __proto__: null,
3648
- down: yo,
3649
- up: vo
3737
+ down: Oo,
3738
+ up: bo
3650
3739
  }, Symbol.toStringTag, { value: "Module" }));
3651
- async function xo(e) {
3740
+ async function $o(e) {
3652
3741
  }
3653
- async function To(e) {
3742
+ async function Eo(e) {
3654
3743
  }
3655
- const No = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3744
+ const Io = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3656
3745
  __proto__: null,
3657
- down: To,
3658
- up: xo
3746
+ down: Eo,
3747
+ up: $o
3659
3748
  }, Symbol.toStringTag, { value: "Module" }));
3660
- async function So(e) {
3749
+ async function zo(e) {
3661
3750
  await e.schema.createTable("sessions").addColumn("id", "varchar(21)", (t) => t.primaryKey()).addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addForeignKeyConstraint(
3662
3751
  "user_id_constraint",
3663
3752
  ["user_id", "tenant_id"],
@@ -3682,15 +3771,15 @@ async function So(e) {
3682
3771
  (t) => t.references("applications.id").onDelete("cascade").notNull()
3683
3772
  ).addColumn("code", "varchar(255)", (t) => t.notNull()).addColumn("email", "varchar(255)", (t) => t.notNull()).addColumn("user_id", "varchar(255)").addColumn("send", "varchar(255)").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)", (t) => t.notNull()).addColumn("expires_at", "varchar(255)", (t) => t.notNull()).addColumn("used_at", "varchar(255)").execute(), await e.schema.createIndex("otps_email_index").on("otps").column("email").execute(), await e.schema.createIndex("otps_expires_at_index").on("otps").column("expires_at").execute();
3684
3773
  }
3685
- async function bo(e) {
3774
+ async function Po(e) {
3686
3775
  await e.schema.dropTable("sessions").execute(), await e.schema.dropTable("tickets").execute(), await e.schema.dropTable("otps").execute();
3687
3776
  }
3688
- const Oo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3777
+ const Do = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3689
3778
  __proto__: null,
3690
- down: bo,
3691
- up: So
3779
+ down: Po,
3780
+ up: zo
3692
3781
  }, Symbol.toStringTag, { value: "Module" }));
3693
- async function ko(e) {
3782
+ async function Ao(e) {
3694
3783
  await e.schema.createTable("passwords").addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addPrimaryKeyConstraint("passwords_pkey", ["user_id", "tenant_id"]).addForeignKeyConstraint(
3695
3784
  "user_id_constraint",
3696
3785
  ["user_id", "tenant_id"],
@@ -3705,24 +3794,24 @@ async function ko(e) {
3705
3794
  (t) => t.onDelete("cascade")
3706
3795
  ).addColumn("type", "varchar(255)", (t) => t.notNull()).addColumn("created_at", "varchar(255)", (t) => t.notNull()).addColumn("expires_at", "varchar(255)", (t) => t.notNull()).addColumn("used_at", "varchar(255)").execute(), await e.schema.createIndex("codes_expires_at_index").on("codes").column("expires_at").execute();
3707
3796
  }
3708
- async function $o(e) {
3797
+ async function jo(e) {
3709
3798
  await e.schema.dropTable("passwords").execute(), await e.schema.dropTable("codes").execute();
3710
3799
  }
3711
- const Eo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3800
+ const Fo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3712
3801
  __proto__: null,
3713
- down: $o,
3714
- up: ko
3802
+ down: jo,
3803
+ up: Ao
3715
3804
  }, Symbol.toStringTag, { value: "Module" }));
3716
- async function Io(e) {
3805
+ async function Ro(e) {
3717
3806
  }
3718
- async function zo(e) {
3807
+ async function Mo(e) {
3719
3808
  }
3720
- const Po = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3809
+ const Jo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3721
3810
  __proto__: null,
3722
- down: zo,
3723
- up: Io
3811
+ down: Mo,
3812
+ up: Ro
3724
3813
  }, Symbol.toStringTag, { value: "Module" }));
3725
- async function Do(e) {
3814
+ async function Lo(e) {
3726
3815
  await e.schema.alterTable("passwords").addColumn(
3727
3816
  "password",
3728
3817
  "varchar(255)",
@@ -3730,86 +3819,86 @@ async function Do(e) {
3730
3819
  (t) => t.notNull()
3731
3820
  ).execute();
3732
3821
  }
3733
- async function Ao(e) {
3822
+ async function Ko(e) {
3734
3823
  await e.schema.alterTable("passwords").dropColumn("password").execute();
3735
3824
  }
3736
- const jo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3825
+ const qo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3737
3826
  __proto__: null,
3738
- down: Ao,
3739
- up: Do
3827
+ down: Ko,
3828
+ up: Lo
3740
3829
  }, Symbol.toStringTag, { value: "Module" }));
3741
- async function Fo(e) {
3830
+ async function Uo(e) {
3742
3831
  }
3743
- async function Ro(e) {
3832
+ async function Bo(e) {
3744
3833
  }
3745
- const Mo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3834
+ const Qo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3746
3835
  __proto__: null,
3747
- down: Ro,
3748
- up: Fo
3836
+ down: Bo,
3837
+ up: Uo
3749
3838
  }, Symbol.toStringTag, { value: "Module" }));
3750
- async function Jo(e) {
3839
+ async function Ho(e) {
3751
3840
  }
3752
- async function Lo(e) {
3841
+ async function Yo(e) {
3753
3842
  }
3754
- const Ko = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3843
+ const Wo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3755
3844
  __proto__: null,
3756
- down: Lo,
3757
- up: Jo
3845
+ down: Yo,
3846
+ up: Ho
3758
3847
  }, Symbol.toStringTag, { value: "Module" }));
3759
- async function qo(e) {
3848
+ async function Go(e) {
3760
3849
  }
3761
- async function Uo(e) {
3850
+ async function Vo(e) {
3762
3851
  }
3763
- const Bo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3852
+ const Xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3764
3853
  __proto__: null,
3765
- down: Uo,
3766
- up: qo
3854
+ down: Vo,
3855
+ up: Go
3767
3856
  }, Symbol.toStringTag, { value: "Module" }));
3768
- async function Qo(e) {
3857
+ async function Zo(e) {
3769
3858
  await e.schema.createIndex("users_email_index").on("users").column("email").execute();
3770
3859
  }
3771
- async function Ho(e) {
3860
+ async function er(e) {
3772
3861
  await e.schema.dropIndex("users_email_index").execute();
3773
3862
  }
3774
- const Yo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3863
+ const tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3775
3864
  __proto__: null,
3776
- down: Ho,
3777
- up: Qo
3865
+ down: er,
3866
+ up: Zo
3778
3867
  }, Symbol.toStringTag, { value: "Module" }));
3779
- async function Wo(e) {
3868
+ async function ar(e) {
3780
3869
  await e.schema.alterTable("users").addColumn("profileData", "varchar(2048)").execute();
3781
3870
  }
3782
- async function Go(e) {
3871
+ async function nr(e) {
3783
3872
  await e.schema.alterTable("users").dropColumn("profileData").execute();
3784
3873
  }
3785
- const Vo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3874
+ const or = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3786
3875
  __proto__: null,
3787
- down: Go,
3788
- up: Wo
3876
+ down: nr,
3877
+ up: ar
3789
3878
  }, Symbol.toStringTag, { value: "Module" }));
3790
- async function Xo(e) {
3879
+ async function rr(e) {
3791
3880
  await e.schema.createIndex("users_linked_to_index").on("users").column("linked_to").execute();
3792
3881
  }
3793
- async function Zo(e) {
3882
+ async function sr(e) {
3794
3883
  await e.schema.dropIndex("users_linked_to_index");
3795
3884
  }
3796
- const er = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3885
+ const ir = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3797
3886
  __proto__: null,
3798
- down: Zo,
3799
- up: Xo
3887
+ down: sr,
3888
+ up: rr
3800
3889
  }, Symbol.toStringTag, { value: "Module" }));
3801
- async function tr(e) {
3890
+ async function cr(e) {
3802
3891
  await e.schema.alterTable("users").addColumn("locale", "varchar(255)").execute();
3803
3892
  }
3804
- async function ar(e) {
3893
+ async function lr(e) {
3805
3894
  await e.schema.alterTable("users").dropColumn("locale").execute();
3806
3895
  }
3807
- const nr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3896
+ const dr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3808
3897
  __proto__: null,
3809
- down: ar,
3810
- up: tr
3898
+ down: lr,
3899
+ up: cr
3811
3900
  }, Symbol.toStringTag, { value: "Module" }));
3812
- async function or(e) {
3901
+ async function ur(e) {
3813
3902
  await e.schema.createTable("keys").addColumn("kid", "varchar(255)", (t) => t.primaryKey()).addColumn(
3814
3903
  "tenant_id",
3815
3904
  "varchar(255)",
@@ -3824,202 +3913,202 @@ async function or(e) {
3824
3913
  (t) => t.references("connections.id").onDelete("cascade")
3825
3914
  ).execute();
3826
3915
  }
3827
- async function rr(e) {
3916
+ async function _r(e) {
3828
3917
  await e.schema.dropTable("keys").execute();
3829
3918
  }
3830
- const sr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3919
+ const mr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3831
3920
  __proto__: null,
3832
- down: rr,
3833
- up: or
3921
+ down: _r,
3922
+ up: ur
3834
3923
  }, Symbol.toStringTag, { value: "Module" }));
3835
- async function ir(e) {
3924
+ async function hr(e) {
3836
3925
  }
3837
- async function cr(e) {
3926
+ async function pr(e) {
3838
3927
  }
3839
- const lr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3928
+ const fr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3840
3929
  __proto__: null,
3841
- down: cr,
3842
- up: ir
3930
+ down: pr,
3931
+ up: hr
3843
3932
  }, Symbol.toStringTag, { value: "Module" }));
3844
- async function dr(e) {
3933
+ async function gr(e) {
3845
3934
  }
3846
- async function ur(e) {
3935
+ async function wr(e) {
3847
3936
  }
3848
- const _r = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3937
+ const yr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3849
3938
  __proto__: null,
3850
- down: ur,
3851
- up: dr
3939
+ down: wr,
3940
+ up: gr
3852
3941
  }, Symbol.toStringTag, { value: "Module" }));
3853
- async function mr(e) {
3942
+ async function vr(e) {
3854
3943
  await e.schema.alterTable("otps").addColumn("audience", "varchar(255)").execute();
3855
3944
  }
3856
- async function hr(e) {
3945
+ async function Cr(e) {
3857
3946
  await e.schema.alterTable("otps").dropColumn("audience").execute();
3858
3947
  }
3859
- const pr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3948
+ const xr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3860
3949
  __proto__: null,
3861
- down: hr,
3862
- up: mr
3950
+ down: Cr,
3951
+ up: vr
3863
3952
  }, Symbol.toStringTag, { value: "Module" }));
3864
- async function fr(e) {
3953
+ async function Tr(e) {
3865
3954
  }
3866
- async function gr(e) {
3955
+ async function Nr(e) {
3867
3956
  }
3868
- const wr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3957
+ const Sr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3869
3958
  __proto__: null,
3870
- down: gr,
3871
- up: fr
3959
+ down: Nr,
3960
+ up: Tr
3872
3961
  }, Symbol.toStringTag, { value: "Module" }));
3873
- async function vr(e) {
3962
+ async function br(e) {
3874
3963
  await e.schema.alterTable("logs").dropColumn("category").execute();
3875
3964
  }
3876
- async function yr(e) {
3965
+ async function Or(e) {
3877
3966
  await e.schema.alterTable("logs").addColumn("category", "varchar(255)", (t) => t.notNull()).execute();
3878
3967
  }
3879
- const Cr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3968
+ const kr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3880
3969
  __proto__: null,
3881
- down: yr,
3882
- up: vr
3970
+ down: Or,
3971
+ up: br
3883
3972
  }, Symbol.toStringTag, { value: "Module" }));
3884
- async function xr(e) {
3973
+ async function $r(e) {
3885
3974
  await e.schema.alterTable("users").dropColumn("tags").execute();
3886
3975
  }
3887
- async function Tr(e) {
3976
+ async function Er(e) {
3888
3977
  await e.schema.alterTable("users").addColumn("tags", "varchar(255)").execute();
3889
3978
  }
3890
- const Nr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3979
+ const Ir = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3891
3980
  __proto__: null,
3892
- down: Tr,
3893
- up: xr
3981
+ down: Er,
3982
+ up: $r
3894
3983
  }, Symbol.toStringTag, { value: "Module" }));
3895
- async function Sr(e) {
3984
+ async function zr(e) {
3896
3985
  await e.schema.createIndex("logs_user_id").on("logs").column("user_id").execute(), await e.schema.createIndex("logs_tenant_id").on("logs").column("tenant_id").execute(), await e.schema.createIndex("logs_date").on("logs").column("date").execute();
3897
3986
  }
3898
- async function br(e) {
3987
+ async function Pr(e) {
3899
3988
  await e.schema.dropIndex("logs_user_id"), await e.schema.dropIndex("logs_tenant_id"), await e.schema.dropIndex("logs_date");
3900
3989
  }
3901
- const Or = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3990
+ const Dr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3902
3991
  __proto__: null,
3903
- down: br,
3904
- up: Sr
3992
+ down: Pr,
3993
+ up: zr
3905
3994
  }, Symbol.toStringTag, { value: "Module" }));
3906
- async function kr(e) {
3995
+ async function Ar(e) {
3907
3996
  await e.schema.alterTable("logs").dropColumn("details").execute(), await e.schema.alterTable("logs").addColumn("details", "varchar(8192)").execute();
3908
3997
  }
3909
- async function $r(e) {
3998
+ async function jr(e) {
3910
3999
  await e.schema.alterTable("logs").dropColumn("details").execute(), await e.schema.alterTable("logs").addColumn("details", "varchar(2048)").execute();
3911
4000
  }
3912
- const Er = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4001
+ const Fr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3913
4002
  __proto__: null,
3914
- down: $r,
3915
- up: kr
4003
+ down: jr,
4004
+ up: Ar
3916
4005
  }, Symbol.toStringTag, { value: "Module" }));
3917
- async function Ir(e) {
4006
+ async function Rr(e) {
3918
4007
  await e.schema.alterTable("logs").addColumn("user_name", "varchar(255)").execute(), await e.schema.alterTable("logs").addColumn("auth0_client", "varchar(255)").execute(), await e.schema.alterTable("logs").addColumn("isMobile", "boolean").execute(), await e.schema.alterTable("logs").addColumn("connection", "varchar(255)").execute(), await e.schema.alterTable("logs").addColumn("connection_id", "varchar(255)").execute(), await e.schema.alterTable("logs").addColumn("audience", "varchar(255)").execute(), await e.schema.alterTable("logs").addColumn("scope", "varchar(255)").execute(), await e.schema.alterTable("logs").addColumn("strategy", "varchar(255)").execute(), await e.schema.alterTable("logs").addColumn("strategy_type", "varchar(255)").execute(), await e.schema.alterTable("logs").addColumn("hostname", "varchar(255)").execute(), await e.schema.alterTable("logs").addColumn("session_connection", "varchar(255)").execute();
3919
4008
  }
3920
- async function zr(e) {
4009
+ async function Mr(e) {
3921
4010
  await e.schema.alterTable("logs").dropColumn("user_name").execute(), await e.schema.alterTable("logs").dropColumn("auth0_client").execute(), await e.schema.alterTable("logs").dropColumn("isMobile").execute(), await e.schema.alterTable("logs").dropColumn("connection").execute(), await e.schema.alterTable("logs").dropColumn("connection_id").execute(), await e.schema.alterTable("logs").dropColumn("audience").execute(), await e.schema.alterTable("logs").dropColumn("scope").execute(), await e.schema.alterTable("logs").dropColumn("strategy").execute(), await e.schema.alterTable("logs").dropColumn("strategy_type").execute(), await e.schema.alterTable("logs").dropColumn("hostname").execute(), await e.schema.alterTable("logs").dropColumn("session_connection").execute();
3922
4011
  }
3923
- const Pr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4012
+ const Jr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3924
4013
  __proto__: null,
3925
- down: zr,
3926
- up: Ir
4014
+ down: Mr,
4015
+ up: Rr
3927
4016
  }, Symbol.toStringTag, { value: "Module" }));
3928
- async function Dr(e) {
4017
+ async function Lr(e) {
3929
4018
  await e.schema.createIndex("users_name_index").on("users").column("name").execute();
3930
4019
  }
3931
- async function Ar(e) {
4020
+ async function Kr(e) {
3932
4021
  await e.schema.dropIndex("users_name_index").execute();
3933
4022
  }
3934
- const jr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4023
+ const qr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3935
4024
  __proto__: null,
3936
- down: Ar,
3937
- up: Dr
4025
+ down: Kr,
4026
+ up: Lr
3938
4027
  }, Symbol.toStringTag, { value: "Module" }));
3939
- async function Fr(e) {
4028
+ async function Ur(e) {
3940
4029
  }
3941
- async function Rr(e) {
4030
+ async function Br(e) {
3942
4031
  await e.schema.alterTable("users").dropConstraint("unique_email_provider").execute();
3943
4032
  }
3944
- const Mr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4033
+ const Qr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3945
4034
  __proto__: null,
3946
- down: Rr,
3947
- up: Fr
4035
+ down: Br,
4036
+ up: Ur
3948
4037
  }, Symbol.toStringTag, { value: "Module" }));
3949
- async function Jr(e) {
4038
+ async function Hr(e) {
3950
4039
  await e.schema.alterTable("otps").dropColumn("state").execute(), await e.schema.alterTable("otps").addColumn("state", "varchar(8192)").execute();
3951
4040
  }
3952
- async function Lr(e) {
4041
+ async function Yr(e) {
3953
4042
  await e.schema.alterTable("otps").dropColumn("state").execute(), await e.schema.alterTable("otps").addColumn("state", "varchar(1024)").execute();
3954
4043
  }
3955
- const Kr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4044
+ const Wr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3956
4045
  __proto__: null,
3957
- down: Lr,
3958
- up: Jr
4046
+ down: Yr,
4047
+ up: Hr
3959
4048
  }, Symbol.toStringTag, { value: "Module" }));
3960
- async function qr(e) {
4049
+ async function Gr(e) {
3961
4050
  await e.schema.alterTable("tickets").dropColumn("state").execute(), await e.schema.alterTable("tickets").addColumn("state", "varchar(8192)").execute();
3962
4051
  }
3963
- async function Ur(e) {
4052
+ async function Vr(e) {
3964
4053
  await e.schema.alterTable("tickets").dropColumn("state").execute(), await e.schema.alterTable("tickets").addColumn("state", "varchar(1024)").execute();
3965
4054
  }
3966
- const Br = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4055
+ const Xr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3967
4056
  __proto__: null,
3968
- down: Ur,
3969
- up: qr
4057
+ down: Vr,
4058
+ up: Gr
3970
4059
  }, Symbol.toStringTag, { value: "Module" }));
3971
- async function Qr(e) {
4060
+ async function Zr(e) {
3972
4061
  await e.schema.createTable("branding").addColumn(
3973
4062
  "tenant_id",
3974
4063
  "varchar(255)",
3975
4064
  (t) => t.references("tenants.id").onDelete("cascade").notNull().primaryKey()
3976
4065
  ).addColumn("logo_url", "varchar(512)").addColumn("favicon_url", "varchar(512)").addColumn("font_url", "varchar(512)").addColumn("colors_primary", "varchar(8)").addColumn("colors_page_background_type", "varchar(32)").addColumn("colors_page_background_start", "varchar(8)").addColumn("colors_page_background_end", "varchar(8)").addColumn("colors_page_background_angle_dev", "integer").execute();
3977
4066
  }
3978
- async function Hr(e) {
4067
+ async function es(e) {
3979
4068
  await e.schema.dropTable("branding").execute();
3980
4069
  }
3981
- const Yr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4070
+ const ts = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3982
4071
  __proto__: null,
3983
- down: Hr,
3984
- up: Qr
4072
+ down: es,
4073
+ up: Zr
3985
4074
  }, Symbol.toStringTag, { value: "Module" }));
3986
- async function Wr(e) {
4075
+ async function as(e) {
3987
4076
  }
3988
- async function Gr(e) {
4077
+ async function ns(e) {
3989
4078
  }
3990
- const Vr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4079
+ const os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3991
4080
  __proto__: null,
3992
- down: Gr,
3993
- up: Wr
4081
+ down: ns,
4082
+ up: as
3994
4083
  }, Symbol.toStringTag, { value: "Module" }));
3995
- async function Xr(e) {
4084
+ async function rs(e) {
3996
4085
  }
3997
- async function Zr(e) {
4086
+ async function ss(e) {
3998
4087
  }
3999
- const es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4088
+ const is = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4000
4089
  __proto__: null,
4001
- down: Zr,
4002
- up: Xr
4090
+ down: ss,
4091
+ up: rs
4003
4092
  }, Symbol.toStringTag, { value: "Module" }));
4004
- async function ts(e) {
4093
+ async function cs(e) {
4005
4094
  }
4006
- async function as(e) {
4095
+ async function ls(e) {
4007
4096
  }
4008
- const ns = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4097
+ const ds = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4009
4098
  __proto__: null,
4010
- down: as,
4011
- up: ts
4099
+ down: ls,
4100
+ up: cs
4012
4101
  }, Symbol.toStringTag, { value: "Module" }));
4013
- async function os(e) {
4102
+ async function us(e) {
4014
4103
  }
4015
- async function rs(e) {
4104
+ async function _s(e) {
4016
4105
  }
4017
- const ss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4106
+ const ms = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4018
4107
  __proto__: null,
4019
- down: rs,
4020
- up: os
4108
+ down: _s,
4109
+ up: us
4021
4110
  }, Symbol.toStringTag, { value: "Module" }));
4022
- async function is(e) {
4111
+ async function hs(e) {
4023
4112
  await e.schema.createTable("authentication_codes").addColumn(
4024
4113
  "tenant_id",
4025
4114
  "varchar(255)",
@@ -4030,55 +4119,55 @@ async function is(e) {
4030
4119
  (t) => t.references("applications.id").onDelete("cascade").notNull()
4031
4120
  ).addColumn("user_id", "varchar(255)", (t) => t.notNull()).addColumn("nonce", "varchar(255)").addColumn("state", "varchar(8192)").addColumn("scope", "varchar(1024)").addColumn("response_type", "varchar(256)").addColumn("response_mode", "varchar(256)").addColumn("redirect_uri", "varchar(1024)").addColumn("created_at", "varchar(255)", (t) => t.notNull()).addColumn("expires_at", "varchar(255)", (t) => t.notNull()).addColumn("used_at", "varchar(255)").execute();
4032
4121
  }
4033
- async function cs(e) {
4122
+ async function ps(e) {
4034
4123
  await e.schema.dropTable("authentication_codes").execute();
4035
4124
  }
4036
- const ls = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4125
+ const fs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4037
4126
  __proto__: null,
4038
- down: cs,
4039
- up: is
4127
+ down: ps,
4128
+ up: hs
4040
4129
  }, Symbol.toStringTag, { value: "Module" }));
4041
- async function ds(e) {
4130
+ async function gs(e) {
4042
4131
  }
4043
- async function us(e) {
4132
+ async function ws(e) {
4044
4133
  }
4045
- const _s = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4134
+ const ys = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4046
4135
  __proto__: null,
4047
- down: us,
4048
- up: ds
4136
+ down: ws,
4137
+ up: gs
4049
4138
  }, Symbol.toStringTag, { value: "Module" }));
4050
- async function ms(e) {
4139
+ async function vs(e) {
4051
4140
  await e.schema.alterTable("otps").addColumn("ip", "varchar(64)").execute();
4052
4141
  }
4053
- async function hs(e) {
4142
+ async function Cs(e) {
4054
4143
  await e.schema.alterTable("otps").dropColumn("ip").execute();
4055
4144
  }
4056
- const ps = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4145
+ const xs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4057
4146
  __proto__: null,
4058
- down: hs,
4059
- up: ms
4147
+ down: Cs,
4148
+ up: vs
4060
4149
  }, Symbol.toStringTag, { value: "Module" }));
4061
- async function fs(e) {
4150
+ async function Ts(e) {
4062
4151
  await e.schema.alterTable("logs").dropColumn("user_agent").execute(), await e.schema.alterTable("logs").addColumn("user_agent", "varchar(1024)").execute();
4063
4152
  }
4064
- async function gs(e) {
4153
+ async function Ns(e) {
4065
4154
  await e.schema.alterTable("logs").dropColumn("user_agent").execute(), await e.schema.alterTable("logs").addColumn("user_agent", "varchar(255)").execute();
4066
4155
  }
4067
- const ws = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4156
+ const Ss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4068
4157
  __proto__: null,
4069
- down: gs,
4070
- up: fs
4158
+ down: Ns,
4159
+ up: Ts
4071
4160
  }, Symbol.toStringTag, { value: "Module" }));
4072
- async function vs(e) {
4161
+ async function bs(e) {
4073
4162
  }
4074
- async function ys(e) {
4163
+ async function Os(e) {
4075
4164
  }
4076
- const Cs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4165
+ const ks = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4077
4166
  __proto__: null,
4078
- down: ys,
4079
- up: vs
4167
+ down: Os,
4168
+ up: bs
4080
4169
  }, Symbol.toStringTag, { value: "Module" }));
4081
- async function xs(e) {
4170
+ async function $s(e) {
4082
4171
  await e.schema.createTable("hooks").addColumn("hook_id", "varchar(255)", (t) => t.notNull().primaryKey()).addColumn(
4083
4172
  "tenant_id",
4084
4173
  "varchar(255)",
@@ -4089,33 +4178,33 @@ async function xs(e) {
4089
4178
  (t) => t.defaultTo(!1).notNull()
4090
4179
  ).addColumn("priority", "integer").execute();
4091
4180
  }
4092
- async function Ts(e) {
4181
+ async function Es(e) {
4093
4182
  await e.schema.dropTable("hooks").execute();
4094
4183
  }
4095
- const Ns = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4184
+ const Is = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4096
4185
  __proto__: null,
4097
- down: Ts,
4098
- up: xs
4186
+ down: Es,
4187
+ up: $s
4099
4188
  }, Symbol.toStringTag, { value: "Module" }));
4100
- async function Ss(e) {
4189
+ async function zs(e) {
4101
4190
  }
4102
- async function bs(e) {
4191
+ async function Ps(e) {
4103
4192
  }
4104
- const Os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4193
+ const Ds = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4105
4194
  __proto__: null,
4106
- down: bs,
4107
- up: Ss
4195
+ down: Ps,
4196
+ up: zs
4108
4197
  }, Symbol.toStringTag, { value: "Module" }));
4109
- async function ks(e) {
4198
+ async function As(e) {
4110
4199
  }
4111
- async function $s(e) {
4200
+ async function js(e) {
4112
4201
  }
4113
- const Es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4202
+ const Fs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4114
4203
  __proto__: null,
4115
- down: $s,
4116
- up: ks
4204
+ down: js,
4205
+ up: As
4117
4206
  }, Symbol.toStringTag, { value: "Module" }));
4118
- async function Is(e) {
4207
+ async function Rs(e) {
4119
4208
  await e.schema.createTable("logins").addColumn("login_id", "varchar(255)", (t) => t.primaryKey()).addColumn(
4120
4209
  "tenant_id",
4121
4210
  "varchar(255)",
@@ -4132,7 +4221,7 @@ async function Is(e) {
4132
4221
  (t) => t.onDelete("cascade")
4133
4222
  ).addColumn("code_type", "varchar(255)", (t) => t.notNull()).addColumn("created_at", "varchar(255)", (t) => t.notNull()).addColumn("expires_at", "varchar(255)", (t) => t.notNull()).addColumn("used_at", "varchar(255)").execute();
4134
4223
  }
4135
- async function zs(e) {
4224
+ async function Ms(e) {
4136
4225
  await e.schema.dropTable("logins").execute(), await e.schema.alterTable("passwords").dropColumn("algorithm").execute(), await e.schema.dropTable("codes").execute(), await e.schema.createTable("codes").addColumn("id", "varchar(255)", (t) => t.primaryKey()).addColumn("code", "varchar(255)", (t) => t.notNull()).addColumn("user_id", "varchar(255)").addColumn("tenant_id", "varchar(255)").addForeignKeyConstraint(
4137
4226
  "codes_user_id_tenant_id_constraint",
4138
4227
  ["user_id", "tenant_id"],
@@ -4141,90 +4230,90 @@ async function zs(e) {
4141
4230
  (t) => t.onDelete("cascade")
4142
4231
  ).addColumn("type", "varchar(255)", (t) => t.notNull()).addColumn("created_at", "varchar(255)", (t) => t.notNull()).addColumn("expires_at", "varchar(255)", (t) => t.notNull()).addColumn("used_at", "varchar(255)").execute();
4143
4232
  }
4144
- const Ps = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4233
+ const Js = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4145
4234
  __proto__: null,
4146
- down: zs,
4147
- up: Is
4235
+ down: Ms,
4236
+ up: Rs
4148
4237
  }, Symbol.toStringTag, { value: "Module" }));
4149
- async function Ds(e) {
4238
+ async function Ls(e) {
4150
4239
  }
4151
- async function As(e) {
4240
+ async function Ks(e) {
4152
4241
  }
4153
- const js = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4242
+ const qs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4154
4243
  __proto__: null,
4155
- down: As,
4156
- up: Ds
4244
+ down: Ks,
4245
+ up: Ls
4157
4246
  }, Symbol.toStringTag, { value: "Module" }));
4158
- async function Fs(e) {
4247
+ async function Us(e) {
4159
4248
  await e.schema.alterTable("logins").addColumn("auth0Client", "varchar(256)").execute();
4160
4249
  }
4161
- async function Rs(e) {
4250
+ async function Bs(e) {
4162
4251
  await e.schema.alterTable("logins").dropColumn("auth0Client").execute();
4163
4252
  }
4164
- const Ms = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4253
+ const Qs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4165
4254
  __proto__: null,
4166
- down: Rs,
4167
- up: Fs
4255
+ down: Bs,
4256
+ up: Us
4168
4257
  }, Symbol.toStringTag, { value: "Module" }));
4169
- async function Js(e) {
4258
+ async function Hs(e) {
4170
4259
  await e.schema.alterTable("logins").dropColumn("authParams_state").execute(), await e.schema.alterTable("logins").addColumn("authParams_state", "varchar(8192)").execute();
4171
4260
  }
4172
- async function Ls(e) {
4261
+ async function Ys(e) {
4173
4262
  await e.schema.alterTable("logins").dropColumn("authParams_state").execute(), await e.schema.alterTable("logins").addColumn("authParams_state", "varchar(511)").execute();
4174
4263
  }
4175
- const Ks = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4264
+ const Ws = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4176
4265
  __proto__: null,
4177
- down: Ls,
4178
- up: Js
4266
+ down: Ys,
4267
+ up: Hs
4179
4268
  }, Symbol.toStringTag, { value: "Module" }));
4180
- async function qs(e) {
4269
+ async function Gs(e) {
4181
4270
  }
4182
- async function Us(e) {
4271
+ async function Vs(e) {
4183
4272
  }
4184
- const Bs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4273
+ const Xs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4185
4274
  __proto__: null,
4186
- down: Us,
4187
- up: qs
4275
+ down: Vs,
4276
+ up: Gs
4188
4277
  }, Symbol.toStringTag, { value: "Module" }));
4189
- async function Qs(e) {
4278
+ async function Zs(e) {
4190
4279
  }
4191
- async function Hs(e) {
4280
+ async function ei(e) {
4192
4281
  }
4193
- const Ys = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4282
+ const ti = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4194
4283
  __proto__: null,
4195
- down: Hs,
4196
- up: Qs
4284
+ down: ei,
4285
+ up: Zs
4197
4286
  }, Symbol.toStringTag, { value: "Module" }));
4198
- async function Ws(e) {
4287
+ async function ai(e) {
4199
4288
  await e.schema.alterTable("logins").addColumn("authParams_nonce", "varchar(255)").execute();
4200
4289
  }
4201
- async function Gs(e) {
4290
+ async function ni(e) {
4202
4291
  await e.schema.alterTable("logins").dropColumn("nonce").execute();
4203
4292
  }
4204
- const Vs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4293
+ const oi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4205
4294
  __proto__: null,
4206
- down: Gs,
4207
- up: Ws
4295
+ down: ni,
4296
+ up: ai
4208
4297
  }, Symbol.toStringTag, { value: "Module" }));
4209
- async function Xs(e) {
4298
+ async function ri(e) {
4210
4299
  }
4211
- async function Zs(e) {
4300
+ async function si(e) {
4212
4301
  }
4213
- const ei = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4302
+ const ii = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4214
4303
  __proto__: null,
4215
- down: Zs,
4216
- up: Xs
4304
+ down: si,
4305
+ up: ri
4217
4306
  }, Symbol.toStringTag, { value: "Module" }));
4218
- async function ti(e) {
4307
+ async function ci(e) {
4219
4308
  }
4220
- async function ai(e) {
4309
+ async function li(e) {
4221
4310
  }
4222
- const ni = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4311
+ const di = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4223
4312
  __proto__: null,
4224
- down: ai,
4225
- up: ti
4313
+ down: li,
4314
+ up: ci
4226
4315
  }, Symbol.toStringTag, { value: "Module" }));
4227
- async function oi(e) {
4316
+ async function ui(e) {
4228
4317
  await e.schema.dropTable("codes").execute(), await e.schema.createTable("codes").addColumn("code_id", "varchar(255)", (t) => t.notNull()).addColumn(
4229
4318
  "tenant_id",
4230
4319
  "varchar(255)",
@@ -4240,7 +4329,7 @@ async function oi(e) {
4240
4329
  "code_type"
4241
4330
  ]).execute();
4242
4331
  }
4243
- async function ri(e) {
4332
+ async function _i(e) {
4244
4333
  await e.schema.dropTable("codes").execute(), await e.schema.createTable("codes").addColumn("code_id", "varchar(255)", (t) => t.primaryKey()).addColumn(
4245
4334
  "tenant_id",
4246
4335
  "varchar(255)",
@@ -4253,15 +4342,15 @@ async function ri(e) {
4253
4342
  (t) => t.onDelete("cascade")
4254
4343
  ).addColumn("code_type", "varchar(255)", (t) => t.notNull()).addColumn("created_at", "varchar(255)", (t) => t.notNull()).addColumn("expires_at", "varchar(255)", (t) => t.notNull()).addColumn("used_at", "varchar(255)").execute();
4255
4344
  }
4256
- const si = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4345
+ const mi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4257
4346
  __proto__: null,
4258
- down: ri,
4259
- up: oi
4347
+ down: _i,
4348
+ up: ui
4260
4349
  }, Symbol.toStringTag, { value: "Module" }));
4261
- async function ii(e) {
4350
+ async function hi(e) {
4262
4351
  await e.schema.dropTable("otps").execute(), await e.schema.dropTable("authentication_codes").execute();
4263
4352
  }
4264
- async function ci(e) {
4353
+ async function pi(e) {
4265
4354
  await e.schema.alterTable("keys").addColumn("private_key", "varchar(2048)").addColumn("public_key", "varchar(2048)").execute(), await e.schema.createTable("otps").addColumn(
4266
4355
  "tenant_id",
4267
4356
  "varchar(255)",
@@ -4280,32 +4369,32 @@ async function ci(e) {
4280
4369
  (t) => t.references("applications.id").onDelete("cascade").notNull()
4281
4370
  ).addColumn("user_id", "varchar(255)", (t) => t.notNull()).addColumn("nonce", "varchar(255)").addColumn("state", "varchar(8192)").addColumn("scope", "varchar(1024)").addColumn("response_type", "varchar(256)").addColumn("response_mode", "varchar(256)").addColumn("redirect_uri", "varchar(1024)").addColumn("created_at", "varchar(255)", (t) => t.notNull()).addColumn("expires_at", "varchar(255)", (t) => t.notNull()).addColumn("used_at", "varchar(255)").execute();
4282
4371
  }
4283
- const li = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4372
+ const fi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4284
4373
  __proto__: null,
4285
- down: ci,
4286
- up: ii
4374
+ down: pi,
4375
+ up: hi
4287
4376
  }, Symbol.toStringTag, { value: "Module" }));
4288
- async function di(e) {
4377
+ async function gi(e) {
4289
4378
  await e.schema.createIndex("IDX_logs_tenant_date_type_user").on("logs").columns(["tenant_id", "date", "type", "user_id"]).execute();
4290
4379
  }
4291
- async function ui(e) {
4380
+ async function wi(e) {
4292
4381
  await e.schema.dropIndex("IDX_logs_tenant_date_type_user").on("logs").execute();
4293
4382
  }
4294
- const _i = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4383
+ const yi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4295
4384
  __proto__: null,
4296
- down: ui,
4297
- up: di
4385
+ down: wi,
4386
+ up: gi
4298
4387
  }, Symbol.toStringTag, { value: "Module" }));
4299
- async function mi(e) {
4388
+ async function vi(e) {
4300
4389
  }
4301
- async function hi(e) {
4390
+ async function Ci(e) {
4302
4391
  }
4303
- const pi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4392
+ const xi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4304
4393
  __proto__: null,
4305
- down: hi,
4306
- up: mi
4394
+ down: Ci,
4395
+ up: vi
4307
4396
  }, Symbol.toStringTag, { value: "Module" }));
4308
- async function fi(e) {
4397
+ async function Ti(e) {
4309
4398
  await e.schema.createTable("prompt_settings").addColumn("tenant_id", "varchar(64)", (t) => t.primaryKey()).addColumn(
4310
4399
  "universal_login_experience",
4311
4400
  "varchar(16)",
@@ -4324,95 +4413,95 @@ async function fi(e) {
4324
4413
  (t) => t.defaultTo(!1).notNull()
4325
4414
  ).execute();
4326
4415
  }
4327
- async function gi(e) {
4416
+ async function Ni(e) {
4328
4417
  await e.schema.dropTable("prompt_settings").execute();
4329
4418
  }
4330
- const wi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4419
+ const Si = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4331
4420
  __proto__: null,
4332
- down: gi,
4333
- up: fi
4421
+ down: Ni,
4422
+ up: Ti
4334
4423
  }, Symbol.toStringTag, { value: "Module" }));
4335
- async function vi(e) {
4424
+ async function bi(e) {
4336
4425
  }
4337
- async function yi(e) {
4426
+ async function Oi(e) {
4338
4427
  }
4339
- const Ci = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4428
+ const ki = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4340
4429
  __proto__: null,
4341
- down: yi,
4342
- up: vi
4430
+ down: Oi,
4431
+ up: bi
4343
4432
  }, Symbol.toStringTag, { value: "Module" }));
4344
- async function xi(e) {
4433
+ async function $i(e) {
4345
4434
  }
4346
- async function Ti(e) {
4435
+ async function Ei(e) {
4347
4436
  }
4348
- const Ni = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4437
+ const Ii = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4349
4438
  __proto__: null,
4350
- down: Ti,
4351
- up: xi
4439
+ down: Ei,
4440
+ up: $i
4352
4441
  }, Symbol.toStringTag, { value: "Module" }));
4353
- async function Si(e) {
4442
+ async function zi(e) {
4354
4443
  }
4355
- async function bi(e) {
4444
+ async function Pi(e) {
4356
4445
  }
4357
- const Oi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4446
+ const Di = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4358
4447
  __proto__: null,
4359
- down: bi,
4360
- up: Si
4448
+ down: Pi,
4449
+ up: zi
4361
4450
  }, Symbol.toStringTag, { value: "Module" }));
4362
- async function ki(e) {
4451
+ async function Ai(e) {
4363
4452
  await e.schema.alterTable("logins").addColumn("authParams_ui_locales", "varchar(32)").execute();
4364
4453
  }
4365
- async function $i(e) {
4454
+ async function ji(e) {
4366
4455
  await e.schema.alterTable("logins").dropColumn("authParams_ui_locales").execute();
4367
4456
  }
4368
- const Ei = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4457
+ const Fi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4369
4458
  __proto__: null,
4370
- down: $i,
4371
- up: ki
4459
+ down: ji,
4460
+ up: Ai
4372
4461
  }, Symbol.toStringTag, { value: "Module" }));
4373
- async function Ii(e) {
4462
+ async function Ri(e) {
4374
4463
  await e.schema.alterTable("logins").addColumn("authParams_prompt", "varchar(16)").execute();
4375
4464
  }
4376
- async function zi(e) {
4465
+ async function Mi(e) {
4377
4466
  await e.schema.alterTable("logins").dropColumn("authParams_prompt").execute();
4378
4467
  }
4379
- const Pi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4468
+ const Ji = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4380
4469
  __proto__: null,
4381
- down: zi,
4382
- up: Ii
4470
+ down: Mi,
4471
+ up: Ri
4383
4472
  }, Symbol.toStringTag, { value: "Module" }));
4384
- async function Di(e) {
4473
+ async function Li(e) {
4385
4474
  }
4386
- async function Ai(e) {
4475
+ async function Ki(e) {
4387
4476
  }
4388
- const ji = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4477
+ const qi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4389
4478
  __proto__: null,
4390
- down: Ai,
4391
- up: Di
4479
+ down: Ki,
4480
+ up: Li
4392
4481
  }, Symbol.toStringTag, { value: "Module" }));
4393
- async function Fi(e) {
4482
+ async function Ui(e) {
4394
4483
  await e.schema.alterTable("logins").addColumn("authParams_act_as", "varchar(255)").execute();
4395
4484
  }
4396
- async function Ri(e) {
4485
+ async function Bi(e) {
4397
4486
  await e.schema.alterTable("logins").dropColumn("authParam_act_as").execute();
4398
4487
  }
4399
- const Mi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4488
+ const Qi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4400
4489
  __proto__: null,
4401
- down: Ri,
4402
- up: Fi
4490
+ down: Bi,
4491
+ up: Ui
4403
4492
  }, Symbol.toStringTag, { value: "Module" }));
4404
- async function Ji(e) {
4493
+ async function Hi(e) {
4405
4494
  await e.schema.alterTable("codes").addColumn("code_verifier", "varchar(128)").execute();
4406
4495
  }
4407
- async function Li(e) {
4496
+ async function Yi(e) {
4408
4497
  await e.schema.alterTable("codes").dropColumn("code_verifier").execute();
4409
4498
  }
4410
- const Ki = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4499
+ const Wi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4411
4500
  __proto__: null,
4412
- down: Li,
4413
- up: Ji
4501
+ down: Yi,
4502
+ up: Hi
4414
4503
  }, Symbol.toStringTag, { value: "Module" }));
4415
- async function qi(e) {
4504
+ async function Gi(e) {
4416
4505
  await e.schema.createTable("email_providers").addColumn("tenant_id", "varchar(255)", (t) => t.primaryKey()).addColumn("name", "varchar(255)", (t) => t.notNull()).addColumn("enabled", "boolean", (t) => t.notNull()).addColumn("default_from_address", "varchar(255)").addColumn(
4417
4506
  "credentials",
4418
4507
  "varchar(2048)",
@@ -4423,18 +4512,18 @@ async function qi(e) {
4423
4512
  (t) => t.notNull().defaultTo("{}")
4424
4513
  ).addColumn("created_at", "varchar(29)", (t) => t.notNull()).addColumn("updated_at", "varchar(29)", (t) => t.notNull()).execute();
4425
4514
  }
4426
- async function Ui(e) {
4515
+ async function Vi(e) {
4427
4516
  await e.schema.dropTable("email_providers").execute();
4428
4517
  }
4429
- const Bi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4518
+ const Xi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4430
4519
  __proto__: null,
4431
- down: Ui,
4432
- up: qi
4520
+ down: Vi,
4521
+ up: Gi
4433
4522
  }, Symbol.toStringTag, { value: "Module" }));
4434
- async function Qi(e) {
4523
+ async function Zi(e) {
4435
4524
  await e.schema.dropTable("tickets").execute();
4436
4525
  }
4437
- async function Hi(e) {
4526
+ async function ec(e) {
4438
4527
  await e.schema.createTable("tickets").addColumn(
4439
4528
  "tenant_id",
4440
4529
  "varchar(255)",
@@ -4445,22 +4534,22 @@ async function Hi(e) {
4445
4534
  (t) => t.references("applications.id").onDelete("cascade").notNull()
4446
4535
  ).addColumn("email", "varchar(255)", (t) => t.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)", (t) => t.notNull()).addColumn("expires_at", "varchar(255)", (t) => t.notNull()).addColumn("used_at", "varchar(255)").execute();
4447
4536
  }
4448
- const Yi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4537
+ const tc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4449
4538
  __proto__: null,
4450
- down: Hi,
4451
- up: Qi
4539
+ down: ec,
4540
+ up: Zi
4452
4541
  }, Symbol.toStringTag, { value: "Module" }));
4453
- async function Wi(e) {
4542
+ async function ac(e) {
4454
4543
  }
4455
- async function Gi(e) {
4544
+ async function nc(e) {
4456
4545
  await e.schema.alterTable("logins").dropColumn("ip").dropColumn("useragent").execute();
4457
4546
  }
4458
- const Vi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4547
+ const oc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4459
4548
  __proto__: null,
4460
- down: Gi,
4461
- up: Wi
4549
+ down: nc,
4550
+ up: ac
4462
4551
  }, Symbol.toStringTag, { value: "Module" }));
4463
- async function Xi(e) {
4552
+ async function rc(e) {
4464
4553
  await e.schema.createTable("refresh_tokens").addColumn("id", "varchar(21)", (t) => t.primaryKey()).addColumn(
4465
4554
  "client_id",
4466
4555
  "varchar(21)",
@@ -4473,27 +4562,27 @@ async function Xi(e) {
4473
4562
  (t) => t.onDelete("cascade")
4474
4563
  ).addColumn("created_at", "varchar(35)", (t) => t.notNull()).addColumn("expires_at", "varchar(35)").addColumn("idle_expires_at", "varchar(35)").addColumn("last_exchanged_at", "varchar(35)").addColumn("device", "varchar(2048)", (t) => t.notNull()).addColumn("resource_servers", "varchar(2048)", (t) => t.notNull()).addColumn("rotating", "boolean", (t) => t.notNull()).execute();
4475
4564
  }
4476
- async function Zi(e) {
4565
+ async function sc(e) {
4477
4566
  await e.schema.dropTable("refresh_tokens").execute();
4478
4567
  }
4479
- const ec = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4568
+ const ic = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4480
4569
  __proto__: null,
4481
- down: Zi,
4482
- up: Xi
4570
+ down: sc,
4571
+ up: rc
4483
4572
  }, Symbol.toStringTag, { value: "Module" }));
4484
- async function tc(e) {
4573
+ async function cc(e) {
4485
4574
  }
4486
- async function ac(e) {
4575
+ async function lc(e) {
4487
4576
  }
4488
- const nc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4577
+ const dc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4489
4578
  __proto__: null,
4490
- down: ac,
4491
- up: tc
4579
+ down: lc,
4580
+ up: cc
4492
4581
  }, Symbol.toStringTag, { value: "Module" }));
4493
- async function oc(e) {
4582
+ async function uc(e) {
4494
4583
  await e.schema.dropTable("sessions").execute(), await e.schema.dropTable("refresh_tokens").execute();
4495
4584
  }
4496
- async function rc(e) {
4585
+ async function _c(e) {
4497
4586
  await e.schema.createTable("sessions").addColumn("id", "varchar(21)", (t) => t.primaryKey()).addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addForeignKeyConstraint(
4498
4587
  "sessions_user_id_constraint",
4499
4588
  ["user_id", "tenant_id"],
@@ -4512,12 +4601,12 @@ async function rc(e) {
4512
4601
  (t) => t.onDelete("cascade")
4513
4602
  ).addColumn("created_at", "varchar(35)", (t) => t.notNull()).addColumn("expires_at", "varchar(35)").addColumn("idle_expires_at", "varchar(35)").addColumn("last_exchanged_at", "varchar(35)").addColumn("device", "varchar(2048)", (t) => t.notNull()).addColumn("resource_servers", "varchar(2048)", (t) => t.notNull()).addColumn("rotating", "boolean", (t) => t.notNull()).execute();
4514
4603
  }
4515
- const sc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4604
+ const mc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4516
4605
  __proto__: null,
4517
- down: rc,
4518
- up: oc
4606
+ down: _c,
4607
+ up: uc
4519
4608
  }, Symbol.toStringTag, { value: "Module" }));
4520
- async function ic(e) {
4609
+ async function hc(e) {
4521
4610
  await e.schema.createTable("sessions_2").addColumn("id", "varchar(21)", (t) => t.primaryKey()).addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addForeignKeyConstraint(
4522
4611
  "sessions_2_user_id_constraint",
4523
4612
  ["user_id", "tenant_id"],
@@ -4536,15 +4625,15 @@ async function ic(e) {
4536
4625
  (t) => t.onDelete("cascade")
4537
4626
  ).addColumn("created_at", "varchar(35)", (t) => t.notNull()).addColumn("expires_at", "varchar(35)").addColumn("idle_expires_at", "varchar(35)").addColumn("last_exchanged_at", "varchar(35)").addColumn("device", "varchar(2048)", (t) => t.notNull()).addColumn("resource_servers", "varchar(2048)", (t) => t.notNull()).addColumn("rotating", "boolean", (t) => t.notNull()).execute();
4538
4627
  }
4539
- async function cc(e) {
4628
+ async function pc(e) {
4540
4629
  await e.schema.dropTable("sessions_2").execute(), await e.schema.dropTable("refresh_tokens_2").execute();
4541
4630
  }
4542
- const lc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4631
+ const fc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4543
4632
  __proto__: null,
4544
- down: cc,
4545
- up: ic
4633
+ down: pc,
4634
+ up: hc
4546
4635
  }, Symbol.toStringTag, { value: "Module" }));
4547
- async function dc(e) {
4636
+ async function gc(e) {
4548
4637
  await e.schema.createTable("custom_domains").addColumn(
4549
4638
  "custom_domain_id",
4550
4639
  "varchar(21)",
@@ -4555,49 +4644,49 @@ async function dc(e) {
4555
4644
  (t) => t.references("tenants.id").onDelete("cascade").notNull()
4556
4645
  ).addColumn("domain", "varchar(255)", (t) => t.notNull()).addColumn("primary", "boolean", (t) => t.notNull()).addColumn("status", "varchar(50)", (t) => t.notNull()).addColumn("type", "varchar(50)", (t) => t.notNull()).addColumn("origin_domain_name", "varchar(255)").addColumn("verification", "varchar(2048)").addColumn("custom_client_ip_header", "varchar(50)").addColumn("tls_policy", "varchar(50)").addColumn("domain_metadata", "varchar(2048)").addColumn("created_at", "varchar(35)", (t) => t.notNull()).addColumn("updated_at", "varchar(35)", (t) => t.notNull()).execute(), await e.schema.dropTable("domains").execute();
4557
4646
  }
4558
- async function uc(e) {
4647
+ async function wc(e) {
4559
4648
  await e.schema.dropTable("custom_domains").execute(), await e.schema.createTable("domains").addColumn("id", "varchar(255)", (t) => t.notNull().primaryKey()).addColumn(
4560
4649
  "tenant_id",
4561
4650
  "varchar(255)",
4562
4651
  (t) => t.references("tenants.id").onDelete("cascade").notNull()
4563
4652
  ).addColumn("domain", "varchar(255)", (t) => t.notNull()).addColumn("email_service", "varchar(255)").addColumn("email_api_key", "varchar(255)").addColumn("dkim_private_key", "varchar(2048)").addColumn("dkim_public_key", "varchar(2048)").addColumn("created_at", "varchar(255)", (t) => t.notNull()).addColumn("updated_at", "varchar(255)", (t) => t.notNull()).execute();
4564
4653
  }
4565
- const _c = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4654
+ const yc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4566
4655
  __proto__: null,
4567
- down: uc,
4568
- up: dc
4656
+ down: wc,
4657
+ up: gc
4569
4658
  }, Symbol.toStringTag, { value: "Module" }));
4570
- async function mc(e) {
4659
+ async function vc(e) {
4571
4660
  }
4572
- async function hc(e) {
4661
+ async function Cc(e) {
4573
4662
  await e.schema.alterTable("logins").dropColumn("authParams_organization").dropColumn("authorization_url").execute();
4574
4663
  }
4575
- const pc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4664
+ const xc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4576
4665
  __proto__: null,
4577
- down: hc,
4578
- up: mc
4666
+ down: Cc,
4667
+ up: vc
4579
4668
  }, Symbol.toStringTag, { value: "Module" }));
4580
- async function fc(e) {
4669
+ async function Tc(e) {
4581
4670
  await e.schema.alterTable("logins").dropColumn("authorization_url").execute(), await e.schema.alterTable("logins").addColumn("authorization_url", "varchar(2048)").execute();
4582
4671
  }
4583
- async function gc(e) {
4672
+ async function Nc(e) {
4584
4673
  await e.schema.alterTable("logins").dropColumn("authorization_url").execute(), await e.schema.alterTable("logins").addColumn("authorization_url", "varchar(1024)").execute();
4585
4674
  }
4586
- const wc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4675
+ const Sc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4587
4676
  __proto__: null,
4588
- down: gc,
4589
- up: fc
4677
+ down: Nc,
4678
+ up: Tc
4590
4679
  }, Symbol.toStringTag, { value: "Module" }));
4591
- async function vc(e) {
4680
+ async function bc(e) {
4592
4681
  }
4593
- async function yc(e) {
4682
+ async function Oc(e) {
4594
4683
  }
4595
- const Cc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4684
+ const kc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4596
4685
  __proto__: null,
4597
- down: yc,
4598
- up: vc
4686
+ down: Oc,
4687
+ up: bc
4599
4688
  }, Symbol.toStringTag, { value: "Module" }));
4600
- async function xc(e) {
4689
+ async function $c(e) {
4601
4690
  await e.schema.createTable("sessions").addColumn("id", "varchar(21)", (t) => t.primaryKey()).addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addForeignKeyConstraint(
4602
4691
  "sessions_user_id_constraint",
4603
4692
  ["user_id", "tenant_id"],
@@ -4624,25 +4713,25 @@ async function xc(e) {
4624
4713
  (t) => t.onDelete("cascade")
4625
4714
  ).addColumn("created_at", "varchar(35)", (t) => t.notNull()).addColumn("expires_at", "varchar(35)").addColumn("idle_expires_at", "varchar(35)").addColumn("last_exchanged_at", "varchar(35)").addColumn("device", "varchar(2048)", (t) => t.notNull()).addColumn("resource_servers", "varchar(2048)", (t) => t.notNull()).addColumn("rotating", "boolean", (t) => t.notNull()).execute();
4626
4715
  }
4627
- async function Tc(e) {
4716
+ async function Ec(e) {
4628
4717
  await e.schema.dropTable("sessions").execute(), await e.schema.dropTable("login_sessions").execute(), await e.schema.dropTable("refresh_tokens").execute();
4629
4718
  }
4630
- const Nc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4719
+ const Ic = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4631
4720
  __proto__: null,
4632
- down: Tc,
4633
- up: xc
4721
+ down: Ec,
4722
+ up: $c
4634
4723
  }, Symbol.toStringTag, { value: "Module" }));
4635
- async function Sc(e) {
4724
+ async function zc(e) {
4636
4725
  await e.schema.dropTable("logins").execute(), await e.schema.dropTable("sessions_2").execute(), await e.schema.dropTable("refresh_tokens_2").execute();
4637
4726
  }
4638
- async function bc(e) {
4727
+ async function Pc(e) {
4639
4728
  }
4640
- const Oc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4729
+ const Dc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4641
4730
  __proto__: null,
4642
- down: bc,
4643
- up: Sc
4731
+ down: Pc,
4732
+ up: zc
4644
4733
  }, Symbol.toStringTag, { value: "Module" }));
4645
- async function kc(e) {
4734
+ async function Ac(e) {
4646
4735
  await e.schema.dropTable("custom_domains").execute(), await e.schema.createTable("custom_domains").addColumn(
4647
4736
  "custom_domain_id",
4648
4737
  "varchar(256)",
@@ -4653,120 +4742,120 @@ async function kc(e) {
4653
4742
  (t) => t.references("tenants.id").onDelete("cascade").notNull()
4654
4743
  ).addColumn("domain", "varchar(255)", (t) => t.notNull()).addColumn("primary", "boolean", (t) => t.notNull()).addColumn("status", "varchar(50)", (t) => t.notNull()).addColumn("type", "varchar(50)", (t) => t.notNull()).addColumn("origin_domain_name", "varchar(255)").addColumn("verification", "varchar(2048)").addColumn("custom_client_ip_header", "varchar(50)").addColumn("tls_policy", "varchar(50)").addColumn("domain_metadata", "varchar(2048)").addColumn("created_at", "varchar(35)", (t) => t.notNull()).addColumn("updated_at", "varchar(35)", (t) => t.notNull()).execute();
4655
4744
  }
4656
- async function $c(e) {
4745
+ async function jc(e) {
4657
4746
  }
4658
- const Ec = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4747
+ const Fc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4659
4748
  __proto__: null,
4660
- down: $c,
4661
- up: kc
4749
+ down: jc,
4750
+ up: Ac
4662
4751
  }, Symbol.toStringTag, { value: "Module" }));
4663
- async function Ic(e) {
4752
+ async function Rc(e) {
4664
4753
  }
4665
- async function zc(e) {
4754
+ async function Mc(e) {
4666
4755
  await e.schema.alterTable("users").dropColumn("phone_number").dropColumn("phone_verified").dropColumn("username").execute();
4667
4756
  }
4668
- const Pc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4757
+ const Jc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4669
4758
  __proto__: null,
4670
- down: zc,
4671
- up: Ic
4759
+ down: Mc,
4760
+ up: Rc
4672
4761
  }, Symbol.toStringTag, { value: "Module" }));
4673
- async function Dc(e) {
4762
+ async function Lc(e) {
4674
4763
  await e.schema.createTable("forms").addColumn("id", "varchar(255)", (t) => t.primaryKey()).addColumn("name", "varchar(255)", (t) => t.notNull()).addColumn("tenant_id", "varchar(255)", (t) => t.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)", (t) => t.notNull()).addColumn("updated_at", "varchar(255)", (t) => t.notNull()).execute(), await e.schema.createIndex("forms_tenant_id_idx").on("forms").column("tenant_id").execute();
4675
4764
  }
4676
- async function Ac(e) {
4765
+ async function Kc(e) {
4677
4766
  await e.schema.dropTable("forms").execute();
4678
4767
  }
4679
- const jc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4768
+ const qc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4680
4769
  __proto__: null,
4681
- down: Ac,
4682
- up: Dc
4770
+ down: Kc,
4771
+ up: Lc
4683
4772
  }, Symbol.toStringTag, { value: "Module" }));
4684
- async function Fc(e) {
4773
+ async function Uc(e) {
4685
4774
  await e.schema.alterTable("hooks").addColumn("form_id", "text").execute(), await e.schema.alterTable("hooks").addColumn("url_tmp", "varchar(512)").execute(), await e.updateTable("hooks").set((t) => ({ url_tmp: t.ref("url") })).execute(), await e.schema.alterTable("hooks").dropColumn("url").execute(), await e.schema.alterTable("hooks").renameColumn("url_tmp", "url").execute();
4686
4775
  }
4687
- async function Rc(e) {
4776
+ async function Bc(e) {
4688
4777
  await e.schema.dropTable("hooks").ifExists().execute(), await e.schema.createTable("hooks").addColumn("hook_id", "text", (t) => t.primaryKey()).addColumn("tenant_id", "text", (t) => t.notNull()).addColumn("trigger_id", "text", (t) => t.notNull()).addColumn("enabled", "integer", (t) => t.notNull().defaultTo(0)).addColumn("url", "varchar(512)", (t) => t.notNull()).addColumn("synchronous", "integer", (t) => t.notNull().defaultTo(0)).addColumn("priority", "integer").addColumn("created_at", "text", (t) => t.notNull()).addColumn("updated_at", "text", (t) => t.notNull()).execute();
4689
4778
  }
4690
- const Mc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4779
+ const Qc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4691
4780
  __proto__: null,
4692
- down: Rc,
4693
- up: Fc
4781
+ down: Bc,
4782
+ up: Uc
4694
4783
  }, Symbol.toStringTag, { value: "Module" }));
4695
- async function Jc(e) {
4784
+ async function Hc(e) {
4696
4785
  await e.schema.alterTable("login_sessions").addColumn(
4697
4786
  "login_completed",
4698
4787
  "boolean",
4699
4788
  (t) => t.notNull().defaultTo(0)
4700
4789
  ).execute();
4701
4790
  }
4702
- async function Lc(e) {
4791
+ async function Yc(e) {
4703
4792
  await e.schema.alterTable("login_sessions").dropColumn("login_completed").execute();
4704
4793
  }
4705
- const Kc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4794
+ const Wc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4706
4795
  __proto__: null,
4707
- down: Lc,
4708
- up: Jc
4796
+ down: Yc,
4797
+ up: Hc
4709
4798
  }, Symbol.toStringTag, { value: "Module" }));
4710
- async function qc(e) {
4799
+ async function Gc(e) {
4711
4800
  await e.schema.alterTable("sessions").addColumn(
4712
4801
  "login_session_id",
4713
4802
  "varchar(21)",
4714
4803
  (t) => t.references("login_sessions.id").onDelete("set null")
4715
4804
  ).execute();
4716
4805
  }
4717
- async function Uc(e) {
4806
+ async function Vc(e) {
4718
4807
  await e.schema.alterTable("sessions").dropColumn("login_session_id").execute();
4719
4808
  }
4720
- const Bc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4809
+ const Xc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4721
4810
  __proto__: null,
4722
- down: Uc,
4723
- up: qc
4811
+ down: Vc,
4812
+ up: Gc
4724
4813
  }, Symbol.toStringTag, { value: "Module" }));
4725
- async function Qc(e) {
4814
+ async function Zc(e) {
4726
4815
  await e.schema.createIndex("IDX_sessions_login_session_id").on("sessions").column("login_session_id").execute();
4727
4816
  }
4728
- async function Hc(e) {
4817
+ async function el(e) {
4729
4818
  await e.schema.dropIndex("IDX_sessions_login_session_id").on("sessions").execute();
4730
4819
  }
4731
- const Yc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4820
+ const tl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4732
4821
  __proto__: null,
4733
- down: Hc,
4734
- up: Qc
4822
+ down: el,
4823
+ up: Zc
4735
4824
  }, Symbol.toStringTag, { value: "Module" }));
4736
- async function Wc(e) {
4825
+ async function al(e) {
4737
4826
  await e.schema.alterTable("codes").addColumn("code_challenge", "varchar(128)").execute(), await e.schema.alterTable("codes").addColumn("code_challenge_method", "varchar(5)").execute();
4738
4827
  }
4739
- async function Gc(e) {
4828
+ async function nl(e) {
4740
4829
  await e.schema.alterTable("codes").dropColumn("code_challenge").execute(), await e.schema.alterTable("codes").dropColumn("code_challenge_method").execute();
4741
4830
  }
4742
- const Vc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4831
+ const ol = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4743
4832
  __proto__: null,
4744
- down: Gc,
4745
- up: Wc
4833
+ down: nl,
4834
+ up: al
4746
4835
  }, Symbol.toStringTag, { value: "Module" }));
4747
- async function Xc(e) {
4836
+ async function rl(e) {
4748
4837
  await e.schema.alterTable("codes").addColumn("redirect_uri", "varchar(1024)").execute();
4749
4838
  }
4750
- async function Zc(e) {
4839
+ async function sl(e) {
4751
4840
  await e.schema.alterTable("codes").dropColumn("redirect_uri").execute();
4752
4841
  }
4753
- const el = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4842
+ const il = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4754
4843
  __proto__: null,
4755
- down: Zc,
4756
- up: Xc
4844
+ down: sl,
4845
+ up: rl
4757
4846
  }, Symbol.toStringTag, { value: "Module" }));
4758
- async function tl(e) {
4847
+ async function cl(e) {
4759
4848
  await e.schema.alterTable("codes").addColumn("nonce", "varchar(1024)").execute(), await e.schema.alterTable("codes").addColumn("state", "varchar(2048)").execute();
4760
4849
  }
4761
- async function al(e) {
4850
+ async function ll(e) {
4762
4851
  await e.schema.alterTable("codes").dropColumn("nonce").execute(), await e.schema.alterTable("codes").dropColumn("state").execute();
4763
4852
  }
4764
- const nl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4853
+ const dl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4765
4854
  __proto__: null,
4766
- down: al,
4767
- up: tl
4855
+ down: ll,
4856
+ up: cl
4768
4857
  }, Symbol.toStringTag, { value: "Module" }));
4769
- async function ol(e) {
4858
+ async function ul(e) {
4770
4859
  await e.schema.createTable("themes").addColumn(
4771
4860
  "tenant_id",
4772
4861
  "varchar(255)",
@@ -4841,26 +4930,26 @@ async function ol(e) {
4841
4930
  (t) => t.notNull()
4842
4931
  ).addColumn("created_at", "varchar(35)", (t) => t.notNull()).addColumn("updated_at", "varchar(35)", (t) => t.notNull()).addPrimaryKeyConstraint("themes_pkey", ["tenant_id", "themeId"]).execute(), await e.schema.createIndex("themes_tenant_id_idx").on("themes").column("tenant_id").execute();
4843
4932
  }
4844
- async function rl(e) {
4933
+ async function _l(e) {
4845
4934
  await e.schema.dropTable("themes").execute();
4846
4935
  }
4847
- const sl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4936
+ const ml = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4848
4937
  __proto__: null,
4849
- down: rl,
4850
- up: ol
4938
+ down: _l,
4939
+ up: ul
4851
4940
  }, Symbol.toStringTag, { value: "Module" }));
4852
- async function il(e) {
4941
+ async function hl(e) {
4853
4942
  await e.schema.createTable("resource_servers").addColumn("id", "varchar(21)", (t) => t.notNull()).addColumn("tenant_id", "varchar(191)", (t) => t.notNull()).addColumn("identifier", "varchar(191)", (t) => t.notNull()).addColumn("name", "varchar(255)", (t) => t.notNull()).addColumn("scopes", "varchar(4096)").addColumn("signing_alg", "varchar(64)").addColumn("signing_secret", "varchar(2048)").addColumn("token_lifetime", "integer").addColumn("token_lifetime_for_web", "integer").addColumn("skip_consent_for_verifiable_first_party_clients", "integer").addColumn("allow_offline_access", "integer").addColumn("verification_key", "varchar(4096)").addColumn("options", "varchar(4096)").addColumn("created_at", "varchar(35)", (t) => t.notNull()).addColumn("updated_at", "varchar(35)", (t) => t.notNull()).addPrimaryKeyConstraint("resource_servers_pk", ["tenant_id", "id"]).execute(), await e.schema.createIndex("resource_servers_tenant_identifier_uq").on("resource_servers").columns(["tenant_id", "identifier"]).unique().execute(), await e.schema.createTable("roles").addColumn("id", "varchar(21)", (t) => t.notNull()).addColumn("tenant_id", "varchar(191)", (t) => t.notNull()).addColumn("name", "varchar(50)", (t) => t.notNull()).addColumn("description", "varchar(255)").addColumn("created_at", "varchar(35)", (t) => t.notNull()).addColumn("updated_at", "varchar(35)", (t) => t.notNull()).addPrimaryKeyConstraint("roles_pk", ["tenant_id", "id"]).execute(), await e.schema.createIndex("roles_tenant_name_uq").on("roles").columns(["tenant_id", "name"]).unique().execute();
4854
4943
  }
4855
- async function cl(e) {
4944
+ async function pl(e) {
4856
4945
  await e.schema.dropTable("roles").execute(), await e.schema.dropTable("resource_servers").execute();
4857
4946
  }
4858
- const ll = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4947
+ const fl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4859
4948
  __proto__: null,
4860
- down: cl,
4861
- up: il
4949
+ down: pl,
4950
+ up: hl
4862
4951
  }, Symbol.toStringTag, { value: "Module" }));
4863
- async function dl(e) {
4952
+ async function gl(e) {
4864
4953
  await e.schema.createTable("role_permissions").addColumn("tenant_id", "varchar(191)", (t) => t.notNull()).addColumn("role_id", "varchar(21)", (t) => t.notNull()).addColumn(
4865
4954
  "resource_server_identifier",
4866
4955
  "varchar(191)",
@@ -4881,66 +4970,66 @@ async function dl(e) {
4881
4970
  "permission_name"
4882
4971
  ]).execute(), await e.schema.createIndex("user_permissions_user_fk").on("user_permissions").columns(["tenant_id", "user_id"]).execute(), await e.schema.createIndex("user_permissions_permission_fk").on("user_permissions").columns(["tenant_id", "resource_server_identifier", "permission_name"]).execute();
4883
4972
  }
4884
- async function ul(e) {
4973
+ async function wl(e) {
4885
4974
  await e.schema.dropTable("user_permissions").execute(), await e.schema.dropTable("role_permissions").execute();
4886
4975
  }
4887
- const _l = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4976
+ const yl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4888
4977
  __proto__: null,
4889
- down: ul,
4890
- up: dl
4978
+ down: wl,
4979
+ up: gl
4891
4980
  }, Symbol.toStringTag, { value: "Module" }));
4892
- async function ml(e) {
4981
+ async function vl(e) {
4893
4982
  await e.schema.createTable("user_roles").addColumn("tenant_id", "varchar(191)", (t) => t.notNull()).addColumn("user_id", "varchar(191)", (t) => t.notNull()).addColumn("role_id", "varchar(21)", (t) => t.notNull()).addColumn("created_at", "varchar(35)", (t) => t.notNull()).addPrimaryKeyConstraint("user_roles_pk", [
4894
4983
  "tenant_id",
4895
4984
  "user_id",
4896
4985
  "role_id"
4897
4986
  ]).execute(), await e.schema.createIndex("user_roles_user_fk").on("user_roles").columns(["tenant_id", "user_id"]).execute(), await e.schema.createIndex("user_roles_role_fk").on("user_roles").columns(["tenant_id", "role_id"]).execute();
4898
4987
  }
4899
- async function hl(e) {
4988
+ async function Cl(e) {
4900
4989
  await e.schema.dropTable("user_roles").execute();
4901
4990
  }
4902
- const pl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4991
+ const xl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4903
4992
  __proto__: null,
4904
- down: hl,
4905
- up: ml
4993
+ down: Cl,
4994
+ up: vl
4906
4995
  }, Symbol.toStringTag, { value: "Module" }));
4907
- async function fl(e) {
4996
+ async function Tl(e) {
4908
4997
  }
4909
- async function gl(e) {
4998
+ async function Nl(e) {
4910
4999
  await e.schema.alterTable("keys").dropColumn("connection").execute(), await e.schema.alterTable("keys").modifyColumn("cert", "varchar(2048)").execute(), await e.schema.alterTable("keys").modifyColumn("pkcs7", "varchar(2048)").execute(), await e.schema.alterTable("keys").dropColumn("type").execute();
4911
5000
  }
4912
- const wl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5001
+ const Sl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4913
5002
  __proto__: null,
4914
- down: gl,
4915
- up: fl
5003
+ down: Nl,
5004
+ up: Tl
4916
5005
  }, Symbol.toStringTag, { value: "Module" }));
4917
- async function vl(e) {
5006
+ async function bl(e) {
4918
5007
  await e.schema.createTable("organizations").addColumn("id", "varchar(21)", (t) => t.primaryKey()).addColumn("tenant_id", "varchar(191)", (t) => t.notNull()).addColumn("name", "varchar(256)", (t) => t.notNull()).addColumn("display_name", "varchar(256)").addColumn("branding", "text").addColumn("metadata", "text").addColumn("enabled_connections", "text").addColumn("token_quota", "text").addColumn("created_at", "varchar(35)", (t) => t.notNull()).addColumn("updated_at", "varchar(35)", (t) => t.notNull()).execute(), await e.schema.createIndex("idx_organizations_tenant_id").on("organizations").column("tenant_id").execute(), await e.schema.createIndex("idx_organizations_tenant_name_unique").on("organizations").columns(["tenant_id", "name"]).unique().execute();
4919
5008
  }
4920
- async function yl(e) {
5009
+ async function Ol(e) {
4921
5010
  await e.schema.dropTable("organizations").execute();
4922
5011
  }
4923
- const Cl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5012
+ const kl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4924
5013
  __proto__: null,
4925
- down: yl,
4926
- up: vl
5014
+ down: Ol,
5015
+ up: bl
4927
5016
  }, Symbol.toStringTag, { value: "Module" }));
4928
- async function xl(e) {
5017
+ async function $l(e) {
4929
5018
  await e.schema.createTable("user_organizations").addColumn("id", "varchar(21)", (t) => t.primaryKey()).addColumn("tenant_id", "varchar(191)", (t) => t.notNull()).addColumn("user_id", "varchar(191)", (t) => t.notNull()).addColumn("organization_id", "varchar(21)", (t) => t.notNull()).addColumn("created_at", "varchar(35)", (t) => t.notNull()).addColumn("updated_at", "varchar(35)", (t) => t.notNull()).addUniqueConstraint("user_organizations_unique", [
4930
5019
  "tenant_id",
4931
5020
  "user_id",
4932
5021
  "organization_id"
4933
5022
  ]).execute(), await e.schema.createIndex("idx_user_organizations_tenant_id").on("user_organizations").column("tenant_id").execute(), await e.schema.createIndex("idx_user_organizations_user_id").on("user_organizations").column("user_id").execute(), await e.schema.createIndex("idx_user_organizations_organization_id").on("user_organizations").column("organization_id").execute();
4934
5023
  }
4935
- async function Tl(e) {
5024
+ async function El(e) {
4936
5025
  await e.schema.dropTable("user_organizations").execute();
4937
5026
  }
4938
- const Nl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5027
+ const Il = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4939
5028
  __proto__: null,
4940
- down: Tl,
4941
- up: xl
5029
+ down: El,
5030
+ up: $l
4942
5031
  }, Symbol.toStringTag, { value: "Module" }));
4943
- async function Sl(e) {
5032
+ async function zl(e) {
4944
5033
  await e.schema.dropTable("user_permissions").execute(), await e.schema.dropTable("user_roles").execute(), await e.schema.createTable("user_permissions").addColumn("tenant_id", "varchar(191)", (t) => t.notNull()).addColumn("user_id", "varchar(191)", (t) => t.notNull()).addColumn(
4945
5034
  "resource_server_identifier",
4946
5035
  "varchar(21)",
@@ -4966,7 +5055,7 @@ async function Sl(e) {
4966
5055
  "organization_id"
4967
5056
  ]).execute(), await e.schema.createIndex("user_roles_user_fk").on("user_roles").columns(["tenant_id", "user_id"]).execute(), await e.schema.createIndex("user_roles_role_fk").on("user_roles").columns(["tenant_id", "role_id"]).execute(), await e.schema.createIndex("user_roles_organization_fk").on("user_roles").column("organization_id").execute();
4968
5057
  }
4969
- async function bl(e) {
5058
+ async function Pl(e) {
4970
5059
  await e.schema.dropTable("user_permissions").execute(), await e.schema.dropTable("user_roles").execute(), await e.schema.createTable("user_permissions").addColumn("tenant_id", "varchar(191)", (t) => t.notNull()).addColumn("user_id", "varchar(191)", (t) => t.notNull()).addColumn(
4971
5060
  "resource_server_identifier",
4972
5061
  "varchar(191)",
@@ -4982,12 +5071,12 @@ async function bl(e) {
4982
5071
  "role_id"
4983
5072
  ]).execute(), await e.schema.createIndex("user_roles_user_fk").on("user_roles").columns(["tenant_id", "user_id"]).execute(), await e.schema.createIndex("user_roles_role_fk").on("user_roles").columns(["tenant_id", "role_id"]).execute();
4984
5073
  }
4985
- const Ol = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5074
+ const Dl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4986
5075
  __proto__: null,
4987
- down: bl,
4988
- up: Sl
5076
+ down: Pl,
5077
+ up: zl
4989
5078
  }, Symbol.toStringTag, { value: "Module" }));
4990
- async function kl(e) {
5079
+ async function Al(e) {
4991
5080
  await e.schema.createTable("clients").addColumn("client_id", "varchar(191)", (t) => t.notNull()).addColumn(
4992
5081
  "tenant_id",
4993
5082
  "varchar(191)",
@@ -5029,25 +5118,25 @@ async function kl(e) {
5029
5118
  "client_id"
5030
5119
  ]).execute();
5031
5120
  }
5032
- async function $l(e) {
5121
+ async function jl(e) {
5033
5122
  await e.schema.dropTable("clients").execute();
5034
5123
  }
5035
- const El = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5124
+ const Fl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5036
5125
  __proto__: null,
5037
- down: $l,
5038
- up: kl
5126
+ down: jl,
5127
+ up: Al
5039
5128
  }, Symbol.toStringTag, { value: "Module" }));
5040
- async function ve(e) {
5129
+ async function ye(e) {
5041
5130
  try {
5042
5131
  return await h`SELECT VERSION()`.execute(e), "mysql";
5043
5132
  } catch {
5044
5133
  return "sqlite";
5045
5134
  }
5046
5135
  }
5047
- async function Il(e) {
5048
- await ve(e) === "mysql" ? await zl(e) : await Pl(e);
5136
+ async function Rl(e) {
5137
+ await ye(e) === "mysql" ? await Ml(e) : await Jl(e);
5049
5138
  }
5050
- async function zl(e) {
5139
+ async function Ml(e) {
5051
5140
  await e.transaction().execute(async (t) => {
5052
5141
  const a = await h`
5053
5142
  SELECT
@@ -5128,7 +5217,7 @@ async function zl(e) {
5128
5217
  FROM login_sessions_backup`.execute(t), await h`DROP TABLE sessions_backup`.execute(t), await h`DROP TABLE login_sessions_backup`.execute(t), await h`DROP TABLE refresh_tokens_backup`.execute(t);
5129
5218
  });
5130
5219
  }
5131
- async function Pl(e) {
5220
+ async function Jl(e) {
5132
5221
  await e.transaction().execute(async (t) => {
5133
5222
  const a = [
5134
5223
  "sessions_backup",
@@ -5194,10 +5283,10 @@ async function Pl(e) {
5194
5283
  FROM login_sessions_backup`.execute(t), await h`DROP TABLE sessions_backup`.execute(t), await h`DROP TABLE login_sessions_backup`.execute(t), await h`DROP TABLE refresh_tokens_backup`.execute(t);
5195
5284
  });
5196
5285
  }
5197
- async function Dl(e) {
5198
- await ve(e) === "mysql" ? await Al(e) : await jl(e);
5286
+ async function Ll(e) {
5287
+ await ye(e) === "mysql" ? await Kl(e) : await ql(e);
5199
5288
  }
5200
- async function Al(e) {
5289
+ async function Kl(e) {
5201
5290
  await e.transaction().execute(async (t) => {
5202
5291
  await h`ALTER TABLE refresh_tokens DROP FOREIGN KEY refresh_tokens_client_fk`.execute(
5203
5292
  t
@@ -5214,7 +5303,7 @@ async function Al(e) {
5214
5303
  );
5215
5304
  });
5216
5305
  }
5217
- async function jl(e) {
5306
+ async function ql(e) {
5218
5307
  await e.transaction().execute(async (t) => {
5219
5308
  await h`CREATE TABLE refresh_tokens_temp AS SELECT * FROM refresh_tokens`.execute(
5220
5309
  t
@@ -5244,12 +5333,12 @@ async function jl(e) {
5244
5333
  FROM login_sessions_temp`.execute(t), await h`DROP TABLE login_sessions_temp`.execute(t);
5245
5334
  });
5246
5335
  }
5247
- const Fl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5336
+ const Ul = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5248
5337
  __proto__: null,
5249
- down: Dl,
5250
- up: Il
5338
+ down: Ll,
5339
+ up: Rl
5251
5340
  }, Symbol.toStringTag, { value: "Module" }));
5252
- async function Rl(e) {
5341
+ async function Bl(e) {
5253
5342
  await e.schema.createTable("client_grants").addColumn("id", "varchar(21)", (t) => t.notNull()).addColumn(
5254
5343
  "tenant_id",
5255
5344
  "varchar(191)",
@@ -5266,89 +5355,89 @@ async function Rl(e) {
5266
5355
  (t) => t.onDelete("cascade")
5267
5356
  ).execute(), await e.schema.createIndex("uq_client_grants_tenant_client_audience").on("client_grants").columns(["tenant_id", "client_id", "audience"]).unique().execute(), await e.schema.createIndex("idx_client_grants_audience").on("client_grants").columns(["audience"]).execute();
5268
5357
  }
5269
- async function Ml(e) {
5358
+ async function Ql(e) {
5270
5359
  await e.schema.dropTable("client_grants").execute();
5271
5360
  }
5272
- const Jl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5361
+ const Hl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5273
5362
  __proto__: null,
5274
- down: Ml,
5275
- up: Rl
5363
+ down: Ql,
5364
+ up: Bl
5276
5365
  }, Symbol.toStringTag, { value: "Module" }));
5277
- async function Ll(e) {
5366
+ async function Yl(e) {
5278
5367
  await e.schema.dropTable("applications").execute();
5279
5368
  }
5280
- async function Kl(e) {
5369
+ async function Wl(e) {
5281
5370
  await e.schema.createTable("applications").addColumn("id", "varchar(21)", (t) => t.notNull()).addColumn(
5282
5371
  "tenant_id",
5283
5372
  "varchar(191)",
5284
5373
  (t) => t.notNull().references("tenants.id").onDelete("cascade")
5285
5374
  ).addColumn("name", "varchar(255)", (t) => t.notNull()).addColumn("client_secret", "varchar(255)").addColumn("callbacks", "text", (t) => t.defaultTo("[]")).addColumn("allowed_origins", "text", (t) => t.defaultTo("[]")).addColumn("web_origins", "text", (t) => t.defaultTo("[]")).addColumn("allowed_logout_urls", "text", (t) => t.defaultTo("[]")).addColumn("allowed_clients", "text", (t) => t.defaultTo("[]")).addColumn("disable_sign_ups", "integer", (t) => t.defaultTo(0)).addColumn("addons", "text", (t) => t.defaultTo("{}")).addColumn("client_metadata", "text", (t) => t.defaultTo("{}")).addColumn("created_at", "varchar(35)", (t) => t.notNull()).addColumn("updated_at", "varchar(35)", (t) => t.notNull()).addPrimaryKeyConstraint("pk_applications", ["tenant_id", "id"]).execute(), await e.schema.createIndex("idx_applications_tenant_id").on("applications").columns(["tenant_id"]).execute();
5286
5375
  }
5287
- const ql = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5376
+ const Gl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5288
5377
  __proto__: null,
5289
- down: Kl,
5290
- up: Ll
5378
+ down: Wl,
5379
+ up: Yl
5291
5380
  }, Symbol.toStringTag, { value: "Module" }));
5292
- async function Ul(e) {
5381
+ async function Vl(e) {
5293
5382
  await e.schema.createIndex("users_phone_tenant_provider_index").on("users").columns(["tenant_id", "phone_number", "provider"]).execute();
5294
5383
  }
5295
- async function Bl(e) {
5384
+ async function Xl(e) {
5296
5385
  await e.schema.dropIndex("users_phone_tenant_provider_index").execute();
5297
5386
  }
5298
- const Ql = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5387
+ const Zl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5299
5388
  __proto__: null,
5300
- down: Bl,
5301
- up: Ul
5389
+ down: Xl,
5390
+ up: Vl
5302
5391
  }, Symbol.toStringTag, { value: "Module" }));
5303
- async function Hl(e) {
5392
+ async function ed(e) {
5304
5393
  await e.schema.createIndex("login_sessions_id_index").on("login_sessions").column("id").execute();
5305
5394
  }
5306
- async function Yl(e) {
5395
+ async function td(e) {
5307
5396
  await e.schema.dropIndex("login_sessions_id_index").execute();
5308
5397
  }
5309
- const Wl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5398
+ const ad = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5310
5399
  __proto__: null,
5311
- down: Yl,
5312
- up: Hl
5400
+ down: td,
5401
+ up: ed
5313
5402
  }, Symbol.toStringTag, { value: "Module" }));
5314
- async function Gl(e) {
5403
+ async function nd(e) {
5315
5404
  await e.schema.createIndex("connections_tenant_id_index").on("connections").column("tenant_id").execute();
5316
5405
  }
5317
- async function Vl(e) {
5406
+ async function od(e) {
5318
5407
  await e.schema.dropIndex("connections_tenant_id_index").execute();
5319
5408
  }
5320
- const Xl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5409
+ const rd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5321
5410
  __proto__: null,
5322
- down: Vl,
5323
- up: Gl
5411
+ down: od,
5412
+ up: nd
5324
5413
  }, Symbol.toStringTag, { value: "Module" }));
5325
- async function Zl(e) {
5414
+ async function sd(e) {
5326
5415
  await e.schema.dropIndex("idx_user_organizations_tenant_id").execute();
5327
5416
  }
5328
- async function ed(e) {
5417
+ async function id(e) {
5329
5418
  await e.schema.createIndex("idx_user_organizations_tenant_id").on("user_organizations").column("tenant_id").execute();
5330
5419
  }
5331
- const td = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5420
+ const cd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5332
5421
  __proto__: null,
5333
- down: ed,
5334
- up: Zl
5422
+ down: id,
5423
+ up: sd
5335
5424
  }, Symbol.toStringTag, { value: "Module" }));
5336
- async function ad(e) {
5425
+ async function ld(e) {
5337
5426
  await e.schema.createTable("tenant_settings").addColumn(
5338
5427
  "tenant_id",
5339
5428
  "varchar(191)",
5340
5429
  (t) => t.references("tenants.id").onDelete("cascade").notNull().primaryKey()
5341
5430
  ).addColumn("idle_session_lifetime", "integer").addColumn("session_lifetime", "integer").addColumn("session_cookie", "text").addColumn("enable_client_connections", "integer").addColumn("default_redirection_uri", "text").addColumn("enabled_locales", "text").addColumn("default_directory", "varchar(255)").addColumn("error_page", "text").addColumn("flags", "text").addColumn("friendly_name", "varchar(255)").addColumn("picture_url", "text").addColumn("support_email", "varchar(255)").addColumn("support_url", "text").addColumn("sandbox_version", "varchar(50)").addColumn("sandbox_versions_available", "text").addColumn("change_password", "text").addColumn("guardian_mfa_page", "text").addColumn("default_audience", "varchar(255)").addColumn("default_organization", "varchar(255)").addColumn("sessions", "text").execute();
5342
5431
  }
5343
- async function nd(e) {
5432
+ async function dd(e) {
5344
5433
  await e.schema.dropTable("tenant_settings").execute();
5345
5434
  }
5346
- const od = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5435
+ const ud = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5347
5436
  __proto__: null,
5348
- down: nd,
5349
- up: ad
5437
+ down: dd,
5438
+ up: ld
5350
5439
  }, Symbol.toStringTag, { value: "Module" }));
5351
- async function rd(e) {
5440
+ async function _d(e) {
5352
5441
  if (await e.schema.alterTable("tenants").addColumn("idle_session_lifetime", "integer").execute(), await e.schema.alterTable("tenants").addColumn("session_lifetime", "integer").execute(), await e.schema.alterTable("tenants").addColumn("session_cookie", "text").execute(), await e.schema.alterTable("tenants").addColumn("allowed_logout_urls", "text").execute(), await e.schema.alterTable("tenants").addColumn("ephemeral_session_lifetime", "integer").execute(), await e.schema.alterTable("tenants").addColumn("idle_ephemeral_session_lifetime", "integer").execute(), await e.schema.alterTable("tenants").addColumn("default_redirection_uri", "text").execute(), await e.schema.alterTable("tenants").addColumn("enabled_locales", "text").execute(), await e.schema.alterTable("tenants").addColumn("default_directory", "varchar(255)").execute(), await e.schema.alterTable("tenants").addColumn("error_page", "text").execute(), await e.schema.alterTable("tenants").addColumn("flags", "text").execute(), await e.schema.alterTable("tenants").addColumn("friendly_name", "varchar(255)").execute(), await e.schema.alterTable("tenants").addColumn("picture_url", "text").execute(), await e.schema.alterTable("tenants").addColumn("support_email", "varchar(255)").execute(), await e.schema.alterTable("tenants").addColumn("sandbox_version", "varchar(50)").execute(), await e.schema.alterTable("tenants").addColumn("sandbox_versions_available", "text").execute(), await e.schema.alterTable("tenants").addColumn("legacy_sandbox_version", "varchar(50)").execute(), await e.schema.alterTable("tenants").addColumn("change_password", "text").execute(), await e.schema.alterTable("tenants").addColumn("guardian_mfa_page", "text").execute(), await e.schema.alterTable("tenants").addColumn("device_flow", "text").execute(), await e.schema.alterTable("tenants").addColumn("default_token_quota", "text").execute(), await e.schema.alterTable("tenants").addColumn("default_audience", "varchar(255)").execute(), await e.schema.alterTable("tenants").addColumn("default_organization", "varchar(255)").execute(), await e.schema.alterTable("tenants").addColumn("sessions", "text").execute(), await e.schema.alterTable("tenants").addColumn("oidc_logout", "text").execute(), await e.schema.alterTable("tenants").addColumn("allow_organization_name_in_authentication_api", "integer").execute(), await e.schema.alterTable("tenants").addColumn("customize_mfa_in_postlogin_action", "integer").execute(), await e.schema.alterTable("tenants").addColumn("acr_values_supported", "text").execute(), await e.schema.alterTable("tenants").addColumn("mtls", "text").execute(), await e.schema.alterTable("tenants").addColumn("pushed_authorization_requests_supported", "integer").execute(), await e.schema.alterTable("tenants").addColumn("authorization_response_iss_parameter_supported", "integer").execute(), await e.updateTable("tenants").set({
5353
5442
  friendly_name: h`name`
5354
5443
  }).execute(), await e.schema.alterTable("tenants").dropColumn("language").execute(), await e.schema.alterTable("tenants").dropColumn("logo").execute(), await e.schema.alterTable("tenants").dropColumn("primary_color").execute(), await e.schema.alterTable("tenants").dropColumn("secondary_color").execute(), await e.schema.alterTable("tenants").dropColumn("name").execute(), (await e.selectFrom("tenant_settings").select("tenant_id").limit(1).execute()).length > 0) {
@@ -5379,7 +5468,7 @@ async function rd(e) {
5379
5468
  }
5380
5469
  await e.schema.dropTable("tenant_settings").execute();
5381
5470
  }
5382
- async function sd(e) {
5471
+ async function md(e) {
5383
5472
  await e.schema.createTable("tenant_settings").addColumn(
5384
5473
  "tenant_id",
5385
5474
  "varchar(191)",
@@ -5436,45 +5525,45 @@ async function sd(e) {
5436
5525
  name: h`COALESCE(friendly_name, id)`
5437
5526
  }).execute(), await e.schema.alterTable("tenants").addColumn("language", "varchar(255)").execute(), await e.schema.alterTable("tenants").addColumn("logo", "text").execute(), await e.schema.alterTable("tenants").addColumn("primary_color", "varchar(50)").execute(), await e.schema.alterTable("tenants").addColumn("secondary_color", "varchar(50)").execute();
5438
5527
  }
5439
- const id = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5528
+ const hd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5440
5529
  __proto__: null,
5441
- down: sd,
5442
- up: rd
5530
+ down: md,
5531
+ up: _d
5443
5532
  }, Symbol.toStringTag, { value: "Module" }));
5444
- async function cd(e) {
5533
+ async function pd(e) {
5445
5534
  await e.schema.createTable("invites").addColumn("id", "varchar(21)", (t) => t.primaryKey()).addColumn("tenant_id", "varchar(191)", (t) => t.notNull()).addColumn("organization_id", "varchar(21)", (t) => t.notNull()).addColumn("inviter", "text", (t) => t.notNull()).addColumn("invitee", "text", (t) => t.notNull()).addColumn("client_id", "varchar(191)", (t) => t.notNull()).addColumn("connection_id", "varchar(21)").addColumn("invitation_url", "text", (t) => t.notNull()).addColumn("created_at", "varchar(35)", (t) => t.notNull()).addColumn("expires_at", "varchar(35)", (t) => t.notNull()).addColumn("app_metadata", "text").addColumn("user_metadata", "text").addColumn("roles", "text").addColumn("ticket_id", "varchar(191)").addColumn("ttl_sec", "integer").addColumn("send_invitation_email", "integer").execute(), await e.schema.createIndex("idx_invites_tenant_id").on("invites").column("tenant_id").execute(), await e.schema.createIndex("idx_invites_organization_id").on("invites").column("organization_id").execute(), await e.schema.createIndex("idx_invites_expires_at").on("invites").column("expires_at").execute(), await e.schema.createIndex("idx_invites_tenant_created").on("invites").columns(["tenant_id", "created_at"]).execute();
5446
5535
  }
5447
- async function ld(e) {
5536
+ async function fd(e) {
5448
5537
  await e.schema.dropTable("invites").execute();
5449
5538
  }
5450
- const dd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5539
+ const gd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5451
5540
  __proto__: null,
5452
- down: ld,
5453
- up: cd
5541
+ down: fd,
5542
+ up: pd
5454
5543
  }, Symbol.toStringTag, { value: "Module" }));
5455
- async function ud(e) {
5544
+ async function wd(e) {
5456
5545
  await e.schema.dropTable("logs").ifExists().execute(), await e.schema.createTable("logs").addColumn("log_id", "varchar(21)", (t) => t.primaryKey().notNull()).addColumn("category", "varchar(255)").addColumn("tenant_id", "varchar(64)").addColumn("user_id", "varchar(64)").addColumn("ip", "varchar(255)").addColumn("type", "varchar(8)", (t) => t.notNull()).addColumn("date", "varchar(25)", (t) => t.notNull()).addColumn("client_id", "varchar(255)").addColumn("client_name", "varchar(255)").addColumn("user_agent", "varchar(255)").addColumn("description", "varchar(255)").addColumn("details", "varchar(2048)").addColumn("isMobile", "integer").addColumn("user_name", "varchar(255)").addColumn("connection", "varchar(255)").addColumn("connection_id", "varchar(255)").addColumn("audience", "varchar(255)").addColumn("scope", "varchar(255)").addColumn("strategy", "varchar(255)").addColumn("strategy_type", "varchar(255)").addColumn("hostname", "varchar(255)").addColumn("auth0_client", "varchar(8192)").addColumn("session_connection", "varchar(255)").execute();
5457
5546
  }
5458
- async function _d(e) {
5547
+ async function yd(e) {
5459
5548
  await e.schema.dropTable("logs").ifExists().execute(), await e.schema.createTable("logs").addColumn("id", "varchar(255)", (t) => t.primaryKey().notNull()).addColumn("category", "varchar(255)", (t) => t.notNull()).addColumn("tenant_id", "varchar(64)").addColumn("user_id", "varchar(64)").addColumn("ip", "varchar(255)").addColumn("type", "varchar(8)", (t) => t.notNull()).addColumn("date", "varchar(25)", (t) => t.notNull()).addColumn("client_id", "varchar(255)").addColumn("client_name", "varchar(255)").addColumn("user_agent", "varchar(255)").addColumn("description", "varchar(255)").addColumn("details", "varchar(2048)").execute();
5460
5549
  }
5461
- const md = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5550
+ const vd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5462
5551
  __proto__: null,
5463
- down: _d,
5464
- up: ud
5552
+ down: yd,
5553
+ up: wd
5465
5554
  }, Symbol.toStringTag, { value: "Module" }));
5466
- async function hd(e) {
5555
+ async function Cd(e) {
5467
5556
  await e.schema.alterTable("logs").addColumn("country_code", "varchar(2)").execute(), await e.schema.alterTable("logs").addColumn("city_name", "varchar(255)").execute(), await e.schema.alterTable("logs").addColumn("latitude", "varchar(255)").execute(), await e.schema.alterTable("logs").addColumn("longitude", "varchar(255)").execute(), await e.schema.alterTable("logs").addColumn("time_zone", "varchar(255)").execute(), await e.schema.alterTable("logs").addColumn("continent_code", "varchar(2)").execute();
5468
5557
  }
5469
- async function pd(e) {
5558
+ async function xd(e) {
5470
5559
  await e.schema.alterTable("logs").dropColumn("country_code").execute(), await e.schema.alterTable("logs").dropColumn("city_name").execute(), await e.schema.alterTable("logs").dropColumn("latitude").execute(), await e.schema.alterTable("logs").dropColumn("longitude").execute(), await e.schema.alterTable("logs").dropColumn("time_zone").execute(), await e.schema.alterTable("logs").dropColumn("continent_code").execute();
5471
5560
  }
5472
- const fd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5561
+ const Td = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5473
5562
  __proto__: null,
5474
- down: pd,
5475
- up: hd
5563
+ down: xd,
5564
+ up: Cd
5476
5565
  }, Symbol.toStringTag, { value: "Module" })), j = 1e3;
5477
- async function gd(e) {
5566
+ async function Nd(e) {
5478
5567
  await e.schema.createTable("password_history").addColumn("id", "varchar(21)", (n) => n.primaryKey()).addColumn("user_id", "varchar(191)", (n) => n.notNull()).addColumn(
5479
5568
  "tenant_id",
5480
5569
  "varchar(191)",
@@ -5506,7 +5595,7 @@ async function gd(e) {
5506
5595
  }
5507
5596
  for (const o of n)
5508
5597
  await e.insertInto("password_history").values({
5509
- id: k(),
5598
+ id: b(),
5510
5599
  user_id: o.user_id,
5511
5600
  tenant_id: o.tenant_id,
5512
5601
  password: o.password,
@@ -5519,7 +5608,7 @@ async function gd(e) {
5519
5608
  }
5520
5609
  await e.schema.alterTable("passwords").renameTo("passwords_backup").execute(), await e.schema.alterTable("password_history").renameTo("passwords").execute();
5521
5610
  }
5522
- async function wd(e) {
5611
+ async function Sd(e) {
5523
5612
  await e.schema.alterTable("passwords").renameTo("password_history").execute();
5524
5613
  try {
5525
5614
  await e.schema.alterTable("passwords_backup").renameTo("passwords").execute();
@@ -5567,56 +5656,56 @@ async function wd(e) {
5567
5656
  }
5568
5657
  await e.schema.dropTable("password_history").execute();
5569
5658
  }
5570
- const vd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5659
+ const bd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5571
5660
  __proto__: null,
5572
- down: wd,
5573
- up: gd
5661
+ down: Sd,
5662
+ up: Nd
5574
5663
  }, Symbol.toStringTag, { value: "Module" }));
5575
- async function yd(e) {
5664
+ async function Od(e) {
5576
5665
  await e.schema.alterTable("connections").addColumn("display_name", "varchar(255)").execute(), await e.schema.alterTable("connections").addColumn("is_domain_connection", "integer").execute(), await e.schema.alterTable("connections").addColumn("show_as_button", "integer").execute(), await e.schema.alterTable("connections").addColumn("metadata", "varchar(4096)").execute();
5577
5666
  }
5578
- async function Cd(e) {
5667
+ async function kd(e) {
5579
5668
  await e.schema.alterTable("connections").dropColumn("display_name").execute(), await e.schema.alterTable("connections").dropColumn("is_domain_connection").execute(), await e.schema.alterTable("connections").dropColumn("show_as_button").execute(), await e.schema.alterTable("connections").dropColumn("metadata").execute();
5580
5669
  }
5581
- const xd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5670
+ const $d = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5582
5671
  __proto__: null,
5583
- down: Cd,
5584
- up: yd
5672
+ down: kd,
5673
+ up: Od
5585
5674
  }, Symbol.toStringTag, { value: "Module" }));
5586
- async function Td(e) {
5675
+ async function Ed(e) {
5587
5676
  await e.schema.alterTable("clients").addColumn("connections", "text", (t) => t.notNull().defaultTo("[]")).execute();
5588
5677
  }
5589
- async function Nd(e) {
5678
+ async function Id(e) {
5590
5679
  await e.schema.alterTable("clients").dropColumn("connections").execute();
5591
5680
  }
5592
- const Sd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5681
+ const zd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5593
5682
  __proto__: null,
5594
- down: Nd,
5595
- up: Td
5683
+ down: Id,
5684
+ up: Ed
5596
5685
  }, Symbol.toStringTag, { value: "Module" }));
5597
- async function bd(e) {
5686
+ async function Pd(e) {
5598
5687
  await e.schema.createTable("flows").addColumn("id", "varchar(24)", (t) => t.primaryKey()).addColumn("tenant_id", "varchar(191)", (t) => t.notNull()).addColumn("name", "varchar(150)", (t) => t.notNull()).addColumn("actions", "text").addColumn("created_at", "varchar(35)", (t) => t.notNull()).addColumn("updated_at", "varchar(35)", (t) => t.notNull()).execute(), await e.schema.createIndex("flows_tenant_id_idx").on("flows").column("tenant_id").execute(), await e.schema.dropTable("passwords_backup").execute();
5599
5688
  }
5600
- async function Od(e) {
5689
+ async function Dd(e) {
5601
5690
  await e.schema.dropTable("flows").execute();
5602
5691
  }
5603
- const kd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5692
+ const Ad = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5604
5693
  __proto__: null,
5605
- down: Od,
5606
- up: bd
5694
+ down: Dd,
5695
+ up: Pd
5607
5696
  }, Symbol.toStringTag, { value: "Module" }));
5608
- async function $d(e) {
5697
+ async function jd(e) {
5609
5698
  await e.schema.alterTable("resource_servers").addColumn("is_system", "integer", (t) => t.defaultTo(0).notNull()).execute(), await e.schema.alterTable("roles").addColumn("is_system", "integer", (t) => t.defaultTo(0).notNull()).execute(), await e.schema.alterTable("connections").addColumn("is_system", "integer", (t) => t.defaultTo(0).notNull()).execute();
5610
5699
  }
5611
- async function Ed(e) {
5700
+ async function Fd(e) {
5612
5701
  await e.schema.alterTable("resource_servers").dropColumn("is_system").execute(), await e.schema.alterTable("roles").dropColumn("is_system").execute(), await e.schema.alterTable("connections").dropColumn("is_system").execute();
5613
5702
  }
5614
- const Id = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5703
+ const Rd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5615
5704
  __proto__: null,
5616
- down: Ed,
5617
- up: $d
5705
+ down: Fd,
5706
+ up: jd
5618
5707
  }, Symbol.toStringTag, { value: "Module" }));
5619
- async function zd(e) {
5708
+ async function Md(e) {
5620
5709
  const t = await e.selectFrom("keys").selectAll().execute();
5621
5710
  await e.schema.dropTable("keys").execute(), await h`ALTER TABLE connections RENAME TO connections_old`.execute(e), await e.schema.createTable("connections").addColumn("id", "varchar(255)", (a) => a.notNull()).addColumn(
5622
5711
  "tenant_id",
@@ -5649,7 +5738,7 @@ async function zd(e) {
5649
5738
  for (const a of t)
5650
5739
  await e.insertInto("keys").values(a).execute();
5651
5740
  }
5652
- async function Pd(e) {
5741
+ async function Jd(e) {
5653
5742
  const t = await e.selectFrom("keys").selectAll().execute();
5654
5743
  await e.schema.dropTable("keys").execute(), await h`ALTER TABLE connections RENAME TO connections_new`.execute(e), await e.schema.createTable("connections").addColumn("id", "varchar(255)", (a) => a.notNull().primaryKey()).addColumn(
5655
5744
  "tenant_id",
@@ -5686,12 +5775,12 @@ async function Pd(e) {
5686
5775
  for (const a of t)
5687
5776
  await e.insertInto("keys").values(a).execute();
5688
5777
  }
5689
- const Dd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5778
+ const Ld = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5690
5779
  __proto__: null,
5691
- down: Pd,
5692
- up: zd
5780
+ down: Jd,
5781
+ up: Md
5693
5782
  }, Symbol.toStringTag, { value: "Module" }));
5694
- async function Ad(e) {
5783
+ async function Kd(e) {
5695
5784
  await e.schema.alterTable("login_sessions").addColumn("state", "varchar(50)", (t) => t.defaultTo("pending")).execute(), await e.schema.alterTable("login_sessions").addColumn("state_data", "text").execute(), await e.schema.alterTable("login_sessions").addColumn("failure_reason", "text").execute(), await e.schema.alterTable("login_sessions").addColumn("user_id", "varchar(255)").execute(), await e.schema.createIndex("login_sessions_tenant_user_idx").on("login_sessions").columns(["tenant_id", "user_id"]).execute(), await e.updateTable("login_sessions").set({
5696
5785
  state: h`CASE
5697
5786
  WHEN login_completed = 1 THEN 'completed'
@@ -5700,28 +5789,28 @@ async function Ad(e) {
5700
5789
  END`
5701
5790
  }).execute(), await e.schema.alterTable("login_sessions").dropColumn("login_completed").execute(), await e.schema.createIndex("login_sessions_state_idx").on("login_sessions").column("state").execute(), await e.schema.createIndex("login_sessions_state_updated_idx").on("login_sessions").columns(["state", "updated_at"]).execute();
5702
5791
  }
5703
- async function jd(e) {
5792
+ async function qd(e) {
5704
5793
  await e.schema.alterTable("login_sessions").addColumn("login_completed", "integer", (t) => t.defaultTo(0)).execute(), await e.updateTable("login_sessions").set({
5705
5794
  login_completed: h`CASE WHEN state = 'completed' THEN 1 ELSE 0 END`
5706
5795
  }).execute(), await e.schema.dropIndex("login_sessions_state_updated_idx").execute(), await e.schema.dropIndex("login_sessions_state_idx").execute(), await e.schema.dropIndex("login_sessions_tenant_user_idx").execute(), await e.schema.alterTable("login_sessions").dropColumn("state").dropColumn("state_data").dropColumn("failure_reason").dropColumn("user_id").execute();
5707
5796
  }
5708
- const Fd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5797
+ const Ud = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5709
5798
  __proto__: null,
5710
- down: jd,
5711
- up: Ad
5799
+ down: qd,
5800
+ up: Kd
5712
5801
  }, Symbol.toStringTag, { value: "Module" }));
5713
- async function Rd(e) {
5802
+ async function Bd(e) {
5714
5803
  await e.schema.alterTable("roles").addColumn("metadata", "varchar(4096)").execute(), await e.schema.alterTable("resource_servers").addColumn("metadata", "varchar(4096)").execute();
5715
5804
  }
5716
- async function Md(e) {
5805
+ async function Qd(e) {
5717
5806
  await e.schema.alterTable("roles").dropColumn("metadata").execute(), await e.schema.alterTable("resource_servers").dropColumn("metadata").execute();
5718
5807
  }
5719
- const Jd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5808
+ const Hd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5720
5809
  __proto__: null,
5721
- down: Md,
5722
- up: Rd
5810
+ down: Qd,
5811
+ up: Bd
5723
5812
  }, Symbol.toStringTag, { value: "Module" }));
5724
- async function Ld(e) {
5813
+ async function Yd(e) {
5725
5814
  try {
5726
5815
  return await h`SELECT VERSION()`.execute(e), "mysql";
5727
5816
  } catch {
@@ -5741,8 +5830,8 @@ async function x(e, t, a, n) {
5741
5830
  throw o;
5742
5831
  }
5743
5832
  }
5744
- async function Kd(e) {
5745
- const t = await Ld(e);
5833
+ async function Wd(e) {
5834
+ const t = await Yd(e);
5746
5835
  await x(e, "refresh_tokens", "created_at_ts", "bigint"), await x(e, "refresh_tokens", "expires_at_ts", "bigint"), await x(e, "refresh_tokens", "idle_expires_at_ts", "bigint"), await x(e, "refresh_tokens", "last_exchanged_at_ts", "bigint"), await x(e, "sessions", "created_at_ts", "bigint"), await x(e, "sessions", "updated_at_ts", "bigint"), await x(e, "sessions", "expires_at_ts", "bigint"), await x(e, "sessions", "idle_expires_at_ts", "bigint"), await x(e, "sessions", "authenticated_at_ts", "bigint"), await x(e, "sessions", "last_interaction_at_ts", "bigint"), await x(e, "sessions", "used_at_ts", "bigint"), await x(e, "sessions", "revoked_at_ts", "bigint"), await x(e, "login_sessions", "created_at_ts", "bigint"), await x(e, "login_sessions", "updated_at_ts", "bigint"), await x(e, "login_sessions", "expires_at_ts", "bigint"), t === "mysql" && (await e.schema.alterTable("refresh_tokens").modifyColumn("created_at", "varchar(35)").execute(), await e.schema.alterTable("refresh_tokens").modifyColumn("expires_at", "varchar(35)").execute(), await e.schema.alterTable("sessions").modifyColumn("created_at", "varchar(35)").execute(), await e.schema.alterTable("sessions").modifyColumn("updated_at", "varchar(35)").execute(), await e.schema.alterTable("sessions").modifyColumn("expires_at", "varchar(35)").execute(), await e.schema.alterTable("login_sessions").modifyColumn("created_at", "varchar(35)").execute(), await e.schema.alterTable("login_sessions").modifyColumn("updated_at", "varchar(35)").execute(), await e.schema.alterTable("login_sessions").modifyColumn("expires_at", "varchar(35)").execute()), await e.schema.createIndex("idx_sessions_user_id").on("sessions").columns(["tenant_id", "user_id"]).execute(), await e.schema.createIndex("idx_refresh_tokens_user_id").on("refresh_tokens").columns(["tenant_id", "user_id"]).execute(), await e.schema.createIndex("idx_refresh_tokens_session_id").on("refresh_tokens").column("session_id").execute(), await e.schema.createIndex("idx_refresh_tokens_expires_at_ts").on("refresh_tokens").column("expires_at_ts").execute(), await e.schema.createIndex("idx_sessions_expires_at_ts").on("sessions").column("expires_at_ts").execute(), await e.schema.createIndex("idx_login_sessions_expires_at_ts").on("login_sessions").column("expires_at_ts").execute();
5747
5836
  }
5748
5837
  async function A(e, t, a) {
@@ -5763,15 +5852,15 @@ async function T(e, t, a) {
5763
5852
  throw n;
5764
5853
  }
5765
5854
  }
5766
- async function qd(e) {
5855
+ async function Gd(e) {
5767
5856
  await A(e, "idx_sessions_user_id", "sessions"), await A(e, "idx_refresh_tokens_user_id", "refresh_tokens"), await A(e, "idx_refresh_tokens_session_id", "refresh_tokens"), await A(e, "idx_refresh_tokens_expires_at_ts", "refresh_tokens"), await A(e, "idx_sessions_expires_at_ts", "sessions"), await A(e, "idx_login_sessions_expires_at_ts", "login_sessions"), await T(e, "refresh_tokens", "created_at_ts"), await T(e, "refresh_tokens", "expires_at_ts"), await T(e, "refresh_tokens", "idle_expires_at_ts"), await T(e, "refresh_tokens", "last_exchanged_at_ts"), await T(e, "sessions", "created_at_ts"), await T(e, "sessions", "updated_at_ts"), await T(e, "sessions", "expires_at_ts"), await T(e, "sessions", "idle_expires_at_ts"), await T(e, "sessions", "authenticated_at_ts"), await T(e, "sessions", "last_interaction_at_ts"), await T(e, "sessions", "used_at_ts"), await T(e, "sessions", "revoked_at_ts"), await T(e, "login_sessions", "created_at_ts"), await T(e, "login_sessions", "updated_at_ts"), await T(e, "login_sessions", "expires_at_ts");
5768
5857
  }
5769
- const Ud = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5858
+ const Vd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5770
5859
  __proto__: null,
5771
- down: qd,
5772
- up: Kd
5860
+ down: Gd,
5861
+ up: Wd
5773
5862
  }, Symbol.toStringTag, { value: "Module" }));
5774
- async function ye(e) {
5863
+ async function ve(e) {
5775
5864
  try {
5776
5865
  return await h`SELECT VERSION()`.execute(e), "mysql";
5777
5866
  } catch {
@@ -5792,8 +5881,8 @@ async function N(e, t, a) {
5792
5881
  throw n;
5793
5882
  }
5794
5883
  }
5795
- async function Bd(e) {
5796
- const t = await ye(e);
5884
+ async function Xd(e) {
5885
+ const t = await ve(e);
5797
5886
  console.log("Dropping indexes that depend on old date columns...");
5798
5887
  try {
5799
5888
  await h`DROP INDEX IF EXISTS login_sessions_state_updated_idx`.execute(
@@ -5806,48 +5895,48 @@ async function Bd(e) {
5806
5895
  }
5807
5896
  console.log("Dropping old date columns..."), await N(e, "refresh_tokens", "created_at"), await N(e, "refresh_tokens", "expires_at"), await N(e, "refresh_tokens", "idle_expires_at"), await N(e, "refresh_tokens", "last_exchanged_at"), await N(e, "sessions", "created_at"), await N(e, "sessions", "updated_at"), await N(e, "sessions", "expires_at"), await N(e, "sessions", "idle_expires_at"), await N(e, "sessions", "authenticated_at"), await N(e, "sessions", "last_interaction_at"), await N(e, "sessions", "used_at"), await N(e, "sessions", "revoked_at"), await N(e, "login_sessions", "created_at"), await N(e, "login_sessions", "updated_at"), await N(e, "login_sessions", "expires_at"), t === "mysql" && (console.log("Increasing ID column sizes for ULID support..."), await e.schema.alterTable("login_sessions").modifyColumn("id", "varchar(26)").execute(), await e.schema.alterTable("login_sessions").modifyColumn("session_id", "varchar(26)").execute(), await e.schema.alterTable("login_sessions").modifyColumn("csrf_token", "varchar(26)").execute(), await e.schema.alterTable("sessions").modifyColumn("id", "varchar(26)").execute(), await e.schema.alterTable("sessions").modifyColumn("login_session_id", "varchar(26)").execute(), await e.schema.alterTable("refresh_tokens").modifyColumn("id", "varchar(26)").execute(), await e.schema.alterTable("refresh_tokens").modifyColumn("session_id", "varchar(26)").execute()), console.log("Migration completed successfully");
5808
5897
  }
5809
- async function Qd(e) {
5810
- await ye(e) === "mysql" && (console.log("Restoring ID column sizes to varchar(21)..."), await e.schema.alterTable("login_sessions").modifyColumn("id", "varchar(21)").execute(), await e.schema.alterTable("login_sessions").modifyColumn("session_id", "varchar(21)").execute(), await e.schema.alterTable("login_sessions").modifyColumn("csrf_token", "varchar(21)").execute(), await e.schema.alterTable("sessions").modifyColumn("id", "varchar(21)").execute(), await e.schema.alterTable("sessions").modifyColumn("login_session_id", "varchar(21)").execute(), await e.schema.alterTable("refresh_tokens").modifyColumn("id", "varchar(21)").execute(), await e.schema.alterTable("refresh_tokens").modifyColumn("session_id", "varchar(21)").execute()), console.log("Re-adding old date columns (data will be empty)..."), await e.schema.alterTable("refresh_tokens").addColumn("created_at", "varchar(35)").execute(), await e.schema.alterTable("refresh_tokens").addColumn("expires_at", "varchar(35)").execute(), await e.schema.alterTable("refresh_tokens").addColumn("idle_expires_at", "varchar(35)").execute(), await e.schema.alterTable("refresh_tokens").addColumn("last_exchanged_at", "varchar(35)").execute(), await e.schema.alterTable("sessions").addColumn("created_at", "varchar(35)").execute(), await e.schema.alterTable("sessions").addColumn("updated_at", "varchar(35)").execute(), await e.schema.alterTable("sessions").addColumn("expires_at", "varchar(35)").execute(), await e.schema.alterTable("sessions").addColumn("idle_expires_at", "varchar(35)").execute(), await e.schema.alterTable("sessions").addColumn("authenticated_at", "varchar(35)").execute(), await e.schema.alterTable("sessions").addColumn("last_interaction_at", "varchar(35)").execute(), await e.schema.alterTable("sessions").addColumn("used_at", "varchar(35)").execute(), await e.schema.alterTable("sessions").addColumn("revoked_at", "varchar(35)").execute(), await e.schema.alterTable("login_sessions").addColumn("created_at", "varchar(35)").execute(), await e.schema.alterTable("login_sessions").addColumn("updated_at", "varchar(35)").execute(), await e.schema.alterTable("login_sessions").addColumn("expires_at", "varchar(35)").execute(), console.log("Rollback completed");
5898
+ async function Zd(e) {
5899
+ await ve(e) === "mysql" && (console.log("Restoring ID column sizes to varchar(21)..."), await e.schema.alterTable("login_sessions").modifyColumn("id", "varchar(21)").execute(), await e.schema.alterTable("login_sessions").modifyColumn("session_id", "varchar(21)").execute(), await e.schema.alterTable("login_sessions").modifyColumn("csrf_token", "varchar(21)").execute(), await e.schema.alterTable("sessions").modifyColumn("id", "varchar(21)").execute(), await e.schema.alterTable("sessions").modifyColumn("login_session_id", "varchar(21)").execute(), await e.schema.alterTable("refresh_tokens").modifyColumn("id", "varchar(21)").execute(), await e.schema.alterTable("refresh_tokens").modifyColumn("session_id", "varchar(21)").execute()), console.log("Re-adding old date columns (data will be empty)..."), await e.schema.alterTable("refresh_tokens").addColumn("created_at", "varchar(35)").execute(), await e.schema.alterTable("refresh_tokens").addColumn("expires_at", "varchar(35)").execute(), await e.schema.alterTable("refresh_tokens").addColumn("idle_expires_at", "varchar(35)").execute(), await e.schema.alterTable("refresh_tokens").addColumn("last_exchanged_at", "varchar(35)").execute(), await e.schema.alterTable("sessions").addColumn("created_at", "varchar(35)").execute(), await e.schema.alterTable("sessions").addColumn("updated_at", "varchar(35)").execute(), await e.schema.alterTable("sessions").addColumn("expires_at", "varchar(35)").execute(), await e.schema.alterTable("sessions").addColumn("idle_expires_at", "varchar(35)").execute(), await e.schema.alterTable("sessions").addColumn("authenticated_at", "varchar(35)").execute(), await e.schema.alterTable("sessions").addColumn("last_interaction_at", "varchar(35)").execute(), await e.schema.alterTable("sessions").addColumn("used_at", "varchar(35)").execute(), await e.schema.alterTable("sessions").addColumn("revoked_at", "varchar(35)").execute(), await e.schema.alterTable("login_sessions").addColumn("created_at", "varchar(35)").execute(), await e.schema.alterTable("login_sessions").addColumn("updated_at", "varchar(35)").execute(), await e.schema.alterTable("login_sessions").addColumn("expires_at", "varchar(35)").execute(), console.log("Rollback completed");
5811
5900
  }
5812
- const Hd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5901
+ const eu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5813
5902
  __proto__: null,
5814
- down: Qd,
5815
- up: Bd
5903
+ down: Zd,
5904
+ up: Xd
5816
5905
  }, Symbol.toStringTag, { value: "Module" }));
5817
- async function Yd(e) {
5906
+ async function tu(e) {
5818
5907
  await e.schema.alterTable("users").dropColumn("user_metadata").execute(), await e.schema.alterTable("users").addColumn("user_metadata", "text").execute(), await e.schema.alterTable("users").addColumn("middle_name", "varchar(100)").execute(), await e.schema.alterTable("users").addColumn("profile", "text").execute(), await e.schema.alterTable("users").addColumn("website", "text").execute(), await e.schema.alterTable("users").addColumn("gender", "varchar(50)").execute(), await e.schema.alterTable("users").addColumn("birthdate", "varchar(10)").execute(), await e.schema.alterTable("users").addColumn("zoneinfo", "varchar(100)").execute();
5819
5908
  }
5820
- async function Wd(e) {
5909
+ async function au(e) {
5821
5910
  await e.schema.alterTable("users").dropColumn("middle_name").execute(), await e.schema.alterTable("users").dropColumn("profile").execute(), await e.schema.alterTable("users").dropColumn("website").execute(), await e.schema.alterTable("users").dropColumn("gender").execute(), await e.schema.alterTable("users").dropColumn("birthdate").execute(), await e.schema.alterTable("users").dropColumn("zoneinfo").execute(), await e.schema.alterTable("users").dropColumn("user_metadata").execute(), await e.schema.alterTable("users").addColumn("user_metadata", "varchar(4096)").execute();
5822
5911
  }
5823
- const Gd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5912
+ const nu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5824
5913
  __proto__: null,
5825
- down: Wd,
5826
- up: Yd
5914
+ down: au,
5915
+ up: tu
5827
5916
  }, Symbol.toStringTag, { value: "Module" }));
5828
- async function Vd(e) {
5917
+ async function ou(e) {
5829
5918
  await e.schema.alterTable("users").addColumn("preferred_username", "varchar(255)").execute();
5830
5919
  }
5831
- async function Xd(e) {
5920
+ async function ru(e) {
5832
5921
  await e.schema.alterTable("users").dropColumn("preferred_username").execute();
5833
5922
  }
5834
- const Zd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5923
+ const su = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5835
5924
  __proto__: null,
5836
- down: Xd,
5837
- up: Vd
5925
+ down: ru,
5926
+ up: ou
5838
5927
  }, Symbol.toStringTag, { value: "Module" }));
5839
- async function eu(e) {
5928
+ async function iu(e) {
5840
5929
  await e.schema.alterTable("users").addColumn("address", "text").execute();
5841
5930
  }
5842
- async function tu(e) {
5931
+ async function cu(e) {
5843
5932
  await e.schema.alterTable("users").dropColumn("address").execute();
5844
5933
  }
5845
- const au = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5934
+ const lu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5846
5935
  __proto__: null,
5847
- down: tu,
5848
- up: eu
5936
+ down: cu,
5937
+ up: iu
5849
5938
  }, Symbol.toStringTag, { value: "Module" }));
5850
- async function nu(e) {
5939
+ async function du(e) {
5851
5940
  try {
5852
5941
  await e.schema.alterTable("login_sessions").addColumn("authParams_max_age", "integer").execute(), console.log(" Added column authParams_max_age to login_sessions");
5853
5942
  } catch (t) {
@@ -5863,7 +5952,7 @@ async function nu(e) {
5863
5952
  );
5864
5953
  }
5865
5954
  }
5866
- async function ou(e) {
5955
+ async function uu(e) {
5867
5956
  try {
5868
5957
  await e.schema.alterTable("login_sessions").dropColumn("authParams_max_age").execute();
5869
5958
  } catch (t) {
@@ -5879,38 +5968,38 @@ async function ou(e) {
5879
5968
  );
5880
5969
  }
5881
5970
  }
5882
- const ru = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5971
+ const _u = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5883
5972
  __proto__: null,
5884
- down: ou,
5885
- up: nu
5973
+ down: uu,
5974
+ up: du
5886
5975
  }, Symbol.toStringTag, { value: "Module" }));
5887
- async function su(e) {
5976
+ async function mu(e) {
5888
5977
  await e.schema.alterTable("clients").addColumn("auth0_conformant", "integer", (t) => t.defaultTo(1)).execute();
5889
5978
  }
5890
- async function iu(e) {
5979
+ async function hu(e) {
5891
5980
  await e.schema.alterTable("clients").dropColumn("auth0_conformant").execute();
5892
5981
  }
5893
- const cu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5982
+ const pu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5894
5983
  __proto__: null,
5895
- down: iu,
5896
- up: su
5984
+ down: hu,
5985
+ up: mu
5897
5986
  }, Symbol.toStringTag, { value: "Module" }));
5898
- async function lu(e) {
5987
+ async function fu(e) {
5899
5988
  await e.schema.createTable("universal_login_templates").addColumn(
5900
5989
  "tenant_id",
5901
5990
  "varchar(191)",
5902
5991
  (t) => t.primaryKey().references("tenants.id").onDelete("cascade")
5903
5992
  ).addColumn("body", "text", (t) => t.notNull()).addColumn("updated_at_ts", "integer", (t) => t.notNull()).addColumn("created_at_ts", "integer", (t) => t.notNull()).execute();
5904
5993
  }
5905
- async function du(e) {
5994
+ async function gu(e) {
5906
5995
  await e.schema.dropTable("universal_login_templates").execute();
5907
5996
  }
5908
- const uu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5997
+ const wu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5909
5998
  __proto__: null,
5910
- down: du,
5911
- up: lu
5999
+ down: gu,
6000
+ up: fu
5912
6001
  }, Symbol.toStringTag, { value: "Module" }));
5913
- async function _u(e) {
6002
+ async function yu(e) {
5914
6003
  await e.schema.createTable("custom_text").addColumn(
5915
6004
  "tenant_id",
5916
6005
  "varchar(191)",
@@ -5921,26 +6010,26 @@ async function _u(e) {
5921
6010
  "language"
5922
6011
  ]).execute();
5923
6012
  }
5924
- async function mu(e) {
6013
+ async function vu(e) {
5925
6014
  await e.schema.dropTable("custom_text").execute();
5926
6015
  }
5927
- const hu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6016
+ const Cu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5928
6017
  __proto__: null,
5929
- down: mu,
5930
- up: _u
6018
+ down: vu,
6019
+ up: yu
5931
6020
  }, Symbol.toStringTag, { value: "Module" }));
5932
- async function pu(e) {
6021
+ async function xu(e) {
5933
6022
  await e.schema.alterTable("tenants").addColumn("mfa", "text").execute();
5934
6023
  }
5935
- async function fu(e) {
6024
+ async function Tu(e) {
5936
6025
  await e.schema.alterTable("tenants").dropColumn("mfa").execute();
5937
6026
  }
5938
- const gu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6027
+ const Nu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5939
6028
  __proto__: null,
5940
- down: fu,
5941
- up: pu
6029
+ down: Tu,
6030
+ up: xu
5942
6031
  }, Symbol.toStringTag, { value: "Module" }));
5943
- async function wu(e) {
6032
+ async function Su(e) {
5944
6033
  try {
5945
6034
  return await h`SELECT VERSION()`.execute(e), "mysql";
5946
6035
  } catch {
@@ -5960,8 +6049,8 @@ async function Q(e, t, a, n) {
5960
6049
  throw o;
5961
6050
  }
5962
6051
  }
5963
- async function vu(e) {
5964
- const t = await wu(e);
6052
+ async function bu(e) {
6053
+ const t = await Su(e);
5965
6054
  await Q(e, "hooks", "template_id", "text"), await Q(e, "hooks", "created_at_ts", "bigint"), await Q(e, "hooks", "updated_at_ts", "bigint"), t === "mysql" ? await h`
5966
6055
  UPDATE hooks
5967
6056
  SET created_at_ts = UNIX_TIMESTAMP(created_at) * 1000,
@@ -5983,13 +6072,13 @@ async function H(e, t, a) {
5983
6072
  throw n;
5984
6073
  }
5985
6074
  }
5986
- async function yu(e) {
6075
+ async function Ou(e) {
5987
6076
  await H(e, "hooks", "template_id"), await H(e, "hooks", "created_at_ts"), await H(e, "hooks", "updated_at_ts");
5988
6077
  }
5989
- const Cu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6078
+ const ku = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5990
6079
  __proto__: null,
5991
- down: yu,
5992
- up: vu
6080
+ down: Ou,
6081
+ up: bu
5993
6082
  }, Symbol.toStringTag, { value: "Module" }));
5994
6083
  async function Ce(e) {
5995
6084
  try {
@@ -6012,7 +6101,7 @@ async function se(e, t, a) {
6012
6101
  throw n;
6013
6102
  }
6014
6103
  }
6015
- async function xu(e) {
6104
+ async function $u(e) {
6016
6105
  var r, s, i, c, d;
6017
6106
  const t = await Ce(e);
6018
6107
  console.log(
@@ -6051,7 +6140,7 @@ async function xu(e) {
6051
6140
  (u) => u.notNull().primaryKey()
6052
6141
  ).execute(), await e.schema.alterTable("hooks").modifyColumn("form_id", "varchar(128)").execute(), await e.schema.alterTable("hooks").modifyColumn("template_id", "varchar(64)").execute());
6053
6142
  }
6054
- async function Tu(e) {
6143
+ async function Eu(e) {
6055
6144
  const t = await Ce(e);
6056
6145
  await e.schema.alterTable("hooks").addColumn("created_at", "varchar(255)").execute(), await e.schema.alterTable("hooks").addColumn("updated_at", "varchar(255)").execute(), t === "mysql" ? await h`
6057
6146
  UPDATE hooks
@@ -6069,12 +6158,12 @@ async function Tu(e) {
6069
6158
  (a) => a.notNull().primaryKey()
6070
6159
  ).execute(), await e.schema.alterTable("hooks").modifyColumn("form_id", "text").execute(), await e.schema.alterTable("hooks").modifyColumn("template_id", "text").execute());
6071
6160
  }
6072
- const Nu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6161
+ const Iu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6073
6162
  __proto__: null,
6074
- down: Tu,
6075
- up: xu
6163
+ down: Eu,
6164
+ up: $u
6076
6165
  }, Symbol.toStringTag, { value: "Module" }));
6077
- async function Su(e) {
6166
+ async function zu(e) {
6078
6167
  const { rows: t } = await h`
6079
6168
  SELECT username, provider, tenant_id, COUNT(*) AS cnt
6080
6169
  FROM users
@@ -6110,24 +6199,24 @@ async function Su(e) {
6110
6199
  }
6111
6200
  await e.schema.createIndex("unique_username_provider").on("users").unique().columns(["username", "provider", "tenant_id"]).execute();
6112
6201
  }
6113
- async function bu(e) {
6202
+ async function Pu(e) {
6114
6203
  await e.schema.dropIndex("unique_username_provider").execute();
6115
6204
  }
6116
- const Ou = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6205
+ const Du = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6117
6206
  __proto__: null,
6118
- down: bu,
6119
- up: Su
6207
+ down: Pu,
6208
+ up: zu
6120
6209
  }, Symbol.toStringTag, { value: "Module" }));
6121
- async function ku(e) {
6210
+ async function Au(e) {
6122
6211
  await e.schema.alterTable("refresh_tokens").addColumn("login_id", "varchar(26)").execute(), await e.schema.createIndex("idx_refresh_tokens_login_id").on("refresh_tokens").column("login_id").execute();
6123
6212
  }
6124
- async function $u(e) {
6213
+ async function ju(e) {
6125
6214
  await e.schema.dropIndex("idx_refresh_tokens_login_id").execute(), await e.schema.alterTable("refresh_tokens").dropColumn("login_id").execute();
6126
6215
  }
6127
- const Eu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6216
+ const Fu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6128
6217
  __proto__: null,
6129
- down: $u,
6130
- up: ku
6218
+ down: ju,
6219
+ up: Au
6131
6220
  }, Symbol.toStringTag, { value: "Module" }));
6132
6221
  async function xe(e) {
6133
6222
  try {
@@ -6136,215 +6225,227 @@ async function xe(e) {
6136
6225
  return "sqlite";
6137
6226
  }
6138
6227
  }
6139
- async function Iu(e) {
6228
+ async function Ru(e) {
6140
6229
  await xe(e) === "mysql" ? (await e.schema.alterTable("refresh_tokens").modifyColumn("login_id", "varchar(26)", (a) => a.notNull()).execute(), await e.schema.dropIndex("idx_refresh_tokens_session_id").execute(), await e.schema.alterTable("refresh_tokens").dropColumn("session_id").execute()) : (await e.schema.dropIndex("idx_refresh_tokens_session_id").execute(), await e.schema.alterTable("refresh_tokens").dropColumn("session_id").execute());
6141
6230
  }
6142
- async function zu(e) {
6231
+ async function Mu(e) {
6143
6232
  await xe(e) === "mysql" ? (await e.schema.alterTable("refresh_tokens").addColumn("session_id", "varchar(26)").execute(), await e.schema.createIndex("idx_refresh_tokens_session_id").on("refresh_tokens").column("session_id").execute(), await e.schema.alterTable("refresh_tokens").modifyColumn("login_id", "varchar(26)").execute()) : await e.schema.alterTable("refresh_tokens").addColumn("session_id", "varchar(21)").execute();
6144
6233
  }
6145
- const Pu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6234
+ const Ju = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6146
6235
  __proto__: null,
6147
- down: zu,
6148
- up: Iu
6236
+ down: Mu,
6237
+ up: Ru
6149
6238
  }, Symbol.toStringTag, { value: "Module" }));
6150
- async function Du(e) {
6239
+ async function Lu(e) {
6151
6240
  await e.schema.createIndex("idx_sessions_idle_expires_at_ts").on("sessions").column("idle_expires_at_ts").execute(), await e.schema.createIndex("idx_refresh_tokens_idle_expires_at_ts").on("refresh_tokens").column("idle_expires_at_ts").execute();
6152
6241
  }
6153
- async function Au(e) {
6242
+ async function Ku(e) {
6154
6243
  await e.schema.dropIndex("idx_sessions_idle_expires_at_ts").on("sessions").execute(), await e.schema.dropIndex("idx_refresh_tokens_idle_expires_at_ts").on("refresh_tokens").execute();
6155
6244
  }
6156
- const ju = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6245
+ const qu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6157
6246
  __proto__: null,
6158
- down: Au,
6159
- up: Du
6247
+ down: Ku,
6248
+ up: Lu
6160
6249
  }, Symbol.toStringTag, { value: "Module" }));
6161
- async function Fu(e) {
6250
+ async function Uu(e) {
6162
6251
  await e.schema.alterTable("login_sessions").addColumn("auth_connection", "varchar(255)").execute();
6163
6252
  }
6164
- async function Ru(e) {
6253
+ async function Bu(e) {
6165
6254
  await e.schema.alterTable("login_sessions").dropColumn("auth_connection").execute();
6166
6255
  }
6167
- const Mu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6256
+ const Qu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6168
6257
  __proto__: null,
6169
- down: Ru,
6170
- up: Fu
6258
+ down: Bu,
6259
+ up: Uu
6171
6260
  }, Symbol.toStringTag, { value: "Module" }));
6172
- async function Ju(e) {
6261
+ async function Hu(e) {
6173
6262
  await e.schema.createTable("mfa_enrollments").addColumn("id", "varchar(26)", (t) => t.primaryKey()).addColumn(
6174
6263
  "tenant_id",
6175
6264
  "varchar(191)",
6176
6265
  (t) => t.references("tenants.id").onDelete("cascade").notNull()
6177
6266
  ).addColumn("user_id", "varchar(255)", (t) => t.notNull()).addColumn("type", "varchar(32)", (t) => t.notNull()).addColumn("phone_number", "varchar(32)").addColumn("totp_secret", "varchar(255)").addColumn("confirmed", "integer", (t) => t.notNull().defaultTo(0)).addColumn("created_at_ts", "bigint", (t) => t.notNull()).addColumn("updated_at_ts", "bigint", (t) => t.notNull()).execute(), await e.schema.createIndex("mfa_enrollments_tenant_user_idx").on("mfa_enrollments").columns(["tenant_id", "user_id"]).execute();
6178
6267
  }
6179
- async function Lu(e) {
6268
+ async function Yu(e) {
6180
6269
  await e.schema.dropTable("mfa_enrollments").execute();
6181
6270
  }
6182
- const Ku = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6271
+ const Wu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6183
6272
  __proto__: null,
6184
- down: Lu,
6185
- up: Ju
6273
+ down: Yu,
6274
+ up: Hu
6186
6275
  }, Symbol.toStringTag, { value: "Module" }));
6187
- async function qu(e) {
6276
+ async function Gu(e) {
6188
6277
  await e.schema.alterTable("codes").addColumn("otp", "varchar(32)").execute();
6189
6278
  }
6190
- async function Uu(e) {
6279
+ async function Vu(e) {
6191
6280
  await e.schema.alterTable("codes").dropColumn("otp").execute();
6192
6281
  }
6193
- const Bu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6282
+ const Xu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6194
6283
  __proto__: null,
6195
- down: Uu,
6196
- up: qu
6284
+ down: Vu,
6285
+ up: Gu
6197
6286
  }, Symbol.toStringTag, { value: "Module" }));
6198
- async function Qu(e) {
6287
+ async function Zu(e) {
6199
6288
  await e.schema.alterTable("mfa_enrollments").renameTo("authentication_methods").execute(), await e.schema.alterTable("authentication_methods").addColumn("credential_id", "varchar(512)").execute(), await e.schema.alterTable("authentication_methods").addColumn("public_key", "text").execute(), await e.schema.alterTable("authentication_methods").addColumn("sign_count", "integer").execute(), await e.schema.alterTable("authentication_methods").addColumn("credential_backed_up", "integer").execute(), await e.schema.alterTable("authentication_methods").addColumn("transports", "varchar(512)").execute(), await e.schema.alterTable("authentication_methods").addColumn("friendly_name", "varchar(255)").execute(), await e.schema.createIndex("authentication_methods_credential_id_idx").on("authentication_methods").column("credential_id").execute();
6200
6289
  }
6201
- async function Hu(e) {
6290
+ async function e_(e) {
6202
6291
  await e.schema.dropIndex("authentication_methods_credential_id_idx").execute(), await e.schema.alterTable("authentication_methods").dropColumn("friendly_name").execute(), await e.schema.alterTable("authentication_methods").dropColumn("transports").execute(), await e.schema.alterTable("authentication_methods").dropColumn("credential_backed_up").execute(), await e.schema.alterTable("authentication_methods").dropColumn("sign_count").execute(), await e.schema.alterTable("authentication_methods").dropColumn("public_key").execute(), await e.schema.alterTable("authentication_methods").dropColumn("credential_id").execute(), await e.schema.alterTable("authentication_methods").renameTo("mfa_enrollments").execute();
6203
6292
  }
6204
- const Yu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6293
+ const t_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6294
+ __proto__: null,
6295
+ down: e_,
6296
+ up: Zu
6297
+ }, Symbol.toStringTag, { value: "Module" }));
6298
+ async function a_(e) {
6299
+ await e.schema.createTable("outbox_events").addColumn("id", "varchar(21)", (t) => t.primaryKey()).addColumn("tenant_id", "varchar(191)", (t) => t.notNull()).addColumn("event_type", "varchar(255)", (t) => t.notNull()).addColumn("log_type", "varchar(64)", (t) => t.notNull()).addColumn("aggregate_type", "varchar(64)", (t) => t.notNull()).addColumn("aggregate_id", "varchar(255)", (t) => t.notNull()).addColumn("payload", "text", (t) => t.notNull()).addColumn("created_at", "varchar(35)", (t) => t.notNull()).addColumn("processed_at", "varchar(35)").addColumn("retry_count", "integer", (t) => t.notNull().defaultTo(0)).addColumn("next_retry_at", "varchar(35)").addColumn("error", "text").execute(), await e.schema.createIndex("idx_outbox_unprocessed").on("outbox_events").columns(["processed_at", "created_at"]).execute(), await e.schema.createIndex("idx_outbox_tenant_type").on("outbox_events").columns(["tenant_id", "event_type", "created_at"]).execute();
6300
+ }
6301
+ async function n_(e) {
6302
+ await e.schema.dropTable("outbox_events").execute();
6303
+ }
6304
+ const o_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6205
6305
  __proto__: null,
6206
- down: Hu,
6207
- up: Qu
6306
+ down: n_,
6307
+ up: a_
6208
6308
  }, Symbol.toStringTag, { value: "Module" })), Te = {
6209
- m1_init: _o,
6210
- m2_magicLink: po,
6211
- m3_updateAt: wo,
6212
- m4_logTable: Co,
6213
- m5_userProfile: No,
6214
- m6_sessions: Oo,
6215
- m7_passwords: Eo,
6216
- m8_logsTableNewFields: Po,
6217
- m9_passwordTableNewField: jo,
6218
- n01_codesTable: Mo,
6219
- n11_universalLoginSession: Ko,
6220
- n12_userFields: Bo,
6221
- n13_userEmailIndex: Yo,
6222
- n14_profileDataField: Vo,
6223
- n15_userEmailIndex: er,
6224
- n16_userLocale: nr,
6225
- n17_signingKeys: sr,
6226
- n18_logsFields: lr,
6227
- n19_connectionsUserinfo: _r,
6228
- n20_missingFields: pr,
6229
- n21_sessionDeletedAt: wr,
6230
- n22_dropLogsFields: Cr,
6231
- n23_dropUsersFields: Nr,
6232
- n24_logsIndexes: Or,
6233
- n25_logDescMaxLength: Er,
6234
- n26_logsTableExtraFields: Pr,
6235
- n27_usersTableNameIndex: jr,
6236
- n28_usersEmailConstrain: Mr,
6237
- n29_increaseOtpStateLength: Kr,
6238
- n30_increaseTicketStateLength: Br,
6239
- n31_branding: Yr,
6240
- n32_indexesAndNotNull: Vr,
6241
- n33_vendorIdInUniversalLoginSession: es,
6242
- n34_auth0ClientInUniversalLoginSession: ns,
6243
- n35_increaseUniversalSessionStateLength: ss,
6244
- n36_authenticationCodes: ls,
6245
- n37_disableSignUps: _s,
6246
- n38_otpIpAddress: ps,
6247
- n39_increaseUserAgentLength: ws,
6248
- n40_userId: Cs,
6249
- n41_hooks: Ns,
6250
- n42_userIdIndexes: Os,
6251
- n43_userIdIndexes: Es,
6252
- n44_codes: Ps,
6253
- n45_hookProperties: js,
6254
- n46_loginAuth0Client: Ms,
6255
- n47_loginAuth0Client: Ks,
6256
- n48_saml: Bs,
6257
- n49_removeFields: Ys,
6258
- n50_authParamsNonce: Vs,
6259
- n51_connectionid: ei,
6260
- n52_cert: ni,
6261
- n53_codes_primary_key: si,
6262
- n54_cleanup_tables: li,
6263
- n55_logs_index: _i,
6264
- n56_application_fields: pi,
6265
- n57_prompt_settings: wi,
6266
- n58_connection_client_id: Ci,
6267
- n59_connection_options: Ni,
6268
- n60_users_metadata: Oi,
6269
- n61_userLocales: Ei,
6270
- n62_prompt: Pi,
6271
- n63_connection_cleanup: ji,
6272
- n64_act_as: Mi,
6273
- n65_code_verifier: Ki,
6274
- n66_email_providers: Bi,
6275
- n67_drop_tickets: Yi,
6276
- n68_login_useragents: Vi,
6277
- n70_refresh_tokens: ec,
6278
- n71_session_new_fields: nc,
6279
- n72_session_primary_key: sc,
6280
- n73_drop_sessions: lc,
6281
- n74_custom_domains: _c,
6282
- n75_organizations: pc,
6283
- n76_authorization_url_length: wc,
6284
- n77_drop_sessions: Cc,
6285
- n78_login_sessions: Nc,
6286
- n79_drop_sessions_2: Oc,
6287
- n80_recreate_custom_domains: Ec,
6288
- n81_phone: Pc,
6289
- n82_forms: jc,
6290
- n83_addFormsIdToHooks: Mc,
6291
- n84_login_completed: Kc,
6292
- n85_add_login_session_id_to_sessions: Bc,
6293
- n86_index_sessions_login_session_id: Yc,
6294
- n87_code_challenge: Vc,
6295
- n88_add_redirect_uri_to_codes: el,
6296
- n89_add_nonce_and_state_to_codes: nl,
6297
- n90_themes: sl,
6298
- n91_resource_servers_rules_permissions: ll,
6299
- n92_role_permissions: _l,
6300
- n93_add_permissions_to_roles: pl,
6301
- n94_keys_connection_and_extend_columns: wl,
6302
- n95_create_organizations_table: Cl,
6303
- n96_create_user_organizations_table: Nl,
6304
- n97_add_organization_to_user_permissions_and_roles: Ol,
6305
- n98_clients: El,
6306
- n99_update_client_foreign_keys: Fl,
6307
- o001_client_grants: Jl,
6308
- o002_drop_applications: ql,
6309
- o003_phone_number_index: Ql,
6310
- o004_login_sessions_id_index: Wl,
6311
- o005_connections_tenant_index: Xl,
6312
- o006_remove_redundant_user_organizations_tenant_index: td,
6313
- o007_tenant_settings: od,
6314
- o008_merge_tenant_settings_into_tenants: id,
6315
- o009_create_invites_table: dd,
6316
- o010_add_log_id_to_logs: md,
6317
- o011_add_location_info_to_logs: fd,
6318
- o012_add_password_history: vd,
6319
- o013_connection_display_name: xd,
6320
- o014_client_connections: Sd,
6321
- o015_flows: kd,
6322
- o016_add_is_system_column: Id,
6323
- o017_connections_composite_key: Dd,
6324
- o018_login_session_state: Fd,
6325
- o019_roles_resource_servers_metadata: Jd,
6326
- o020_session_add_timestamp_columns: Ud,
6327
- o021_session_cleanup_and_ulid: Hd,
6328
- o022_oidc_profile_claims: Gd,
6329
- o023_preferred_username: Zd,
6330
- o024_user_address: au,
6331
- o025_authparams_max_age: ru,
6332
- o026_auth0_conformant: cu,
6333
- o027_universal_login_templates: uu,
6334
- o028_custom_text: hu,
6335
- o029_guardian_mfa: gu,
6336
- o030_add_template_id_to_hooks: Cu,
6337
- o031_hooks_cleanup: Nu,
6338
- o032_unique_username_provider: Ou,
6339
- o033_add_login_id_to_refresh_tokens: Eu,
6340
- o034_refresh_tokens_replace_session_id_with_login_id: Pu,
6341
- o035_idle_expires_at_ts_indexes: ju,
6342
- o036_add_connection_to_login_sessions: Mu,
6343
- o037_mfa_enrollments: Ku,
6344
- o038_add_otp_to_codes: Bu,
6345
- o039_rename_mfa_enrollments_to_authentication_methods: Yu
6309
+ m1_init: yo,
6310
+ m2_magicLink: xo,
6311
+ m3_updateAt: So,
6312
+ m4_logTable: ko,
6313
+ m5_userProfile: Io,
6314
+ m6_sessions: Do,
6315
+ m7_passwords: Fo,
6316
+ m8_logsTableNewFields: Jo,
6317
+ m9_passwordTableNewField: qo,
6318
+ n01_codesTable: Qo,
6319
+ n11_universalLoginSession: Wo,
6320
+ n12_userFields: Xo,
6321
+ n13_userEmailIndex: tr,
6322
+ n14_profileDataField: or,
6323
+ n15_userEmailIndex: ir,
6324
+ n16_userLocale: dr,
6325
+ n17_signingKeys: mr,
6326
+ n18_logsFields: fr,
6327
+ n19_connectionsUserinfo: yr,
6328
+ n20_missingFields: xr,
6329
+ n21_sessionDeletedAt: Sr,
6330
+ n22_dropLogsFields: kr,
6331
+ n23_dropUsersFields: Ir,
6332
+ n24_logsIndexes: Dr,
6333
+ n25_logDescMaxLength: Fr,
6334
+ n26_logsTableExtraFields: Jr,
6335
+ n27_usersTableNameIndex: qr,
6336
+ n28_usersEmailConstrain: Qr,
6337
+ n29_increaseOtpStateLength: Wr,
6338
+ n30_increaseTicketStateLength: Xr,
6339
+ n31_branding: ts,
6340
+ n32_indexesAndNotNull: os,
6341
+ n33_vendorIdInUniversalLoginSession: is,
6342
+ n34_auth0ClientInUniversalLoginSession: ds,
6343
+ n35_increaseUniversalSessionStateLength: ms,
6344
+ n36_authenticationCodes: fs,
6345
+ n37_disableSignUps: ys,
6346
+ n38_otpIpAddress: xs,
6347
+ n39_increaseUserAgentLength: Ss,
6348
+ n40_userId: ks,
6349
+ n41_hooks: Is,
6350
+ n42_userIdIndexes: Ds,
6351
+ n43_userIdIndexes: Fs,
6352
+ n44_codes: Js,
6353
+ n45_hookProperties: qs,
6354
+ n46_loginAuth0Client: Qs,
6355
+ n47_loginAuth0Client: Ws,
6356
+ n48_saml: Xs,
6357
+ n49_removeFields: ti,
6358
+ n50_authParamsNonce: oi,
6359
+ n51_connectionid: ii,
6360
+ n52_cert: di,
6361
+ n53_codes_primary_key: mi,
6362
+ n54_cleanup_tables: fi,
6363
+ n55_logs_index: yi,
6364
+ n56_application_fields: xi,
6365
+ n57_prompt_settings: Si,
6366
+ n58_connection_client_id: ki,
6367
+ n59_connection_options: Ii,
6368
+ n60_users_metadata: Di,
6369
+ n61_userLocales: Fi,
6370
+ n62_prompt: Ji,
6371
+ n63_connection_cleanup: qi,
6372
+ n64_act_as: Qi,
6373
+ n65_code_verifier: Wi,
6374
+ n66_email_providers: Xi,
6375
+ n67_drop_tickets: tc,
6376
+ n68_login_useragents: oc,
6377
+ n70_refresh_tokens: ic,
6378
+ n71_session_new_fields: dc,
6379
+ n72_session_primary_key: mc,
6380
+ n73_drop_sessions: fc,
6381
+ n74_custom_domains: yc,
6382
+ n75_organizations: xc,
6383
+ n76_authorization_url_length: Sc,
6384
+ n77_drop_sessions: kc,
6385
+ n78_login_sessions: Ic,
6386
+ n79_drop_sessions_2: Dc,
6387
+ n80_recreate_custom_domains: Fc,
6388
+ n81_phone: Jc,
6389
+ n82_forms: qc,
6390
+ n83_addFormsIdToHooks: Qc,
6391
+ n84_login_completed: Wc,
6392
+ n85_add_login_session_id_to_sessions: Xc,
6393
+ n86_index_sessions_login_session_id: tl,
6394
+ n87_code_challenge: ol,
6395
+ n88_add_redirect_uri_to_codes: il,
6396
+ n89_add_nonce_and_state_to_codes: dl,
6397
+ n90_themes: ml,
6398
+ n91_resource_servers_rules_permissions: fl,
6399
+ n92_role_permissions: yl,
6400
+ n93_add_permissions_to_roles: xl,
6401
+ n94_keys_connection_and_extend_columns: Sl,
6402
+ n95_create_organizations_table: kl,
6403
+ n96_create_user_organizations_table: Il,
6404
+ n97_add_organization_to_user_permissions_and_roles: Dl,
6405
+ n98_clients: Fl,
6406
+ n99_update_client_foreign_keys: Ul,
6407
+ o001_client_grants: Hl,
6408
+ o002_drop_applications: Gl,
6409
+ o003_phone_number_index: Zl,
6410
+ o004_login_sessions_id_index: ad,
6411
+ o005_connections_tenant_index: rd,
6412
+ o006_remove_redundant_user_organizations_tenant_index: cd,
6413
+ o007_tenant_settings: ud,
6414
+ o008_merge_tenant_settings_into_tenants: hd,
6415
+ o009_create_invites_table: gd,
6416
+ o010_add_log_id_to_logs: vd,
6417
+ o011_add_location_info_to_logs: Td,
6418
+ o012_add_password_history: bd,
6419
+ o013_connection_display_name: $d,
6420
+ o014_client_connections: zd,
6421
+ o015_flows: Ad,
6422
+ o016_add_is_system_column: Rd,
6423
+ o017_connections_composite_key: Ld,
6424
+ o018_login_session_state: Ud,
6425
+ o019_roles_resource_servers_metadata: Hd,
6426
+ o020_session_add_timestamp_columns: Vd,
6427
+ o021_session_cleanup_and_ulid: eu,
6428
+ o022_oidc_profile_claims: nu,
6429
+ o023_preferred_username: su,
6430
+ o024_user_address: lu,
6431
+ o025_authparams_max_age: _u,
6432
+ o026_auth0_conformant: pu,
6433
+ o027_universal_login_templates: wu,
6434
+ o028_custom_text: Cu,
6435
+ o029_guardian_mfa: Nu,
6436
+ o030_add_template_id_to_hooks: ku,
6437
+ o031_hooks_cleanup: Iu,
6438
+ o032_unique_username_provider: Du,
6439
+ o033_add_login_id_to_refresh_tokens: Fu,
6440
+ o034_refresh_tokens_replace_session_id_with_login_id: Ju,
6441
+ o035_idle_expires_at_ts_indexes: qu,
6442
+ o036_add_connection_to_login_sessions: Qu,
6443
+ o037_mfa_enrollments: Wu,
6444
+ o038_add_otp_to_codes: Xu,
6445
+ o039_rename_mfa_enrollments_to_authentication_methods: t_,
6446
+ o040_create_outbox_events: o_
6346
6447
  };
6347
- async function e_(e, t = !1) {
6448
+ async function u_(e, t = !1) {
6348
6449
  t && console.log("migrating...");
6349
6450
  const a = new we(Te), n = new ce({
6350
6451
  db: e,
@@ -6357,7 +6458,7 @@ async function e_(e, t = !1) {
6357
6458
  }), o)
6358
6459
  throw console.error("failed to migrate"), console.error(o), o;
6359
6460
  }
6360
- async function t_(e) {
6461
+ async function __(e) {
6361
6462
  console.log("migrating...");
6362
6463
  const t = new we(Te), a = new ce({
6363
6464
  db: e,
@@ -6368,8 +6469,8 @@ async function t_(e) {
6368
6469
  }), n)
6369
6470
  throw console.error("failed to migrate"), console.error(n), n;
6370
6471
  }
6371
- function a_(e, t = { useTransactions: !0 }) {
6372
- return {
6472
+ function r_(e, t = { useTransactions: !0 }) {
6473
+ const a = {
6373
6474
  branding: ga(e),
6374
6475
  clients: Bt(e),
6375
6476
  clientConnections: Vt(e),
@@ -6403,11 +6504,19 @@ function a_(e, t = { useTransactions: !0 }) {
6403
6504
  users: Ke(e, t),
6404
6505
  organizations: Ln(e),
6405
6506
  userOrganizations: Yn(e),
6406
- stats: ao(e)
6507
+ stats: ao(e),
6508
+ outbox: fo(e),
6509
+ async transaction(n) {
6510
+ return t.useTransactions === !1 ? n(a) : e.transaction().execute(async (o) => {
6511
+ const r = r_(o, t);
6512
+ return n(r);
6513
+ });
6514
+ }
6407
6515
  };
6516
+ return a;
6408
6517
  }
6409
6518
  export {
6410
- a_ as default,
6411
- t_ as migrateDown,
6412
- e_ as migrateToLatest
6519
+ r_ as default,
6520
+ __ as migrateDown,
6521
+ u_ as migrateToLatest
6413
6522
  };