@authhero/kysely-adapter 10.26.0 → 10.28.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), B = (t, e, a) => e.has(t) || ue("Cannot " + a);
7
+ var c = (t, e, a) => (B(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) => (B(t, e, "write to private field"), n ? n.call(t, a) : e.set(t, a), a), u = (t, e, a) => (B(t, e, "access private method"), a);
8
+ import { parseUserId as Z, codeSchema as Re, connectionSchema as Be, loginSessionSchema as Ue, 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) => Be.parse(
734
734
  f({
735
735
  ...s,
736
736
  options: s.options ? JSON.parse(s.options) : {}
@@ -766,14 +766,14 @@ function Kt(t) {
766
766
  function Rt(t) {
767
767
  return async (e, a) => !!(await t.updateTable("keys").set(a).where("kid", "=", e).execute()).length;
768
768
  }
769
- function Ut(t) {
769
+ function Bt(t) {
770
770
  return {
771
771
  create: Kt(t),
772
772
  list: Et(t),
773
773
  update: Rt(t)
774
774
  };
775
775
  }
776
- function Bt(t) {
776
+ function Ut(t) {
777
777
  return async (e, a) => {
778
778
  const n = {
779
779
  custom_domain_id: S(),
@@ -829,7 +829,7 @@ function Gt(t) {
829
829
  }
830
830
  function Ht(t) {
831
831
  return {
832
- create: Bt(t),
832
+ create: Ut(t),
833
833
  get: Vt(t),
834
834
  getByDomain: Gt(t),
835
835
  list: Qt(t),
@@ -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,67 @@ 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
+ if (!n)
998
+ return null;
999
+ const o = {
1000
+ ...n,
1001
+ borders_show_widget_shadow: !!n.borders_show_widget_shadow,
1002
+ fonts_body_text_bold: !!n.fonts_body_text_bold,
1003
+ fonts_buttons_text_bold: !!n.fonts_buttons_text_bold,
1004
+ fonts_input_labels_bold: !!n.fonts_input_labels_bold,
1005
+ fonts_links_bold: !!n.fonts_links_bold,
1006
+ fonts_subtitle_bold: !!n.fonts_subtitle_bold,
1007
+ fonts_title_bold: !!n.fonts_title_bold
1008
+ };
1009
+ return f(
1010
+ ge(o, [
1011
+ "widget",
1012
+ "colors",
1013
+ "borders",
1014
+ "fonts",
1015
+ "page_background"
1016
+ ])
1017
+ );
995
1018
  };
996
1019
  }
997
- function ca(t) {
1020
+ function da(t) {
998
1021
  return async (e, a, n) => {
999
1022
  const o = P({
1000
1023
  ...n,
1001
1024
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
1002
1025
  });
1003
- return await t.updateTable("themes").set(o).where("themes.id", "=", a).where("themes.tenant_id", "=", e).execute(), !0;
1026
+ return await t.updateTable("themes").set(o).where("themes.themeId", "=", a).where("themes.tenant_id", "=", e).execute(), !0;
1004
1027
  };
1005
1028
  }
1006
- function da(t) {
1029
+ function ca(t) {
1007
1030
  return {
1008
1031
  create: sa(t),
1009
1032
  get: la(t),
1010
1033
  remove: ia(t),
1011
- update: ca(t)
1034
+ update: da(t)
1012
1035
  };
1013
1036
  }
1014
1037
  function ua(t) {
1015
1038
  return async (e, a) => {
1016
1039
  const n = await t.selectFrom("login_sessions").where("login_sessions.id", "=", a).selectAll().executeTakeFirst();
1017
1040
  return n ? Ue.parse(
1018
- Ge(
1041
+ ge(
1019
1042
  f({
1020
1043
  ...n,
1021
1044
  login_completed: !!n.login_completed
@@ -1042,22 +1065,22 @@ function ma(t) {
1042
1065
  }).execute(), n;
1043
1066
  };
1044
1067
  }
1045
- function ha(t) {
1068
+ function _a(t) {
1046
1069
  return async (e, a, n) => (await t.updateTable("login_sessions").set(
1047
1070
  P({
1048
1071
  ...n
1049
1072
  })
1050
1073
  ).where("login_sessions.id", "=", a).where("login_sessions.tenant_id", "=", e).execute()).length === 1;
1051
1074
  }
1052
- function _a(t) {
1075
+ function ha(t) {
1053
1076
  return async (e, a) => (await t.deleteFrom("login_sessions").where("login_sessions.tenant_id", "=", e).where("login_sessions.id", "=", a).execute()).length > 0;
1054
1077
  }
1055
1078
  function fa(t) {
1056
1079
  return {
1057
1080
  create: ma(t),
1058
1081
  get: ua(t),
1059
- update: ha(t),
1060
- remove: _a(t)
1082
+ update: _a(t),
1083
+ remove: ha(t)
1061
1084
  };
1062
1085
  }
1063
1086
  function pa(t) {
@@ -1071,7 +1094,7 @@ function pa(t) {
1071
1094
  });
1072
1095
  };
1073
1096
  }
1074
- function _e(t) {
1097
+ function he(t) {
1075
1098
  return f({
1076
1099
  ...t,
1077
1100
  webauthn_platform_first_factor: t.webauthn_platform_first_factor ? !!t.webauthn_platform_first_factor : void 0,
@@ -1083,13 +1106,13 @@ function _e(t) {
1083
1106
  function ga(t) {
1084
1107
  return async (e, a) => {
1085
1108
  try {
1086
- const n = Be.parse(a);
1109
+ const n = Qe.parse(a);
1087
1110
  await t.insertInto("prompt_settings").values({
1088
- ..._e(n),
1111
+ ...he(n),
1089
1112
  tenant_id: e
1090
1113
  }).execute();
1091
1114
  } catch {
1092
- await t.updateTable("prompt_settings").set(_e(a)).where("tenant_id", "=", e).execute();
1115
+ await t.updateTable("prompt_settings").set(he(a)).where("tenant_id", "=", e).execute();
1093
1116
  }
1094
1117
  };
1095
1118
  }
@@ -1109,10 +1132,10 @@ function wa(t) {
1109
1132
  credentials: o,
1110
1133
  settings: r,
1111
1134
  enabled: s,
1112
- ...c
1135
+ ...d
1113
1136
  } = a;
1114
1137
  return f({
1115
- ...c,
1138
+ ...d,
1116
1139
  credentials: JSON.parse(o),
1117
1140
  settings: JSON.parse(r),
1118
1141
  enabled: !!s
@@ -1208,7 +1231,7 @@ function Oa(t) {
1208
1231
  );
1209
1232
  }
1210
1233
  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);
1234
+ const r = await o.selectAll().execute(), { count: s } = await n.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow(), d = b(s);
1212
1235
  return {
1213
1236
  refresh_tokens: r.map((l) => ({
1214
1237
  ...l,
@@ -1218,7 +1241,7 @@ function Oa(t) {
1218
1241
  })),
1219
1242
  start: a.page * a.per_page,
1220
1243
  limit: a.per_page,
1221
- length: c
1244
+ length: d
1222
1245
  };
1223
1246
  };
1224
1247
  }
@@ -1288,29 +1311,29 @@ function Ia(t) {
1288
1311
  let n = t.selectFrom("forms").where("tenant_id", "=", e);
1289
1312
  a != null && a.q && (n = T(t, n, a.q, []));
1290
1313
  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")
1314
+ const _ = { ...l };
1315
+ if (typeof _.nodes == "string")
1293
1316
  try {
1294
- h.nodes = JSON.parse(h.nodes);
1317
+ _.nodes = JSON.parse(_.nodes);
1295
1318
  } catch {
1296
1319
  }
1297
- if (typeof h.start == "string")
1320
+ if (typeof _.start == "string")
1298
1321
  try {
1299
- h.start = JSON.parse(h.start);
1322
+ _.start = JSON.parse(_.start);
1300
1323
  } catch {
1301
1324
  }
1302
- if (typeof h.ending == "string")
1325
+ if (typeof _.ending == "string")
1303
1326
  try {
1304
- h.ending = JSON.parse(h.ending);
1327
+ _.ending = JSON.parse(_.ending);
1305
1328
  } catch {
1306
1329
  }
1307
- return K.parse(f(h));
1308
- }), { count: c } = await n.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow();
1330
+ return K.parse(f(_));
1331
+ }), { count: d } = await n.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow();
1309
1332
  return {
1310
1333
  forms: s,
1311
1334
  start: a.page * a.per_page,
1312
1335
  limit: a.per_page,
1313
- length: b(c)
1336
+ length: b(d)
1314
1337
  };
1315
1338
  };
1316
1339
  }
@@ -1396,7 +1419,7 @@ const E = g({
1396
1419
  identifier: E.create(e)
1397
1420
  });
1398
1421
  }
1399
- }), La = g({
1422
+ }), za = g({
1400
1423
  is(t) {
1401
1424
  return t.kind === "AliasNode";
1402
1425
  },
@@ -1407,7 +1430,7 @@ const E = g({
1407
1430
  alias: e
1408
1431
  });
1409
1432
  }
1410
- }), B = g({
1433
+ }), U = g({
1411
1434
  is(t) {
1412
1435
  return t.kind === "TableNode";
1413
1436
  },
@@ -1425,7 +1448,7 @@ const E = g({
1425
1448
  }
1426
1449
  });
1427
1450
  var R;
1428
- class za {
1451
+ class La {
1429
1452
  constructor() {
1430
1453
  M(this, "nodeStack", []);
1431
1454
  y(this, R, g({
@@ -1532,7 +1555,7 @@ class za {
1532
1555
  return this.nodeStack.pop(), g(a);
1533
1556
  }
1534
1557
  transformNodeImpl(e) {
1535
- return d(this, R)[e.kind](e);
1558
+ return c(this, R)[e.kind](e);
1536
1559
  }
1537
1560
  transformNodeList(e) {
1538
1561
  return e && g(e.map((a) => this.transformNode(a)));
@@ -2278,8 +2301,8 @@ const Ja = g({
2278
2301
  UpdateQueryNode: !0,
2279
2302
  MergeQueryNode: !0
2280
2303
  });
2281
- var j, O, k, p, ye, we, ve, $, G, Ne;
2282
- class Ea extends za {
2304
+ var j, O, k, p, we, ve, Ne, $, G, Ce;
2305
+ class Ea extends La {
2283
2306
  constructor(a) {
2284
2307
  super();
2285
2308
  y(this, p);
@@ -2289,39 +2312,39 @@ class Ea extends za {
2289
2312
  F(this, j, a);
2290
2313
  }
2291
2314
  transformNodeImpl(a) {
2292
- if (!u(this, p, ye).call(this, a))
2315
+ if (!u(this, p, we).call(this, a))
2293
2316
  return super.transformNodeImpl(a);
2294
- const n = u(this, p, ve).call(this, a);
2317
+ const n = u(this, p, Ne).call(this, a);
2295
2318
  for (const s of n)
2296
- d(this, k).add(s);
2297
- const o = u(this, p, we).call(this, a);
2319
+ c(this, k).add(s);
2320
+ const o = u(this, p, ve).call(this, a);
2298
2321
  for (const s of o)
2299
- d(this, O).add(s);
2322
+ c(this, O).add(s);
2300
2323
  const r = super.transformNodeImpl(a);
2301
2324
  for (const s of o)
2302
- d(this, O).delete(s);
2325
+ c(this, O).delete(s);
2303
2326
  for (const s of n)
2304
- d(this, k).delete(s);
2327
+ c(this, k).delete(s);
2305
2328
  return r;
2306
2329
  }
2307
2330
  transformSchemableIdentifier(a) {
2308
2331
  const n = super.transformSchemableIdentifier(a);
2309
- return n.schema || !d(this, O).has(a.identifier.name) ? n : {
2332
+ return n.schema || !c(this, O).has(a.identifier.name) ? n : {
2310
2333
  ...n,
2311
- schema: E.create(d(this, j))
2334
+ schema: E.create(c(this, j))
2312
2335
  };
2313
2336
  }
2314
2337
  transformReferences(a) {
2315
2338
  const n = super.transformReferences(a);
2316
2339
  return n.table.table.schema ? n : {
2317
2340
  ...n,
2318
- table: B.createWithSchema(d(this, j), n.table.table.identifier.name)
2341
+ table: U.createWithSchema(c(this, j), n.table.table.identifier.name)
2319
2342
  };
2320
2343
  }
2321
2344
  }
2322
- j = new WeakMap(), O = new WeakMap(), k = new WeakMap(), p = new WeakSet(), ye = function(a) {
2345
+ j = new WeakMap(), O = new WeakMap(), k = new WeakMap(), p = new WeakSet(), we = function(a) {
2323
2346
  return a.kind in Ja;
2324
- }, we = function(a) {
2347
+ }, ve = function(a) {
2325
2348
  const n = /* @__PURE__ */ new Set();
2326
2349
  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
2350
  for (const o of a.from.froms)
@@ -2330,35 +2353,35 @@ j = new WeakMap(), O = new WeakMap(), k = new WeakMap(), p = new WeakSet(), ye =
2330
2353
  for (const o of a.joins)
2331
2354
  u(this, p, $).call(this, o.table, n);
2332
2355
  return "using" in a && a.using && u(this, p, $).call(this, a.using, n), n;
2333
- }, ve = function(a) {
2356
+ }, Ne = function(a) {
2334
2357
  const n = /* @__PURE__ */ new Set();
2335
- return "with" in a && a.with && u(this, p, Ne).call(this, a.with, n), n;
2358
+ return "with" in a && a.with && u(this, p, Ce).call(this, a.with, n), n;
2336
2359
  }, $ = function(a, n) {
2337
- const o = B.is(a) ? a : La.is(a) && B.is(a.node) ? a.node : null;
2360
+ const o = U.is(a) ? a : za.is(a) && U.is(a.node) ? a.node : null;
2338
2361
  o && u(this, p, G).call(this, o.table, n);
2339
2362
  }, G = function(a, n) {
2340
2363
  const o = a.identifier.name;
2341
- !d(this, O).has(o) && !d(this, k).has(o) && n.add(o);
2342
- }, Ne = function(a, n) {
2364
+ !c(this, O).has(o) && !c(this, k).has(o) && n.add(o);
2365
+ }, Ce = function(a, n) {
2343
2366
  for (const o of a.expressions) {
2344
2367
  const r = o.name.table.table.identifier.name;
2345
- d(this, k).has(r) || n.add(r);
2368
+ c(this, k).has(r) || n.add(r);
2346
2369
  }
2347
2370
  };
2348
- var z;
2371
+ var L;
2349
2372
  class Ka {
2350
2373
  constructor(e) {
2351
- y(this, z);
2352
- F(this, z, new Ea(e));
2374
+ y(this, L);
2375
+ F(this, L, new Ea(e));
2353
2376
  }
2354
2377
  transformQuery(e) {
2355
- return d(this, z).transformNode(e.node);
2378
+ return c(this, L).transformNode(e.node);
2356
2379
  }
2357
2380
  async transformResult(e) {
2358
2381
  return e.result;
2359
2382
  }
2360
2383
  }
2361
- z = new WeakMap();
2384
+ L = new WeakMap();
2362
2385
  class Ra {
2363
2386
  transformQuery(e) {
2364
2387
  return e.node;
@@ -2367,13 +2390,13 @@ class Ra {
2367
2390
  return e.result;
2368
2391
  }
2369
2392
  }
2370
- 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 {
2393
+ const Ba = "kysely_migration", fe = "kysely_migration_lock", Ua = !1, Q = "migration_lock", Qa = g({ __noMigrations__: !0 });
2394
+ 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;
2395
+ class be {
2373
2396
  constructor(e) {
2374
2397
  y(this, i);
2375
- y(this, _);
2376
- F(this, _, g(e));
2398
+ y(this, h);
2399
+ F(this, h, g(e));
2377
2400
  }
2378
2401
  /**
2379
2402
  * Returns a {@link MigrationInfo} object for each migration.
@@ -2381,7 +2404,7 @@ class Ce {
2381
2404
  * The returned array is sorted by migration name.
2382
2405
  */
2383
2406
  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() : [];
2407
+ 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
2408
  return (await u(this, i, Y).call(this)).map(({ name: n, ...o }) => {
2386
2409
  const r = e.find((s) => s.name === n);
2387
2410
  return {
@@ -2468,9 +2491,9 @@ class Ce {
2468
2491
  return u(this, i, A).call(this, ({ migrations: a, executedMigrations: n, pendingMigrations: o }) => {
2469
2492
  if (e === Qa)
2470
2493
  return { direction: "Down", step: 1 / 0 };
2471
- if (!a.find((c) => c.name === e))
2494
+ if (!a.find((d) => d.name === e))
2472
2495
  throw new Error(`migration "${e}" doesn't exist`);
2473
- const r = n.indexOf(e), s = o.findIndex((c) => c.name === e);
2496
+ const r = n.indexOf(e), s = o.findIndex((d) => d.name === e);
2474
2497
  if (r !== -1)
2475
2498
  return {
2476
2499
  direction: "Down",
@@ -2516,128 +2539,128 @@ class Ce {
2516
2539
  return u(this, i, A).call(this, () => ({ direction: "Down", step: 1 }));
2517
2540
  }
2518
2541
  }
2519
- _ = new WeakMap(), i = new WeakSet(), A = async function(e) {
2542
+ h = new WeakMap(), i = new WeakSet(), A = async function(e) {
2520
2543
  try {
2521
- return await u(this, i, xe).call(this), await u(this, i, $e).call(this, e);
2544
+ return await u(this, i, Te).call(this), await u(this, i, De).call(this, e);
2522
2545
  } catch (a) {
2523
2546
  return a instanceof q ? a.resultSet : { error: a };
2524
2547
  }
2525
2548
  }, v = function() {
2526
- return d(this, _).migrationTableSchema;
2549
+ return c(this, h).migrationTableSchema;
2527
2550
  }, N = function() {
2528
- return d(this, _).migrationTableName ?? Ua;
2551
+ return c(this, h).migrationTableName ?? Ba;
2529
2552
  }, D = function() {
2530
- return d(this, _).migrationLockTableName ?? fe;
2531
- }, be = function() {
2532
- return d(this, _).allowUnorderedMigrations ?? Ba;
2553
+ return c(this, h).migrationLockTableName ?? fe;
2554
+ }, xe = function() {
2555
+ return c(this, h).allowUnorderedMigrations ?? Ua;
2533
2556
  }, 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);
2557
+ return c(this, i, v) ? new Ka(c(this, i, v)) : new Ra();
2537
2558
  }, Te = async function() {
2538
- if (d(this, i, v) && !await u(this, i, H).call(this))
2559
+ 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);
2560
+ }, Se = async function() {
2561
+ if (c(this, i, v) && !await u(this, i, H).call(this))
2539
2562
  try {
2540
- await u(this, i, L).call(this, d(this, _).db.schema.createSchema(d(this, i, v)));
2563
+ await u(this, i, z).call(this, c(this, h).db.schema.createSchema(c(this, i, v)));
2541
2564
  } catch (e) {
2542
2565
  if (!await u(this, i, H).call(this))
2543
2566
  throw e;
2544
2567
  }
2545
- }, Se = async function() {
2546
- if (!await u(this, i, I).call(this, d(this, i, N)))
2568
+ }, Oe = async function() {
2569
+ if (!await u(this, i, I).call(this, c(this, i, N)))
2547
2570
  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()));
2571
+ 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
2572
  } catch (e) {
2550
- if (!await u(this, i, I).call(this, d(this, i, N)))
2573
+ if (!await u(this, i, I).call(this, c(this, i, N)))
2551
2574
  throw e;
2552
2575
  }
2553
- }, Oe = async function() {
2554
- if (!await u(this, i, I).call(this, d(this, i, D)))
2576
+ }, ke = async function() {
2577
+ if (!await u(this, i, I).call(this, c(this, i, D)))
2555
2578
  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)));
2579
+ 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
2580
  } catch (e) {
2558
- if (!await u(this, i, I).call(this, d(this, i, D)))
2581
+ if (!await u(this, i, I).call(this, c(this, i, D)))
2559
2582
  throw e;
2560
2583
  }
2561
- }, ke = async function() {
2584
+ }, $e = async function() {
2562
2585
  if (!await u(this, i, X).call(this))
2563
2586
  try {
2564
- await d(this, _).db.withPlugin(d(this, i, C)).insertInto(d(this, i, D)).values({ id: Q, is_locked: 0 }).execute();
2587
+ await c(this, h).db.withPlugin(c(this, i, C)).insertInto(c(this, i, D)).values({ id: Q, is_locked: 0 }).execute();
2565
2588
  } catch (e) {
2566
2589
  if (!await u(this, i, X).call(this))
2567
2590
  throw e;
2568
2591
  }
2569
2592
  }, H = async function() {
2570
- return (await d(this, _).db.introspection.getSchemas()).some((a) => a.name === d(this, i, v));
2593
+ return (await c(this, h).db.introspection.getSchemas()).some((a) => a.name === c(this, i, v));
2571
2594
  }, I = async function(e) {
2572
- const a = d(this, i, v);
2573
- return (await d(this, _).db.introspection.getTables({
2595
+ const a = c(this, i, v);
2596
+ return (await c(this, h).db.introspection.getTables({
2574
2597
  withInternalKyselyTables: !0
2575
2598
  })).some((o) => o.name === e && (!a || o.schema === a));
2576
2599
  }, 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,
2600
+ return !!await c(this, h).db.withPlugin(c(this, i, C)).selectFrom(c(this, i, D)).where("id", "=", Q).select("id").executeTakeFirst();
2601
+ }, De = async function(e) {
2602
+ const a = c(this, h).db.getExecutor().adapter, n = g({
2603
+ lockTable: c(this, h).migrationLockTableName ?? fe,
2581
2604
  lockRowId: Q,
2582
- lockTableSchema: d(this, _).migrationTableSchema
2605
+ lockTableSchema: c(this, h).migrationTableSchema
2583
2606
  }), o = async (r) => {
2584
2607
  try {
2585
2608
  await a.acquireMigrationLock(r, n);
2586
- const s = await u(this, i, De).call(this, r);
2609
+ const s = await u(this, i, Ie).call(this, r);
2587
2610
  if (s.migrations.length === 0)
2588
2611
  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: [] };
2612
+ const { direction: d, step: l } = e(s);
2613
+ 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
2614
  } finally {
2592
2615
  await a.releaseMigrationLock(r, n);
2593
2616
  }
2594
2617
  };
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);
2618
+ return a.supportsTransactionalDdl ? c(this, h).db.transaction().execute(o) : c(this, h).db.connection().execute(o);
2619
+ }, Ie = async function(e) {
2620
+ const a = await u(this, i, Y).call(this), n = await u(this, i, Pe).call(this, e);
2621
+ u(this, i, Me).call(this, a, n), c(this, i, xe) || u(this, i, Fe).call(this, a, n);
2622
+ const o = u(this, i, je).call(this, a, n);
2600
2623
  return g({
2601
2624
  migrations: a,
2602
2625
  executedMigrations: n,
2603
2626
  lastMigration: Aa(n),
2604
2627
  pendingMigrations: o
2605
2628
  });
2606
- }, Ie = function(e, a) {
2629
+ }, je = function(e, a) {
2607
2630
  return e.filter((n) => !a.includes(n.name));
2608
2631
  }, Y = async function() {
2609
- const e = await d(this, _).provider.getMigrations();
2632
+ const e = await c(this, h).provider.getMigrations();
2610
2633
  return Object.keys(e).sort().map((a) => ({
2611
2634
  ...e[a],
2612
2635
  name: a
2613
2636
  }));
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) {
2637
+ }, Pe = async function(e) {
2638
+ return (await e.withPlugin(c(this, i, C)).selectFrom(c(this, i, N)).select("name").orderBy(["timestamp", "name"]).execute()).map((n) => n.name);
2639
+ }, Me = function(e, a) {
2617
2640
  for (const n of a)
2618
2641
  if (!e.some((o) => o.name === n))
2619
2642
  throw new Error(`corrupted migrations: previously executed migration ${n} is missing`);
2620
- }, Me = function(e, a) {
2643
+ }, Fe = function(e, a) {
2621
2644
  for (let n = 0; n < a.length; ++n)
2622
2645
  if (e[n].name !== a[n])
2623
2646
  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) => ({
2647
+ }, Ae = async function(e, a, n) {
2648
+ const o = a.executedMigrations.slice().reverse().slice(0, n).map((s) => a.migrations.find((d) => d.name === s)), r = o.map((s) => ({
2626
2649
  migrationName: s.name,
2627
2650
  direction: "Down",
2628
2651
  status: "NotExecuted"
2629
2652
  }));
2630
2653
  for (let s = 0; s < r.length; ++s) {
2631
- const c = o[s];
2654
+ const d = o[s];
2632
2655
  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,
2656
+ 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] = {
2657
+ migrationName: d.name,
2635
2658
  direction: "Down",
2636
2659
  status: "Success"
2637
2660
  });
2638
2661
  } catch (l) {
2639
2662
  throw r[s] = {
2640
- migrationName: c.name,
2663
+ migrationName: d.name,
2641
2664
  direction: "Down",
2642
2665
  status: "Error"
2643
2666
  }, new q({
@@ -2647,26 +2670,26 @@ _ = new WeakMap(), i = new WeakSet(), A = async function(e) {
2647
2670
  }
2648
2671
  }
2649
2672
  return { results: r };
2650
- }, Ae = async function(e, a, n) {
2673
+ }, ze = async function(e, a, n) {
2651
2674
  const r = a.pendingMigrations.slice(0, n).map((s) => ({
2652
2675
  migrationName: s.name,
2653
2676
  direction: "Up",
2654
2677
  status: "NotExecuted"
2655
2678
  }));
2656
2679
  for (let s = 0; s < r.length; s++) {
2657
- const c = a.pendingMigrations[s];
2680
+ const d = a.pendingMigrations[s];
2658
2681
  try {
2659
- await c.up(e), await e.withPlugin(d(this, i, C)).insertInto(d(this, i, N)).values({
2660
- name: c.name,
2682
+ await d.up(e), await e.withPlugin(c(this, i, C)).insertInto(c(this, i, N)).values({
2683
+ name: d.name,
2661
2684
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
2662
2685
  }).execute(), r[s] = {
2663
- migrationName: c.name,
2686
+ migrationName: d.name,
2664
2687
  direction: "Up",
2665
2688
  status: "Success"
2666
2689
  };
2667
2690
  } catch (l) {
2668
2691
  throw r[s] = {
2669
- migrationName: c.name,
2692
+ migrationName: d.name,
2670
2693
  direction: "Up",
2671
2694
  status: "Error"
2672
2695
  }, new q({
@@ -2676,8 +2699,8 @@ _ = new WeakMap(), i = new WeakSet(), A = async function(e) {
2676
2699
  }
2677
2700
  }
2678
2701
  return { results: r };
2679
- }, L = async function(e) {
2680
- d(this, _).db.getExecutor().adapter.supportsCreateIfNotExists && (e = e.ifNotExists()), await e.execute();
2702
+ }, z = async function(e) {
2703
+ c(this, h).db.getExecutor().adapter.supportsCreateIfNotExists && (e = e.ifNotExists()), await e.execute();
2681
2704
  };
2682
2705
  var J;
2683
2706
  class q extends Error {
@@ -2687,7 +2710,7 @@ class q extends Error {
2687
2710
  F(this, J, a);
2688
2711
  }
2689
2712
  get resultSet() {
2690
- return d(this, J);
2713
+ return c(this, J);
2691
2714
  }
2692
2715
  }
2693
2716
  J = new WeakMap();
@@ -2851,12 +2874,12 @@ async function ln(t) {
2851
2874
  (e) => e.references("applications.id").onDelete("cascade").notNull()
2852
2875
  ).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
2876
  }
2854
- async function cn(t) {
2877
+ async function dn(t) {
2855
2878
  await t.schema.dropTable("sessions").execute(), await t.schema.dropTable("tickets").execute(), await t.schema.dropTable("otps").execute();
2856
2879
  }
2857
- const dn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2880
+ const cn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2858
2881
  __proto__: null,
2859
- down: cn,
2882
+ down: dn,
2860
2883
  up: ln
2861
2884
  }, Symbol.toStringTag, { value: "Module" }));
2862
2885
  async function un(t) {
@@ -2877,19 +2900,19 @@ async function un(t) {
2877
2900
  async function mn(t) {
2878
2901
  await t.schema.dropTable("passwords").execute(), await t.schema.dropTable("codes").execute();
2879
2902
  }
2880
- const hn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2903
+ const _n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2881
2904
  __proto__: null,
2882
2905
  down: mn,
2883
2906
  up: un
2884
2907
  }, Symbol.toStringTag, { value: "Module" }));
2885
- async function _n(t) {
2908
+ async function hn(t) {
2886
2909
  }
2887
2910
  async function fn(t) {
2888
2911
  }
2889
2912
  const pn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2890
2913
  __proto__: null,
2891
2914
  down: fn,
2892
- up: _n
2915
+ up: hn
2893
2916
  }, Symbol.toStringTag, { value: "Module" }));
2894
2917
  async function gn(t) {
2895
2918
  await t.schema.alterTable("passwords").addColumn(
@@ -2962,12 +2985,12 @@ async function Fn(t) {
2962
2985
  async function An(t) {
2963
2986
  await t.schema.dropIndex("users_linked_to_index");
2964
2987
  }
2965
- const Ln = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2988
+ const zn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2966
2989
  __proto__: null,
2967
2990
  down: An,
2968
2991
  up: Fn
2969
2992
  }, Symbol.toStringTag, { value: "Module" }));
2970
- async function zn(t) {
2993
+ async function Ln(t) {
2971
2994
  await t.schema.alterTable("users").addColumn("locale", "varchar(255)").execute();
2972
2995
  }
2973
2996
  async function Jn(t) {
@@ -2976,7 +2999,7 @@ async function Jn(t) {
2976
2999
  const En = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2977
3000
  __proto__: null,
2978
3001
  down: Jn,
2979
- up: zn
3002
+ up: Ln
2980
3003
  }, Symbol.toStringTag, { value: "Module" }));
2981
3004
  async function Kn(t) {
2982
3005
  await t.schema.createTable("keys").addColumn("kid", "varchar(255)", (e) => e.primaryKey()).addColumn(
@@ -2988,19 +3011,19 @@ async function Kn(t) {
2988
3011
  async function Rn(t) {
2989
3012
  await t.schema.dropTable("keys").execute();
2990
3013
  }
2991
- const Un = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3014
+ const Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2992
3015
  __proto__: null,
2993
3016
  down: Rn,
2994
3017
  up: Kn
2995
3018
  }, Symbol.toStringTag, { value: "Module" }));
2996
- async function Bn(t) {
3019
+ async function Un(t) {
2997
3020
  }
2998
3021
  async function Qn(t) {
2999
3022
  }
3000
3023
  const qn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3001
3024
  __proto__: null,
3002
3025
  down: Qn,
3003
- up: Bn
3026
+ up: Un
3004
3027
  }, Symbol.toStringTag, { value: "Module" }));
3005
3028
  async function Vn(t) {
3006
3029
  }
@@ -3056,12 +3079,12 @@ const ir = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3056
3079
  async function lr(t) {
3057
3080
  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
3081
  }
3059
- async function cr(t) {
3082
+ async function dr(t) {
3060
3083
  await t.schema.dropIndex("logs_user_id"), await t.schema.dropIndex("logs_tenant_id"), await t.schema.dropIndex("logs_date");
3061
3084
  }
3062
- const dr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3085
+ const cr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3063
3086
  __proto__: null,
3064
- down: cr,
3087
+ down: dr,
3065
3088
  up: lr
3066
3089
  }, Symbol.toStringTag, { value: "Module" }));
3067
3090
  async function ur(t) {
@@ -3070,12 +3093,12 @@ async function ur(t) {
3070
3093
  async function mr(t) {
3071
3094
  await t.schema.alterTable("logs").dropColumn("details").execute(), await t.schema.alterTable("logs").addColumn("details", "varchar(2048)").execute();
3072
3095
  }
3073
- const hr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3096
+ const _r = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3074
3097
  __proto__: null,
3075
3098
  down: mr,
3076
3099
  up: ur
3077
3100
  }, Symbol.toStringTag, { value: "Module" }));
3078
- async function _r(t) {
3101
+ async function hr(t) {
3079
3102
  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
3103
  }
3081
3104
  async function fr(t) {
@@ -3084,7 +3107,7 @@ async function fr(t) {
3084
3107
  const pr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3085
3108
  __proto__: null,
3086
3109
  down: fr,
3087
- up: _r
3110
+ up: hr
3088
3111
  }, Symbol.toStringTag, { value: "Module" }));
3089
3112
  async function gr(t) {
3090
3113
  await t.schema.createIndex("users_name_index").on("users").column("name").execute();
@@ -3157,30 +3180,30 @@ async function Fr(t) {
3157
3180
  }
3158
3181
  async function Ar(t) {
3159
3182
  }
3160
- const Lr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3183
+ const zr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3161
3184
  __proto__: null,
3162
3185
  down: Ar,
3163
3186
  up: Fr
3164
3187
  }, Symbol.toStringTag, { value: "Module" }));
3165
- async function zr(t) {
3188
+ async function Lr(t) {
3166
3189
  }
3167
3190
  async function Jr(t) {
3168
3191
  }
3169
3192
  const Er = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3170
3193
  __proto__: null,
3171
3194
  down: Jr,
3172
- up: zr
3195
+ up: Lr
3173
3196
  }, Symbol.toStringTag, { value: "Module" }));
3174
3197
  async function Kr(t) {
3175
3198
  }
3176
3199
  async function Rr(t) {
3177
3200
  }
3178
- const Ur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3201
+ const Br = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3179
3202
  __proto__: null,
3180
3203
  down: Rr,
3181
3204
  up: Kr
3182
3205
  }, Symbol.toStringTag, { value: "Module" }));
3183
- async function Br(t) {
3206
+ async function Ur(t) {
3184
3207
  await t.schema.createTable("authentication_codes").addColumn(
3185
3208
  "tenant_id",
3186
3209
  "varchar(255)",
@@ -3197,7 +3220,7 @@ async function Qr(t) {
3197
3220
  const qr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3198
3221
  __proto__: null,
3199
3222
  down: Qr,
3200
- up: Br
3223
+ up: Ur
3201
3224
  }, Symbol.toStringTag, { value: "Module" }));
3202
3225
  async function Vr(t) {
3203
3226
  }
@@ -3269,11 +3292,11 @@ const uo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3269
3292
  }, Symbol.toStringTag, { value: "Module" }));
3270
3293
  async function mo(t) {
3271
3294
  }
3272
- async function ho(t) {
3295
+ async function _o(t) {
3273
3296
  }
3274
- const _o = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3297
+ const ho = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3275
3298
  __proto__: null,
3276
- down: ho,
3299
+ down: _o,
3277
3300
  up: mo
3278
3301
  }, Symbol.toStringTag, { value: "Module" }));
3279
3302
  async function fo(t) {
@@ -3369,11 +3392,11 @@ const Fo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3369
3392
  }, Symbol.toStringTag, { value: "Module" }));
3370
3393
  async function Ao(t) {
3371
3394
  }
3372
- async function Lo(t) {
3395
+ async function zo(t) {
3373
3396
  }
3374
- const zo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3397
+ const Lo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3375
3398
  __proto__: null,
3376
- down: Lo,
3399
+ down: zo,
3377
3400
  up: Ao
3378
3401
  }, Symbol.toStringTag, { value: "Module" }));
3379
3402
  async function Jo(t) {
@@ -3401,7 +3424,7 @@ async function Ro(t) {
3401
3424
  "code_type"
3402
3425
  ]).execute();
3403
3426
  }
3404
- async function Uo(t) {
3427
+ async function Bo(t) {
3405
3428
  await t.schema.dropTable("codes").execute(), await t.schema.createTable("codes").addColumn("code_id", "varchar(255)", (e) => e.primaryKey()).addColumn(
3406
3429
  "tenant_id",
3407
3430
  "varchar(255)",
@@ -3414,9 +3437,9 @@ async function Uo(t) {
3414
3437
  (e) => e.onDelete("cascade")
3415
3438
  ).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();
3416
3439
  }
3417
- const Bo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3440
+ const Uo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3418
3441
  __proto__: null,
3419
- down: Uo,
3442
+ down: Bo,
3420
3443
  up: Ro
3421
3444
  }, Symbol.toStringTag, { value: "Module" }));
3422
3445
  async function Qo(t) {
@@ -3511,24 +3534,24 @@ const ls = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3511
3534
  down: is,
3512
3535
  up: ss
3513
3536
  }, Symbol.toStringTag, { value: "Module" }));
