@authhero/kysely-adapter 8.3.0 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
1
  var Ee = Object.defineProperty;
2
- var de = (t) => {
2
+ var le = (t) => {
3
3
  throw TypeError(t);
4
4
  };
5
5
  var Je = (t, e, a) => e in t ? Ee(t, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[e] = a;
6
- var P = (t, e, a) => Je(t, typeof e != "symbol" ? e + "" : e, a), R = (t, e, a) => e.has(t) || de("Cannot " + a);
7
- var d = (t, e, a) => (R(t, e, "read from private field"), a ? a.call(t) : e.get(t)), y = (t, e, a) => e.has(t) ? de("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, a), M = (t, e, a, r) => (R(t, e, "write to private field"), r ? r.call(t, a) : e.set(t, a), a), u = (t, e, a) => (R(t, e, "access private method"), a);
6
+ var P = (t, e, a) => Je(t, typeof e != "symbol" ? e + "" : e, a), R = (t, e, a) => e.has(t) || le("Cannot " + a);
7
+ var d = (t, e, a) => (R(t, e, "read from private field"), a ? a.call(t) : e.get(t)), y = (t, e, a) => e.has(t) ? le("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, a), M = (t, e, a, r) => (R(t, e, "write to private field"), r ? r.call(t, a) : e.set(t, a), a), u = (t, e, a) => (R(t, e, "access private method"), a);
8
8
  import { parseUserId as Y, codeSchema as ze, connectionSchema as Ke, loginSchema as Re, promptSettingSchema as Ue } from "@authhero/adapter-interfaces";
9
9
  import "@hono/zod-openapi";
10
10
  var V = class extends Error {
@@ -83,7 +83,7 @@ function Qe(t) {
83
83
  ]);
84
84
  if (!r)
85
85
  return null;
86
- const { tenant_id: n, ...s } = r, c = {
86
+ const { tenant_id: n, ...s } = r, l = {
87
87
  ...s,
88
88
  email: r.email || "",
89
89
  email_verified: r.email_verified === 1,
@@ -100,18 +100,18 @@ function Qe(t) {
100
100
  ...o.map(fe)
101
101
  ]
102
102
  };
103
- return _(c);
103
+ return _(l);
104
104
  };
105
105
  }
106
- function T(t, e, a, r) {
106
+ function O(t, e, a, r) {
107
107
  return a.split(/\s+/).map((n) => n.replace(/^([^:]+)=/g, "$1:")).map((n) => {
108
- let s = n.startsWith("-"), c, l, g, m;
109
- return n.startsWith("-_exists_:") ? (c = n.substring(10), g = !0, s = !0) : n.startsWith("_exists_:") ? (c = n.substring(9), g = !0, s = !1) : n.includes(":") ? (s = n.startsWith("-"), [c, l] = s ? n.substring(1).split(":") : n.split(":"), g = !1, l.startsWith(">=") ? (m = ">=", l = l.substring(2)) : l.startsWith(">") ? (m = ">", l = l.substring(1)) : l.startsWith("<=") ? (m = "<=", l = l.substring(2)) : l.startsWith("<") ? (m = "<", l = l.substring(1)) : m = "=") : (c = null, l = n, g = !1), { key: c, value: l, isNegation: s, isExistsQuery: g, operator: m };
110
- }).forEach(({ key: n, value: s, isNegation: c, isExistsQuery: l, operator: g }) => {
108
+ let s = n.startsWith("-"), l, c, g, m;
109
+ return n.startsWith("-_exists_:") ? (l = n.substring(10), g = !0, s = !0) : n.startsWith("_exists_:") ? (l = n.substring(9), g = !0, s = !1) : n.includes(":") ? (s = n.startsWith("-"), [l, c] = s ? n.substring(1).split(":") : n.split(":"), g = !1, c.startsWith(">=") ? (m = ">=", c = c.substring(2)) : c.startsWith(">") ? (m = ">", c = c.substring(1)) : c.startsWith("<=") ? (m = "<=", c = c.substring(2)) : c.startsWith("<") ? (m = "<", c = c.substring(1)) : m = "=") : (l = null, c = n, g = !1), { key: l, value: c, isNegation: s, isExistsQuery: g, operator: m };
110
+ }).forEach(({ key: n, value: s, isNegation: l, isExistsQuery: c, operator: g }) => {
111
111
  if (n)
112
- if (l)
113
- c ? e = e.where(n, "is", null) : e = e.where(n, "is not", null);
114
- else if (c)
112
+ if (c)
113
+ l ? e = e.where(n, "is", null) : e = e.where(n, "is not", null);
114
+ else if (l)
115
115
  switch (g) {
116
116
  case ">":
117
117
  e = e.where(n, "<=", s);
@@ -134,13 +134,13 @@ function T(t, e, a, r) {
134
134
  const { ref: m } = t.dynamic;
135
135
  e = e.where(
136
136
  (w) => w.or(
137
- r.map((x) => w(m(x), "like", `%${s}%`))
137
+ r.map((b) => w(m(b), "like", `%${s}%`))
138
138
  )
139
139
  );
140
140
  }
141
141
  }), e;
142
142
  }
143
- function b(t) {
143
+ function x(t) {
144
144
  return typeof t == "string" ? parseInt(t, 10) : typeof t == "bigint" ? Number(t) : t;
145
145
  }
146
146
  function Ve(t) {
@@ -150,13 +150,13 @@ function Ve(t) {
150
150
  include_totals: !1
151
151
  }) => {
152
152
  let r = t.selectFrom("users").where("users.tenant_id", "=", e);
153
- if (a.q && (r = T(t, r, a.q, ["email", "name"])), a.sort && a.sort.sort_by) {
153
+ if (a.q && (r = O(t, r, a.q, ["email", "name"])), a.sort && a.sort.sort_by) {
154
154
  const { ref: m } = t.dynamic;
155
155
  r = r.orderBy(m(a.sort.sort_by), a.sort.sort_order);
156
156
  }
157
- const n = await r.offset(a.page * a.per_page).limit(a.per_page).selectAll().execute(), s = n.map((m) => m.user_id), c = s.length ? await t.selectFrom("users").selectAll().where("users.tenant_id", "=", e).where("users.linked_to", "in", s).execute() : [], l = n.map((m) => {
158
- const w = c.filter(
159
- (x) => x.linked_to === m.user_id
157
+ const n = await r.offset(a.page * a.per_page).limit(a.per_page).selectAll().execute(), s = n.map((m) => m.user_id), l = s.length ? await t.selectFrom("users").selectAll().where("users.tenant_id", "=", e).where("users.linked_to", "in", s).execute() : [], c = n.map((m) => {
158
+ const w = l.filter(
159
+ (b) => b.linked_to === m.user_id
160
160
  );
161
161
  return _({
162
162
  ...m,
@@ -176,17 +176,17 @@ function Ve(t) {
176
176
  });
177
177
  }), { count: g } = await r.select((m) => m.fn.countAll().as("count")).executeTakeFirstOrThrow();
178
178
  return {
179
- users: l,
179
+ users: c,
180
180
  start: a.page * a.per_page,
181
181
  limit: a.per_page,
182
- length: b(g)
182
+ length: x(g)
183
183
  };
184
184
  };
185
185
  }
186
- function qe(t) {
186
+ function We(t) {
187
187
  return async (e, a) => (await t.deleteFrom("users").where("users.tenant_id", "=", e).where("users.linked_to", "=", a).execute(), (await t.deleteFrom("users").where("users.tenant_id", "=", e).where("users.user_id", "=", a).execute()).length === 1);
188
188
  }
189
- function We(t) {
189
+ function qe(t) {
190
190
  if (t.email_verified !== void 0)
191
191
  return t.email_verified ? 1 : 0;
192
192
  }
@@ -194,7 +194,7 @@ function Ge(t) {
194
194
  return async (e, a, r) => {
195
195
  const o = {
196
196
  ...r,
197
- email_verified: We(r),
197
+ email_verified: qe(r),
198
198
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
199
199
  };
200
200
  return r.app_metadata && (o.app_metadata = JSON.stringify(r.app_metadata)), r.user_metadata && (o.user_metadata = JSON.stringify(r.user_metadata)), (await t.updateTable("users").set(o).where("users.tenant_id", "=", e).where("users.user_id", "=", a).execute()).length === 1;
@@ -209,7 +209,7 @@ function He(t) {
209
209
  function Xe(t) {
210
210
  return {
211
211
  create: Be(t),
212
- remove: qe(t),
212
+ remove: We(t),
213
213
  get: Qe(t),
214
214
  list: Ve(t),
215
215
  update: Ge(t),
@@ -249,16 +249,16 @@ function tt(t) {
249
249
  }) => {
250
250
  let a = t.selectFrom("tenants");
251
251
  if (e.sort && e.sort.sort_by) {
252
- const { ref: c } = t.dynamic;
253
- a = a.orderBy(c(e.sort.sort_by), e.sort.sort_order);
252
+ const { ref: l } = t.dynamic;
253
+ a = a.orderBy(l(e.sort.sort_by), e.sort.sort_order);
254
254
  }
255
- e.q && (a = a.where((c) => c.or([c("name", "like", `%${e.q}%`)])));
255
+ e.q && (a = a.where((l) => l.or([l("name", "like", `%${e.q}%`)])));
256
256
  const o = await a.offset(e.page * e.per_page).limit(e.per_page).selectAll().execute();
257
257
  if (!e.include_totals)
258
258
  return {
259
259
  tenants: o
260
260
  };
261
- const { count: n } = await a.select((c) => c.fn.countAll().as("count")).executeTakeFirstOrThrow(), s = b(n);
261
+ const { count: n } = await a.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow(), s = x(n);
262
262
  return {
263
263
  tenants: o.map(_),
264
264
  start: (e.page - 1) * e.per_page,
@@ -342,22 +342,22 @@ function it(t) {
342
342
  include_totals: !1
343
343
  }) => {
344
344
  let r = t.selectFrom("logs").where("logs.tenant_id", "=", e);
345
- a.q && (r = T(t, r, a.q, ["user_id", "ip"]));
345
+ a.q && (r = O(t, r, a.q, ["user_id", "ip"]));
346
346
  let o = r;
347
347
  if (a.sort && a.sort.sort_by) {
348
- const { ref: c } = t.dynamic;
348
+ const { ref: l } = t.dynamic;
349
349
  o = o.orderBy(
350
- c(a.sort.sort_by),
350
+ l(a.sort.sort_by),
351
351
  a.sort.sort_order
352
352
  );
353
353
  }
354
354
  o = o.offset(a.page * a.per_page).limit(a.per_page);
355
- const n = await o.selectAll().execute(), { count: s } = await r.select((c) => c.fn.countAll().as("count")).executeTakeFirstOrThrow();
355
+ const n = await o.selectAll().execute(), { count: s } = await r.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow();
356
356
  return {
357
357
  logs: n.map(pe),
358
358
  start: a.page * a.per_page,
359
359
  limit: a.per_page,
360
- length: b(s)
360
+ length: x(s)
361
361
  };
362
362
  };
363
363
  }
@@ -367,21 +367,21 @@ function ct(t) {
367
367
  return r ? pe(r) : null;
368
368
  };
369
369
  }
370
- function lt(t) {
370
+ function dt(t) {
371
371
  return {
372
372
  create: st(t),
373
373
  list: it(t),
374
374
  get: ct(t)
375
375
  };
376
376
  }
377
- function dt(t) {
377
+ function lt(t) {
378
378
  return async (e, a) => {
379
379
  const r = await t.selectFrom("sessions_2").where("sessions_2.tenant_id", "=", e).where("sessions_2.id", "=", a).where("sessions_2.revoked_at", "is", null).selectAll().executeTakeFirst();
380
380
  if (!r)
381
381
  return null;
382
- const { tenant_id: o, device: n, clients: s, ...c } = r;
382
+ const { tenant_id: o, device: n, clients: s, ...l } = r;
383
383
  return {
384
- ...c,
384
+ ...l,
385
385
  device: JSON.parse(n),
386
386
  clients: JSON.parse(s)
387
387
  };
@@ -425,33 +425,33 @@ function _t(t) {
425
425
  include_totals: !1
426
426
  }) => {
427
427
  let r = t.selectFrom("sessions_2").where("sessions_2.tenant_id", "=", e);
428
- a.q && (r = T(t, r, a.q, ["user_id", "session_id"]));
428
+ a.q && (r = O(t, r, a.q, ["user_id", "session_id"]));
429
429
  let o = r;
430
430
  if (a.sort && a.sort.sort_by) {
431
- const { ref: l } = t.dynamic;
431
+ const { ref: c } = t.dynamic;
432
432
  o = o.orderBy(
433
- l(a.sort.sort_by),
433
+ c(a.sort.sort_by),
434
434
  a.sort.sort_order
435
435
  );
436
436
  }
437
437
  o = o.offset(a.page * a.per_page).limit(a.per_page);
438
- const n = await o.selectAll().execute(), { count: s } = await r.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow(), c = b(s);
438
+ const n = await o.selectAll().execute(), { count: s } = await r.select((c) => c.fn.countAll().as("count")).executeTakeFirstOrThrow(), l = x(s);
439
439
  return {
440
- sessions: n.map((l) => ({
441
- ...l,
442
- device: JSON.parse(l.device),
443
- clients: JSON.parse(l.clients)
440
+ sessions: n.map((c) => ({
441
+ ...c,
442
+ device: JSON.parse(c.device),
443
+ clients: JSON.parse(c.clients)
444
444
  })),
445
445
  start: a.page * a.per_page,
446
446
  limit: a.per_page,
447
- length: c
447
+ length: l
448
448
  };
449
449
  };
450
450
  }
451
451
  function ft(t) {
452
452
  return {
453
453
  create: ut(t),
454
- get: dt(t),
454
+ get: lt(t),
455
455
  list: _t(t),
456
456
  remove: mt(t),
457
457
  update: ht(t)
@@ -496,16 +496,16 @@ function Nt(t) {
496
496
  include_totals: !1
497
497
  }) => {
498
498
  let r = t.selectFrom("codes").where("codes.tenant_id", "=", e);
499
- a.q && (r = T(t, r, a.q, ["code", "login_id"]));
500
- const n = await r.offset(a.page * a.per_page).limit(a.per_page).selectAll().execute(), { count: s } = await r.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow();
499
+ a.q && (r = O(t, r, a.q, ["code", "login_id"]));
500
+ const n = await r.offset(a.page * a.per_page).limit(a.per_page).selectAll().execute(), { count: s } = await r.select((c) => c.fn.countAll().as("count")).executeTakeFirstOrThrow();
501
501
  return {
502
- codes: n.map((l) => {
503
- const { tenant_id: g, ...m } = l;
502
+ codes: n.map((c) => {
503
+ const { tenant_id: g, ...m } = c;
504
504
  return ze.parse(_(m));
505
505
  }),
506
506
  start: a.page * a.per_page,
507
507
  limit: a.per_page,
508
- length: b(s)
508
+ length: x(s)
509
509
  };
510
510
  };
511
511
  }
@@ -550,7 +550,7 @@ function St(t) {
550
550
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
551
551
  updated_at: (/* @__PURE__ */ new Date()).toISOString(),
552
552
  ...a
553
- }, o = JSON.stringify(a.allowed_origins), n = JSON.stringify(a.callbacks), s = JSON.stringify(a.web_origins), c = JSON.stringify(a.allowed_logout_urls), l = JSON.stringify(a.allowed_clients);
553
+ }, o = JSON.stringify(a.allowed_origins), n = JSON.stringify(a.callbacks), s = JSON.stringify(a.web_origins), l = JSON.stringify(a.allowed_logout_urls), c = JSON.stringify(a.allowed_clients);
554
554
  return await t.insertInto("applications").values({
555
555
  ...r,
556
556
  tenant_id: e,
@@ -559,8 +559,8 @@ function St(t) {
559
559
  callbacks: n,
560
560
  allowed_origins: o,
561
561
  web_origins: s,
562
- allowed_logout_urls: c,
563
- allowed_clients: l
562
+ allowed_logout_urls: l,
563
+ allowed_clients: c
564
564
  }).execute(), r;
565
565
  };
566
566
  }
@@ -643,18 +643,18 @@ function Pt(t) {
643
643
  include_totals: !1
644
644
  }) => {
645
645
  let r = t.selectFrom("connections").where("connections.tenant_id", "=", e);
646
- a.q && (r = T(t, r, a.q, ["user_id", "ip"]));
646
+ a.q && (r = O(t, r, a.q, ["user_id", "ip"]));
647
647
  const s = (await r.offset(a.page * a.per_page).limit(a.per_page).selectAll().execute()).map(
648
- (l) => _({
649
- ...l,
650
- options: JSON.parse(l.options)
648
+ (c) => _({
649
+ ...c,
650
+ options: JSON.parse(c.options)
651
651
  })
652
- ), { count: c } = await r.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow();
652
+ ), { count: l } = await r.select((c) => c.fn.countAll().as("count")).executeTakeFirstOrThrow();
653
653
  return {
654
654
  connections: s,
655
655
  start: a.page * a.per_page,
656
656
  limit: a.per_page,
657
- length: b(c)
657
+ length: x(l)
658
658
  };
659
659
  };
660
660
  }
@@ -700,18 +700,17 @@ function Et(t) {
700
700
  const r = await t.selectFrom("tenants").selectAll().where("id", "=", a.tenant_id).executeTakeFirst();
701
701
  if (!r)
702
702
  throw new V(404, { message: "Tenant not found" });
703
- const o = await t.selectFrom("connections").where("tenant_id", "=", a.tenant_id).selectAll().execute(), n = await t.selectFrom("domains").where("tenant_id", "=", a.tenant_id).selectAll().execute();
703
+ const o = await t.selectFrom("connections").where("tenant_id", "=", a.tenant_id).selectAll().execute();
704
704
  return {
705
705
  ...a,
706
706
  connections: o.map(
707
- (c) => Ke.parse(
707
+ (s) => Ke.parse(
708
708
  _({
709
- ...c,
710
- options: c.options ? JSON.parse(c.options) : {}
709
+ ...s,
710
+ options: s.options ? JSON.parse(s.options) : {}
711
711
  })
712
712
  )
713
713
  ),
714
- domains: n,
715
714
  addons: a.addons ? JSON.parse(a.addons) : {},
716
715
  callbacks: a.callbacks ? JSON.parse(a.callbacks) : [],
717
716
  allowed_origins: a.allowed_origins ? JSON.parse(a.allowed_origins) : [],
@@ -751,35 +750,58 @@ function Rt(t) {
751
750
  function Ut(t) {
752
751
  return async (e, a) => {
753
752
  const r = {
753
+ custom_domain_id: k(),
754
+ status: "pending",
755
+ primary: !1,
756
+ ...a
757
+ };
758
+ return await t.insertInto("custom_domains").values({
759
+ ...r,
754
760
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
755
761
  updated_at: (/* @__PURE__ */ new Date()).toISOString(),
756
762
  tenant_id: e,
757
- id: k(),
758
- ...a
759
- };
760
- return await t.insertInto("domains").values(r).execute(), r;
763
+ primary: r.primary ? 1 : 0
764
+ }).execute(), r;
761
765
  };
762
766
  }
763
767
  function Bt(t) {
768
+ return async (e) => (await t.selectFrom("custom_domains").where("custom_domains.tenant_id", "=", e).selectAll().execute()).map((r) => ({
769
+ ...r,
770
+ primary: r.primary === 1
771
+ }));
772
+ }
773
+ function Qt(t) {
774
+ return async (e, a) => (await t.deleteFrom("custom_domains").where("custom_domains.tenant_id", "=", e).where("custom_domains.custom_domain_id", "=", a).execute()).length > 0;
775
+ }
776
+ function Vt(t) {
764
777
  return async (e, a) => {
765
- let r = t.selectFrom("domains").where("domains.tenant_id", "=", e);
766
- a.q && (r = T(t, r, a.q, ["user_id", "ip"]));
767
- const n = await r.offset(a.page * a.per_page).limit(a.per_page).selectAll().execute(), { count: s } = await r.select((c) => c.fn.countAll().as("count")).executeTakeFirstOrThrow();
768
- return {
769
- domains: n,
770
- start: a.page * a.per_page,
771
- limit: a.per_page,
772
- length: b(s)
778
+ const r = await t.selectFrom("custom_domains").where("custom_domains.tenant_id", "=", e).where("custom_domains.custom_domain_id", "=", a).selectAll().executeTakeFirst();
779
+ return r ? {
780
+ ...r,
781
+ primary: r.primary === 1
782
+ } : null;
783
+ };
784
+ }
785
+ function Wt(t) {
786
+ return async (e, a, r) => {
787
+ const o = {
788
+ ...r,
789
+ updated_at: (/* @__PURE__ */ new Date()).toISOString(),
790
+ primary: r.primary ? 1 : 0
773
791
  };
792
+ return (await t.updateTable("custom_domains").set(o).where("custom_domains.tenant_id", "=", e).where("custom_domains.custom_domain_id", "=", a).execute()).length > 0;
774
793
  };
775
794
  }
776
- function Qt(t) {
795
+ function qt(t) {
777
796
  return {
778
797
  create: Ut(t),
779
- list: Bt(t)
798
+ get: Vt(t),
799
+ list: Bt(t),
800
+ remove: Qt(t),
801
+ update: Wt(t)
780
802
  };
781
803
  }
782
- function Vt(t) {
804
+ function Gt(t) {
783
805
  return async (e) => {
784
806
  const [a] = await t.selectFrom("branding").where("branding.tenant_id", "=", e).selectAll().execute();
785
807
  if (!a)
@@ -789,8 +811,8 @@ function Vt(t) {
789
811
  colors_primary: o,
790
812
  colors_page_background_type: n,
791
813
  colors_page_background_start: s,
792
- colors_page_background_end: c,
793
- colors_page_background_angle_dev: l,
814
+ colors_page_background_end: l,
815
+ colors_page_background_angle_dev: c,
794
816
  font_url: g,
795
817
  ...m
796
818
  } = a;
@@ -801,26 +823,26 @@ function Vt(t) {
801
823
  page_background: {
802
824
  type: n,
803
825
  start: s,
804
- end: c,
805
- angle_deg: l
826
+ end: l,
827
+ angle_deg: c
806
828
  }
807
829
  },
808
830
  font: g ? { url: g } : void 0
809
831
  });
810
832
  };
811
833
  }
812
- function qt(t) {
834
+ function Ht(t) {
813
835
  return async (e, a) => {
814
- var s, c, l, g, m, w, x, Z, ee, te, ae, re, ne, oe, se, ie, ce, le;
836
+ var s, l, c, g, m, w, b, Z, ee, te, ae, re, ne, oe, se, ie, ce, de;
815
837
  const { colors: r, font: o, ...n } = a;
816
838
  try {
817
839
  await t.insertInto("branding").values({
818
840
  ...n,
819
841
  colors_primary: r == null ? void 0 : r.primary,
820
- colors_page_background_type: (c = (s = a.colors) == null ? void 0 : s.page_background) == null ? void 0 : c.type,
821
- colors_page_background_start: (g = (l = a.colors) == null ? void 0 : l.page_background) == null ? void 0 : g.start,
842
+ colors_page_background_type: (l = (s = a.colors) == null ? void 0 : s.page_background) == null ? void 0 : l.type,
843
+ colors_page_background_start: (g = (c = a.colors) == null ? void 0 : c.page_background) == null ? void 0 : g.start,
822
844
  colors_page_background_end: (w = (m = a.colors) == null ? void 0 : m.page_background) == null ? void 0 : w.end,
823
- colors_page_background_angle_dev: (Z = (x = a.colors) == null ? void 0 : x.page_background) == null ? void 0 : Z.angle_deg,
845
+ colors_page_background_angle_dev: (Z = (b = a.colors) == null ? void 0 : b.page_background) == null ? void 0 : Z.angle_deg,
824
846
  font_url: (ee = a.font) == null ? void 0 : ee.url,
825
847
  tenant_id: e
826
848
  }).execute();
@@ -832,42 +854,42 @@ function qt(t) {
832
854
  colors_page_background_start: (ne = (re = a.colors) == null ? void 0 : re.page_background) == null ? void 0 : ne.start,
833
855
  colors_page_background_end: (se = (oe = a.colors) == null ? void 0 : oe.page_background) == null ? void 0 : se.end,
834
856
  colors_page_background_angle_dev: (ce = (ie = a.colors) == null ? void 0 : ie.page_background) == null ? void 0 : ce.angle_deg,
835
- font_url: (le = a.font) == null ? void 0 : le.url
857
+ font_url: (de = a.font) == null ? void 0 : de.url
836
858
  }).where("tenant_id", "=", e).execute();
837
859
  }
838
860
  };
839
861
  }
840
- function Wt(t) {
862
+ function Xt(t) {
841
863
  return {
842
- get: Vt(t),
843
- set: qt(t)
864
+ get: Gt(t),
865
+ set: Ht(t)
844
866
  };
845
867
  }
846
- function Gt(t) {
868
+ function Yt(t) {
847
869
  return async (e, a = {
848
870
  page: 0,
849
871
  per_page: 50,
850
872
  include_totals: !1
851
873
  }) => {
852
874
  let r = t.selectFrom("hooks").where("hooks.tenant_id", "=", e);
853
- a.q && (r = T(t, r, a.q, ["url"]));
854
- const n = await r.offset(a.page * a.per_page).limit(a.per_page).selectAll().execute(), { count: s } = await r.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow();
875
+ a.q && (r = O(t, r, a.q, ["url"]));
876
+ const n = await r.offset(a.page * a.per_page).limit(a.per_page).selectAll().execute(), { count: s } = await r.select((c) => c.fn.countAll().as("count")).executeTakeFirstOrThrow();
855
877
  return {
856
- hooks: n.map((l) => {
857
- const { tenant_id: g, enabled: m, synchronous: w, ...x } = l;
878
+ hooks: n.map((c) => {
879
+ const { tenant_id: g, enabled: m, synchronous: w, ...b } = c;
858
880
  return _({
859
- ...x,
881
+ ...b,
860
882
  enabled: !!m,
861
883
  synchronous: !!w
862
884
  });
863
885
  }),
864
886
  start: a.page * a.per_page,
865
887
  limit: a.per_page,
866
- length: b(s)
888
+ length: x(s)
867
889
  };
868
890
  };
869
891
  }
870
- function Ht(t) {
892
+ function Zt(t) {
871
893
  return async (e, a) => {
872
894
  const r = await t.selectFrom("hooks").where("hooks.tenant_id", "=", e).where("hooks.hook_id", "=", a).selectAll().executeTakeFirst();
873
895
  return r ? _({
@@ -877,10 +899,10 @@ function Ht(t) {
877
899
  }) : null;
878
900
  };
879
901
  }
880
- function Xt(t) {
902
+ function ea(t) {
881
903
  return async (e, a) => (await t.deleteFrom("hooks").where("hooks.tenant_id", "=", e).where("hooks.hook_id", "=", a).executeTakeFirst()).numDeletedRows > 0;
882
904
  }
883
- function Yt(t) {
905
+ function ta(t) {
884
906
  return async (e, a) => {
885
907
  const r = {
886
908
  hook_id: k(),
@@ -896,7 +918,7 @@ function Yt(t) {
896
918
  }).execute(), r;
897
919
  };
898
920
  }
899
- function Zt(t) {
921
+ function aa(t) {
900
922
  return async (e, a, r) => {
901
923
  const o = {
902
924
  ...r,
@@ -907,13 +929,13 @@ function Zt(t) {
907
929
  return await t.updateTable("hooks").set(o).where("hooks.hook_id", "=", a).where("hooks.tenant_id", "=", e).execute(), !0;
908
930
  };
909
931
  }
910
- function ea(t) {
932
+ function ra(t) {
911
933
  return {
912
- create: Yt(t),
913
- get: Ht(t),
914
- list: Gt(t),
915
- update: Zt(t),
916
- remove: Xt(t)
934
+ create: ta(t),
935
+ get: Zt(t),
936
+ list: Yt(t),
937
+ update: aa(t),
938
+ remove: ea(t)
917
939
  };
918
940
  }
919
941
  function J(t, e = "", a = {}) {
@@ -924,7 +946,7 @@ function J(t, e = "", a = {}) {
924
946
  }
925
947
  return a;
926
948
  }
927
- function ta(t, e) {
949
+ function na(t, e) {
928
950
  const a = {};
929
951
  for (const [r, o] of Object.entries(t)) {
930
952
  const n = e.find(
@@ -942,7 +964,7 @@ function ta(t, e) {
942
964
  }
943
965
  return a;
944
966
  }
945
- function aa(t) {
967
+ function oa(t) {
946
968
  return async (e, a) => {
947
969
  const r = {
948
970
  themeId: k(),
@@ -953,16 +975,16 @@ function aa(t) {
953
975
  return await t.insertInto("themes").values({ ...J(r), tenant_id: e }).execute(), r;
954
976
  };
955
977
  }
956
- function ra(t) {
978
+ function sa(t) {
957
979
  return async (e, a) => (await t.deleteFrom("themes").where("themes.tenant_id", "=", e).where("themes.theme_id", "=", a).executeTakeFirst()).numDeletedRows > 0;
958
980
  }
959
- function na(t) {
981
+ function ia(t) {
960
982
  return async (e, a) => {
961
983
  const r = await t.selectFrom("themes").where("themes.tenant_id", "=", e).where("themes.theme_id", "=", a).selectAll().executeTakeFirst();
962
984
  return r ? _(r) : null;
963
985
  };
964
986
  }
965
- function oa(t) {
987
+ function ca(t) {
966
988
  return async (e, a, r) => {
967
989
  const o = J({
968
990
  ...r,
@@ -971,23 +993,23 @@ function oa(t) {
971
993
  return await t.updateTable("themes").set(o).where("themes.id", "=", a).where("themes.tenant_id", "=", e).execute(), !0;
972
994
  };
973
995
  }
974
- function sa(t) {
996
+ function da(t) {
975
997
  return {
976
- create: aa(t),
977
- get: na(t),
978
- remove: ra(t),
979
- update: oa(t)
998
+ create: oa(t),
999
+ get: ia(t),
1000
+ remove: sa(t),
1001
+ update: ca(t)
980
1002
  };
981
1003
  }
982
- function ia(t) {
1004
+ function la(t) {
983
1005
  return async (e, a) => {
984
1006
  const r = (/* @__PURE__ */ new Date()).toISOString(), o = await t.selectFrom("logins").where("logins.expires_at", ">", r).where("logins.login_id", "=", a).selectAll().executeTakeFirst();
985
1007
  return o ? Re.parse(
986
- ta(_(o), ["authParams"])
1008
+ na(_(o), ["authParams"])
987
1009
  ) : null;
988
1010
  };
989
1011
  }
990
- function ca(t) {
1012
+ function ua(t) {
991
1013
  return async (e, a) => {
992
1014
  const r = {
993
1015
  login_id: k(),
@@ -998,21 +1020,21 @@ function ca(t) {
998
1020
  return await t.insertInto("logins").values({ ...J(r), tenant_id: e }).execute(), r;
999
1021
  };
1000
1022
  }
1001
- function la(t) {
1023
+ function ma(t) {
1002
1024
  return async (e, a, r) => (await t.updateTable("logins").set(J(r)).where("logins.login_id", "=", a).where("logins.tenant_id", "=", e).execute()).length === 1;
1003
1025
  }
1004
- function da(t) {
1026
+ function ha(t) {
1005
1027
  return async (e, a) => (await t.deleteFrom("logins").where("logins.tenant_id", "=", e).where("logins.login_id", "=", a).execute()).length > 0;
1006
1028
  }
1007
- function ua(t) {
1029
+ function _a(t) {
1008
1030
  return {
1009
- create: ca(t),
1010
- get: ia(t),
1011
- update: la(t),
1012
- remove: da(t)
1031
+ create: ua(t),
1032
+ get: la(t),
1033
+ update: ma(t),
1034
+ remove: ha(t)
1013
1035
  };
1014
1036
  }
1015
- function ma(t) {
1037
+ function fa(t) {
1016
1038
  return async (e) => {
1017
1039
  const [a] = await t.selectFrom("prompt_settings").where("prompt_settings.tenant_id", "=", e).selectAll().execute();
1018
1040
  return _({
@@ -1032,7 +1054,7 @@ function he(t) {
1032
1054
  universal_login_experience: t.universal_login_experience
1033
1055
  });
1034
1056
  }
1035
- function ha(t) {
1057
+ function pa(t) {
1036
1058
  return async (e, a) => {
1037
1059
  try {
1038
1060
  const r = Ue.parse(a);
@@ -1045,13 +1067,13 @@ function ha(t) {
1045
1067
  }
1046
1068
  };
1047
1069
  }
1048
- function _a(t) {
1070
+ function ga(t) {
1049
1071
  return {
1050
- get: ma(t),
1051
- set: ha(t)
1072
+ get: fa(t),
1073
+ set: pa(t)
1052
1074
  };
1053
1075
  }
1054
- function fa(t) {
1076
+ function ya(t) {
1055
1077
  return async (e) => {
1056
1078
  const [a] = await t.selectFrom("email_providers").where("email_providers.tenant_id", "=", e).selectAll().execute();
1057
1079
  if (!a)
@@ -1061,17 +1083,17 @@ function fa(t) {
1061
1083
  credentials: o,
1062
1084
  settings: n,
1063
1085
  enabled: s,
1064
- ...c
1086
+ ...l
1065
1087
  } = a;
1066
1088
  return _({
1067
- ...c,
1089
+ ...l,
1068
1090
  credentials: JSON.parse(o),
1069
1091
  settings: JSON.parse(n),
1070
1092
  enabled: !!s
1071
1093
  });
1072
1094
  };
1073
1095
  }
1074
- function pa(t) {
1096
+ function wa(t) {
1075
1097
  return async (e, a) => {
1076
1098
  const { credentials: r, settings: o, enabled: n, ...s } = a;
1077
1099
  await t.updateTable("email_providers").set({
@@ -1082,7 +1104,7 @@ function pa(t) {
1082
1104
  }).where("tenant_id", "=", e).execute();
1083
1105
  };
1084
1106
  }
1085
- function ga(t) {
1107
+ function Na(t) {
1086
1108
  return async (e, a) => {
1087
1109
  const { credentials: r, settings: o, enabled: n, ...s } = a;
1088
1110
  await t.insertInto("email_providers").values({
@@ -1096,14 +1118,14 @@ function ga(t) {
1096
1118
  }).execute();
1097
1119
  };
1098
1120
  }
1099
- function ya(t) {
1121
+ function va(t) {
1100
1122
  return {
1101
- get: fa(t),
1102
- create: ga(t),
1103
- update: pa(t)
1123
+ get: ya(t),
1124
+ create: Na(t),
1125
+ update: wa(t)
1104
1126
  };
1105
1127
  }
1106
- function wa(t) {
1128
+ function Ca(t) {
1107
1129
  return async (e, a) => {
1108
1130
  const r = await t.selectFrom("refresh_tokens_2").where("refresh_tokens_2.tenant_id", "=", e).where("refresh_tokens_2.id", "=", a).selectAll().executeTakeFirst();
1109
1131
  return r ? {
@@ -1114,7 +1136,7 @@ function wa(t) {
1114
1136
  } : null;
1115
1137
  };
1116
1138
  }
1117
- function Na(t) {
1139
+ function ba(t) {
1118
1140
  return async (e, a) => {
1119
1141
  const r = {
1120
1142
  ...a,
@@ -1129,10 +1151,10 @@ function Na(t) {
1129
1151
  }).execute(), { ...a, ...r };
1130
1152
  };
1131
1153
  }
1132
- function va(t) {
1154
+ function xa(t) {
1133
1155
  return async (e, a) => !!(await t.deleteFrom("refresh_tokens_2").where("tenant_id", "=", e).where("refresh_tokens_2.id", "=", a).execute()).length;
1134
1156
  }
1135
- function Ca(t) {
1157
+ function Ta(t) {
1136
1158
  return async (e, a, r) => {
1137
1159
  const o = {
1138
1160
  ...r,
@@ -1143,47 +1165,47 @@ function Ca(t) {
1143
1165
  return !!(await t.updateTable("refresh_tokens_2").set(o).where("tenant_id", "=", e).where("refresh_tokens_2.id", "=", a).execute()).length;
1144
1166
  };
1145
1167
  }
1146
- function ba(t) {
1168
+ function Sa(t) {
1147
1169
  return async (e, a = {
1148
1170
  page: 0,
1149
1171
  per_page: 50,
1150
1172
  include_totals: !1
1151
1173
  }) => {
1152
1174
  let r = t.selectFrom("refresh_tokens_2").where("refresh_tokens_2.tenant_id", "=", e);
1153
- a.q && (r = T(t, r, a.q, ["token", "session_id"]));
1175
+ a.q && (r = O(t, r, a.q, ["token", "session_id"]));
1154
1176
  let o = r;
1155
1177
  if (a.sort && a.sort.sort_by) {
1156
- const { ref: l } = t.dynamic;
1178
+ const { ref: c } = t.dynamic;
1157
1179
  o = o.orderBy(
1158
- l(a.sort.sort_by),
1180
+ c(a.sort.sort_by),
1159
1181
  a.sort.sort_order
1160
1182
  );
1161
1183
  }
1162
1184
  o = o.offset(a.page * a.per_page).limit(a.per_page);
1163
- const n = await o.selectAll().execute(), { count: s } = await r.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow(), c = b(s);
1185
+ const n = await o.selectAll().execute(), { count: s } = await r.select((c) => c.fn.countAll().as("count")).executeTakeFirstOrThrow(), l = x(s);
1164
1186
  return {
1165
- refresh_tokens: n.map((l) => ({
1166
- ...l,
1167
- rotating: !!l.rotating,
1168
- device: l.device ? JSON.parse(l.device) : {},
1169
- resource_servers: l.resource_servers ? JSON.parse(l.resource_servers) : []
1187
+ refresh_tokens: n.map((c) => ({
1188
+ ...c,
1189
+ rotating: !!c.rotating,
1190
+ device: c.device ? JSON.parse(c.device) : {},
1191
+ resource_servers: c.resource_servers ? JSON.parse(c.resource_servers) : []
1170
1192
  })),
1171
1193
  start: a.page * a.per_page,
1172
1194
  limit: a.per_page,
1173
- length: c
1195
+ length: l
1174
1196
  };
1175
1197
  };
1176
1198
  }
1177
- function xa(t) {
1199
+ function Oa(t) {
1178
1200
  return {
1179
- create: Na(t),
1180
- get: wa(t),
1181
- list: ba(t),
1182
- remove: va(t),
1183
- update: Ca(t)
1201
+ create: ba(t),
1202
+ get: Ca(t),
1203
+ list: Sa(t),
1204
+ remove: xa(t),
1205
+ update: Ta(t)
1184
1206
  };
1185
1207
  }
1186
- function Ta(t) {
1208
+ function ka(t) {
1187
1209
  return t[t.length - 1];
1188
1210
  }
1189
1211
  function p(t) {
@@ -1199,7 +1221,7 @@ const z = p({
1199
1221
  name: t
1200
1222
  });
1201
1223
  }
1202
- }), q = p({
1224
+ }), W = p({
1203
1225
  is(t) {
1204
1226
  return t.kind === "SchemableIdentifierNode";
1205
1227
  },
@@ -1216,7 +1238,7 @@ const z = p({
1216
1238
  identifier: z.create(e)
1217
1239
  });
1218
1240
  }
1219
- }), Sa = p({
1241
+ }), $a = p({
1220
1242
  is(t) {
1221
1243
  return t.kind === "AliasNode";
1222
1244
  },
@@ -1234,18 +1256,18 @@ const z = p({
1234
1256
  create(t) {
1235
1257
  return p({
1236
1258
  kind: "TableNode",
1237
- table: q.create(t)
1259
+ table: W.create(t)
1238
1260
  });
1239
1261
  },
1240
1262
  createWithSchema(t, e) {
1241
1263
  return p({
1242
1264
  kind: "TableNode",
1243
- table: q.createWithSchema(t, e)
1265
+ table: W.createWithSchema(t, e)
1244
1266
  });
1245
1267
  }
1246
1268
  });
1247
1269
  var K;
1248
- class Oa {
1270
+ class Da {
1249
1271
  constructor() {
1250
1272
  P(this, "nodeStack", []);
1251
1273
  y(this, K, p({
@@ -2079,7 +2101,7 @@ class Oa {
2079
2101
  }
2080
2102
  }
2081
2103
  K = new WeakMap();
2082
- const ka = p({
2104
+ const Ia = p({
2083
2105
  AlterTableNode: !0,
2084
2106
  CreateIndexNode: !0,
2085
2107
  CreateSchemaNode: !0,
@@ -2098,14 +2120,14 @@ const ka = p({
2098
2120
  UpdateQueryNode: !0,
2099
2121
  MergeQueryNode: !0
2100
2122
  });
2101
- var j, S, O, f, ge, ye, we, $, W, Ne;
2102
- class $a extends Oa {
2123
+ var j, T, S, f, ge, ye, we, $, q, Ne;
2124
+ class ja extends Da {
2103
2125
  constructor(a) {
2104
2126
  super();
2105
2127
  y(this, f);
2106
2128
  y(this, j);
2129
+ y(this, T, /* @__PURE__ */ new Set());
2107
2130
  y(this, S, /* @__PURE__ */ new Set());
2108
- y(this, O, /* @__PURE__ */ new Set());
2109
2131
  M(this, j, a);
2110
2132
  }
2111
2133
  transformNodeImpl(a) {
@@ -2113,20 +2135,20 @@ class $a extends Oa {
2113
2135
  return super.transformNodeImpl(a);
2114
2136
  const r = u(this, f, we).call(this, a);
2115
2137
  for (const s of r)
2116
- d(this, O).add(s);
2138
+ d(this, S).add(s);
2117
2139
  const o = u(this, f, ye).call(this, a);
2118
2140
  for (const s of o)
2119
- d(this, S).add(s);
2141
+ d(this, T).add(s);
2120
2142
  const n = super.transformNodeImpl(a);
2121
2143
  for (const s of o)
2122
- d(this, S).delete(s);
2144
+ d(this, T).delete(s);
2123
2145
  for (const s of r)
2124
- d(this, O).delete(s);
2146
+ d(this, S).delete(s);
2125
2147
  return n;
2126
2148
  }
2127
2149
  transformSchemableIdentifier(a) {
2128
2150
  const r = super.transformSchemableIdentifier(a);
2129
- return r.schema || !d(this, S).has(a.identifier.name) ? r : {
2151
+ return r.schema || !d(this, T).has(a.identifier.name) ? r : {
2130
2152
  ...r,
2131
2153
  schema: z.create(d(this, j))
2132
2154
  };
@@ -2139,11 +2161,11 @@ class $a extends Oa {
2139
2161
  };
2140
2162
  }
2141
2163
  }
2142
- j = new WeakMap(), S = new WeakMap(), O = new WeakMap(), f = new WeakSet(), ge = function(a) {
2143
- return a.kind in ka;
2164
+ j = new WeakMap(), T = new WeakMap(), S = new WeakMap(), f = new WeakSet(), ge = function(a) {
2165
+ return a.kind in Ia;
2144
2166
  }, ye = function(a) {
2145
2167
  const r = /* @__PURE__ */ new Set();
2146
- if ("name" in a && a.name && q.is(a.name) && u(this, f, W).call(this, a.name, r), "from" in a && a.from)
2168
+ if ("name" in a && a.name && W.is(a.name) && u(this, f, q).call(this, a.name, r), "from" in a && a.from)
2147
2169
  for (const o of a.from.froms)
2148
2170
  u(this, f, $).call(this, o, r);
2149
2171
  if ("into" in a && a.into && u(this, f, $).call(this, a.into, r), "table" in a && a.table && u(this, f, $).call(this, a.table, r), "joins" in a && a.joins)
@@ -2154,22 +2176,22 @@ j = new WeakMap(), S = new WeakMap(), O = new WeakMap(), f = new WeakSet(), ge =
2154
2176
  const r = /* @__PURE__ */ new Set();
2155
2177
  return "with" in a && a.with && u(this, f, Ne).call(this, a.with, r), r;
2156
2178
  }, $ = function(a, r) {
2157
- const o = U.is(a) ? a : Sa.is(a) && U.is(a.node) ? a.node : null;
2158
- o && u(this, f, W).call(this, o.table, r);
2159
- }, W = function(a, r) {
2179
+ const o = U.is(a) ? a : $a.is(a) && U.is(a.node) ? a.node : null;
2180
+ o && u(this, f, q).call(this, o.table, r);
2181
+ }, q = function(a, r) {
2160
2182
  const o = a.identifier.name;
2161
- !d(this, S).has(o) && !d(this, O).has(o) && r.add(o);
2183
+ !d(this, T).has(o) && !d(this, S).has(o) && r.add(o);
2162
2184
  }, Ne = function(a, r) {
2163
2185
  for (const o of a.expressions) {
2164
2186
  const n = o.name.table.table.identifier.name;
2165
- d(this, O).has(n) || r.add(n);
2187
+ d(this, S).has(n) || r.add(n);
2166
2188
  }
2167
2189
  };
2168
2190
  var L;
2169
- class Da {
2191
+ class Pa {
2170
2192
  constructor(e) {
2171
2193
  y(this, L);
2172
- M(this, L, new $a(e));
2194
+ M(this, L, new ja(e));
2173
2195
  }
2174
2196
  transformQuery(e) {
2175
2197
  return d(this, L).transformNode(e.node);
@@ -2179,7 +2201,7 @@ class Da {
2179
2201
  }
2180
2202
  }
2181
2203
  L = new WeakMap();
2182
- class Ia {
2204
+ class Ma {
2183
2205
  transformQuery(e) {
2184
2206
  return e.node;
2185
2207
  }
@@ -2187,7 +2209,7 @@ class Ia {
2187
2209
  return e.result;
2188
2210
  }
2189
2211
  }
2190
- const ja = "kysely_migration", _e = "kysely_migration_lock", Pa = !1, B = "migration_lock", Ma = p({ __noMigrations__: !0 });
2212
+ const Aa = "kysely_migration", _e = "kysely_migration_lock", Fa = !1, B = "migration_lock", La = p({ __noMigrations__: !0 });
2191
2213
  var h, i, A, N, v, D, Ce, C, be, xe, Te, Se, Oe, G, I, H, ke, $e, De, X, Ie, je, Pe, Me, Ae, F;
2192
2214
  class ve {
2193
2215
  constructor(e) {
@@ -2286,11 +2308,11 @@ class ve {
2286
2308
  */
2287
2309
  async migrateTo(e) {
2288
2310
  return u(this, i, A).call(this, ({ migrations: a, executedMigrations: r, pendingMigrations: o }) => {
2289
- if (e === Ma)
2311
+ if (e === La)
2290
2312
  return { direction: "Down", step: 1 / 0 };
2291
- if (!a.find((c) => c.name === e))
2313
+ if (!a.find((l) => l.name === e))
2292
2314
  throw new Error(`migration "${e}" doesn't exist`);
2293
- const n = r.indexOf(e), s = o.findIndex((c) => c.name === e);
2315
+ const n = r.indexOf(e), s = o.findIndex((l) => l.name === e);
2294
2316
  if (n !== -1)
2295
2317
  return {
2296
2318
  direction: "Down",
@@ -2345,13 +2367,13 @@ h = new WeakMap(), i = new WeakSet(), A = async function(e) {
2345
2367
  }, N = function() {
2346
2368
  return d(this, h).migrationTableSchema;
2347
2369
  }, v = function() {
2348
- return d(this, h).migrationTableName ?? ja;
2370
+ return d(this, h).migrationTableName ?? Aa;
2349
2371
  }, D = function() {
2350
2372
  return d(this, h).migrationLockTableName ?? _e;
2351
2373
  }, Ce = function() {
2352
- return d(this, h).allowUnorderedMigrations ?? Pa;
2374
+ return d(this, h).allowUnorderedMigrations ?? Fa;
2353
2375
  }, C = function() {
2354
- return d(this, i, N) ? new Da(d(this, i, N)) : new Ia();
2376
+ return d(this, i, N) ? new Pa(d(this, i, N)) : new Ma();
2355
2377
  }, be = async function() {
2356
2378
  await u(this, i, xe).call(this), await u(this, i, Te).call(this), await u(this, i, Se).call(this), await u(this, i, Oe).call(this);
2357
2379
  }, xe = async function() {
@@ -2406,8 +2428,8 @@ h = new WeakMap(), i = new WeakSet(), A = async function(e) {
2406
2428
  const s = await u(this, i, $e).call(this, n);
2407
2429
  if (s.migrations.length === 0)
2408
2430
  return { results: [] };
2409
- const { direction: c, step: l } = e(s);
2410
- return l <= 0 ? { results: [] } : c === "Down" ? await u(this, i, Me).call(this, n, s, l) : c === "Up" ? await u(this, i, Ae).call(this, n, s, l) : { results: [] };
2431
+ const { direction: l, step: c } = e(s);
2432
+ return c <= 0 ? { results: [] } : l === "Down" ? await u(this, i, Me).call(this, n, s, c) : l === "Up" ? await u(this, i, Ae).call(this, n, s, c) : { results: [] };
2411
2433
  } finally {
2412
2434
  await a.releaseMigrationLock(n, r);
2413
2435
  }
@@ -2420,7 +2442,7 @@ h = new WeakMap(), i = new WeakSet(), A = async function(e) {
2420
2442
  return p({
2421
2443
  migrations: a,
2422
2444
  executedMigrations: r,
2423
- lastMigration: Ta(r),
2445
+ lastMigration: ka(r),
2424
2446
  pendingMigrations: o
2425
2447
  });
2426
2448
  }, De = function(e, a) {
@@ -2442,26 +2464,26 @@ h = new WeakMap(), i = new WeakSet(), A = async function(e) {
2442
2464
  if (e[r].name !== a[r])
2443
2465
  throw new Error(`corrupted migrations: expected previously executed migration ${a[r]} to be at index ${r} but ${e[r].name} was found in its place. New migrations must always have a name that comes alphabetically after the last executed migration.`);
2444
2466
  }, Me = async function(e, a, r) {
2445
- const o = a.executedMigrations.slice().reverse().slice(0, r).map((s) => a.migrations.find((c) => c.name === s)), n = o.map((s) => ({
2467
+ const o = a.executedMigrations.slice().reverse().slice(0, r).map((s) => a.migrations.find((l) => l.name === s)), n = o.map((s) => ({
2446
2468
  migrationName: s.name,
2447
2469
  direction: "Down",
2448
2470
  status: "NotExecuted"
2449
2471
  }));
2450
2472
  for (let s = 0; s < n.length; ++s) {
2451
- const c = o[s];
2473
+ const l = o[s];
2452
2474
  try {
2453
- c.down && (await c.down(e), await e.withPlugin(d(this, i, C)).deleteFrom(d(this, i, v)).where("name", "=", c.name).execute(), n[s] = {
2454
- migrationName: c.name,
2475
+ l.down && (await l.down(e), await e.withPlugin(d(this, i, C)).deleteFrom(d(this, i, v)).where("name", "=", l.name).execute(), n[s] = {
2476
+ migrationName: l.name,
2455
2477
  direction: "Down",
2456
2478
  status: "Success"
2457
2479
  });
2458
- } catch (l) {
2480
+ } catch (c) {
2459
2481
  throw n[s] = {
2460
- migrationName: c.name,
2482
+ migrationName: l.name,
2461
2483
  direction: "Down",
2462
2484
  status: "Error"
2463
2485
  }, new Q({
2464
- error: l,
2486
+ error: c,
2465
2487
  results: n
2466
2488
  });
2467
2489
  }
@@ -2474,23 +2496,23 @@ h = new WeakMap(), i = new WeakSet(), A = async function(e) {
2474
2496
  status: "NotExecuted"
2475
2497
  }));
2476
2498
  for (let s = 0; s < n.length; s++) {
2477
- const c = a.pendingMigrations[s];
2499
+ const l = a.pendingMigrations[s];
2478
2500
  try {
2479
- await c.up(e), await e.withPlugin(d(this, i, C)).insertInto(d(this, i, v)).values({
2480
- name: c.name,
2501
+ await l.up(e), await e.withPlugin(d(this, i, C)).insertInto(d(this, i, v)).values({
2502
+ name: l.name,
2481
2503
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
2482
2504
  }).execute(), n[s] = {
2483
- migrationName: c.name,
2505
+ migrationName: l.name,
2484
2506
  direction: "Up",
2485
2507
  status: "Success"
2486
2508
  };
2487
- } catch (l) {
2509
+ } catch (c) {
2488
2510
  throw n[s] = {
2489
- migrationName: c.name,
2511
+ migrationName: l.name,
2490
2512
  direction: "Up",
2491
2513
  status: "Error"
2492
2514
  }, new Q({
2493
- error: l,
2515
+ error: c,
2494
2516
  results: n
2495
2517
  });
2496
2518
  }
@@ -2520,7 +2542,7 @@ class Fe {
2520
2542
  return this.migrations;
2521
2543
  }
2522
2544
  }
2523
- async function Aa(t) {
2545
+ async function Ea(t) {
2524
2546
  await t.schema.createTable("tenants").addColumn("id", "varchar(255)", (e) => e.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)", (e) => e.notNull()).addColumn("updated_at", "varchar(255)", (e) => e.notNull()).execute(), await t.schema.createTable("users").addColumn("user_id", "varchar(255)", (e) => e.notNull()).addColumn(
2525
2547
  "tenant_id",
2526
2548
  "varchar(255)",
@@ -2588,19 +2610,8 @@ async function Aa(t) {
2588
2610
  (e) => e.references("tenants.id").onDelete("cascade").notNull()
2589
2611
  ).addColumn("domain", "varchar(255)", (e) => e.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)", (e) => e.notNull()).addColumn("updated_at", "varchar(255)", (e) => e.notNull()).execute();
2590
2612
  }
2591
- async function Fa(t) {
2592
- await t.schema.dropTable("domains").execute(), await t.schema.dropTable("members").execute(), await t.schema.dropTable("users").execute(), await t.schema.dropTable("connections").execute(), await t.schema.dropTable("applications").execute(), await t.schema.dropTable("migrations").execute(), await t.schema.dropTable("tenants").execute();
2593
- }
2594
- const La = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2595
- __proto__: null,
2596
- down: Fa,
2597
- up: Aa
2598
- }, Symbol.toStringTag, { value: "Module" }));
2599
- async function Ea(t) {
2600
- await t.schema.alterTable("tenants").addColumn("support_url", "varchar(255)").execute();
2601
- }
2602
2613
  async function Ja(t) {
2603
- await t.schema.alterTable("tenants").dropColumn("support_url").execute();
2614
+ await t.schema.dropTable("domains").execute(), await t.schema.dropTable("members").execute(), await t.schema.dropTable("users").execute(), await t.schema.dropTable("connections").execute(), await t.schema.dropTable("applications").execute(), await t.schema.dropTable("migrations").execute(), await t.schema.dropTable("tenants").execute();
2604
2615
  }
2605
2616
  const za = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2606
2617
  __proto__: null,
@@ -2608,8 +2619,10 @@ const za = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2608
2619
  up: Ea
2609
2620
  }, Symbol.toStringTag, { value: "Module" }));
2610
2621
  async function Ka(t) {
2622
+ await t.schema.alterTable("tenants").addColumn("support_url", "varchar(255)").execute();
2611
2623
  }
2612
2624
  async function Ra(t) {
2625
+ await t.schema.alterTable("tenants").dropColumn("support_url").execute();
2613
2626
  }
2614
2627
  const Ua = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2615
2628
  __proto__: null,
@@ -2617,6 +2630,15 @@ const Ua = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2617
2630
  up: Ka
2618
2631
  }, Symbol.toStringTag, { value: "Module" }));
2619
2632
  async function Ba(t) {
2633
+ }
2634
+ async function Qa(t) {
2635
+ }
2636
+ const Va = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2637
+ __proto__: null,
2638
+ down: Qa,
2639
+ up: Ba
2640
+ }, Symbol.toStringTag, { value: "Module" }));
2641
+ async function Wa(t) {
2620
2642
  await t.schema.createTable("logs").addColumn("id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("category", "varchar(255)", (e) => e.notNull()).addColumn("tenant_id", "varchar(64)").addColumn("user_id", "varchar(64)").addForeignKeyConstraint(
2621
2643
  "tenant_id_constraint",
2622
2644
  ["tenant_id"],
@@ -2625,24 +2647,24 @@ async function Ba(t) {
2625
2647
  (e) => e.onDelete("cascade")
2626
2648
  ).addColumn("ip", "varchar(255)").addColumn("type", "varchar(8)", (e) => e.notNull()).addColumn("date", "varchar(25)", (e) => e.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();
2627
2649
  }
2628
- async function Qa(t) {
2650
+ async function qa(t) {
2629
2651
  await t.schema.dropTable("logs").execute();
2630
2652
  }
2631
- const Va = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2653
+ const Ga = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2632
2654
  __proto__: null,
2633
- down: Qa,
2634
- up: Ba
2655
+ down: qa,
2656
+ up: Wa
2635
2657
  }, Symbol.toStringTag, { value: "Module" }));
2636
- async function qa(t) {
2658
+ async function Ha(t) {
2637
2659
  }
2638
- async function Wa(t) {
2660
+ async function Xa(t) {
2639
2661
  }
2640
- const Ga = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2662
+ const Ya = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2641
2663
  __proto__: null,
2642
- down: Wa,
2643
- up: qa
2664
+ down: Xa,
2665
+ up: Ha
2644
2666
  }, Symbol.toStringTag, { value: "Module" }));
2645
- async function Ha(t) {
2667
+ async function Za(t) {
2646
2668
  await t.schema.createTable("sessions").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addForeignKeyConstraint(
2647
2669
  "user_id_constraint",
2648
2670
  ["user_id", "tenant_id"],
@@ -2667,15 +2689,15 @@ async function Ha(t) {
2667
2689
  (e) => e.references("applications.id").onDelete("cascade").notNull()
2668
2690
  ).addColumn("code", "varchar(255)", (e) => e.notNull()).addColumn("email", "varchar(255)", (e) => e.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)", (e) => e.notNull()).addColumn("expires_at", "varchar(255)", (e) => e.notNull()).addColumn("used_at", "varchar(255)").execute(), await t.schema.createIndex("otps_email_index").on("otps").column("email").execute(), await t.schema.createIndex("otps_expires_at_index").on("otps").column("expires_at").execute();
2669
2691
  }
2670
- async function Xa(t) {
2692
+ async function er(t) {
2671
2693
  await t.schema.dropTable("sessions").execute(), await t.schema.dropTable("tickets").execute(), await t.schema.dropTable("otps").execute();
2672
2694
  }
2673
- const Ya = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2695
+ const tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2674
2696
  __proto__: null,
2675
- down: Xa,
2676
- up: Ha
2697
+ down: er,
2698
+ up: Za
2677
2699
  }, Symbol.toStringTag, { value: "Module" }));
2678
- async function Za(t) {
2700
+ async function ar(t) {
2679
2701
  await t.schema.createTable("passwords").addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addPrimaryKeyConstraint("passwords_pkey", ["user_id", "tenant_id"]).addForeignKeyConstraint(
2680
2702
  "user_id_constraint",
2681
2703
  ["user_id", "tenant_id"],
@@ -2690,17 +2712,8 @@ async function Za(t) {
2690
2712
  (e) => e.onDelete("cascade")
2691
2713
  ).addColumn("type", "varchar(255)", (e) => e.notNull()).addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("expires_at", "varchar(255)", (e) => e.notNull()).addColumn("used_at", "varchar(255)").execute(), await t.schema.createIndex("codes_expires_at_index").on("codes").column("expires_at").execute();
2692
2714
  }
2693
- async function er(t) {
2694
- await t.schema.dropTable("passwords").execute(), await t.schema.dropTable("codes").execute();
2695
- }
2696
- const tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2697
- __proto__: null,
2698
- down: er,
2699
- up: Za
2700
- }, Symbol.toStringTag, { value: "Module" }));
2701
- async function ar(t) {
2702
- }
2703
2715
  async function rr(t) {
2716
+ await t.schema.dropTable("passwords").execute(), await t.schema.dropTable("codes").execute();
2704
2717
  }
2705
2718
  const nr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2706
2719
  __proto__: null,
@@ -2708,15 +2721,8 @@ const nr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2708
2721
  up: ar
2709
2722
  }, Symbol.toStringTag, { value: "Module" }));
2710
2723
  async function or(t) {
2711
- await t.schema.alterTable("passwords").addColumn(
2712
- "password",
2713
- "varchar(255)",
2714
- // do we want not null?
2715
- (e) => e.notNull()
2716
- ).execute();
2717
2724
  }
2718
2725
  async function sr(t) {
2719
- await t.schema.alterTable("passwords").dropColumn("password").execute();
2720
2726
  }
2721
2727
  const ir = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2722
2728
  __proto__: null,
@@ -2724,12 +2730,19 @@ const ir = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2724
2730
  up: or
2725
2731
  }, Symbol.toStringTag, { value: "Module" }));
2726
2732
  async function cr(t) {
2733
+ await t.schema.alterTable("passwords").addColumn(
2734
+ "password",
2735
+ "varchar(255)",
2736
+ // do we want not null?
2737
+ (e) => e.notNull()
2738
+ ).execute();
2727
2739
  }
2728
- async function lr(t) {
2740
+ async function dr(t) {
2741
+ await t.schema.alterTable("passwords").dropColumn("password").execute();
2729
2742
  }
2730
- const dr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2743
+ const lr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2731
2744
  __proto__: null,
2732
- down: lr,
2745
+ down: dr,
2733
2746
  up: cr
2734
2747
  }, Symbol.toStringTag, { value: "Module" }));
2735
2748
  async function ur(t) {
@@ -2751,10 +2764,8 @@ const pr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2751
2764
  up: _r
2752
2765
  }, Symbol.toStringTag, { value: "Module" }));
2753
2766
  async function gr(t) {
2754
- await t.schema.createIndex("users_email_index").on("users").column("email").execute();
2755
2767
  }
2756
2768
  async function yr(t) {
2757
- await t.schema.dropIndex("users_email_index").execute();
2758
2769
  }
2759
2770
  const wr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2760
2771
  __proto__: null,
@@ -2762,10 +2773,10 @@ const wr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2762
2773
  up: gr
2763
2774
  }, Symbol.toStringTag, { value: "Module" }));
2764
2775
  async function Nr(t) {
2765
- await t.schema.alterTable("users").addColumn("profileData", "varchar(2048)").execute();
2776
+ await t.schema.createIndex("users_email_index").on("users").column("email").execute();
2766
2777
  }
2767
2778
  async function vr(t) {
2768
- await t.schema.alterTable("users").dropColumn("profileData").execute();
2779
+ await t.schema.dropIndex("users_email_index").execute();
2769
2780
  }
2770
2781
  const Cr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2771
2782
  __proto__: null,
@@ -2773,10 +2784,10 @@ const Cr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2773
2784
  up: Nr
2774
2785
  }, Symbol.toStringTag, { value: "Module" }));
2775
2786
  async function br(t) {
2776
- await t.schema.createIndex("users_linked_to_index").on("users").column("linked_to").execute();
2787
+ await t.schema.alterTable("users").addColumn("profileData", "varchar(2048)").execute();
2777
2788
  }
2778
2789
  async function xr(t) {
2779
- await t.schema.dropIndex("users_linked_to_index");
2790
+ await t.schema.alterTable("users").dropColumn("profileData").execute();
2780
2791
  }
2781
2792
  const Tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2782
2793
  __proto__: null,
@@ -2784,10 +2795,10 @@ const Tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2784
2795
  up: br
2785
2796
  }, Symbol.toStringTag, { value: "Module" }));
2786
2797
  async function Sr(t) {
2787
- await t.schema.alterTable("users").addColumn("locale", "varchar(255)").execute();
2798
+ await t.schema.createIndex("users_linked_to_index").on("users").column("linked_to").execute();
2788
2799
  }
2789
2800
  async function Or(t) {
2790
- await t.schema.alterTable("users").dropColumn("locale").execute();
2801
+ await t.schema.dropIndex("users_linked_to_index");
2791
2802
  }
2792
2803
  const kr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2793
2804
  __proto__: null,
@@ -2795,14 +2806,10 @@ const kr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2795
2806
  up: Sr
2796
2807
  }, Symbol.toStringTag, { value: "Module" }));
2797
2808
  async function $r(t) {
2798
- await t.schema.createTable("keys").addColumn("kid", "varchar(255)", (e) => e.primaryKey()).addColumn(
2799
- "tenant_id",
2800
- "varchar(255)",
2801
- (e) => e.references("tenants.id").onDelete("cascade")
2802
- ).addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("revoked_at", "varchar(255)").addColumn("cert", "varchar(2048)").addColumn("pkcs7", "varchar(2048)").addColumn("fingerprint", "varchar(256)").addColumn("thumbprint", "varchar(256)").addColumn("current_since", "varchar(256)").addColumn("current_until", "varchar(256)").execute();
2809
+ await t.schema.alterTable("users").addColumn("locale", "varchar(255)").execute();
2803
2810
  }
2804
2811
  async function Dr(t) {
2805
- await t.schema.dropTable("keys").execute();
2812
+ await t.schema.alterTable("users").dropColumn("locale").execute();
2806
2813
  }
2807
2814
  const Ir = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2808
2815
  __proto__: null,
@@ -2810,8 +2817,14 @@ const Ir = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2810
2817
  up: $r
2811
2818
  }, Symbol.toStringTag, { value: "Module" }));
2812
2819
  async function jr(t) {
2820
+ await t.schema.createTable("keys").addColumn("kid", "varchar(255)", (e) => e.primaryKey()).addColumn(
2821
+ "tenant_id",
2822
+ "varchar(255)",
2823
+ (e) => e.references("tenants.id").onDelete("cascade")
2824
+ ).addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("revoked_at", "varchar(255)").addColumn("cert", "varchar(2048)").addColumn("pkcs7", "varchar(2048)").addColumn("fingerprint", "varchar(256)").addColumn("thumbprint", "varchar(256)").addColumn("current_since", "varchar(256)").addColumn("current_until", "varchar(256)").execute();
2813
2825
  }
2814
2826
  async function Pr(t) {
2827
+ await t.schema.dropTable("keys").execute();
2815
2828
  }
2816
2829
  const Mr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2817
2830
  __proto__: null,
@@ -2828,10 +2841,8 @@ const Lr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2828
2841
  up: Ar
2829
2842
  }, Symbol.toStringTag, { value: "Module" }));
2830
2843
  async function Er(t) {
2831
- await t.schema.alterTable("otps").addColumn("audience", "varchar(255)").execute();
2832
2844
  }
2833
2845
  async function Jr(t) {
2834
- await t.schema.alterTable("otps").dropColumn("audience").execute();
2835
2846
  }
2836
2847
  const zr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2837
2848
  __proto__: null,
@@ -2839,8 +2850,10 @@ const zr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2839
2850
  up: Er
2840
2851
  }, Symbol.toStringTag, { value: "Module" }));
2841
2852
  async function Kr(t) {
2853
+ await t.schema.alterTable("otps").addColumn("audience", "varchar(255)").execute();
2842
2854
  }
2843
2855
  async function Rr(t) {
2856
+ await t.schema.alterTable("otps").dropColumn("audience").execute();
2844
2857
  }
2845
2858
  const Ur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2846
2859
  __proto__: null,
@@ -2848,32 +2861,30 @@ const Ur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2848
2861
  up: Kr
2849
2862
  }, Symbol.toStringTag, { value: "Module" }));
2850
2863
  async function Br(t) {
2851
- await t.schema.alterTable("logs").dropColumn("category").execute();
2852
2864
  }
2853
2865
  async function Qr(t) {
2854
- await t.schema.alterTable("logs").addColumn("category", "varchar(255)", (e) => e.notNull()).execute();
2855
2866
  }
2856
2867
  const Vr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2857
2868
  __proto__: null,
2858
2869
  down: Qr,
2859
2870
  up: Br
2860
2871
  }, Symbol.toStringTag, { value: "Module" }));
2861
- async function qr(t) {
2862
- await t.schema.alterTable("users").dropColumn("tags").execute();
2863
- }
2864
2872
  async function Wr(t) {
2865
- await t.schema.alterTable("users").addColumn("tags", "varchar(255)").execute();
2873
+ await t.schema.alterTable("logs").dropColumn("category").execute();
2874
+ }
2875
+ async function qr(t) {
2876
+ await t.schema.alterTable("logs").addColumn("category", "varchar(255)", (e) => e.notNull()).execute();
2866
2877
  }
2867
2878
  const Gr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2868
2879
  __proto__: null,
2869
- down: Wr,
2870
- up: qr
2880
+ down: qr,
2881
+ up: Wr
2871
2882
  }, Symbol.toStringTag, { value: "Module" }));
2872
2883
  async function Hr(t) {
2873
- await t.schema.createIndex("logs_user_id").on("logs").column("user_id").execute(), await t.schema.createIndex("logs_tenant_id").on("logs").column("tenant_id").execute(), await t.schema.createIndex("logs_date").on("logs").column("date").execute();
2884
+ await t.schema.alterTable("users").dropColumn("tags").execute();
2874
2885
  }
2875
2886
  async function Xr(t) {
2876
- await t.schema.dropIndex("logs_user_id"), await t.schema.dropIndex("logs_tenant_id"), await t.schema.dropIndex("logs_date");
2887
+ await t.schema.alterTable("users").addColumn("tags", "varchar(255)").execute();
2877
2888
  }
2878
2889
  const Yr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2879
2890
  __proto__: null,
@@ -2881,10 +2892,10 @@ const Yr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2881
2892
  up: Hr
2882
2893
  }, Symbol.toStringTag, { value: "Module" }));
2883
2894
  async function Zr(t) {
2884
- await t.schema.alterTable("logs").dropColumn("details").execute(), await t.schema.alterTable("logs").addColumn("details", "varchar(8192)").execute();
2895
+ await t.schema.createIndex("logs_user_id").on("logs").column("user_id").execute(), await t.schema.createIndex("logs_tenant_id").on("logs").column("tenant_id").execute(), await t.schema.createIndex("logs_date").on("logs").column("date").execute();
2885
2896
  }
2886
2897
  async function en(t) {
2887
- await t.schema.alterTable("logs").dropColumn("details").execute(), await t.schema.alterTable("logs").addColumn("details", "varchar(2048)").execute();
2898
+ await t.schema.dropIndex("logs_user_id"), await t.schema.dropIndex("logs_tenant_id"), await t.schema.dropIndex("logs_date");
2888
2899
  }
2889
2900
  const tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2890
2901
  __proto__: null,
@@ -2892,10 +2903,10 @@ const tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2892
2903
  up: Zr
2893
2904
  }, Symbol.toStringTag, { value: "Module" }));
2894
2905
  async function an(t) {
2895
- await t.schema.alterTable("logs").addColumn("user_name", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("auth0_client", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("isMobile", "boolean").execute(), await t.schema.alterTable("logs").addColumn("connection", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("connection_id", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("audience", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("scope", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("strategy", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("strategy_type", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("hostname", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("session_connection", "varchar(255)").execute();
2906
+ await t.schema.alterTable("logs").dropColumn("details").execute(), await t.schema.alterTable("logs").addColumn("details", "varchar(8192)").execute();
2896
2907
  }
2897
2908
  async function rn(t) {
2898
- await t.schema.alterTable("logs").dropColumn("user_name").execute(), await t.schema.alterTable("logs").dropColumn("auth0_client").execute(), await t.schema.alterTable("logs").dropColumn("isMobile").execute(), await t.schema.alterTable("logs").dropColumn("connection").execute(), await t.schema.alterTable("logs").dropColumn("connection_id").execute(), await t.schema.alterTable("logs").dropColumn("audience").execute(), await t.schema.alterTable("logs").dropColumn("scope").execute(), await t.schema.alterTable("logs").dropColumn("strategy").execute(), await t.schema.alterTable("logs").dropColumn("strategy_type").execute(), await t.schema.alterTable("logs").dropColumn("hostname").execute(), await t.schema.alterTable("logs").dropColumn("session_connection").execute();
2909
+ await t.schema.alterTable("logs").dropColumn("details").execute(), await t.schema.alterTable("logs").addColumn("details", "varchar(2048)").execute();
2899
2910
  }
2900
2911
  const nn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2901
2912
  __proto__: null,
@@ -2903,31 +2914,31 @@ const nn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2903
2914
  up: an
2904
2915
  }, Symbol.toStringTag, { value: "Module" }));
2905
2916
  async function on(t) {
2906
- await t.schema.createIndex("users_name_index").on("users").column("name").execute();
2917
+ await t.schema.alterTable("logs").addColumn("user_name", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("auth0_client", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("isMobile", "boolean").execute(), await t.schema.alterTable("logs").addColumn("connection", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("connection_id", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("audience", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("scope", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("strategy", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("strategy_type", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("hostname", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("session_connection", "varchar(255)").execute();
2907
2918
  }
2908
2919
  async function sn(t) {
2909
- await t.schema.dropIndex("users_name_index").execute();
2920
+ await t.schema.alterTable("logs").dropColumn("user_name").execute(), await t.schema.alterTable("logs").dropColumn("auth0_client").execute(), await t.schema.alterTable("logs").dropColumn("isMobile").execute(), await t.schema.alterTable("logs").dropColumn("connection").execute(), await t.schema.alterTable("logs").dropColumn("connection_id").execute(), await t.schema.alterTable("logs").dropColumn("audience").execute(), await t.schema.alterTable("logs").dropColumn("scope").execute(), await t.schema.alterTable("logs").dropColumn("strategy").execute(), await t.schema.alterTable("logs").dropColumn("strategy_type").execute(), await t.schema.alterTable("logs").dropColumn("hostname").execute(), await t.schema.alterTable("logs").dropColumn("session_connection").execute();
2910
2921
  }
2911
2922
  const cn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2912
2923
  __proto__: null,
2913
2924
  down: sn,
2914
2925
  up: on
2915
2926
  }, Symbol.toStringTag, { value: "Module" }));
2916
- async function ln(t) {
2917
- }
2918
2927
  async function dn(t) {
2919
- await t.schema.alterTable("users").dropConstraint("unique_email_provider").execute();
2928
+ await t.schema.createIndex("users_name_index").on("users").column("name").execute();
2929
+ }
2930
+ async function ln(t) {
2931
+ await t.schema.dropIndex("users_name_index").execute();
2920
2932
  }
2921
2933
  const un = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2922
2934
  __proto__: null,
2923
- down: dn,
2924
- up: ln
2935
+ down: ln,
2936
+ up: dn
2925
2937
  }, Symbol.toStringTag, { value: "Module" }));
2926
2938
  async function mn(t) {
2927
- await t.schema.alterTable("otps").dropColumn("state").execute(), await t.schema.alterTable("otps").addColumn("state", "varchar(8192)").execute();
2928
2939
  }
2929
2940
  async function hn(t) {
2930
- await t.schema.alterTable("otps").dropColumn("state").execute(), await t.schema.alterTable("otps").addColumn("state", "varchar(1024)").execute();
2941
+ await t.schema.alterTable("users").dropConstraint("unique_email_provider").execute();
2931
2942
  }
2932
2943
  const _n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2933
2944
  __proto__: null,
@@ -2935,10 +2946,10 @@ const _n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2935
2946
  up: mn
2936
2947
  }, Symbol.toStringTag, { value: "Module" }));
2937
2948
  async function fn(t) {
2938
- await t.schema.alterTable("tickets").dropColumn("state").execute(), await t.schema.alterTable("tickets").addColumn("state", "varchar(8192)").execute();
2949
+ await t.schema.alterTable("otps").dropColumn("state").execute(), await t.schema.alterTable("otps").addColumn("state", "varchar(8192)").execute();
2939
2950
  }
2940
2951
  async function pn(t) {
2941
- await t.schema.alterTable("tickets").dropColumn("state").execute(), await t.schema.alterTable("tickets").addColumn("state", "varchar(1024)").execute();
2952
+ await t.schema.alterTable("otps").dropColumn("state").execute(), await t.schema.alterTable("otps").addColumn("state", "varchar(1024)").execute();
2942
2953
  }
2943
2954
  const gn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2944
2955
  __proto__: null,
@@ -2946,14 +2957,10 @@ const gn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2946
2957
  up: fn
2947
2958
  }, Symbol.toStringTag, { value: "Module" }));
2948
2959
  async function yn(t) {
2949
- await t.schema.createTable("branding").addColumn(
2950
- "tenant_id",
2951
- "varchar(255)",
2952
- (e) => e.references("tenants.id").onDelete("cascade").notNull().primaryKey()
2953
- ).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();
2960
+ await t.schema.alterTable("tickets").dropColumn("state").execute(), await t.schema.alterTable("tickets").addColumn("state", "varchar(8192)").execute();
2954
2961
  }
2955
2962
  async function wn(t) {
2956
- await t.schema.dropTable("branding").execute();
2963
+ await t.schema.alterTable("tickets").dropColumn("state").execute(), await t.schema.alterTable("tickets").addColumn("state", "varchar(1024)").execute();
2957
2964
  }
2958
2965
  const Nn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2959
2966
  __proto__: null,
@@ -2961,8 +2968,14 @@ const Nn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2961
2968
  up: yn
2962
2969
  }, Symbol.toStringTag, { value: "Module" }));
2963
2970
  async function vn(t) {
2971
+ await t.schema.createTable("branding").addColumn(
2972
+ "tenant_id",
2973
+ "varchar(255)",
2974
+ (e) => e.references("tenants.id").onDelete("cascade").notNull().primaryKey()
2975
+ ).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();
2964
2976
  }
2965
2977
  async function Cn(t) {
2978
+ await t.schema.dropTable("branding").execute();
2966
2979
  }
2967
2980
  const bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2968
2981
  __proto__: null,
@@ -2997,18 +3010,8 @@ const jn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2997
3010
  up: Dn
2998
3011
  }, Symbol.toStringTag, { value: "Module" }));
2999
3012
  async function Pn(t) {
3000
- await t.schema.createTable("authentication_codes").addColumn(
3001
- "tenant_id",
3002
- "varchar(255)",
3003
- (e) => e.references("tenants.id").onDelete("cascade").notNull()
3004
- ).addColumn("code", "varchar(255)", (e) => e.primaryKey()).addColumn(
3005
- "client_id",
3006
- "varchar(255)",
3007
- (e) => e.references("applications.id").onDelete("cascade").notNull()
3008
- ).addColumn("user_id", "varchar(255)", (e) => e.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)", (e) => e.notNull()).addColumn("expires_at", "varchar(255)", (e) => e.notNull()).addColumn("used_at", "varchar(255)").execute();
3009
3013
  }
3010
3014
  async function Mn(t) {
3011
- await t.schema.dropTable("authentication_codes").execute();
3012
3015
  }
3013
3016
  const An = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3014
3017
  __proto__: null,
@@ -3016,8 +3019,18 @@ const An = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3016
3019
  up: Pn
3017
3020
  }, Symbol.toStringTag, { value: "Module" }));
3018
3021
  async function Fn(t) {
3022
+ await t.schema.createTable("authentication_codes").addColumn(
3023
+ "tenant_id",
3024
+ "varchar(255)",
3025
+ (e) => e.references("tenants.id").onDelete("cascade").notNull()
3026
+ ).addColumn("code", "varchar(255)", (e) => e.primaryKey()).addColumn(
3027
+ "client_id",
3028
+ "varchar(255)",
3029
+ (e) => e.references("applications.id").onDelete("cascade").notNull()
3030
+ ).addColumn("user_id", "varchar(255)", (e) => e.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)", (e) => e.notNull()).addColumn("expires_at", "varchar(255)", (e) => e.notNull()).addColumn("used_at", "varchar(255)").execute();
3019
3031
  }
3020
3032
  async function Ln(t) {
3033
+ await t.schema.dropTable("authentication_codes").execute();
3021
3034
  }
3022
3035
  const En = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3023
3036
  __proto__: null,
@@ -3025,10 +3038,8 @@ const En = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3025
3038
  up: Fn
3026
3039
  }, Symbol.toStringTag, { value: "Module" }));
3027
3040
  async function Jn(t) {
3028
- await t.schema.alterTable("otps").addColumn("ip", "varchar(64)").execute();
3029
3041
  }
3030
3042
  async function zn(t) {
3031
- await t.schema.alterTable("otps").dropColumn("ip").execute();
3032
3043
  }
3033
3044
  const Kn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3034
3045
  __proto__: null,
@@ -3036,10 +3047,10 @@ const Kn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3036
3047
  up: Jn
3037
3048
  }, Symbol.toStringTag, { value: "Module" }));
3038
3049
  async function Rn(t) {
3039
- await t.schema.alterTable("logs").dropColumn("user_agent").execute(), await t.schema.alterTable("logs").addColumn("user_agent", "varchar(1024)").execute();
3050
+ await t.schema.alterTable("otps").addColumn("ip", "varchar(64)").execute();
3040
3051
  }
3041
3052
  async function Un(t) {
3042
- await t.schema.alterTable("logs").dropColumn("user_agent").execute(), await t.schema.alterTable("logs").addColumn("user_agent", "varchar(255)").execute();
3053
+ await t.schema.alterTable("otps").dropColumn("ip").execute();
3043
3054
  }
3044
3055
  const Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3045
3056
  __proto__: null,
@@ -3047,15 +3058,26 @@ const Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3047
3058
  up: Rn
3048
3059
  }, Symbol.toStringTag, { value: "Module" }));
3049
3060
  async function Qn(t) {
3061
+ await t.schema.alterTable("logs").dropColumn("user_agent").execute(), await t.schema.alterTable("logs").addColumn("user_agent", "varchar(1024)").execute();
3050
3062
  }
3051
3063
  async function Vn(t) {
3064
+ await t.schema.alterTable("logs").dropColumn("user_agent").execute(), await t.schema.alterTable("logs").addColumn("user_agent", "varchar(255)").execute();
3052
3065
  }
3053
- const qn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3066
+ const Wn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3054
3067
  __proto__: null,
3055
3068
  down: Vn,
3056
3069
  up: Qn
3057
3070
  }, Symbol.toStringTag, { value: "Module" }));
3058
- async function Wn(t) {
3071
+ async function qn(t) {
3072
+ }
3073
+ async function Gn(t) {
3074
+ }
3075
+ const Hn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3076
+ __proto__: null,
3077
+ down: Gn,
3078
+ up: qn
3079
+ }, Symbol.toStringTag, { value: "Module" }));
3080
+ async function Xn(t) {
3059
3081
  await t.schema.createTable("hooks").addColumn("hook_id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn(
3060
3082
  "tenant_id",
3061
3083
  "varchar(255)",
@@ -3066,17 +3088,8 @@ async function Wn(t) {
3066
3088
  (e) => e.defaultTo(!1).notNull()
3067
3089
  ).addColumn("priority", "integer").execute();
3068
3090
  }
3069
- async function Gn(t) {
3070
- await t.schema.dropTable("hooks").execute();
3071
- }
3072
- const Hn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3073
- __proto__: null,
3074
- down: Gn,
3075
- up: Wn
3076
- }, Symbol.toStringTag, { value: "Module" }));
3077
- async function Xn(t) {
3078
- }
3079
3091
  async function Yn(t) {
3092
+ await t.schema.dropTable("hooks").execute();
3080
3093
  }
3081
3094
  const Zn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3082
3095
  __proto__: null,
@@ -3093,6 +3106,15 @@ const ao = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3093
3106
  up: eo
3094
3107
  }, Symbol.toStringTag, { value: "Module" }));
3095
3108
  async function ro(t) {
3109
+ }
3110
+ async function no(t) {
3111
+ }
3112
+ const oo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3113
+ __proto__: null,
3114
+ down: no,
3115
+ up: ro
3116
+ }, Symbol.toStringTag, { value: "Module" }));
3117
+ async function so(t) {
3096
3118
  await t.schema.createTable("logins").addColumn("login_id", "varchar(255)", (e) => e.primaryKey()).addColumn(
3097
3119
  "tenant_id",
3098
3120
  "varchar(255)",
@@ -3109,7 +3131,7 @@ async function ro(t) {
3109
3131
  (e) => e.onDelete("cascade")
3110
3132
  ).addColumn("code_type", "varchar(255)", (e) => e.notNull()).addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("expires_at", "varchar(255)", (e) => e.notNull()).addColumn("used_at", "varchar(255)").execute();
3111
3133
  }
3112
- async function no(t) {
3134
+ async function io(t) {
3113
3135
  await t.schema.dropTable("logins").execute(), await t.schema.alterTable("passwords").dropColumn("algorithm").execute(), await t.schema.dropTable("codes").execute(), await t.schema.createTable("codes").addColumn("id", "varchar(255)", (e) => e.primaryKey()).addColumn("code", "varchar(255)", (e) => e.notNull()).addColumn("user_id", "varchar(255)").addColumn("tenant_id", "varchar(255)").addForeignKeyConstraint(
3114
3136
  "codes_user_id_tenant_id_constraint",
3115
3137
  ["user_id", "tenant_id"],
@@ -3118,25 +3140,14 @@ async function no(t) {
3118
3140
  (e) => e.onDelete("cascade")
3119
3141
  ).addColumn("type", "varchar(255)", (e) => e.notNull()).addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("expires_at", "varchar(255)", (e) => e.notNull()).addColumn("used_at", "varchar(255)").execute();
3120
3142
  }
3121
- const oo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3122
- __proto__: null,
3123
- down: no,
3124
- up: ro
3125
- }, Symbol.toStringTag, { value: "Module" }));
3126
- async function so(t) {
3127
- }
3128
- async function io(t) {
3129
- }
3130
3143
  const co = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3131
3144
  __proto__: null,
3132
3145
  down: io,
3133
3146
  up: so
3134
3147
  }, Symbol.toStringTag, { value: "Module" }));
3135
3148
  async function lo(t) {
3136
- await t.schema.alterTable("logins").addColumn("auth0Client", "varchar(256)").execute();
3137
3149
  }
3138
3150
  async function uo(t) {
3139
- await t.schema.alterTable("logins").dropColumn("auth0Client").execute();
3140
3151
  }
3141
3152
  const mo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3142
3153
  __proto__: null,
@@ -3144,10 +3155,10 @@ const mo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3144
3155
  up: lo
3145
3156
  }, Symbol.toStringTag, { value: "Module" }));
3146
3157
  async function ho(t) {
3147
- await t.schema.alterTable("logins").dropColumn("authParams_state").execute(), await t.schema.alterTable("logins").addColumn("authParams_state", "varchar(8192)").execute();
3158
+ await t.schema.alterTable("logins").addColumn("auth0Client", "varchar(256)").execute();
3148
3159
  }
3149
3160
  async function _o(t) {
3150
- await t.schema.alterTable("logins").dropColumn("authParams_state").execute(), await t.schema.alterTable("logins").addColumn("authParams_state", "varchar(511)").execute();
3161
+ await t.schema.alterTable("logins").dropColumn("auth0Client").execute();
3151
3162
  }
3152
3163
  const fo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3153
3164
  __proto__: null,
@@ -3155,8 +3166,10 @@ const fo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3155
3166
  up: ho
3156
3167
  }, Symbol.toStringTag, { value: "Module" }));
3157
3168
  async function po(t) {
3169
+ await t.schema.alterTable("logins").dropColumn("authParams_state").execute(), await t.schema.alterTable("logins").addColumn("authParams_state", "varchar(8192)").execute();
3158
3170
  }
3159
3171
  async function go(t) {
3172
+ await t.schema.alterTable("logins").dropColumn("authParams_state").execute(), await t.schema.alterTable("logins").addColumn("authParams_state", "varchar(511)").execute();
3160
3173
  }
3161
3174
  const yo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3162
3175
  __proto__: null,
@@ -3173,10 +3186,8 @@ const vo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3173
3186
  up: wo
3174
3187
  }, Symbol.toStringTag, { value: "Module" }));
3175
3188
  async function Co(t) {
3176
- await t.schema.alterTable("logins").addColumn("authParams_nonce", "varchar(255)").execute();
3177
3189
  }
3178
3190
  async function bo(t) {
3179
- await t.schema.alterTable("logins").dropColumn("nonce").execute();
3180
3191
  }
3181
3192
  const xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3182
3193
  __proto__: null,
@@ -3184,8 +3195,10 @@ const xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3184
3195
  up: Co
3185
3196
  }, Symbol.toStringTag, { value: "Module" }));
3186
3197
  async function To(t) {
3198
+ await t.schema.alterTable("logins").addColumn("authParams_nonce", "varchar(255)").execute();
3187
3199
  }
3188
3200
  async function So(t) {
3201
+ await t.schema.alterTable("logins").dropColumn("nonce").execute();
3189
3202
  }
3190
3203
  const Oo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3191
3204
  __proto__: null,
@@ -3202,6 +3215,15 @@ const Do = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3202
3215
  up: ko
3203
3216
  }, Symbol.toStringTag, { value: "Module" }));
3204
3217
  async function Io(t) {
3218
+ }
3219
+ async function jo(t) {
3220
+ }
3221
+ const Po = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3222
+ __proto__: null,
3223
+ down: jo,
3224
+ up: Io
3225
+ }, Symbol.toStringTag, { value: "Module" }));
3226
+ async function Mo(t) {
3205
3227
  await t.schema.dropTable("codes").execute(), await t.schema.createTable("codes").addColumn("code_id", "varchar(255)", (e) => e.notNull()).addColumn(
3206
3228
  "tenant_id",
3207
3229
  "varchar(255)",
@@ -3217,7 +3239,7 @@ async function Io(t) {
3217
3239
  "code_type"
3218
3240
  ]).execute();
3219
3241
  }
3220
- async function jo(t) {
3242
+ async function Ao(t) {
3221
3243
  await t.schema.dropTable("codes").execute(), await t.schema.createTable("codes").addColumn("code_id", "varchar(255)", (e) => e.primaryKey()).addColumn(
3222
3244
  "tenant_id",
3223
3245
  "varchar(255)",
@@ -3230,15 +3252,15 @@ async function jo(t) {
3230
3252
  (e) => e.onDelete("cascade")
3231
3253
  ).addColumn("code_type", "varchar(255)", (e) => e.notNull()).addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("expires_at", "varchar(255)", (e) => e.notNull()).addColumn("used_at", "varchar(255)").execute();
3232
3254
  }
3233
- const Po = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3255
+ const Fo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3234
3256
  __proto__: null,
3235
- down: jo,
3236
- up: Io
3257
+ down: Ao,
3258
+ up: Mo
3237
3259
  }, Symbol.toStringTag, { value: "Module" }));
3238
- async function Mo(t) {
3260
+ async function Lo(t) {
3239
3261
  await t.schema.dropTable("otps").execute(), await t.schema.dropTable("authentication_codes").execute();
3240
3262
  }
3241
- async function Ao(t) {
3263
+ async function Eo(t) {
3242
3264
  await t.schema.alterTable("keys").addColumn("private_key", "varchar(2048)").addColumn("public_key", "varchar(2048)").execute(), await t.schema.createTable("otps").addColumn(
3243
3265
  "tenant_id",
3244
3266
  "varchar(255)",
@@ -3257,25 +3279,16 @@ async function Ao(t) {
3257
3279
  (e) => e.references("applications.id").onDelete("cascade").notNull()
3258
3280
  ).addColumn("user_id", "varchar(255)", (e) => e.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)", (e) => e.notNull()).addColumn("expires_at", "varchar(255)", (e) => e.notNull()).addColumn("used_at", "varchar(255)").execute();
3259
3281
  }
3260
- const Fo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3261
- __proto__: null,
3262
- down: Ao,
3263
- up: Mo
3264
- }, Symbol.toStringTag, { value: "Module" }));
3265
- async function Lo(t) {
3266
- await t.schema.createIndex("IDX_logs_tenant_date_type_user").on("logs").columns(["tenant_id", "date", "type", "user_id"]).execute();
3267
- }
3268
- async function Eo(t) {
3269
- await t.schema.dropIndex("IDX_logs_tenant_date_type_user").on("logs").execute();
3270
- }
3271
3282
  const Jo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3272
3283
  __proto__: null,
3273
3284
  down: Eo,
3274
3285
  up: Lo
3275
3286
  }, Symbol.toStringTag, { value: "Module" }));
