@authhero/kysely-adapter 10.61.0 → 10.63.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.
@@ -4,7 +4,7 @@ var Tn = (t) => {
4
4
  };
5
5
  var Ba = (t, e, n) => e in t ? qa(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
6
6
  var ie = (t, e, n) => Ba(t, typeof e != "symbol" ? e + "" : e, n), Qt = (t, e, n) => e.has(t) || Tn("Cannot " + n);
7
- var i = (t, e, n) => (Qt(t, e, "read from private field"), n ? n.call(t) : e.get(t)), C = (t, e, n) => e.has(t) ? Tn("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), b = (t, e, n, a) => (Qt(t, e, "write to private field"), a ? a.call(t, n) : e.set(t, n), n), y = (t, e, n) => (Qt(t, e, "access private method"), n);
7
+ var i = (t, e, n) => (Qt(t, e, "read from private field"), n ? n.call(t) : e.get(t)), C = (t, e, n) => e.has(t) ? Tn("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), b = (t, e, n, a) => (Qt(t, e, "write to private field"), a ? a.call(t, n) : e.set(t, n), n), w = (t, e, n) => (Qt(t, e, "access private method"), n);
8
8
  import { parseUserId as pn, codeSchema as Wa, connectionSchema as Ka, loginSessionSchema as Ua, promptSettingSchema as Qa, formSchema as Tt, resourceServerSchema as Va } from "@authhero/adapter-interfaces";
9
9
  import "@hono/zod-openapi";
10
10
  var et = class extends Error {
@@ -96,7 +96,7 @@ function Ya(t) {
96
96
  ]);
97
97
  if (!a)
98
98
  return null;
99
- const { tenant_id: o, ...u } = a, d = {
99
+ const { tenant_id: o, ...u } = a, c = {
100
100
  ...u,
101
101
  email: a.email || "",
102
102
  email_verified: a.email_verified === 1,
@@ -113,51 +113,51 @@ function Ya(t) {
113
113
  ...r.map(Vn)
114
114
  ]
115
115
  };
116
- return T(d);
116
+ return T(c);
117
117
  };
118
118
  }
119
119
  function J(t, e, n, a) {
120
120
  const r = [];
121
121
  let o = "", u = !1;
122
- for (let c = 0; c < n.length; c++) {
123
- const h = n[c];
122
+ for (let d = 0; d < n.length; d++) {
123
+ const h = n[d];
124
124
  h === '"' ? (u = !u, o += h) : h === " " && !u ? o.trim() && (r.push(o.trim()), o = "") : o += h;
125
125
  }
126
- return o.trim() && r.push(o.trim()), r.map((c) => c.replace(/^([^:]+)=/g, "$1:")).map((c) => {
127
- let h = c.startsWith("-"), p = null, l = "", w = !1, f;
128
- if (c.startsWith("-_exists_:"))
129
- p = c.substring(10), w = !0, h = !0;
130
- else if (c.startsWith("_exists_:"))
131
- p = c.substring(9), w = !0, h = !1;
132
- else if (c.includes(":")) {
133
- const v = h ? c.substring(1) : c, x = v.indexOf(":");
134
- p = v.substring(0, x), l = v.substring(x + 1), w = !1, l.startsWith(">=") ? (f = ">=", l = l.substring(2)) : l.startsWith(">") ? (f = ">", l = l.substring(1)) : l.startsWith("<=") ? (f = "<=", l = l.substring(2)) : l.startsWith("<") ? (f = "<", l = l.substring(1)) : f = "=", l.startsWith('"') && l.endsWith('"') && l.length > 1 && (l = l.slice(1, -1));
126
+ return o.trim() && r.push(o.trim()), r.map((d) => d.replace(/^([^:]+)=/g, "$1:")).map((d) => {
127
+ let h = d.startsWith("-"), g = null, l = "", y = !1, f;
128
+ if (d.startsWith("-_exists_:"))
129
+ g = d.substring(10), y = !0, h = !0;
130
+ else if (d.startsWith("_exists_:"))
131
+ g = d.substring(9), y = !0, h = !1;
132
+ else if (d.includes(":")) {
133
+ const v = h ? d.substring(1) : d, x = v.indexOf(":");
134
+ g = v.substring(0, x), l = v.substring(x + 1), y = !1, l.startsWith(">=") ? (f = ">=", l = l.substring(2)) : l.startsWith(">") ? (f = ">", l = l.substring(1)) : l.startsWith("<=") ? (f = "<=", l = l.substring(2)) : l.startsWith("<") ? (f = "<", l = l.substring(1)) : f = "=", l.startsWith('"') && l.endsWith('"') && l.length > 1 && (l = l.slice(1, -1));
135
135
  } else
136
- p = null, l = c, w = !1;
137
- return { key: p, value: l, isNegation: h, isExistsQuery: w, operator: f };
138
- }).forEach(({ key: c, value: h, isNegation: p, isExistsQuery: l, operator: w }) => {
139
- if (c)
136
+ g = null, l = d, y = !1;
137
+ return { key: g, value: l, isNegation: h, isExistsQuery: y, operator: f };
138
+ }).forEach(({ key: d, value: h, isNegation: g, isExistsQuery: l, operator: y }) => {
139
+ if (d)
140
140
  if (l)
141
- p ? e = e.where(c, "is", null) : e = e.where(c, "is not", null);
142
- else if (p)
143
- switch (w) {
141
+ g ? e = e.where(d, "is", null) : e = e.where(d, "is not", null);
142
+ else if (g)
143
+ switch (y) {
144
144
  case ">":
145
- e = e.where(c, "<=", h);
145
+ e = e.where(d, "<=", h);
146
146
  break;
147
147
  case ">=":
148
- e = e.where(c, "<", h);
148
+ e = e.where(d, "<", h);
149
149
  break;
150
150
  case "<":
151
- e = e.where(c, ">=", h);
151
+ e = e.where(d, ">=", h);
152
152
  break;
153
153
  case "<=":
154
- e = e.where(c, ">", h);
154
+ e = e.where(d, ">", h);
155
155
  break;
156
156
  default:
157
- e = e.where(c, "!=", h);
157
+ e = e.where(d, "!=", h);
158
158
  }
159
159
  else
160
- e = e.where(c, w, h);
160
+ e = e.where(d, y, h);
161
161
  else if (h) {
162
162
  const { ref: f } = t.dynamic;
163
163
  e = e.where(
@@ -173,14 +173,14 @@ function j(t) {
173
173
  }
174
174
  function Ha(t) {
175
175
  return async (e, n = {}) => {
176
- const { page: a = 0, per_page: r = 50, include_totals: o = !1, sort: u, q: d } = n;
177
- let c = t.selectFrom("users").where("users.tenant_id", "=", e);
178
- if (d && (c = J(t, c, d, ["email", "name", "phone_number"])), u && u.sort_by) {
176
+ const { page: a = 0, per_page: r = 50, include_totals: o = !1, sort: u, q: c } = n;
177
+ let d = t.selectFrom("users").where("users.tenant_id", "=", e);
178
+ if (c && (d = J(t, d, c, ["email", "name", "phone_number"])), u && u.sort_by) {
179
179
  const { ref: x } = t.dynamic;
180
- c = c.orderBy(x(u.sort_by), u.sort_order);
180
+ d = d.orderBy(x(u.sort_by), u.sort_order);
181
181
  }
182
- const p = await c.offset(a * r).limit(r).selectAll().execute(), l = p.map((x) => x.user_id), w = l.length ? await t.selectFrom("users").selectAll().where("users.tenant_id", "=", e).where("users.linked_to", "in", l).execute() : [], f = p.map((x) => {
183
- const E = w.filter(
182
+ const g = await d.offset(a * r).limit(r).selectAll().execute(), l = g.map((x) => x.user_id), y = l.length ? await t.selectFrom("users").selectAll().where("users.tenant_id", "=", e).where("users.linked_to", "in", l).execute() : [], f = g.map((x) => {
183
+ const E = y.filter(
184
184
  (z) => z.linked_to === x.user_id
185
185
  );
186
186
  return T({
@@ -207,7 +207,7 @@ function Ha(t) {
207
207
  limit: 0,
208
208
  length: 0
209
209
  };
210
- const { count: v } = await c.select((x) => x.fn.countAll().as("count")).executeTakeFirstOrThrow();
210
+ const { count: v } = await d.select((x) => x.fn.countAll().as("count")).executeTakeFirstOrThrow();
211
211
  return {
212
212
  users: f,
213
213
  start: a * r,
@@ -279,9 +279,9 @@ let ar = (t) => crypto.getRandomValues(new Uint8Array(t)), rr = (t, e, n) => {
279
279
  return (o = e) => {
280
280
  let u = "";
281
281
  for (; ; ) {
282
- let d = n(r), c = r | 0;
283
- for (; c--; )
284
- if (u += t[d[c] & a] || "", u.length >= o) return u;
282
+ let c = n(r), d = r | 0;
283
+ for (; d--; )
284
+ if (u += t[c[d] & a] || "", u.length >= o) return u;
285
285
  }
286
286
  };
287
287
  }, or = (t, e = 21) => rr(t, e | 0, ar), U = (t = 21) => {
@@ -353,32 +353,32 @@ function ur(t) {
353
353
  return n ? Hn(n) : null;
354
354
  };
355
355
  }
356
- function dr(t) {
356
+ function cr(t) {
357
357
  return async (e) => {
358
358
  let n = t.selectFrom("tenants");
359
- const { page: a = 0, per_page: r = 50, include_totals: o = !1, sort: u, q: d } = e;
359
+ const { page: a = 0, per_page: r = 50, include_totals: o = !1, sort: u, q: c } = e;
360
360
  if (u && u.sort_by) {
361
361
  const { ref: f } = t.dynamic;
362
362
  n = n.orderBy(f(u.sort_by), u.sort_order);
363
363
  }
364
- d && (n = n.where(
365
- (f) => f.or([f("friendly_name", "like", `%${d}%`)])
364
+ c && (n = n.where(
365
+ (f) => f.or([f("friendly_name", "like", `%${c}%`)])
366
366
  ));
367
- const p = (await n.offset(a * r).limit(r).selectAll().execute()).map(Hn);
367
+ const g = (await n.offset(a * r).limit(r).selectAll().execute()).map(Hn);
368
368
  if (!o)
369
369
  return {
370
- tenants: p
370
+ tenants: g
371
371
  };
372
- const { count: l } = await n.select((f) => f.fn.countAll().as("count")).executeTakeFirstOrThrow(), w = j(l);
372
+ const { count: l } = await n.select((f) => f.fn.countAll().as("count")).executeTakeFirstOrThrow(), y = j(l);
373
373
  return {
374
- tenants: p,
374
+ tenants: g,
375
375
  start: a * r,
376
376
  limit: r,
377
- length: w
377
+ length: y
378
378
  };
379
379
  };
380
380
  }
381
- function cr(t) {
381
+ function dr(t) {
382
382
  return async (e, n) => {
383
383
  const r = {
384
384
  ...Xn(n),
@@ -395,8 +395,8 @@ function _r(t) {
395
395
  return {
396
396
  create: sr(t),
397
397
  get: ur(t),
398
- list: dr(t),
399
- update: cr(t),
398
+ list: cr(t),
399
+ update: dr(t),
400
400
  remove: lr(t)
401
401
  };
402
402
  }
@@ -406,25 +406,25 @@ function On(t) {
406
406
  const mr = 1024;
407
407
  function hr(t) {
408
408
  return async (e, n) => {
409
- var o, u, d, c, h, p, l, w, f;
410
- const a = (o = n.user_agent) == null ? void 0 : o.slice(0, mr), r = n.log_id || U();
409
+ var c, d, h;
410
+ const a = (c = n.user_agent) == null ? void 0 : c.slice(0, mr), r = n.log_id || U(), { location_info: o, ...u } = n;
411
411
  return await t.insertInto("logs").values({
412
- ...n,
412
+ ...u,
413
413
  log_id: r,
414
414
  tenant_id: e,
415
415
  user_agent: a,
416
- description: (u = n.description) == null ? void 0 : u.substring(0, 256),
416
+ description: (d = n.description) == null ? void 0 : d.substring(0, 256),
417
417
  isMobile: n.isMobile ? 1 : 0,
418
418
  scope: n.scope,
419
419
  auth0_client: On(n.auth0_client),
420
- details: (d = On(n.details)) == null ? void 0 : d.substring(0, 8192),
420
+ details: (h = On(n.details)) == null ? void 0 : h.substring(0, 8192),
421
421
  // Extract location_info fields for separate columns
422
- country_code: (c = n.location_info) == null ? void 0 : c.country_code,
423
- city_name: (h = n.location_info) == null ? void 0 : h.city_name,
424
- latitude: (p = n.location_info) == null ? void 0 : p.latitude,
425
- longitude: (l = n.location_info) == null ? void 0 : l.longitude,
426
- time_zone: (w = n.location_info) == null ? void 0 : w.time_zone,
427
- continent_code: (f = n.location_info) == null ? void 0 : f.continent_code
422
+ country_code: o == null ? void 0 : o.country_code,
423
+ city_name: o == null ? void 0 : o.city_name,
424
+ latitude: o == null ? void 0 : o.latitude,
425
+ longitude: o == null ? void 0 : o.longitude,
426
+ time_zone: o == null ? void 0 : o.time_zone,
427
+ continent_code: o == null ? void 0 : o.continent_code
428
428
  }).execute(), {
429
429
  ...n,
430
430
  log_id: r,
@@ -464,10 +464,10 @@ function Zn(t) {
464
464
  }
465
465
  function fr(t) {
466
466
  return async (e, n = {}) => {
467
- const { page: a = 0, per_page: r = 50, include_totals: o = !1, sort: u, q: d } = n;
468
- let c = t.selectFrom("logs").where("logs.tenant_id", "=", e);
469
- d && (c = J(t, c, d, ["user_id", "ip"]));
470
- let h = c;
467
+ const { page: a = 0, per_page: r = 50, include_totals: o = !1, sort: u, q: c } = n;
468
+ let d = t.selectFrom("logs").where("logs.tenant_id", "=", e);
469
+ c && (d = J(t, d, c, ["user_id", "ip"]));
470
+ let h = d;
471
471
  if (u && u.sort_by) {
472
472
  const { ref: f } = t.dynamic;
473
473
  h = h.orderBy(f(u.sort_by), u.sort_order);
@@ -481,12 +481,12 @@ function fr(t) {
481
481
  limit: 0,
482
482
  length: 0
483
483
  };
484
- const { count: w } = await c.select((f) => f.fn.countAll().as("count")).executeTakeFirstOrThrow();
484
+ const { count: y } = await d.select((f) => f.fn.countAll().as("count")).executeTakeFirstOrThrow();
485
485
  return {
486
486
  logs: l,
487
487
  start: a * r,
488
488
  limit: r,
489
- length: j(w)
489
+ length: j(y)
490
490
  };
491
491
  };
492
492
  }
@@ -508,9 +508,9 @@ function wr(t) {
508
508
  const a = await t.selectFrom("sessions").where("sessions.tenant_id", "=", e).where("sessions.id", "=", n).selectAll().executeTakeFirst();
509
509
  if (!a)
510
510
  return null;
511
- const { tenant_id: r, device: o, clients: u, ...d } = a;
511
+ const { tenant_id: r, device: o, clients: u, ...c } = a;
512
512
  return {
513
- ...d,
513
+ ...c,
514
514
  device: JSON.parse(o),
515
515
  clients: JSON.parse(u)
516
516
  };
@@ -549,10 +549,10 @@ function vr(t) {
549
549
  }
550
550
  function Cr(t) {
551
551
  return async (e, n = {}) => {
552
- const { page: a = 0, per_page: r = 50, include_totals: o = !1, sort: u, q: d } = n;
553
- let c = t.selectFrom("sessions").where("sessions.tenant_id", "=", e);
554
- d && (c = J(t, c, d, ["user_id", "session_id"]));
555
- let h = c;
552
+ const { page: a = 0, per_page: r = 50, include_totals: o = !1, sort: u, q: c } = n;
553
+ let d = t.selectFrom("sessions").where("sessions.tenant_id", "=", e);
554
+ c && (d = J(t, d, c, ["user_id", "session_id"]));
555
+ let h = d;
556
556
  if (u && u.sort_by) {
557
557
  const { ref: v } = t.dynamic;
558
558
  h = h.orderBy(v(u.sort_by), u.sort_order);
@@ -570,7 +570,7 @@ function Cr(t) {
570
570
  limit: 0,
571
571
  length: 0
572
572
  };
573
- const { count: w } = await c.select((v) => v.fn.countAll().as("count")).executeTakeFirstOrThrow(), f = j(w);
573
+ const { count: y } = await d.select((v) => v.fn.countAll().as("count")).executeTakeFirstOrThrow(), f = j(y);
574
574
  return {
575
575
  sessions: l,
576
576
  start: a * r,
@@ -630,9 +630,9 @@ function Or(t) {
630
630
  function Sr(t) {
631
631
  return async (e, n, a) => {
632
632
  let r = t.selectFrom("passwords").where("passwords.tenant_id", "=", e).where("passwords.user_id", "=", n).orderBy("created_at", "desc");
633
- return a && (r = r.limit(a)), (await r.selectAll().execute()).map(({ tenant_id: u, ...d }) => ({
634
- ...d,
635
- is_current: !!d.is_current
633
+ return a && (r = r.limit(a)), (await r.selectAll().execute()).map(({ tenant_id: u, ...c }) => ({
634
+ ...c,
635
+ is_current: !!c.is_current
636
636
  }));
637
637
  };
638
638
  }
@@ -647,22 +647,22 @@ function kr(t) {
647
647
  function Ir(t) {
648
648
  return async (e, n = {}) => {
649
649
  const { page: a = 0, per_page: r = 50, include_totals: o = !1, q: u } = n;
650
- let d = t.selectFrom("codes").where("codes.tenant_id", "=", e);
651
- u && (d = J(t, d, u, ["code", "login_id"]));
652
- const p = (await d.offset(a * r).limit(r).selectAll().execute()).map((w) => {
653
- const { tenant_id: f, ...v } = w;
650
+ let c = t.selectFrom("codes").where("codes.tenant_id", "=", e);
651
+ u && (c = J(t, c, u, ["code", "login_id"]));
652
+ const g = (await c.offset(a * r).limit(r).selectAll().execute()).map((y) => {
653
+ const { tenant_id: f, ...v } = y;
654
654
  return Wa.parse(T(v));
655
655
  });
656
656
  if (!o)
657
657
  return {
658
- codes: p,
658
+ codes: g,
659
659
  start: 0,
660
660
  limit: 0,
661
661
  length: 0
662
662
  };
663
- const { count: l } = await d.select((w) => w.fn.countAll().as("count")).executeTakeFirstOrThrow();
663
+ const { count: l } = await c.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
664
664
  return {
665
- codes: p,
665
+ codes: g,
666
666
  start: a * r,
667
667
  limit: r,
668
668
  length: j(l)
@@ -752,24 +752,24 @@ function qr(t) {
752
752
  function Br(t) {
753
753
  return async (e, n = {}) => {
754
754
  const { page: a = 0, per_page: r = 50, include_totals: o = !1, q: u } = n;
755
- let d = t.selectFrom("connections").where("connections.tenant_id", "=", e);
756
- u && (d = J(t, d, u, ["user_id", "ip"]));
757
- const p = (await d.offset(a * r).limit(r).selectAll().execute()).map(
758
- (w) => T({
759
- ...w,
760
- options: JSON.parse(w.options)
755
+ let c = t.selectFrom("connections").where("connections.tenant_id", "=", e);
756
+ u && (c = J(t, c, u, ["user_id", "ip"]));
757
+ const g = (await c.offset(a * r).limit(r).selectAll().execute()).map(
758
+ (y) => T({
759
+ ...y,
760
+ options: JSON.parse(y.options)
761
761
  })
762
762
  );
763
763
  if (!o)
764
764
  return {
765
- connections: p,
765
+ connections: g,
766
766
  start: 0,
767
767
  limit: 0,
768
768
  length: 0
769
769
  };
770
- const { count: l } = await d.select((w) => w.fn.countAll().as("count")).executeTakeFirstOrThrow();
770
+ const { count: l } = await c.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
771
771
  return {
772
- connections: p,
772
+ connections: g,
773
773
  start: a * r,
774
774
  limit: r,
775
775
  length: j(l)
@@ -1024,27 +1024,27 @@ function Zr(t) {
1024
1024
  }
1025
1025
  function eo(t) {
1026
1026
  return async (e, n) => {
1027
- const a = (/* @__PURE__ */ new Date()).toISOString(), r = U(), { scope: o, authorization_details_types: u, ...d } = n, c = {
1027
+ const a = (/* @__PURE__ */ new Date()).toISOString(), r = U(), { scope: o, authorization_details_types: u, ...c } = n, d = {
1028
1028
  id: r,
1029
1029
  tenant_id: e,
1030
- ...d,
1030
+ ...c,
1031
1031
  scope: o ? JSON.stringify(o) : "[]",
1032
1032
  authorization_details_types: u ? JSON.stringify(u) : "[]",
1033
1033
  // Convert booleans to integers for database storage
1034
- allow_any_organization: d.allow_any_organization !== void 0 ? d.allow_any_organization ? 1 : 0 : void 0,
1035
- is_system: d.is_system !== void 0 ? d.is_system ? 1 : 0 : void 0,
1034
+ allow_any_organization: c.allow_any_organization !== void 0 ? c.allow_any_organization ? 1 : 0 : void 0,
1035
+ is_system: c.is_system !== void 0 ? c.is_system ? 1 : 0 : void 0,
1036
1036
  created_at: a,
1037
1037
  updated_at: a
1038
1038
  };
1039
- return await t.insertInto("client_grants").values(c).execute(), T({
1039
+ return await t.insertInto("client_grants").values(d).execute(), T({
1040
1040
  id: r,
1041
1041
  tenant_id: e,
1042
- ...d,
1042
+ ...c,
1043
1043
  scope: o || [],
1044
1044
  authorization_details_types: u || [],
1045
1045
  // Ensure boolean fields have proper defaults
1046
- allow_any_organization: d.allow_any_organization ?? !1,
1047
- is_system: d.is_system ?? !1,
1046
+ allow_any_organization: c.allow_any_organization ?? !1,
1047
+ is_system: c.is_system ?? !1,
1048
1048
  created_at: a,
1049
1049
  updated_at: a
1050
1050
  });
@@ -1074,24 +1074,24 @@ function to(t) {
1074
1074
  }
1075
1075
  function no(t) {
1076
1076
  return async (e, n = {}) => {
1077
- const { page: a = 0, per_page: r = 50, include_totals: o = !1, q: u, sort: d } = n;
1078
- let c = t.selectFrom("client_grants").where("client_grants.tenant_id", "=", e);
1077
+ const { page: a = 0, per_page: r = 50, include_totals: o = !1, q: u, sort: c } = n;
1078
+ let d = t.selectFrom("client_grants").where("client_grants.tenant_id", "=", e);
1079
1079
  if (u) {
1080
1080
  const f = u.trim(), v = f.split(/\s+/), x = v.length === 1 ? v[0] : void 0, E = x ? x.match(/^(-)?([a-zA-Z_][a-zA-Z0-9_]*):"?([^"]*)"?$/) : null, z = E ? E[3] : "", oe = /^(>=|>|<=|<)/.test(z || "");
1081
1081
  if (E && !oe && z) {
1082
1082
  const Q = !!E[1], ye = E[2], { ref: Ct } = t.dynamic, Ne = Ct(`client_grants.${ye}`);
1083
1083
  if (ye === "allow_any_organization") {
1084
1084
  const rt = z === "true" ? 1 : 0;
1085
- Q ? c = c.where(Ne, "!=", rt) : c = c.where(Ne, "=", rt);
1085
+ Q ? d = d.where(Ne, "!=", rt) : d = d.where(Ne, "=", rt);
1086
1086
  } else
1087
- Q ? c = c.where(Ne, "!=", z) : c = c.where(Ne, "=", z);
1087
+ Q ? d = d.where(Ne, "!=", z) : d = d.where(Ne, "=", z);
1088
1088
  } else
1089
- c = J(t, c, f, []);
1089
+ d = J(t, d, f, []);
1090
1090
  }
1091
- let h = c;
1092
- if (d) {
1091
+ let h = d;
1092
+ if (c) {
1093
1093
  const { ref: f } = t.dynamic;
1094
- h = h.orderBy(f(d.sort_by), d.sort_order);
1094
+ h = h.orderBy(f(c.sort_by), c.sort_order);
1095
1095
  } else
1096
1096
  h = h.orderBy("client_grants.created_at", "desc");
1097
1097
  h = h.limit(r).offset(a * r);
@@ -1119,12 +1119,12 @@ function no(t) {
1119
1119
  limit: 0,
1120
1120
  length: 0
1121
1121
  };
1122
- const { count: w } = await c.select((f) => f.fn.countAll().as("count")).executeTakeFirstOrThrow();
1122
+ const { count: y } = await d.select((f) => f.fn.countAll().as("count")).executeTakeFirstOrThrow();
1123
1123
  return {
1124
1124
  client_grants: l,
1125
1125
  start: a * r,
1126
1126
  limit: r,
1127
- length: j(w)
1127
+ length: j(y)
1128
1128
  };
1129
1129
  };
1130
1130
  }
@@ -1133,13 +1133,13 @@ function ao(t) {
1133
1133
  }
1134
1134
  function ro(t) {
1135
1135
  return async (e, n, a) => {
1136
- const r = (/* @__PURE__ */ new Date()).toISOString(), { scope: o, authorization_details_types: u, ...d } = a, c = {
1137
- ...d,
1136
+ const r = (/* @__PURE__ */ new Date()).toISOString(), { scope: o, authorization_details_types: u, ...c } = a, d = {
1137
+ ...c,
1138
1138
  updated_at: r
1139
1139
  };
1140
- return o !== void 0 && (c.scope = JSON.stringify(o)), u !== void 0 && (c.authorization_details_types = JSON.stringify(
1140
+ return o !== void 0 && (d.scope = JSON.stringify(o)), u !== void 0 && (d.authorization_details_types = JSON.stringify(
1141
1141
  u
1142
- )), d.allow_any_organization !== void 0 && (c.allow_any_organization = d.allow_any_organization ? 1 : 0), d.is_system !== void 0 && (c.is_system = d.is_system ? 1 : 0), ((await t.updateTable("client_grants").set(c).where("client_grants.tenant_id", "=", e).where("client_grants.id", "=", n).executeTakeFirst()).numUpdatedRows ?? 0n) > 0n;
1142
+ )), c.allow_any_organization !== void 0 && (d.allow_any_organization = c.allow_any_organization ? 1 : 0), c.is_system !== void 0 && (d.is_system = c.is_system ? 1 : 0), ((await t.updateTable("client_grants").set(d).where("client_grants.tenant_id", "=", e).where("client_grants.id", "=", n).executeTakeFirst()).numUpdatedRows ?? 0n) > 0n;
1143
1143
  };
1144
1144
  }
1145
1145
  function oo(t) {
@@ -1175,10 +1175,10 @@ function io(t) {
1175
1175
  require_proof_of_possession: !!n.require_proof_of_possession,
1176
1176
  // Parse JSON string fields back to objects/arrays
1177
1177
  connections: r.map(
1178
- (d) => Ka.parse(
1178
+ (c) => Ka.parse(
1179
1179
  T({
1180
- ...d,
1181
- options: d.options ? JSON.parse(d.options) : {}
1180
+ ...c,
1181
+ options: c.options ? JSON.parse(c.options) : {}
1182
1182
  })
1183
1183
  )
1184
1184
  ),
@@ -1217,36 +1217,36 @@ function so(t) {
1217
1217
  sort: o,
1218
1218
  q: u
1219
1219
  } = e;
1220
- let d = t.selectFrom("keys").where(
1220
+ let c = t.selectFrom("keys").where(
1221
1221
  (f) => f.or([
1222
1222
  f("revoked_at", ">", (/* @__PURE__ */ new Date()).toISOString()),
1223
1223
  f("revoked_at", "is", null)
1224
1224
  ])
1225
1225
  );
1226
- u && (d = J(t, d, u, [
1226
+ u && (c = J(t, c, u, [
1227
1227
  "kid",
1228
1228
  "connection",
1229
1229
  "fingerprint",
1230
1230
  "thumbprint",
1231
1231
  "type"
1232
1232
  ]));
1233
- let c = d.select((f) => f.fn.count("kid").as("count"));
1233
+ let d = c.select((f) => f.fn.count("kid").as("count"));
1234
1234
  const h = n * a;
1235
- d = d.limit(a).offset(h), o && (d = d.orderBy(o.sort_by, o.sort_order));
1236
- const p = await d.selectAll().execute();
1235
+ c = c.limit(a).offset(h), o && (c = c.orderBy(o.sort_by, o.sort_order));
1236
+ const g = await c.selectAll().execute();
1237
1237
  if (!r)
1238
1238
  return {
1239
- signingKeys: p,
1239
+ signingKeys: g,
1240
1240
  start: 0,
1241
1241
  limit: 0,
1242
1242
  length: 0
1243
1243
  };
1244
- const l = await c.executeTakeFirst(), w = j((l == null ? void 0 : l.count) ?? 0);
1244
+ const l = await d.executeTakeFirst(), y = j((l == null ? void 0 : l.count) ?? 0);
1245
1245
  return {
1246
- signingKeys: p,
1246
+ signingKeys: g,
1247
1247
  start: h,
1248
1248
  limit: a,
1249
- length: w
1249
+ length: y
1250
1250
  };
1251
1251
  };
1252
1252
  }
@@ -1339,20 +1339,20 @@ function yo(t) {
1339
1339
  colors_primary: r,
1340
1340
  colors_page_background_type: o,
1341
1341
  colors_page_background_start: u,
1342
- colors_page_background_end: d,
1343
- colors_page_background_angle_dev: c,
1342
+ colors_page_background_end: c,
1343
+ colors_page_background_angle_dev: d,
1344
1344
  font_url: h,
1345
- ...p
1345
+ ...g
1346
1346
  } = n;
1347
1347
  return T({
1348
- ...p,
1348
+ ...g,
1349
1349
  colors: {
1350
1350
  primary: r,
1351
1351
  page_background: {
1352
1352
  type: o,
1353
1353
  start: u,
1354
- end: d,
1355
- angle_deg: c
1354
+ end: c,
1355
+ angle_deg: d
1356
1356
  }
1357
1357
  },
1358
1358
  font: h ? { url: h } : void 0
@@ -1361,16 +1361,16 @@ function yo(t) {
1361
1361
  }
1362
1362
  function No(t) {
1363
1363
  return async (e, n) => {
1364
- var u, d, c, h, p, l, w, f, v, x, E, z, oe, Q, ye, Ct, Ne, rt;
1364
+ var u, c, d, h, g, l, y, f, v, x, E, z, oe, Q, ye, Ct, Ne, rt;
1365
1365
  const { colors: a, font: r, ...o } = n;
1366
1366
  try {
1367
1367
  await t.insertInto("branding").values({
1368
1368
  ...o,
1369
1369
  colors_primary: a == null ? void 0 : a.primary,
1370
- colors_page_background_type: (d = (u = n.colors) == null ? void 0 : u.page_background) == null ? void 0 : d.type,
1371
- colors_page_background_start: (h = (c = n.colors) == null ? void 0 : c.page_background) == null ? void 0 : h.start,
1372
- colors_page_background_end: (l = (p = n.colors) == null ? void 0 : p.page_background) == null ? void 0 : l.end,
1373
- colors_page_background_angle_dev: (f = (w = n.colors) == null ? void 0 : w.page_background) == null ? void 0 : f.angle_deg,
1370
+ colors_page_background_type: (c = (u = n.colors) == null ? void 0 : u.page_background) == null ? void 0 : c.type,
1371
+ colors_page_background_start: (h = (d = n.colors) == null ? void 0 : d.page_background) == null ? void 0 : h.start,
1372
+ colors_page_background_end: (l = (g = n.colors) == null ? void 0 : g.page_background) == null ? void 0 : l.end,
1373
+ colors_page_background_angle_dev: (f = (y = n.colors) == null ? void 0 : y.page_background) == null ? void 0 : f.angle_deg,
1374
1374
  font_url: (v = n.font) == null ? void 0 : v.url,
1375
1375
  tenant_id: e
1376
1376
  }).execute();
@@ -1396,10 +1396,10 @@ function vo(t) {
1396
1396
  function Co(t) {
1397
1397
  return async (e, n = {}) => {
1398
1398
  const { page: a = 0, per_page: r = 50, include_totals: o = !1, q: u } = n;
1399
- let d = t.selectFrom("hooks").where("hooks.tenant_id", "=", e);
1400
- u && (d = J(t, d, u, ["url", "form_id"]));
1401
- const p = (await d.offset(a * r).limit(r).selectAll().execute()).map((w) => {
1402
- const { tenant_id: f, enabled: v, synchronous: x, ...E } = w;
1399
+ let c = t.selectFrom("hooks").where("hooks.tenant_id", "=", e);
1400
+ u && (c = J(t, c, u, ["url", "form_id"]));
1401
+ const g = (await c.offset(a * r).limit(r).selectAll().execute()).map((y) => {
1402
+ const { tenant_id: f, enabled: v, synchronous: x, ...E } = y;
1403
1403
  return T({
1404
1404
  ...E,
1405
1405
  enabled: !!v,
@@ -1408,14 +1408,14 @@ function Co(t) {
1408
1408
  });
1409
1409
  if (!o)
1410
1410
  return {
1411
- hooks: p,
1411
+ hooks: g,
1412
1412
  start: 0,
1413
1413
  limit: 0,
1414
1414
  length: 0
1415
1415
  };
1416
- const { count: l } = await d.select((w) => w.fn.countAll().as("count")).executeTakeFirstOrThrow();
1416
+ const { count: l } = await c.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
1417
1417
  return {
1418
- hooks: p,
1418
+ hooks: g,
1419
1419
  start: a * r,
1420
1420
  limit: r,
1421
1421
  length: j(l)
@@ -1629,10 +1629,10 @@ function Jo(t) {
1629
1629
  credentials: r,
1630
1630
  settings: o,
1631
1631
  enabled: u,
1632
- ...d
1632
+ ...c
1633
1633
  } = n;
1634
1634
  return T({
1635
- ...d,
1635
+ ...c,
1636
1636
  credentials: JSON.parse(r),
1637
1637
  settings: JSON.parse(o),
1638
1638
  enabled: !!u
@@ -1713,10 +1713,10 @@ function Vo(t) {
1713
1713
  }
1714
1714
  function Go(t) {
1715
1715
  return async (e, n = {}) => {
1716
- const { page: a = 0, per_page: r = 50, include_totals: o = !1, sort: u, q: d } = n;
1717
- let c = t.selectFrom("refresh_tokens").where("refresh_tokens.tenant_id", "=", e);
1718
- d && (c = J(t, c, d, ["token", "session_id"]));
1719
- let h = c;
1716
+ const { page: a = 0, per_page: r = 50, include_totals: o = !1, sort: u, q: c } = n;
1717
+ let d = t.selectFrom("refresh_tokens").where("refresh_tokens.tenant_id", "=", e);
1718
+ c && (d = J(t, d, c, ["token", "session_id"]));
1719
+ let h = d;
1720
1720
  if (u && u.sort_by) {
1721
1721
  const { ref: v } = t.dynamic;
1722
1722
  h = h.orderBy(v(u.sort_by), u.sort_order);
@@ -1735,7 +1735,7 @@ function Go(t) {
1735
1735
  limit: 0,
1736
1736
  length: 0
1737
1737
  };
1738
- const { count: w } = await c.select((v) => v.fn.countAll().as("count")).executeTakeFirstOrThrow(), f = j(w);
1738
+ const { count: y } = await d.select((v) => v.fn.countAll().as("count")).executeTakeFirstOrThrow(), f = j(y);
1739
1739
  return {
1740
1740
  refresh_tokens: l,
1741
1741
  start: a * r,
@@ -1804,10 +1804,10 @@ function Xo(t) {
1804
1804
  function Zo(t) {
1805
1805
  return async (e, n = {}) => {
1806
1806
  const { page: a = 0, per_page: r = 50, include_totals: o = !1, q: u } = n;
1807
- let d = t.selectFrom("forms").where("tenant_id", "=", e);
1808
- u && (d = J(t, d, u, []));
1809
- const p = (await d.offset(a * r).limit(r).selectAll().execute()).map((w) => {
1810
- const f = { ...w };
1807
+ let c = t.selectFrom("forms").where("tenant_id", "=", e);
1808
+ u && (c = J(t, c, u, []));
1809
+ const g = (await c.offset(a * r).limit(r).selectAll().execute()).map((y) => {
1810
+ const f = { ...y };
1811
1811
  if (typeof f.nodes == "string")
1812
1812
  try {
1813
1813
  f.nodes = JSON.parse(f.nodes);
@@ -1827,14 +1827,14 @@ function Zo(t) {
1827
1827
  });
1828
1828
  if (!o)
1829
1829
  return {
1830
- forms: p,
1830
+ forms: g,
1831
1831
  start: 0,
1832
1832
  limit: 0,
1833
1833
  length: 0
1834
1834
  };
1835
- const { count: l } = await d.select((w) => w.fn.countAll().as("count")).executeTakeFirstOrThrow();
1835
+ const { count: l } = await c.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
1836
1836
  return {
1837
- forms: p,
1837
+ forms: g,
1838
1838
  start: a * r,
1839
1839
  limit: r,
1840
1840
  length: j(l)
@@ -1899,23 +1899,23 @@ function ri(t) {
1899
1899
  updated_at: a
1900
1900
  }, o = Va.parse(r), {
1901
1901
  verificationKey: u,
1902
- scopes: d,
1903
- options: c,
1902
+ scopes: c,
1903
+ options: d,
1904
1904
  skip_consent_for_verifiable_first_party_clients: h,
1905
- allow_offline_access: p,
1905
+ allow_offline_access: g,
1906
1906
  ...l
1907
- } = o, w = {
1907
+ } = o, y = {
1908
1908
  ...l,
1909
1909
  tenant_id: e,
1910
- scopes: d ? JSON.stringify(d) : "[]",
1911
- options: c ? JSON.stringify(c) : "{}",
1910
+ scopes: c ? JSON.stringify(c) : "[]",
1911
+ options: d ? JSON.stringify(d) : "{}",
1912
1912
  skip_consent_for_verifiable_first_party_clients: h ? 1 : 0,
1913
- allow_offline_access: p ? 1 : 0,
1913
+ allow_offline_access: g ? 1 : 0,
1914
1914
  verification_key: u,
1915
1915
  created_at: a,
1916
1916
  updated_at: a
1917
1917
  };
1918
- return await t.insertInto("resource_servers").values(w).execute(), T(o);
1918
+ return await t.insertInto("resource_servers").values(y).execute(), T(o);
1919
1919
  };
1920
1920
  }
1921
1921
  function oi(t) {
@@ -1925,15 +1925,15 @@ function oi(t) {
1925
1925
  const r = a, {
1926
1926
  verification_key: o,
1927
1927
  scopes: u,
1928
- options: d,
1929
- skip_consent_for_verifiable_first_party_clients: c,
1928
+ options: c,
1929
+ skip_consent_for_verifiable_first_party_clients: d,
1930
1930
  allow_offline_access: h,
1931
- ...p
1931
+ ...g
1932
1932
  } = r, l = {
1933
- ...p,
1933
+ ...g,
1934
1934
  scopes: u ? JSON.parse(u) : [],
1935
- options: d ? JSON.parse(d) : {},
1936
- skip_consent_for_verifiable_first_party_clients: !!c,
1935
+ options: c ? JSON.parse(c) : {},
1936
+ skip_consent_for_verifiable_first_party_clients: !!d,
1937
1937
  allow_offline_access: !!h,
1938
1938
  // Convert verification_key back to verificationKey for API
1939
1939
  verificationKey: o
@@ -1944,20 +1944,20 @@ function oi(t) {
1944
1944
  function ii(t) {
1945
1945
  return async (e, n = {}) => {
1946
1946
  const { page: a = 0, per_page: r = 50, include_totals: o = !1, q: u } = n;
1947
- let d = t.selectFrom("resource_servers").where("resource_servers.tenant_id", "=", e);
1947
+ let c = t.selectFrom("resource_servers").where("resource_servers.tenant_id", "=", e);
1948
1948
  if (u) {
1949
- const w = u.trim(), f = w.split(/\s+/), v = f.length === 1 ? f[0] : void 0, x = v ? v.match(/^(-)?(name|identifier):(.*)$/) : null, E = x ? x[3] : "", z = /^(>=|>|<=|<)/.test(E || "");
1949
+ const y = u.trim(), f = y.split(/\s+/), v = f.length === 1 ? f[0] : void 0, x = v ? v.match(/^(-)?(name|identifier):(.*)$/) : null, E = x ? x[3] : "", z = /^(>=|>|<=|<)/.test(E || "");
1950
1950
  if (x && !z) {
1951
1951
  const oe = !!x[1], Q = x[2] === "name" ? "resource_servers.name" : "resource_servers.identifier";
1952
- d = oe ? d.where(Q, "not like", `%${E}%`) : d.where(Q, "like", `%${E}%`);
1952
+ c = oe ? c.where(Q, "not like", `%${E}%`) : c.where(Q, "like", `%${E}%`);
1953
1953
  } else
1954
- d = J(t, d, w, [
1954
+ c = J(t, c, y, [
1955
1955
  "resource_servers.name",
1956
1956
  "resource_servers.identifier"
1957
1957
  ]);
1958
1958
  }
1959
- const p = (await d.offset(a * r).limit(r).selectAll().execute()).map((w) => {
1960
- const f = w, {
1959
+ const g = (await c.offset(a * r).limit(r).selectAll().execute()).map((y) => {
1960
+ const f = y, {
1961
1961
  verification_key: v,
1962
1962
  scopes: x,
1963
1963
  options: E,
@@ -1977,14 +1977,14 @@ function ii(t) {
1977
1977
  });
1978
1978
  if (!o)
1979
1979
  return {
1980
- resource_servers: p,
1980
+ resource_servers: g,
1981
1981
  start: 0,
1982
1982
  limit: 0,
1983
1983
  length: 0
1984
1984
  };
1985
- const { count: l } = await d.select((w) => w.fn.countAll().as("count")).executeTakeFirstOrThrow();
1985
+ const { count: l } = await c.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
1986
1986
  return {
1987
- resource_servers: p,
1987
+ resource_servers: g,
1988
1988
  start: a * r,
1989
1989
  limit: r,
1990
1990
  length: j(l)
@@ -2003,23 +2003,23 @@ function ui(t) {
2003
2003
  verificationKey: r,
2004
2004
  scopes: o,
2005
2005
  options: u,
2006
- skip_consent_for_verifiable_first_party_clients: d,
2007
- allow_offline_access: c,
2006
+ skip_consent_for_verifiable_first_party_clients: c,
2007
+ allow_offline_access: d,
2008
2008
  ...h
2009
- } = a, p = {
2009
+ } = a, g = {
2010
2010
  ...h,
2011
2011
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
2012
2012
  };
2013
- if (r !== void 0 && (p.verification_key = r), o !== void 0 && (p.scopes = JSON.stringify(o)), u !== void 0) {
2014
- const w = await t.selectFrom("resource_servers").select("options").where("tenant_id", "=", e).where("id", "=", n).executeTakeFirst(), v = { ...w != null && w.options ? JSON.parse(w.options) : {}, ...u };
2015
- p.options = JSON.stringify(v);
2013
+ if (r !== void 0 && (g.verification_key = r), o !== void 0 && (g.scopes = JSON.stringify(o)), u !== void 0) {
2014
+ const y = await t.selectFrom("resource_servers").select("options").where("tenant_id", "=", e).where("id", "=", n).executeTakeFirst(), v = { ...y != null && y.options ? JSON.parse(y.options) : {}, ...u };
2015
+ g.options = JSON.stringify(v);
2016
2016
  }
2017
- d !== void 0 && (p.skip_consent_for_verifiable_first_party_clients = d ? 1 : 0), c !== void 0 && (p.allow_offline_access = c ? 1 : 0);
2018
- const l = await t.updateTable("resource_servers").set(p).where("tenant_id", "=", e).where("id", "=", n).executeTakeFirst();
2017
+ c !== void 0 && (g.skip_consent_for_verifiable_first_party_clients = c ? 1 : 0), d !== void 0 && (g.allow_offline_access = d ? 1 : 0);
2018
+ const l = await t.updateTable("resource_servers").set(g).where("tenant_id", "=", e).where("id", "=", n).executeTakeFirst();
2019
2019
  return Number(l.numUpdatedRows) > 0;
2020
2020
  };
2021
2021
  }
2022
- function di(t) {
2022
+ function ci(t) {
2023
2023
  return {
2024
2024
  create: ri(t),
2025
2025
  get: oi(t),
@@ -2028,7 +2028,7 @@ function di(t) {
2028
2028
  update: ui(t)
2029
2029
  };
2030
2030
  }
2031
- function ci(t) {
2031
+ function di(t) {
2032
2032
  return async (e, n) => {
2033
2033
  const a = (/* @__PURE__ */ new Date()).toISOString(), r = U(), o = {
2034
2034
  id: r,
@@ -2058,17 +2058,17 @@ function _i(t) {
2058
2058
  let a = t.selectFrom("roles").where("roles.tenant_id", "=", e);
2059
2059
  const { page: r = 0, per_page: o = 50, include_totals: u = !1 } = n;
2060
2060
  n.q && (a = J(t, a, n.q, ["name"]));
2061
- const c = await a.offset(r * o).limit(o).selectAll().execute();
2061
+ const d = await a.offset(r * o).limit(o).selectAll().execute();
2062
2062
  if (!u)
2063
2063
  return {
2064
- roles: c,
2064
+ roles: d,
2065
2065
  start: r * o,
2066
2066
  limit: o,
2067
- length: c.length
2067
+ length: d.length
2068
2068
  };
2069
- const { count: h } = await a.select((p) => p.fn.countAll().as("count")).executeTakeFirstOrThrow();
2069
+ const { count: h } = await a.select((g) => g.fn.countAll().as("count")).executeTakeFirstOrThrow();
2070
2070
  return {
2071
- roles: c,
2071
+ roles: d,
2072
2072
  start: r * o,
2073
2073
  limit: o,
2074
2074
  length: j(h)
@@ -2092,7 +2092,7 @@ function hi(t) {
2092
2092
  }
2093
2093
  function fi(t) {
2094
2094
  return {
2095
- create: ci(t),
2095
+ create: di(t),
2096
2096
  get: li(t),
2097
2097
  list: _i(t),
2098
2098
  update: mi(t),
@@ -2118,10 +2118,10 @@ function pi(t) {
2118
2118
  };
2119
2119
  try {
2120
2120
  await t.insertInto("role_permissions").values(u).execute();
2121
- } catch (d) {
2122
- if (d.code === "SQLITE_CONSTRAINT_PRIMARYKEY" || d.code === "SQLITE_CONSTRAINT_UNIQUE")
2121
+ } catch (c) {
2122
+ if (c.code === "SQLITE_CONSTRAINT_PRIMARYKEY" || c.code === "SQLITE_CONSTRAINT_UNIQUE")
2123
2123
  continue;
2124
- throw d;
2124
+ throw c;
2125
2125
  }
2126
2126
  }
2127
2127
  return !0;
@@ -2151,7 +2151,7 @@ function gi(t) {
2151
2151
  function wi(t) {
2152
2152
  return async (e, n, a = {}) => {
2153
2153
  const { page: r = 0, per_page: o = 50, include_totals: u = !1 } = a;
2154
- let d = t.selectFrom("role_permissions").leftJoin(
2154
+ let c = t.selectFrom("role_permissions").leftJoin(
2155
2155
  "resource_servers",
2156
2156
  (l) => l.onRef(
2157
2157
  "role_permissions.tenant_id",
@@ -2169,7 +2169,7 @@ function wi(t) {
2169
2169
  "role_permissions.created_at",
2170
2170
  "resource_servers.name as resource_server_name"
2171
2171
  ]).where("role_permissions.tenant_id", "=", e).where("role_permissions.role_id", "=", n);
2172
- const p = (await d.offset(r * o).limit(o).execute()).map((l) => ({
2172
+ const g = (await c.offset(r * o).limit(o).execute()).map((l) => ({
2173
2173
  role_id: l.role_id,
2174
2174
  resource_server_identifier: l.resource_server_identifier,
2175
2175
  resource_server_name: l.resource_server_name || l.resource_server_identifier,
@@ -2179,7 +2179,7 @@ function wi(t) {
2179
2179
  // No description available from role_permissions directly
2180
2180
  created_at: l.created_at
2181
2181
  }));
2182
- return u && await d.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow(), p;
2182
+ return u && await c.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow(), g;
2183
2183
  };
2184
2184
  }
2185
2185
  function yi(t) {
@@ -2225,7 +2225,7 @@ function Ci(t) {
2225
2225
  return async (e, n, a, r) => {
2226
2226
  let o = t.selectFrom("user_permissions").leftJoin(
2227
2227
  "resource_servers",
2228
- (d) => d.onRef(
2228
+ (c) => c.onRef(
2229
2229
  "user_permissions.tenant_id",
2230
2230
  "=",
2231
2231
  "resource_servers.tenant_id"
@@ -2246,16 +2246,16 @@ function Ci(t) {
2246
2246
  "user_permissions.organization_id",
2247
2247
  "=",
2248
2248
  r
2249
- )), (await o.execute()).map((d) => ({
2250
- resource_server_identifier: d.resource_server_identifier,
2251
- permission_name: d.permission_name,
2249
+ )), (await o.execute()).map((c) => ({
2250
+ resource_server_identifier: c.resource_server_identifier,
2251
+ permission_name: c.permission_name,
2252
2252
  description: null,
2253
2253
  // No description available from user_permissions directly
2254
- resource_server_name: d.resource_server_name || d.resource_server_identifier,
2254
+ resource_server_name: c.resource_server_name || c.resource_server_identifier,
2255
2255
  // Fallback to identifier if name is null
2256
- user_id: d.user_id,
2257
- created_at: d.created_at,
2258
- organization_id: d.organization_id === "" ? void 0 : d.organization_id
2256
+ user_id: c.user_id,
2257
+ created_at: c.created_at,
2258
+ organization_id: c.organization_id === "" ? void 0 : c.organization_id
2259
2259
  }));
2260
2260
  };
2261
2261
  }
@@ -2278,7 +2278,7 @@ function Ti(t) {
2278
2278
  return async (e, n, a, r) => {
2279
2279
  let o = t.selectFrom("user_roles as ur").innerJoin(
2280
2280
  "roles as r",
2281
- (d) => d.onRef("ur.role_id", "=", "r.id").onRef("ur.tenant_id", "=", "r.tenant_id")
2281
+ (c) => c.onRef("ur.role_id", "=", "r.id").onRef("ur.tenant_id", "=", "r.tenant_id")
2282
2282
  ).select([
2283
2283
  "r.id",
2284
2284
  "r.name",
@@ -2401,8 +2401,8 @@ function Pi(t) {
2401
2401
  }
2402
2402
  function Di(t) {
2403
2403
  return async (e, n, a) => {
2404
- const { branding: r, metadata: o, enabled_connections: u, token_quota: d, ...c } = a, h = {
2405
- ...c,
2404
+ const { branding: r, metadata: o, enabled_connections: u, token_quota: c, ...d } = a, h = {
2405
+ ...d,
2406
2406
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
2407
2407
  };
2408
2408
  return Nt(
@@ -2469,20 +2469,20 @@ function ji(t) {
2469
2469
  }
2470
2470
  }
2471
2471
  u = u.orderBy("created_at", "desc"), r > 0 && (u = u.limit(r).offset(o));
2472
- const d = await u.execute();
2473
- let c = t.selectFrom("user_organizations").select(t.fn.count("id").as("count")).where("tenant_id", "=", e);
2472
+ const c = await u.execute();
2473
+ let d = t.selectFrom("user_organizations").select(t.fn.count("id").as("count")).where("tenant_id", "=", e);
2474
2474
  if (n != null && n.q) {
2475
2475
  if (n.q.startsWith("user_id:")) {
2476
2476
  const l = n.q.replace("user_id:", "");
2477
- c = c.where("user_id", "=", l);
2477
+ d = d.where("user_id", "=", l);
2478
2478
  } else if (n.q.startsWith("organization_id:")) {
2479
2479
  const l = n.q.replace("organization_id:", "");
2480
- c = c.where("organization_id", "=", l);
2480
+ d = d.where("organization_id", "=", l);
2481
2481
  }
2482
2482
  }
2483
- const h = await c.executeTakeFirst();
2483
+ const h = await d.executeTakeFirst();
2484
2484
  return {
2485
- userOrganizations: d.map((l) => ({
2485
+ userOrganizations: c.map((l) => ({
2486
2486
  id: l.id,
2487
2487
  user_id: l.user_id,
2488
2488
  organization_id: l.organization_id,
@@ -2498,7 +2498,7 @@ function ji(t) {
2498
2498
  function Li(t) {
2499
2499
  return async (e, n, a) => {
2500
2500
  const r = (a == null ? void 0 : a.page) || 0, o = (a == null ? void 0 : a.per_page) || 50, u = r * o;
2501
- let d = t.selectFrom("user_organizations").innerJoin(
2501
+ let c = t.selectFrom("user_organizations").innerJoin(
2502
2502
  "organizations",
2503
2503
  "organizations.id",
2504
2504
  "user_organizations.organization_id"
@@ -2514,14 +2514,14 @@ function Li(t) {
2514
2514
  "organizations.updated_at",
2515
2515
  "user_organizations.created_at as joined_at"
2516
2516
  ]).where("user_organizations.tenant_id", "=", e).where("user_organizations.user_id", "=", n);
2517
- d = d.orderBy("user_organizations.created_at", "desc"), o > 0 && (d = d.limit(o).offset(u));
2518
- const c = await d.execute(), h = await t.selectFrom("user_organizations").innerJoin(
2517
+ c = c.orderBy("user_organizations.created_at", "desc"), o > 0 && (c = c.limit(o).offset(u));
2518
+ const d = await c.execute(), h = await t.selectFrom("user_organizations").innerJoin(
2519
2519
  "organizations",
2520
2520
  "organizations.id",
2521
2521
  "user_organizations.organization_id"
2522
2522
  ).select(t.fn.count("user_organizations.id").as("count")).where("user_organizations.tenant_id", "=", e).where("user_organizations.user_id", "=", n).executeTakeFirst();
2523
2523
  return {
2524
- organizations: c.map((l) => ({
2524
+ organizations: d.map((l) => ({
2525
2525
  id: l.id,
2526
2526
  name: l.name,
2527
2527
  display_name: l.display_name,
@@ -2565,7 +2565,7 @@ function qi(t) {
2565
2565
  }
2566
2566
  function Bi(t) {
2567
2567
  return async (e, n) => {
2568
- const a = Jr(), r = (/* @__PURE__ */ new Date()).toISOString(), o = n.ttl_sec || 604800, u = new Date(Date.now() + o * 1e3).toISOString(), d = Nt(
2568
+ const a = Jr(), r = (/* @__PURE__ */ new Date()).toISOString(), o = n.ttl_sec || 604800, u = new Date(Date.now() + o * 1e3).toISOString(), c = Nt(
2569
2569
  {
2570
2570
  id: a,
2571
2571
  tenant_id: e,
@@ -2587,15 +2587,15 @@ function Bi(t) {
2587
2587
  ["inviter", "invitee", "app_metadata", "user_metadata", "roles"]
2588
2588
  );
2589
2589
  try {
2590
- await t.insertInto("invites").values(d).execute();
2591
- } catch (c) {
2592
- throw c.code === "SQLITE_CONSTRAINT_UNIQUE" || c.message.includes("AlreadyExists") ? new et(409, {
2590
+ await t.insertInto("invites").values(c).execute();
2591
+ } catch (d) {
2592
+ throw d.code === "SQLITE_CONSTRAINT_UNIQUE" || d.message.includes("AlreadyExists") ? new et(409, {
2593
2593
  message: "Invite already exists"
2594
- }) : c;
2594
+ }) : d;
2595
2595
  }
2596
2596
  return {
2597
2597
  id: a,
2598
- organization_id: d.organization_id,
2598
+ organization_id: c.organization_id,
2599
2599
  inviter: n.inviter,
2600
2600
  invitee: n.invitee,
2601
2601
  client_id: n.client_id,
@@ -2606,7 +2606,7 @@ function Bi(t) {
2606
2606
  app_metadata: n.app_metadata || {},
2607
2607
  user_metadata: n.user_metadata || {},
2608
2608
  roles: n.roles || [],
2609
- ticket_id: d.ticket_id || void 0,
2609
+ ticket_id: c.ticket_id || void 0,
2610
2610
  ttl_sec: o,
2611
2611
  send_invitation_email: n.send_invitation_email ?? !0
2612
2612
  };
@@ -2655,7 +2655,7 @@ function Ui(t) {
2655
2655
  a = a.offset(u);
2656
2656
  }
2657
2657
  const o = (await a.execute()).map((u) => {
2658
- const d = ea(u, {
2658
+ const c = ea(u, {
2659
2659
  inviter: {},
2660
2660
  invitee: {},
2661
2661
  app_metadata: {},
@@ -2663,7 +2663,7 @@ function Ui(t) {
2663
2663
  roles: []
2664
2664
  });
2665
2665
  return T({
2666
- ...d,
2666
+ ...c,
2667
2667
  send_invitation_email: u.send_invitation_email === 1
2668
2668
  });
2669
2669
  });
@@ -3149,22 +3149,22 @@ function fe(t) {
3149
3149
  const e = ".";
3150
3150
  if (!t.includes(e))
3151
3151
  return qt.create(wn.create(t));
3152
- const n = t.split(e).map(da);
3152
+ const n = t.split(e).map(ca);
3153
3153
  if (n.length === 3)
3154
- return cs(n);
3154
+ return ds(n);
3155
3155
  if (n.length === 2)
3156
3156
  return ls(n);
3157
3157
  throw new Error(`invalid column reference ${t}`);
3158
3158
  }
3159
- function ds(t) {
3159
+ function cs(t) {
3160
3160
  const e = " as ";
3161
3161
  if (t.includes(e)) {
3162
- const [n, a] = t.split(e).map(da);
3162
+ const [n, a] = t.split(e).map(ca);
3163
3163
  return we.create(fe(n), F.create(a));
3164
3164
  } else
3165
3165
  return fe(t);
3166
3166
  }
3167
- function cs(t) {
3167
+ function ds(t) {
3168
3168
  const [e, n, a] = t;
3169
3169
  return qt.create(wn.create(a), _e.createWithSchema(e, n));
3170
3170
  }
@@ -3172,7 +3172,7 @@ function ls(t) {
3172
3172
  const [e, n] = t;
3173
3173
  return qt.create(wn.create(n), _e.create(e));
3174
3174
  }
3175
- function da(t) {
3175
+ function ca(t) {
3176
3176
  return t.trim();
3177
3177
  }
3178
3178
  const _s = s({
@@ -3249,13 +3249,13 @@ function K(t) {
3249
3249
  throw new Error(`invalid arguments: ${JSON.stringify(t)}`);
3250
3250
  }
3251
3251
  function Cn(t, e, n) {
3252
- return ps(e) && ca(n) ? tt.create(L(t), tn(e), pe.createImmediate(n)) : tt.create(L(t), tn(e), hs(n));
3252
+ return ps(e) && da(n) ? tt.create(L(t), tn(e), pe.createImmediate(n)) : tt.create(L(t), tn(e), hs(n));
3253
3253
  }
3254
3254
  function ht(t, e, n) {
3255
3255
  return tt.create(L(t), tn(e), L(n));
3256
3256
  }
3257
3257
  function En(t, e) {
3258
- return en(Object.entries(t).filter(([, n]) => !Ot(n)).map(([n, a]) => Cn(n, ca(a) ? "is" : "=", a)), e);
3258
+ return en(Object.entries(t).filter(([, n]) => !Ot(n)).map(([n, a]) => Cn(n, da(a) ? "is" : "=", a)), e);
3259
3259
  }
3260
3260
  function en(t, e, n = !0) {
3261
3261
  const a = e === "and" ? he.create : at.create;
@@ -3269,7 +3269,7 @@ function en(t, e, n = !0) {
3269
3269
  function ps(t) {
3270
3270
  return t === "is" || t === "is not";
3271
3271
  }
3272
- function ca(t) {
3272
+ function da(t) {
3273
3273
  return na(t) || ta(t);
3274
3274
  }
3275
3275
  function tn(t) {
@@ -3502,13 +3502,13 @@ function Ae(t, e) {
3502
3502
  });
3503
3503
  }
3504
3504
  var B;
3505
- const ct = class ct {
3505
+ const dt = class dt {
3506
3506
  constructor(e) {
3507
3507
  C(this, B);
3508
3508
  b(this, B, s(e));
3509
3509
  }
3510
3510
  on(...e) {
3511
- return new ct({
3511
+ return new dt({
3512
3512
  ...i(this, B),
3513
3513
  joinNode: st.cloneWithOn(i(this, B).joinNode, K(e))
3514
3514
  });
@@ -3520,7 +3520,7 @@ const ct = class ct {
3520
3520
  * See {@link WhereInterface.whereRef} for documentation and examples.
3521
3521
  */
3522
3522
  onRef(e, n, a) {
3523
- return new ct({
3523
+ return new dt({
3524
3524
  ...i(this, B),
3525
3525
  joinNode: st.cloneWithOn(i(this, B).joinNode, ht(e, n, a))
3526
3526
  });
@@ -3529,7 +3529,7 @@ const ct = class ct {
3529
3529
  * Adds `on true`.
3530
3530
  */
3531
3531
  onTrue() {
3532
- return new ct({
3532
+ return new dt({
3533
3533
  ...i(this, B),
3534
3534
  joinNode: st.cloneWithOn(i(this, B).joinNode, R.createWithSql("true"))
3535
3535
  });
@@ -3546,7 +3546,7 @@ const ct = class ct {
3546
3546
  }
3547
3547
  };
3548
3548
  B = new WeakMap();
3549
- let It = ct;
3549
+ let It = dt;
3550
3550
  Ae(It, "don't await JoinBuilder instances. They are never executed directly and are always just a part of a query.");
3551
3551
  const gs = s({
3552
3552
  is(t) {
@@ -3613,7 +3613,7 @@ const zt = class zt {
3613
3613
  ve = new WeakMap();
3614
3614
  let Et = zt;
3615
3615
  Ae(Et, "don't await OverBuilder instances. They are never executed directly and are always just a part of a query.");
3616
- const dt = s({
3616
+ const ct = s({
3617
3617
  is(t) {
3618
3618
  return t.kind === "SelectionNode";
3619
3619
  },
@@ -3640,14 +3640,14 @@ function la(t) {
3640
3640
  return Ee(t) ? la(t(Wt())) : me(t) ? t.map((e) => zn(e)) : [zn(t)];
3641
3641
  }
3642
3642
  function zn(t) {
3643
- return Y(t) ? dt.create(ds(t)) : ia(t) ? dt.create(t.toOperationNode()) : dt.create(va(t));
3643
+ return Y(t) ? ct.create(cs(t)) : ia(t) ? ct.create(t.toOperationNode()) : ct.create(va(t));
3644
3644
  }
3645
3645
  function _a(t) {
3646
- return t ? Array.isArray(t) ? t.map(Rn) : [Rn(t)] : [dt.createSelectAll()];
3646
+ return t ? Array.isArray(t) ? t.map(Rn) : [Rn(t)] : [ct.createSelectAll()];
3647
3647
  }
3648
3648
  function Rn(t) {
3649
3649
  if (Y(t))
3650
- return dt.createSelectAllFromTable(W(t));
3650
+ return ct.createSelectAllFromTable(W(t));
3651
3651
  throw new Error(`invalid value selectAll expression: ${JSON.stringify(t)}`);
3652
3652
  }
3653
3653
  const ys = s({
@@ -4934,12 +4934,12 @@ class Rs extends Ps {
4934
4934
  b(this, qe, n);
4935
4935
  }
4936
4936
  transformNodeImpl(n) {
4937
- if (!y(this, I, ma).call(this, n))
4937
+ if (!w(this, I, ma).call(this, n))
4938
4938
  return super.transformNodeImpl(n);
4939
- const a = y(this, I, fa).call(this, n);
4939
+ const a = w(this, I, fa).call(this, n);
4940
4940
  for (const u of a)
4941
4941
  i(this, xe).add(u);
4942
- const r = y(this, I, ha).call(this, n);
4942
+ const r = w(this, I, ha).call(this, n);
4943
4943
  for (const u of r)
4944
4944
  i(this, Ce).add(u);
4945
4945
  const o = super.transformNodeImpl(n);
@@ -4966,13 +4966,13 @@ class Rs extends Ps {
4966
4966
  transformAggregateFunction(n) {
4967
4967
  return {
4968
4968
  ...super.transformAggregateFunction({ ...n, aggregated: [] }),
4969
- aggregated: y(this, I, an).call(this, n, "aggregated")
4969
+ aggregated: w(this, I, an).call(this, n, "aggregated")
4970
4970
  };
4971
4971
  }
4972
4972
  transformFunction(n) {
4973
4973
  return {
4974
4974
  ...super.transformFunction({ ...n, arguments: [] }),
4975
- arguments: y(this, I, an).call(this, n, "arguments")
4975
+ arguments: w(this, I, an).call(this, n, "arguments")
4976
4976
  };
4977
4977
  }
4978
4978
  }
@@ -4985,19 +4985,19 @@ qe = new WeakMap(), Ce = new WeakMap(), xe = new WeakMap(), I = new WeakSet(), a
4985
4985
  return n.kind in Ds;
4986
4986
  }, ha = function(n) {
4987
4987
  const a = /* @__PURE__ */ new Set();
4988
- if ("name" in n && n.name && Xt.is(n.name) && y(this, I, rn).call(this, n.name, a), "from" in n && n.from)
4988
+ if ("name" in n && n.name && Xt.is(n.name) && w(this, I, rn).call(this, n.name, a), "from" in n && n.from)
4989
4989
  for (const r of n.from.froms)
4990
- y(this, I, De).call(this, r, a);
4991
- if ("into" in n && n.into && y(this, I, De).call(this, n.into, a), "table" in n && n.table && y(this, I, De).call(this, n.table, a), "joins" in n && n.joins)
4990
+ w(this, I, De).call(this, r, a);
4991
+ if ("into" in n && n.into && w(this, I, De).call(this, n.into, a), "table" in n && n.table && w(this, I, De).call(this, n.table, a), "joins" in n && n.joins)
4992
4992
  for (const r of n.joins)
4993
- y(this, I, De).call(this, r.table, a);
4994
- return "using" in n && n.using && y(this, I, De).call(this, n.using, a), a;
4993
+ w(this, I, De).call(this, r.table, a);
4994
+ return "using" in n && n.using && w(this, I, De).call(this, n.using, a), a;
4995
4995
  }, fa = function(n) {
4996
4996
  const a = /* @__PURE__ */ new Set();
4997
- return "with" in n && n.with && y(this, I, pa).call(this, n.with, a), a;
4997
+ return "with" in n && n.with && w(this, I, pa).call(this, n.with, a), a;
4998
4998
  }, De = function(n, a) {
4999
4999
  const r = _e.is(n) ? n : we.is(n) && _e.is(n.node) ? n.node : null;
5000
- r && y(this, I, rn).call(this, r.table, a);
5000
+ r && w(this, I, rn).call(this, r.table, a);
5001
5001
  }, rn = function(n, a) {
5002
5002
  const r = n.identifier.name;
5003
5003
  !i(this, Ce).has(r) && !i(this, xe).has(r) && a.add(r);
@@ -5074,17 +5074,17 @@ class Ls {
5074
5074
  }
5075
5075
  async executeQuery(e, n) {
5076
5076
  return await this.provideConnection(async (a) => {
5077
- const r = await a.executeQuery(e), o = await y(this, gt, on).call(this, r, n);
5077
+ const r = await a.executeQuery(e), o = await w(this, gt, on).call(this, r, n);
5078
5078
  return Ms(r, o), o;
5079
5079
  });
5080
5080
  }
5081
5081
  async *stream(e, n, a) {
5082
5082
  const r = new Jn(), o = new Jn();
5083
- this.provideConnection(async (d) => (r.resolve(d), await o.promise)).catch((d) => r.reject(d));
5083
+ this.provideConnection(async (c) => (r.resolve(c), await o.promise)).catch((c) => r.reject(c));
5084
5084
  const u = await r.promise;
5085
5085
  try {
5086
- for await (const d of u.streamQuery(e, n))
5087
- yield await y(this, gt, on).call(this, d, a);
5086
+ for await (const c of u.streamQuery(e, n))
5087
+ yield await w(this, gt, on).call(this, c, a);
5088
5088
  } finally {
5089
5089
  o.resolve();
5090
5090
  }
@@ -5234,12 +5234,12 @@ const Ft = class Ft {
5234
5234
  };
5235
5235
  ae = new WeakMap();
5236
5236
  let O = Ft;
5237
- var Ke, de;
5237
+ var Ke, ce;
5238
5238
  class xn {
5239
5239
  constructor(e, n) {
5240
5240
  C(this, Ke);
5241
- C(this, de);
5242
- b(this, Ke, e), b(this, de, n);
5241
+ C(this, ce);
5242
+ b(this, Ke, e), b(this, ce, n);
5243
5243
  }
5244
5244
  /** @private */
5245
5245
  get expression() {
@@ -5247,13 +5247,13 @@ class xn {
5247
5247
  }
5248
5248
  /** @private */
5249
5249
  get alias() {
5250
- return i(this, de);
5250
+ return i(this, ce);
5251
5251
  }
5252
5252
  toOperationNode() {
5253
- return we.create(i(this, Ke).toOperationNode(), q(i(this, de)) ? i(this, de).toOperationNode() : F.create(i(this, de)));
5253
+ return we.create(i(this, Ke).toOperationNode(), q(i(this, ce)) ? i(this, ce).toOperationNode() : F.create(i(this, ce)));
5254
5254
  }
5255
5255
  }
5256
- Ke = new WeakMap(), de = new WeakMap();
5256
+ Ke = new WeakMap(), ce = new WeakMap();
5257
5257
  var Te;
5258
5258
  const jt = class jt {
5259
5259
  constructor(e) {
@@ -6145,8 +6145,8 @@ const Wn = s({
6145
6145
  });
6146
6146
  }
6147
6147
  });
6148
- var G, wt, cn;
6149
- class dn {
6148
+ var G, wt, dn;
6149
+ class cn {
6150
6150
  constructor(e) {
6151
6151
  C(this, wt);
6152
6152
  C(this, G);
@@ -6220,7 +6220,7 @@ class dn {
6220
6220
  * ```
6221
6221
  */
6222
6222
  at(e) {
6223
- return y(this, wt, cn).call(this, "ArrayLocation", e);
6223
+ return w(this, wt, dn).call(this, "ArrayLocation", e);
6224
6224
  }
6225
6225
  /**
6226
6226
  * Access a property of a JSON object.
@@ -6272,14 +6272,14 @@ class dn {
6272
6272
  * ```
6273
6273
  */
6274
6274
  key(e) {
6275
- return y(this, wt, cn).call(this, "Member", e);
6275
+ return w(this, wt, dn).call(this, "Member", e);
6276
6276
  }
6277
6277
  }
6278
- G = new WeakMap(), wt = new WeakSet(), cn = function(e, n) {
6278
+ G = new WeakMap(), wt = new WeakSet(), dn = function(e, n) {
6279
6279
  return St.is(i(this, G)) ? new $t(St.cloneWithTraversal(i(this, G), ut.is(i(this, G).traversal) ? ut.cloneWithLeg(i(this, G).traversal, Wn.create(e, n)) : ua.cloneWithValue(i(this, G).traversal, pe.createImmediate(n)))) : new $t(ut.cloneWithLeg(i(this, G), Wn.create(e, n)));
6280
6280
  };
6281
6281
  var Se;
6282
- const Mt = class Mt extends dn {
6282
+ const Mt = class Mt extends cn {
6283
6283
  constructor(n) {
6284
6284
  super(n);
6285
6285
  C(this, Se);
@@ -6309,12 +6309,12 @@ const Mt = class Mt extends dn {
6309
6309
  };
6310
6310
  Se = new WeakMap();
6311
6311
  let $t = Mt;
6312
- var Ze, ce;
6312
+ var Ze, de;
6313
6313
  class iu {
6314
6314
  constructor(e, n) {
6315
6315
  C(this, Ze);
6316
- C(this, ce);
6317
- b(this, Ze, e), b(this, ce, n);
6316
+ C(this, de);
6317
+ b(this, Ze, e), b(this, de, n);
6318
6318
  }
6319
6319
  /** @private */
6320
6320
  get expression() {
@@ -6322,13 +6322,13 @@ class iu {
6322
6322
  }
6323
6323
  /** @private */
6324
6324
  get alias() {
6325
- return i(this, ce);
6325
+ return i(this, de);
6326
6326
  }
6327
6327
  toOperationNode() {
6328
- return we.create(i(this, Ze).toOperationNode(), q(i(this, ce)) ? i(this, ce).toOperationNode() : F.create(i(this, ce)));
6328
+ return we.create(i(this, Ze).toOperationNode(), q(i(this, de)) ? i(this, de).toOperationNode() : F.create(i(this, de)));
6329
6329
  }
6330
6330
  }
6331
- Ze = new WeakMap(), ce = new WeakMap();
6331
+ Ze = new WeakMap(), de = new WeakMap();
6332
6332
  const Kn = s({
6333
6333
  is(t) {
6334
6334
  return t.kind === "TupleNode";
@@ -6395,7 +6395,7 @@ const Kn = s({
6395
6395
  /^timestamp\(\d+\)$/,
6396
6396
  /^timestamptz\(\d+\)$/,
6397
6397
  /^varbinary\(\d+\)$/
6398
- ], du = s({
6398
+ ], cu = s({
6399
6399
  is(t) {
6400
6400
  return t.kind === "DataTypeNode";
6401
6401
  },
@@ -6406,14 +6406,14 @@ const Kn = s({
6406
6406
  });
6407
6407
  }
6408
6408
  });
6409
- function cu(t) {
6409
+ function du(t) {
6410
6410
  return !!(su.includes(t) || uu.some((e) => e.test(t)));
6411
6411
  }
6412
6412
  function lu(t) {
6413
6413
  if (q(t))
6414
6414
  return t.toOperationNode();
6415
- if (cu(t))
6416
- return du.create(t);
6415
+ if (du(t))
6416
+ return cu.create(t);
6417
6417
  throw new Error(`invalid column data type ${JSON.stringify(t)}`);
6418
6418
  }
6419
6419
  const _u = s({
@@ -6451,10 +6451,10 @@ function bn(t = wa) {
6451
6451
  });
6452
6452
  },
6453
6453
  ref(r, o) {
6454
- return Ot(o) ? new O(fe(r)) : new dn(us(r, o));
6454
+ return Ot(o) ? new O(fe(r)) : new cn(us(r, o));
6455
6455
  },
6456
6456
  jsonPath() {
6457
- return new dn(ut.create());
6457
+ return new cn(ut.create());
6458
6458
  },
6459
6459
  table(r) {
6460
6460
  return new O(W(r));
@@ -6579,14 +6579,14 @@ const lt = class lt {
6579
6579
  });
6580
6580
  }
6581
6581
  toOperationNode() {
6582
- return y(this, M, ln).call(this, y(this, M, bt).call(this));
6582
+ return w(this, M, ln).call(this, w(this, M, bt).call(this));
6583
6583
  }
6584
6584
  compile(e) {
6585
- return y(this, M, _n).call(this, y(this, M, bt).call(this, e));
6585
+ return w(this, M, _n).call(this, w(this, M, bt).call(this, e));
6586
6586
  }
6587
6587
  async execute(e) {
6588
- const n = y(this, M, bt).call(this, e);
6589
- return n.executeQuery(y(this, M, _n).call(this, n), i(this, P).queryId);
6588
+ const n = w(this, M, bt).call(this, e);
6589
+ return n.executeQuery(w(this, M, _n).call(this, n), i(this, P).queryId);
6590
6590
  }
6591
6591
  };
6592
6592
  P = new WeakMap(), M = new WeakSet(), bt = function(e) {
@@ -6595,7 +6595,7 @@ P = new WeakMap(), M = new WeakSet(), bt = function(e) {
6595
6595
  }, ln = function(e) {
6596
6596
  return e.transformQuery(i(this, P).rawNode, i(this, P).queryId);
6597
6597
  }, _n = function(e) {
6598
- return e.compileQuery(y(this, M, ln).call(this, e), i(this, P).queryId);
6598
+ return e.compileQuery(w(this, M, ln).call(this, e), i(this, P).queryId);
6599
6599
  };
6600
6600
  let Dt = lt;
6601
6601
  function se(t) {
@@ -6624,7 +6624,7 @@ class xa {
6624
6624
  }
6625
6625
  ke = new WeakMap(), le = new WeakMap();
6626
6626
  Ae(xa, "don't await AliasedRawBuilder instances directly. AliasedRawBuilder should never be executed directly since it's always a part of another query.");
6627
- const g = Object.assign((t, ...e) => se({
6627
+ const p = Object.assign((t, ...e) => se({
6628
6628
  queryId: X(),
6629
6629
  rawNode: R.create(t, (e == null ? void 0 : e.map(Un)) ?? [])
6630
6630
  }), {
@@ -6671,7 +6671,7 @@ const g = Object.assign((t, ...e) => se({
6671
6671
  rawNode: R.createWithSql(t)
6672
6672
  });
6673
6673
  },
6674
- join(t, e = g`, `) {
6674
+ join(t, e = p`, `) {
6675
6675
  const n = new Array(2 * t.length - 1), a = e.toOperationNode();
6676
6676
  for (let r = 0; r < t.length; ++r)
6677
6677
  n[2 * r] = Un(t[r]), r !== t.length - 1 && (n[2 * r + 1] = a);
@@ -6706,8 +6706,8 @@ class ba {
6706
6706
  * The returned array is sorted by migration name.
6707
6707
  */
6708
6708
  async getMigrations() {
6709
- const e = await y(this, m, Re).call(this, i(this, m, ee)) ? await i(this, k).db.withPlugin(i(this, m, te)).selectFrom(i(this, m, ee)).select(["name", "timestamp"]).$narrowType().execute() : [];
6710
- return (await y(this, m, fn).call(this)).map(({ name: a, ...r }) => {
6709
+ const e = await w(this, m, Re).call(this, i(this, m, ee)) ? await i(this, k).db.withPlugin(i(this, m, te)).selectFrom(i(this, m, ee)).select(["name", "timestamp"]).$narrowType().execute() : [];
6710
+ return (await w(this, m, fn).call(this)).map(({ name: a, ...r }) => {
6711
6711
  const o = e.find((u) => u.name === a);
6712
6712
  return {
6713
6713
  name: a,
@@ -6763,7 +6763,7 @@ class ba {
6763
6763
  * ```
6764
6764
  */
6765
6765
  async migrateToLatest() {
6766
- return y(this, m, ot).call(this, () => ({ direction: "Up", step: 1 / 0 }));
6766
+ return w(this, m, ot).call(this, () => ({ direction: "Up", step: 1 / 0 }));
6767
6767
  }
6768
6768
  /**
6769
6769
  * Migrate up/down to a specific migration.
@@ -6817,12 +6817,12 @@ class ba {
6817
6817
  * ```
6818
6818
  */
6819
6819
  async migrateTo(e) {
6820
- return y(this, m, ot).call(this, ({ migrations: n, executedMigrations: a, pendingMigrations: r }) => {
6820
+ return w(this, m, ot).call(this, ({ migrations: n, executedMigrations: a, pendingMigrations: r }) => {
6821
6821
  if (e === wu)
6822
6822
  return { direction: "Down", step: 1 / 0 };
6823
- if (!n.find((d) => d.name === e))
6823
+ if (!n.find((c) => c.name === e))
6824
6824
  throw new Error(`migration "${e}" doesn't exist`);
6825
- const o = a.indexOf(e), u = r.findIndex((d) => d.name === e);
6825
+ const o = a.indexOf(e), u = r.findIndex((c) => c.name === e);
6826
6826
  if (o !== -1)
6827
6827
  return {
6828
6828
  direction: "Down",
@@ -6862,7 +6862,7 @@ class ba {
6862
6862
  * ```
6863
6863
  */
6864
6864
  async migrateUp() {
6865
- return y(this, m, ot).call(this, () => ({ direction: "Up", step: 1 }));
6865
+ return w(this, m, ot).call(this, () => ({ direction: "Up", step: 1 }));
6866
6866
  }
6867
6867
  /**
6868
6868
  * Migrate one step down.
@@ -6893,12 +6893,12 @@ class ba {
6893
6893
  * ```
6894
6894
  */
6895
6895
  async migrateDown() {
6896
- return y(this, m, ot).call(this, () => ({ direction: "Down", step: 1 }));
6896
+ return w(this, m, ot).call(this, () => ({ direction: "Down", step: 1 }));
6897
6897
  }
6898
6898
  }
6899
6899
  k = new WeakMap(), m = new WeakSet(), ot = async function(e) {
6900
6900
  try {
6901
- return await y(this, m, Oa).call(this), await y(this, m, Aa).call(this, e);
6901
+ return await w(this, m, Oa).call(this), await w(this, m, Aa).call(this, e);
6902
6902
  } catch (n) {
6903
6903
  return n instanceof Ht ? n.resultSet : { error: n };
6904
6904
  }
@@ -6913,37 +6913,37 @@ k = new WeakMap(), m = new WeakSet(), ot = async function(e) {
6913
6913
  }, te = function() {
6914
6914
  return i(this, m, Z) ? new ga(i(this, m, Z)) : new fu();
6915
6915
  }, Oa = async function() {
6916
- await y(this, m, Sa).call(this), await y(this, m, ka).call(this), await y(this, m, Ia).call(this), await y(this, m, Ea).call(this);
6916
+ await w(this, m, Sa).call(this), await w(this, m, ka).call(this), await w(this, m, Ia).call(this), await w(this, m, Ea).call(this);
6917
6917
  }, Sa = async function() {
6918
- if (i(this, m, Z) && !await y(this, m, mn).call(this))
6918
+ if (i(this, m, Z) && !await w(this, m, mn).call(this))
6919
6919
  try {
6920
- await y(this, m, it).call(this, i(this, k).db.schema.createSchema(i(this, m, Z)));
6920
+ await w(this, m, it).call(this, i(this, k).db.schema.createSchema(i(this, m, Z)));
6921
6921
  } catch (e) {
6922
- if (!await y(this, m, mn).call(this))
6922
+ if (!await w(this, m, mn).call(this))
6923
6923
  throw e;
6924
6924
  }
6925
6925
  }, ka = async function() {
6926
- if (!await y(this, m, Re).call(this, i(this, m, ee)))
6926
+ if (!await w(this, m, Re).call(this, i(this, m, ee)))
6927
6927
  try {
6928
- i(this, m, Z) && await y(this, m, it).call(this, i(this, k).db.schema.createSchema(i(this, m, Z))), await y(this, m, it).call(this, i(this, k).db.schema.withPlugin(i(this, m, te)).createTable(i(this, m, ee)).addColumn("name", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("timestamp", "varchar(255)", (e) => e.notNull()));
6928
+ i(this, m, Z) && await w(this, m, it).call(this, i(this, k).db.schema.createSchema(i(this, m, Z))), await w(this, m, it).call(this, i(this, k).db.schema.withPlugin(i(this, m, te)).createTable(i(this, m, ee)).addColumn("name", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("timestamp", "varchar(255)", (e) => e.notNull()));
6929
6929
  } catch (e) {
6930
- if (!await y(this, m, Re).call(this, i(this, m, ee)))
6930
+ if (!await w(this, m, Re).call(this, i(this, m, ee)))
6931
6931
  throw e;
6932
6932
  }
6933
6933
  }, Ia = async function() {
6934
- if (!await y(this, m, Re).call(this, i(this, m, ze)))
6934
+ if (!await w(this, m, Re).call(this, i(this, m, ze)))
6935
6935
  try {
6936
- await y(this, m, it).call(this, i(this, k).db.schema.withPlugin(i(this, m, te)).createTable(i(this, m, ze)).addColumn("id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("is_locked", "integer", (e) => e.notNull().defaultTo(0)));
6936
+ await w(this, m, it).call(this, i(this, k).db.schema.withPlugin(i(this, m, te)).createTable(i(this, m, ze)).addColumn("id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("is_locked", "integer", (e) => e.notNull().defaultTo(0)));
6937
6937
  } catch (e) {
6938
- if (!await y(this, m, Re).call(this, i(this, m, ze)))
6938
+ if (!await w(this, m, Re).call(this, i(this, m, ze)))
6939
6939
  throw e;
6940
6940
  }
6941
6941
  }, Ea = async function() {
6942
- if (!await y(this, m, hn).call(this))
6942
+ if (!await w(this, m, hn).call(this))
6943
6943
  try {
6944
6944
  await i(this, k).db.withPlugin(i(this, m, te)).insertInto(i(this, m, ze)).values({ id: Yt, is_locked: 0 }).execute();
6945
6945
  } catch (e) {
6946
- if (!await y(this, m, hn).call(this))
6946
+ if (!await w(this, m, hn).call(this))
6947
6947
  throw e;
6948
6948
  }
6949
6949
  }, mn = async function() {
@@ -6963,20 +6963,20 @@ k = new WeakMap(), m = new WeakSet(), ot = async function(e) {
6963
6963
  }), r = async (o) => {
6964
6964
  try {
6965
6965
  await n.acquireMigrationLock(o, a);
6966
- const u = await y(this, m, $a).call(this, o);
6966
+ const u = await w(this, m, $a).call(this, o);
6967
6967
  if (u.migrations.length === 0)
6968
6968
  return { results: [] };
6969
- const { direction: d, step: c } = e(u);
6970
- return c <= 0 ? { results: [] } : d === "Down" ? await y(this, m, Fa).call(this, o, u, c) : d === "Up" ? await y(this, m, ja).call(this, o, u, c) : { results: [] };
6969
+ const { direction: c, step: d } = e(u);
6970
+ return d <= 0 ? { results: [] } : c === "Down" ? await w(this, m, Fa).call(this, o, u, d) : c === "Up" ? await w(this, m, ja).call(this, o, u, d) : { results: [] };
6971
6971
  } finally {
6972
6972
  await n.releaseMigrationLock(o, a);
6973
6973
  }
6974
6974
  };
6975
6975
  return n.supportsTransactionalDdl ? i(this, k).db.transaction().execute(r) : i(this, k).db.connection().execute(r);
6976
6976
  }, $a = async function(e) {
6977
- const n = await y(this, m, fn).call(this), a = await y(this, m, Da).call(this, e);
6978
- y(this, m, za).call(this, n, a), i(this, m, Ta) || y(this, m, Ra).call(this, n, a);
6979
- const r = y(this, m, Pa).call(this, n, a);
6977
+ const n = await w(this, m, fn).call(this), a = await w(this, m, Da).call(this, e);
6978
+ w(this, m, za).call(this, n, a), i(this, m, Ta) || w(this, m, Ra).call(this, n, a);
6979
+ const r = w(this, m, Pa).call(this, n, a);
6980
6980
  return s({
6981
6981
  migrations: n,
6982
6982
  executedMigrations: a,
@@ -7003,26 +7003,26 @@ k = new WeakMap(), m = new WeakSet(), ot = async function(e) {
7003
7003
  if (e[a].name !== n[a])
7004
7004
  throw new Error(`corrupted migrations: expected previously executed migration ${n[a]} to be at index ${a} but ${e[a].name} was found in its place. New migrations must always have a name that comes alphabetically after the last executed migration.`);
7005
7005
  }, Fa = async function(e, n, a) {
7006
- const r = n.executedMigrations.slice().reverse().slice(0, a).map((u) => n.migrations.find((d) => d.name === u)), o = r.map((u) => ({
7006
+ const r = n.executedMigrations.slice().reverse().slice(0, a).map((u) => n.migrations.find((c) => c.name === u)), o = r.map((u) => ({
7007
7007
  migrationName: u.name,
7008
7008
  direction: "Down",
7009
7009
  status: "NotExecuted"
7010
7010
  }));
7011
7011
  for (let u = 0; u < o.length; ++u) {
7012
- const d = r[u];
7012
+ const c = r[u];
7013
7013
  try {
7014
- d.down && (await d.down(e), await e.withPlugin(i(this, m, te)).deleteFrom(i(this, m, ee)).where("name", "=", d.name).execute(), o[u] = {
7015
- migrationName: d.name,
7014
+ c.down && (await c.down(e), await e.withPlugin(i(this, m, te)).deleteFrom(i(this, m, ee)).where("name", "=", c.name).execute(), o[u] = {
7015
+ migrationName: c.name,
7016
7016
  direction: "Down",
7017
7017
  status: "Success"
7018
7018
  });
7019
- } catch (c) {
7019
+ } catch (d) {
7020
7020
  throw o[u] = {
7021
- migrationName: d.name,
7021
+ migrationName: c.name,
7022
7022
  direction: "Down",
7023
7023
  status: "Error"
7024
7024
  }, new Ht({
7025
- error: c,
7025
+ error: d,
7026
7026
  results: o
7027
7027
  });
7028
7028
  }
@@ -7035,23 +7035,23 @@ k = new WeakMap(), m = new WeakSet(), ot = async function(e) {
7035
7035
  status: "NotExecuted"
7036
7036
  }));
7037
7037
  for (let u = 0; u < o.length; u++) {
7038
- const d = n.pendingMigrations[u];
7038
+ const c = n.pendingMigrations[u];
7039
7039
  try {
7040
- await d.up(e), await e.withPlugin(i(this, m, te)).insertInto(i(this, m, ee)).values({
7041
- name: d.name,
7040
+ await c.up(e), await e.withPlugin(i(this, m, te)).insertInto(i(this, m, ee)).values({
7041
+ name: c.name,
7042
7042
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
7043
7043
  }).execute(), o[u] = {
7044
- migrationName: d.name,
7044
+ migrationName: c.name,
7045
7045
  direction: "Up",
7046
7046
  status: "Success"
7047
7047
  };
7048
- } catch (c) {
7048
+ } catch (d) {
7049
7049
  throw o[u] = {
7050
- migrationName: d.name,
7050
+ migrationName: c.name,
7051
7051
  direction: "Up",
7052
7052
  status: "Error"
7053
7053
  }, new Ht({
7054
- error: c,
7054
+ error: d,
7055
7055
  results: o
7056
7056
  });
7057
7057
  }
@@ -7310,56 +7310,56 @@ async function Xu(t) {
7310
7310
  }
7311
7311
  async function Zu(t) {
7312
7312
  }
7313
- const ed = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7313
+ const ec = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7314
7314
  __proto__: null,
7315
7315
  down: Zu,
7316
7316
  up: Xu
7317
7317
  }, Symbol.toStringTag, { value: "Module" }));
7318
- async function td(t) {
7318
+ async function tc(t) {
7319
7319
  await t.schema.createIndex("users_email_index").on("users").column("email").execute();
7320
7320
  }
7321
- async function nd(t) {
7321
+ async function nc(t) {
7322
7322
  await t.schema.dropIndex("users_email_index").execute();
7323
7323
  }
7324
- const ad = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7324
+ const ac = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7325
7325
  __proto__: null,
7326
- down: nd,
7327
- up: td
7326
+ down: nc,
7327
+ up: tc
7328
7328
  }, Symbol.toStringTag, { value: "Module" }));
7329
- async function rd(t) {
7329
+ async function rc(t) {
7330
7330
  await t.schema.alterTable("users").addColumn("profileData", "varchar(2048)").execute();
7331
7331
  }
7332
- async function od(t) {
7332
+ async function oc(t) {
7333
7333
  await t.schema.alterTable("users").dropColumn("profileData").execute();
7334
7334
  }
7335
- const id = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7335
+ const ic = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7336
7336
  __proto__: null,
7337
- down: od,
7338
- up: rd
7337
+ down: oc,
7338
+ up: rc
7339
7339
  }, Symbol.toStringTag, { value: "Module" }));
7340
- async function sd(t) {
7340
+ async function sc(t) {
7341
7341
  await t.schema.createIndex("users_linked_to_index").on("users").column("linked_to").execute();
7342
7342
  }
7343
- async function ud(t) {
7343
+ async function uc(t) {
7344
7344
  await t.schema.dropIndex("users_linked_to_index");
7345
7345
  }
7346
- const dd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7346
+ const cc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7347
7347
  __proto__: null,
7348
- down: ud,
7349
- up: sd
7348
+ down: uc,
7349
+ up: sc
7350
7350
  }, Symbol.toStringTag, { value: "Module" }));
7351
- async function cd(t) {
7351
+ async function dc(t) {
7352
7352
  await t.schema.alterTable("users").addColumn("locale", "varchar(255)").execute();
7353
7353
  }
7354
- async function ld(t) {
7354
+ async function lc(t) {
7355
7355
  await t.schema.alterTable("users").dropColumn("locale").execute();
7356
7356
  }
7357
- const _d = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7357
+ const _c = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7358
7358
  __proto__: null,
7359
- down: ld,
7360
- up: cd
7359
+ down: lc,
7360
+ up: dc
7361
7361
  }, Symbol.toStringTag, { value: "Module" }));
7362
- async function md(t) {
7362
+ async function mc(t) {
7363
7363
  await t.schema.createTable("keys").addColumn("kid", "varchar(255)", (e) => e.primaryKey()).addColumn(
7364
7364
  "tenant_id",
7365
7365
  "varchar(255)",
@@ -7374,202 +7374,202 @@ async function md(t) {
7374
7374
  (e) => e.references("connections.id").onDelete("cascade")
7375
7375
  ).execute();
7376
7376
  }
7377
- async function hd(t) {
7377
+ async function hc(t) {
7378
7378
  await t.schema.dropTable("keys").execute();
7379
7379
  }
7380
- const fd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7380
+ const fc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7381
7381
  __proto__: null,
7382
- down: hd,
7383
- up: md
7382
+ down: hc,
7383
+ up: mc
7384
7384
  }, Symbol.toStringTag, { value: "Module" }));
7385
- async function pd(t) {
7385
+ async function pc(t) {
7386
7386
  }
7387
- async function gd(t) {
7387
+ async function gc(t) {
7388
7388
  }
7389
- const wd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7389
+ const wc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7390
7390
  __proto__: null,
7391
- down: gd,
7392
- up: pd
7391
+ down: gc,
7392
+ up: pc
7393
7393
  }, Symbol.toStringTag, { value: "Module" }));
7394
- async function yd(t) {
7394
+ async function yc(t) {
7395
7395
  }
7396
- async function Nd(t) {
7396
+ async function Nc(t) {
7397
7397
  }
7398
- const vd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7398
+ const vc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7399
7399
  __proto__: null,
7400
- down: Nd,
7401
- up: yd
7400
+ down: Nc,
7401
+ up: yc
7402
7402
  }, Symbol.toStringTag, { value: "Module" }));
7403
- async function Cd(t) {
7403
+ async function Cc(t) {
7404
7404
  await t.schema.alterTable("otps").addColumn("audience", "varchar(255)").execute();
7405
7405
  }
7406
- async function xd(t) {
7406
+ async function xc(t) {
7407
7407
  await t.schema.alterTable("otps").dropColumn("audience").execute();
7408
7408
  }
7409
- const bd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7409
+ const bc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7410
7410
  __proto__: null,
7411
- down: xd,
7412
- up: Cd
7411
+ down: xc,
7412
+ up: Cc
7413
7413
  }, Symbol.toStringTag, { value: "Module" }));
7414
- async function Td(t) {
7414
+ async function Tc(t) {
7415
7415
  }
7416
- async function Od(t) {
7416
+ async function Oc(t) {
7417
7417
  }
7418
- const Sd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7418
+ const Sc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7419
7419
  __proto__: null,
7420
- down: Od,
7421
- up: Td
7420
+ down: Oc,
7421
+ up: Tc
7422
7422
  }, Symbol.toStringTag, { value: "Module" }));
7423
- async function kd(t) {
7423
+ async function kc(t) {
7424
7424
  await t.schema.alterTable("logs").dropColumn("category").execute();
7425
7425
  }
7426
- async function Id(t) {
7426
+ async function Ic(t) {
7427
7427
  await t.schema.alterTable("logs").addColumn("category", "varchar(255)", (e) => e.notNull()).execute();
7428
7428
  }
7429
- const Ed = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7429
+ const Ec = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7430
7430
  __proto__: null,
7431
- down: Id,
7432
- up: kd
7431
+ down: Ic,
7432
+ up: kc
7433
7433
  }, Symbol.toStringTag, { value: "Module" }));
7434
- async function Ad(t) {
7434
+ async function Ac(t) {
7435
7435
  await t.schema.alterTable("users").dropColumn("tags").execute();
7436
7436
  }
7437
- async function $d(t) {
7437
+ async function $c(t) {
7438
7438
  await t.schema.alterTable("users").addColumn("tags", "varchar(255)").execute();
7439
7439
  }
7440
- const Pd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7440
+ const Pc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7441
7441
  __proto__: null,
7442
- down: $d,
7443
- up: Ad
7442
+ down: $c,
7443
+ up: Ac
7444
7444
  }, Symbol.toStringTag, { value: "Module" }));
7445
- async function Dd(t) {
7445
+ async function Dc(t) {
7446
7446
  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();
7447
7447
  }
7448
- async function zd(t) {
7448
+ async function zc(t) {
7449
7449
  await t.schema.dropIndex("logs_user_id"), await t.schema.dropIndex("logs_tenant_id"), await t.schema.dropIndex("logs_date");
7450
7450
  }
7451
- const Rd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7451
+ const Rc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7452
7452
  __proto__: null,
7453
- down: zd,
7454
- up: Dd
7453
+ down: zc,
7454
+ up: Dc
7455
7455
  }, Symbol.toStringTag, { value: "Module" }));
7456
- async function Fd(t) {
7456
+ async function Fc(t) {
7457
7457
  await t.schema.alterTable("logs").dropColumn("details").execute(), await t.schema.alterTable("logs").addColumn("details", "varchar(8192)").execute();
7458
7458
  }
7459
- async function jd(t) {
7459
+ async function jc(t) {
7460
7460
  await t.schema.alterTable("logs").dropColumn("details").execute(), await t.schema.alterTable("logs").addColumn("details", "varchar(2048)").execute();
7461
7461
  }
7462
- const Ld = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7462
+ const Lc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7463
7463
  __proto__: null,
7464
- down: jd,
7465
- up: Fd
7464
+ down: jc,
7465
+ up: Fc
7466
7466
  }, Symbol.toStringTag, { value: "Module" }));
7467
- async function Md(t) {
7467
+ async function Mc(t) {
7468
7468
  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();
7469
7469
  }
7470
- async function Jd(t) {
7470
+ async function Jc(t) {
7471
7471
  await t.schema.alterTable("logs").dropColumn("user_name").execute(), await t.schema.alterTable("logs").dropColumn("auth0_client").execute(), await t.schema.alterTable("logs").dropColumn("isMobile").execute(), await t.schema.alterTable("logs").dropColumn("connection").execute(), await t.schema.alterTable("logs").dropColumn("connection_id").execute(), await t.schema.alterTable("logs").dropColumn("audience").execute(), await t.schema.alterTable("logs").dropColumn("scope").execute(), await t.schema.alterTable("logs").dropColumn("strategy").execute(), await t.schema.alterTable("logs").dropColumn("strategy_type").execute(), await t.schema.alterTable("logs").dropColumn("hostname").execute(), await t.schema.alterTable("logs").dropColumn("session_connection").execute();
7472
7472
  }
7473
- const qd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7473
+ const qc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7474
7474
  __proto__: null,
7475
- down: Jd,
7476
- up: Md
7475
+ down: Jc,
7476
+ up: Mc
7477
7477
  }, Symbol.toStringTag, { value: "Module" }));
7478
- async function Bd(t) {
7478
+ async function Bc(t) {
7479
7479
  await t.schema.createIndex("users_name_index").on("users").column("name").execute();
7480
7480
  }
7481
- async function Wd(t) {
7481
+ async function Wc(t) {
7482
7482
  await t.schema.dropIndex("users_name_index").execute();
7483
7483
  }
7484
- const Kd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7484
+ const Kc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7485
7485
  __proto__: null,
7486
- down: Wd,
7487
- up: Bd
7486
+ down: Wc,
7487
+ up: Bc
7488
7488
  }, Symbol.toStringTag, { value: "Module" }));
7489
- async function Ud(t) {
7489
+ async function Uc(t) {
7490
7490
  }
7491
- async function Qd(t) {
7491
+ async function Qc(t) {
7492
7492
  await t.schema.alterTable("users").dropConstraint("unique_email_provider").execute();
7493
7493
  }
7494
- const Vd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7494
+ const Vc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7495
7495
  __proto__: null,
7496
- down: Qd,
7497
- up: Ud
7496
+ down: Qc,
7497
+ up: Uc
7498
7498
  }, Symbol.toStringTag, { value: "Module" }));
7499
- async function Gd(t) {
7499
+ async function Gc(t) {
7500
7500
  await t.schema.alterTable("otps").dropColumn("state").execute(), await t.schema.alterTable("otps").addColumn("state", "varchar(8192)").execute();
7501
7501
  }
7502
- async function Yd(t) {
7502
+ async function Yc(t) {
7503
7503
  await t.schema.alterTable("otps").dropColumn("state").execute(), await t.schema.alterTable("otps").addColumn("state", "varchar(1024)").execute();
7504
7504
  }
7505
- const Hd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7505
+ const Hc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7506
7506
  __proto__: null,
7507
- down: Yd,
7508
- up: Gd
7507
+ down: Yc,
7508
+ up: Gc
7509
7509
  }, Symbol.toStringTag, { value: "Module" }));
7510
- async function Xd(t) {
7510
+ async function Xc(t) {
7511
7511
  await t.schema.alterTable("tickets").dropColumn("state").execute(), await t.schema.alterTable("tickets").addColumn("state", "varchar(8192)").execute();
7512
7512
  }
7513
- async function Zd(t) {
7513
+ async function Zc(t) {
7514
7514
  await t.schema.alterTable("tickets").dropColumn("state").execute(), await t.schema.alterTable("tickets").addColumn("state", "varchar(1024)").execute();
7515
7515
  }
7516
- const ec = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7516
+ const ed = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7517
7517
  __proto__: null,
7518
- down: Zd,
7519
- up: Xd
7518
+ down: Zc,
7519
+ up: Xc
7520
7520
  }, Symbol.toStringTag, { value: "Module" }));
7521
- async function tc(t) {
7521
+ async function td(t) {
7522
7522
  await t.schema.createTable("branding").addColumn(
7523
7523
  "tenant_id",
7524
7524
  "varchar(255)",
7525
7525
  (e) => e.references("tenants.id").onDelete("cascade").notNull().primaryKey()
7526
7526
  ).addColumn("logo_url", "varchar(512)").addColumn("favicon_url", "varchar(512)").addColumn("font_url", "varchar(512)").addColumn("colors_primary", "varchar(8)").addColumn("colors_page_background_type", "varchar(32)").addColumn("colors_page_background_start", "varchar(8)").addColumn("colors_page_background_end", "varchar(8)").addColumn("colors_page_background_angle_dev", "integer").execute();
7527
7527
  }
7528
- async function nc(t) {
7528
+ async function nd(t) {
7529
7529
  await t.schema.dropTable("branding").execute();
7530
7530
  }
7531
- const ac = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7531
+ const ad = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7532
7532
  __proto__: null,
7533
- down: nc,
7534
- up: tc
7533
+ down: nd,
7534
+ up: td
7535
7535
  }, Symbol.toStringTag, { value: "Module" }));
7536
- async function rc(t) {
7536
+ async function rd(t) {
7537
7537
  }
7538
- async function oc(t) {
7538
+ async function od(t) {
7539
7539
  }
7540
- const ic = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7540
+ const id = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7541
7541
  __proto__: null,
7542
- down: oc,
7543
- up: rc
7542
+ down: od,
7543
+ up: rd
7544
7544
  }, Symbol.toStringTag, { value: "Module" }));
7545
- async function sc(t) {
7545
+ async function sd(t) {
7546
7546
  }
7547
- async function uc(t) {
7547
+ async function ud(t) {
7548
7548
  }
7549
- const dc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7549
+ const cd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7550
7550
  __proto__: null,
7551
- down: uc,
7552
- up: sc
7551
+ down: ud,
7552
+ up: sd
7553
7553
  }, Symbol.toStringTag, { value: "Module" }));
7554
- async function cc(t) {
7554
+ async function dd(t) {
7555
7555
  }
7556
- async function lc(t) {
7556
+ async function ld(t) {
7557
7557
  }
7558
- const _c = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7558
+ const _d = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7559
7559
  __proto__: null,
7560
- down: lc,
7561
- up: cc
7560
+ down: ld,
7561
+ up: dd
7562
7562
  }, Symbol.toStringTag, { value: "Module" }));
7563
- async function mc(t) {
7563
+ async function md(t) {
7564
7564
  }
7565
- async function hc(t) {
7565
+ async function hd(t) {
7566
7566
  }
7567
- const fc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7567
+ const fd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7568
7568
  __proto__: null,
7569
- down: hc,
7570
- up: mc
7569
+ down: hd,
7570
+ up: md
7571
7571
  }, Symbol.toStringTag, { value: "Module" }));
7572
- async function pc(t) {
7572
+ async function pd(t) {
7573
7573
  await t.schema.createTable("authentication_codes").addColumn(
7574
7574
  "tenant_id",
7575
7575
  "varchar(255)",
@@ -7580,55 +7580,55 @@ async function pc(t) {
7580
7580
  (e) => e.references("applications.id").onDelete("cascade").notNull()
7581
7581
  ).addColumn("user_id", "varchar(255)", (e) => e.notNull()).addColumn("nonce", "varchar(255)").addColumn("state", "varchar(8192)").addColumn("scope", "varchar(1024)").addColumn("response_type", "varchar(256)").addColumn("response_mode", "varchar(256)").addColumn("redirect_uri", "varchar(1024)").addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("expires_at", "varchar(255)", (e) => e.notNull()).addColumn("used_at", "varchar(255)").execute();
7582
7582
  }
7583
- async function gc(t) {
7583
+ async function gd(t) {
7584
7584
  await t.schema.dropTable("authentication_codes").execute();
7585
7585
  }
7586
- const wc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7586
+ const wd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7587
7587
  __proto__: null,
7588
- down: gc,
7589
- up: pc
7588
+ down: gd,
7589
+ up: pd
7590
7590
  }, Symbol.toStringTag, { value: "Module" }));
7591
- async function yc(t) {
7591
+ async function yd(t) {
7592
7592
  }
7593
- async function Nc(t) {
7593
+ async function Nd(t) {
7594
7594
  }
7595
- const vc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7595
+ const vd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7596
7596
  __proto__: null,
7597
- down: Nc,
7598
- up: yc
7597
+ down: Nd,
7598
+ up: yd
7599
7599
  }, Symbol.toStringTag, { value: "Module" }));
7600
- async function Cc(t) {
7600
+ async function Cd(t) {
7601
7601
  await t.schema.alterTable("otps").addColumn("ip", "varchar(64)").execute();
7602
7602
  }
7603
- async function xc(t) {
7603
+ async function xd(t) {
7604
7604
  await t.schema.alterTable("otps").dropColumn("ip").execute();
7605
7605
  }
7606
- const bc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7606
+ const bd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7607
7607
  __proto__: null,
7608
- down: xc,
7609
- up: Cc
7608
+ down: xd,
7609
+ up: Cd
7610
7610
  }, Symbol.toStringTag, { value: "Module" }));
7611
- async function Tc(t) {
7611
+ async function Td(t) {
7612
7612
  await t.schema.alterTable("logs").dropColumn("user_agent").execute(), await t.schema.alterTable("logs").addColumn("user_agent", "varchar(1024)").execute();
7613
7613
  }
7614
- async function Oc(t) {
7614
+ async function Od(t) {
7615
7615
  await t.schema.alterTable("logs").dropColumn("user_agent").execute(), await t.schema.alterTable("logs").addColumn("user_agent", "varchar(255)").execute();
7616
7616
  }
7617
- const Sc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7617
+ const Sd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7618
7618
  __proto__: null,
7619
- down: Oc,
7620
- up: Tc
7619
+ down: Od,
7620
+ up: Td
7621
7621
  }, Symbol.toStringTag, { value: "Module" }));
7622
- async function kc(t) {
7622
+ async function kd(t) {
7623
7623
  }
7624
- async function Ic(t) {
7624
+ async function Id(t) {
7625
7625
  }
7626
- const Ec = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7626
+ const Ed = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7627
7627
  __proto__: null,
7628
- down: Ic,
7629
- up: kc
7628
+ down: Id,
7629
+ up: kd
7630
7630
  }, Symbol.toStringTag, { value: "Module" }));
7631
- async function Ac(t) {
7631
+ async function Ad(t) {
7632
7632
  await t.schema.createTable("hooks").addColumn("hook_id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn(
7633
7633
  "tenant_id",
7634
7634
  "varchar(255)",
@@ -7639,33 +7639,33 @@ async function Ac(t) {
7639
7639
  (e) => e.defaultTo(!1).notNull()
7640
7640
  ).addColumn("priority", "integer").execute();
7641
7641
  }
7642
- async function $c(t) {
7642
+ async function $d(t) {
7643
7643
  await t.schema.dropTable("hooks").execute();
7644
7644
  }
7645
- const Pc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7645
+ const Pd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7646
7646
  __proto__: null,
7647
- down: $c,
7648
- up: Ac
7647
+ down: $d,
7648
+ up: Ad
7649
7649
  }, Symbol.toStringTag, { value: "Module" }));
7650
- async function Dc(t) {
7650
+ async function Dd(t) {
7651
7651
  }
7652
- async function zc(t) {
7652
+ async function zd(t) {
7653
7653
  }
7654
- const Rc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7654
+ const Rd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7655
7655
  __proto__: null,
7656
- down: zc,
7657
- up: Dc
7656
+ down: zd,
7657
+ up: Dd
7658
7658
  }, Symbol.toStringTag, { value: "Module" }));
7659
- async function Fc(t) {
7659
+ async function Fd(t) {
7660
7660
  }
7661
- async function jc(t) {
7661
+ async function jd(t) {
7662
7662
  }
7663
- const Lc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7663
+ const Ld = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7664
7664
  __proto__: null,
7665
- down: jc,
7666
- up: Fc
7665
+ down: jd,
7666
+ up: Fd
7667
7667
  }, Symbol.toStringTag, { value: "Module" }));
7668
- async function Mc(t) {
7668
+ async function Md(t) {
7669
7669
  await t.schema.createTable("logins").addColumn("login_id", "varchar(255)", (e) => e.primaryKey()).addColumn(
7670
7670
  "tenant_id",
7671
7671
  "varchar(255)",
@@ -7682,7 +7682,7 @@ async function Mc(t) {
7682
7682
  (e) => e.onDelete("cascade")
7683
7683
  ).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();
7684
7684
  }
7685
- async function Jc(t) {
7685
+ async function Jd(t) {
7686
7686
  await t.schema.dropTable("logins").execute(), await t.schema.alterTable("passwords").dropColumn("algorithm").execute(), await t.schema.dropTable("codes").execute(), await t.schema.createTable("codes").addColumn("id", "varchar(255)", (e) => e.primaryKey()).addColumn("code", "varchar(255)", (e) => e.notNull()).addColumn("user_id", "varchar(255)").addColumn("tenant_id", "varchar(255)").addForeignKeyConstraint(
7687
7687
  "codes_user_id_tenant_id_constraint",
7688
7688
  ["user_id", "tenant_id"],
@@ -7691,50 +7691,50 @@ async function Jc(t) {
7691
7691
  (e) => e.onDelete("cascade")
7692
7692
  ).addColumn("type", "varchar(255)", (e) => e.notNull()).addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("expires_at", "varchar(255)", (e) => e.notNull()).addColumn("used_at", "varchar(255)").execute();
7693
7693
  }
7694
- const qc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7694
+ const qd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7695
7695
  __proto__: null,
7696
- down: Jc,
7697
- up: Mc
7696
+ down: Jd,
7697
+ up: Md
7698
7698
  }, Symbol.toStringTag, { value: "Module" }));
7699
- async function Bc(t) {
7699
+ async function Bd(t) {
7700
7700
  }
7701
- async function Wc(t) {
7701
+ async function Wd(t) {
7702
7702
  }
7703
- const Kc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7703
+ const Kd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7704
7704
  __proto__: null,
7705
- down: Wc,
7706
- up: Bc
7705
+ down: Wd,
7706
+ up: Bd
7707
7707
  }, Symbol.toStringTag, { value: "Module" }));
7708
- async function Uc(t) {
7708
+ async function Ud(t) {
7709
7709
  await t.schema.alterTable("logins").addColumn("auth0Client", "varchar(256)").execute();
7710
7710
  }
7711
- async function Qc(t) {
7711
+ async function Qd(t) {
7712
7712
  await t.schema.alterTable("logins").dropColumn("auth0Client").execute();
7713
7713
  }
7714
- const Vc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7714
+ const Vd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7715
7715
  __proto__: null,
7716
- down: Qc,
7717
- up: Uc
7716
+ down: Qd,
7717
+ up: Ud
7718
7718
  }, Symbol.toStringTag, { value: "Module" }));
7719
- async function Gc(t) {
7719
+ async function Gd(t) {
7720
7720
  await t.schema.alterTable("logins").dropColumn("authParams_state").execute(), await t.schema.alterTable("logins").addColumn("authParams_state", "varchar(8192)").execute();
7721
7721
  }
7722
- async function Yc(t) {
7722
+ async function Yd(t) {
7723
7723
  await t.schema.alterTable("logins").dropColumn("authParams_state").execute(), await t.schema.alterTable("logins").addColumn("authParams_state", "varchar(511)").execute();
7724
7724
  }
7725
- const Hc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7725
+ const Hd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7726
7726
  __proto__: null,
7727
- down: Yc,
7728
- up: Gc
7727
+ down: Yd,
7728
+ up: Gd
7729
7729
  }, Symbol.toStringTag, { value: "Module" }));
7730
- async function Xc(t) {
7730
+ async function Xd(t) {
7731
7731
  }
7732
- async function Zc(t) {
7732
+ async function Zd(t) {
7733
7733
  }
7734
7734
  const el = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7735
7735
  __proto__: null,
7736
- down: Zc,
7737
- up: Xc
7736
+ down: Zd,
7737
+ up: Xd
7738
7738
  }, Symbol.toStringTag, { value: "Module" }));
7739
7739
  async function tl(t) {
7740
7740
  }
@@ -7760,19 +7760,19 @@ async function sl(t) {
7760
7760
  }
7761
7761
  async function ul(t) {
7762
7762
  }
7763
- const dl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7763
+ const cl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7764
7764
  __proto__: null,
7765
7765
  down: ul,
7766
7766
  up: sl
7767
7767
  }, Symbol.toStringTag, { value: "Module" }));
7768
- async function cl(t) {
7768
+ async function dl(t) {
7769
7769
  }
7770
7770
  async function ll(t) {
7771
7771
  }
7772
7772
  const _l = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7773
7773
  __proto__: null,
7774
7774
  down: ll,
7775
- up: cl
7775
+ up: dl
7776
7776
  }, Symbol.toStringTag, { value: "Module" }));
7777
7777
  async function ml(t) {
7778
7778
  await t.schema.dropTable("codes").execute(), await t.schema.createTable("codes").addColumn("code_id", "varchar(255)", (e) => e.notNull()).addColumn(
@@ -8026,19 +8026,19 @@ async function s_(t) {
8026
8026
  async function u_(t) {
8027
8027
  await t.schema.dropTable("refresh_tokens").execute();
8028
8028
  }
8029
- const d_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8029
+ const c_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8030
8030
  __proto__: null,
8031
8031
  down: u_,
8032
8032
  up: s_
8033
8033
  }, Symbol.toStringTag, { value: "Module" }));
8034
- async function c_(t) {
8034
+ async function d_(t) {
8035
8035
  }
8036
8036
  async function l_(t) {
8037
8037
  }
8038
8038
  const __ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8039
8039
  __proto__: null,
8040
8040
  down: l_,
8041
- up: c_
8041
+ up: d_
8042
8042
  }, Symbol.toStringTag, { value: "Module" }));
8043
8043
  async function m_(t) {
8044
8044
  await t.schema.dropTable("sessions").execute(), await t.schema.dropTable("refresh_tokens").execute();
@@ -8300,12 +8300,12 @@ async function sm(t) {
8300
8300
  async function um(t) {
8301
8301
  await t.schema.alterTable("codes").dropColumn("redirect_uri").execute();
8302
8302
  }
8303
- const dm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8303
+ const cm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8304
8304
  __proto__: null,
8305
8305
  down: um,
8306
8306
  up: sm
8307
8307
  }, Symbol.toStringTag, { value: "Module" }));
8308
- async function cm(t) {
8308
+ async function dm(t) {
8309
8309
  await t.schema.alterTable("codes").addColumn("nonce", "varchar(1024)").execute(), await t.schema.alterTable("codes").addColumn("state", "varchar(2048)").execute();
8310
8310
  }
8311
8311
  async function lm(t) {
@@ -8314,7 +8314,7 @@ async function lm(t) {
8314
8314
  const _m = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8315
8315
  __proto__: null,
8316
8316
  down: lm,
8317
- up: cm
8317
+ up: dm
8318
8318
  }, Symbol.toStringTag, { value: "Module" }));
8319
8319
  async function mm(t) {
8320
8320
  await t.schema.createTable("themes").addColumn(
@@ -8589,7 +8589,7 @@ const Lm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8589
8589
  }, Symbol.toStringTag, { value: "Module" }));
8590
8590
  async function Ma(t) {
8591
8591
  try {
8592
- return await g`SELECT VERSION()`.execute(t), "mysql";
8592
+ return await p`SELECT VERSION()`.execute(t), "mysql";
8593
8593
  } catch {
8594
8594
  return "sqlite";
8595
8595
  }
@@ -8599,7 +8599,7 @@ async function Mm(t) {
8599
8599
  }
8600
8600
  async function Jm(t) {
8601
8601
  await t.transaction().execute(async (e) => {
8602
- const n = await g`
8602
+ const n = await p`
8603
8603
  SELECT
8604
8604
  rc.CONSTRAINT_NAME,
8605
8605
  rc.TABLE_NAME
@@ -8610,15 +8610,15 @@ async function Jm(t) {
8610
8610
  for (const r of n.rows) {
8611
8611
  const o = r.CONSTRAINT_NAME, u = r.TABLE_NAME;
8612
8612
  try {
8613
- await g`ALTER TABLE ${g.raw(u)} DROP FOREIGN KEY ${g.raw(o)}`.execute(
8613
+ await p`ALTER TABLE ${p.raw(u)} DROP FOREIGN KEY ${p.raw(o)}`.execute(
8614
8614
  e
8615
8615
  ), console.log(
8616
8616
  `Dropped foreign key constraint ${o} from ${u}`
8617
8617
  );
8618
- } catch (d) {
8618
+ } catch (c) {
8619
8619
  console.warn(
8620
8620
  `Failed to drop constraint ${o} from ${u}:`,
8621
- d
8621
+ c
8622
8622
  );
8623
8623
  }
8624
8624
  }
@@ -8629,53 +8629,53 @@ async function Jm(t) {
8629
8629
  ];
8630
8630
  for (const r of a)
8631
8631
  try {
8632
- await g`DROP TABLE IF EXISTS ${g.raw(r)}`.execute(e);
8632
+ await p`DROP TABLE IF EXISTS ${p.raw(r)}`.execute(e);
8633
8633
  } catch (o) {
8634
8634
  console.warn(`Failed to drop backup table ${r}:`, o);
8635
8635
  }
8636
- await g`CREATE TABLE sessions_backup AS SELECT * FROM sessions`.execute(
8636
+ await p`CREATE TABLE sessions_backup AS SELECT * FROM sessions`.execute(
8637
8637
  e
8638
- ), await g`CREATE TABLE login_sessions_backup AS SELECT * FROM login_sessions`.execute(
8638
+ ), await p`CREATE TABLE login_sessions_backup AS SELECT * FROM login_sessions`.execute(
8639
8639
  e
8640
- ), await g`CREATE TABLE refresh_tokens_backup AS SELECT * FROM refresh_tokens`.execute(
8640
+ ), await p`CREATE TABLE refresh_tokens_backup AS SELECT * FROM refresh_tokens`.execute(
8641
8641
  e
8642
- ), await g`DROP TABLE sessions`.execute(e), await g`DROP TABLE login_sessions`.execute(e), await g`DROP TABLE refresh_tokens`.execute(e), await e.schema.createTable("refresh_tokens").addColumn("id", "varchar(21)", (r) => r.notNull()).addColumn("tenant_id", "varchar(255)", (r) => r.notNull()).addColumn("client_id", "varchar(191)", (r) => r.notNull()).addColumn("session_id", "varchar(21)", (r) => r.notNull()).addColumn("user_id", "varchar(255)").addColumn("resource_servers", "text", (r) => r.notNull()).addColumn("device", "text", (r) => r.notNull()).addColumn("rotating", "boolean", (r) => r.notNull()).addColumn("created_at", "varchar(35)", (r) => r.notNull()).addColumn("expires_at", "varchar(35)").addColumn("idle_expires_at", "varchar(35)").addColumn("last_exchanged_at", "varchar(35)").addPrimaryKeyConstraint("refresh_tokens_pk", ["tenant_id", "id"]).execute(), await g`ALTER TABLE refresh_tokens
8642
+ ), await p`DROP TABLE sessions`.execute(e), await p`DROP TABLE login_sessions`.execute(e), await p`DROP TABLE refresh_tokens`.execute(e), await e.schema.createTable("refresh_tokens").addColumn("id", "varchar(21)", (r) => r.notNull()).addColumn("tenant_id", "varchar(255)", (r) => r.notNull()).addColumn("client_id", "varchar(191)", (r) => r.notNull()).addColumn("session_id", "varchar(21)", (r) => r.notNull()).addColumn("user_id", "varchar(255)").addColumn("resource_servers", "text", (r) => r.notNull()).addColumn("device", "text", (r) => r.notNull()).addColumn("rotating", "boolean", (r) => r.notNull()).addColumn("created_at", "varchar(35)", (r) => r.notNull()).addColumn("expires_at", "varchar(35)").addColumn("idle_expires_at", "varchar(35)").addColumn("last_exchanged_at", "varchar(35)").addPrimaryKeyConstraint("refresh_tokens_pk", ["tenant_id", "id"]).execute(), await p`ALTER TABLE refresh_tokens
8643
8643
  ADD CONSTRAINT refresh_tokens_tenant_fk
8644
8644
  FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON DELETE CASCADE`.execute(
8645
8645
  e
8646
- ), await g`ALTER TABLE refresh_tokens
8646
+ ), await p`ALTER TABLE refresh_tokens
8647
8647
  ADD CONSTRAINT refresh_tokens_client_fk
8648
8648
  FOREIGN KEY (tenant_id, client_id) REFERENCES clients(tenant_id, client_id) ON DELETE CASCADE`.execute(
8649
8649
  e
8650
- ), await e.schema.createTable("sessions").addColumn("id", "varchar(21)", (r) => r.notNull()).addColumn("tenant_id", "varchar(191)", (r) => r.notNull()).addColumn("user_id", "varchar(255)").addColumn("created_at", "varchar(35)", (r) => r.notNull()).addColumn("updated_at", "varchar(35)", (r) => r.notNull()).addColumn("expires_at", "varchar(35)").addColumn("idle_expires_at", "varchar(35)").addColumn("authenticated_at", "varchar(35)").addColumn("last_interaction_at", "varchar(35)").addColumn("used_at", "varchar(35)").addColumn("revoked_at", "varchar(35)").addColumn("device", "text", (r) => r.notNull()).addColumn("clients", "text", (r) => r.notNull()).addColumn("login_session_id", "varchar(21)").addPrimaryKeyConstraint("sessions_pk", ["tenant_id", "id"]).execute(), await g`ALTER TABLE sessions
8650
+ ), await e.schema.createTable("sessions").addColumn("id", "varchar(21)", (r) => r.notNull()).addColumn("tenant_id", "varchar(191)", (r) => r.notNull()).addColumn("user_id", "varchar(255)").addColumn("created_at", "varchar(35)", (r) => r.notNull()).addColumn("updated_at", "varchar(35)", (r) => r.notNull()).addColumn("expires_at", "varchar(35)").addColumn("idle_expires_at", "varchar(35)").addColumn("authenticated_at", "varchar(35)").addColumn("last_interaction_at", "varchar(35)").addColumn("used_at", "varchar(35)").addColumn("revoked_at", "varchar(35)").addColumn("device", "text", (r) => r.notNull()).addColumn("clients", "text", (r) => r.notNull()).addColumn("login_session_id", "varchar(21)").addPrimaryKeyConstraint("sessions_pk", ["tenant_id", "id"]).execute(), await p`ALTER TABLE sessions
8651
8651
  ADD CONSTRAINT sessions_user_fk
8652
8652
  FOREIGN KEY (user_id, tenant_id) REFERENCES users(user_id, tenant_id) ON DELETE CASCADE`.execute(
8653
8653
  e
8654
- ), await e.schema.createTable("login_sessions").addColumn("id", "varchar(21)", (r) => r.notNull()).addColumn("tenant_id", "varchar(255)", (r) => r.notNull()).addColumn("session_id", "varchar(21)").addColumn("csrf_token", "varchar(21)", (r) => r.notNull()).addColumn("authParams_client_id", "varchar(191)", (r) => r.notNull()).addColumn("authParams_vendor_id", "varchar(255)").addColumn("authParams_username", "varchar(255)").addColumn("authParams_response_type", "varchar(255)").addColumn("authParams_response_mode", "varchar(255)").addColumn("authParams_audience", "varchar(255)").addColumn("authParams_scope", "text").addColumn("authParams_state", "text").addColumn("authParams_nonce", "varchar(255)").addColumn("authParams_code_challenge_method", "varchar(255)").addColumn("authParams_code_challenge", "varchar(255)").addColumn("authParams_redirect_uri", "text").addColumn("authParams_organization", "varchar(255)").addColumn("authParams_prompt", "varchar(32)").addColumn("authParams_act_as", "varchar(256)").addColumn("authParams_ui_locales", "varchar(32)").addColumn("authorization_url", "text").addColumn("created_at", "varchar(35)", (r) => r.notNull()).addColumn("updated_at", "varchar(35)", (r) => r.notNull()).addColumn("expires_at", "varchar(35)", (r) => r.notNull()).addColumn("ip", "varchar(39)").addColumn("useragent", "text").addColumn("auth0Client", "varchar(255)").addColumn("login_completed", "integer", (r) => r.defaultTo(0)).addPrimaryKeyConstraint("login_sessions_pk", ["tenant_id", "id"]).execute(), await g`ALTER TABLE login_sessions
8654
+ ), await e.schema.createTable("login_sessions").addColumn("id", "varchar(21)", (r) => r.notNull()).addColumn("tenant_id", "varchar(255)", (r) => r.notNull()).addColumn("session_id", "varchar(21)").addColumn("csrf_token", "varchar(21)", (r) => r.notNull()).addColumn("authParams_client_id", "varchar(191)", (r) => r.notNull()).addColumn("authParams_vendor_id", "varchar(255)").addColumn("authParams_username", "varchar(255)").addColumn("authParams_response_type", "varchar(255)").addColumn("authParams_response_mode", "varchar(255)").addColumn("authParams_audience", "varchar(255)").addColumn("authParams_scope", "text").addColumn("authParams_state", "text").addColumn("authParams_nonce", "varchar(255)").addColumn("authParams_code_challenge_method", "varchar(255)").addColumn("authParams_code_challenge", "varchar(255)").addColumn("authParams_redirect_uri", "text").addColumn("authParams_organization", "varchar(255)").addColumn("authParams_prompt", "varchar(32)").addColumn("authParams_act_as", "varchar(256)").addColumn("authParams_ui_locales", "varchar(32)").addColumn("authorization_url", "text").addColumn("created_at", "varchar(35)", (r) => r.notNull()).addColumn("updated_at", "varchar(35)", (r) => r.notNull()).addColumn("expires_at", "varchar(35)", (r) => r.notNull()).addColumn("ip", "varchar(39)").addColumn("useragent", "text").addColumn("auth0Client", "varchar(255)").addColumn("login_completed", "integer", (r) => r.defaultTo(0)).addPrimaryKeyConstraint("login_sessions_pk", ["tenant_id", "id"]).execute(), await p`ALTER TABLE login_sessions
8655
8655
  ADD CONSTRAINT login_sessions_tenant_fk
8656
8656
  FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON DELETE CASCADE`.execute(
8657
8657
  e
8658
- ), await g`ALTER TABLE login_sessions
8658
+ ), await p`ALTER TABLE login_sessions
8659
8659
  ADD CONSTRAINT login_sessions_client_fk
8660
8660
  FOREIGN KEY (tenant_id, authParams_client_id) REFERENCES clients(tenant_id, client_id) ON DELETE CASCADE`.execute(
8661
8661
  e
8662
- ), await g`ALTER TABLE login_sessions
8662
+ ), await p`ALTER TABLE login_sessions
8663
8663
  ADD CONSTRAINT login_sessions_session_fk
8664
8664
  FOREIGN KEY (tenant_id, session_id) REFERENCES sessions(tenant_id, id) ON DELETE CASCADE`.execute(
8665
8665
  e
8666
- ), await g`INSERT INTO refresh_tokens
8666
+ ), await p`INSERT INTO refresh_tokens
8667
8667
  SELECT id, tenant_id, client_id, session_id, user_id, resource_servers, device, rotating,
8668
8668
  created_at, expires_at, idle_expires_at, last_exchanged_at
8669
- FROM refresh_tokens_backup`.execute(e), await g`INSERT INTO sessions
8669
+ FROM refresh_tokens_backup`.execute(e), await p`INSERT INTO sessions
8670
8670
  SELECT id, tenant_id, user_id, created_at, updated_at, expires_at, idle_expires_at,
8671
8671
  authenticated_at, last_interaction_at, used_at, revoked_at, device, clients, login_session_id
8672
- FROM sessions_backup`.execute(e), await g`INSERT INTO login_sessions
8672
+ FROM sessions_backup`.execute(e), await p`INSERT INTO login_sessions
8673
8673
  SELECT id, tenant_id, session_id, csrf_token, authParams_client_id, authParams_vendor_id, authParams_username,
8674
8674
  authParams_response_type, authParams_response_mode, authParams_audience, authParams_scope, authParams_state,
8675
8675
  authParams_nonce, authParams_code_challenge_method, authParams_code_challenge, authParams_redirect_uri,
8676
8676
  authParams_organization, authParams_prompt, authParams_act_as, authParams_ui_locales, authorization_url,
8677
8677
  created_at, updated_at, expires_at, ip, useragent, auth0Client, login_completed
8678
- FROM login_sessions_backup`.execute(e), await g`DROP TABLE sessions_backup`.execute(e), await g`DROP TABLE login_sessions_backup`.execute(e), await g`DROP TABLE refresh_tokens_backup`.execute(e);
8678
+ FROM login_sessions_backup`.execute(e), await p`DROP TABLE sessions_backup`.execute(e), await p`DROP TABLE login_sessions_backup`.execute(e), await p`DROP TABLE refresh_tokens_backup`.execute(e);
8679
8679
  });
8680
8680
  }
8681
8681
  async function qm(t) {
@@ -8687,17 +8687,17 @@ async function qm(t) {
8687
8687
  ];
8688
8688
  for (const a of n)
8689
8689
  try {
8690
- await g`DROP TABLE IF EXISTS ${g.raw(a)}`.execute(e);
8690
+ await p`DROP TABLE IF EXISTS ${p.raw(a)}`.execute(e);
8691
8691
  } catch (r) {
8692
8692
  console.warn(`Failed to drop backup table ${a}:`, r);
8693
8693
  }
8694
- await g`CREATE TABLE sessions_backup AS SELECT * FROM sessions`.execute(
8694
+ await p`CREATE TABLE sessions_backup AS SELECT * FROM sessions`.execute(
8695
8695
  e
8696
- ), await g`CREATE TABLE login_sessions_backup AS SELECT * FROM login_sessions`.execute(
8696
+ ), await p`CREATE TABLE login_sessions_backup AS SELECT * FROM login_sessions`.execute(
8697
8697
  e
8698
- ), await g`CREATE TABLE refresh_tokens_backup AS SELECT * FROM refresh_tokens`.execute(
8698
+ ), await p`CREATE TABLE refresh_tokens_backup AS SELECT * FROM refresh_tokens`.execute(
8699
8699
  e
8700
- ), await g`DROP TABLE sessions`.execute(e), await g`DROP TABLE login_sessions`.execute(e), await g`DROP TABLE refresh_tokens`.execute(e), await e.schema.createTable("refresh_tokens").addColumn("id", "varchar(21)", (a) => a.notNull()).addColumn(
8700
+ ), await p`DROP TABLE sessions`.execute(e), await p`DROP TABLE login_sessions`.execute(e), await p`DROP TABLE refresh_tokens`.execute(e), await e.schema.createTable("refresh_tokens").addColumn("id", "varchar(21)", (a) => a.notNull()).addColumn(
8701
8701
  "tenant_id",
8702
8702
  "varchar(255)",
8703
8703
  (a) => a.references("tenants.id").onDelete("cascade").notNull()
@@ -8729,19 +8729,19 @@ async function qm(t) {
8729
8729
  "sessions",
8730
8730
  ["tenant_id", "id"],
8731
8731
  (a) => a.onDelete("cascade")
8732
- ).execute(), await g`INSERT INTO refresh_tokens
8732
+ ).execute(), await p`INSERT INTO refresh_tokens
8733
8733
  SELECT id, tenant_id, client_id, session_id, user_id, resource_servers, device, rotating,
8734
8734
  created_at, expires_at, idle_expires_at, last_exchanged_at
8735
- FROM refresh_tokens_backup`.execute(e), await g`INSERT INTO sessions
8735
+ FROM refresh_tokens_backup`.execute(e), await p`INSERT INTO sessions
8736
8736
  SELECT id, tenant_id, user_id, created_at, updated_at, expires_at, idle_expires_at,
8737
8737
  authenticated_at, last_interaction_at, used_at, revoked_at, device, clients, login_session_id
8738
- FROM sessions_backup`.execute(e), await g`INSERT INTO login_sessions
8738
+ FROM sessions_backup`.execute(e), await p`INSERT INTO login_sessions
8739
8739
  SELECT id, tenant_id, session_id, csrf_token, authParams_client_id, authParams_vendor_id, authParams_username,
8740
8740
  authParams_response_type, authParams_response_mode, authParams_audience, authParams_scope, authParams_state,
8741
8741
  authParams_nonce, authParams_code_challenge_method, authParams_code_challenge, authParams_redirect_uri,
8742
8742
  authParams_organization, authParams_prompt, authParams_act_as, authParams_ui_locales, authorization_url,
8743
8743
  created_at, updated_at, expires_at, ip, useragent, auth0Client, login_completed
8744
- FROM login_sessions_backup`.execute(e), await g`DROP TABLE sessions_backup`.execute(e), await g`DROP TABLE login_sessions_backup`.execute(e), await g`DROP TABLE refresh_tokens_backup`.execute(e);
8744
+ FROM login_sessions_backup`.execute(e), await p`DROP TABLE sessions_backup`.execute(e), await p`DROP TABLE login_sessions_backup`.execute(e), await p`DROP TABLE refresh_tokens_backup`.execute(e);
8745
8745
  });
8746
8746
  }
8747
8747
  async function Bm(t) {
@@ -8749,15 +8749,15 @@ async function Bm(t) {
8749
8749
  }
8750
8750
  async function Wm(t) {
8751
8751
  await t.transaction().execute(async (e) => {
8752
- await g`ALTER TABLE refresh_tokens DROP FOREIGN KEY refresh_tokens_client_fk`.execute(
8752
+ await p`ALTER TABLE refresh_tokens DROP FOREIGN KEY refresh_tokens_client_fk`.execute(
8753
8753
  e
8754
- ), await g`ALTER TABLE login_sessions DROP FOREIGN KEY login_sessions_client_fk`.execute(
8754
+ ), await p`ALTER TABLE login_sessions DROP FOREIGN KEY login_sessions_client_fk`.execute(
8755
8755
  e
8756
- ), await g`ALTER TABLE refresh_tokens DROP PRIMARY KEY`.execute(e), await g`ALTER TABLE refresh_tokens ADD PRIMARY KEY (id)`.execute(e), await g`ALTER TABLE sessions DROP PRIMARY KEY`.execute(e), await g`ALTER TABLE sessions ADD PRIMARY KEY (id)`.execute(e), await g`ALTER TABLE login_sessions DROP PRIMARY KEY`.execute(e), await g`ALTER TABLE login_sessions ADD PRIMARY KEY (id)`.execute(e), await g`ALTER TABLE refresh_tokens
8756
+ ), await p`ALTER TABLE refresh_tokens DROP PRIMARY KEY`.execute(e), await p`ALTER TABLE refresh_tokens ADD PRIMARY KEY (id)`.execute(e), await p`ALTER TABLE sessions DROP PRIMARY KEY`.execute(e), await p`ALTER TABLE sessions ADD PRIMARY KEY (id)`.execute(e), await p`ALTER TABLE login_sessions DROP PRIMARY KEY`.execute(e), await p`ALTER TABLE login_sessions ADD PRIMARY KEY (id)`.execute(e), await p`ALTER TABLE refresh_tokens
8757
8757
  ADD CONSTRAINT refresh_tokens_application_fk
8758
8758
  FOREIGN KEY (client_id) REFERENCES applications(id) ON DELETE CASCADE`.execute(
8759
8759
  e
8760
- ), await g`ALTER TABLE login_sessions
8760
+ ), await p`ALTER TABLE login_sessions
8761
8761
  ADD CONSTRAINT login_sessions_application_fk
8762
8762
  FOREIGN KEY (authParams_client_id) REFERENCES applications(id) ON DELETE CASCADE`.execute(
8763
8763
  e
@@ -8766,9 +8766,9 @@ async function Wm(t) {
8766
8766
  }
8767
8767
  async function Km(t) {
8768
8768
  await t.transaction().execute(async (e) => {
8769
- await g`CREATE TABLE refresh_tokens_temp AS SELECT * FROM refresh_tokens`.execute(
8769
+ await p`CREATE TABLE refresh_tokens_temp AS SELECT * FROM refresh_tokens`.execute(
8770
8770
  e
8771
- ), await g`DROP TABLE refresh_tokens`.execute(e), await e.schema.createTable("refresh_tokens").addColumn("id", "varchar(21)", (n) => n.primaryKey()).addColumn(
8771
+ ), await p`DROP TABLE refresh_tokens`.execute(e), await e.schema.createTable("refresh_tokens").addColumn("id", "varchar(21)", (n) => n.primaryKey()).addColumn(
8772
8772
  "tenant_id",
8773
8773
  "varchar(255)",
8774
8774
  (n) => n.references("tenants.id").onDelete("cascade").notNull()
@@ -8776,12 +8776,12 @@ async function Km(t) {
8776
8776
  "client_id",
8777
8777
  "varchar(21)",
8778
8778
  (n) => n.references("applications.id").onDelete("cascade").notNull()
8779
- ).addColumn("session_id", "varchar(21)", (n) => n.notNull()).addColumn("user_id", "varchar(255)").addColumn("resource_servers", "varchar(255)", (n) => n.notNull()).addColumn("device", "varchar(255)", (n) => n.notNull()).addColumn("rotating", "boolean", (n) => n.notNull()).addColumn("created_at", "varchar(35)", (n) => n.notNull()).addColumn("expires_at", "varchar(35)").addColumn("idle_expires_at", "varchar(35)").addColumn("last_exchanged_at", "varchar(35)").execute(), await g`INSERT INTO refresh_tokens
8779
+ ).addColumn("session_id", "varchar(21)", (n) => n.notNull()).addColumn("user_id", "varchar(255)").addColumn("resource_servers", "varchar(255)", (n) => n.notNull()).addColumn("device", "varchar(255)", (n) => n.notNull()).addColumn("rotating", "boolean", (n) => n.notNull()).addColumn("created_at", "varchar(35)", (n) => n.notNull()).addColumn("expires_at", "varchar(35)").addColumn("idle_expires_at", "varchar(35)").addColumn("last_exchanged_at", "varchar(35)").execute(), await p`INSERT INTO refresh_tokens
8780
8780
  SELECT id, tenant_id, client_id, session_id, user_id, resource_servers, device, rotating,
8781
8781
  created_at, expires_at, idle_expires_at, last_exchanged_at
8782
- FROM refresh_tokens_temp`.execute(e), await g`DROP TABLE refresh_tokens_temp`.execute(e), await g`CREATE TABLE login_sessions_temp AS SELECT * FROM login_sessions`.execute(
8782
+ FROM refresh_tokens_temp`.execute(e), await p`DROP TABLE refresh_tokens_temp`.execute(e), await p`CREATE TABLE login_sessions_temp AS SELECT * FROM login_sessions`.execute(
8783
8783
  e
8784
- ), await g`DROP TABLE login_sessions`.execute(e), await e.schema.createTable("login_sessions").addColumn("id", "varchar(21)", (n) => n.primaryKey()).addColumn(
8784
+ ), await p`DROP TABLE login_sessions`.execute(e), await e.schema.createTable("login_sessions").addColumn("id", "varchar(21)", (n) => n.primaryKey()).addColumn(
8785
8785
  "tenant_id",
8786
8786
  "varchar(255)",
8787
8787
  (n) => n.references("tenants.id").onDelete("cascade").notNull()
@@ -8789,9 +8789,9 @@ async function Km(t) {
8789
8789
  "authParams_client_id",
8790
8790
  "varchar(191)",
8791
8791
  (n) => n.references("applications.id").onDelete("cascade").notNull()
8792
- ).execute(), await g`INSERT INTO login_sessions (id, tenant_id, session_id, csrf_token, authParams_client_id)
8792
+ ).execute(), await p`INSERT INTO login_sessions (id, tenant_id, session_id, csrf_token, authParams_client_id)
8793
8793
  SELECT id, tenant_id, session_id, csrf_token, authParams_client_id
8794
- FROM login_sessions_temp`.execute(e), await g`DROP TABLE login_sessions_temp`.execute(e);
8794
+ FROM login_sessions_temp`.execute(e), await p`DROP TABLE login_sessions_temp`.execute(e);
8795
8795
  });
8796
8796
  }
8797
8797
  const Um = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -8875,12 +8875,12 @@ const sh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8875
8875
  async function uh(t) {
8876
8876
  await t.schema.dropIndex("idx_user_organizations_tenant_id").execute();
8877
8877
  }
8878
- async function dh(t) {
8878
+ async function ch(t) {
8879
8879
  await t.schema.createIndex("idx_user_organizations_tenant_id").on("user_organizations").column("tenant_id").execute();
8880
8880
  }
8881
- const ch = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8881
+ const dh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8882
8882
  __proto__: null,
8883
- down: dh,
8883
+ down: ch,
8884
8884
  up: uh
8885
8885
  }, Symbol.toStringTag, { value: "Module" }));
8886
8886
  async function lh(t) {
@@ -8900,7 +8900,7 @@ const mh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8900
8900
  }, Symbol.toStringTag, { value: "Module" }));
8901
8901
  async function hh(t) {
8902
8902
  if (await t.schema.alterTable("tenants").addColumn("idle_session_lifetime", "integer").execute(), await t.schema.alterTable("tenants").addColumn("session_lifetime", "integer").execute(), await t.schema.alterTable("tenants").addColumn("session_cookie", "text").execute(), await t.schema.alterTable("tenants").addColumn("allowed_logout_urls", "text").execute(), await t.schema.alterTable("tenants").addColumn("ephemeral_session_lifetime", "integer").execute(), await t.schema.alterTable("tenants").addColumn("idle_ephemeral_session_lifetime", "integer").execute(), await t.schema.alterTable("tenants").addColumn("default_redirection_uri", "text").execute(), await t.schema.alterTable("tenants").addColumn("enabled_locales", "text").execute(), await t.schema.alterTable("tenants").addColumn("default_directory", "varchar(255)").execute(), await t.schema.alterTable("tenants").addColumn("error_page", "text").execute(), await t.schema.alterTable("tenants").addColumn("flags", "text").execute(), await t.schema.alterTable("tenants").addColumn("friendly_name", "varchar(255)").execute(), await t.schema.alterTable("tenants").addColumn("picture_url", "text").execute(), await t.schema.alterTable("tenants").addColumn("support_email", "varchar(255)").execute(), await t.schema.alterTable("tenants").addColumn("sandbox_version", "varchar(50)").execute(), await t.schema.alterTable("tenants").addColumn("sandbox_versions_available", "text").execute(), await t.schema.alterTable("tenants").addColumn("legacy_sandbox_version", "varchar(50)").execute(), await t.schema.alterTable("tenants").addColumn("change_password", "text").execute(), await t.schema.alterTable("tenants").addColumn("guardian_mfa_page", "text").execute(), await t.schema.alterTable("tenants").addColumn("device_flow", "text").execute(), await t.schema.alterTable("tenants").addColumn("default_token_quota", "text").execute(), await t.schema.alterTable("tenants").addColumn("default_audience", "varchar(255)").execute(), await t.schema.alterTable("tenants").addColumn("default_organization", "varchar(255)").execute(), await t.schema.alterTable("tenants").addColumn("sessions", "text").execute(), await t.schema.alterTable("tenants").addColumn("oidc_logout", "text").execute(), await t.schema.alterTable("tenants").addColumn("allow_organization_name_in_authentication_api", "integer").execute(), await t.schema.alterTable("tenants").addColumn("customize_mfa_in_postlogin_action", "integer").execute(), await t.schema.alterTable("tenants").addColumn("acr_values_supported", "text").execute(), await t.schema.alterTable("tenants").addColumn("mtls", "text").execute(), await t.schema.alterTable("tenants").addColumn("pushed_authorization_requests_supported", "integer").execute(), await t.schema.alterTable("tenants").addColumn("authorization_response_iss_parameter_supported", "integer").execute(), await t.updateTable("tenants").set({
8903
- friendly_name: g`name`
8903
+ friendly_name: p`name`
8904
8904
  }).execute(), await t.schema.alterTable("tenants").dropColumn("language").execute(), await t.schema.alterTable("tenants").dropColumn("logo").execute(), await t.schema.alterTable("tenants").dropColumn("primary_color").execute(), await t.schema.alterTable("tenants").dropColumn("secondary_color").execute(), await t.schema.alterTable("tenants").dropColumn("name").execute(), (await t.selectFrom("tenant_settings").select("tenant_id").limit(1).execute()).length > 0) {
8905
8905
  const n = await t.selectFrom("tenant_settings").selectAll().execute();
8906
8906
  for (const a of n)
@@ -8983,7 +8983,7 @@ async function fh(t) {
8983
8983
  sessions: n.sessions
8984
8984
  }).execute();
8985
8985
  await t.schema.alterTable("tenants").dropColumn("idle_session_lifetime").dropColumn("session_lifetime").dropColumn("session_cookie").dropColumn("enable_client_connections").dropColumn("default_redirection_uri").dropColumn("enabled_locales").dropColumn("default_directory").dropColumn("error_page").dropColumn("flags").dropColumn("friendly_name").dropColumn("picture_url").dropColumn("support_email").dropColumn("sandbox_version").dropColumn("sandbox_versions_available").dropColumn("change_password").dropColumn("guardian_mfa_page").dropColumn("default_audience").dropColumn("default_organization").dropColumn("sessions").execute(), await t.schema.alterTable("tenants").addColumn("name", "varchar(255)").execute(), await t.updateTable("tenants").set({
8986
- name: g`COALESCE(friendly_name, id)`
8986
+ name: p`COALESCE(friendly_name, id)`
8987
8987
  }).execute(), await t.schema.alterTable("tenants").addColumn("language", "varchar(255)").execute(), await t.schema.alterTable("tenants").addColumn("logo", "text").execute(), await t.schema.alterTable("tenants").addColumn("primary_color", "varchar(50)").execute(), await t.schema.alterTable("tenants").addColumn("secondary_color", "varchar(50)").execute();
8988
8988
  }
8989
8989
  const ph = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -9121,6 +9121,17 @@ const kh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9121
9121
  __proto__: null,
9122
9122
  down: Sh,
9123
9123
  up: Oh
9124
+ }, Symbol.toStringTag, { value: "Module" }));
9125
+ async function Ih(t) {
9126
+ await t.schema.alterTable("connections").addColumn("display_name", "varchar(255)").execute(), await t.schema.alterTable("connections").addColumn("is_domain_connection", "integer").execute(), await t.schema.alterTable("connections").addColumn("show_as_button", "integer").execute(), await t.schema.alterTable("connections").addColumn("metadata", "varchar(4096)").execute();
9127
+ }
9128
+ async function Eh(t) {
9129
+ await t.schema.alterTable("connections").dropColumn("display_name").execute(), await t.schema.alterTable("connections").dropColumn("is_domain_connection").execute(), await t.schema.alterTable("connections").dropColumn("show_as_button").execute(), await t.schema.alterTable("connections").dropColumn("metadata").execute();
9130
+ }
9131
+ const Ah = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9132
+ __proto__: null,
9133
+ down: Eh,
9134
+ up: Ih
9124
9135
  }, Symbol.toStringTag, { value: "Module" })), Ja = {
9125
9136
  m1_init: vu,
9126
9137
  m2_magicLink: bu,
@@ -9133,46 +9144,46 @@ const kh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9133
9144
  m9_passwordTableNewField: Ku,
9134
9145
  n01_codesTable: Vu,
9135
9146
  n11_universalLoginSession: Hu,
9136
- n12_userFields: ed,
9137
- n13_userEmailIndex: ad,
9138
- n14_profileDataField: id,
9139
- n15_userEmailIndex: dd,
9140
- n16_userLocale: _d,
9141
- n17_signingKeys: fd,
9142
- n18_logsFields: wd,
9143
- n19_connectionsUserinfo: vd,
9144
- n20_missingFields: bd,
9145
- n21_sessionDeletedAt: Sd,
9146
- n22_dropLogsFields: Ed,
9147
- n23_dropUsersFields: Pd,
9148
- n24_logsIndexes: Rd,
9149
- n25_logDescMaxLength: Ld,
9150
- n26_logsTableExtraFields: qd,
9151
- n27_usersTableNameIndex: Kd,
9152
- n28_usersEmailConstrain: Vd,
9153
- n29_increaseOtpStateLength: Hd,
9154
- n30_increaseTicketStateLength: ec,
9155
- n31_branding: ac,
9156
- n32_indexesAndNotNull: ic,
9157
- n33_vendorIdInUniversalLoginSession: dc,
9158
- n34_auth0ClientInUniversalLoginSession: _c,
9159
- n35_increaseUniversalSessionStateLength: fc,
9160
- n36_authenticationCodes: wc,
9161
- n37_disableSignUps: vc,
9162
- n38_otpIpAddress: bc,
9163
- n39_increaseUserAgentLength: Sc,
9164
- n40_userId: Ec,
9165
- n41_hooks: Pc,
9166
- n42_userIdIndexes: Rc,
9167
- n43_userIdIndexes: Lc,
9168
- n44_codes: qc,
9169
- n45_hookProperties: Kc,
9170
- n46_loginAuth0Client: Vc,
9171
- n47_loginAuth0Client: Hc,
9147
+ n12_userFields: ec,
9148
+ n13_userEmailIndex: ac,
9149
+ n14_profileDataField: ic,
9150
+ n15_userEmailIndex: cc,
9151
+ n16_userLocale: _c,
9152
+ n17_signingKeys: fc,
9153
+ n18_logsFields: wc,
9154
+ n19_connectionsUserinfo: vc,
9155
+ n20_missingFields: bc,
9156
+ n21_sessionDeletedAt: Sc,
9157
+ n22_dropLogsFields: Ec,
9158
+ n23_dropUsersFields: Pc,
9159
+ n24_logsIndexes: Rc,
9160
+ n25_logDescMaxLength: Lc,
9161
+ n26_logsTableExtraFields: qc,
9162
+ n27_usersTableNameIndex: Kc,
9163
+ n28_usersEmailConstrain: Vc,
9164
+ n29_increaseOtpStateLength: Hc,
9165
+ n30_increaseTicketStateLength: ed,
9166
+ n31_branding: ad,
9167
+ n32_indexesAndNotNull: id,
9168
+ n33_vendorIdInUniversalLoginSession: cd,
9169
+ n34_auth0ClientInUniversalLoginSession: _d,
9170
+ n35_increaseUniversalSessionStateLength: fd,
9171
+ n36_authenticationCodes: wd,
9172
+ n37_disableSignUps: vd,
9173
+ n38_otpIpAddress: bd,
9174
+ n39_increaseUserAgentLength: Sd,
9175
+ n40_userId: Ed,
9176
+ n41_hooks: Pd,
9177
+ n42_userIdIndexes: Rd,
9178
+ n43_userIdIndexes: Ld,
9179
+ n44_codes: qd,
9180
+ n45_hookProperties: Kd,
9181
+ n46_loginAuth0Client: Vd,
9182
+ n47_loginAuth0Client: Hd,
9172
9183
  n48_saml: el,
9173
9184
  n49_removeFields: al,
9174
9185
  n50_authParamsNonce: il,
9175
- n51_connectionid: dl,
9186
+ n51_connectionid: cl,
9176
9187
  n52_cert: _l,
9177
9188
  n53_codes_primary_key: fl,
9178
9189
  n54_cleanup_tables: wl,
@@ -9190,7 +9201,7 @@ const kh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9190
9201
  n66_email_providers: e_,
9191
9202
  n67_drop_tickets: a_,
9192
9203
  n68_login_useragents: i_,
9193
- n70_refresh_tokens: d_,
9204
+ n70_refresh_tokens: c_,
9194
9205
  n71_session_new_fields: __,
9195
9206
  n72_session_primary_key: f_,
9196
9207
  n73_drop_sessions: w_,
@@ -9208,7 +9219,7 @@ const kh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9208
9219
  n85_add_login_session_id_to_sessions: em,
9209
9220
  n86_index_sessions_login_session_id: am,
9210
9221
  n87_code_challenge: im,
9211
- n88_add_redirect_uri_to_codes: dm,
9222
+ n88_add_redirect_uri_to_codes: cm,
9212
9223
  n89_add_nonce_and_state_to_codes: _m,
9213
9224
  n90_themes: fm,
9214
9225
  n91_resource_servers_rules_permissions: wm,
@@ -9225,15 +9236,16 @@ const kh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9225
9236
  o003_phone_number_index: th,
9226
9237
  o004_login_sessions_id_index: rh,
9227
9238
  o005_connections_tenant_index: sh,
9228
- o006_remove_redundant_user_organizations_tenant_index: ch,
9239
+ o006_remove_redundant_user_organizations_tenant_index: dh,
9229
9240
  o007_tenant_settings: mh,
9230
9241
  o008_merge_tenant_settings_into_tenants: ph,
9231
9242
  o009_create_invites_table: yh,
9232
9243
  o010_add_log_id_to_logs: Ch,
9233
9244
  o011_add_location_info_to_logs: Th,
9234
- o012_add_password_history: kh
9245
+ o012_add_password_history: kh,
9246
+ o013_connection_display_name: Ah
9235
9247
  };
9236
- async function Ph(t, e = !1) {
9248
+ async function Rh(t, e = !1) {
9237
9249
  e && console.log("migrating...");
9238
9250
  const n = new La(Ja), a = new ba({
9239
9251
  db: t,
@@ -9246,7 +9258,7 @@ async function Ph(t, e = !1) {
9246
9258
  }), r)
9247
9259
  throw console.error("failed to migrate"), console.error(r), r;
9248
9260
  }
9249
- async function Dh(t) {
9261
+ async function Fh(t) {
9250
9262
  console.log("migrating...");
9251
9263
  const e = new La(Ja), n = new ba({
9252
9264
  db: t,
@@ -9257,7 +9269,7 @@ async function Dh(t) {
9257
9269
  }), a)
9258
9270
  throw console.error("failed to migrate"), console.error(a), a;
9259
9271
  }
9260
- function zh(t) {
9272
+ function jh(t) {
9261
9273
  return {
9262
9274
  branding: vo(t),
9263
9275
  cleanup: Ho(t),
@@ -9277,7 +9289,7 @@ function zh(t) {
9277
9289
  passwords: kr(t),
9278
9290
  promptSettings: Mo(t),
9279
9291
  refreshTokens: Yo(t),
9280
- resourceServers: di(t),
9292
+ resourceServers: ci(t),
9281
9293
  rolePermissions: yi(t),
9282
9294
  userPermissions: bi(t),
9283
9295
  userRoles: Ii(t),
@@ -9291,7 +9303,7 @@ function zh(t) {
9291
9303
  };
9292
9304
  }
9293
9305
  export {
9294
- zh as default,
9295
- Dh as migrateDown,
9296
- Ph as migrateToLatest
9306
+ jh as default,
9307
+ Fh as migrateDown,
9308
+ Rh as migrateToLatest
9297
9309
  };