3514
- async function cs(t) {
3515
- }
3516
3537
  async function ds(t) {
3517
3538
  }
3539
+ async function cs(t) {
3540
+ }
3518
3541
  const us = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3519
3542
  __proto__: null,
3520
- down: ds,
3521
- up: cs
3543
+ down: cs,
3544
+ up: ds
3522
3545
  }, Symbol.toStringTag, { value: "Module" }));
3523
3546
  async function ms(t) {
3524
3547
  await t.schema.alterTable("logins").addColumn("authParams_ui_locales", "varchar(32)").execute();
3525
3548
  }
3526
- async function hs(t) {
3549
+ async function _s(t) {
3527
3550
  await t.schema.alterTable("logins").dropColumn("authParams_ui_locales").execute();
3528
3551
  }
3529
- const _s = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3552
+ const hs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3530
3553
  __proto__: null,
3531
- down: hs,
3554
+ down: _s,
3532
3555
  up: ms
3533
3556
  }, Symbol.toStringTag, { value: "Module" }));
3534
3557
  async function fs(t) {
@@ -3634,12 +3657,12 @@ async function As(t) {
3634
3657
  (e) => e.onDelete("cascade")
3635
3658
  ).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
3659
  }
3637
- async function Ls(t) {
3660
+ async function zs(t) {
3638
3661
  await t.schema.dropTable("refresh_tokens").execute();
3639
3662
  }
3640
- const zs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3663
+ const Ls = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3641
3664
  __proto__: null,
3642
- down: Ls,
3665
+ down: zs,
3643
3666
  up: As
3644
3667
  }, Symbol.toStringTag, { value: "Module" }));