3276
3287
  async function zo(t) {
3288
+ await t.schema.createIndex("IDX_logs_tenant_date_type_user").on("logs").columns(["tenant_id", "date", "type", "user_id"]).execute();
3277
3289
  }
3278
3290
  async function Ko(t) {
3291
+ await t.schema.dropIndex("IDX_logs_tenant_date_type_user").on("logs").execute();
3279
3292
  }
3280
3293
  const Ro = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3281
3294
  __proto__: null,
@@ -3283,6 +3296,15 @@ const Ro = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3283
3296
  up: zo
3284
3297
  }, Symbol.toStringTag, { value: "Module" }));
3285
3298
  async function Uo(t) {
3299
+ }
3300
+ async function Bo(t) {
3301
+ }
3302
+ const Qo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3303
+ __proto__: null,
3304
+ down: Bo,
3305
+ up: Uo
3306
+ }, Symbol.toStringTag, { value: "Module" }));
3307
+ async function Vo(t) {
3286
3308
  await t.schema.createTable("prompt_settings").addColumn("tenant_id", "varchar(64)", (e) => e.primaryKey()).addColumn(
3287
3309
  "universal_login_experience",
3288
3310
  "varchar(16)",
@@ -3301,21 +3323,12 @@ async function Uo(t) {
3301
3323
  (e) => e.defaultTo(!1).notNull()
3302
3324
  ).execute();
3303
3325
  }
3304
- async function Bo(t) {
3326
+ async function Wo(t) {
3305
3327
  await t.schema.dropTable("prompt_settings").execute();
3306
3328
  }
3307
- const Qo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3308
- __proto__: null,
3309
- down: Bo,
3310
- up: Uo
3311
- }, Symbol.toStringTag, { value: "Module" }));
3312
- async function Vo(t) {
3313
- }
3314
- async function qo(t) {
3315
- }
3316
- const Wo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3329
+ const qo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3317
3330
  __proto__: null,
