@authhero/kysely-adapter 10.0.0 → 10.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.
@@ -25,8 +25,8 @@ var V = class extends Error {
25
25
  };
26
26
  function Be(t) {
27
27
  return async (e, a) => {
28
- const { identities: r, ...o } = a, n = {
29
- ...o,
28
+ const { identities: r, ...n } = a, o = {
29
+ ...n,
30
30
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
31
31
  updated_at: (/* @__PURE__ */ new Date()).toISOString(),
32
32
  login_count: 0,
@@ -37,16 +37,16 @@ function Be(t) {
37
37
  user_metadata: JSON.stringify(a.user_metadata)
38
38
  };
39
39
  try {
40
- await t.insertInto("users").values(n).execute();
40
+ await t.insertInto("users").values(o).execute();
41
41
  } catch (s) {
42
42
  throw s.code === "SQLITE_CONSTRAINT_UNIQUE" || s.message.includes("AlreadyExists") ? new V(409, { message: "User already exists" }) : new V(500, { message: `${s.code}, ${s.message}` });
43
43
  }
44
44
  return {
45
- ...n,
45
+ ...o,
46
46
  // TODO: check if this is correct. Should it be optional?
47
- email: n.email || "",
48
- email_verified: n.email_verified === 1,
49
- is_social: n.is_social === 1
47
+ email: o.email || "",
48
+ email_verified: o.email_verified === 1,
49
+ is_social: o.is_social === 1
50
50
  };
51
51
  };
52
52
  }
@@ -77,13 +77,13 @@ function fe(t) {
77
77
  }
78
78
  function Qe(t) {
79
79
  return async (e, a) => {
80
- const [r, o] = await Promise.all([
80
+ const [r, n] = await Promise.all([
81
81
  t.selectFrom("users").where("users.tenant_id", "=", e).where("users.user_id", "=", a).selectAll().executeTakeFirst(),
82
82
  t.selectFrom("users").where("users.tenant_id", "=", e).where("users.linked_to", "=", a).selectAll().execute()
83
83
  ]);
84
84
  if (!r)
85
85
  return null;
86
- const { tenant_id: n, ...s } = r, l = {
86
+ const { tenant_id: o, ...s } = r, l = {
87
87
  ...s,
88
88
  email: r.email || "",
89
89
  email_verified: r.email_verified === 1,
@@ -97,39 +97,39 @@ function Qe(t) {
97
97
  user_id: Y(r.user_id).id,
98
98
  isSocial: !!r.is_social
99
99
  },
100
- ...o.map(fe)
100
+ ...n.map(fe)
101
101
  ]
102
102
  };
103
103
  return _(l);
104
104
  };
105
105
  }
106
106
  function O(t, e, a, r) {
107
- return a.split(/\s+/).map((n) => n.replace(/^([^:]+)=/g, "$1:")).map((n) => {
108
- let s = n.startsWith("-"), l, d, 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, d] = s ? n.substring(1).split(":") : n.split(":"), g = !1, d.startsWith(">=") ? (m = ">=", d = d.substring(2)) : d.startsWith(">") ? (m = ">", d = d.substring(1)) : d.startsWith("<=") ? (m = "<=", d = d.substring(2)) : d.startsWith("<") ? (m = "<", d = d.substring(1)) : m = "=") : (l = null, d = n, g = !1), { key: l, value: d, isNegation: s, isExistsQuery: g, operator: m };
110
- }).forEach(({ key: n, value: s, isNegation: l, isExistsQuery: d, operator: g }) => {
111
- if (n)
107
+ return a.split(/\s+/).map((o) => o.replace(/^([^:]+)=/g, "$1:")).map((o) => {
108
+ let s = o.startsWith("-"), l, d, g, m;
109
+ return o.startsWith("-_exists_:") ? (l = o.substring(10), g = !0, s = !0) : o.startsWith("_exists_:") ? (l = o.substring(9), g = !0, s = !1) : o.includes(":") ? (s = o.startsWith("-"), [l, d] = s ? o.substring(1).split(":") : o.split(":"), g = !1, d.startsWith(">=") ? (m = ">=", d = d.substring(2)) : d.startsWith(">") ? (m = ">", d = d.substring(1)) : d.startsWith("<=") ? (m = "<=", d = d.substring(2)) : d.startsWith("<") ? (m = "<", d = d.substring(1)) : m = "=") : (l = null, d = o, g = !1), { key: l, value: d, isNegation: s, isExistsQuery: g, operator: m };
110
+ }).forEach(({ key: o, value: s, isNegation: l, isExistsQuery: d, operator: g }) => {
111
+ if (o)
112
112
  if (d)
113
- l ? e = e.where(n, "is", null) : e = e.where(n, "is not", null);
113
+ l ? e = e.where(o, "is", null) : e = e.where(o, "is not", null);
114
114
  else if (l)
115
115
  switch (g) {
116
116
  case ">":
117
- e = e.where(n, "<=", s);
117
+ e = e.where(o, "<=", s);
118
118
  break;
119
119
  case ">=":
120
- e = e.where(n, "<", s);
120
+ e = e.where(o, "<", s);
121
121
  break;
122
122
  case "<":
123
- e = e.where(n, ">=", s);
123
+ e = e.where(o, ">=", s);
124
124
  break;
125
125
  case "<=":
126
- e = e.where(n, ">", s);
126
+ e = e.where(o, ">", s);
127
127
  break;
128
128
  default:
129
- e = e.where(n, "!=", s);
129
+ e = e.where(o, "!=", s);
130
130
  }
131
131
  else
132
- e = e.where(n, g, s);
132
+ e = e.where(o, g, s);
133
133
  else {
134
134
  const { ref: m } = t.dynamic;
135
135
  e = e.where(
@@ -154,7 +154,7 @@ function Ve(t) {
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), l = s.length ? await t.selectFrom("users").selectAll().where("users.tenant_id", "=", e).where("users.linked_to", "in", s).execute() : [], d = n.map((m) => {
157
+ const o = await r.offset(a.page * a.per_page).limit(a.per_page).selectAll().execute(), s = o.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() : [], d = o.map((m) => {
158
158
  const w = l.filter(
159
159
  (b) => b.linked_to === m.user_id
160
160
  );
@@ -192,18 +192,18 @@ function qe(t) {
192
192
  }
193
193
  function Ge(t) {
194
194
  return async (e, a, r) => {
195
- const o = {
195
+ const n = {
196
196
  ...r,
197
197
  email_verified: qe(r),
198
198
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
199
199
  };
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;
200
+ return r.app_metadata && (n.app_metadata = JSON.stringify(r.app_metadata)), r.user_metadata && (n.user_metadata = JSON.stringify(r.user_metadata)), (await t.updateTable("users").set(n).where("users.tenant_id", "=", e).where("users.user_id", "=", a).execute()).length === 1;
201
201
  };
202
202
  }
203
203
  function He(t) {
204
- return async (e, a, r, o) => {
205
- const n = { linked_to: null };
206
- return (await t.updateTable("users").set(n).where("users.tenant_id", "=", e).where("users.user_id", "=", `${r}|${o}`).where("users.linked_to", "=", `${a}`).execute()).length === 1;
204
+ return async (e, a, r, n) => {
205
+ const o = { linked_to: null };
206
+ return (await t.updateTable("users").set(o).where("users.tenant_id", "=", e).where("users.user_id", "=", `${r}|${n}`).where("users.linked_to", "=", `${a}`).execute()).length === 1;
207
207
  };
208
208
  }
209
209
  function Xe(t) {
@@ -253,14 +253,14 @@ function tt(t) {
253
253
  a = a.orderBy(l(e.sort.sort_by), e.sort.sort_order);
254
254
  }
255
255
  e.q && (a = a.where((l) => l.or([l("name", "like", `%${e.q}%`)])));
256
- const o = await a.offset(e.page * e.per_page).limit(e.per_page).selectAll().execute();
256
+ const n = await a.offset(e.page * e.per_page).limit(e.per_page).selectAll().execute();
257
257
  if (!e.include_totals)
258
258
  return {
259
- tenants: o
259
+ tenants: n
260
260
  };
261
- const { count: n } = await a.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow(), s = x(n);
261
+ const { count: o } = await a.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow(), s = x(o);
262
262
  return {
263
- tenants: o.map(_),
263
+ tenants: n.map(_),
264
264
  start: (e.page - 1) * e.per_page,
265
265
  limit: e.per_page,
266
266
  length: s
@@ -295,7 +295,7 @@ function ue(t) {
295
295
  const ot = 1024;
296
296
  function st(t) {
297
297
  return async (e, a) => {
298
- var o, n, s;
298
+ var n, o, s;
299
299
  const r = {
300
300
  id: k(),
301
301
  ...a,
@@ -304,10 +304,10 @@ function st(t) {
304
304
  return await t.insertInto("logs").values({
305
305
  ...r,
306
306
  // Truncate long strings to avoid database errors
307
- description: (o = r.description) == null ? void 0 : o.substring(0, 256),
307
+ description: (n = r.description) == null ? void 0 : n.substring(0, 256),
308
308
  isMobile: a.isMobile ? 1 : 0,
309
309
  tenant_id: e,
310
- scope: (n = a.scope) == null ? void 0 : n.join(","),
310
+ scope: (o = a.scope) == null ? void 0 : o.join(","),
311
311
  auth0_client: ue(a.auth0_client),
312
312
  details: (s = ue(a.details)) == null ? void 0 : s.substring(0, 8192)
313
313
  }).execute(), r;
@@ -343,18 +343,18 @@ function it(t) {
343
343
  }) => {
344
344
  let r = t.selectFrom("logs").where("logs.tenant_id", "=", e);
345
345
  a.q && (r = O(t, r, a.q, ["user_id", "ip"]));
346
- let o = r;
346
+ let n = r;
347
347
  if (a.sort && a.sort.sort_by) {
348
348
  const { ref: l } = t.dynamic;
349
- o = o.orderBy(
349
+ n = n.orderBy(
350
350
  l(a.sort.sort_by),
351
351
  a.sort.sort_order
352
352
  );
353
353
  }
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((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow();
354
+ n = n.offset(a.page * a.per_page).limit(a.per_page);
355
+ const o = await n.selectAll().execute(), { count: s } = await r.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow();
356
356
  return {
357
- logs: n.map(pe),
357
+ logs: o.map(pe),
358
358
  start: a.page * a.per_page,
359
359
  limit: a.per_page,
360
360
  length: x(s)
@@ -376,13 +376,13 @@ function ct(t) {
376
376
  }
377
377
  function lt(t) {
378
378
  return async (e, a) => {
379
- const r = await t.selectFrom("sessions").where("sessions.tenant_id", "=", e).where("sessions.id", "=", a).where("sessions.revoked_at", "is", null).selectAll().executeTakeFirst();
379
+ const r = await t.selectFrom("sessions").where("sessions.tenant_id", "=", e).where("sessions.id", "=", a).selectAll().executeTakeFirst();
380
380
  if (!r)
381
381
  return null;
382
- const { tenant_id: o, device: n, clients: s, ...l } = r;
382
+ const { tenant_id: n, device: o, clients: s, ...l } = r;
383
383
  return {
384
384
  ...l,
385
- device: JSON.parse(n),
385
+ device: JSON.parse(o),
386
386
  clients: JSON.parse(s)
387
387
  };
388
388
  };
@@ -409,13 +409,13 @@ function mt(t) {
409
409
  }
410
410
  function ht(t) {
411
411
  return async (e, a, r) => {
412
- const o = {
412
+ const n = {
413
413
  ...r,
414
414
  updated_at: (/* @__PURE__ */ new Date()).toISOString(),
415
415
  device: r.device ? JSON.stringify(r.device) : void 0,
416
416
  clients: r.clients ? JSON.stringify(r.clients) : void 0
417
417
  };
418
- return !!(await t.updateTable("sessions").set(o).where("tenant_id", "=", e).where("sessions.id", "=", a).execute()).length;
418
+ return !!(await t.updateTable("sessions").set(n).where("tenant_id", "=", e).where("sessions.id", "=", a).execute()).length;
419
419
  };
420
420
  }
421
421
  function _t(t) {
@@ -426,18 +426,18 @@ function _t(t) {
426
426
  }) => {
427
427
  let r = t.selectFrom("sessions").where("sessions.tenant_id", "=", e);
428
428
  a.q && (r = O(t, r, a.q, ["user_id", "session_id"]));
429
- let o = r;
429
+ let n = r;
430
430
  if (a.sort && a.sort.sort_by) {
431
431
  const { ref: d } = t.dynamic;
432
- o = o.orderBy(
432
+ n = n.orderBy(
433
433
  d(a.sort.sort_by),
434
434
  a.sort.sort_order
435
435
  );
436
436
  }
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((d) => d.fn.countAll().as("count")).executeTakeFirstOrThrow(), l = x(s);
437
+ n = n.offset(a.page * a.per_page).limit(a.per_page);
438
+ const o = await n.selectAll().execute(), { count: s } = await r.select((d) => d.fn.countAll().as("count")).executeTakeFirstOrThrow(), l = x(s);
439
439
  return {
440
- sessions: n.map((d) => ({
440
+ sessions: o.map((d) => ({
441
441
  ...d,
442
442
  device: JSON.parse(d.device),
443
443
  clients: JSON.parse(d.clients)
@@ -462,8 +462,8 @@ function pt(t) {
462
462
  const r = await t.selectFrom("passwords").where("passwords.tenant_id", "=", e).where("passwords.user_id", "=", a).selectAll().executeTakeFirst();
463
463
  if (!r)
464
464
  return null;
465
- const { tenant_id: o, ...n } = r;
466
- return n;
465
+ const { tenant_id: n, ...o } = r;
466
+ return o;
467
467
  };
468
468
  }
469
469
  function gt(t) {
@@ -500,9 +500,9 @@ function vt(t) {
500
500
  }) => {
501
501
  let r = t.selectFrom("codes").where("codes.tenant_id", "=", e);
502
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((d) => d.fn.countAll().as("count")).executeTakeFirstOrThrow();
503
+ const o = await r.offset(a.page * a.per_page).limit(a.per_page).selectAll().execute(), { count: s } = await r.select((d) => d.fn.countAll().as("count")).executeTakeFirstOrThrow();
504
504
  return {
505
- codes: n.map((d) => {
505
+ codes: o.map((d) => {
506
506
  const { tenant_id: g, ...m } = d;
507
507
  return Je.parse(_(m));
508
508
  }),
@@ -529,10 +529,10 @@ function Ct(t) {
529
529
  }
530
530
  function bt(t) {
531
531
  return async (e, a, r) => {
532
- let o = t.selectFrom("codes").where("codes.code_id", "=", a).where("codes.code_type", "=", r);
533
- e.length && (o = o.where("codes.tenant_id", "=", e));
534
- const n = await o.selectAll().executeTakeFirst();
535
- return n ? _(n) : null;
532
+ let n = t.selectFrom("codes").where("codes.code_id", "=", a).where("codes.code_type", "=", r);
533
+ e.length && (n = n.where("codes.tenant_id", "=", e));
534
+ const o = await n.selectAll().executeTakeFirst();
535
+ return o ? _(o) : null;
536
536
  };
537
537
  }
538
538
  function xt(t) {
@@ -553,14 +553,14 @@ function St(t) {
553
553
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
554
554
  updated_at: (/* @__PURE__ */ new Date()).toISOString(),
555
555
  ...a
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), d = JSON.stringify(a.allowed_clients);
556
+ }, n = JSON.stringify(a.allowed_origins), o = JSON.stringify(a.callbacks), s = JSON.stringify(a.web_origins), l = JSON.stringify(a.allowed_logout_urls), d = JSON.stringify(a.allowed_clients);
557
557
  return await t.insertInto("applications").values({
558
558
  ...r,
559
559
  tenant_id: e,
560
560
  disable_sign_ups: a.disable_sign_ups ? 1 : 0,
561
561
  addons: a.addons ? JSON.stringify(a.addons) : "{}",
562
- callbacks: n,
563
- allowed_origins: o,
562
+ callbacks: o,
563
+ allowed_origins: n,
564
564
  web_origins: s,
565
565
  allowed_logout_urls: l,
566
566
  allowed_clients: d
@@ -569,15 +569,15 @@ function St(t) {
569
569
  }
570
570
  function Ot(t) {
571
571
  return async (e) => ({
572
- applications: (await t.selectFrom("applications").where("applications.tenant_id", "=", e).selectAll().execute()).map((n) => ({
573
- ...n,
574
- disable_sign_ups: !!n.disable_sign_ups,
575
- addons: n.addons ? JSON.parse(n.addons) : {},
576
- callbacks: n.callbacks ? JSON.parse(n.callbacks) : [],
577
- allowed_origins: n.allowed_origins ? JSON.parse(n.allowed_origins) : [],
578
- web_origins: n.web_origins ? JSON.parse(n.web_origins) : [],
579
- allowed_logout_urls: n.allowed_logout_urls ? JSON.parse(n.allowed_logout_urls) : [],
580
- allowed_clients: n.allowed_logout_urls ? JSON.parse(n.allowed_logout_urls) : []
572
+ applications: (await t.selectFrom("applications").where("applications.tenant_id", "=", e).selectAll().execute()).map((o) => ({
573
+ ...o,
574
+ disable_sign_ups: !!o.disable_sign_ups,
575
+ addons: o.addons ? JSON.parse(o.addons) : {},
576
+ callbacks: o.callbacks ? JSON.parse(o.callbacks) : [],
577
+ allowed_origins: o.allowed_origins ? JSON.parse(o.allowed_origins) : [],
578
+ web_origins: o.web_origins ? JSON.parse(o.web_origins) : [],
579
+ allowed_logout_urls: o.allowed_logout_urls ? JSON.parse(o.allowed_logout_urls) : [],
580
+ allowed_clients: o.allowed_logout_urls ? JSON.parse(o.allowed_logout_urls) : []
581
581
  }))
582
582
  });
583
583
  }
@@ -600,7 +600,7 @@ function $t(t) {
600
600
  }
601
601
  function Dt(t) {
602
602
  return async (e, a, r) => {
603
- const o = {
603
+ const n = {
604
604
  ...r,
605
605
  updated_at: (/* @__PURE__ */ new Date()).toISOString(),
606
606
  allowed_origins: r.allowed_origins ? JSON.stringify(r.allowed_origins) : void 0,
@@ -611,7 +611,7 @@ function Dt(t) {
611
611
  addons: r.addons ? JSON.stringify(r.addons) : "{}",
612
612
  disable_sign_ups: r.disable_sign_ups ? 1 : 0
613
613
  };
614
- return await t.updateTable("applications").set(o).where("applications.id", "=", a).where("applications.tenant_id", "=", e).execute(), !0;
614
+ return await t.updateTable("applications").set(n).where("applications.id", "=", a).where("applications.tenant_id", "=", e).execute(), !0;
615
615
  };
616
616
  }
617
617
  function It(t) {
@@ -664,7 +664,7 @@ function jt(t) {
664
664
  function Mt(t) {
665
665
  return async (e, a) => (await t.deleteFrom("connections").where("connections.tenant_id", "=", e).where("connections.id", "=", a).executeTakeFirst()).numDeletedRows > 0;
666
666
  }
667
- function At(t) {
667
+ function Ft(t) {
668
668
  return async (e, a) => {
669
669
  const r = await t.selectFrom("connections").where("connections.tenant_id", "=", e).where("connections.id", "=", a).selectAll().executeTakeFirst();
670
670
  return r ? _({
@@ -673,25 +673,25 @@ function At(t) {
673
673
  }) : null;
674
674
  };
675
675
  }
676
- function Ft(t) {
676
+ function At(t) {
677
677
  return async (e, a, r) => {
678
- const o = {
678
+ const n = {
679
679
  ...r,
680
680
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
681
681
  };
682
682
  return await t.updateTable("connections").set({
683
- ...o,
684
- options: o.options ? JSON.stringify(o.options) : void 0
683
+ ...n,
684
+ options: n.options ? JSON.stringify(n.options) : void 0
685
685
  }).where("connections.id", "=", a).where("connections.tenant_id", "=", e).execute(), !0;
686
686
  };
687
687
  }
688
688
  function Lt(t) {
689
689
  return {
690
690
  create: Pt(t),
691
- get: At(t),
691
+ get: Ft(t),
692
692
  list: jt(t),
693
693
  remove: Mt(t),
694
- update: Ft(t)
694
+ update: At(t)
695
695
  };
696
696
  }
697
697
  function zt(t) {
@@ -703,10 +703,10 @@ function zt(t) {
703
703
  const r = await t.selectFrom("tenants").selectAll().where("id", "=", a.tenant_id).executeTakeFirst();
704
704
  if (!r)
705
705
  throw new V(404, { message: "Tenant not found" });
706
- const o = await t.selectFrom("connections").where("tenant_id", "=", a.tenant_id).selectAll().execute();
706
+ const n = await t.selectFrom("connections").where("tenant_id", "=", a.tenant_id).selectAll().execute();
707
707
  return {
708
708
  ...a,
709
- connections: o.map(
709
+ connections: n.map(
710
710
  (s) => Ke.parse(
711
711
  _({
712
712
  ...s,
@@ -787,12 +787,12 @@ function Vt(t) {
787
787
  }
788
788
  function Wt(t) {
789
789
  return async (e, a, r) => {
790
- const o = {
790
+ const n = {
791
791
  ...r,
792
792
  updated_at: (/* @__PURE__ */ new Date()).toISOString(),
793
793
  primary: r.primary ? 1 : 0
794
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;
795
+ return (await t.updateTable("custom_domains").set(n).where("custom_domains.tenant_id", "=", e).where("custom_domains.custom_domain_id", "=", a).execute()).length > 0;
796
796
  };
797
797
  }
798
798
  function qt(t) {
@@ -811,8 +811,8 @@ function Gt(t) {
811
811
  return null;
812
812
  const {
813
813
  tenant_id: r,
814
- colors_primary: o,
815
- colors_page_background_type: n,
814
+ colors_primary: n,
815
+ colors_page_background_type: o,
816
816
  colors_page_background_start: s,
817
817
  colors_page_background_end: l,
818
818
  colors_page_background_angle_dev: d,
@@ -822,9 +822,9 @@ function Gt(t) {
822
822
  return _({
823
823
  ...m,
824
824
  colors: {
825
- primary: o,
825
+ primary: n,
826
826
  page_background: {
827
- type: n,
827
+ type: o,
828
828
  start: s,
829
829
  end: l,
830
830
  angle_deg: d
@@ -837,10 +837,10 @@ function Gt(t) {
837
837
  function Ht(t) {
838
838
  return async (e, a) => {
839
839
  var s, l, d, g, m, w, b, Z, ee, te, ae, re, ne, oe, se, ie, de, ce;
840
- const { colors: r, font: o, ...n } = a;
840
+ const { colors: r, font: n, ...o } = a;
841
841
  try {
842
842
  await t.insertInto("branding").values({
843
- ...n,
843
+ ...o,
844
844
  colors_primary: r == null ? void 0 : r.primary,
845
845
  colors_page_background_type: (l = (s = a.colors) == null ? void 0 : s.page_background) == null ? void 0 : l.type,
846
846
  colors_page_background_start: (g = (d = a.colors) == null ? void 0 : d.page_background) == null ? void 0 : g.start,
@@ -851,7 +851,7 @@ function Ht(t) {
851
851
  }).execute();
852
852
  } catch {
853
853
  await t.updateTable("branding").set({
854
- ...n,
854
+ ...o,
855
855
  colors_primary: r == null ? void 0 : r.primary,
856
856
  colors_page_background_type: (ae = (te = a.colors) == null ? void 0 : te.page_background) == null ? void 0 : ae.type,
857
857
  colors_page_background_start: (ne = (re = a.colors) == null ? void 0 : re.page_background) == null ? void 0 : ne.start,
@@ -876,9 +876,9 @@ function Yt(t) {
876
876
  }) => {
877
877
  let r = t.selectFrom("hooks").where("hooks.tenant_id", "=", e);
878
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((d) => d.fn.countAll().as("count")).executeTakeFirstOrThrow();
879
+ const o = await r.offset(a.page * a.per_page).limit(a.per_page).selectAll().execute(), { count: s } = await r.select((d) => d.fn.countAll().as("count")).executeTakeFirstOrThrow();
880
880
  return {
881
- hooks: n.map((d) => {
881
+ hooks: o.map((d) => {
882
882
  const { tenant_id: g, enabled: m, synchronous: w, ...b } = d;
883
883
  return _({
884
884
  ...b,
@@ -923,13 +923,13 @@ function ta(t) {
923
923
  }
924
924
  function aa(t) {
925
925
  return async (e, a, r) => {
926
- const o = {
926
+ const n = {
927
927
  ...r,
928
928
  updated_at: (/* @__PURE__ */ new Date()).toISOString(),
929
929
  enabled: r.enabled !== void 0 ? r.enabled ? 1 : 0 : void 0,
930
930
  synchronous: r.enabled !== void 0 ? r.synchronous ? 1 : 0 : void 0
931
931
  };
932
- return await t.updateTable("hooks").set(o).where("hooks.hook_id", "=", a).where("hooks.tenant_id", "=", e).execute(), !0;
932
+ return await t.updateTable("hooks").set(n).where("hooks.hook_id", "=", a).where("hooks.tenant_id", "=", e).execute(), !0;
933
933
  };
934
934
  }
935
935
  function ra(t) {
@@ -944,24 +944,24 @@ function ra(t) {
944
944
  function E(t, e = "", a = {}) {
945
945
  for (let r in t)
946
946
  if (Object.prototype.hasOwnProperty.call(t, r)) {
947
- const o = e ? `${e}_${r}` : r;
948
- typeof t[r] == "object" && t[r] !== null && !Array.isArray(t[r]) ? E(t[r], o, a) : a[o] = t[r];
947
+ const n = e ? `${e}_${r}` : r;
948
+ typeof t[r] == "object" && t[r] !== null && !Array.isArray(t[r]) ? E(t[r], n, a) : a[n] = t[r];
949
949
  }
950
950
  return a;
951
951
  }
952
952
  function na(t, e) {
953
953
  const a = {};
954
- for (const [r, o] of Object.entries(t)) {
955
- const n = e.find(
954
+ for (const [r, n] of Object.entries(t)) {
955
+ const o = e.find(
956
956
  (s) => r.startsWith(`${s}_`)
957
957
  );
958
- if (!n)
959
- a[r] = o;
958
+ if (!o)
959
+ a[r] = n;
960
960
  else {
961
- const s = r.slice(n.length + 1);
962
- a[n] = {
963
- ...a[n],
964
- [s]: o
961
+ const s = r.slice(o.length + 1);
962
+ a[o] = {
963
+ ...a[o],
964
+ [s]: n
965
965
  };
966
966
  }
967
967
  }
@@ -989,11 +989,11 @@ function ia(t) {
989
989
  }
990
990
  function da(t) {
991
991
  return async (e, a, r) => {
992
- const o = E({
992
+ const n = E({
993
993
  ...r,
994
994
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
995
995
  });
996
- return await t.updateTable("themes").set(o).where("themes.id", "=", a).where("themes.tenant_id", "=", e).execute(), !0;
996
+ return await t.updateTable("themes").set(n).where("themes.id", "=", a).where("themes.tenant_id", "=", e).execute(), !0;
997
997
  };
998
998
  }
999
999
  function ca(t) {
@@ -1006,19 +1006,19 @@ function ca(t) {
1006
1006
  }
1007
1007
  function la(t) {
1008
1008
  return async (e, a) => {
1009
- const r = (/* @__PURE__ */ new Date()).toISOString(), o = await t.selectFrom("login_sessions").where("login_sessions.expires_at", ">", r).where("login_sessions.id", "=", a).selectAll().executeTakeFirst();
1010
- return o ? Re.parse(
1011
- na(_(o), ["authParams"])
1009
+ const r = (/* @__PURE__ */ new Date()).toISOString(), n = await t.selectFrom("login_sessions").where("login_sessions.expires_at", ">", r).where("login_sessions.id", "=", a).selectAll().executeTakeFirst();
1010
+ return n ? Re.parse(
1011
+ na(_(n), ["authParams"])
1012
1012
  ) : null;
1013
1013
  };
1014
1014
  }
1015
1015
  function ua(t) {
1016
1016
  return async (e, a) => {
1017
- var o;
1017
+ var n;
1018
1018
  const r = {
1019
1019
  id: k(),
1020
1020
  ...a,
1021
- authorization_url: (o = a.authorization_url) == null ? void 0 : o.slice(0, 1024),
1021
+ authorization_url: (n = a.authorization_url) == null ? void 0 : n.slice(0, 1024),
1022
1022
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
1023
1023
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
1024
1024
  };
@@ -1085,38 +1085,38 @@ function ya(t) {
1085
1085
  return null;
1086
1086
  const {
1087
1087
  tenant_id: r,
1088
- credentials: o,
1089
- settings: n,
1088
+ credentials: n,
1089
+ settings: o,
1090
1090
  enabled: s,
1091
1091
  ...l
1092
1092
  } = a;
1093
1093
  return _({
1094
1094
  ...l,
1095
- credentials: JSON.parse(o),
1096
- settings: JSON.parse(n),
1095
+ credentials: JSON.parse(n),
1096
+ settings: JSON.parse(o),
1097
1097
  enabled: !!s
1098
1098
  });
1099
1099
  };
1100
1100
  }
1101
1101
  function wa(t) {
1102
1102
  return async (e, a) => {
1103
- const { credentials: r, settings: o, enabled: n, ...s } = a;
1103
+ const { credentials: r, settings: n, enabled: o, ...s } = a;
1104
1104
  await t.updateTable("email_providers").set({
1105
1105
  ...s,
1106
1106
  credentials: r ? JSON.stringify(r) : void 0,
1107
- settings: o ? JSON.stringify(o) : void 0,
1108
- enabled: n !== void 0 ? n ? 1 : 0 : void 0
1107
+ settings: n ? JSON.stringify(n) : void 0,
1108
+ enabled: o !== void 0 ? o ? 1 : 0 : void 0
1109
1109
  }).where("tenant_id", "=", e).execute();
1110
1110
  };
1111
1111
  }
1112
1112
  function va(t) {
1113
1113
  return async (e, a) => {
1114
- const { credentials: r, settings: o, enabled: n, ...s } = a;
1114
+ const { credentials: r, settings: n, enabled: o, ...s } = a;
1115
1115
  await t.insertInto("email_providers").values({
1116
1116
  ...s,
1117
- enabled: n ? 1 : 0,
1117
+ enabled: o ? 1 : 0,
1118
1118
  credentials: JSON.stringify(r),
1119
- settings: JSON.stringify(o),
1119
+ settings: JSON.stringify(n),
1120
1120
  tenant_id: e,
1121
1121
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
1122
1122
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
@@ -1161,13 +1161,13 @@ function xa(t) {
1161
1161
  }
1162
1162
  function Ta(t) {
1163
1163
  return async (e, a, r) => {
1164
- const o = {
1164
+ const n = {
1165
1165
  ...r,
1166
1166
  device: r.device ? JSON.stringify(r.device) : void 0,
1167
1167
  resource_servers: r.resource_servers ? JSON.stringify(r.resource_servers) : void 0,
1168
1168
  rotating: r.rotating ? 1 : 0
1169
1169
  };
1170
- return !!(await t.updateTable("refresh_tokens").set(o).where("tenant_id", "=", e).where("refresh_tokens.id", "=", a).execute()).length;
1170
+ return !!(await t.updateTable("refresh_tokens").set(n).where("tenant_id", "=", e).where("refresh_tokens.id", "=", a).execute()).length;
1171
1171
  };
1172
1172
  }
1173
1173
  function Sa(t) {
@@ -1178,18 +1178,18 @@ function Sa(t) {
1178
1178
  }) => {
1179
1179
  let r = t.selectFrom("refresh_tokens").where("refresh_tokens.tenant_id", "=", e);
1180
1180
  a.q && (r = O(t, r, a.q, ["token", "session_id"]));
1181
- let o = r;
1181
+ let n = r;
1182
1182
  if (a.sort && a.sort.sort_by) {
1183
1183
  const { ref: d } = t.dynamic;
1184
- o = o.orderBy(
1184
+ n = n.orderBy(
1185
1185
  d(a.sort.sort_by),
1186
1186
  a.sort.sort_order
1187
1187
  );
1188
1188
  }
1189
- o = o.offset(a.page * a.per_page).limit(a.per_page);
1190
- const n = await o.selectAll().execute(), { count: s } = await r.select((d) => d.fn.countAll().as("count")).executeTakeFirstOrThrow(), l = x(s);
1189
+ n = n.offset(a.page * a.per_page).limit(a.per_page);
1190
+ const o = await n.selectAll().execute(), { count: s } = await r.select((d) => d.fn.countAll().as("count")).executeTakeFirstOrThrow(), l = x(s);
1191
1191
  return {
1192
- refresh_tokens: n.map((d) => ({
1192
+ refresh_tokens: o.map((d) => ({
1193
1193
  ...d,
1194
1194
  rotating: !!d.rotating,
1195
1195
  device: d.device ? JSON.parse(d.device) : {},
@@ -1211,6 +1211,28 @@ function Oa(t) {
1211
1211
  };
1212
1212
  }
1213
1213
  function ka(t) {
1214
+ return async () => {
1215
+ const e = new Date(Date.now() - 864e5).toISOString(), a = new Date(
1216
+ Date.now() - 1e3 * 60 * 60 * 24 * 7
1217
+ ).toISOString(), r = new Date(
1218
+ Date.now() - 1e3 * 60 * 60 * 24 * 30 * 3
1219
+ ).toISOString();
1220
+ await t.deleteFrom("codes").where("created_at", "<", e).limit(1e5).execute(), await t.deleteFrom("login_sessions").where("created_at", "<", a).where("session_id", "is", null).limit(1e5).execute(), await t.deleteFrom("logs").where("date", "<", r).limit(1e5).execute(), await t.deleteFrom("refresh_tokens").where("expires_at", "<", a).limit(1e5).execute(), await t.deleteFrom("sessions").where(
1221
+ (n) => n.and([
1222
+ n.or([
1223
+ n("sessions.expires_at", "<", a),
1224
+ n("sessions.idle_expires_at", "<", a)
1225
+ ]),
1226
+ n(
1227
+ "sessions.id",
1228
+ "not in",
1229
+ t.selectFrom("refresh_tokens").select("session_id")
1230
+ )
1231
+ ])
1232
+ ).limit(1e5).execute();
1233
+ };
1234
+ }
1235
+ function $a(t) {
1214
1236
  return t[t.length - 1];
1215
1237
  }
1216
1238
  function p(t) {
@@ -1243,7 +1265,7 @@ const J = p({
1243
1265
  identifier: J.create(e)
1244
1266
  });
1245
1267
  }
1246
- }), $a = p({
1268
+ }), Da = p({
1247
1269
  is(t) {
1248
1270
  return t.kind === "AliasNode";
1249
1271
  },
@@ -1272,7 +1294,7 @@ const J = p({
1272
1294
  }
1273
1295
  });
1274
1296
  var K;
1275
- class Da {
1297
+ class Ia {
1276
1298
  constructor() {
1277
1299
  j(this, "nodeStack", []);
1278
1300
  y(this, K, p({
@@ -2106,7 +2128,7 @@ class Da {
2106
2128
  }
2107
2129
  }
2108
2130
  K = new WeakMap();
2109
- const Ia = p({
2131
+ const Pa = p({
2110
2132
  AlterTableNode: !0,
2111
2133
  CreateIndexNode: !0,
2112
2134
  CreateSchemaNode: !0,
@@ -2126,7 +2148,7 @@ const Ia = p({
2126
2148
  MergeQueryNode: !0
2127
2149
  });
2128
2150
  var P, T, S, f, ge, ye, we, $, q, ve;
2129
- class Pa extends Da {
2151
+ class ja extends Ia {
2130
2152
  constructor(a) {
2131
2153
  super();
2132
2154
  y(this, f);
@@ -2141,15 +2163,15 @@ class Pa extends Da {
2141
2163
  const r = u(this, f, we).call(this, a);
2142
2164
  for (const s of r)
2143
2165
  c(this, S).add(s);
2144
- const o = u(this, f, ye).call(this, a);
2145
- for (const s of o)
2166
+ const n = u(this, f, ye).call(this, a);
2167
+ for (const s of n)
2146
2168
  c(this, T).add(s);
2147
- const n = super.transformNodeImpl(a);
2148
- for (const s of o)
2169
+ const o = super.transformNodeImpl(a);
2170
+ for (const s of n)
2149
2171
  c(this, T).delete(s);
2150
2172
  for (const s of r)
2151
2173
  c(this, S).delete(s);
2152
- return n;
2174
+ return o;
2153
2175
  }
2154
2176
  transformSchemableIdentifier(a) {
2155
2177
  const r = super.transformSchemableIdentifier(a);
@@ -2167,36 +2189,36 @@ class Pa extends Da {
2167
2189
  }
2168
2190
  }
2169
2191
  P = new WeakMap(), T = new WeakMap(), S = new WeakMap(), f = new WeakSet(), ge = function(a) {
2170
- return a.kind in Ia;
2192
+ return a.kind in Pa;
2171
2193
  }, ye = function(a) {
2172
2194
  const r = /* @__PURE__ */ new Set();
2173
2195
  if ("name" in a && a.name && W.is(a.name) && u(this, f, q).call(this, a.name, r), "from" in a && a.from)
2174
- for (const o of a.from.froms)
2175
- u(this, f, $).call(this, o, r);
2196
+ for (const n of a.from.froms)
2197
+ u(this, f, $).call(this, n, r);
2176
2198
  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)
2177
- for (const o of a.joins)
2178
- u(this, f, $).call(this, o.table, r);
2199
+ for (const n of a.joins)
2200
+ u(this, f, $).call(this, n.table, r);
2179
2201
  return "using" in a && a.using && u(this, f, $).call(this, a.using, r), r;
2180
2202
  }, we = function(a) {
2181
2203
  const r = /* @__PURE__ */ new Set();
2182
2204
  return "with" in a && a.with && u(this, f, ve).call(this, a.with, r), r;
2183
2205
  }, $ = function(a, r) {
2184
- const o = U.is(a) ? a : $a.is(a) && U.is(a.node) ? a.node : null;
2185
- o && u(this, f, q).call(this, o.table, r);
2206
+ const n = U.is(a) ? a : Da.is(a) && U.is(a.node) ? a.node : null;
2207
+ n && u(this, f, q).call(this, n.table, r);
2186
2208
  }, q = function(a, r) {
2187
- const o = a.identifier.name;
2188
- !c(this, T).has(o) && !c(this, S).has(o) && r.add(o);
2209
+ const n = a.identifier.name;
2210
+ !c(this, T).has(n) && !c(this, S).has(n) && r.add(n);
2189
2211
  }, ve = function(a, r) {
2190
- for (const o of a.expressions) {
2191
- const n = o.name.table.table.identifier.name;
2192
- c(this, S).has(n) || r.add(n);
2212
+ for (const n of a.expressions) {
2213
+ const o = n.name.table.table.identifier.name;
2214
+ c(this, S).has(o) || r.add(o);
2193
2215
  }
2194
2216
  };
2195
2217
  var L;
2196
- class ja {
2218
+ class Ma {
2197
2219
  constructor(e) {
2198
2220
  y(this, L);
2199
- M(this, L, new Pa(e));
2221
+ M(this, L, new ja(e));
2200
2222
  }
2201
2223
  transformQuery(e) {
2202
2224
  return c(this, L).transformNode(e.node);
@@ -2206,7 +2228,7 @@ class ja {
2206
2228
  }
2207
2229
  }
2208
2230
  L = new WeakMap();
2209
- class Ma {
2231
+ class Fa {
2210
2232
  transformQuery(e) {
2211
2233
  return e.node;
2212
2234
  }
@@ -2214,8 +2236,8 @@ class Ma {
2214
2236
  return e.result;
2215
2237
  }
2216
2238
  }
2217
- const Aa = "kysely_migration", _e = "kysely_migration_lock", Fa = !1, B = "migration_lock", La = p({ __noMigrations__: !0 });
2218
- var h, i, A, v, N, D, Ce, C, be, xe, Te, Se, Oe, G, I, H, ke, $e, De, X, Ie, Pe, je, Me, Ae, F;
2239
+ const Aa = "kysely_migration", _e = "kysely_migration_lock", La = !1, B = "migration_lock", za = p({ __noMigrations__: !0 });
2240
+ var h, i, F, v, N, D, Ce, C, be, xe, Te, Se, Oe, G, I, H, ke, $e, De, X, Ie, Pe, je, Me, Fe, A;
2219
2241
  class Ne {
2220
2242
  constructor(e) {
2221
2243
  y(this, i);
@@ -2229,12 +2251,12 @@ class Ne {
2229
2251
  */
2230
2252
  async getMigrations() {
2231
2253
  const e = await u(this, i, I).call(this, c(this, i, N)) ? await c(this, h).db.withPlugin(c(this, i, C)).selectFrom(c(this, i, N)).select(["name", "timestamp"]).execute() : [];
2232
- return (await u(this, i, X).call(this)).map(({ name: r, ...o }) => {
2233
- const n = e.find((s) => s.name === r);
2254
+ return (await u(this, i, X).call(this)).map(({ name: r, ...n }) => {
2255
+ const o = e.find((s) => s.name === r);
2234
2256
  return {
2235
2257
  name: r,
2236
- migration: o,
2237
- executedAt: n ? new Date(n.timestamp) : void 0
2258
+ migration: n,
2259
+ executedAt: o ? new Date(o.timestamp) : void 0
2238
2260
  };
2239
2261
  });
2240
2262
  }
@@ -2286,7 +2308,7 @@ class Ne {
2286
2308
  * ```
2287
2309
  */
2288
2310
  async migrateToLatest() {
2289
- return u(this, i, A).call(this, () => ({ direction: "Up", step: 1 / 0 }));
2311
+ return u(this, i, F).call(this, () => ({ direction: "Up", step: 1 / 0 }));
2290
2312
  }
2291
2313
  /**
2292
2314
  * Migrate up/down to a specific migration.
@@ -2312,16 +2334,16 @@ class Ne {
2312
2334
  * ```
2313
2335
  */
2314
2336
  async migrateTo(e) {
2315
- return u(this, i, A).call(this, ({ migrations: a, executedMigrations: r, pendingMigrations: o }) => {
2316
- if (e === La)
2337
+ return u(this, i, F).call(this, ({ migrations: a, executedMigrations: r, pendingMigrations: n }) => {
2338
+ if (e === za)
2317
2339
  return { direction: "Down", step: 1 / 0 };
2318
2340
  if (!a.find((l) => l.name === e))
2319
2341
  throw new Error(`migration "${e}" doesn't exist`);
2320
- const n = r.indexOf(e), s = o.findIndex((l) => l.name === e);
2321
- if (n !== -1)
2342
+ const o = r.indexOf(e), s = n.findIndex((l) => l.name === e);
2343
+ if (o !== -1)
2322
2344
  return {
2323
2345
  direction: "Down",
2324
- step: r.length - n - 1
2346
+ step: r.length - o - 1
2325
2347
  };
2326
2348
  if (s !== -1)
2327
2349
  return { direction: "Up", step: s + 1 };
@@ -2343,7 +2365,7 @@ class Ne {
2343
2365
  * ```
2344
2366
  */
2345
2367
  async migrateUp() {
2346
- return u(this, i, A).call(this, () => ({ direction: "Up", step: 1 }));
2368
+ return u(this, i, F).call(this, () => ({ direction: "Up", step: 1 }));
2347
2369
  }
2348
2370
  /**
2349
2371
  * Migrate one step down.
@@ -2360,10 +2382,10 @@ class Ne {
2360
2382
  * ```
2361
2383
  */
2362
2384
  async migrateDown() {
2363
- return u(this, i, A).call(this, () => ({ direction: "Down", step: 1 }));
2385
+ return u(this, i, F).call(this, () => ({ direction: "Down", step: 1 }));
2364
2386
  }
2365
2387
  }
2366
- h = new WeakMap(), i = new WeakSet(), A = async function(e) {
2388
+ h = new WeakMap(), i = new WeakSet(), F = async function(e) {
2367
2389
  try {
2368
2390
  return await u(this, i, be).call(this), await u(this, i, ke).call(this, e);
2369
2391
  } catch (a) {
@@ -2376,15 +2398,15 @@ h = new WeakMap(), i = new WeakSet(), A = async function(e) {
2376
2398
  }, D = function() {
2377
2399
  return c(this, h).migrationLockTableName ?? _e;
2378
2400
  }, Ce = function() {
2379
- return c(this, h).allowUnorderedMigrations ?? Fa;
2401
+ return c(this, h).allowUnorderedMigrations ?? La;
2380
2402
  }, C = function() {
2381
- return c(this, i, v) ? new ja(c(this, i, v)) : new Ma();
2403
+ return c(this, i, v) ? new Ma(c(this, i, v)) : new Fa();
2382
2404
  }, be = async function() {
2383
2405
  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);
2384
2406
  }, xe = async function() {
2385
2407
  if (c(this, i, v) && !await u(this, i, G).call(this))
2386
2408
  try {
2387
- await u(this, i, F).call(this, c(this, h).db.schema.createSchema(c(this, i, v)));
2409
+ await u(this, i, A).call(this, c(this, h).db.schema.createSchema(c(this, i, v)));
2388
2410
  } catch (e) {
2389
2411
  if (!await u(this, i, G).call(this))
2390
2412
  throw e;
@@ -2392,7 +2414,7 @@ h = new WeakMap(), i = new WeakSet(), A = async function(e) {
2392
2414
  }, Te = async function() {
2393
2415
  if (!await u(this, i, I).call(this, c(this, i, N)))
2394
2416
  try {
2395
- c(this, i, v) && await u(this, i, F).call(this, c(this, h).db.schema.createSchema(c(this, i, v))), await u(this, i, F).call(this, c(this, h).db.schema.withPlugin(c(this, i, C)).createTable(c(this, i, N)).addColumn("name", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("timestamp", "varchar(255)", (e) => e.notNull()));
2417
+ c(this, i, v) && await u(this, i, A).call(this, c(this, h).db.schema.createSchema(c(this, i, v))), await u(this, i, A).call(this, c(this, h).db.schema.withPlugin(c(this, i, C)).createTable(c(this, i, N)).addColumn("name", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("timestamp", "varchar(255)", (e) => e.notNull()));
2396
2418
  } catch (e) {
2397
2419
  if (!await u(this, i, I).call(this, c(this, i, N)))
2398
2420
  throw e;
@@ -2400,7 +2422,7 @@ h = new WeakMap(), i = new WeakSet(), A = async function(e) {
2400
2422
  }, Se = async function() {
2401
2423
  if (!await u(this, i, I).call(this, c(this, i, D)))
2402
2424
  try {
2403
- await u(this, i, F).call(this, c(this, h).db.schema.withPlugin(c(this, i, C)).createTable(c(this, i, D)).addColumn("id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("is_locked", "integer", (e) => e.notNull().defaultTo(0)));
2425
+ await u(this, i, A).call(this, c(this, h).db.schema.withPlugin(c(this, i, C)).createTable(c(this, i, D)).addColumn("id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("is_locked", "integer", (e) => e.notNull().defaultTo(0)));
2404
2426
  } catch (e) {
2405
2427
  if (!await u(this, i, I).call(this, c(this, i, D)))
2406
2428
  throw e;
@@ -2419,7 +2441,7 @@ h = new WeakMap(), i = new WeakSet(), A = async function(e) {
2419
2441
  const a = c(this, i, v);
2420
2442
  return (await c(this, h).db.introspection.getTables({
2421
2443
  withInternalKyselyTables: !0
2422
- })).some((o) => o.name === e && (!a || o.schema === a));
2444
+ })).some((n) => n.name === e && (!a || n.schema === a));
2423
2445
  }, H = async function() {
2424
2446
  return !!await c(this, h).db.withPlugin(c(this, i, C)).selectFrom(c(this, i, D)).where("id", "=", B).select("id").executeTakeFirst();
2425
2447
  }, ke = async function(e) {
@@ -2427,28 +2449,28 @@ h = new WeakMap(), i = new WeakSet(), A = async function(e) {
2427
2449
  lockTable: c(this, h).migrationLockTableName ?? _e,
2428
2450
  lockRowId: B,
2429
2451
  lockTableSchema: c(this, h).migrationTableSchema
2430
- }), o = async (n) => {
2452
+ }), n = async (o) => {
2431
2453
  try {
2432
- await a.acquireMigrationLock(n, r);
2433
- const s = await u(this, i, $e).call(this, n);
2454
+ await a.acquireMigrationLock(o, r);
2455
+ const s = await u(this, i, $e).call(this, o);
2434
2456
  if (s.migrations.length === 0)
2435
2457
  return { results: [] };
2436
2458
  const { direction: l, step: d } = e(s);
2437
- return d <= 0 ? { results: [] } : l === "Down" ? await u(this, i, Me).call(this, n, s, d) : l === "Up" ? await u(this, i, Ae).call(this, n, s, d) : { results: [] };
2459
+ return d <= 0 ? { results: [] } : l === "Down" ? await u(this, i, Me).call(this, o, s, d) : l === "Up" ? await u(this, i, Fe).call(this, o, s, d) : { results: [] };
2438
2460
  } finally {
2439
- await a.releaseMigrationLock(n, r);
2461
+ await a.releaseMigrationLock(o, r);
2440
2462
  }
2441
2463
  };
2442
- return a.supportsTransactionalDdl ? c(this, h).db.transaction().execute(o) : c(this, h).db.connection().execute(o);
2464
+ return a.supportsTransactionalDdl ? c(this, h).db.transaction().execute(n) : c(this, h).db.connection().execute(n);
2443
2465
  }, $e = async function(e) {
2444
2466
  const a = await u(this, i, X).call(this), r = await u(this, i, Ie).call(this, e);
2445
2467
  u(this, i, Pe).call(this, a, r), c(this, i, Ce) || u(this, i, je).call(this, a, r);
2446
- const o = u(this, i, De).call(this, a, r);
2468
+ const n = u(this, i, De).call(this, a, r);
2447
2469
  return p({
2448
2470
  migrations: a,
2449
2471
  executedMigrations: r,
2450
- lastMigration: ka(r),
2451
- pendingMigrations: o
2472
+ lastMigration: $a(r),
2473
+ pendingMigrations: n
2452
2474
  });
2453
2475
  }, De = function(e, a) {
2454
2476
  return e.filter((r) => !a.includes(r.name));
@@ -2462,68 +2484,68 @@ h = new WeakMap(), i = new WeakSet(), A = async function(e) {
2462
2484
  return (await e.withPlugin(c(this, i, C)).selectFrom(c(this, i, N)).select("name").orderBy(["timestamp", "name"]).execute()).map((r) => r.name);
2463
2485
  }, Pe = function(e, a) {
2464
2486
  for (const r of a)
2465
- if (!e.some((o) => o.name === r))
2487
+ if (!e.some((n) => n.name === r))
2466
2488
  throw new Error(`corrupted migrations: previously executed migration ${r} is missing`);
2467
2489
  }, je = function(e, a) {
2468
2490
  for (let r = 0; r < a.length; ++r)
2469
2491
  if (e[r].name !== a[r])
2470
2492
  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.`);
2471
2493
  }, Me = async function(e, a, r) {
2472
- const o = a.executedMigrations.slice().reverse().slice(0, r).map((s) => a.migrations.find((l) => l.name === s)), n = o.map((s) => ({
2494
+ const n = a.executedMigrations.slice().reverse().slice(0, r).map((s) => a.migrations.find((l) => l.name === s)), o = n.map((s) => ({
2473
2495
  migrationName: s.name,
2474
2496
  direction: "Down",
2475
2497
  status: "NotExecuted"
2476
2498
  }));
2477
- for (let s = 0; s < n.length; ++s) {
2478
- const l = o[s];
2499
+ for (let s = 0; s < o.length; ++s) {
2500
+ const l = n[s];
2479
2501
  try {
2480
- l.down && (await l.down(e), await e.withPlugin(c(this, i, C)).deleteFrom(c(this, i, N)).where("name", "=", l.name).execute(), n[s] = {
2502
+ l.down && (await l.down(e), await e.withPlugin(c(this, i, C)).deleteFrom(c(this, i, N)).where("name", "=", l.name).execute(), o[s] = {
2481
2503
  migrationName: l.name,
2482
2504
  direction: "Down",
2483
2505
  status: "Success"
2484
2506
  });
2485
2507
  } catch (d) {
2486
- throw n[s] = {
2508
+ throw o[s] = {
2487
2509
  migrationName: l.name,
2488
2510
  direction: "Down",
2489
2511
  status: "Error"
2490
2512
  }, new Q({
2491
2513
  error: d,
2492
- results: n
2514
+ results: o
2493
2515
  });
2494
2516
  }
2495
2517
  }
2496
- return { results: n };
2497
- }, Ae = async function(e, a, r) {
2498
- const n = a.pendingMigrations.slice(0, r).map((s) => ({
2518
+ return { results: o };
2519
+ }, Fe = async function(e, a, r) {
2520
+ const o = a.pendingMigrations.slice(0, r).map((s) => ({
2499
2521
  migrationName: s.name,
2500
2522
  direction: "Up",
2501
2523
  status: "NotExecuted"
2502
2524
  }));
2503
- for (let s = 0; s < n.length; s++) {
2525
+ for (let s = 0; s < o.length; s++) {
2504
2526
  const l = a.pendingMigrations[s];
2505
2527
  try {
2506
2528
  await l.up(e), await e.withPlugin(c(this, i, C)).insertInto(c(this, i, N)).values({
2507
2529
  name: l.name,
2508
2530
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
2509
- }).execute(), n[s] = {
2531
+ }).execute(), o[s] = {
2510
2532
  migrationName: l.name,
2511
2533
  direction: "Up",
2512
2534
  status: "Success"
2513
2535
  };
2514
2536
  } catch (d) {
2515
- throw n[s] = {
2537
+ throw o[s] = {
2516
2538
  migrationName: l.name,
2517
2539
  direction: "Up",
2518
2540
  status: "Error"
2519
2541
  }, new Q({
2520
2542
  error: d,
2521
- results: n
2543
+ results: o
2522
2544
  });
2523
2545
  }
2524
2546
  }
2525
- return { results: n };
2526
- }, F = async function(e) {
2547
+ return { results: o };
2548
+ }, A = async function(e) {
2527
2549
  c(this, h).db.getExecutor().adapter.supportsCreateIfNotExists && (e = e.ifNotExists()), await e.execute();
2528
2550
  };
2529
2551
  var z;
@@ -2538,7 +2560,7 @@ class Q extends Error {
2538
2560
  }
2539
2561
  }
2540
2562
  z = new WeakMap();
2541
- class Fe {
2563
+ class Ae {
2542
2564
  constructor(e) {
2543
2565
  j(this, "migrations");
2544
2566
  this.migrations = e;
@@ -2547,7 +2569,7 @@ class Fe {
2547
2569
  return this.migrations;
2548
2570
  }
2549
2571
  }
2550
- async function za(t) {
2572
+ async function Ea(t) {
2551
2573
  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(
2552
2574
  "tenant_id",
2553
2575
  "varchar(255)",
@@ -2615,35 +2637,35 @@ async function za(t) {
2615
2637
  (e) => e.references("tenants.id").onDelete("cascade").notNull()
2616
2638
  ).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();
2617
2639
  }
2618
- async function Ea(t) {
2640
+ async function Ja(t) {
2619
2641
  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();
2620
2642
  }
2621
- const Ja = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2643
+ const Ka = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2622
2644
  __proto__: null,
2623
- down: Ea,
2624
- up: za
2645
+ down: Ja,
2646
+ up: Ea
2625
2647
  }, Symbol.toStringTag, { value: "Module" }));
2626
- async function Ka(t) {
2648
+ async function Ra(t) {
2627
2649
  await t.schema.alterTable("tenants").addColumn("support_url", "varchar(255)").execute();
2628
2650
  }
2629
- async function Ra(t) {
2651
+ async function Ua(t) {
2630
2652
  await t.schema.alterTable("tenants").dropColumn("support_url").execute();
2631
2653
  }
2632
- const Ua = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2654
+ const Ba = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2633
2655
  __proto__: null,
2634
- down: Ra,
2635
- up: Ka
2656
+ down: Ua,
2657
+ up: Ra
2636
2658
  }, Symbol.toStringTag, { value: "Module" }));
2637
- async function Ba(t) {
2638
- }
2639
2659
  async function Qa(t) {
2640
2660
  }
2641
- const Va = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2661
+ async function Va(t) {
2662
+ }
2663
+ const Wa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2642
2664
  __proto__: null,
2643
- down: Qa,
2644
- up: Ba
2665
+ down: Va,
2666
+ up: Qa
2645
2667
  }, Symbol.toStringTag, { value: "Module" }));
2646
- async function Wa(t) {
2668
+ async function qa(t) {
2647
2669
  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(
2648
2670
  "tenant_id_constraint",
2649
2671
  ["tenant_id"],
@@ -2652,24 +2674,24 @@ async function Wa(t) {
2652
2674
  (e) => e.onDelete("cascade")
2653
2675
  ).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();
2654
2676
  }
2655
- async function qa(t) {
2677
+ async function Ga(t) {
2656
2678
  await t.schema.dropTable("logs").execute();
2657
2679
  }
2658
- const Ga = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2680
+ const Ha = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2659
2681
  __proto__: null,
2660
- down: qa,
2661
- up: Wa
2682
+ down: Ga,
2683
+ up: qa
2662
2684
  }, Symbol.toStringTag, { value: "Module" }));
2663
- async function Ha(t) {
2664
- }
2665
2685
  async function Xa(t) {
2666
2686
  }
2667
- const Ya = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2687
+ async function Ya(t) {
2688
+ }
2689
+ const Za = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2668
2690
  __proto__: null,
2669
- down: Xa,
2670
- up: Ha
2691
+ down: Ya,
2692
+ up: Xa
2671
2693
  }, Symbol.toStringTag, { value: "Module" }));
2672
- async function Za(t) {
2694
+ async function er(t) {
2673
2695
  await t.schema.createTable("sessions").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addForeignKeyConstraint(
2674
2696
  "user_id_constraint",
2675
2697
  ["user_id", "tenant_id"],
@@ -2694,15 +2716,15 @@ async function Za(t) {
2694
2716
  (e) => e.references("applications.id").onDelete("cascade").notNull()
2695
2717
  ).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();
2696
2718
  }
2697
- async function er(t) {
2719
+ async function tr(t) {
2698
2720
  await t.schema.dropTable("sessions").execute(), await t.schema.dropTable("tickets").execute(), await t.schema.dropTable("otps").execute();
2699
2721
  }
2700
- const tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2722
+ const ar = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2701
2723
  __proto__: null,
2702
- down: er,
2703
- up: Za
2724
+ down: tr,
2725
+ up: er
2704
2726
  }, Symbol.toStringTag, { value: "Module" }));
2705
- async function ar(t) {
2727
+ async function rr(t) {
2706
2728
  await t.schema.createTable("passwords").addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addPrimaryKeyConstraint("passwords_pkey", ["user_id", "tenant_id"]).addForeignKeyConstraint(
2707
2729
  "user_id_constraint",
2708
2730
  ["user_id", "tenant_id"],
@@ -2717,24 +2739,24 @@ async function ar(t) {
2717
2739
  (e) => e.onDelete("cascade")
2718
2740
  ).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();
2719
2741
  }
2720
- async function rr(t) {
2742
+ async function nr(t) {
2721
2743
  await t.schema.dropTable("passwords").execute(), await t.schema.dropTable("codes").execute();
2722
2744
  }
2723
- const nr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2745
+ const or = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2724
2746
  __proto__: null,
2725
- down: rr,
2726
- up: ar
2747
+ down: nr,
2748
+ up: rr
2727
2749
  }, Symbol.toStringTag, { value: "Module" }));
2728
- async function or(t) {
2729
- }
2730
2750
  async function sr(t) {
2731
2751
  }
2732
- const ir = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2752
+ async function ir(t) {
2753
+ }
2754
+ const dr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2733
2755
  __proto__: null,
2734
- down: sr,
2735
- up: or
2756
+ down: ir,
2757
+ up: sr
2736
2758
  }, Symbol.toStringTag, { value: "Module" }));
2737
- async function dr(t) {
2759
+ async function cr(t) {
2738
2760
  await t.schema.alterTable("passwords").addColumn(
2739
2761
  "password",
2740
2762
  "varchar(255)",
@@ -2742,288 +2764,288 @@ async function dr(t) {
2742
2764
  (e) => e.notNull()
2743
2765
  ).execute();
2744
2766
  }
2745
- async function cr(t) {
2767
+ async function lr(t) {
2746
2768
  await t.schema.alterTable("passwords").dropColumn("password").execute();
2747
2769
  }
2748
- const lr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2770
+ const ur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2749
2771
  __proto__: null,
2750
- down: cr,
2751
- up: dr
2772
+ down: lr,
2773
+ up: cr
2752
2774
  }, Symbol.toStringTag, { value: "Module" }));
2753
- async function ur(t) {
2754
- }
2755
2775
  async function mr(t) {
2756
2776
  }
2757
- const hr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2777
+ async function hr(t) {
2778
+ }
2779
+ const _r = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2758
2780
  __proto__: null,
2759
- down: mr,
2760
- up: ur
2781
+ down: hr,
2782
+ up: mr
2761
2783
  }, Symbol.toStringTag, { value: "Module" }));
2762
- async function _r(t) {
2763
- }
2764
2784
  async function fr(t) {
2765
2785
  }
2766
- const pr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2786
+ async function pr(t) {
2787
+ }
2788
+ const gr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2767
2789
  __proto__: null,
2768
- down: fr,
2769
- up: _r
2790
+ down: pr,
2791
+ up: fr
2770
2792
  }, Symbol.toStringTag, { value: "Module" }));
2771
- async function gr(t) {
2772
- }
2773
2793
  async function yr(t) {
2774
2794
  }
2775
- const wr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2795
+ async function wr(t) {
2796
+ }
2797
+ const vr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2776
2798
  __proto__: null,
2777
- down: yr,
2778
- up: gr
2799
+ down: wr,
2800
+ up: yr
2779
2801
  }, Symbol.toStringTag, { value: "Module" }));
2780
- async function vr(t) {
2802
+ async function Nr(t) {
2781
2803
  await t.schema.createIndex("users_email_index").on("users").column("email").execute();
2782
2804
  }
2783
- async function Nr(t) {
2805
+ async function Cr(t) {
2784
2806
  await t.schema.dropIndex("users_email_index").execute();
2785
2807
  }
2786
- const Cr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2808
+ const br = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2787
2809
  __proto__: null,
2788
- down: Nr,
2789
- up: vr
2810
+ down: Cr,
2811
+ up: Nr
2790
2812
  }, Symbol.toStringTag, { value: "Module" }));
2791
- async function br(t) {
2813
+ async function xr(t) {
2792
2814
  await t.schema.alterTable("users").addColumn("profileData", "varchar(2048)").execute();
2793
2815
  }
2794
- async function xr(t) {
2816
+ async function Tr(t) {
2795
2817
  await t.schema.alterTable("users").dropColumn("profileData").execute();
2796
2818
  }
2797
- const Tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2819
+ const Sr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2798
2820
  __proto__: null,
2799
- down: xr,
2800
- up: br
2821
+ down: Tr,
2822
+ up: xr
2801
2823
  }, Symbol.toStringTag, { value: "Module" }));
2802
- async function Sr(t) {
2824
+ async function Or(t) {
2803
2825
  await t.schema.createIndex("users_linked_to_index").on("users").column("linked_to").execute();
2804
2826
  }
2805
- async function Or(t) {
2827
+ async function kr(t) {
2806
2828
  await t.schema.dropIndex("users_linked_to_index");
2807
2829
  }
2808
- const kr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2830
+ const $r = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2809
2831
  __proto__: null,
2810
- down: Or,
2811
- up: Sr
2832
+ down: kr,
2833
+ up: Or
2812
2834
  }, Symbol.toStringTag, { value: "Module" }));
2813
- async function $r(t) {
2835
+ async function Dr(t) {
2814
2836
  await t.schema.alterTable("users").addColumn("locale", "varchar(255)").execute();
2815
2837
  }
2816
- async function Dr(t) {
2838
+ async function Ir(t) {
2817
2839
  await t.schema.alterTable("users").dropColumn("locale").execute();
2818
2840
  }
2819
- const Ir = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2841
+ const Pr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2820
2842
  __proto__: null,
2821
- down: Dr,
2822
- up: $r
2843
+ down: Ir,
2844
+ up: Dr
2823
2845
  }, Symbol.toStringTag, { value: "Module" }));
2824
- async function Pr(t) {
2846
+ async function jr(t) {
2825
2847
  await t.schema.createTable("keys").addColumn("kid", "varchar(255)", (e) => e.primaryKey()).addColumn(
2826
2848
  "tenant_id",
2827
2849
  "varchar(255)",
2828
2850
  (e) => e.references("tenants.id").onDelete("cascade")
2829
2851
  ).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();
2830
2852
  }
2831
- async function jr(t) {
2853
+ async function Mr(t) {
2832
2854
  await t.schema.dropTable("keys").execute();
2833
2855
  }
2834
- const Mr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2856
+ const Fr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2835
2857
  __proto__: null,
2836
- down: jr,
2837
- up: Pr
2858
+ down: Mr,
2859
+ up: jr
2838
2860
  }, Symbol.toStringTag, { value: "Module" }));
2839
2861
  async function Ar(t) {
2840
2862
  }
2841
- async function Fr(t) {
2863
+ async function Lr(t) {
2842
2864
  }
2843
- const Lr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2865
+ const zr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2844
2866
  __proto__: null,
2845
- down: Fr,
2867
+ down: Lr,
2846
2868
  up: Ar
2847
2869
  }, Symbol.toStringTag, { value: "Module" }));
2848
- async function zr(t) {
2849
- }
2850
2870
  async function Er(t) {
2851
2871
  }
2852
- const Jr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2872
+ async function Jr(t) {
2873
+ }
2874
+ const Kr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2853
2875
  __proto__: null,
2854
- down: Er,
2855
- up: zr
2876
+ down: Jr,
2877
+ up: Er
2856
2878
  }, Symbol.toStringTag, { value: "Module" }));
2857
- async function Kr(t) {
2879
+ async function Rr(t) {
2858
2880
  await t.schema.alterTable("otps").addColumn("audience", "varchar(255)").execute();
2859
2881
  }
2860
- async function Rr(t) {
2882
+ async function Ur(t) {
2861
2883
  await t.schema.alterTable("otps").dropColumn("audience").execute();
2862
2884
  }
2863
- const Ur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2885
+ const Br = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2864
2886
  __proto__: null,
2865
- down: Rr,
2866
- up: Kr
2887
+ down: Ur,
2888
+ up: Rr
2867
2889
  }, Symbol.toStringTag, { value: "Module" }));
2868
- async function Br(t) {
2869
- }
2870
2890
  async function Qr(t) {
2871
2891
  }
2872
- const Vr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2892
+ async function Vr(t) {
2893
+ }
2894
+ const Wr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2873
2895
  __proto__: null,
2874
- down: Qr,
2875
- up: Br
2896
+ down: Vr,
2897
+ up: Qr
2876
2898
  }, Symbol.toStringTag, { value: "Module" }));
2877
- async function Wr(t) {
2899
+ async function qr(t) {
2878
2900
  await t.schema.alterTable("logs").dropColumn("category").execute();
2879
2901
  }
2880
- async function qr(t) {
2902
+ async function Gr(t) {
2881
2903
  await t.schema.alterTable("logs").addColumn("category", "varchar(255)", (e) => e.notNull()).execute();
2882
2904
  }
2883
- const Gr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2905
+ const Hr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2884
2906
  __proto__: null,
2885
- down: qr,
2886
- up: Wr
2907
+ down: Gr,
2908
+ up: qr
2887
2909
  }, Symbol.toStringTag, { value: "Module" }));
2888
- async function Hr(t) {
2910
+ async function Xr(t) {
2889
2911
  await t.schema.alterTable("users").dropColumn("tags").execute();
2890
2912
  }
2891
- async function Xr(t) {
2913
+ async function Yr(t) {
2892
2914
  await t.schema.alterTable("users").addColumn("tags", "varchar(255)").execute();
2893
2915
  }
2894
- const Yr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2916
+ const Zr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2895
2917
  __proto__: null,
2896
- down: Xr,
2897
- up: Hr
2918
+ down: Yr,
2919
+ up: Xr
2898
2920
  }, Symbol.toStringTag, { value: "Module" }));
2899
- async function Zr(t) {
2921
+ async function en(t) {
2900
2922
  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();
2901
2923
  }
2902
- async function en(t) {
2924
+ async function tn(t) {
2903
2925
  await t.schema.dropIndex("logs_user_id"), await t.schema.dropIndex("logs_tenant_id"), await t.schema.dropIndex("logs_date");
2904
2926
  }
2905
- const tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2927
+ const an = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2906
2928
  __proto__: null,
2907
- down: en,
2908
- up: Zr
2929
+ down: tn,
2930
+ up: en
2909
2931
  }, Symbol.toStringTag, { value: "Module" }));
2910
- async function an(t) {
2932
+ async function rn(t) {
2911
2933
  await t.schema.alterTable("logs").dropColumn("details").execute(), await t.schema.alterTable("logs").addColumn("details", "varchar(8192)").execute();
2912
2934
  }
2913
- async function rn(t) {
2935
+ async function nn(t) {
2914
2936
  await t.schema.alterTable("logs").dropColumn("details").execute(), await t.schema.alterTable("logs").addColumn("details", "varchar(2048)").execute();
2915
2937
  }
2916
- const nn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2938
+ const on = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2917
2939
  __proto__: null,
2918
- down: rn,
2919
- up: an
2940
+ down: nn,
2941
+ up: rn
2920
2942
  }, Symbol.toStringTag, { value: "Module" }));
2921
- async function on(t) {
2943
+ async function sn(t) {
2922
2944
  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();
2923
2945
  }
2924
- async function sn(t) {
2946
+ async function dn(t) {
2925
2947
  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();
2926
2948
  }
2927
- const dn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2949
+ const cn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2928
2950
  __proto__: null,
2929
- down: sn,
2930
- up: on
2951
+ down: dn,
2952
+ up: sn
2931
2953
  }, Symbol.toStringTag, { value: "Module" }));
2932
- async function cn(t) {
2954
+ async function ln(t) {
2933
2955
  await t.schema.createIndex("users_name_index").on("users").column("name").execute();
2934
2956
  }
2935
- async function ln(t) {
2957
+ async function un(t) {
2936
2958
  await t.schema.dropIndex("users_name_index").execute();
2937
2959
  }
2938
- const un = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2960
+ const mn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2939
2961
  __proto__: null,
2940
- down: ln,
2941
- up: cn
2962
+ down: un,
2963
+ up: ln
2942
2964
  }, Symbol.toStringTag, { value: "Module" }));
2943
- async function mn(t) {
2944
- }
2945
2965
  async function hn(t) {
2966
+ }
2967
+ async function _n(t) {
2946
2968
  await t.schema.alterTable("users").dropConstraint("unique_email_provider").execute();
2947
2969
  }
2948
- const _n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2970
+ const fn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2949
2971
  __proto__: null,
2950
- down: hn,
2951
- up: mn
2972
+ down: _n,
2973
+ up: hn
2952
2974
  }, Symbol.toStringTag, { value: "Module" }));
2953
- async function fn(t) {
2975
+ async function pn(t) {
2954
2976
  await t.schema.alterTable("otps").dropColumn("state").execute(), await t.schema.alterTable("otps").addColumn("state", "varchar(8192)").execute();
2955
2977
  }
2956
- async function pn(t) {
2978
+ async function gn(t) {
2957
2979
  await t.schema.alterTable("otps").dropColumn("state").execute(), await t.schema.alterTable("otps").addColumn("state", "varchar(1024)").execute();
2958
2980
  }
2959
- const gn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2981
+ const yn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2960
2982
  __proto__: null,
2961
- down: pn,
2962
- up: fn
2983
+ down: gn,
2984
+ up: pn
2963
2985
  }, Symbol.toStringTag, { value: "Module" }));
2964
- async function yn(t) {
2986
+ async function wn(t) {
2965
2987
  await t.schema.alterTable("tickets").dropColumn("state").execute(), await t.schema.alterTable("tickets").addColumn("state", "varchar(8192)").execute();
2966
2988
  }
2967
- async function wn(t) {
2989
+ async function vn(t) {
2968
2990
  await t.schema.alterTable("tickets").dropColumn("state").execute(), await t.schema.alterTable("tickets").addColumn("state", "varchar(1024)").execute();
2969
2991
  }
2970
- const vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2992
+ const Nn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2971
2993
  __proto__: null,
2972
- down: wn,
2973
- up: yn
2994
+ down: vn,
2995
+ up: wn
2974
2996
  }, Symbol.toStringTag, { value: "Module" }));
2975
- async function Nn(t) {
2997
+ async function Cn(t) {
2976
2998
  await t.schema.createTable("branding").addColumn(
2977
2999
  "tenant_id",
2978
3000
  "varchar(255)",
2979
3001
  (e) => e.references("tenants.id").onDelete("cascade").notNull().primaryKey()
2980
3002
  ).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();
2981
3003
  }
2982
- async function Cn(t) {
3004
+ async function bn(t) {
2983
3005
  await t.schema.dropTable("branding").execute();
2984
3006
  }
2985
- const bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3007
+ const xn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2986
3008
  __proto__: null,
2987
- down: Cn,
2988
- up: Nn
3009
+ down: bn,
3010
+ up: Cn
2989
3011
  }, Symbol.toStringTag, { value: "Module" }));
2990
- async function xn(t) {
2991
- }
2992
3012
  async function Tn(t) {
2993
3013
  }
2994
- const Sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3014
+ async function Sn(t) {
3015
+ }
3016
+ const On = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2995
3017
  __proto__: null,
2996
- down: Tn,
2997
- up: xn
3018
+ down: Sn,
3019
+ up: Tn
2998
3020
  }, Symbol.toStringTag, { value: "Module" }));
2999
- async function On(t) {
3000
- }
3001
3021
  async function kn(t) {
3002
3022
  }
3003
- const $n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3023
+ async function $n(t) {
3024
+ }
3025
+ const Dn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3004
3026
  __proto__: null,
3005
- down: kn,
3006
- up: On
3027
+ down: $n,
3028
+ up: kn
3007
3029
  }, Symbol.toStringTag, { value: "Module" }));
3008
- async function Dn(t) {
3009
- }
3010
3030
  async function In(t) {
3011
3031
  }
3012
- const Pn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3032
+ async function Pn(t) {
3033
+ }
3034
+ const jn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3013
3035
  __proto__: null,
3014
- down: In,
3015
- up: Dn
3036
+ down: Pn,
3037
+ up: In
3016
3038
  }, Symbol.toStringTag, { value: "Module" }));
3017
- async function jn(t) {
3018
- }
3019
3039
  async function Mn(t) {
3020
3040
  }
3041
+ async function Fn(t) {
3042
+ }
3021
3043
  const An = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3022
3044
  __proto__: null,
3023
- down: Mn,
3024
- up: jn
3045
+ down: Fn,
3046
+ up: Mn
3025
3047
  }, Symbol.toStringTag, { value: "Module" }));
3026
- async function Fn(t) {
3048
+ async function Ln(t) {
3027
3049
  await t.schema.createTable("authentication_codes").addColumn(
3028
3050
  "tenant_id",
3029
3051
  "varchar(255)",
@@ -3034,55 +3056,55 @@ async function Fn(t) {
3034
3056
  (e) => e.references("applications.id").onDelete("cascade").notNull()
3035
3057
  ).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();
3036
3058
  }
3037
- async function Ln(t) {
3059
+ async function zn(t) {
3038
3060
  await t.schema.dropTable("authentication_codes").execute();
3039
3061
  }
3040
- const zn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3062
+ const En = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3041
3063
  __proto__: null,
3042
- down: Ln,
3043
- up: Fn
3064
+ down: zn,
3065
+ up: Ln
3044
3066
  }, Symbol.toStringTag, { value: "Module" }));
3045
- async function En(t) {
3046
- }
3047
3067
  async function Jn(t) {
3048
3068
  }
3049
- const Kn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3069
+ async function Kn(t) {
3070
+ }
3071
+ const Rn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3050
3072
  __proto__: null,
3051
- down: Jn,
3052
- up: En
3073
+ down: Kn,
3074
+ up: Jn
3053
3075
  }, Symbol.toStringTag, { value: "Module" }));
3054
- async function Rn(t) {
3076
+ async function Un(t) {
3055
3077
  await t.schema.alterTable("otps").addColumn("ip", "varchar(64)").execute();
3056
3078
  }
3057
- async function Un(t) {
3079
+ async function Bn(t) {
3058
3080
  await t.schema.alterTable("otps").dropColumn("ip").execute();
3059
3081
  }
3060
- const Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3082
+ const Qn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3061
3083
  __proto__: null,
3062
- down: Un,
3063
- up: Rn
3084
+ down: Bn,
3085
+ up: Un
3064
3086
  }, Symbol.toStringTag, { value: "Module" }));
3065
- async function Qn(t) {
3087
+ async function Vn(t) {
3066
3088
  await t.schema.alterTable("logs").dropColumn("user_agent").execute(), await t.schema.alterTable("logs").addColumn("user_agent", "varchar(1024)").execute();
3067
3089
  }
3068
- async function Vn(t) {
3090
+ async function Wn(t) {
3069
3091
  await t.schema.alterTable("logs").dropColumn("user_agent").execute(), await t.schema.alterTable("logs").addColumn("user_agent", "varchar(255)").execute();
3070
3092
  }
3071
- const Wn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3093
+ const qn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3072
3094
  __proto__: null,
3073
- down: Vn,
3074
- up: Qn
3095
+ down: Wn,
3096
+ up: Vn
3075
3097
  }, Symbol.toStringTag, { value: "Module" }));
3076
- async function qn(t) {
3077
- }
3078
3098
  async function Gn(t) {
3079
3099
  }
3080
- const Hn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3100
+ async function Hn(t) {
3101
+ }
3102
+ const Xn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3081
3103
  __proto__: null,
3082
- down: Gn,
3083
- up: qn
3104
+ down: Hn,
3105
+ up: Gn
3084
3106
  }, Symbol.toStringTag, { value: "Module" }));
3085
- async function Xn(t) {
3107
+ async function Yn(t) {
3086
3108
  await t.schema.createTable("hooks").addColumn("hook_id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn(
3087
3109
  "tenant_id",
3088
3110
  "varchar(255)",
@@ -3093,33 +3115,33 @@ async function Xn(t) {
3093
3115
  (e) => e.defaultTo(!1).notNull()
3094
3116
  ).addColumn("priority", "integer").execute();
3095
3117
  }
3096
- async function Yn(t) {
3118
+ async function Zn(t) {
3097
3119
  await t.schema.dropTable("hooks").execute();
3098
3120
  }
3099
- const Zn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3121
+ const eo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3100
3122
  __proto__: null,
3101
- down: Yn,
3102
- up: Xn
3123
+ down: Zn,
3124
+ up: Yn
3103
3125
  }, Symbol.toStringTag, { value: "Module" }));
3104
- async function eo(t) {
3105
- }
3106
3126
  async function to(t) {
3107
3127
  }
3108
- const ao = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3128
+ async function ao(t) {
3129
+ }
3130
+ const ro = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3109
3131
  __proto__: null,
3110
- down: to,
3111
- up: eo
3132
+ down: ao,
3133
+ up: to
3112
3134
  }, Symbol.toStringTag, { value: "Module" }));
3113
- async function ro(t) {
3114
- }
3115
3135
  async function no(t) {
3116
3136
  }
3117
- const oo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3137
+ async function oo(t) {
3138
+ }
3139
+ const so = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3118
3140
  __proto__: null,
3119
- down: no,
3120
- up: ro
3141
+ down: oo,
3142
+ up: no
3121
3143
  }, Symbol.toStringTag, { value: "Module" }));
3122
- async function so(t) {
3144
+ async function io(t) {
3123
3145
  await t.schema.createTable("logins").addColumn("login_id", "varchar(255)", (e) => e.primaryKey()).addColumn(
3124
3146
  "tenant_id",
3125
3147
  "varchar(255)",
@@ -3136,7 +3158,7 @@ async function so(t) {
3136
3158
  (e) => e.onDelete("cascade")
3137
3159
  ).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();
3138
3160
  }
3139
- async function io(t) {
3161
+ async function co(t) {
3140
3162
  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(
3141
3163
  "codes_user_id_tenant_id_constraint",
3142
3164
  ["user_id", "tenant_id"],
@@ -3145,90 +3167,90 @@ async function io(t) {
3145
3167
  (e) => e.onDelete("cascade")
3146
3168
  ).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();
3147
3169
  }
3148
- const co = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3170
+ const lo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3149
3171
  __proto__: null,
3150
- down: io,
3151
- up: so
3172
+ down: co,
3173
+ up: io
3152
3174
  }, Symbol.toStringTag, { value: "Module" }));
3153
- async function lo(t) {
3154
- }
3155
3175
  async function uo(t) {
3156
3176
  }
3157
- const mo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3177
+ async function mo(t) {
3178
+ }
3179
+ const ho = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3158
3180
  __proto__: null,
3159
- down: uo,
3160
- up: lo
3181
+ down: mo,
3182
+ up: uo
3161
3183
  }, Symbol.toStringTag, { value: "Module" }));
3162
- async function ho(t) {
3184
+ async function _o(t) {
3163
3185
  await t.schema.alterTable("logins").addColumn("auth0Client", "varchar(256)").execute();
3164
3186
  }
3165
- async function _o(t) {
3187
+ async function fo(t) {
3166
3188
  await t.schema.alterTable("logins").dropColumn("auth0Client").execute();
3167
3189
  }
3168
- const fo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3190
+ const po = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3169
3191
  __proto__: null,
3170
- down: _o,
3171
- up: ho
3192
+ down: fo,
3193
+ up: _o
3172
3194
  }, Symbol.toStringTag, { value: "Module" }));
3173
- async function po(t) {
3195
+ async function go(t) {
3174
3196
  await t.schema.alterTable("logins").dropColumn("authParams_state").execute(), await t.schema.alterTable("logins").addColumn("authParams_state", "varchar(8192)").execute();
3175
3197
  }
3176
- async function go(t) {
3198
+ async function yo(t) {
3177
3199
  await t.schema.alterTable("logins").dropColumn("authParams_state").execute(), await t.schema.alterTable("logins").addColumn("authParams_state", "varchar(511)").execute();
3178
3200
  }
3179
- const yo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3201
+ const wo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3180
3202
  __proto__: null,
3181
- down: go,
3182
- up: po
3203
+ down: yo,
3204
+ up: go
3183
3205
  }, Symbol.toStringTag, { value: "Module" }));
3184
- async function wo(t) {
3185
- }
3186
3206
  async function vo(t) {
3187
3207
  }
3188
- const No = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3208
+ async function No(t) {
3209
+ }
3210
+ const Co = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3189
3211
  __proto__: null,
3190
- down: vo,
3191
- up: wo
3212
+ down: No,
3213
+ up: vo
3192
3214
  }, Symbol.toStringTag, { value: "Module" }));
3193
- async function Co(t) {
3194
- }
3195
3215
  async function bo(t) {
3196
3216
  }
3197
- const xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3217
+ async function xo(t) {
3218
+ }
3219
+ const To = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3198
3220
  __proto__: null,
3199
- down: bo,
3200
- up: Co
3221
+ down: xo,
3222
+ up: bo
3201
3223
  }, Symbol.toStringTag, { value: "Module" }));
3202
- async function To(t) {
3224
+ async function So(t) {
3203
3225
  await t.schema.alterTable("logins").addColumn("authParams_nonce", "varchar(255)").execute();
3204
3226
  }
3205
- async function So(t) {
3227
+ async function Oo(t) {
3206
3228
  await t.schema.alterTable("logins").dropColumn("nonce").execute();
3207
3229
  }
3208
- const Oo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3230
+ const ko = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3209
3231
  __proto__: null,
3210
- down: So,
3211
- up: To
3232
+ down: Oo,
3233
+ up: So
3212
3234
  }, Symbol.toStringTag, { value: "Module" }));
3213
- async function ko(t) {
3214
- }
3215
3235
  async function $o(t) {
3216
3236
  }
3217
- const Do = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3237
+ async function Do(t) {
3238
+ }
3239
+ const Io = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3218
3240
  __proto__: null,
3219
- down: $o,
3220
- up: ko
3241
+ down: Do,
3242
+ up: $o
3221
3243
  }, Symbol.toStringTag, { value: "Module" }));
3222
- async function Io(t) {
3223
- }
3224
3244
  async function Po(t) {
3225
3245
  }
3226
- const jo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3246
+ async function jo(t) {
3247
+ }
3248
+ const Mo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3227
3249
  __proto__: null,
3228
- down: Po,
3229
- up: Io
3250
+ down: jo,
3251
+ up: Po
3230
3252
  }, Symbol.toStringTag, { value: "Module" }));
3231
- async function Mo(t) {
3253
+ async function Fo(t) {
3232
3254
  await t.schema.dropTable("codes").execute(), await t.schema.createTable("codes").addColumn("code_id", "varchar(255)", (e) => e.notNull()).addColumn(
3233
3255
  "tenant_id",
3234
3256
  "varchar(255)",
@@ -3257,15 +3279,15 @@ async function Ao(t) {
3257
3279
  (e) => e.onDelete("cascade")
3258
3280
  ).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();
3259
3281
  }
3260
- const Fo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3282
+ const Lo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3261
3283
  __proto__: null,
3262
3284
  down: Ao,
3263
- up: Mo
3285
+ up: Fo
3264
3286
  }, Symbol.toStringTag, { value: "Module" }));
3265
- async function Lo(t) {
3287
+ async function zo(t) {
3266
3288
  await t.schema.dropTable("otps").execute(), await t.schema.dropTable("authentication_codes").execute();
3267
3289
  }
3268
- async function zo(t) {
3290
+ async function Eo(t) {
3269
3291
  await t.schema.alterTable("keys").addColumn("private_key", "varchar(2048)").addColumn("public_key", "varchar(2048)").execute(), await t.schema.createTable("otps").addColumn(
3270
3292
  "tenant_id",
3271
3293
  "varchar(255)",
@@ -3284,32 +3306,32 @@ async function zo(t) {
3284
3306
  (e) => e.references("applications.id").onDelete("cascade").notNull()
3285
3307
  ).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();
3286
3308
  }
3287
- const Eo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3309
+ const Jo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3288
3310
  __proto__: null,
3289
- down: zo,
3290
- up: Lo
3311
+ down: Eo,
3312
+ up: zo
3291
3313
  }, Symbol.toStringTag, { value: "Module" }));
3292
- async function Jo(t) {
3314
+ async function Ko(t) {
3293
3315
  await t.schema.createIndex("IDX_logs_tenant_date_type_user").on("logs").columns(["tenant_id", "date", "type", "user_id"]).execute();
3294
3316
  }
3295
- async function Ko(t) {
3317
+ async function Ro(t) {
3296
3318
  await t.schema.dropIndex("IDX_logs_tenant_date_type_user").on("logs").execute();
3297
3319
  }
3298
- const Ro = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3320
+ const Uo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3299
3321
  __proto__: null,
3300
- down: Ko,
3301
- up: Jo
3322
+ down: Ro,
3323
+ up: Ko
3302
3324
  }, Symbol.toStringTag, { value: "Module" }));
3303
- async function Uo(t) {
3304
- }
3305
3325
  async function Bo(t) {
3306
3326
  }
3307
- const Qo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3327
+ async function Qo(t) {
3328
+ }
3329
+ const Vo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3308
3330
  __proto__: null,
3309
- down: Bo,
3310
- up: Uo
3331
+ down: Qo,
3332
+ up: Bo
3311
3333
  }, Symbol.toStringTag, { value: "Module" }));
3312
- async function Vo(t) {
3334
+ async function Wo(t) {
3313
3335
  await t.schema.createTable("prompt_settings").addColumn("tenant_id", "varchar(64)", (e) => e.primaryKey()).addColumn(
3314
3336
  "universal_login_experience",
3315
3337
  "varchar(16)",
@@ -3328,95 +3350,95 @@ async function Vo(t) {
3328
3350
  (e) => e.defaultTo(!1).notNull()
3329
3351
  ).execute();
3330
3352
  }
3331
- async function Wo(t) {
3353
+ async function qo(t) {
3332
3354
  await t.schema.dropTable("prompt_settings").execute();
3333
3355
  }
3334
- const qo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3356
+ const Go = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3335
3357
  __proto__: null,
3336
- down: Wo,
3337
- up: Vo
3358
+ down: qo,
3359
+ up: Wo
3338
3360
  }, Symbol.toStringTag, { value: "Module" }));
3339
- async function Go(t) {
3340
- }
3341
3361
  async function Ho(t) {
3342
3362
  }
3343
- const Xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3363
+ async function Xo(t) {
3364
+ }
3365
+ const Yo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3344
3366
  __proto__: null,
3345
- down: Ho,
3346
- up: Go
3367
+ down: Xo,
3368
+ up: Ho
3347
3369
  }, Symbol.toStringTag, { value: "Module" }));
3348
- async function Yo(t) {
3349
- }
3350
3370
  async function Zo(t) {
3351
3371
  }
3352
- const es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3372
+ async function es(t) {
3373
+ }
3374
+ const ts = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3353
3375
  __proto__: null,
3354
- down: Zo,
3355
- up: Yo
3376
+ down: es,
3377
+ up: Zo
3356
3378
  }, Symbol.toStringTag, { value: "Module" }));
3357
- async function ts(t) {
3358
- }
3359
3379
  async function as(t) {
3360
3380
  }
3361
- const rs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3381
+ async function rs(t) {
3382
+ }
3383
+ const ns = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3362
3384
  __proto__: null,
3363
- down: as,
3364
- up: ts
3385
+ down: rs,
3386
+ up: as
3365
3387
  }, Symbol.toStringTag, { value: "Module" }));
3366
- async function ns(t) {
3388
+ async function os(t) {
3367
3389
  await t.schema.alterTable("logins").addColumn("authParams_ui_locales", "varchar(32)").execute();
3368
3390
  }
3369
- async function os(t) {
3391
+ async function ss(t) {
3370
3392
  await t.schema.alterTable("logins").dropColumn("authParams_ui_locales").execute();
3371
3393
  }
3372
- const ss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3394
+ const is = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3373
3395
  __proto__: null,
3374
- down: os,
3375
- up: ns
3396
+ down: ss,
3397
+ up: os
3376
3398
  }, Symbol.toStringTag, { value: "Module" }));
3377
- async function is(t) {
3399
+ async function ds(t) {
3378
3400
  await t.schema.alterTable("logins").addColumn("authParams_prompt", "varchar(16)").execute();
3379
3401
  }
3380
- async function ds(t) {
3402
+ async function cs(t) {
3381
3403
  await t.schema.alterTable("logins").dropColumn("authParams_prompt").execute();
3382
3404
  }
3383
- const cs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3405
+ const ls = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3384
3406
  __proto__: null,
3385
- down: ds,
3386
- up: is
3407
+ down: cs,
3408
+ up: ds
3387
3409
  }, Symbol.toStringTag, { value: "Module" }));
3388
- async function ls(t) {
3389
- }
3390
3410
  async function us(t) {
3391
3411
  }
3392
- const ms = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3412
+ async function ms(t) {
3413
+ }
3414
+ const hs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3393
3415
  __proto__: null,
3394
- down: us,
3395
- up: ls
3416
+ down: ms,
3417
+ up: us
3396
3418
  }, Symbol.toStringTag, { value: "Module" }));
3397
- async function hs(t) {
3419
+ async function _s(t) {
3398
3420
  await t.schema.alterTable("logins").addColumn("authParams_act_as", "varchar(255)").execute();
3399
3421
  }
3400
- async function _s(t) {
3422
+ async function fs(t) {
3401
3423
  await t.schema.alterTable("logins").dropColumn("authParam_act_as").execute();
3402
3424
  }
3403
- const fs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3425
+ const ps = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3404
3426
  __proto__: null,
3405
- down: _s,
3406
- up: hs
3427
+ down: fs,
3428
+ up: _s
3407
3429
  }, Symbol.toStringTag, { value: "Module" }));
3408
- async function ps(t) {
3430
+ async function gs(t) {
3409
3431
  await t.schema.alterTable("codes").addColumn("code_verifier", "varchar(128)").execute();
3410
3432
  }
3411
- async function gs(t) {
3433
+ async function ys(t) {
3412
3434
  await t.schema.alterTable("codes").dropColumn("code_verifier").execute();
3413
3435
  }
3414
- const ys = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3436
+ const ws = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3415
3437
  __proto__: null,
3416
- down: gs,
3417
- up: ps
3438
+ down: ys,
3439
+ up: gs
3418
3440
  }, Symbol.toStringTag, { value: "Module" }));
3419
- async function ws(t) {
3441
+ async function vs(t) {
3420
3442
  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(
3421
3443
  "credentials",
3422
3444
  "varchar(2048)",
@@ -3427,18 +3449,18 @@ async function ws(t) {
3427
3449
  (e) => e.notNull().defaultTo("{}")
3428
3450
  ).addColumn("created_at", "varchar(29)", (e) => e.notNull()).addColumn("updated_at", "varchar(29)", (e) => e.notNull()).execute();
3429
3451
  }
3430
- async function vs(t) {
3452
+ async function Ns(t) {
3431
3453
  await t.schema.dropTable("email_providers").execute();
3432
3454
  }
3433
- const Ns = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3455
+ const Cs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3434
3456
  __proto__: null,
3435
- down: vs,
3436
- up: ws
3457
+ down: Ns,
3458
+ up: vs
3437
3459
  }, Symbol.toStringTag, { value: "Module" }));
3438
- async function Cs(t) {
3460
+ async function bs(t) {
3439
3461
  await t.schema.dropTable("tickets").execute();
3440
3462
  }
3441
- async function bs(t) {
3463
+ async function xs(t) {
3442
3464
  await t.schema.createTable("tickets").addColumn(
3443
3465
  "tenant_id",
3444
3466
  "varchar(255)",
@@ -3449,22 +3471,22 @@ async function bs(t) {
3449
3471
  (e) => e.references("applications.id").onDelete("cascade").notNull()
3450
3472
  ).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();
3451
3473
  }
3452
- const xs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3474
+ const Ts = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3453
3475
  __proto__: null,
3454
- down: bs,
3455
- up: Cs
3476
+ down: xs,
3477
+ up: bs
3456
3478
  }, Symbol.toStringTag, { value: "Module" }));
3457
- async function Ts(t) {
3458
- }
3459
3479
  async function Ss(t) {
3480
+ }
3481
+ async function Os(t) {
3460
3482
  await t.schema.alterTable("logins").dropColumn("ip").dropColumn("useragent").execute();
3461
3483
  }
3462
- const Os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3484
+ const ks = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3463
3485
  __proto__: null,
3464
- down: Ss,
3465
- up: Ts
3486
+ down: Os,
3487
+ up: Ss
3466
3488
  }, Symbol.toStringTag, { value: "Module" }));
3467
- async function ks(t) {
3489
+ async function $s(t) {
3468
3490
  await t.schema.createTable("refresh_tokens").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn(
3469
3491
  "client_id",
3470
3492
  "varchar(21)",
@@ -3477,24 +3499,24 @@ async function ks(t) {
3477
3499
  (e) => e.onDelete("cascade")
3478
3500
  ).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();
3479
3501
  }
3480
- async function $s(t) {
3502
+ async function Ds(t) {
3481
3503
  await t.schema.dropTable("refresh_tokens").execute();
3482
3504
  }
3483
- const Ds = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3505
+ const Is = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3484
3506
  __proto__: null,
3485
- down: $s,
3486
- up: ks
3507
+ down: Ds,
3508
+ up: $s
3487
3509
  }, Symbol.toStringTag, { value: "Module" }));
3488
- async function Is(t) {
3489
- }
3490
3510
  async function Ps(t) {
3491
3511
  }
3492
- const js = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3512
+ async function js(t) {
3513
+ }
3514
+ const Ms = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3493
3515
  __proto__: null,
3494
- down: Ps,
3495
- up: Is
3516
+ down: js,
3517
+ up: Ps
3496
3518
  }, Symbol.toStringTag, { value: "Module" }));
3497
- async function Ms(t) {
3519
+ async function Fs(t) {
3498
3520
  await t.schema.dropTable("sessions").execute(), await t.schema.dropTable("refresh_tokens").execute();
3499
3521
  }
3500
3522
  async function As(t) {
@@ -3516,12 +3538,12 @@ async function As(t) {
3516
3538
  (e) => e.onDelete("cascade")
3517
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();
3518
3540
  }
3519
- const Fs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3541
+ const Ls = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3520
3542
  __proto__: null,
3521
3543
  down: As,
3522
- up: Ms
3544
+ up: Fs
3523
3545
  }, Symbol.toStringTag, { value: "Module" }));
3524
- async function Ls(t) {
3546
+ async function zs(t) {
3525
3547
  await t.schema.createTable("sessions_2").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addForeignKeyConstraint(
3526
3548
  "sessions_2_user_id_constraint",
3527
3549
  ["user_id", "tenant_id"],
@@ -3540,15 +3562,15 @@ async function Ls(t) {
3540
3562
  (e) => e.onDelete("cascade")
3541
3563
  ).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();
3542
3564
  }
3543
- async function zs(t) {
3565
+ async function Es(t) {
3544
3566
  await t.schema.dropTable("sessions_2").execute(), await t.schema.dropTable("refresh_tokens_2").execute();
3545
3567
  }
3546
- const Es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3568
+ const Js = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3547
3569
  __proto__: null,
3548
- down: zs,
3549
- up: Ls
3570
+ down: Es,
3571
+ up: zs
3550
3572
  }, Symbol.toStringTag, { value: "Module" }));
3551
- async function Js(t) {
3573
+ async function Ks(t) {
3552
3574
  await t.schema.createTable("custom_domains").addColumn(
3553
3575
  "custom_domain_id",
3554
3576
  "varchar(21)",
@@ -3559,49 +3581,49 @@ async function Js(t) {
3559
3581
  (e) => e.references("tenants.id").onDelete("cascade").notNull()
3560
3582
  ).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", "varchar(35)", (e) => e.notNull()).addColumn("updated_at", "varchar(35)", (e) => e.notNull()).execute(), await t.schema.dropTable("domains").execute();
3561
3583
  }
3562
- async function Ks(t) {
3584
+ async function Rs(t) {
3563
3585
  await t.schema.dropTable("custom_domains").execute(), await t.schema.createTable("domains").addColumn("id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn(
3564
3586
  "tenant_id",
3565
3587
  "varchar(255)",
3566
3588
  (e) => e.references("tenants.id").onDelete("cascade").notNull()
3567
3589
  ).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();
3568
3590
  }
3569
- const Rs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3591
+ const Us = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3570
3592
  __proto__: null,
3571
- down: Ks,
3572
- up: Js
3593
+ down: Rs,
3594
+ up: Ks
3573
3595
  }, Symbol.toStringTag, { value: "Module" }));
3574
- async function Us(t) {
3575
- }
3576
3596
  async function Bs(t) {
3597
+ }
3598
+ async function Qs(t) {
3577
3599
  await t.schema.alterTable("logins").dropColumn("authParams_organization").dropColumn("authorization_url").execute();
3578
3600
  }
3579
- const Qs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3601
+ const Vs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3580
3602
  __proto__: null,
3581
- down: Bs,
3582
- up: Us
3603
+ down: Qs,
3604
+ up: Bs
3583
3605
  }, Symbol.toStringTag, { value: "Module" }));
3584
- async function Vs(t) {
3606
+ async function Ws(t) {
3585
3607
  await t.schema.alterTable("logins").dropColumn("authorization_url").execute(), await t.schema.alterTable("logins").addColumn("authorization_url", "varchar(2048)").execute();
3586
3608
  }
3587
- async function Ws(t) {
3609
+ async function qs(t) {
3588
3610
  await t.schema.alterTable("logins").dropColumn("authorization_url").execute(), await t.schema.alterTable("logins").addColumn("authorization_url", "varchar(1024)").execute();
3589
3611
  }
3590
- const qs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3612
+ const Gs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3591
3613
  __proto__: null,
3592
- down: Ws,
3593
- up: Vs
3614
+ down: qs,
3615
+ up: Ws
3594
3616
  }, Symbol.toStringTag, { value: "Module" }));
3595
- async function Gs(t) {
3596
- }
3597
3617
  async function Hs(t) {
3598
3618
  }
3599
- const Xs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3619
+ async function Xs(t) {
3620
+ }
3621
+ const Ys = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3600
3622
  __proto__: null,
3601
- down: Hs,
3602
- up: Gs
3623
+ down: Xs,
3624
+ up: Hs
3603
3625
  }, Symbol.toStringTag, { value: "Module" }));
3604
- async function Ys(t) {
3626
+ async function Zs(t) {
3605
3627
  await t.schema.createTable("sessions").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addForeignKeyConstraint(
3606
3628
  "sessions_user_id_constraint",
3607
3629
  ["user_id", "tenant_id"],
@@ -3628,120 +3650,132 @@ async function Ys(t) {
3628
3650
  (e) => e.onDelete("cascade")
3629
3651
  ).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();
3630
3652
  }
3631
- async function Zs(t) {
3653
+ async function ei(t) {
3632
3654
  await t.schema.dropTable("sessions").execute(), await t.schema.dropTable("login_sessions").execute(), await t.schema.dropTable("refresh_tokens").execute();
3633
3655
  }
3634
- const ei = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3656
+ const ti = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3657
+ __proto__: null,
3658
+ down: ei,
3659
+ up: Zs
3660
+ }, Symbol.toStringTag, { value: "Module" }));
3661
+ async function ai(t) {
3662
+ await t.schema.dropTable("logins").execute(), await t.schema.dropTable("sessions_2").execute(), await t.schema.dropTable("refresh_tokens_2").execute();
3663
+ }
3664
+ async function ri(t) {
3665
+ }
3666
+ const ni = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3635
3667
  __proto__: null,
3636
- down: Zs,
3637
- up: Ys
3668
+ down: ri,
3669
+ up: ai
3638
3670
  }, Symbol.toStringTag, { value: "Module" })), Le = {
3639
- m1_init: Ja,
3640
- m2_magicLink: Ua,
3641
- m3_updateAt: Va,
3642
- m4_logTable: Ga,
3643
- m5_userProfile: Ya,
3644
- m6_sessions: tr,
3645
- m7_passwords: nr,
3646
- m8_logsTableNewFields: ir,
3647
- m9_passwordTableNewField: lr,
3648
- n01_codesTable: hr,
3649
- n11_universalLoginSession: pr,
3650
- n12_userFields: wr,
3651
- n13_userEmailIndex: Cr,
3652
- n14_profileDataField: Tr,
3653
- n15_userEmailIndex: kr,
3654
- n16_userLocale: Ir,
3655
- n17_signingKeys: Mr,
3656
- n18_logsFields: Lr,
3657
- n19_connectionsUserinfo: Jr,
3658
- n20_missingFields: Ur,
3659
- n21_sessionDeletedAt: Vr,
3660
- n22_dropLogsFields: Gr,
3661
- n23_dropUsersFields: Yr,
3662
- n24_logsIndexes: tn,
3663
- n25_logDescMaxLength: nn,
3664
- n26_logsTableExtraFields: dn,
3665
- n27_usersTableNameIndex: un,
3666
- n28_usersEmailConstrain: _n,
3667
- n29_increaseOtpStateLength: gn,
3668
- n30_increaseTicketStateLength: vn,
3669
- n31_branding: bn,
3670
- n32_indexesAndNotNull: Sn,
3671
- n33_vendorIdInUniversalLoginSession: $n,
3672
- n34_auth0ClientInUniversalLoginSession: Pn,
3671
+ m1_init: Ka,
3672
+ m2_magicLink: Ba,
3673
+ m3_updateAt: Wa,
3674
+ m4_logTable: Ha,
3675
+ m5_userProfile: Za,
3676
+ m6_sessions: ar,
3677
+ m7_passwords: or,
3678
+ m8_logsTableNewFields: dr,
3679
+ m9_passwordTableNewField: ur,
3680
+ n01_codesTable: _r,
3681
+ n11_universalLoginSession: gr,
3682
+ n12_userFields: vr,
3683
+ n13_userEmailIndex: br,
3684
+ n14_profileDataField: Sr,
3685
+ n15_userEmailIndex: $r,
3686
+ n16_userLocale: Pr,
3687
+ n17_signingKeys: Fr,
3688
+ n18_logsFields: zr,
3689
+ n19_connectionsUserinfo: Kr,
3690
+ n20_missingFields: Br,
3691
+ n21_sessionDeletedAt: Wr,
3692
+ n22_dropLogsFields: Hr,
3693
+ n23_dropUsersFields: Zr,
3694
+ n24_logsIndexes: an,
3695
+ n25_logDescMaxLength: on,
3696
+ n26_logsTableExtraFields: cn,
3697
+ n27_usersTableNameIndex: mn,
3698
+ n28_usersEmailConstrain: fn,
3699
+ n29_increaseOtpStateLength: yn,
3700
+ n30_increaseTicketStateLength: Nn,
3701
+ n31_branding: xn,
3702
+ n32_indexesAndNotNull: On,
3703
+ n33_vendorIdInUniversalLoginSession: Dn,
3704
+ n34_auth0ClientInUniversalLoginSession: jn,
3673
3705
  n35_increaseUniversalSessionStateLength: An,
3674
- n36_authenticationCodes: zn,
3675
- n37_disableSignUps: Kn,
3676
- n38_otpIpAddress: Bn,
3677
- n39_increaseUserAgentLength: Wn,
3678
- n40_userId: Hn,
3679
- n41_hooks: Zn,
3680
- n42_userIdIndexes: ao,
3681
- n43_userIdIndexes: oo,
3682
- n44_codes: co,
3683
- n45_hookProperties: mo,
3684
- n46_loginAuth0Client: fo,
3685
- n47_loginAuth0Client: yo,
3686
- n48_saml: No,
3687
- n49_removeFields: xo,
3688
- n50_authParamsNonce: Oo,
3689
- n51_connectionid: Do,
3690
- n52_cert: jo,
3691
- n53_codes_primary_key: Fo,
3692
- n54_cleanup_tables: Eo,
3693
- n55_logs_index: Ro,
3694
- n56_application_fields: Qo,
3695
- n57_prompt_settings: qo,
3696
- n58_connection_client_id: Xo,
3697
- n59_connection_options: es,
3698
- n60_users_metadata: rs,
3699
- n61_userLocales: ss,
3700
- n62_prompt: cs,
3701
- n63_connection_cleanup: ms,
3702
- n64_act_as: fs,
3703
- n65_code_verifier: ys,
3704
- n66_email_providers: Ns,
3705
- n67_drop_tickets: xs,
3706
- n68_login_useragents: Os,
3707
- n70_refresh_tokens: Ds,
3708
- n71_session_new_fields: js,
3709
- n72_session_primary_key: Fs,
3710
- n73_drop_sessions: Es,
3711
- n74_custom_domains: Rs,
3712
- n75_organizations: Qs,
3713
- n76_authorization_url_length: qs,
3714
- n77_drop_sessions: Xs,
3715
- n78_login_sessions: ei
3706
+ n36_authenticationCodes: En,
3707
+ n37_disableSignUps: Rn,
3708
+ n38_otpIpAddress: Qn,
3709
+ n39_increaseUserAgentLength: qn,
3710
+ n40_userId: Xn,
3711
+ n41_hooks: eo,
3712
+ n42_userIdIndexes: ro,
3713
+ n43_userIdIndexes: so,
3714
+ n44_codes: lo,
3715
+ n45_hookProperties: ho,
3716
+ n46_loginAuth0Client: po,
3717
+ n47_loginAuth0Client: wo,
3718
+ n48_saml: Co,
3719
+ n49_removeFields: To,
3720
+ n50_authParamsNonce: ko,
3721
+ n51_connectionid: Io,
3722
+ n52_cert: Mo,
3723
+ n53_codes_primary_key: Lo,
3724
+ n54_cleanup_tables: Jo,
3725
+ n55_logs_index: Uo,
3726
+ n56_application_fields: Vo,
3727
+ n57_prompt_settings: Go,
3728
+ n58_connection_client_id: Yo,
3729
+ n59_connection_options: ts,
3730
+ n60_users_metadata: ns,
3731
+ n61_userLocales: is,
3732
+ n62_prompt: ls,
3733
+ n63_connection_cleanup: hs,
3734
+ n64_act_as: ps,
3735
+ n65_code_verifier: ws,
3736
+ n66_email_providers: Cs,
3737
+ n67_drop_tickets: Ts,
3738
+ n68_login_useragents: ks,
3739
+ n70_refresh_tokens: Is,
3740
+ n71_session_new_fields: Ms,
3741
+ n72_session_primary_key: Ls,
3742
+ n73_drop_sessions: Js,
3743
+ n74_custom_domains: Us,
3744
+ n75_organizations: Vs,
3745
+ n76_authorization_url_length: Gs,
3746
+ n77_drop_sessions: Ys,
3747
+ n78_login_sessions: ti,
3748
+ n79_drop_sessions_2: ni
3716
3749
  };
3717
- async function oi(t, e = !1) {
3750
+ async function ci(t, e = !1) {
3718
3751
  e && console.log("migrating...");
3719
- const a = new Fe(Le), r = new Ne({
3752
+ const a = new Ae(Le), r = new Ne({
3720
3753
  db: t,
3721
3754
  provider: a
3722
- }), { error: o, results: n } = await r.migrateToLatest();
3723
- if (n == null || n.forEach((s) => {
3755
+ }), { error: n, results: o } = await r.migrateToLatest();
3756
+ if (o == null || o.forEach((s) => {
3724
3757
  s.status === "Success" ? e && console.log(
3725
3758
  `migration "${s.migrationName}" was executed successfully`
3726
3759
  ) : s.status === "Error" && console.error(`failed to execute migration "${s.migrationName}"`);
3727
- }), o)
3728
- throw console.error("failed to migrate"), console.error(o), o;
3760
+ }), n)
3761
+ throw console.error("failed to migrate"), console.error(n), n;
3729
3762
  }
3730
- async function si(t) {
3763
+ async function li(t) {
3731
3764
  console.log("migrating...");
3732
- const e = new Fe(Le), a = new Ne({
3765
+ const e = new Ae(Le), a = new Ne({
3733
3766
  db: t,
3734
3767
  provider: e
3735
- }), { error: r, results: o } = await a.migrateDown();
3736
- if (o == null || o.forEach((n) => {
3737
- n.status === "Success" ? console.log(`migration "${n.migrationName}" was reverted successfully`) : n.status === "Error" && console.error(`failed to execute migration "${n.migrationName}"`);
3768
+ }), { error: r, results: n } = await a.migrateDown();
3769
+ if (n == null || n.forEach((o) => {
3770
+ o.status === "Success" ? console.log(`migration "${o.migrationName}" was reverted successfully`) : o.status === "Error" && console.error(`failed to execute migration "${o.migrationName}"`);
3738
3771
  }), r)
3739
3772
  throw console.error("failed to migrate"), console.error(r), r;
3740
3773
  }
3741
- function ii(t) {
3774
+ function ui(t) {
3742
3775
  return {
3743
3776
  applications: It(t),
3744
3777
  branding: Xt(t),
3778
+ cleanup: ka(t),
3745
3779
  clients: zt(t),
3746
3780
  codes: Tt(t),
3747
3781
  connections: Lt(t),
@@ -3761,7 +3795,7 @@ function ii(t) {
3761
3795
  };
3762
3796
  }
3763
3797
  export {
3764
- ii as default,
3765
- si as migrateDown,
3766
- oi as migrateToLatest
3798
+ ui as default,
3799
+ li as migrateDown,
3800
+ ci as migrateToLatest
3767
3801
  };