3645
3668
  async function Js(t) {
@@ -3654,7 +3677,7 @@ const Ks = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3654
3677
  async function Rs(t) {
3655
3678
  await t.schema.dropTable("sessions").execute(), await t.schema.dropTable("refresh_tokens").execute();
3656
3679
  }
3657
- async function Us(t) {
3680
+ async function Bs(t) {
3658
3681
  await t.schema.createTable("sessions").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addForeignKeyConstraint(
3659
3682
  "sessions_user_id_constraint",
3660
3683
  ["user_id", "tenant_id"],
@@ -3673,9 +3696,9 @@ async function Us(t) {
3673
3696
  (e) => e.onDelete("cascade")
3674
3697
  ).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();
3675
3698
  }
3676
- const Bs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3699
+ const Us = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3677
3700
  __proto__: null,
3678
- down: Us,
3701
+ down: Bs,
3679
3702
  up: Rs
3680
3703
  }, Symbol.toStringTag, { value: "Module" }));
3681
3704
  async function Qs(t) {
@@ -3793,15 +3816,15 @@ const li = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3793
3816
  down: ii,
3794
3817
  up: si
3795
3818
  }, Symbol.toStringTag, { value: "Module" }));
3796
- async function ci(t) {
3819
+ async function di(t) {
3797
3820
  await t.schema.dropTable("logins").execute(), await t.schema.dropTable("sessions_2").execute(), await t.schema.dropTable("refresh_tokens_2").execute();
3798
3821
  }
3799
- async function di(t) {
3822
+ async function ci(t) {
3800
3823
  }
3801
3824
  const ui = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3802
3825
  __proto__: null,
3803
- down: di,
3804
- up: ci
3826
+ down: ci,
3827
+ up: di
3805
3828
  }, Symbol.toStringTag, { value: "Module" }));