3318
- down: qo,
3331
+ down: Wo,
3319
3332
  up: Vo
3320
3333
  }, Symbol.toStringTag, { value: "Module" }));
3321
3334
  async function Go(t) {
@@ -3337,10 +3350,8 @@ const es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3337
3350
  up: Yo
3338
3351
  }, Symbol.toStringTag, { value: "Module" }));
3339
3352
  async function ts(t) {
3340
- await t.schema.alterTable("logins").addColumn("authParams_ui_locales", "varchar(32)").execute();
3341
3353
  }
3342
3354
  async function as(t) {
3343
- await t.schema.alterTable("logins").dropColumn("authParams_ui_locales").execute();
3344
3355
  }
3345
3356
  const rs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3346
3357
  __proto__: null,
@@ -3348,10 +3359,10 @@ const rs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3348
3359
  up: ts
3349
3360
  }, Symbol.toStringTag, { value: "Module" }));
3350
3361
  async function ns(t) {
3351
- await t.schema.alterTable("logins").addColumn("authParams_prompt", "varchar(16)").execute();
3362
+ await t.schema.alterTable("logins").addColumn("authParams_ui_locales", "varchar(32)").execute();
3352
3363
  }
3353
3364
  async function os(t) {
3354
- await t.schema.alterTable("logins").dropColumn("authParams_prompt").execute();
3365
+ await t.schema.alterTable("logins").dropColumn("authParams_ui_locales").execute();
3355
3366
  }
