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