3806
3829
  async function mi(t) {
3807
3830
  await t.schema.dropTable("custom_domains").execute(), await t.schema.createTable("custom_domains").addColumn(
@@ -3814,11 +3837,11 @@ async function mi(t) {
3814
3837
  (e) => e.references("tenants.id").onDelete("cascade").notNull()
3815
3838
  ).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
3839
  }
3817
- async function hi(t) {
3840
+ async function _i(t) {
3818
3841
  }
3819
- const _i = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3842
+ const hi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3820
3843
  __proto__: null,
3821
- down: hi,
3844
+ down: _i,
3822
3845
  up: mi
3823
3846
  }, Symbol.toStringTag, { value: "Module" }));
3824
3847
  async function fi(t) {
@@ -3908,12 +3931,12 @@ const Fi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3908
3931
  async function Ai(t) {
3909
3932
  await t.schema.alterTable("codes").addColumn("redirect_uri", "varchar(1024)").execute();
3910
3933
  }
3911
- async function Li(t) {
3934
+ async function zi(t) {
3912
3935
  await t.schema.alterTable("codes").dropColumn("redirect_uri").execute();
3913
3936
  }
3914
- const zi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3937
+ const Li = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3915
3938
  __proto__: null,
3916
- down: Li,
3939
+ down: zi,
3917
3940
  up: Ai
3918
3941
  }, Symbol.toStringTag, { value: "Module" }));