3356
3367
  const ss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3357
3368
  __proto__: null,
@@ -3359,30 +3370,30 @@ const ss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3359
3370
  up: ns
3360
3371
  }, Symbol.toStringTag, { value: "Module" }));
3361
3372
  async function is(t) {
3373
+ await t.schema.alterTable("logins").addColumn("authParams_prompt", "varchar(16)").execute();
3362
3374
  }
3363
3375
  async function cs(t) {
3376
+ await t.schema.alterTable("logins").dropColumn("authParams_prompt").execute();
3364
3377
  }
3365
- const ls = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3378
+ const ds = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3366
3379
  __proto__: null,
3367
3380
  down: cs,
3368
3381
  up: is
3369
3382
  }, Symbol.toStringTag, { value: "Module" }));
3370
- async function ds(t) {
3371
- await t.schema.alterTable("logins").addColumn("authParams_act_as", "varchar(255)").execute();
3383
+ async function ls(t) {
3372
3384
  }
3373
3385
  async function us(t) {
3374
- await t.schema.alterTable("logins").dropColumn("authParam_act_as").execute();
3375
3386
  }
3376
3387
  const ms = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3377
3388
  __proto__: null,
3378
3389
  down: us,
3379
- up: ds
3390
+ up: ls
3380
3391
  }, Symbol.toStringTag, { value: "Module" }));
