@authhero/kysely-adapter 10.25.0 → 10.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
- var Je = Object.defineProperty;
1
+ var Ee = Object.defineProperty;
2
2
  var ue = (t) => {
3
3
  throw TypeError(t);
4
4
  };
5
- var Ee = (t, e, a) => e in t ? Je(t, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[e] = a;
6
- var M = (t, e, a) => Ee(t, typeof e != "symbol" ? e + "" : e, a), U = (t, e, a) => e.has(t) || ue("Cannot " + a);
7
- var d = (t, e, a) => (U(t, e, "read from private field"), a ? a.call(t) : e.get(t)), y = (t, e, a) => e.has(t) ? ue("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, a), F = (t, e, a, n) => (U(t, e, "write to private field"), n ? n.call(t, a) : e.set(t, a), a), u = (t, e, a) => (U(t, e, "access private method"), a);
8
- import { parseUserId as Z, codeSchema as Ke, connectionSchema as Re, loginSessionSchema as Ue, promptSettingSchema as Be, formSchema as K } from "@authhero/adapter-interfaces";
5
+ var Ke = (t, e, a) => e in t ? Ee(t, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[e] = a;
6
+ var M = (t, e, a) => Ke(t, typeof e != "symbol" ? e + "" : e, a), U = (t, e, a) => e.has(t) || ue("Cannot " + a);
7
+ var c = (t, e, a) => (U(t, e, "read from private field"), a ? a.call(t) : e.get(t)), y = (t, e, a) => e.has(t) ? ue("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, a), F = (t, e, a, n) => (U(t, e, "write to private field"), n ? n.call(t, a) : e.set(t, a), a), u = (t, e, a) => (U(t, e, "access private method"), a);
8
+ import { parseUserId as Z, codeSchema as Re, connectionSchema as Ue, loginSessionSchema as Be, promptSettingSchema as Qe, formSchema as K } from "@authhero/adapter-interfaces";
9
9
  import "@hono/zod-openapi";
10
10
  var V = class extends Error {
11
11
  constructor(e = 500, a) {
@@ -23,7 +23,7 @@ var V = class extends Error {
23
23
  });
24
24
  }
25
25
  };
26
- function Qe(t) {
26
+ function qe(t) {
27
27
  return async (e, a) => {
28
28
  const { identities: n, ...o } = a, r = {
29
29
  ...o,
@@ -75,7 +75,7 @@ function pe(t) {
75
75
  }
76
76
  };
77
77
  }
78
- function qe(t) {
78
+ function Ve(t) {
79
79
  return async (e, a) => {
80
80
  const [n, o] = await Promise.all([
81
81
  t.selectFrom("users").where("users.tenant_id", "=", e).where("users.user_id", "=", a).selectAll().executeTakeFirst(),
@@ -83,7 +83,7 @@ function qe(t) {
83
83
  ]);
84
84
  if (!n)
85
85
  return null;
86
- const { tenant_id: r, ...s } = n, c = {
86
+ const { tenant_id: r, ...s } = n, d = {
87
87
  ...s,
88
88
  email: n.email || "",
89
89
  email_verified: n.email_verified === 1,
@@ -100,19 +100,19 @@ function qe(t) {
100
100
  ...o.map(pe)
101
101
  ]
102
102
  };
103
- return f(c);
103
+ return f(d);
104
104
  };
105
105
  }
106
106
  function T(t, e, a, n) {
107
107
  return a.split(/\s+/).map((r) => r.replace(/^([^:]+)=/g, "$1:")).map((r) => {
108
- let s = r.startsWith("-"), c, l, h, m;
109
- return r.startsWith("-_exists_:") ? (c = r.substring(10), h = !0, s = !0) : r.startsWith("_exists_:") ? (c = r.substring(9), h = !0, s = !1) : r.includes(":") ? (s = r.startsWith("-"), [c, l] = s ? r.substring(1).split(":") : r.split(":"), h = !1, l.startsWith(">=") ? (m = ">=", l = l.substring(2)) : l.startsWith(">") ? (m = ">", l = l.substring(1)) : l.startsWith("<=") ? (m = "<=", l = l.substring(2)) : l.startsWith("<") ? (m = "<", l = l.substring(1)) : m = "=") : (c = null, l = r, h = !1), { key: c, value: l, isNegation: s, isExistsQuery: h, operator: m };
110
- }).forEach(({ key: r, value: s, isNegation: c, isExistsQuery: l, operator: h }) => {
108
+ let s = r.startsWith("-"), d, l, _, m;
109
+ return r.startsWith("-_exists_:") ? (d = r.substring(10), _ = !0, s = !0) : r.startsWith("_exists_:") ? (d = r.substring(9), _ = !0, s = !1) : r.includes(":") ? (s = r.startsWith("-"), [d, l] = s ? r.substring(1).split(":") : r.split(":"), _ = !1, l.startsWith(">=") ? (m = ">=", l = l.substring(2)) : l.startsWith(">") ? (m = ">", l = l.substring(1)) : l.startsWith("<=") ? (m = "<=", l = l.substring(2)) : l.startsWith("<") ? (m = "<", l = l.substring(1)) : m = "=") : (d = null, l = r, _ = !1), { key: d, value: l, isNegation: s, isExistsQuery: _, operator: m };
110
+ }).forEach(({ key: r, value: s, isNegation: d, isExistsQuery: l, operator: _ }) => {
111
111
  if (r)
112
112
  if (l)
113
- c ? e = e.where(r, "is", null) : e = e.where(r, "is not", null);
114
- else if (c)
115
- switch (h) {
113
+ d ? e = e.where(r, "is", null) : e = e.where(r, "is not", null);
114
+ else if (d)
115
+ switch (_) {
116
116
  case ">":
117
117
  e = e.where(r, "<=", s);
118
118
  break;
@@ -129,7 +129,7 @@ function T(t, e, a, n) {
129
129
  e = e.where(r, "!=", s);
130
130
  }
131
131
  else
132
- e = e.where(r, h, s);
132
+ e = e.where(r, _, s);
133
133
  else {
134
134
  const { ref: m } = t.dynamic;
135
135
  e = e.where(
@@ -143,7 +143,7 @@ function T(t, e, a, n) {
143
143
  function b(t) {
144
144
  return typeof t == "string" ? parseInt(t, 10) : typeof t == "bigint" ? Number(t) : t;
145
145
  }
146
- function Ve(t) {
146
+ function We(t) {
147
147
  return async (e, a = {
148
148
  page: 0,
149
149
  per_page: 50,
@@ -154,8 +154,8 @@ function Ve(t) {
154
154
  const { ref: m } = t.dynamic;
155
155
  n = n.orderBy(m(a.sort.sort_by), a.sort.sort_order);
156
156
  }
157
- const r = await n.offset(a.page * a.per_page).limit(a.per_page).selectAll().execute(), s = r.map((m) => m.user_id), c = s.length ? await t.selectFrom("users").selectAll().where("users.tenant_id", "=", e).where("users.linked_to", "in", s).execute() : [], l = r.map((m) => {
158
- const w = c.filter(
157
+ const r = await n.offset(a.page * a.per_page).limit(a.per_page).selectAll().execute(), s = r.map((m) => m.user_id), d = s.length ? await t.selectFrom("users").selectAll().where("users.tenant_id", "=", e).where("users.linked_to", "in", s).execute() : [], l = r.map((m) => {
158
+ const w = d.filter(
159
159
  (x) => x.linked_to === m.user_id
160
160
  );
161
161
  return f({
@@ -174,16 +174,16 @@ function Ve(t) {
174
174
  ...w.map(pe)
175
175
  ]
176
176
  });
177
- }), { count: h } = await n.select((m) => m.fn.countAll().as("count")).executeTakeFirstOrThrow();
177
+ }), { count: _ } = await n.select((m) => m.fn.countAll().as("count")).executeTakeFirstOrThrow();
178
178
  return {
179
179
  users: l,
180
180
  start: a.page * a.per_page,
181
181
  limit: a.per_page,
182
- length: b(h)
182
+ length: b(_)
183
183
  };
184
184
  };
185
185
  }
186
- function We(t) {
186
+ function Ge(t) {
187
187
  return async (e, a) => (await t.deleteFrom("users").where("users.tenant_id", "=", e).where("users.linked_to", "=", a).execute(), (await t.deleteFrom("users").where("users.tenant_id", "=", e).where("users.user_id", "=", a).execute()).length === 1);
188
188
  }
189
189
  function P(t, e = "", a = {}) {
@@ -194,7 +194,7 @@ function P(t, e = "", a = {}) {
194
194
  }
195
195
  return a;
196
196
  }
197
- function Ge(t, e) {
197
+ function ge(t, e) {
198
198
  const a = {};
199
199
  for (const [n, o] of Object.entries(t)) {
200
200
  const r = e.find(
@@ -231,10 +231,10 @@ function Xe(t) {
231
231
  }
232
232
  function Ye(t) {
233
233
  return {
234
- create: Qe(t),
235
- remove: We(t),
236
- get: qe(t),
237
- list: Ve(t),
234
+ create: qe(t),
235
+ remove: Ge(t),
236
+ get: Ve(t),
237
+ list: We(t),
238
238
  update: He(t),
239
239
  // TODO - think about this more when other issues fixed
240
240
  unlink: Xe(t)
@@ -272,16 +272,16 @@ function at(t) {
272
272
  }) => {
273
273
  let a = t.selectFrom("tenants");
274
274
  if (e.sort && e.sort.sort_by) {
275
- const { ref: c } = t.dynamic;
276
- a = a.orderBy(c(e.sort.sort_by), e.sort.sort_order);
275
+ const { ref: d } = t.dynamic;
276
+ a = a.orderBy(d(e.sort.sort_by), e.sort.sort_order);
277
277
  }
278
- e.q && (a = a.where((c) => c.or([c("name", "like", `%${e.q}%`)])));
278
+ e.q && (a = a.where((d) => d.or([d("name", "like", `%${e.q}%`)])));
279
279
  const o = await a.offset(e.page * e.per_page).limit(e.per_page).selectAll().execute();
280
280
  if (!e.include_totals)
281
281
  return {
282
282
  tenants: o
283
283
  };
284
- const { count: r } = await a.select((c) => c.fn.countAll().as("count")).executeTakeFirstOrThrow(), s = b(r);
284
+ const { count: r } = await a.select((d) => d.fn.countAll().as("count")).executeTakeFirstOrThrow(), s = b(r);
285
285
  return {
286
286
  tenants: o.map(f),
287
287
  start: (e.page - 1) * e.per_page,
@@ -336,7 +336,7 @@ function it(t) {
336
336
  }).execute(), n;
337
337
  };
338
338
  }
339
- function he(t) {
339
+ function _e(t) {
340
340
  if (!t)
341
341
  return "";
342
342
  try {
@@ -345,13 +345,13 @@ function he(t) {
345
345
  return t;
346
346
  }
347
347
  }
348
- function ge(t) {
348
+ function ye(t) {
349
349
  return {
350
350
  ...t,
351
351
  client_id: t.client_id,
352
352
  client_name: "",
353
- auth0_client: he(t.auth0_client),
354
- details: he(t.details),
353
+ auth0_client: _e(t.auth0_client),
354
+ details: _e(t.details),
355
355
  isMobile: !!t.isMobile,
356
356
  scope: t.scope ? t.scope.split(",") : void 0,
357
357
  log_id: t.id,
@@ -368,33 +368,33 @@ function lt(t) {
368
368
  a.q && (n = T(t, n, a.q, ["user_id", "ip"]));
369
369
  let o = n;
370
370
  if (a.sort && a.sort.sort_by) {
371
- const { ref: c } = t.dynamic;
371
+ const { ref: d } = t.dynamic;
372
372
  o = o.orderBy(
373
- c(a.sort.sort_by),
373
+ d(a.sort.sort_by),
374
374
  a.sort.sort_order
375
375
  );
376
376
  }
377
377
  o = o.offset(a.page * a.per_page).limit(a.per_page);
378
- const r = await o.selectAll().execute(), { count: s } = await n.select((c) => c.fn.countAll().as("count")).executeTakeFirstOrThrow();
378
+ const r = await o.selectAll().execute(), { count: s } = await n.select((d) => d.fn.countAll().as("count")).executeTakeFirstOrThrow();
379
379
  return {
380
- logs: r.map(ge),
380
+ logs: r.map(ye),
381
381
  start: a.page * a.per_page,
382
382
  limit: a.per_page,
383
383
  length: b(s)
384
384
  };
385
385
  };
386
386
  }
387
- function ct(t) {
387
+ function dt(t) {
388
388
  return async (e, a) => {
389
389
  const n = await t.selectFrom("logs").where("logs.tenant_id", "=", e).where("logs.id", "=", a).selectAll().executeTakeFirst();
390
- return n ? ge(n) : null;
390
+ return n ? ye(n) : null;
391
391
  };
392
392
  }
393
- function dt(t) {
393
+ function ct(t) {
394
394
  return {
395
395
  create: it(t),
396
396
  list: lt(t),
397
- get: ct(t)
397
+ get: dt(t)
398
398
  };
399
399
  }
400
400
  function ut(t) {
@@ -402,9 +402,9 @@ function ut(t) {
402
402
  const n = await t.selectFrom("sessions").where("sessions.tenant_id", "=", e).where("sessions.id", "=", a).selectAll().executeTakeFirst();
403
403
  if (!n)
404
404
  return null;
405
- const { tenant_id: o, device: r, clients: s, ...c } = n;
405
+ const { tenant_id: o, device: r, clients: s, ...d } = n;
406
406
  return {
407
- ...c,
407
+ ...d,
408
408
  device: JSON.parse(r),
409
409
  clients: JSON.parse(s)
410
410
  };
@@ -427,10 +427,10 @@ function mt(t) {
427
427
  }).execute(), n;
428
428
  };
429
429
  }
430
- function ht(t) {
430
+ function _t(t) {
431
431
  return async (e, a) => !!(await t.deleteFrom("sessions").where("tenant_id", "=", e).where("sessions.id", "=", a).execute()).length;
432
432
  }
433
- function _t(t) {
433
+ function ht(t) {
434
434
  return async (e, a, n) => {
435
435
  const o = {
436
436
  ...n,
@@ -458,7 +458,7 @@ function ft(t) {
458
458
  );
459
459
  }
460
460
  o = o.offset(a.page * a.per_page).limit(a.per_page);
461
- const r = await o.selectAll().execute(), { count: s } = await n.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow(), c = b(s);
461
+ const r = await o.selectAll().execute(), { count: s } = await n.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow(), d = b(s);
462
462
  return {
463
463
  sessions: r.map((l) => ({
464
464
  ...l,
@@ -467,7 +467,7 @@ function ft(t) {
467
467
  })),
468
468
  start: a.page * a.per_page,
469
469
  limit: a.per_page,
470
- length: c
470
+ length: d
471
471
  };
472
472
  };
473
473
  }
@@ -476,8 +476,8 @@ function pt(t) {
476
476
  create: mt(t),
477
477
  get: ut(t),
478
478
  list: ft(t),
479
- remove: ht(t),
480
- update: _t(t)
479
+ remove: _t(t),
480
+ update: ht(t)
481
481
  };
482
482
  }
483
483
  function gt(t) {
@@ -526,8 +526,8 @@ function Nt(t) {
526
526
  const r = await n.offset(a.page * a.per_page).limit(a.per_page).selectAll().execute(), { count: s } = await n.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow();
527
527
  return {
528
528
  codes: r.map((l) => {
529
- const { tenant_id: h, ...m } = l;
530
- return Ke.parse(f(m));
529
+ const { tenant_id: _, ...m } = l;
530
+ return Re.parse(f(m));
531
531
  }),
532
532
  start: a.page * a.per_page,
533
533
  limit: a.per_page,
@@ -576,7 +576,7 @@ function Ot(t) {
576
576
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
577
577
  updated_at: (/* @__PURE__ */ new Date()).toISOString(),
578
578
  ...a
579
- }, o = JSON.stringify(a.allowed_origins), r = JSON.stringify(a.callbacks), s = JSON.stringify(a.web_origins), c = JSON.stringify(a.allowed_logout_urls), l = JSON.stringify(a.allowed_clients);
579
+ }, o = JSON.stringify(a.allowed_origins), r = JSON.stringify(a.callbacks), s = JSON.stringify(a.web_origins), d = JSON.stringify(a.allowed_logout_urls), l = JSON.stringify(a.allowed_clients);
580
580
  return await t.insertInto("applications").values({
581
581
  ...n,
582
582
  tenant_id: e,
@@ -585,7 +585,7 @@ function Ot(t) {
585
585
  callbacks: r,
586
586
  allowed_origins: o,
587
587
  web_origins: s,
588
- allowed_logout_urls: c,
588
+ allowed_logout_urls: d,
589
589
  allowed_clients: l
590
590
  }).execute(), n;
591
591
  };
@@ -675,12 +675,12 @@ function Mt(t) {
675
675
  ...l,
676
676
  options: JSON.parse(l.options)
677
677
  })
678
- ), { count: c } = await n.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow();
678
+ ), { count: d } = await n.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow();
679
679
  return {
680
680
  connections: s,
681
681
  start: a.page * a.per_page,
682
682
  limit: a.per_page,
683
- length: b(c)
683
+ length: b(d)
684
684
  };
685
685
  };
686
686
  }
@@ -696,7 +696,7 @@ function At(t) {
696
696
  }) : null;
697
697
  };
698
698
  }
699
- function Lt(t) {
699
+ function zt(t) {
700
700
  return async (e, a, n) => {
701
701
  const o = {
702
702
  ...n,
@@ -708,13 +708,13 @@ function Lt(t) {
708
708
  }).where("connections.id", "=", a).where("connections.tenant_id", "=", e).execute(), !0;
709
709
  };
710
710
  }
711
- function zt(t) {
711
+ function Lt(t) {
712
712
  return {
713
713
  create: Pt(t),
714
714
  get: At(t),
715
715
  list: Mt(t),
716
716
  remove: Ft(t),
717
- update: Lt(t)
717
+ update: zt(t)
718
718
  };
719
719
  }
720
720
  function Jt(t) {
@@ -730,7 +730,7 @@ function Jt(t) {
730
730
  return {
731
731
  ...a,
732
732
  connections: o.map(
733
- (s) => Re.parse(
733
+ (s) => Ue.parse(
734
734
  f({
735
735
  ...s,
736
736
  options: s.options ? JSON.parse(s.options) : {}
@@ -847,9 +847,9 @@ function Xt(t) {
847
847
  colors_primary: o,
848
848
  colors_page_background_type: r,
849
849
  colors_page_background_start: s,
850
- colors_page_background_end: c,
850
+ colors_page_background_end: d,
851
851
  colors_page_background_angle_dev: l,
852
- font_url: h,
852
+ font_url: _,
853
853
  ...m
854
854
  } = a;
855
855
  return f({
@@ -859,24 +859,24 @@ function Xt(t) {
859
859
  page_background: {
860
860
  type: r,
861
861
  start: s,
862
- end: c,
862
+ end: d,
863
863
  angle_deg: l
864
864
  }
865
865
  },
866
- font: h ? { url: h } : void 0
866
+ font: _ ? { url: _ } : void 0
867
867
  });
868
868
  };
869
869
  }
870
870
  function Yt(t) {
871
871
  return async (e, a) => {
872
- var s, c, l, h, m, w, x, ee, te, ae, ne, re, oe, se, ie, le, ce, de;
872
+ var s, d, l, _, m, w, x, ee, te, ae, ne, re, oe, se, ie, le, de, ce;
873
873
  const { colors: n, font: o, ...r } = a;
874
874
  try {
875
875
  await t.insertInto("branding").values({
876
876
  ...r,
877
877
  colors_primary: n == null ? void 0 : n.primary,
878
- colors_page_background_type: (c = (s = a.colors) == null ? void 0 : s.page_background) == null ? void 0 : c.type,
879
- colors_page_background_start: (h = (l = a.colors) == null ? void 0 : l.page_background) == null ? void 0 : h.start,
878
+ colors_page_background_type: (d = (s = a.colors) == null ? void 0 : s.page_background) == null ? void 0 : d.type,
879
+ colors_page_background_start: (_ = (l = a.colors) == null ? void 0 : l.page_background) == null ? void 0 : _.start,
880
880
  colors_page_background_end: (w = (m = a.colors) == null ? void 0 : m.page_background) == null ? void 0 : w.end,
881
881
  colors_page_background_angle_dev: (ee = (x = a.colors) == null ? void 0 : x.page_background) == null ? void 0 : ee.angle_deg,
882
882
  font_url: (te = a.font) == null ? void 0 : te.url,
@@ -889,8 +889,8 @@ function Yt(t) {
889
889
  colors_page_background_type: (ne = (ae = a.colors) == null ? void 0 : ae.page_background) == null ? void 0 : ne.type,
890
890
  colors_page_background_start: (oe = (re = a.colors) == null ? void 0 : re.page_background) == null ? void 0 : oe.start,
891
891
  colors_page_background_end: (ie = (se = a.colors) == null ? void 0 : se.page_background) == null ? void 0 : ie.end,
892
- colors_page_background_angle_dev: (ce = (le = a.colors) == null ? void 0 : le.page_background) == null ? void 0 : ce.angle_deg,
893
- font_url: (de = a.font) == null ? void 0 : de.url
892
+ colors_page_background_angle_dev: (de = (le = a.colors) == null ? void 0 : le.page_background) == null ? void 0 : de.angle_deg,
893
+ font_url: (ce = a.font) == null ? void 0 : ce.url
894
894
  }).where("tenant_id", "=", e).execute();
895
895
  }
896
896
  };
@@ -912,7 +912,7 @@ function ea(t) {
912
912
  const r = await n.offset(a.page * a.per_page).limit(a.per_page).selectAll().execute(), { count: s } = await n.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow();
913
913
  return {
914
914
  hooks: r.map((l) => {
915
- const { tenant_id: h, enabled: m, synchronous: w, ...x } = l;
915
+ const { tenant_id: _, enabled: m, synchronous: w, ...x } = l;
916
916
  return f({
917
917
  ...x,
918
918
  enabled: !!m,
@@ -978,44 +978,55 @@ function sa(t) {
978
978
  return async (e, a) => {
979
979
  const n = {
980
980
  themeId: S(),
981
- ...a,
982
981
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
983
- updated_at: (/* @__PURE__ */ new Date()).toISOString()
982
+ updated_at: (/* @__PURE__ */ new Date()).toISOString(),
983
+ ...a
984
+ }, o = {
985
+ ...n,
986
+ tenant_id: e
984
987
  };
985
- return await t.insertInto("themes").values({ ...P(n), tenant_id: e }).execute(), n;
988
+ return await t.insertInto("themes").values(P(o)).execute(), n;
986
989
  };
987
990
  }
988
991
  function ia(t) {
989
- return async (e, a) => (await t.deleteFrom("themes").where("themes.tenant_id", "=", e).where("themes.theme_id", "=", a).executeTakeFirst()).numDeletedRows > 0;
992
+ return async (e, a) => (await t.deleteFrom("themes").where("themes.tenant_id", "=", e).where("themes.themeId", "=", a).executeTakeFirst()).numDeletedRows > 0;
990
993
  }
991
994
  function la(t) {
992
995
  return async (e, a) => {
993
- const n = await t.selectFrom("themes").where("themes.tenant_id", "=", e).where("themes.theme_id", "=", a).selectAll().executeTakeFirst();
994
- return n ? f(n) : null;
996
+ const n = await t.selectFrom("themes").where("themes.tenant_id", "=", e).where("themes.themeId", "=", a).selectAll().executeTakeFirst();
997
+ return n ? f(
998
+ ge(n, [
999
+ "widget",
1000
+ "colors",
1001
+ "borders",
1002
+ "fonts",
1003
+ "page_background"
1004
+ ])
1005
+ ) : null;
995
1006
  };
996
1007
  }
997
- function ca(t) {
1008
+ function da(t) {
998
1009
  return async (e, a, n) => {
999
1010
  const o = P({
1000
1011
  ...n,
1001
1012
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
1002
1013
  });
1003
- return await t.updateTable("themes").set(o).where("themes.id", "=", a).where("themes.tenant_id", "=", e).execute(), !0;
1014
+ return await t.updateTable("themes").set(o).where("themes.themeId", "=", a).where("themes.tenant_id", "=", e).execute(), !0;
1004
1015
  };
1005
1016
  }
1006
- function da(t) {
1017
+ function ca(t) {
1007
1018
  return {
1008
1019
  create: sa(t),
1009
1020
  get: la(t),
1010
1021
  remove: ia(t),
1011
- update: ca(t)
1022
+ update: da(t)
1012
1023
  };
1013
1024
  }
1014
1025
  function ua(t) {
1015
1026
  return async (e, a) => {
1016
1027
  const n = await t.selectFrom("login_sessions").where("login_sessions.id", "=", a).selectAll().executeTakeFirst();
1017
- return n ? Ue.parse(
1018
- Ge(
1028
+ return n ? Be.parse(
1029
+ ge(
1019
1030
  f({
1020
1031
  ...n,
1021
1032
  login_completed: !!n.login_completed
@@ -1042,22 +1053,22 @@ function ma(t) {
1042
1053
  }).execute(), n;
1043
1054
  };
1044
1055
  }
1045
- function ha(t) {
1056
+ function _a(t) {
1046
1057
  return async (e, a, n) => (await t.updateTable("login_sessions").set(
1047
1058
  P({
1048
1059
  ...n
1049
1060
  })
1050
1061
  ).where("login_sessions.id", "=", a).where("login_sessions.tenant_id", "=", e).execute()).length === 1;
1051
1062
  }
1052
- function _a(t) {
1063
+ function ha(t) {
1053
1064
  return async (e, a) => (await t.deleteFrom("login_sessions").where("login_sessions.tenant_id", "=", e).where("login_sessions.id", "=", a).execute()).length > 0;
1054
1065
  }
1055
1066
  function fa(t) {
1056
1067
  return {
1057
1068
  create: ma(t),
1058
1069
  get: ua(t),
1059
- update: ha(t),
1060
- remove: _a(t)
1070
+ update: _a(t),
1071
+ remove: ha(t)
1061
1072
  };
1062
1073
  }
1063
1074
  function pa(t) {
@@ -1071,7 +1082,7 @@ function pa(t) {
1071
1082
  });
1072
1083
  };
1073
1084
  }
1074
- function _e(t) {
1085
+ function he(t) {
1075
1086
  return f({
1076
1087
  ...t,
1077
1088
  webauthn_platform_first_factor: t.webauthn_platform_first_factor ? !!t.webauthn_platform_first_factor : void 0,
@@ -1083,13 +1094,13 @@ function _e(t) {
1083
1094
  function ga(t) {
1084
1095
  return async (e, a) => {
1085
1096
  try {
1086
- const n = Be.parse(a);
1097
+ const n = Qe.parse(a);
1087
1098
  await t.insertInto("prompt_settings").values({
1088
- ..._e(n),
1099
+ ...he(n),
1089
1100
  tenant_id: e
1090
1101
  }).execute();
1091
1102
  } catch {
1092
- await t.updateTable("prompt_settings").set(_e(a)).where("tenant_id", "=", e).execute();
1103
+ await t.updateTable("prompt_settings").set(he(a)).where("tenant_id", "=", e).execute();
1093
1104
  }
1094
1105
  };
1095
1106
  }
@@ -1109,10 +1120,10 @@ function wa(t) {
1109
1120
  credentials: o,
1110
1121
  settings: r,
1111
1122
  enabled: s,
1112
- ...c
1123
+ ...d
1113
1124
  } = a;
1114
1125
  return f({
1115
- ...c,
1126
+ ...d,
1116
1127
  credentials: JSON.parse(o),
1117
1128
  settings: JSON.parse(r),
1118
1129
  enabled: !!s
@@ -1208,7 +1219,7 @@ function Oa(t) {
1208
1219
  );
1209
1220
  }
1210
1221
  o = o.offset(a.page * a.per_page).limit(a.per_page);
1211
- const r = await o.selectAll().execute(), { count: s } = await n.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow(), c = b(s);
1222
+ const r = await o.selectAll().execute(), { count: s } = await n.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow(), d = b(s);
1212
1223
  return {
1213
1224
  refresh_tokens: r.map((l) => ({
1214
1225
  ...l,
@@ -1218,7 +1229,7 @@ function Oa(t) {
1218
1229
  })),
1219
1230
  start: a.page * a.per_page,
1220
1231
  limit: a.per_page,
1221
- length: c
1232
+ length: d
1222
1233
  };
1223
1234
  };
1224
1235
  }
@@ -1288,29 +1299,29 @@ function Ia(t) {
1288
1299
  let n = t.selectFrom("forms").where("tenant_id", "=", e);
1289
1300
  a != null && a.q && (n = T(t, n, a.q, []));
1290
1301
  const s = (await n.offset(a.page * a.per_page).limit(a.per_page).selectAll().execute()).map((l) => {
1291
- const h = { ...l };
1292
- if (typeof h.nodes == "string")
1302
+ const _ = { ...l };
1303
+ if (typeof _.nodes == "string")
1293
1304
  try {
1294
- h.nodes = JSON.parse(h.nodes);
1305
+ _.nodes = JSON.parse(_.nodes);
1295
1306
  } catch {
1296
1307
  }
1297
- if (typeof h.start == "string")
1308
+ if (typeof _.start == "string")
1298
1309
  try {
1299
- h.start = JSON.parse(h.start);
1310
+ _.start = JSON.parse(_.start);
1300
1311
  } catch {
1301
1312
  }
1302
- if (typeof h.ending == "string")
1313
+ if (typeof _.ending == "string")
1303
1314
  try {
1304
- h.ending = JSON.parse(h.ending);
1315
+ _.ending = JSON.parse(_.ending);
1305
1316
  } catch {
1306
1317
  }
1307
- return K.parse(f(h));
1308
- }), { count: c } = await n.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow();
1318
+ return K.parse(f(_));
1319
+ }), { count: d } = await n.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow();
1309
1320
  return {
1310
1321
  forms: s,
1311
1322
  start: a.page * a.per_page,
1312
1323
  limit: a.per_page,
1313
- length: b(c)
1324
+ length: b(d)
1314
1325
  };
1315
1326
  };
1316
1327
  }
@@ -1396,7 +1407,7 @@ const E = g({
1396
1407
  identifier: E.create(e)
1397
1408
  });
1398
1409
  }
1399
- }), La = g({
1410
+ }), za = g({
1400
1411
  is(t) {
1401
1412
  return t.kind === "AliasNode";
1402
1413
  },
@@ -1425,7 +1436,7 @@ const E = g({
1425
1436
  }
1426
1437
  });
1427
1438
  var R;
1428
- class za {
1439
+ class La {
1429
1440
  constructor() {
1430
1441
  M(this, "nodeStack", []);
1431
1442
  y(this, R, g({
@@ -1532,7 +1543,7 @@ class za {
1532
1543
  return this.nodeStack.pop(), g(a);
1533
1544
  }
1534
1545
  transformNodeImpl(e) {
1535
- return d(this, R)[e.kind](e);
1546
+ return c(this, R)[e.kind](e);
1536
1547
  }
1537
1548
  transformNodeList(e) {
1538
1549
  return e && g(e.map((a) => this.transformNode(a)));
@@ -2278,8 +2289,8 @@ const Ja = g({
2278
2289
  UpdateQueryNode: !0,
2279
2290
  MergeQueryNode: !0
2280
2291
  });
2281
- var j, O, k, p, ye, we, ve, $, G, Ne;
2282
- class Ea extends za {
2292
+ var j, O, k, p, we, ve, Ne, $, G, Ce;
2293
+ class Ea extends La {
2283
2294
  constructor(a) {
2284
2295
  super();
2285
2296
  y(this, p);
@@ -2289,39 +2300,39 @@ class Ea extends za {
2289
2300
  F(this, j, a);
2290
2301
  }
2291
2302
  transformNodeImpl(a) {
2292
- if (!u(this, p, ye).call(this, a))
2303
+ if (!u(this, p, we).call(this, a))
2293
2304
  return super.transformNodeImpl(a);
2294
- const n = u(this, p, ve).call(this, a);
2305
+ const n = u(this, p, Ne).call(this, a);
2295
2306
  for (const s of n)
2296
- d(this, k).add(s);
2297
- const o = u(this, p, we).call(this, a);
2307
+ c(this, k).add(s);
2308
+ const o = u(this, p, ve).call(this, a);
2298
2309
  for (const s of o)
2299
- d(this, O).add(s);
2310
+ c(this, O).add(s);
2300
2311
  const r = super.transformNodeImpl(a);
2301
2312
  for (const s of o)
2302
- d(this, O).delete(s);
2313
+ c(this, O).delete(s);
2303
2314
  for (const s of n)
2304
- d(this, k).delete(s);
2315
+ c(this, k).delete(s);
2305
2316
  return r;
2306
2317
  }
2307
2318
  transformSchemableIdentifier(a) {
2308
2319
  const n = super.transformSchemableIdentifier(a);
2309
- return n.schema || !d(this, O).has(a.identifier.name) ? n : {
2320
+ return n.schema || !c(this, O).has(a.identifier.name) ? n : {
2310
2321
  ...n,
2311
- schema: E.create(d(this, j))
2322
+ schema: E.create(c(this, j))
2312
2323
  };
2313
2324
  }
2314
2325
  transformReferences(a) {
2315
2326
  const n = super.transformReferences(a);
2316
2327
  return n.table.table.schema ? n : {
2317
2328
  ...n,
2318
- table: B.createWithSchema(d(this, j), n.table.table.identifier.name)
2329
+ table: B.createWithSchema(c(this, j), n.table.table.identifier.name)
2319
2330
  };
2320
2331
  }
2321
2332
  }
2322
- j = new WeakMap(), O = new WeakMap(), k = new WeakMap(), p = new WeakSet(), ye = function(a) {
2333
+ j = new WeakMap(), O = new WeakMap(), k = new WeakMap(), p = new WeakSet(), we = function(a) {
2323
2334
  return a.kind in Ja;
2324
- }, we = function(a) {
2335
+ }, ve = function(a) {
2325
2336
  const n = /* @__PURE__ */ new Set();
2326
2337
  if ("name" in a && a.name && W.is(a.name) && u(this, p, G).call(this, a.name, n), "from" in a && a.from)
2327
2338
  for (const o of a.from.froms)
@@ -2330,35 +2341,35 @@ j = new WeakMap(), O = new WeakMap(), k = new WeakMap(), p = new WeakSet(), ye =
2330
2341
  for (const o of a.joins)
2331
2342
  u(this, p, $).call(this, o.table, n);
2332
2343
  return "using" in a && a.using && u(this, p, $).call(this, a.using, n), n;
2333
- }, ve = function(a) {
2344
+ }, Ne = function(a) {
2334
2345
  const n = /* @__PURE__ */ new Set();
2335
- return "with" in a && a.with && u(this, p, Ne).call(this, a.with, n), n;
2346
+ return "with" in a && a.with && u(this, p, Ce).call(this, a.with, n), n;
2336
2347
  }, $ = function(a, n) {
2337
- const o = B.is(a) ? a : La.is(a) && B.is(a.node) ? a.node : null;
2348
+ const o = B.is(a) ? a : za.is(a) && B.is(a.node) ? a.node : null;
2338
2349
  o && u(this, p, G).call(this, o.table, n);
2339
2350
  }, G = function(a, n) {
2340
2351
  const o = a.identifier.name;
2341
- !d(this, O).has(o) && !d(this, k).has(o) && n.add(o);
2342
- }, Ne = function(a, n) {
2352
+ !c(this, O).has(o) && !c(this, k).has(o) && n.add(o);
2353
+ }, Ce = function(a, n) {
2343
2354
  for (const o of a.expressions) {
2344
2355
  const r = o.name.table.table.identifier.name;
2345
- d(this, k).has(r) || n.add(r);
2356
+ c(this, k).has(r) || n.add(r);
2346
2357
  }
2347
2358
  };
2348
- var z;
2359
+ var L;
2349
2360
  class Ka {
2350
2361
  constructor(e) {
2351
- y(this, z);
2352
- F(this, z, new Ea(e));
2362
+ y(this, L);
2363
+ F(this, L, new Ea(e));
2353
2364
  }
2354
2365
  transformQuery(e) {
2355
- return d(this, z).transformNode(e.node);
2366
+ return c(this, L).transformNode(e.node);
2356
2367
  }
2357
2368
  async transformResult(e) {
2358
2369
  return e.result;
2359
2370
  }
2360
2371
  }
2361
- z = new WeakMap();
2372
+ L = new WeakMap();
2362
2373
  class Ra {
2363
2374
  transformQuery(e) {
2364
2375
  return e.node;
@@ -2368,12 +2379,12 @@ class Ra {
2368
2379
  }
2369
2380
  }
2370
2381
  const Ua = "kysely_migration", fe = "kysely_migration_lock", Ba = !1, Q = "migration_lock", Qa = g({ __noMigrations__: !0 });
2371
- var _, i, A, v, N, D, be, C, xe, Te, Se, Oe, ke, H, I, X, $e, De, Ie, Y, je, Pe, Me, Fe, Ae, L;
2372
- class Ce {
2382
+ var h, i, A, v, N, D, xe, C, Te, Se, Oe, ke, $e, H, I, X, De, Ie, je, Y, Pe, Me, Fe, Ae, ze, z;
2383
+ class be {
2373
2384
  constructor(e) {
2374
2385
  y(this, i);
2375
- y(this, _);
2376
- F(this, _, g(e));
2386
+ y(this, h);
2387
+ F(this, h, g(e));
2377
2388
  }
2378
2389
  /**
2379
2390
  * Returns a {@link MigrationInfo} object for each migration.
@@ -2381,7 +2392,7 @@ class Ce {
2381
2392
  * The returned array is sorted by migration name.
2382
2393
  */
2383
2394
  async getMigrations() {
2384
- const e = await u(this, i, I).call(this, d(this, i, N)) ? await d(this, _).db.withPlugin(d(this, i, C)).selectFrom(d(this, i, N)).select(["name", "timestamp"]).execute() : [];
2395
+ 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() : [];
2385
2396
  return (await u(this, i, Y).call(this)).map(({ name: n, ...o }) => {
2386
2397
  const r = e.find((s) => s.name === n);
2387
2398
  return {
@@ -2468,9 +2479,9 @@ class Ce {
2468
2479
  return u(this, i, A).call(this, ({ migrations: a, executedMigrations: n, pendingMigrations: o }) => {
2469
2480
  if (e === Qa)
2470
2481
  return { direction: "Down", step: 1 / 0 };
2471
- if (!a.find((c) => c.name === e))
2482
+ if (!a.find((d) => d.name === e))
2472
2483
  throw new Error(`migration "${e}" doesn't exist`);
2473
- const r = n.indexOf(e), s = o.findIndex((c) => c.name === e);
2484
+ const r = n.indexOf(e), s = o.findIndex((d) => d.name === e);
2474
2485
  if (r !== -1)
2475
2486
  return {
2476
2487
  direction: "Down",
@@ -2516,128 +2527,128 @@ class Ce {
2516
2527
  return u(this, i, A).call(this, () => ({ direction: "Down", step: 1 }));
2517
2528
  }
2518
2529
  }
2519
- _ = new WeakMap(), i = new WeakSet(), A = async function(e) {
2530
+ h = new WeakMap(), i = new WeakSet(), A = async function(e) {
2520
2531
  try {
2521
- return await u(this, i, xe).call(this), await u(this, i, $e).call(this, e);
2532
+ return await u(this, i, Te).call(this), await u(this, i, De).call(this, e);
2522
2533
  } catch (a) {
2523
2534
  return a instanceof q ? a.resultSet : { error: a };
2524
2535
  }
2525
2536
  }, v = function() {
2526
- return d(this, _).migrationTableSchema;
2537
+ return c(this, h).migrationTableSchema;
2527
2538
  }, N = function() {
2528
- return d(this, _).migrationTableName ?? Ua;
2539
+ return c(this, h).migrationTableName ?? Ua;
2529
2540
  }, D = function() {
2530
- return d(this, _).migrationLockTableName ?? fe;
2531
- }, be = function() {
2532
- return d(this, _).allowUnorderedMigrations ?? Ba;
2541
+ return c(this, h).migrationLockTableName ?? fe;
2542
+ }, xe = function() {
2543
+ return c(this, h).allowUnorderedMigrations ?? Ba;
2533
2544
  }, C = function() {
2534
- return d(this, i, v) ? new Ka(d(this, i, v)) : new Ra();
2535
- }, xe = async function() {
2536
- await u(this, i, Te).call(this), await u(this, i, Se).call(this), await u(this, i, Oe).call(this), await u(this, i, ke).call(this);
2545
+ return c(this, i, v) ? new Ka(c(this, i, v)) : new Ra();
2537
2546
  }, Te = async function() {
2538
- if (d(this, i, v) && !await u(this, i, H).call(this))
2547
+ await u(this, i, Se).call(this), await u(this, i, Oe).call(this), await u(this, i, ke).call(this), await u(this, i, $e).call(this);
2548
+ }, Se = async function() {
2549
+ if (c(this, i, v) && !await u(this, i, H).call(this))
2539
2550
  try {
2540
- await u(this, i, L).call(this, d(this, _).db.schema.createSchema(d(this, i, v)));
2551
+ await u(this, i, z).call(this, c(this, h).db.schema.createSchema(c(this, i, v)));
2541
2552
  } catch (e) {
2542
2553
  if (!await u(this, i, H).call(this))
2543
2554
  throw e;
2544
2555
  }
2545
- }, Se = async function() {
2546
- if (!await u(this, i, I).call(this, d(this, i, N)))
2556
+ }, Oe = async function() {
2557
+ if (!await u(this, i, I).call(this, c(this, i, N)))
2547
2558
  try {
2548
- d(this, i, v) && await u(this, i, L).call(this, d(this, _).db.schema.createSchema(d(this, i, v))), await u(this, i, L).call(this, d(this, _).db.schema.withPlugin(d(this, i, C)).createTable(d(this, i, N)).addColumn("name", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("timestamp", "varchar(255)", (e) => e.notNull()));
2559
+ c(this, i, v) && await u(this, i, z).call(this, c(this, h).db.schema.createSchema(c(this, i, v))), await u(this, i, z).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()));
2549
2560
  } catch (e) {
2550
- if (!await u(this, i, I).call(this, d(this, i, N)))
2561
+ if (!await u(this, i, I).call(this, c(this, i, N)))
2551
2562
  throw e;
2552
2563
  }
2553
- }, Oe = async function() {
2554
- if (!await u(this, i, I).call(this, d(this, i, D)))
2564
+ }, ke = async function() {
2565
+ if (!await u(this, i, I).call(this, c(this, i, D)))
2555
2566
  try {
2556
- await u(this, i, L).call(this, d(this, _).db.schema.withPlugin(d(this, i, C)).createTable(d(this, i, D)).addColumn("id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("is_locked", "integer", (e) => e.notNull().defaultTo(0)));
2567
+ await u(this, i, z).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)));
2557
2568
  } catch (e) {
2558
- if (!await u(this, i, I).call(this, d(this, i, D)))
2569
+ if (!await u(this, i, I).call(this, c(this, i, D)))
2559
2570
  throw e;
2560
2571
  }
2561
- }, ke = async function() {
2572
+ }, $e = async function() {
2562
2573
  if (!await u(this, i, X).call(this))
2563
2574
  try {
2564
- await d(this, _).db.withPlugin(d(this, i, C)).insertInto(d(this, i, D)).values({ id: Q, is_locked: 0 }).execute();
2575
+ await c(this, h).db.withPlugin(c(this, i, C)).insertInto(c(this, i, D)).values({ id: Q, is_locked: 0 }).execute();
2565
2576
  } catch (e) {
2566
2577
  if (!await u(this, i, X).call(this))
2567
2578
  throw e;
2568
2579
  }
2569
2580
  }, H = async function() {
2570
- return (await d(this, _).db.introspection.getSchemas()).some((a) => a.name === d(this, i, v));
2581
+ return (await c(this, h).db.introspection.getSchemas()).some((a) => a.name === c(this, i, v));
2571
2582
  }, I = async function(e) {
2572
- const a = d(this, i, v);
2573
- return (await d(this, _).db.introspection.getTables({
2583
+ const a = c(this, i, v);
2584
+ return (await c(this, h).db.introspection.getTables({
2574
2585
  withInternalKyselyTables: !0
2575
2586
  })).some((o) => o.name === e && (!a || o.schema === a));
2576
2587
  }, X = async function() {
2577
- return !!await d(this, _).db.withPlugin(d(this, i, C)).selectFrom(d(this, i, D)).where("id", "=", Q).select("id").executeTakeFirst();
2578
- }, $e = async function(e) {
2579
- const a = d(this, _).db.getExecutor().adapter, n = g({
2580
- lockTable: d(this, _).migrationLockTableName ?? fe,
2588
+ return !!await c(this, h).db.withPlugin(c(this, i, C)).selectFrom(c(this, i, D)).where("id", "=", Q).select("id").executeTakeFirst();
2589
+ }, De = async function(e) {
2590
+ const a = c(this, h).db.getExecutor().adapter, n = g({
2591
+ lockTable: c(this, h).migrationLockTableName ?? fe,
2581
2592
  lockRowId: Q,
2582
- lockTableSchema: d(this, _).migrationTableSchema
2593
+ lockTableSchema: c(this, h).migrationTableSchema
2583
2594
  }), o = async (r) => {
2584
2595
  try {
2585
2596
  await a.acquireMigrationLock(r, n);
2586
- const s = await u(this, i, De).call(this, r);
2597
+ const s = await u(this, i, Ie).call(this, r);
2587
2598
  if (s.migrations.length === 0)
2588
2599
  return { results: [] };
2589
- const { direction: c, step: l } = e(s);
2590
- return l <= 0 ? { results: [] } : c === "Down" ? await u(this, i, Fe).call(this, r, s, l) : c === "Up" ? await u(this, i, Ae).call(this, r, s, l) : { results: [] };
2600
+ const { direction: d, step: l } = e(s);
2601
+ return l <= 0 ? { results: [] } : d === "Down" ? await u(this, i, Ae).call(this, r, s, l) : d === "Up" ? await u(this, i, ze).call(this, r, s, l) : { results: [] };
2591
2602
  } finally {
2592
2603
  await a.releaseMigrationLock(r, n);
2593
2604
  }
2594
2605
  };
2595
- return a.supportsTransactionalDdl ? d(this, _).db.transaction().execute(o) : d(this, _).db.connection().execute(o);
2596
- }, De = async function(e) {
2597
- const a = await u(this, i, Y).call(this), n = await u(this, i, je).call(this, e);
2598
- u(this, i, Pe).call(this, a, n), d(this, i, be) || u(this, i, Me).call(this, a, n);
2599
- const o = u(this, i, Ie).call(this, a, n);
2606
+ return a.supportsTransactionalDdl ? c(this, h).db.transaction().execute(o) : c(this, h).db.connection().execute(o);
2607
+ }, Ie = async function(e) {
2608
+ const a = await u(this, i, Y).call(this), n = await u(this, i, Pe).call(this, e);
2609
+ u(this, i, Me).call(this, a, n), c(this, i, xe) || u(this, i, Fe).call(this, a, n);
2610
+ const o = u(this, i, je).call(this, a, n);
2600
2611
  return g({
2601
2612
  migrations: a,
2602
2613
  executedMigrations: n,
2603
2614
  lastMigration: Aa(n),
2604
2615
  pendingMigrations: o
2605
2616
  });
2606
- }, Ie = function(e, a) {
2617
+ }, je = function(e, a) {
2607
2618
  return e.filter((n) => !a.includes(n.name));
2608
2619
  }, Y = async function() {
2609
- const e = await d(this, _).provider.getMigrations();
2620
+ const e = await c(this, h).provider.getMigrations();
2610
2621
  return Object.keys(e).sort().map((a) => ({
2611
2622
  ...e[a],
2612
2623
  name: a
2613
2624
  }));
2614
- }, je = async function(e) {
2615
- return (await e.withPlugin(d(this, i, C)).selectFrom(d(this, i, N)).select("name").orderBy(["timestamp", "name"]).execute()).map((n) => n.name);
2616
- }, Pe = function(e, a) {
2625
+ }, Pe = async function(e) {
2626
+ return (await e.withPlugin(c(this, i, C)).selectFrom(c(this, i, N)).select("name").orderBy(["timestamp", "name"]).execute()).map((n) => n.name);
2627
+ }, Me = function(e, a) {
2617
2628
  for (const n of a)
2618
2629
  if (!e.some((o) => o.name === n))
2619
2630
  throw new Error(`corrupted migrations: previously executed migration ${n} is missing`);
2620
- }, Me = function(e, a) {
2631
+ }, Fe = function(e, a) {
2621
2632
  for (let n = 0; n < a.length; ++n)
2622
2633
  if (e[n].name !== a[n])
2623
2634
  throw new Error(`corrupted migrations: expected previously executed migration ${a[n]} to be at index ${n} but ${e[n].name} was found in its place. New migrations must always have a name that comes alphabetically after the last executed migration.`);
2624
- }, Fe = async function(e, a, n) {
2625
- const o = a.executedMigrations.slice().reverse().slice(0, n).map((s) => a.migrations.find((c) => c.name === s)), r = o.map((s) => ({
2635
+ }, Ae = async function(e, a, n) {
2636
+ const o = a.executedMigrations.slice().reverse().slice(0, n).map((s) => a.migrations.find((d) => d.name === s)), r = o.map((s) => ({
2626
2637
  migrationName: s.name,
2627
2638
  direction: "Down",
2628
2639
  status: "NotExecuted"
2629
2640
  }));
2630
2641
  for (let s = 0; s < r.length; ++s) {
2631
- const c = o[s];
2642
+ const d = o[s];
2632
2643
  try {
2633
- c.down && (await c.down(e), await e.withPlugin(d(this, i, C)).deleteFrom(d(this, i, N)).where("name", "=", c.name).execute(), r[s] = {
2634
- migrationName: c.name,
2644
+ d.down && (await d.down(e), await e.withPlugin(c(this, i, C)).deleteFrom(c(this, i, N)).where("name", "=", d.name).execute(), r[s] = {
2645
+ migrationName: d.name,
2635
2646
  direction: "Down",
2636
2647
  status: "Success"
2637
2648
  });
2638
2649
  } catch (l) {
2639
2650
  throw r[s] = {
2640
- migrationName: c.name,
2651
+ migrationName: d.name,
2641
2652
  direction: "Down",
2642
2653
  status: "Error"
2643
2654
  }, new q({
@@ -2647,26 +2658,26 @@ _ = new WeakMap(), i = new WeakSet(), A = async function(e) {
2647
2658
  }
2648
2659
  }
2649
2660
  return { results: r };
2650
- }, Ae = async function(e, a, n) {
2661
+ }, ze = async function(e, a, n) {
2651
2662
  const r = a.pendingMigrations.slice(0, n).map((s) => ({
2652
2663
  migrationName: s.name,
2653
2664
  direction: "Up",
2654
2665
  status: "NotExecuted"
2655
2666
  }));
2656
2667
  for (let s = 0; s < r.length; s++) {
2657
- const c = a.pendingMigrations[s];
2668
+ const d = a.pendingMigrations[s];
2658
2669
  try {
2659
- await c.up(e), await e.withPlugin(d(this, i, C)).insertInto(d(this, i, N)).values({
2660
- name: c.name,
2670
+ await d.up(e), await e.withPlugin(c(this, i, C)).insertInto(c(this, i, N)).values({
2671
+ name: d.name,
2661
2672
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
2662
2673
  }).execute(), r[s] = {
2663
- migrationName: c.name,
2674
+ migrationName: d.name,
2664
2675
  direction: "Up",
2665
2676
  status: "Success"
2666
2677
  };
2667
2678
  } catch (l) {
2668
2679
  throw r[s] = {
2669
- migrationName: c.name,
2680
+ migrationName: d.name,
2670
2681
  direction: "Up",
2671
2682
  status: "Error"
2672
2683
  }, new q({
@@ -2676,8 +2687,8 @@ _ = new WeakMap(), i = new WeakSet(), A = async function(e) {
2676
2687
  }
2677
2688
  }
2678
2689
  return { results: r };
2679
- }, L = async function(e) {
2680
- d(this, _).db.getExecutor().adapter.supportsCreateIfNotExists && (e = e.ifNotExists()), await e.execute();
2690
+ }, z = async function(e) {
2691
+ c(this, h).db.getExecutor().adapter.supportsCreateIfNotExists && (e = e.ifNotExists()), await e.execute();
2681
2692
  };
2682
2693
  var J;
2683
2694
  class q extends Error {
@@ -2687,7 +2698,7 @@ class q extends Error {
2687
2698
  F(this, J, a);
2688
2699
  }
2689
2700
  get resultSet() {
2690
- return d(this, J);
2701
+ return c(this, J);
2691
2702
  }
2692
2703
  }
2693
2704
  J = new WeakMap();
@@ -2851,12 +2862,12 @@ async function ln(t) {
2851
2862
  (e) => e.references("applications.id").onDelete("cascade").notNull()
2852
2863
  ).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();
2853
2864
  }
2854
- async function cn(t) {
2865
+ async function dn(t) {
2855
2866
  await t.schema.dropTable("sessions").execute(), await t.schema.dropTable("tickets").execute(), await t.schema.dropTable("otps").execute();
2856
2867
  }
2857
- const dn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2868
+ const cn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2858
2869
  __proto__: null,
2859
- down: cn,
2870
+ down: dn,
2860
2871
  up: ln
2861
2872
  }, Symbol.toStringTag, { value: "Module" }));
2862
2873
  async function un(t) {
@@ -2877,19 +2888,19 @@ async function un(t) {
2877
2888
  async function mn(t) {
2878
2889
  await t.schema.dropTable("passwords").execute(), await t.schema.dropTable("codes").execute();
2879
2890
  }
2880
- const hn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2891
+ const _n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2881
2892
  __proto__: null,
2882
2893
  down: mn,
2883
2894
  up: un
2884
2895
  }, Symbol.toStringTag, { value: "Module" }));
2885
- async function _n(t) {
2896
+ async function hn(t) {
2886
2897
  }
2887
2898
  async function fn(t) {
2888
2899
  }
2889
2900
  const pn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2890
2901
  __proto__: null,
2891
2902
  down: fn,
2892
- up: _n
2903
+ up: hn
2893
2904
  }, Symbol.toStringTag, { value: "Module" }));
2894
2905
  async function gn(t) {
2895
2906
  await t.schema.alterTable("passwords").addColumn(
@@ -2962,12 +2973,12 @@ async function Fn(t) {
2962
2973
  async function An(t) {
2963
2974
  await t.schema.dropIndex("users_linked_to_index");
2964
2975
  }
2965
- const Ln = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2976
+ const zn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2966
2977
  __proto__: null,
2967
2978
  down: An,
2968
2979
  up: Fn
2969
2980
  }, Symbol.toStringTag, { value: "Module" }));
2970
- async function zn(t) {
2981
+ async function Ln(t) {
2971
2982
  await t.schema.alterTable("users").addColumn("locale", "varchar(255)").execute();
2972
2983
  }
2973
2984
  async function Jn(t) {
@@ -2976,7 +2987,7 @@ async function Jn(t) {
2976
2987
  const En = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2977
2988
  __proto__: null,
2978
2989
  down: Jn,
2979
- up: zn
2990
+ up: Ln
2980
2991
  }, Symbol.toStringTag, { value: "Module" }));
2981
2992
  async function Kn(t) {
2982
2993
  await t.schema.createTable("keys").addColumn("kid", "varchar(255)", (e) => e.primaryKey()).addColumn(
@@ -3056,12 +3067,12 @@ const ir = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3056
3067
  async function lr(t) {
3057
3068
  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();
3058
3069
  }
3059
- async function cr(t) {
3070
+ async function dr(t) {
3060
3071
  await t.schema.dropIndex("logs_user_id"), await t.schema.dropIndex("logs_tenant_id"), await t.schema.dropIndex("logs_date");
3061
3072
  }
3062
- const dr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3073
+ const cr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3063
3074
  __proto__: null,
3064
- down: cr,
3075
+ down: dr,
3065
3076
  up: lr
3066
3077
  }, Symbol.toStringTag, { value: "Module" }));
3067
3078
  async function ur(t) {
@@ -3070,12 +3081,12 @@ async function ur(t) {
3070
3081
  async function mr(t) {
3071
3082
  await t.schema.alterTable("logs").dropColumn("details").execute(), await t.schema.alterTable("logs").addColumn("details", "varchar(2048)").execute();
3072
3083
  }
3073
- const hr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3084
+ const _r = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3074
3085
  __proto__: null,
3075
3086
  down: mr,
3076
3087
  up: ur
3077
3088
  }, Symbol.toStringTag, { value: "Module" }));
3078
- async function _r(t) {
3089
+ async function hr(t) {
3079
3090
  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();
3080
3091
  }
3081
3092
  async function fr(t) {
@@ -3084,7 +3095,7 @@ async function fr(t) {
3084
3095
  const pr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3085
3096
  __proto__: null,
3086
3097
  down: fr,
3087
- up: _r
3098
+ up: hr
3088
3099
  }, Symbol.toStringTag, { value: "Module" }));
3089
3100
  async function gr(t) {
3090
3101
  await t.schema.createIndex("users_name_index").on("users").column("name").execute();
@@ -3157,19 +3168,19 @@ async function Fr(t) {
3157
3168
  }
3158
3169
  async function Ar(t) {
3159
3170
  }
3160
- const Lr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3171
+ const zr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3161
3172
  __proto__: null,
3162
3173
  down: Ar,
3163
3174
  up: Fr
3164
3175
  }, Symbol.toStringTag, { value: "Module" }));
3165
- async function zr(t) {
3176
+ async function Lr(t) {
3166
3177
  }
3167
3178
  async function Jr(t) {
3168
3179
  }
3169
3180
  const Er = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3170
3181
  __proto__: null,
3171
3182
  down: Jr,
3172
- up: zr
3183
+ up: Lr
3173
3184
  }, Symbol.toStringTag, { value: "Module" }));
3174
3185
  async function Kr(t) {
3175
3186
  }
@@ -3269,11 +3280,11 @@ const uo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3269
3280
  }, Symbol.toStringTag, { value: "Module" }));
3270
3281
  async function mo(t) {
3271
3282
  }
3272
- async function ho(t) {
3283
+ async function _o(t) {
3273
3284
  }
3274
- const _o = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3285
+ const ho = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3275
3286
  __proto__: null,
3276
- down: ho,
3287
+ down: _o,
3277
3288
  up: mo
3278
3289
  }, Symbol.toStringTag, { value: "Module" }));
3279
3290
  async function fo(t) {
@@ -3369,11 +3380,11 @@ const Fo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3369
3380
  }, Symbol.toStringTag, { value: "Module" }));
3370
3381
  async function Ao(t) {
3371
3382
  }
3372
- async function Lo(t) {
3383
+ async function zo(t) {
3373
3384
  }
3374
- const zo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3385
+ const Lo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3375
3386
  __proto__: null,
3376
- down: Lo,
3387
+ down: zo,
3377
3388
  up: Ao
3378
3389
  }, Symbol.toStringTag, { value: "Module" }));
3379
3390
  async function Jo(t) {
@@ -3511,24 +3522,24 @@ const ls = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3511
3522
  down: is,
3512
3523
  up: ss
3513
3524
  }, Symbol.toStringTag, { value: "Module" }));
3514
- async function cs(t) {
3515
- }
3516
3525
  async function ds(t) {
3517
3526
  }
3527
+ async function cs(t) {
3528
+ }
3518
3529
  const us = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3519
3530
  __proto__: null,
3520
- down: ds,
3521
- up: cs
3531
+ down: cs,
3532
+ up: ds
3522
3533
  }, Symbol.toStringTag, { value: "Module" }));
3523
3534
  async function ms(t) {
3524
3535
  await t.schema.alterTable("logins").addColumn("authParams_ui_locales", "varchar(32)").execute();
3525
3536
  }
3526
- async function hs(t) {
3537
+ async function _s(t) {
3527
3538
  await t.schema.alterTable("logins").dropColumn("authParams_ui_locales").execute();
3528
3539
  }
3529
- const _s = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3540
+ const hs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3530
3541
  __proto__: null,
3531
- down: hs,
3542
+ down: _s,
3532
3543
  up: ms
3533
3544
  }, Symbol.toStringTag, { value: "Module" }));
3534
3545
  async function fs(t) {
@@ -3634,12 +3645,12 @@ async function As(t) {
3634
3645
  (e) => e.onDelete("cascade")
3635
3646
  ).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();
3636
3647
  }
3637
- async function Ls(t) {
3648
+ async function zs(t) {
3638
3649
  await t.schema.dropTable("refresh_tokens").execute();
3639
3650
  }
3640
- const zs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3651
+ const Ls = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3641
3652
  __proto__: null,
3642
- down: Ls,
3653
+ down: zs,
3643
3654
  up: As
3644
3655
  }, Symbol.toStringTag, { value: "Module" }));
3645
3656
  async function Js(t) {
@@ -3793,15 +3804,15 @@ const li = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3793
3804
  down: ii,
3794
3805
  up: si
3795
3806
  }, Symbol.toStringTag, { value: "Module" }));
3796
- async function ci(t) {
3807
+ async function di(t) {
3797
3808
  await t.schema.dropTable("logins").execute(), await t.schema.dropTable("sessions_2").execute(), await t.schema.dropTable("refresh_tokens_2").execute();
3798
3809
  }
3799
- async function di(t) {
3810
+ async function ci(t) {
3800
3811
  }
3801
3812
  const ui = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3802
3813
  __proto__: null,
3803
- down: di,
3804
- up: ci
3814
+ down: ci,
3815
+ up: di
3805
3816
  }, Symbol.toStringTag, { value: "Module" }));
3806
3817
  async function mi(t) {
3807
3818
  await t.schema.dropTable("custom_domains").execute(), await t.schema.createTable("custom_domains").addColumn(
@@ -3814,11 +3825,11 @@ async function mi(t) {
3814
3825
  (e) => e.references("tenants.id").onDelete("cascade").notNull()
3815
3826
  ).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();
3816
3827
  }
3817
- async function hi(t) {
3828
+ async function _i(t) {
3818
3829
  }
3819
- const _i = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3830
+ const hi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3820
3831
  __proto__: null,
3821
- down: hi,
3832
+ down: _i,
3822
3833
  up: mi
3823
3834
  }, Symbol.toStringTag, { value: "Module" }));
3824
3835
  async function fi(t) {
@@ -3908,12 +3919,12 @@ const Fi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3908
3919
  async function Ai(t) {
3909
3920
  await t.schema.alterTable("codes").addColumn("redirect_uri", "varchar(1024)").execute();
3910
3921
  }
3911
- async function Li(t) {
3922
+ async function zi(t) {
3912
3923
  await t.schema.alterTable("codes").dropColumn("redirect_uri").execute();
3913
3924
  }
3914
- const zi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3925
+ const Li = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3915
3926
  __proto__: null,
3916
- down: Li,
3927
+ down: zi,
3917
3928
  up: Ai
3918
3929
  }, Symbol.toStringTag, { value: "Module" }));
3919
3930
  async function Ji(t) {
@@ -3926,14 +3937,97 @@ const Ki = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3926
3937
  __proto__: null,
3927
3938
  down: Ei,
3928
3939
  up: Ji
3929
- }, Symbol.toStringTag, { value: "Module" })), ze = {
3940
+ }, Symbol.toStringTag, { value: "Module" }));
3941
+ async function Ri(t) {
3942
+ await t.schema.createTable("themes").addColumn(
3943
+ "tenant_id",
3944
+ "varchar(255)",
3945
+ (e) => e.references("tenants.id").onDelete("cascade").notNull()
3946
+ ).addColumn("themeId", "varchar(255)", (e) => e.notNull()).addColumn("displayName", "varchar(255)", (e) => e.notNull()).addColumn(
3947
+ "colors_primary_button_label",
3948
+ "varchar(24)",
3949
+ (e) => e.notNull()
3950
+ ).addColumn("colors_primary_button", "varchar(24)", (e) => e.notNull()).addColumn(
3951
+ "colors_secondary_button_border",
3952
+ "varchar(24)",
3953
+ (e) => e.notNull()
3954
+ ).addColumn(
3955
+ "colors_secondary_button_label",
3956
+ "varchar(24)",
3957
+ (e) => e.notNull()
3958
+ ).addColumn("colors_base_focus_color", "varchar(24)", (e) => e.notNull()).addColumn("colors_base_hover_color", "varchar(24)", (e) => e.notNull()).addColumn("colors_body_text", "varchar(24)", (e) => e.notNull()).addColumn(
3959
+ "colors_captcha_widget_theme",
3960
+ "varchar(24)",
3961
+ (e) => e.notNull()
3962
+ ).addColumn("colors_error", "varchar(24)", (e) => e.notNull()).addColumn("colors_header", "varchar(24)", (e) => e.notNull()).addColumn("colors_icons", "varchar(24)", (e) => e.notNull()).addColumn("colors_input_background", "varchar(24)", (e) => e.notNull()).addColumn("colors_input_border", "varchar(24)", (e) => e.notNull()).addColumn(
3963
+ "colors_input_filled_text",
3964
+ "varchar(24)",
3965
+ (e) => e.notNull()
3966
+ ).addColumn(
3967
+ "colors_input_labels_placeholders",
3968
+ "varchar(24)",
3969
+ (e) => e.notNull()
3970
+ ).addColumn(
3971
+ "colors_links_focused_components",
3972
+ "varchar(24)",
3973
+ (e) => e.notNull()
3974
+ ).addColumn("colors_success", "varchar(24)", (e) => e.notNull()).addColumn(
3975
+ "colors_widget_background",
3976
+ "varchar(24)",
3977
+ (e) => e.notNull()
3978
+ ).addColumn("colors_widget_border", "varchar(24)", (e) => e.notNull()).addColumn(
3979
+ "borders_button_border_radius",
3980
+ "integer",
3981
+ (e) => e.notNull()
3982
+ ).addColumn(
3983
+ "borders_button_border_weight",
3984
+ "integer",
3985
+ (e) => e.notNull()
3986
+ ).addColumn("borders_buttons_style", "varchar(24)", (e) => e.notNull()).addColumn("borders_input_border_radius", "integer", (e) => e.notNull()).addColumn("borders_input_border_weight", "integer", (e) => e.notNull()).addColumn("borders_inputs_style", "varchar(24)", (e) => e.notNull()).addColumn("borders_show_widget_shadow", "integer", (e) => e.notNull()).addColumn(
3987
+ "borders_widget_border_weight",
3988
+ "integer",
3989
+ (e) => e.notNull()
3990
+ ).addColumn(
3991
+ "borders_widget_corner_radius",
3992
+ "integer",
3993
+ (e) => e.notNull()
3994
+ ).addColumn("fonts_body_text_bold", "integer", (e) => e.notNull()).addColumn("fonts_body_text_size", "integer", (e) => e.notNull()).addColumn("fonts_buttons_text_bold", "integer", (e) => e.notNull()).addColumn("fonts_buttons_text_size", "integer", (e) => e.notNull()).addColumn("fonts_font_url", "varchar(255)", (e) => e.notNull()).addColumn("fonts_input_labels_bold", "integer", (e) => e.notNull()).addColumn("fonts_input_labels_size", "integer", (e) => e.notNull()).addColumn("fonts_links_bold", "integer", (e) => e.notNull()).addColumn("fonts_links_size", "integer", (e) => e.notNull()).addColumn("fonts_links_style", "varchar(24)", (e) => e.notNull()).addColumn("fonts_reference_text_size", "integer", (e) => e.notNull()).addColumn("fonts_subtitle_bold", "integer", (e) => e.notNull()).addColumn("fonts_subtitle_size", "integer", (e) => e.notNull()).addColumn("fonts_title_bold", "integer", (e) => e.notNull()).addColumn("fonts_title_size", "integer", (e) => e.notNull()).addColumn(
3995
+ "page_background_background_color",
3996
+ "varchar(24)",
3997
+ (e) => e.notNull()
3998
+ ).addColumn(
3999
+ "page_background_background_image_url",
4000
+ "varchar(255)",
4001
+ (e) => e.notNull()
4002
+ ).addColumn(
4003
+ "page_background_page_layout",
4004
+ "varchar(24)",
4005
+ (e) => e.notNull()
4006
+ ).addColumn(
4007
+ "widget_header_text_alignment",
4008
+ "varchar(24)",
4009
+ (e) => e.notNull()
4010
+ ).addColumn("widget_logo_height", "integer", (e) => e.notNull()).addColumn("widget_logo_position", "varchar(24)", (e) => e.notNull()).addColumn("widget_logo_url", "varchar(255)", (e) => e.notNull()).addColumn(
4011
+ "widget_social_buttons_layout",
4012
+ "varchar(24)",
4013
+ (e) => e.notNull()
4014
+ ).addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("updated_at", "varchar(35)", (e) => e.notNull()).addPrimaryKeyConstraint("themes_pkey", ["tenant_id", "themeId"]).execute(), await t.schema.createIndex("themes_tenant_id_idx").on("themes").column("tenant_id").execute();
4015
+ }
4016
+ async function Ui(t) {
4017
+ await t.schema.dropTable("themes").execute();
4018
+ }
4019
+ const Bi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4020
+ __proto__: null,
4021
+ down: Ui,
4022
+ up: Ri
4023
+ }, Symbol.toStringTag, { value: "Module" })), Je = {
3930
4024
  m1_init: Wa,
3931
4025
  m2_magicLink: Xa,
3932
4026
  m3_updateAt: en,
3933
4027
  m4_logTable: nn,
3934
4028
  m5_userProfile: sn,
3935
- m6_sessions: dn,
3936
- m7_passwords: hn,
4029
+ m6_sessions: cn,
4030
+ m7_passwords: _n,
3937
4031
  m8_logsTableNewFields: pn,
3938
4032
  m9_passwordTableNewField: wn,
3939
4033
  n01_codesTable: Cn,
@@ -3941,7 +4035,7 @@ const Ki = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3941
4035
  n12_userFields: kn,
3942
4036
  n13_userEmailIndex: In,
3943
4037
  n14_profileDataField: Mn,
3944
- n15_userEmailIndex: Ln,
4038
+ n15_userEmailIndex: zn,
3945
4039
  n16_userLocale: En,
3946
4040
  n17_signingKeys: Un,
3947
4041
  n18_logsFields: qn,
@@ -3950,8 +4044,8 @@ const Ki = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3950
4044
  n21_sessionDeletedAt: tr,
3951
4045
  n22_dropLogsFields: rr,
3952
4046
  n23_dropUsersFields: ir,
3953
- n24_logsIndexes: dr,
3954
- n25_logDescMaxLength: hr,
4047
+ n24_logsIndexes: cr,
4048
+ n25_logDescMaxLength: _r,
3955
4049
  n26_logsTableExtraFields: pr,
3956
4050
  n27_usersTableNameIndex: wr,
3957
4051
  n28_usersEmailConstrain: Cr,
@@ -3959,7 +4053,7 @@ const Ki = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3959
4053
  n30_increaseTicketStateLength: kr,
3960
4054
  n31_branding: Ir,
3961
4055
  n32_indexesAndNotNull: Mr,
3962
- n33_vendorIdInUniversalLoginSession: Lr,
4056
+ n33_vendorIdInUniversalLoginSession: zr,
3963
4057
  n34_auth0ClientInUniversalLoginSession: Er,
3964
4058
  n35_increaseUniversalSessionStateLength: Ur,
3965
4059
  n36_authenticationCodes: qr,
@@ -3969,7 +4063,7 @@ const Ki = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3969
4063
  n40_userId: ro,
3970
4064
  n41_hooks: io,
3971
4065
  n42_userIdIndexes: uo,
3972
- n43_userIdIndexes: _o,
4066
+ n43_userIdIndexes: ho,
3973
4067
  n44_codes: go,
3974
4068
  n45_hookProperties: vo,
3975
4069
  n46_loginAuth0Client: bo,
@@ -3977,7 +4071,7 @@ const Ki = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3977
4071
  n48_saml: $o,
3978
4072
  n49_removeFields: jo,
3979
4073
  n50_authParamsNonce: Fo,
3980
- n51_connectionid: zo,
4074
+ n51_connectionid: Lo,
3981
4075
  n52_cert: Ko,
3982
4076
  n53_codes_primary_key: Bo,
3983
4077
  n54_cleanup_tables: Vo,
@@ -3987,7 +4081,7 @@ const Ki = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3987
4081
  n58_connection_client_id: os,
3988
4082
  n59_connection_options: ls,
3989
4083
  n60_users_metadata: us,
3990
- n61_userLocales: _s,
4084
+ n61_userLocales: hs,
3991
4085
  n62_prompt: gs,
3992
4086
  n63_connection_cleanup: vs,
3993
4087
  n64_act_as: bs,
@@ -3995,7 +4089,7 @@ const Ki = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3995
4089
  n66_email_providers: $s,
3996
4090
  n67_drop_tickets: js,
3997
4091
  n68_login_useragents: Fs,
3998
- n70_refresh_tokens: zs,
4092
+ n70_refresh_tokens: Ls,
3999
4093
  n71_session_new_fields: Ks,
4000
4094
  n72_session_primary_key: Bs,
4001
4095
  n73_drop_sessions: Vs,
@@ -4005,7 +4099,7 @@ const Ki = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4005
4099
  n77_drop_sessions: oi,
4006
4100
  n78_login_sessions: li,
4007
4101
  n79_drop_sessions_2: ui,
4008
- n80_recreate_custom_domains: _i,
4102
+ n80_recreate_custom_domains: hi,
4009
4103
  n81_phone: gi,
4010
4104
  n82_forms: vi,
4011
4105
  n83_addFormsIdToHooks: bi,
@@ -4013,12 +4107,13 @@ const Ki = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4013
4107
  n85_add_login_session_id_to_sessions: $i,
4014
4108
  n86_index_sessions_login_session_id: ji,
4015
4109
  n87_code_challenge: Fi,
4016
- n88_add_redirect_uri_to_codes: zi,
4017
- n89_add_nonce_and_state_to_codes: Ki
4110
+ n88_add_redirect_uri_to_codes: Li,
4111
+ n89_add_nonce_and_state_to_codes: Ki,
4112
+ n90_themes: Bi
4018
4113
  };
4019
- async function qi(t, e = !1) {
4114
+ async function Gi(t, e = !1) {
4020
4115
  e && console.log("migrating...");
4021
- const a = new Le(ze), n = new Ce({
4116
+ const a = new Le(Je), n = new be({
4022
4117
  db: t,
4023
4118
  provider: a
4024
4119
  }), { error: o, results: r } = await n.migrateToLatest();
@@ -4029,9 +4124,9 @@ async function qi(t, e = !1) {
4029
4124
  }), o)
4030
4125
  throw console.error("failed to migrate"), console.error(o), o;
4031
4126
  }
4032
- async function Vi(t) {
4127
+ async function Hi(t) {
4033
4128
  console.log("migrating...");
4034
- const e = new Le(ze), a = new Ce({
4129
+ const e = new Le(Je), a = new be({
4035
4130
  db: t,
4036
4131
  provider: e
4037
4132
  }), { error: n, results: o } = await a.migrateDown();
@@ -4040,32 +4135,32 @@ async function Vi(t) {
4040
4135
  }), n)
4041
4136
  throw console.error("failed to migrate"), console.error(n), n;
4042
4137
  }
4043
- function Wi(t) {
4138
+ function Xi(t) {
4044
4139
  return {
4045
4140
  applications: jt(t),
4046
4141
  branding: Zt(t),
4047
4142
  cleanup: $a(t),
4048
4143
  clients: Jt(t),
4049
4144
  codes: St(t),
4050
- connections: zt(t),
4145
+ connections: Lt(t),
4051
4146
  emailProviders: Ca(t),
4052
4147
  customDomains: Ht(t),
4053
4148
  forms: Fa(t),
4054
4149
  hooks: oa(t),
4055
4150
  keys: Ut(t),
4056
4151
  loginSessions: fa(t),
4057
- logs: dt(t),
4152
+ logs: ct(t),
4058
4153
  passwords: vt(t),
4059
4154
  promptSettings: ya(t),
4060
4155
  refreshTokens: ka(t),
4061
4156
  sessions: pt(t),
4062
4157
  tenants: ot(t),
4063
- themes: da(t),
4158
+ themes: ca(t),
4064
4159
  users: Ye(t)
4065
4160
  };
4066
4161
  }
4067
4162
  export {
4068
- Wi as default,
4069
- Vi as migrateDown,
4070
- qi as migrateToLatest
4163
+ Xi as default,
4164
+ Hi as migrateDown,
4165
+ Gi as migrateToLatest
4071
4166
  };