3919
3942
  async function Ji(t) {
@@ -3926,14 +3949,97 @@ const Ki = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3926
3949
  __proto__: null,
3927
3950
  down: Ei,
3928
3951
  up: Ji
3929
- }, Symbol.toStringTag, { value: "Module" })), ze = {
3952
+ }, Symbol.toStringTag, { value: "Module" }));
3953
+ async function Ri(t) {
3954
+ await t.schema.createTable("themes").addColumn(
3955
+ "tenant_id",
3956
+ "varchar(255)",
3957
+ (e) => e.references("tenants.id").onDelete("cascade").notNull()
3958
+ ).addColumn("themeId", "varchar(255)", (e) => e.notNull()).addColumn("displayName", "varchar(255)", (e) => e.notNull()).addColumn(
3959
+ "colors_primary_button_label",
3960
+ "varchar(24)",
3961
+ (e) => e.notNull()
3962
+ ).addColumn("colors_primary_button", "varchar(24)", (e) => e.notNull()).addColumn(
3963
+ "colors_secondary_button_border",
3964
+ "varchar(24)",
3965
+ (e) => e.notNull()
3966
+ ).addColumn(
3967
+ "colors_secondary_button_label",
3968
+ "varchar(24)",
3969
+ (e) => e.notNull()
3970
+ ).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(
3971
+ "colors_captcha_widget_theme",
3972
+ "varchar(24)",
3973
+ (e) => e.notNull()
3974
+ ).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(
3975
+ "colors_input_filled_text",
3976
+ "varchar(24)",
3977
+ (e) => e.notNull()
3978
+ ).addColumn(
3979
+ "colors_input_labels_placeholders",
3980
+ "varchar(24)",
3981
+ (e) => e.notNull()
3982
+ ).addColumn(
3983
+ "colors_links_focused_components",
3984
+ "varchar(24)",
3985
+ (e) => e.notNull()
3986
+ ).addColumn("colors_success", "varchar(24)", (e) => e.notNull()).addColumn(
3987
+ "colors_widget_background",
3988
+ "varchar(24)",
3989
+ (e) => e.notNull()
3990
+ ).addColumn("colors_widget_border", "varchar(24)", (e) => e.notNull()).addColumn(
3991
+ "borders_button_border_radius",
3992
+ "integer",
3993
+ (e) => e.notNull()
3994
+ ).addColumn(
3995
+ "borders_button_border_weight",
3996
+ "integer",
3997
+ (e) => e.notNull()
3998
+ ).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", "boolean", (e) => e.notNull()).addColumn(
3999
+ "borders_widget_border_weight",
4000
+ "integer",
4001
+ (e) => e.notNull()
4002
+ ).addColumn(
4003
+ "borders_widget_corner_radius",
4004
+ "integer",
4005
+ (e) => e.notNull()
4006
+ ).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", "boolean", (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", "boolean", (e) => e.notNull()).addColumn("fonts_subtitle_size", "integer", (e) => e.notNull()).addColumn("fonts_title_bold", "boolean", (e) => e.notNull()).addColumn("fonts_title_size", "integer", (e) => e.notNull()).addColumn(
4007
+ "page_background_background_color",
4008
+ "varchar(24)",
4009
+ (e) => e.notNull()
4010
+ ).addColumn(
4011
+ "page_background_background_image_url",
4012
+ "varchar(255)",
4013
+ (e) => e.notNull()
4014
+ ).addColumn(
4015
+ "page_background_page_layout",
4016
+ "varchar(24)",
4017
+ (e) => e.notNull()
4018
+ ).addColumn(
4019
+ "widget_header_text_alignment",
4020
+ "varchar(24)",
4021
+ (e) => e.notNull()
4022
+ ).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(
4023
+ "widget_social_buttons_layout",
4024
+ "varchar(24)",
4025
+ (e) => e.notNull()
4026
+ ).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();
4027
+ }
4028
+ async function Bi(t) {
4029
+ await t.schema.dropTable("themes").execute();
4030
+ }
4031
+ const Ui = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4032
+ __proto__: null,
4033
+ down: Bi,
4034
+ up: Ri
4035
+ }, Symbol.toStringTag, { value: "Module" })), Je = {
3930
4036
  m1_init: Wa,
3931
4037
  m2_magicLink: Xa,
3932
4038
  m3_updateAt: en,
3933
4039
  m4_logTable: nn,
3934
4040
  m5_userProfile: sn,
3935
- m6_sessions: dn,
3936
- m7_passwords: hn,
4041
+ m6_sessions: cn,
4042
+ m7_passwords: _n,
3937
4043
  m8_logsTableNewFields: pn,
3938
4044
  m9_passwordTableNewField: wn,
3939
4045
  n01_codesTable: Cn,
@@ -3941,17 +4047,17 @@ const Ki = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3941
4047
  n12_userFields: kn,
3942
4048
  n13_userEmailIndex: In,
3943
4049
  n14_profileDataField: Mn,
3944
- n15_userEmailIndex: Ln,
4050
+ n15_userEmailIndex: zn,
3945
4051
  n16_userLocale: En,
3946
- n17_signingKeys: Un,
4052
+ n17_signingKeys: Bn,
3947
4053
  n18_logsFields: qn,
3948
4054
  n19_connectionsUserinfo: Gn,
3949
4055
  n20_missingFields: Yn,
3950
4056
  n21_sessionDeletedAt: tr,
3951
4057
  n22_dropLogsFields: rr,
3952
4058
  n23_dropUsersFields: ir,
3953
- n24_logsIndexes: dr,
3954
- n25_logDescMaxLength: hr,
4059
+ n24_logsIndexes: cr,
4060
+ n25_logDescMaxLength: _r,
3955
4061
  n26_logsTableExtraFields: pr,
3956
4062
  n27_usersTableNameIndex: wr,
3957
4063
  n28_usersEmailConstrain: Cr,
@@ -3959,9 +4065,9 @@ const Ki = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3959
4065
  n30_increaseTicketStateLength: kr,
3960
4066
  n31_branding: Ir,
3961
4067
  n32_indexesAndNotNull: Mr,
3962
- n33_vendorIdInUniversalLoginSession: Lr,
4068
+ n33_vendorIdInUniversalLoginSession: zr,
3963
4069
  n34_auth0ClientInUniversalLoginSession: Er,
3964
- n35_increaseUniversalSessionStateLength: Ur,
4070
+ n35_increaseUniversalSessionStateLength: Br,
3965
4071
  n36_authenticationCodes: qr,
3966
4072
  n37_disableSignUps: Gr,
3967
4073
  n38_otpIpAddress: Yr,
@@ -3969,7 +4075,7 @@ const Ki = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3969
4075
  n40_userId: ro,
3970
4076
  n41_hooks: io,
3971
4077
  n42_userIdIndexes: uo,
3972
- n43_userIdIndexes: _o,
4078
+ n43_userIdIndexes: ho,
3973
4079
  n44_codes: go,
3974
4080
  n45_hookProperties: vo,
3975
4081
  n46_loginAuth0Client: bo,
@@ -3977,9 +4083,9 @@ const Ki = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3977
4083
  n48_saml: $o,
3978
4084
  n49_removeFields: jo,
3979
4085
  n50_authParamsNonce: Fo,
3980
- n51_connectionid: zo,
4086
+ n51_connectionid: Lo,
3981
4087
  n52_cert: Ko,
3982
- n53_codes_primary_key: Bo,
4088
+ n53_codes_primary_key: Uo,
3983
4089
  n54_cleanup_tables: Vo,
3984
4090
  n55_logs_index: Ho,
3985
4091
  n56_application_fields: Zo,
@@ -3987,7 +4093,7 @@ const Ki = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3987
4093
  n58_connection_client_id: os,
3988
4094
  n59_connection_options: ls,
3989
4095
  n60_users_metadata: us,
3990
- n61_userLocales: _s,
4096
+ n61_userLocales: hs,
3991
4097
  n62_prompt: gs,
3992
4098
  n63_connection_cleanup: vs,
3993
4099
  n64_act_as: bs,
@@ -3995,9 +4101,9 @@ const Ki = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3995
4101
  n66_email_providers: $s,
3996
4102
  n67_drop_tickets: js,
3997
4103
  n68_login_useragents: Fs,
3998
- n70_refresh_tokens: zs,
4104
+ n70_refresh_tokens: Ls,
3999
4105
  n71_session_new_fields: Ks,
4000
- n72_session_primary_key: Bs,
4106
+ n72_session_primary_key: Us,
4001
4107
  n73_drop_sessions: Vs,
4002
4108
  n74_custom_domains: Hs,
4003
4109
  n75_organizations: Zs,
@@ -4005,7 +4111,7 @@ const Ki = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4005
4111
  n77_drop_sessions: oi,
4006
4112
  n78_login_sessions: li,
4007
4113
  n79_drop_sessions_2: ui,
4008
- n80_recreate_custom_domains: _i,
4114
+ n80_recreate_custom_domains: hi,
4009
4115
  n81_phone: gi,
4010
4116
  n82_forms: vi,
4011
4117
  n83_addFormsIdToHooks: bi,
@@ -4013,12 +4119,13 @@ const Ki = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4013
4119
  n85_add_login_session_id_to_sessions: $i,
4014
4120
  n86_index_sessions_login_session_id: ji,
4015
4121
  n87_code_challenge: Fi,
4016
- n88_add_redirect_uri_to_codes: zi,
4017
- n89_add_nonce_and_state_to_codes: Ki
4122
+ n88_add_redirect_uri_to_codes: Li,
4123
+ n89_add_nonce_and_state_to_codes: Ki,
4124
+ n90_themes: Ui
4018
4125
  };