3381
3392
  async function hs(t) {
3382
- await t.schema.alterTable("codes").addColumn("code_verifier", "varchar(128)").execute();
3393
+ await t.schema.alterTable("logins").addColumn("authParams_act_as", "varchar(255)").execute();
3383
3394
  }
3384
3395
  async function _s(t) {
3385
- await t.schema.alterTable("codes").dropColumn("code_verifier").execute();
3396
+ await t.schema.alterTable("logins").dropColumn("authParam_act_as").execute();
3386
3397
  }
3387
3398
  const fs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3388
3399
  __proto__: null,
@@ -3390,6 +3401,17 @@ const fs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3390
3401
  up: hs
3391
3402
  }, Symbol.toStringTag, { value: "Module" }));
3392
3403
  async function ps(t) {
3404
+ await t.schema.alterTable("codes").addColumn("code_verifier", "varchar(128)").execute();
3405
+ }
3406
+ async function gs(t) {
3407
+ await t.schema.alterTable("codes").dropColumn("code_verifier").execute();
3408
+ }
3409
+ const ys = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3410
+ __proto__: null,
3411
+ down: gs,
3412
+ up: ps
3413
+ }, Symbol.toStringTag, { value: "Module" }));
3414
+ async function ws(t) {
3393
3415
  await t.schema.createTable("email_providers").addColumn("tenant_id", "varchar(255)", (e) => e.primaryKey()).addColumn("name", "varchar(255)", (e) => e.notNull()).addColumn("enabled", "boolean", (e) => e.notNull()).addColumn("default_from_address", "varchar(255)").addColumn(
3394
3416
  "credentials",
3395
3417
  "varchar(2048)",
@@ -3400,18 +3422,18 @@ async function ps(t) {
3400
3422
  (e) => e.notNull().defaultTo("{}")
3401
3423
  ).addColumn("created_at", "varchar(29)", (e) => e.notNull()).addColumn("updated_at", "varchar(29)", (e) => e.notNull()).execute();
3402
3424
  }
3403
- async function gs(t) {
3425
+ async function Ns(t) {
3404
3426
  await t.schema.dropTable("email_providers").execute();
3405
3427
  }
3406
- const ys = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3428
+ const vs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3407
3429
  __proto__: null,
3408
- down: gs,
3409
- up: ps
3430
+ down: Ns,
3431
+ up: ws
3410
3432
  }, Symbol.toStringTag, { value: "Module" }));
3411
- async function ws(t) {
3433
+ async function Cs(t) {
3412
3434
  await t.schema.dropTable("tickets").execute();
3413
3435
  }
3414
- async function Ns(t) {
3436
+ async function bs(t) {
3415
3437
  await t.schema.createTable("tickets").addColumn(
3416
3438
  "tenant_id",
3417
3439
  "varchar(255)",
@@ -3422,22 +3444,22 @@ async function Ns(t) {
3422
3444
  (e) => e.references("applications.id").onDelete("cascade").notNull()
3423
3445
  ).addColumn("email", "varchar(255)", (e) => e.notNull()).addColumn("nonce", "varchar(255)").addColumn("state", "varchar(1024)").addColumn("scope", "varchar(1024)").addColumn("response_type", "varchar(256)").addColumn("response_mode", "varchar(256)").addColumn("redirect_uri", "varchar(1024)").addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("expires_at", "varchar(255)", (e) => e.notNull()).addColumn("used_at", "varchar(255)").execute();
3424
3446
  }
3425
- const vs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3447
+ const xs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3426
3448
  __proto__: null,
3427
- down: Ns,
3428
- up: ws
3449
+ down: bs,
3450
+ up: Cs
3429
3451
  }, Symbol.toStringTag, { value: "Module" }));