4019
- async function qi(t, e = !1) {
4126
+ async function Gi(t, e = !1) {
4020
4127
  e && console.log("migrating...");
4021
- const a = new Le(ze), n = new Ce({
4128
+ const a = new Le(Je), n = new be({
4022
4129
  db: t,
4023
4130
  provider: a
4024
4131
  }), { error: o, results: r } = await n.migrateToLatest();
@@ -4029,9 +4136,9 @@ async function qi(t, e = !1) {
4029
4136
  }), o)
4030
4137
  throw console.error("failed to migrate"), console.error(o), o;
4031
4138
  }
4032
- async function Vi(t) {
4139
+ async function Hi(t) {
4033
4140
  console.log("migrating...");
4034
- const e = new Le(ze), a = new Ce({
4141
+ const e = new Le(Je), a = new be({
4035
4142
  db: t,
4036
4143
  provider: e
4037
4144
  }), { error: n, results: o } = await a.migrateDown();
@@ -4040,32 +4147,32 @@ async function Vi(t) {
4040
4147
  }), n)
4041
4148
  throw console.error("failed to migrate"), console.error(n), n;
4042
4149
  }
4043
- function Wi(t) {
4150
+ function Xi(t) {
4044
4151
  return {
4045
4152
  applications: jt(t),
4046
4153
  branding: Zt(t),
4047
4154
  cleanup: $a(t),
4048
4155
  clients: Jt(t),
4049
4156
  codes: St(t),
4050
- connections: zt(t),
4157
+ connections: Lt(t),
4051
4158
  emailProviders: Ca(t),
4052
4159
  customDomains: Ht(t),
4053
4160
  forms: Fa(t),
4054
4161
  hooks: oa(t),
4055
- keys: Ut(t),
4162
+ keys: Bt(t),
4056
4163
  loginSessions: fa(t),
4057
- logs: dt(t),
4164
+ logs: ct(t),
4058
4165
  passwords: vt(t),
4059
4166
  promptSettings: ya(t),
4060
4167
  refreshTokens: ka(t),
4061
4168
  sessions: pt(t),
4062
4169
  tenants: ot(t),
4063
- themes: da(t),
4170
+ themes: ca(t),
4064
4171
  users: Ye(t)
4065
4172
  };
4066
4173
  }
4067
4174
  export {
4068
- Wi as default,
4069
- Vi as migrateDown,
4070
- qi as migrateToLatest
4175
+ Xi as default,
4176
+ Hi as migrateDown,
4177
+ Gi as migrateToLatest
4071
4178
  };