3430
- async function Cs(t) {
3452
+ async function Ts(t) {
3431
3453
  }
3432
- async function bs(t) {
3454
+ async function Ss(t) {
3433
3455
  await t.schema.alterTable("logins").dropColumn("ip").dropColumn("useragent").execute();
3434
3456
  }
3435
- const xs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3457
+ const Os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3436
3458
  __proto__: null,
3437
- down: bs,
3438
- up: Cs
3459
+ down: Ss,
3460
+ up: Ts
3439
3461
  }, Symbol.toStringTag, { value: "Module" }));
3440
- async function Ts(t) {
3462
+ async function ks(t) {
3441
3463
  await t.schema.createTable("refresh_tokens").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn(
3442
3464
  "client_id",
3443
3465
  "varchar(21)",
@@ -3450,17 +3472,8 @@ async function Ts(t) {
3450
3472
  (e) => e.onDelete("cascade")
3451
3473
  ).addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("expires_at", "varchar(35)").addColumn("idle_expires_at", "varchar(35)").addColumn("last_exchanged_at", "varchar(35)").addColumn("device", "varchar(2048)", (e) => e.notNull()).addColumn("resource_servers", "varchar(2048)", (e) => e.notNull()).addColumn("rotating", "boolean", (e) => e.notNull()).execute();
3452
3474
  }
3453
- async function Ss(t) {
3454
- await t.schema.dropTable("refresh_tokens").execute();
3455
- }
3456
- const Os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3457
- __proto__: null,
3458
- down: Ss,
3459
- up: Ts
3460
- }, Symbol.toStringTag, { value: "Module" }));
3461
- async function ks(t) {
3462
- }
3463
3475
  async function $s(t) {
3476
+ await t.schema.dropTable("refresh_tokens").execute();
3464
3477
  }
3465
3478
  const Ds = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3466
3479
  __proto__: null,
@@ -3468,9 +3481,18 @@ const Ds = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3468
3481
  up: ks
3469
3482
  }, Symbol.toStringTag, { value: "Module" }));
3470
3483
  async function Is(t) {
3471
- await t.schema.dropTable("sessions").execute(), await t.schema.dropTable("refresh_tokens").execute();
3472
3484
  }
3473
3485
  async function js(t) {
3486
+ }
3487
+ const Ps = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3488
+ __proto__: null,
3489
+ down: js,
3490
+ up: Is
3491
+ }, Symbol.toStringTag, { value: "Module" }));
3492
+ async function Ms(t) {
3493
+ await t.schema.dropTable("sessions").execute(), await t.schema.dropTable("refresh_tokens").execute();
3494
+ }
3495
+ async function As(t) {
3474
3496
  await t.schema.createTable("sessions").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addForeignKeyConstraint(
3475
3497
  "sessions_user_id_constraint",
3476
3498
  ["user_id", "tenant_id"],
@@ -3489,12 +3511,12 @@ async function js(t) {
3489
3511
  (e) => e.onDelete("cascade")
3490
3512
  ).addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("expires_at", "varchar(35)").addColumn("idle_expires_at", "varchar(35)").addColumn("last_exchanged_at", "varchar(35)").addColumn("device", "varchar(2048)", (e) => e.notNull()).addColumn("resource_servers", "varchar(2048)", (e) => e.notNull()).addColumn("rotating", "boolean", (e) => e.notNull()).execute();
3491
3513
  }
3492
- const Ps = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3514
+ const Fs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3493
3515
  __proto__: null,
3494
- down: js,
3495
- up: Is
3516
+ down: As,
3517
+ up: Ms
3496
3518
  }, Symbol.toStringTag, { value: "Module" }));
3497
- async function Ms(t) {
3519
+ async function Ls(t) {
3498
3520
  await t.schema.createTable("sessions_2").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addForeignKeyConstraint(
3499
3521
  "sessions_2_user_id_constraint",
3500
3522
  ["user_id", "tenant_id"],
@@ -3513,88 +3535,112 @@ async function Ms(t) {
3513
3535
  (e) => e.onDelete("cascade")
3514
3536
  ).addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("expires_at", "varchar(35)").addColumn("idle_expires_at", "varchar(35)").addColumn("last_exchanged_at", "varchar(35)").addColumn("device", "varchar(2048)", (e) => e.notNull()).addColumn("resource_servers", "varchar(2048)", (e) => e.notNull()).addColumn("rotating", "boolean", (e) => e.notNull()).execute();
3515
3537
  }
3516
- async function As(t) {
3538
+ async function Es(t) {
3517
3539
  await t.schema.dropTable("sessions_2").execute(), await t.schema.dropTable("refresh_tokens_2").execute();
3518
3540
  }
3519
- const Fs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3541
+ const Js = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3520
3542
  __proto__: null,
3521
- down: As,
3522
- up: Ms
3543
+ down: Es,
3544
+ up: Ls
3545
+ }, Symbol.toStringTag, { value: "Module" }));
3546
+ async function zs(t) {
3547
+ await t.schema.createTable("custom_domains").addColumn(
3548
+ "custom_domain_id",
3549
+ "varchar(21)",
3550
+ (e) => e.notNull().primaryKey()
3551
+ ).addColumn(
3552
+ "tenant_id",
3553
+ "varchar(255)",
3554
+ (e) => e.references("tenants.id").onDelete("cascade").notNull()
3555
+ ).addColumn("domain", "varchar(255)", (e) => e.notNull()).addColumn("primary", "boolean", (e) => e.notNull()).addColumn("status", "varchar(50)", (e) => e.notNull()).addColumn("type", "varchar(50)", (e) => e.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", "timestamp", (e) => e.notNull()).addColumn("updated_at", "timestamp", (e) => e.notNull()).execute(), await t.schema.dropTable("domains").execute();
3556
+ }
3557
+ async function Ks(t) {
3558
+ await t.schema.dropTable("custom_domains").execute(), await t.schema.createTable("domains").addColumn("id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn(
3559
+ "tenant_id",
3560
+ "varchar(255)",
3561
+ (e) => e.references("tenants.id").onDelete("cascade").notNull()
3562
+ ).addColumn("domain", "varchar(255)", (e) => e.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)", (e) => e.notNull()).addColumn("updated_at", "varchar(255)", (e) => e.notNull()).execute();
3563
+ }
3564
+ const Rs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3565
+ __proto__: null,
3566
+ down: Ks,
3567
+ up: zs
3523
3568
  }, Symbol.toStringTag, { value: "Module" })), Le = {
3524
- m1_init: La,
3525
- m2_magicLink: za,
3526
- m3_updateAt: Ua,
3527
- m4_logTable: Va,
3528
- m5_userProfile: Ga,
3529
- m6_sessions: Ya,
3530
- m7_passwords: tr,
3531
- m8_logsTableNewFields: nr,
3532
- m9_passwordTableNewField: ir,
3533
- n01_codesTable: dr,
3534
- n11_universalLoginSession: hr,
3535
- n12_userFields: pr,
3536
- n13_userEmailIndex: wr,
3537
- n14_profileDataField: Cr,
3538
- n15_userEmailIndex: Tr,
3539
- n16_userLocale: kr,
3540
- n17_signingKeys: Ir,
3541
- n18_logsFields: Mr,
3542
- n19_connectionsUserinfo: Lr,
3543
- n20_missingFields: zr,
3544
- n21_sessionDeletedAt: Ur,
3545
- n22_dropLogsFields: Vr,
3546
- n23_dropUsersFields: Gr,
3547
- n24_logsIndexes: Yr,
3548
- n25_logDescMaxLength: tn,
3549
- n26_logsTableExtraFields: nn,
3550
- n27_usersTableNameIndex: cn,
3551
- n28_usersEmailConstrain: un,
3552
- n29_increaseOtpStateLength: _n,
3553
- n30_increaseTicketStateLength: gn,
3554
- n31_branding: Nn,
3555
- n32_indexesAndNotNull: bn,
3556
- n33_vendorIdInUniversalLoginSession: Sn,
3557
- n34_auth0ClientInUniversalLoginSession: $n,
3558
- n35_increaseUniversalSessionStateLength: jn,
3559
- n36_authenticationCodes: An,
3560
- n37_disableSignUps: En,
3561
- n38_otpIpAddress: Kn,
3562
- n39_increaseUserAgentLength: Bn,
3563
- n40_userId: qn,
3564
- n41_hooks: Hn,
3565
- n42_userIdIndexes: Zn,
3566
- n43_userIdIndexes: ao,
3567
- n44_codes: oo,
3568
- n45_hookProperties: co,
3569
- n46_loginAuth0Client: mo,
3570
- n47_loginAuth0Client: fo,
3571
- n48_saml: yo,
3572
- n49_removeFields: vo,
3573
- n50_authParamsNonce: xo,
3574
- n51_connectionid: Oo,
3575
- n52_cert: Do,
3576
- n53_codes_primary_key: Po,
3577
- n54_cleanup_tables: Fo,
3578
- n55_logs_index: Jo,
3579
- n56_application_fields: Ro,
3580
- n57_prompt_settings: Qo,
3581
- n58_connection_client_id: Wo,
3582
- n59_connection_options: Xo,
3583
- n60_users_metadata: es,
3584
- n61_userLocales: rs,
3585
- n62_prompt: ss,
3586
- n63_connection_cleanup: ls,
3587
- n64_act_as: ms,
3588
- n65_code_verifier: fs,
3589
- n66_email_providers: ys,
3590
- n67_drop_tickets: vs,
3591
- n68_login_useragents: xs,
3592
- n70_refresh_tokens: Os,
3593
- n71_session_new_fields: Ds,
3594
- n72_session_primary_key: Ps,
3595
- n73_drop_sessions: Fs
3569
+ m1_init: za,
3570
+ m2_magicLink: Ua,
3571
+ m3_updateAt: Va,
3572
+ m4_logTable: Ga,
3573
+ m5_userProfile: Ya,
3574
+ m6_sessions: tr,
3575
+ m7_passwords: nr,
3576
+ m8_logsTableNewFields: ir,
3577
+ m9_passwordTableNewField: lr,
3578
+ n01_codesTable: hr,
3579
+ n11_universalLoginSession: pr,
3580
+ n12_userFields: wr,
3581
+ n13_userEmailIndex: Cr,
3582
+ n14_profileDataField: Tr,
3583
+ n15_userEmailIndex: kr,
3584
+ n16_userLocale: Ir,
3585
+ n17_signingKeys: Mr,
3586
+ n18_logsFields: Lr,
3587
+ n19_connectionsUserinfo: zr,
3588
+ n20_missingFields: Ur,
3589
+ n21_sessionDeletedAt: Vr,
3590
+ n22_dropLogsFields: Gr,
3591
+ n23_dropUsersFields: Yr,
3592
+ n24_logsIndexes: tn,
3593
+ n25_logDescMaxLength: nn,
3594
+ n26_logsTableExtraFields: cn,
3595
+ n27_usersTableNameIndex: un,
3596
+ n28_usersEmailConstrain: _n,
3597
+ n29_increaseOtpStateLength: gn,
3598
+ n30_increaseTicketStateLength: Nn,
3599
+ n31_branding: bn,
3600
+ n32_indexesAndNotNull: Sn,
3601
+ n33_vendorIdInUniversalLoginSession: $n,
3602
+ n34_auth0ClientInUniversalLoginSession: jn,
3603
+ n35_increaseUniversalSessionStateLength: An,
3604
+ n36_authenticationCodes: En,
3605
+ n37_disableSignUps: Kn,
3606
+ n38_otpIpAddress: Bn,
3607
+ n39_increaseUserAgentLength: Wn,
3608
+ n40_userId: Hn,
3609
+ n41_hooks: Zn,
3610
+ n42_userIdIndexes: ao,
3611
+ n43_userIdIndexes: oo,
3612
+ n44_codes: co,
3613
+ n45_hookProperties: mo,
3614
+ n46_loginAuth0Client: fo,
3615
+ n47_loginAuth0Client: yo,
3616
+ n48_saml: vo,
3617
+ n49_removeFields: xo,
3618
+ n50_authParamsNonce: Oo,
3619
+ n51_connectionid: Do,
3620
+ n52_cert: Po,
3621
+ n53_codes_primary_key: Fo,
3622
+ n54_cleanup_tables: Jo,
3623
+ n55_logs_index: Ro,
3624
+ n56_application_fields: Qo,
3625
+ n57_prompt_settings: qo,
3626
+ n58_connection_client_id: Xo,
3627
+ n59_connection_options: es,
3628
+ n60_users_metadata: rs,
3629
+ n61_userLocales: ss,
3630
+ n62_prompt: ds,
3631
+ n63_connection_cleanup: ms,
3632
+ n64_act_as: fs,
3633
+ n65_code_verifier: ys,
3634
+ n66_email_providers: vs,
3635
+ n67_drop_tickets: xs,
3636
+ n68_login_useragents: Os,
3637
+ n70_refresh_tokens: Ds,
3638
+ n71_session_new_fields: Ps,
3639
+ n72_session_primary_key: Fs,
3640
+ n73_drop_sessions: Js,
3641
+ n74_custom_domains: Rs
3596
3642
  };
3597
- async function Ks(t, e = !1) {
3643
+ async function Ws(t, e = !1) {
3598
3644
  e && console.log("migrating...");
3599
3645
  const a = new Fe(Le), r = new ve({
3600
3646
  db: t,
@@ -3607,7 +3653,7 @@ async function Ks(t, e = !1) {
3607
3653
  }), o)
3608
3654
  throw console.error("failed to migrate"), console.error(o), o;
3609
3655
  }
3610
- async function Rs(t) {
3656
+ async function qs(t) {
3611
3657
  console.log("migrating...");
3612
3658
  const e = new Fe(Le), a = new ve({
3613
3659
  db: t,
@@ -3618,30 +3664,30 @@ async function Rs(t) {
3618
3664
  }), r)
3619
3665
  throw console.error("failed to migrate"), console.error(r), r;
3620
3666
  }
3621
- function Us(t) {
3667
+ function Gs(t) {
3622
3668
  return {
3623
3669
  applications: It(t),
3624
- branding: Wt(t),
3670
+ branding: Xt(t),
3625
3671
  clients: Et(t),
3626
3672
  codes: Tt(t),
3627
3673
  connections: Lt(t),
3628
- emailProviders: ya(t),
3629
- domains: Qt(t),
3630
- hooks: ea(t),
3674
+ emailProviders: va(t),
3675
+ customDomains: qt(t),
3676
+ hooks: ra(t),
3631
3677
  keys: Rt(t),
3632
- logins: ua(t),
3633
- logs: lt(t),
3678
+ logins: _a(t),
3679
+ logs: dt(t),
3634
3680
  passwords: wt(t),
3635
- promptSettings: _a(t),
3636
- refreshTokens: xa(t),
3681
+ promptSettings: ga(t),
3682
+ refreshTokens: Oa(t),
3637
3683
  sessions: ft(t),
3638
3684
  tenants: nt(t),
3639
- themes: sa(t),
3685
+ themes: da(t),
3640
3686
  users: Xe(t)
3641
3687
  };
3642
3688
  }
3643
3689
  export {
3644
- Us as default,
3645
- Rs as migrateDown,
3646
- Ks as migrateToLatest
3690
+ Gs as default,
3691
+ qs as migrateDown,
3692
+ Ws as migrateToLatest
3647
3693
  };