@authhero/kysely-adapter 10.47.0 → 10.49.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.
@@ -3,9 +3,9 @@ var wn = (t) => {
3
3
  throw TypeError(t);
4
4
  };
5
5
  var Rr = (t, e, n) => e in t ? Dr(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
6
- var oe = (t, e, n) => Rr(t, typeof e != "symbol" ? e + "" : e, n), Bt = (t, e, n) => e.has(t) || wn("Cannot " + n);
7
- var i = (t, e, n) => (Bt(t, e, "read from private field"), n ? n.call(t) : e.get(t)), C = (t, e, n) => e.has(t) ? wn("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), O = (t, e, n, r) => (Bt(t, e, "write to private field"), r ? r.call(t, n) : e.set(t, n), n), w = (t, e, n) => (Bt(t, e, "access private method"), n);
8
- import { parseUserId as ln, codeSchema as zr, connectionSchema as Fr, loginSessionSchema as qr, promptSettingSchema as jr, formSchema as bt, resourceServerSchema as Lr } from "@authhero/adapter-interfaces";
6
+ var oe = (t, e, n) => Rr(t, typeof e != "symbol" ? e + "" : e, n), Wt = (t, e, n) => e.has(t) || wn("Cannot " + n);
7
+ var i = (t, e, n) => (Wt(t, e, "read from private field"), n ? n.call(t) : e.get(t)), C = (t, e, n) => e.has(t) ? wn("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), O = (t, e, n, r) => (Wt(t, e, "write to private field"), r ? r.call(t, n) : e.set(t, n), n), w = (t, e, n) => (Wt(t, e, "access private method"), n);
8
+ import { parseUserId as ln, codeSchema as zr, connectionSchema as Fr, loginSessionSchema as jr, promptSettingSchema as qr, formSchema as bt, resourceServerSchema as Lr } from "@authhero/adapter-interfaces";
9
9
  import "@hono/zod-openapi";
10
10
  var lt = class extends Error {
11
11
  constructor(e = 500, n) {
@@ -50,26 +50,26 @@ function Jr(t) {
50
50
  };
51
51
  };
52
52
  }
53
- function S(t) {
53
+ function T(t) {
54
54
  if (t == null || typeof t != "object")
55
55
  return t;
56
56
  if (Array.isArray(t))
57
57
  return t.map(
58
58
  (n) => (
59
59
  // Only recurse into objects; leave primitives untouched
60
- n !== null && typeof n == "object" ? S(n) : n
60
+ n !== null && typeof n == "object" ? T(n) : n
61
61
  )
62
62
  );
63
63
  const e = { ...t };
64
64
  for (const n in e) {
65
65
  const r = e[n];
66
66
  r === null ? delete e[n] : r !== null && typeof r == "object" && (Array.isArray(r) ? e[n] = r.map(
67
- (a) => a !== null && typeof a == "object" ? S(a) : a
68
- ) : e[n] = S(r));
67
+ (a) => a !== null && typeof a == "object" ? T(a) : a
68
+ ) : e[n] = T(r));
69
69
  }
70
70
  return e;
71
71
  }
72
- function Wn(t) {
72
+ function Bn(t) {
73
73
  let e = {};
74
74
  try {
75
75
  e = JSON.parse(t.profileData || "{}");
@@ -96,7 +96,7 @@ function Mr(t) {
96
96
  ]);
97
97
  if (!r)
98
98
  return null;
99
- const { tenant_id: o, ...u } = r, d = {
99
+ const { tenant_id: o, ...u } = r, c = {
100
100
  ...u,
101
101
  email: r.email || "",
102
102
  email_verified: r.email_verified === 1,
@@ -110,54 +110,54 @@ function Mr(t) {
110
110
  user_id: ln(r.user_id).id,
111
111
  isSocial: !!r.is_social
112
112
  },
113
- ...a.map(Wn)
113
+ ...a.map(Bn)
114
114
  ]
115
115
  };
116
- return S(d);
116
+ return T(c);
117
117
  };
118
118
  }
119
119
  function L(t, e, n, r) {
120
120
  const a = [];
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() && (a.push(o.trim()), o = "") : o += h;
125
125
  }
126
- return o.trim() && a.push(o.trim()), a.map((c) => c.replace(/^([^:]+)=/g, "$1:")).map((c) => {
127
- let h = c.startsWith("-"), p = null, l = "", y = !1, f;
128
- if (c.startsWith("-_exists_:"))
129
- p = c.substring(10), y = !0, h = !0;
130
- else if (c.startsWith("_exists_:"))
131
- p = c.substring(9), y = !0, h = !1;
132
- else if (c.includes(":")) {
133
- const v = h ? c.substring(1) : c, b = v.indexOf(":");
126
+ return o.trim() && a.push(o.trim()), a.map((d) => d.replace(/^([^:]+)=/g, "$1:")).map((d) => {
127
+ let h = d.startsWith("-"), p = null, l = "", y = !1, f;
128
+ if (d.startsWith("-_exists_:"))
129
+ p = d.substring(10), y = !0, h = !0;
130
+ else if (d.startsWith("_exists_:"))
131
+ p = d.substring(9), y = !0, h = !1;
132
+ else if (d.includes(":")) {
133
+ const v = h ? d.substring(1) : d, b = v.indexOf(":");
134
134
  p = v.substring(0, b), l = v.substring(b + 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, y = !1;
136
+ p = null, l = d, y = !1;
137
137
  return { key: p, value: l, isNegation: h, isExistsQuery: y, operator: f };
138
- }).forEach(({ key: c, value: h, isNegation: p, isExistsQuery: l, operator: y }) => {
139
- if (c)
138
+ }).forEach(({ key: d, value: h, isNegation: p, 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);
141
+ p ? e = e.where(d, "is", null) : e = e.where(d, "is not", null);
142
142
  else if (p)
143
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, y, 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(
@@ -171,19 +171,19 @@ function L(t, e, n, r) {
171
171
  function F(t) {
172
172
  return typeof t == "string" ? parseInt(t, 10) : typeof t == "bigint" ? Number(t) : t;
173
173
  }
174
- function Wr(t) {
174
+ function Br(t) {
175
175
  return async (e, n = {}) => {
176
- const { page: r = 0, per_page: a = 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 = L(t, c, d, ["email", "name"])), u && u.sort_by) {
176
+ const { page: r = 0, per_page: a = 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 = L(t, d, c, ["email", "name", "phone_number"])), u && u.sort_by) {
179
179
  const { ref: b } = t.dynamic;
180
- c = c.orderBy(b(u.sort_by), u.sort_order);
180
+ d = d.orderBy(b(u.sort_by), u.sort_order);
181
181
  }
182
- const p = await c.offset(r * a).limit(a).selectAll().execute(), l = p.map((b) => b.user_id), y = l.length ? await t.selectFrom("users").selectAll().where("users.tenant_id", "=", e).where("users.linked_to", "in", l).execute() : [], f = p.map((b) => {
182
+ const p = await d.offset(r * a).limit(a).selectAll().execute(), l = p.map((b) => b.user_id), y = l.length ? await t.selectFrom("users").selectAll().where("users.tenant_id", "=", e).where("users.linked_to", "in", l).execute() : [], f = p.map((b) => {
183
183
  const E = y.filter(
184
184
  (D) => D.linked_to === b.user_id
185
185
  );
186
- return S({
186
+ return T({
187
187
  ...b,
188
188
  email_verified: b.email_verified === 1,
189
189
  is_social: b.is_social === 1,
@@ -196,7 +196,7 @@ function Wr(t) {
196
196
  user_id: ln(b.user_id).id,
197
197
  isSocial: !!b.is_social
198
198
  },
199
- ...E.map(Wn)
199
+ ...E.map(Bn)
200
200
  ]
201
201
  });
202
202
  });
@@ -207,7 +207,7 @@ function Wr(t) {
207
207
  limit: 0,
208
208
  length: 0
209
209
  };
210
- const { count: v } = await c.select((b) => b.fn.countAll().as("count")).executeTakeFirstOrThrow();
210
+ const { count: v } = await d.select((b) => b.fn.countAll().as("count")).executeTakeFirstOrThrow();
211
211
  return {
212
212
  users: f,
213
213
  start: r * a,
@@ -216,7 +216,7 @@ function Wr(t) {
216
216
  };
217
217
  };
218
218
  }
219
- function Br(t) {
219
+ function Wr(t) {
220
220
  return async (e, n) => (await t.deleteFrom("users").where("users.tenant_id", "=", e).where("users.linked_to", "=", n).execute(), (await t.deleteFrom("users").where("users.tenant_id", "=", e).where("users.user_id", "=", n).execute()).length === 1);
221
221
  }
222
222
  function et(t, e = "", n = {}) {
@@ -227,7 +227,7 @@ function et(t, e = "", n = {}) {
227
227
  }
228
228
  return n;
229
229
  }
230
- function Bn(t, e) {
230
+ function Wn(t, e) {
231
231
  const n = {};
232
232
  for (const [r, a] of Object.entries(t)) {
233
233
  const o = e.find(
@@ -265,9 +265,9 @@ function Ur(t) {
265
265
  function Qr(t) {
266
266
  return {
267
267
  create: Jr(t),
268
- remove: Br(t),
268
+ remove: Wr(t),
269
269
  get: Mr(t),
270
- list: Wr(t),
270
+ list: Br(t),
271
271
  update: Kr(t),
272
272
  // TODO - think about this more when other issues fixed
273
273
  unlink: Ur(t)
@@ -279,9 +279,9 @@ let Gr = (t) => crypto.getRandomValues(new Uint8Array(t)), Yr = (t, e, n) => {
279
279
  return (o = e) => {
280
280
  let u = "";
281
281
  for (; ; ) {
282
- let d = n(a), c = a;
283
- for (; c--; )
284
- if (u += t[d[c] & r] || "", u.length === o) return u;
282
+ let c = n(a), d = a;
283
+ for (; d--; )
284
+ if (u += t[c[d] & r] || "", u.length === o) return u;
285
285
  }
286
286
  };
287
287
  }, Hr = (t, e = 21) => Yr(t, e, Gr), re = (t = 21) => {
@@ -304,19 +304,19 @@ function Xr(t) {
304
304
  function Zr(t) {
305
305
  return async (e) => {
306
306
  const n = await t.selectFrom("tenants").where("tenants.id", "=", e).selectAll().executeTakeFirst();
307
- return n ? S(n) : null;
307
+ return n ? T(n) : null;
308
308
  };
309
309
  }
310
310
  function ea(t) {
311
311
  return async (e) => {
312
312
  let n = t.selectFrom("tenants");
313
- const { page: r = 0, per_page: a = 50, include_totals: o = !1, sort: u, q: d } = e;
313
+ const { page: r = 0, per_page: a = 50, include_totals: o = !1, sort: u, q: c } = e;
314
314
  if (u && u.sort_by) {
315
315
  const { ref: f } = t.dynamic;
316
316
  n = n.orderBy(f(u.sort_by), u.sort_order);
317
317
  }
318
- d && (n = n.where((f) => f.or([f("name", "like", `%${d}%`)])));
319
- const p = (await n.offset(r * a).limit(a).selectAll().execute()).map(S);
318
+ c && (n = n.where((f) => f.or([f("name", "like", `%${c}%`)])));
319
+ const p = (await n.offset(r * a).limit(a).selectAll().execute()).map(T);
320
320
  if (!o)
321
321
  return {
322
322
  tenants: p
@@ -400,10 +400,10 @@ function Kn(t) {
400
400
  }
401
401
  function ia(t) {
402
402
  return async (e, n = {}) => {
403
- const { page: r = 0, per_page: a = 50, include_totals: o = !1, sort: u, q: d } = n;
404
- let c = t.selectFrom("logs").where("logs.tenant_id", "=", e);
405
- d && (c = L(t, c, d, ["user_id", "ip"]));
406
- let h = c;
403
+ const { page: r = 0, per_page: a = 50, include_totals: o = !1, sort: u, q: c } = n;
404
+ let d = t.selectFrom("logs").where("logs.tenant_id", "=", e);
405
+ c && (d = L(t, d, c, ["user_id", "ip"]));
406
+ let h = d;
407
407
  if (u && u.sort_by) {
408
408
  const { ref: f } = t.dynamic;
409
409
  h = h.orderBy(f(u.sort_by), u.sort_order);
@@ -417,7 +417,7 @@ function ia(t) {
417
417
  limit: 0,
418
418
  length: 0
419
419
  };
420
- const { count: y } = await c.select((f) => f.fn.countAll().as("count")).executeTakeFirstOrThrow();
420
+ const { count: y } = await d.select((f) => f.fn.countAll().as("count")).executeTakeFirstOrThrow();
421
421
  return {
422
422
  logs: l,
423
423
  start: r * a,
@@ -439,20 +439,20 @@ function ua(t) {
439
439
  get: sa(t)
440
440
  };
441
441
  }
442
- function da(t) {
442
+ function ca(t) {
443
443
  return async (e, n) => {
444
444
  const r = await t.selectFrom("sessions").where("sessions.tenant_id", "=", e).where("sessions.id", "=", n).selectAll().executeTakeFirst();
445
445
  if (!r)
446
446
  return null;
447
- const { tenant_id: a, device: o, clients: u, ...d } = r;
447
+ const { tenant_id: a, device: o, clients: u, ...c } = r;
448
448
  return {
449
- ...d,
449
+ ...c,
450
450
  device: JSON.parse(o),
451
451
  clients: JSON.parse(u)
452
452
  };
453
453
  };
454
454
  }
455
- function ca(t) {
455
+ function da(t) {
456
456
  return async (e, n) => {
457
457
  const r = {
458
458
  ...n,
@@ -485,10 +485,10 @@ function _a(t) {
485
485
  }
486
486
  function ma(t) {
487
487
  return async (e, n = {}) => {
488
- const { page: r = 0, per_page: a = 50, include_totals: o = !1, sort: u, q: d } = n;
489
- let c = t.selectFrom("sessions").where("sessions.tenant_id", "=", e);
490
- d && (c = L(t, c, d, ["user_id", "session_id"]));
491
- let h = c;
488
+ const { page: r = 0, per_page: a = 50, include_totals: o = !1, sort: u, q: c } = n;
489
+ let d = t.selectFrom("sessions").where("sessions.tenant_id", "=", e);
490
+ c && (d = L(t, d, c, ["user_id", "session_id"]));
491
+ let h = d;
492
492
  if (u && u.sort_by) {
493
493
  const { ref: v } = t.dynamic;
494
494
  h = h.orderBy(v(u.sort_by), u.sort_order);
@@ -506,7 +506,7 @@ function ma(t) {
506
506
  limit: 0,
507
507
  length: 0
508
508
  };
509
- const { count: y } = await c.select((v) => v.fn.countAll().as("count")).executeTakeFirstOrThrow(), f = F(y);
509
+ const { count: y } = await d.select((v) => v.fn.countAll().as("count")).executeTakeFirstOrThrow(), f = F(y);
510
510
  return {
511
511
  sessions: l,
512
512
  start: r * a,
@@ -517,8 +517,8 @@ function ma(t) {
517
517
  }
518
518
  function ha(t) {
519
519
  return {
520
- create: ca(t),
521
- get: da(t),
520
+ create: da(t),
521
+ get: ca(t),
522
522
  list: ma(t),
523
523
  remove: la(t),
524
524
  update: _a(t)
@@ -562,11 +562,11 @@ function ya(t) {
562
562
  function wa(t) {
563
563
  return async (e, n = {}) => {
564
564
  const { page: r = 0, per_page: a = 50, include_totals: o = !1, q: u } = n;
565
- let d = t.selectFrom("codes").where("codes.tenant_id", "=", e);
566
- u && (d = L(t, d, u, ["code", "login_id"]));
567
- const p = (await d.offset(r * a).limit(a).selectAll().execute()).map((y) => {
565
+ let c = t.selectFrom("codes").where("codes.tenant_id", "=", e);
566
+ u && (c = L(t, c, u, ["code", "login_id"]));
567
+ const p = (await c.offset(r * a).limit(a).selectAll().execute()).map((y) => {
568
568
  const { tenant_id: f, ...v } = y;
569
- return zr.parse(S(v));
569
+ return zr.parse(T(v));
570
570
  });
571
571
  if (!o)
572
572
  return {
@@ -575,7 +575,7 @@ function wa(t) {
575
575
  limit: 0,
576
576
  length: 0
577
577
  };
578
- const { count: l } = await d.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
578
+ const { count: l } = await c.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
579
579
  return {
580
580
  codes: p,
581
581
  start: r * a,
@@ -604,7 +604,7 @@ function Ca(t) {
604
604
  let a = t.selectFrom("codes").where("codes.code_id", "=", n).where("codes.code_type", "=", r);
605
605
  e.length && (a = a.where("codes.tenant_id", "=", e));
606
606
  const o = await a.selectAll().executeTakeFirst();
607
- return o ? S(o) : null;
607
+ return o ? T(o) : null;
608
608
  };
609
609
  }
610
610
  function ba(t) {
@@ -619,7 +619,7 @@ function Oa(t) {
619
619
  get: Ca(t)
620
620
  };
621
621
  }
622
- const Ta = 17, Sa = {
622
+ const xa = 17, Ta = {
623
623
  organization: "org_",
624
624
  connection: "con_",
625
625
  action: "act_",
@@ -629,10 +629,10 @@ const Ta = 17, Sa = {
629
629
  guardian_factor: "gfa_"
630
630
  };
631
631
  function Ft(t) {
632
- const r = Hr("0123456789abcdefghijklmnopqrstuvwxyz", Ta)();
633
- return `${Sa[t]}${r}`;
632
+ const r = Hr("0123456789abcdefghijklmnopqrstuvwxyz", xa)();
633
+ return `${Ta[t]}${r}`;
634
634
  }
635
- function xa() {
635
+ function Sa() {
636
636
  return Ft("organization");
637
637
  }
638
638
  function ka() {
@@ -663,10 +663,10 @@ function Aa(t) {
663
663
  function Pa(t) {
664
664
  return async (e, n = {}) => {
665
665
  const { page: r = 0, per_page: a = 50, include_totals: o = !1, q: u } = n;
666
- let d = t.selectFrom("connections").where("connections.tenant_id", "=", e);
667
- u && (d = L(t, d, u, ["user_id", "ip"]));
668
- const p = (await d.offset(r * a).limit(a).selectAll().execute()).map(
669
- (y) => S({
666
+ let c = t.selectFrom("connections").where("connections.tenant_id", "=", e);
667
+ u && (c = L(t, c, u, ["user_id", "ip"]));
668
+ const p = (await c.offset(r * a).limit(a).selectAll().execute()).map(
669
+ (y) => T({
670
670
  ...y,
671
671
  options: JSON.parse(y.options)
672
672
  })
@@ -678,7 +678,7 @@ function Pa(t) {
678
678
  limit: 0,
679
679
  length: 0
680
680
  };
681
- const { count: l } = await d.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
681
+ const { count: l } = await c.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
682
682
  return {
683
683
  connections: p,
684
684
  start: r * a,
@@ -693,7 +693,7 @@ function $a(t) {
693
693
  function Da(t) {
694
694
  return async (e, n) => {
695
695
  const r = await t.selectFrom("connections").where("connections.tenant_id", "=", e).where("connections.id", "=", n).selectAll().executeTakeFirst();
696
- return r ? S({
696
+ return r ? T({
697
697
  ...r,
698
698
  options: JSON.parse(r.options)
699
699
  }) : null;
@@ -779,13 +779,13 @@ function Fa(t) {
779
779
  }).execute(), r;
780
780
  };
781
781
  }
782
- function qa(t) {
782
+ function ja(t) {
783
783
  return async (e, n) => {
784
784
  const r = await t.selectFrom("clients").where("clients.tenant_id", "=", e).where("clients.client_id", "=", n).selectAll().executeTakeFirst();
785
785
  if (!r)
786
786
  return null;
787
787
  const { tenant_id: a, ...o } = r;
788
- return S({
788
+ return T({
789
789
  ...o,
790
790
  // Convert integer fields back to booleans
791
791
  global: !!r.global,
@@ -824,7 +824,7 @@ function qa(t) {
824
824
  });
825
825
  };
826
826
  }
827
- function ja(t) {
827
+ function qa(t) {
828
828
  return async (e, n) => {
829
829
  let r = t.selectFrom("clients").where("clients.tenant_id", "=", e);
830
830
  return n != null && n.per_page && (r = r.limit(n.per_page)), n != null && n.page && (n != null && n.per_page) && (r = r.offset((n.page - 1) * n.per_page)), {
@@ -893,41 +893,41 @@ function Ja(t) {
893
893
  function Ma(t) {
894
894
  return {
895
895
  create: Fa(t),
896
- get: qa(t),
897
- list: ja(t),
896
+ get: ja(t),
897
+ list: qa(t),
898
898
  remove: La(t),
899
899
  update: Ja(t)
900
900
  };
901
901
  }
902
- function Wa(t) {
902
+ function Ba(t) {
903
903
  return async (e, n) => {
904
- const r = (/* @__PURE__ */ new Date()).toISOString(), a = re(), { scope: o, authorization_details_types: u, ...d } = n, c = {
904
+ const r = (/* @__PURE__ */ new Date()).toISOString(), a = re(), { scope: o, authorization_details_types: u, ...c } = n, d = {
905
905
  id: a,
906
906
  tenant_id: e,
907
- ...d,
907
+ ...c,
908
908
  scope: o ? JSON.stringify(o) : "[]",
909
909
  authorization_details_types: u ? JSON.stringify(u) : "[]",
910
910
  // Convert booleans to integers for database storage
911
- allow_any_organization: d.allow_any_organization !== void 0 ? d.allow_any_organization ? 1 : 0 : void 0,
912
- is_system: d.is_system !== void 0 ? d.is_system ? 1 : 0 : void 0,
911
+ allow_any_organization: c.allow_any_organization !== void 0 ? c.allow_any_organization ? 1 : 0 : void 0,
912
+ is_system: c.is_system !== void 0 ? c.is_system ? 1 : 0 : void 0,
913
913
  created_at: r,
914
914
  updated_at: r
915
915
  };
916
- return await t.insertInto("client_grants").values(c).execute(), S({
916
+ return await t.insertInto("client_grants").values(d).execute(), T({
917
917
  id: a,
918
918
  tenant_id: e,
919
- ...d,
919
+ ...c,
920
920
  scope: o || [],
921
921
  authorization_details_types: u || [],
922
922
  // Ensure boolean fields have proper defaults
923
- allow_any_organization: d.allow_any_organization ?? !1,
924
- is_system: d.is_system ?? !1,
923
+ allow_any_organization: c.allow_any_organization ?? !1,
924
+ is_system: c.is_system ?? !1,
925
925
  created_at: r,
926
926
  updated_at: r
927
927
  });
928
928
  };
929
929
  }
930
- function Ba(t) {
930
+ function Wa(t) {
931
931
  return async (e, n) => {
932
932
  const r = await t.selectFrom("client_grants").selectAll().where("client_grants.tenant_id", "=", e).where("client_grants.id", "=", n).executeTakeFirst();
933
933
  if (!r)
@@ -946,29 +946,29 @@ function Ba(t) {
946
946
  created_at: r.created_at,
947
947
  updated_at: r.updated_at
948
948
  };
949
- return S(a);
949
+ return T(a);
950
950
  };
951
951
  }
952
952
  function Ka(t) {
953
953
  return async (e, n = {}) => {
954
- const { page: r = 0, per_page: a = 50, include_totals: o = !1, q: u, sort: d } = n;
955
- let c = t.selectFrom("client_grants").where("client_grants.tenant_id", "=", e);
954
+ const { page: r = 0, per_page: a = 50, include_totals: o = !1, q: u, sort: c } = n;
955
+ let d = t.selectFrom("client_grants").where("client_grants.tenant_id", "=", e);
956
956
  if (u) {
957
957
  const f = u.trim(), v = f.split(/\s+/), b = v.length === 1 ? v[0] : void 0, E = b ? b.match(/^(-)?([a-zA-Z_][a-zA-Z0-9_]*):"?([^"]*)"?$/) : null, D = E ? E[3] : "", ae = /^(>=|>|<=|<)/.test(D || "");
958
958
  if (E && !ae && D) {
959
959
  const U = !!E[1], pe = E[2], { ref: Nt } = t.dynamic, ge = Nt(`client_grants.${pe}`);
960
960
  if (pe === "allow_any_organization") {
961
961
  const nt = D === "true" ? 1 : 0;
962
- U ? c = c.where(ge, "!=", nt) : c = c.where(ge, "=", nt);
962
+ U ? d = d.where(ge, "!=", nt) : d = d.where(ge, "=", nt);
963
963
  } else
964
- U ? c = c.where(ge, "!=", D) : c = c.where(ge, "=", D);
964
+ U ? d = d.where(ge, "!=", D) : d = d.where(ge, "=", D);
965
965
  } else
966
- c = L(t, c, f, []);
966
+ d = L(t, d, f, []);
967
967
  }
968
- let h = c;
969
- if (d) {
968
+ let h = d;
969
+ if (c) {
970
970
  const { ref: f } = t.dynamic;
971
- h = h.orderBy(f(d.sort_by), d.sort_order);
971
+ h = h.orderBy(f(c.sort_by), c.sort_order);
972
972
  } else
973
973
  h = h.orderBy("client_grants.created_at", "desc");
974
974
  h = h.limit(a).offset(r * a);
@@ -987,7 +987,7 @@ function Ka(t) {
987
987
  created_at: f.created_at,
988
988
  updated_at: f.updated_at
989
989
  };
990
- return S(v);
990
+ return T(v);
991
991
  });
992
992
  if (!o)
993
993
  return {
@@ -996,7 +996,7 @@ function Ka(t) {
996
996
  limit: 0,
997
997
  length: 0
998
998
  };
999
- const { count: y } = await c.select((f) => f.fn.countAll().as("count")).executeTakeFirstOrThrow();
999
+ const { count: y } = await d.select((f) => f.fn.countAll().as("count")).executeTakeFirstOrThrow();
1000
1000
  return {
1001
1001
  client_grants: l,
1002
1002
  start: r * a,
@@ -1010,19 +1010,19 @@ function Ua(t) {
1010
1010
  }
1011
1011
  function Qa(t) {
1012
1012
  return async (e, n, r) => {
1013
- const a = (/* @__PURE__ */ new Date()).toISOString(), { scope: o, authorization_details_types: u, ...d } = r, c = {
1014
- ...d,
1013
+ const a = (/* @__PURE__ */ new Date()).toISOString(), { scope: o, authorization_details_types: u, ...c } = r, d = {
1014
+ ...c,
1015
1015
  updated_at: a
1016
1016
  };
1017
- return o !== void 0 && (c.scope = JSON.stringify(o)), u !== void 0 && (c.authorization_details_types = JSON.stringify(
1017
+ return o !== void 0 && (d.scope = JSON.stringify(o)), u !== void 0 && (d.authorization_details_types = JSON.stringify(
1018
1018
  u
1019
- )), 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;
1019
+ )), 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;
1020
1020
  };
1021
1021
  }
1022
1022
  function Va(t) {
1023
1023
  return {
1024
- create: Wa(t),
1025
- get: Ba(t),
1024
+ create: Ba(t),
1025
+ get: Wa(t),
1026
1026
  list: Ka(t),
1027
1027
  remove: Ua(t),
1028
1028
  update: Qa(t)
@@ -1052,10 +1052,10 @@ function Ga(t) {
1052
1052
  require_proof_of_possession: !!n.require_proof_of_possession,
1053
1053
  // Parse JSON string fields back to objects/arrays
1054
1054
  connections: a.map(
1055
- (d) => Fr.parse(
1056
- S({
1057
- ...d,
1058
- options: d.options ? JSON.parse(d.options) : {}
1055
+ (c) => Fr.parse(
1056
+ T({
1057
+ ...c,
1058
+ options: c.options ? JSON.parse(c.options) : {}
1059
1059
  })
1060
1060
  )
1061
1061
  ),
@@ -1080,10 +1080,7 @@ function Ga(t) {
1080
1080
  client_authentication_methods: n.client_authentication_methods ? JSON.parse(n.client_authentication_methods) : {},
1081
1081
  signed_request_object: n.signed_request_object ? JSON.parse(n.signed_request_object) : {},
1082
1082
  token_quota: n.token_quota ? JSON.parse(n.token_quota) : {},
1083
- tenant: S(r),
1084
- // Extract legacy fields from client_metadata
1085
- disable_sign_ups: o.disable_sign_ups === "true",
1086
- email_validation: o.email_validation || "disabled"
1083
+ tenant: T(r)
1087
1084
  };
1088
1085
  }
1089
1086
  };
@@ -1097,23 +1094,23 @@ function Ya(t) {
1097
1094
  sort: o,
1098
1095
  q: u
1099
1096
  } = e;
1100
- let d = t.selectFrom("keys").where(
1097
+ let c = t.selectFrom("keys").where(
1101
1098
  (f) => f.or([
1102
1099
  f("revoked_at", ">", (/* @__PURE__ */ new Date()).toISOString()),
1103
1100
  f("revoked_at", "is", null)
1104
1101
  ])
1105
1102
  );
1106
- u && (d = L(t, d, u, [
1103
+ u && (c = L(t, c, u, [
1107
1104
  "kid",
1108
1105
  "connection",
1109
1106
  "fingerprint",
1110
1107
  "thumbprint",
1111
1108
  "type"
1112
1109
  ]));
1113
- let c = d.select((f) => f.fn.count("kid").as("count"));
1110
+ let d = c.select((f) => f.fn.count("kid").as("count"));
1114
1111
  const h = n * r;
1115
- d = d.limit(r).offset(h), o && (d = d.orderBy(o.sort_by, o.sort_order));
1116
- const p = await d.selectAll().execute();
1112
+ c = c.limit(r).offset(h), o && (c = c.orderBy(o.sort_by, o.sort_order));
1113
+ const p = await c.selectAll().execute();
1117
1114
  if (!a)
1118
1115
  return {
1119
1116
  signingKeys: p,
@@ -1121,7 +1118,7 @@ function Ya(t) {
1121
1118
  limit: 0,
1122
1119
  length: 0
1123
1120
  };
1124
- const l = await c.executeTakeFirst(), y = F((l == null ? void 0 : l.count) ?? 0);
1121
+ const l = await d.executeTakeFirst(), y = F((l == null ? void 0 : l.count) ?? 0);
1125
1122
  return {
1126
1123
  signingKeys: p,
1127
1124
  start: h,
@@ -1219,20 +1216,20 @@ function so(t) {
1219
1216
  colors_primary: a,
1220
1217
  colors_page_background_type: o,
1221
1218
  colors_page_background_start: u,
1222
- colors_page_background_end: d,
1223
- colors_page_background_angle_dev: c,
1219
+ colors_page_background_end: c,
1220
+ colors_page_background_angle_dev: d,
1224
1221
  font_url: h,
1225
1222
  ...p
1226
1223
  } = n;
1227
- return S({
1224
+ return T({
1228
1225
  ...p,
1229
1226
  colors: {
1230
1227
  primary: a,
1231
1228
  page_background: {
1232
1229
  type: o,
1233
1230
  start: u,
1234
- end: d,
1235
- angle_deg: c
1231
+ end: c,
1232
+ angle_deg: d
1236
1233
  }
1237
1234
  },
1238
1235
  font: h ? { url: h } : void 0
@@ -1241,14 +1238,14 @@ function so(t) {
1241
1238
  }
1242
1239
  function uo(t) {
1243
1240
  return async (e, n) => {
1244
- var u, d, c, h, p, l, y, f, v, b, E, D, ae, U, pe, Nt, ge, nt;
1241
+ var u, c, d, h, p, l, y, f, v, b, E, D, ae, U, pe, Nt, ge, nt;
1245
1242
  const { colors: r, font: a, ...o } = n;
1246
1243
  try {
1247
1244
  await t.insertInto("branding").values({
1248
1245
  ...o,
1249
1246
  colors_primary: r == null ? void 0 : r.primary,
1250
- colors_page_background_type: (d = (u = n.colors) == null ? void 0 : u.page_background) == null ? void 0 : d.type,
1251
- colors_page_background_start: (h = (c = n.colors) == null ? void 0 : c.page_background) == null ? void 0 : h.start,
1247
+ colors_page_background_type: (c = (u = n.colors) == null ? void 0 : u.page_background) == null ? void 0 : c.type,
1248
+ colors_page_background_start: (h = (d = n.colors) == null ? void 0 : d.page_background) == null ? void 0 : h.start,
1252
1249
  colors_page_background_end: (l = (p = n.colors) == null ? void 0 : p.page_background) == null ? void 0 : l.end,
1253
1250
  colors_page_background_angle_dev: (f = (y = n.colors) == null ? void 0 : y.page_background) == null ? void 0 : f.angle_deg,
1254
1251
  font_url: (v = n.font) == null ? void 0 : v.url,
@@ -1276,11 +1273,11 @@ function co(t) {
1276
1273
  function lo(t) {
1277
1274
  return async (e, n = {}) => {
1278
1275
  const { page: r = 0, per_page: a = 50, include_totals: o = !1, q: u } = n;
1279
- let d = t.selectFrom("hooks").where("hooks.tenant_id", "=", e);
1280
- u && (d = L(t, d, u, ["url", "form_id"]));
1281
- const p = (await d.offset(r * a).limit(a).selectAll().execute()).map((y) => {
1276
+ let c = t.selectFrom("hooks").where("hooks.tenant_id", "=", e);
1277
+ u && (c = L(t, c, u, ["url", "form_id"]));
1278
+ const p = (await c.offset(r * a).limit(a).selectAll().execute()).map((y) => {
1282
1279
  const { tenant_id: f, enabled: v, synchronous: b, ...E } = y;
1283
- return S({
1280
+ return T({
1284
1281
  ...E,
1285
1282
  enabled: !!v,
1286
1283
  synchronous: !!b
@@ -1293,7 +1290,7 @@ function lo(t) {
1293
1290
  limit: 0,
1294
1291
  length: 0
1295
1292
  };
1296
- const { count: l } = await d.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
1293
+ const { count: l } = await c.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
1297
1294
  return {
1298
1295
  hooks: p,
1299
1296
  start: r * a,
@@ -1305,7 +1302,7 @@ function lo(t) {
1305
1302
  function _o(t) {
1306
1303
  return async (e, n) => {
1307
1304
  const r = await t.selectFrom("hooks").where("hooks.tenant_id", "=", e).where("hooks.hook_id", "=", n).selectAll().executeTakeFirst();
1308
- return r ? S({
1305
+ return r ? T({
1309
1306
  ...r,
1310
1307
  enabled: !!r.enabled,
1311
1308
  synchronous: !!r.synchronous
@@ -1383,8 +1380,8 @@ function wo(t) {
1383
1380
  fonts_subtitle_bold: !!r.fonts_subtitle_bold,
1384
1381
  fonts_title_bold: !!r.fonts_title_bold
1385
1382
  };
1386
- return S(
1387
- Bn(a, [
1383
+ return T(
1384
+ Wn(a, [
1388
1385
  "widget",
1389
1386
  "colors",
1390
1387
  "borders",
@@ -1414,9 +1411,9 @@ function vo(t) {
1414
1411
  function Co(t) {
1415
1412
  return async (e, n) => {
1416
1413
  const r = await t.selectFrom("login_sessions").where("login_sessions.id", "=", n).selectAll().executeTakeFirst();
1417
- return r ? qr.parse(
1418
- Bn(
1419
- S({
1414
+ return r ? jr.parse(
1415
+ Wn(
1416
+ T({
1420
1417
  ...r,
1421
1418
  login_completed: !!r.login_completed
1422
1419
  }),
@@ -1449,21 +1446,21 @@ function Oo(t) {
1449
1446
  })
1450
1447
  ).where("login_sessions.id", "=", n).where("login_sessions.tenant_id", "=", e).execute()).length === 1;
1451
1448
  }
1452
- function To(t) {
1449
+ function xo(t) {
1453
1450
  return async (e, n) => (await t.deleteFrom("login_sessions").where("login_sessions.tenant_id", "=", e).where("login_sessions.id", "=", n).execute()).length > 0;
1454
1451
  }
1455
- function So(t) {
1452
+ function To(t) {
1456
1453
  return {
1457
1454
  create: bo(t),
1458
1455
  get: Co(t),
1459
1456
  update: Oo(t),
1460
- remove: To(t)
1457
+ remove: xo(t)
1461
1458
  };
1462
1459
  }
1463
- function xo(t) {
1460
+ function So(t) {
1464
1461
  return async (e) => {
1465
1462
  const [n] = await t.selectFrom("prompt_settings").where("prompt_settings.tenant_id", "=", e).selectAll().execute();
1466
- return S({
1463
+ return T({
1467
1464
  identifier_first: !!(n != null && n.identifier_first),
1468
1465
  password_first: !!(n != null && n.password_first),
1469
1466
  webauthn_platform_first_factor: !!(n != null && n.webauthn_platform_first_factor),
@@ -1472,7 +1469,7 @@ function xo(t) {
1472
1469
  };
1473
1470
  }
1474
1471
  function Cn(t) {
1475
- return S({
1472
+ return T({
1476
1473
  ...t,
1477
1474
  webauthn_platform_first_factor: t.webauthn_platform_first_factor ? !!t.webauthn_platform_first_factor : void 0,
1478
1475
  identifier_first: t.identifier_first ? !!t.identifier_first : void 0,
@@ -1483,7 +1480,7 @@ function Cn(t) {
1483
1480
  function ko(t) {
1484
1481
  return async (e, n) => {
1485
1482
  try {
1486
- const r = jr.parse(n);
1483
+ const r = qr.parse(n);
1487
1484
  await t.insertInto("prompt_settings").values({
1488
1485
  ...Cn(r),
1489
1486
  tenant_id: e
@@ -1495,7 +1492,7 @@ function ko(t) {
1495
1492
  }
1496
1493
  function Eo(t) {
1497
1494
  return {
1498
- get: xo(t),
1495
+ get: So(t),
1499
1496
  set: ko(t)
1500
1497
  };
1501
1498
  }
@@ -1509,10 +1506,10 @@ function Io(t) {
1509
1506
  credentials: a,
1510
1507
  settings: o,
1511
1508
  enabled: u,
1512
- ...d
1509
+ ...c
1513
1510
  } = n;
1514
- return S({
1515
- ...d,
1511
+ return T({
1512
+ ...c,
1516
1513
  credentials: JSON.parse(a),
1517
1514
  settings: JSON.parse(o),
1518
1515
  enabled: !!u
@@ -1591,12 +1588,12 @@ function Fo(t) {
1591
1588
  return !!(await t.updateTable("refresh_tokens").set(a).where("tenant_id", "=", e).where("refresh_tokens.id", "=", n).execute()).length;
1592
1589
  };
1593
1590
  }
1594
- function qo(t) {
1591
+ function jo(t) {
1595
1592
  return async (e, n = {}) => {
1596
- const { page: r = 0, per_page: a = 50, include_totals: o = !1, sort: u, q: d } = n;
1597
- let c = t.selectFrom("refresh_tokens").where("refresh_tokens.tenant_id", "=", e);
1598
- d && (c = L(t, c, d, ["token", "session_id"]));
1599
- let h = c;
1593
+ const { page: r = 0, per_page: a = 50, include_totals: o = !1, sort: u, q: c } = n;
1594
+ let d = t.selectFrom("refresh_tokens").where("refresh_tokens.tenant_id", "=", e);
1595
+ c && (d = L(t, d, c, ["token", "session_id"]));
1596
+ let h = d;
1600
1597
  if (u && u.sort_by) {
1601
1598
  const { ref: v } = t.dynamic;
1602
1599
  h = h.orderBy(v(u.sort_by), u.sort_order);
@@ -1615,7 +1612,7 @@ function qo(t) {
1615
1612
  limit: 0,
1616
1613
  length: 0
1617
1614
  };
1618
- const { count: y } = await c.select((v) => v.fn.countAll().as("count")).executeTakeFirstOrThrow(), f = F(y);
1615
+ const { count: y } = await d.select((v) => v.fn.countAll().as("count")).executeTakeFirstOrThrow(), f = F(y);
1619
1616
  return {
1620
1617
  refresh_tokens: l,
1621
1618
  start: r * a,
@@ -1624,11 +1621,11 @@ function qo(t) {
1624
1621
  };
1625
1622
  };
1626
1623
  }
1627
- function jo(t) {
1624
+ function qo(t) {
1628
1625
  return {
1629
1626
  create: Ro(t),
1630
1627
  get: Do(t),
1631
- list: qo(t),
1628
+ list: jo(t),
1632
1629
  remove: zo(t),
1633
1630
  update: Fo(t)
1634
1631
  };
@@ -1684,9 +1681,9 @@ function Jo(t) {
1684
1681
  function Mo(t) {
1685
1682
  return async (e, n = {}) => {
1686
1683
  const { page: r = 0, per_page: a = 50, include_totals: o = !1, q: u } = n;
1687
- let d = t.selectFrom("forms").where("tenant_id", "=", e);
1688
- u && (d = L(t, d, u, []));
1689
- const p = (await d.offset(r * a).limit(a).selectAll().execute()).map((y) => {
1684
+ let c = t.selectFrom("forms").where("tenant_id", "=", e);
1685
+ u && (c = L(t, c, u, []));
1686
+ const p = (await c.offset(r * a).limit(a).selectAll().execute()).map((y) => {
1690
1687
  const f = { ...y };
1691
1688
  if (typeof f.nodes == "string")
1692
1689
  try {
@@ -1703,7 +1700,7 @@ function Mo(t) {
1703
1700
  f.ending = JSON.parse(f.ending);
1704
1701
  } catch {
1705
1702
  }
1706
- return bt.parse(S(f));
1703
+ return bt.parse(T(f));
1707
1704
  });
1708
1705
  if (!o)
1709
1706
  return {
@@ -1712,7 +1709,7 @@ function Mo(t) {
1712
1709
  limit: 0,
1713
1710
  length: 0
1714
1711
  };
1715
- const { count: l } = await d.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
1712
+ const { count: l } = await c.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
1716
1713
  return {
1717
1714
  forms: p,
1718
1715
  start: r * a,
@@ -1721,13 +1718,13 @@ function Mo(t) {
1721
1718
  };
1722
1719
  };
1723
1720
  }
1724
- function Wo(t) {
1721
+ function Bo(t) {
1725
1722
  return async (e, n) => {
1726
1723
  const { numDeletedRows: r } = await t.deleteFrom("forms").where("id", "=", n).where("tenant_id", "=", e).executeTakeFirst();
1727
1724
  return r > 0;
1728
1725
  };
1729
1726
  }
1730
- function Bo(t) {
1727
+ function Wo(t) {
1731
1728
  return async (e, n) => {
1732
1729
  const r = await t.selectFrom("forms").selectAll().where("forms.id", "=", n).where("tenant_id", "=", e).executeTakeFirst();
1733
1730
  if (!r) return null;
@@ -1747,7 +1744,7 @@ function Bo(t) {
1747
1744
  a.ending = JSON.parse(a.ending);
1748
1745
  } catch {
1749
1746
  }
1750
- return bt.parse(S(a));
1747
+ return bt.parse(T(a));
1751
1748
  };
1752
1749
  }
1753
1750
  function Ko(t) {
@@ -1764,9 +1761,9 @@ function Ko(t) {
1764
1761
  function Uo(t) {
1765
1762
  return {
1766
1763
  create: Jo(t),
1767
- get: Bo(t),
1764
+ get: Wo(t),
1768
1765
  list: Mo(t),
1769
- remove: Wo(t),
1766
+ remove: Bo(t),
1770
1767
  update: Ko(t)
1771
1768
  };
1772
1769
  }
@@ -1779,23 +1776,23 @@ function Qo(t) {
1779
1776
  updated_at: r
1780
1777
  }, o = Lr.parse(a), {
1781
1778
  verificationKey: u,
1782
- scopes: d,
1783
- options: c,
1779
+ scopes: c,
1780
+ options: d,
1784
1781
  skip_consent_for_verifiable_first_party_clients: h,
1785
1782
  allow_offline_access: p,
1786
1783
  ...l
1787
1784
  } = o, y = {
1788
1785
  ...l,
1789
1786
  tenant_id: e,
1790
- scopes: d ? JSON.stringify(d) : "[]",
1791
- options: c ? JSON.stringify(c) : "{}",
1787
+ scopes: c ? JSON.stringify(c) : "[]",
1788
+ options: d ? JSON.stringify(d) : "{}",
1792
1789
  skip_consent_for_verifiable_first_party_clients: h ? 1 : 0,
1793
1790
  allow_offline_access: p ? 1 : 0,
1794
1791
  verification_key: u,
1795
1792
  created_at: r,
1796
1793
  updated_at: r
1797
1794
  };
1798
- return await t.insertInto("resource_servers").values(y).execute(), S(o);
1795
+ return await t.insertInto("resource_servers").values(y).execute(), T(o);
1799
1796
  };
1800
1797
  }
1801
1798
  function Vo(t) {
@@ -1805,38 +1802,38 @@ function Vo(t) {
1805
1802
  const a = r, {
1806
1803
  verification_key: o,
1807
1804
  scopes: u,
1808
- options: d,
1809
- skip_consent_for_verifiable_first_party_clients: c,
1805
+ options: c,
1806
+ skip_consent_for_verifiable_first_party_clients: d,
1810
1807
  allow_offline_access: h,
1811
1808
  ...p
1812
1809
  } = a, l = {
1813
1810
  ...p,
1814
1811
  scopes: u ? JSON.parse(u) : [],
1815
- options: d ? JSON.parse(d) : {},
1816
- skip_consent_for_verifiable_first_party_clients: !!c,
1812
+ options: c ? JSON.parse(c) : {},
1813
+ skip_consent_for_verifiable_first_party_clients: !!d,
1817
1814
  allow_offline_access: !!h,
1818
1815
  // Convert verification_key back to verificationKey for API
1819
1816
  verificationKey: o
1820
1817
  };
1821
- return S(l);
1818
+ return T(l);
1822
1819
  };
1823
1820
  }
1824
1821
  function Go(t) {
1825
1822
  return async (e, n = {}) => {
1826
1823
  const { page: r = 0, per_page: a = 50, include_totals: o = !1, q: u } = n;
1827
- let d = t.selectFrom("resource_servers").where("resource_servers.tenant_id", "=", e);
1824
+ let c = t.selectFrom("resource_servers").where("resource_servers.tenant_id", "=", e);
1828
1825
  if (u) {
1829
1826
  const y = u.trim(), f = y.split(/\s+/), v = f.length === 1 ? f[0] : void 0, b = v ? v.match(/^(-)?(name|identifier):(.*)$/) : null, E = b ? b[3] : "", D = /^(>=|>|<=|<)/.test(E || "");
1830
1827
  if (b && !D) {
1831
1828
  const ae = !!b[1], U = b[2] === "name" ? "resource_servers.name" : "resource_servers.identifier";
1832
- d = ae ? d.where(U, "not like", `%${E}%`) : d.where(U, "like", `%${E}%`);
1829
+ c = ae ? c.where(U, "not like", `%${E}%`) : c.where(U, "like", `%${E}%`);
1833
1830
  } else
1834
- d = L(t, d, y, [
1831
+ c = L(t, c, y, [
1835
1832
  "resource_servers.name",
1836
1833
  "resource_servers.identifier"
1837
1834
  ]);
1838
1835
  }
1839
- const p = (await d.offset(r * a).limit(a).selectAll().execute()).map((y) => {
1836
+ const p = (await c.offset(r * a).limit(a).selectAll().execute()).map((y) => {
1840
1837
  const f = y, {
1841
1838
  verification_key: v,
1842
1839
  scopes: b,
@@ -1853,7 +1850,7 @@ function Go(t) {
1853
1850
  // Convert verification_key back to verificationKey for API
1854
1851
  verificationKey: v
1855
1852
  };
1856
- return S(pe);
1853
+ return T(pe);
1857
1854
  });
1858
1855
  if (!o)
1859
1856
  return {
@@ -1862,7 +1859,7 @@ function Go(t) {
1862
1859
  limit: 0,
1863
1860
  length: 0
1864
1861
  };
1865
- const { count: l } = await d.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
1862
+ const { count: l } = await c.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
1866
1863
  return {
1867
1864
  resource_servers: p,
1868
1865
  start: r * a,
@@ -1883,8 +1880,8 @@ function Ho(t) {
1883
1880
  verificationKey: a,
1884
1881
  scopes: o,
1885
1882
  options: u,
1886
- skip_consent_for_verifiable_first_party_clients: d,
1887
- allow_offline_access: c,
1883
+ skip_consent_for_verifiable_first_party_clients: c,
1884
+ allow_offline_access: d,
1888
1885
  ...h
1889
1886
  } = r, p = {
1890
1887
  ...h,
@@ -1894,7 +1891,7 @@ function Ho(t) {
1894
1891
  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 };
1895
1892
  p.options = JSON.stringify(v);
1896
1893
  }
1897
- d !== void 0 && (p.skip_consent_for_verifiable_first_party_clients = d ? 1 : 0), c !== void 0 && (p.allow_offline_access = c ? 1 : 0);
1894
+ c !== void 0 && (p.skip_consent_for_verifiable_first_party_clients = c ? 1 : 0), d !== void 0 && (p.allow_offline_access = d ? 1 : 0);
1898
1895
  const l = await t.updateTable("resource_servers").set(p).where("tenant_id", "=", e).where("id", "=", n).executeTakeFirst();
1899
1896
  return Number(l.numUpdatedRows) > 0;
1900
1897
  };
@@ -1938,17 +1935,17 @@ function ti(t) {
1938
1935
  let r = t.selectFrom("roles").where("roles.tenant_id", "=", e);
1939
1936
  const { page: a = 0, per_page: o = 50, include_totals: u = !1 } = n;
1940
1937
  n.q && (r = L(t, r, n.q, ["name"]));
1941
- const c = await r.offset(a * o).limit(o).selectAll().execute();
1938
+ const d = await r.offset(a * o).limit(o).selectAll().execute();
1942
1939
  if (!u)
1943
1940
  return {
1944
- roles: c,
1941
+ roles: d,
1945
1942
  start: a * o,
1946
1943
  limit: o,
1947
- length: c.length
1944
+ length: d.length
1948
1945
  };
1949
1946
  const { count: h } = await r.select((p) => p.fn.countAll().as("count")).executeTakeFirstOrThrow();
1950
1947
  return {
1951
- roles: c,
1948
+ roles: d,
1952
1949
  start: a * o,
1953
1950
  limit: o,
1954
1951
  length: F(h)
@@ -1998,10 +1995,10 @@ function oi(t) {
1998
1995
  };
1999
1996
  try {
2000
1997
  await t.insertInto("role_permissions").values(u).execute();
2001
- } catch (d) {
2002
- if (d.code === "SQLITE_CONSTRAINT_PRIMARYKEY" || d.code === "SQLITE_CONSTRAINT_UNIQUE")
1998
+ } catch (c) {
1999
+ if (c.code === "SQLITE_CONSTRAINT_PRIMARYKEY" || c.code === "SQLITE_CONSTRAINT_UNIQUE")
2003
2000
  continue;
2004
- throw d;
2001
+ throw c;
2005
2002
  }
2006
2003
  }
2007
2004
  return !0;
@@ -2031,7 +2028,7 @@ function ii(t) {
2031
2028
  function si(t) {
2032
2029
  return async (e, n, r = {}) => {
2033
2030
  const { page: a = 0, per_page: o = 50, include_totals: u = !1 } = r;
2034
- let d = t.selectFrom("role_permissions").leftJoin(
2031
+ let c = t.selectFrom("role_permissions").leftJoin(
2035
2032
  "resource_servers",
2036
2033
  (l) => l.onRef(
2037
2034
  "role_permissions.tenant_id",
@@ -2049,7 +2046,7 @@ function si(t) {
2049
2046
  "role_permissions.created_at",
2050
2047
  "resource_servers.name as resource_server_name"
2051
2048
  ]).where("role_permissions.tenant_id", "=", e).where("role_permissions.role_id", "=", n);
2052
- const p = (await d.offset(a * o).limit(o).execute()).map((l) => ({
2049
+ const p = (await c.offset(a * o).limit(o).execute()).map((l) => ({
2053
2050
  role_id: l.role_id,
2054
2051
  resource_server_identifier: l.resource_server_identifier,
2055
2052
  resource_server_name: l.resource_server_name || l.resource_server_identifier,
@@ -2059,7 +2056,7 @@ function si(t) {
2059
2056
  // No description available from role_permissions directly
2060
2057
  created_at: l.created_at
2061
2058
  }));
2062
- return u && await d.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow(), p;
2059
+ return u && await c.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow(), p;
2063
2060
  };
2064
2061
  }
2065
2062
  function ui(t) {
@@ -2069,7 +2066,7 @@ function ui(t) {
2069
2066
  list: si(t)
2070
2067
  };
2071
2068
  }
2072
- function di(t) {
2069
+ function ci(t) {
2073
2070
  return async (e, n, r, a) => {
2074
2071
  const o = (/* @__PURE__ */ new Date()).toISOString();
2075
2072
  try {
@@ -2087,7 +2084,7 @@ function di(t) {
2087
2084
  }
2088
2085
  };
2089
2086
  }
2090
- function ci(t) {
2087
+ function di(t) {
2091
2088
  return async (e, n, r, a) => {
2092
2089
  try {
2093
2090
  let o = t.deleteFrom("user_permissions").where("tenant_id", "=", e).where("user_id", "=", n).where(
@@ -2105,7 +2102,7 @@ function li(t) {
2105
2102
  return async (e, n, r, a) => {
2106
2103
  let o = t.selectFrom("user_permissions").leftJoin(
2107
2104
  "resource_servers",
2108
- (d) => d.onRef(
2105
+ (c) => c.onRef(
2109
2106
  "user_permissions.tenant_id",
2110
2107
  "=",
2111
2108
  "resource_servers.tenant_id"
@@ -2126,23 +2123,23 @@ function li(t) {
2126
2123
  "user_permissions.organization_id",
2127
2124
  "=",
2128
2125
  a
2129
- )), (await o.execute()).map((d) => ({
2130
- resource_server_identifier: d.resource_server_identifier,
2131
- permission_name: d.permission_name,
2126
+ )), (await o.execute()).map((c) => ({
2127
+ resource_server_identifier: c.resource_server_identifier,
2128
+ permission_name: c.permission_name,
2132
2129
  description: null,
2133
2130
  // No description available from user_permissions directly
2134
- resource_server_name: d.resource_server_name || d.resource_server_identifier,
2131
+ resource_server_name: c.resource_server_name || c.resource_server_identifier,
2135
2132
  // Fallback to identifier if name is null
2136
- user_id: d.user_id,
2137
- created_at: d.created_at,
2138
- organization_id: d.organization_id === "" ? void 0 : d.organization_id
2133
+ user_id: c.user_id,
2134
+ created_at: c.created_at,
2135
+ organization_id: c.organization_id === "" ? void 0 : c.organization_id
2139
2136
  }));
2140
2137
  };
2141
2138
  }
2142
2139
  function _i(t) {
2143
2140
  return {
2144
- create: di(t),
2145
- remove: ci(t),
2141
+ create: ci(t),
2142
+ remove: di(t),
2146
2143
  list: li(t)
2147
2144
  };
2148
2145
  }
@@ -2158,7 +2155,7 @@ function hi(t) {
2158
2155
  return async (e, n, r, a) => {
2159
2156
  let o = t.selectFrom("user_roles as ur").innerJoin(
2160
2157
  "roles as r",
2161
- (d) => d.onRef("ur.role_id", "=", "r.id").onRef("ur.tenant_id", "=", "r.tenant_id")
2158
+ (c) => c.onRef("ur.role_id", "=", "r.id").onRef("ur.tenant_id", "=", "r.tenant_id")
2162
2159
  ).select([
2163
2160
  "r.id",
2164
2161
  "r.name",
@@ -2214,7 +2211,7 @@ function wi(t) {
2214
2211
  return async (e, n) => {
2215
2212
  const r = {
2216
2213
  ...n,
2217
- id: n.id || xa(),
2214
+ id: n.id || Sa(),
2218
2215
  tenant_id: e,
2219
2216
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
2220
2217
  updated_at: (/* @__PURE__ */ new Date()).toISOString(),
@@ -2243,7 +2240,7 @@ function wi(t) {
2243
2240
  function Ni(t) {
2244
2241
  return async (e, n) => {
2245
2242
  const r = await t.selectFrom("organizations").selectAll().where("tenant_id", "=", e).where("id", "=", n).executeTakeFirst();
2246
- return r ? S({
2243
+ return r ? T({
2247
2244
  ...r,
2248
2245
  branding: r.branding ? JSON.parse(r.branding) : {},
2249
2246
  metadata: r.metadata ? JSON.parse(r.metadata) : {},
@@ -2260,7 +2257,7 @@ function vi(t) {
2260
2257
  r = r.offset(u);
2261
2258
  }
2262
2259
  const o = (await r.execute()).map(
2263
- (u) => S({
2260
+ (u) => T({
2264
2261
  ...u,
2265
2262
  branding: u.branding ? JSON.parse(u.branding) : {},
2266
2263
  metadata: u.metadata ? JSON.parse(u.metadata) : {},
@@ -2281,11 +2278,11 @@ function Ci(t) {
2281
2278
  }
2282
2279
  function bi(t) {
2283
2280
  return async (e, n, r) => {
2284
- const { branding: a, metadata: o, enabled_connections: u, token_quota: d, ...c } = r, h = {
2285
- ...c,
2281
+ const { branding: a, metadata: o, enabled_connections: u, token_quota: c, ...d } = r, h = {
2282
+ ...d,
2286
2283
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
2287
2284
  };
2288
- return a !== void 0 && (h.branding = JSON.stringify(a)), o !== void 0 && (h.metadata = JSON.stringify(o)), u !== void 0 && (h.enabled_connections = JSON.stringify(u)), d !== void 0 && (h.token_quota = JSON.stringify(d)), (await t.updateTable("organizations").set(h).where("tenant_id", "=", e).where("id", "=", n).execute()).length > 0;
2285
+ return a !== void 0 && (h.branding = JSON.stringify(a)), o !== void 0 && (h.metadata = JSON.stringify(o)), u !== void 0 && (h.enabled_connections = JSON.stringify(u)), c !== void 0 && (h.token_quota = JSON.stringify(c)), (await t.updateTable("organizations").set(h).where("tenant_id", "=", e).where("id", "=", n).execute()).length > 0;
2289
2286
  };
2290
2287
  }
2291
2288
  function Oi(t) {
@@ -2297,7 +2294,7 @@ function Oi(t) {
2297
2294
  update: bi(t)
2298
2295
  };
2299
2296
  }
2300
- function Ti(t) {
2297
+ function xi(t) {
2301
2298
  return async (e, n) => {
2302
2299
  const r = {
2303
2300
  id: re(),
@@ -2319,7 +2316,7 @@ function Ti(t) {
2319
2316
  };
2320
2317
  };
2321
2318
  }
2322
- function Si(t) {
2319
+ function Ti(t) {
2323
2320
  return async (e, n) => {
2324
2321
  const r = await t.selectFrom("user_organizations").selectAll().where("id", "=", n).where("tenant_id", "=", e).executeTakeFirst();
2325
2322
  return r ? {
@@ -2331,7 +2328,7 @@ function Si(t) {
2331
2328
  } : null;
2332
2329
  };
2333
2330
  }
2334
- function xi(t) {
2331
+ function Si(t) {
2335
2332
  return async (e, n) => {
2336
2333
  const r = (n == null ? void 0 : n.page) || 0, a = (n == null ? void 0 : n.per_page) || 50, o = r * a;
2337
2334
  let u = t.selectFrom("user_organizations").selectAll().where("tenant_id", "=", e);
@@ -2345,20 +2342,20 @@ function xi(t) {
2345
2342
  }
2346
2343
  }
2347
2344
  u = u.orderBy("created_at", "desc"), a > 0 && (u = u.limit(a).offset(o));
2348
- const d = await u.execute();
2349
- let c = t.selectFrom("user_organizations").select(t.fn.count("id").as("count")).where("tenant_id", "=", e);
2345
+ const c = await u.execute();
2346
+ let d = t.selectFrom("user_organizations").select(t.fn.count("id").as("count")).where("tenant_id", "=", e);
2350
2347
  if (n != null && n.q) {
2351
2348
  if (n.q.startsWith("user_id:")) {
2352
2349
  const l = n.q.replace("user_id:", "");
2353
- c = c.where("user_id", "=", l);
2350
+ d = d.where("user_id", "=", l);
2354
2351
  } else if (n.q.startsWith("organization_id:")) {
2355
2352
  const l = n.q.replace("organization_id:", "");
2356
- c = c.where("organization_id", "=", l);
2353
+ d = d.where("organization_id", "=", l);
2357
2354
  }
2358
2355
  }
2359
- const h = await c.executeTakeFirst();
2356
+ const h = await d.executeTakeFirst();
2360
2357
  return {
2361
- userOrganizations: d.map((l) => ({
2358
+ userOrganizations: c.map((l) => ({
2362
2359
  id: l.id,
2363
2360
  user_id: l.user_id,
2364
2361
  organization_id: l.organization_id,
@@ -2374,7 +2371,7 @@ function xi(t) {
2374
2371
  function ki(t) {
2375
2372
  return async (e, n, r) => {
2376
2373
  const a = (r == null ? void 0 : r.page) || 0, o = (r == null ? void 0 : r.per_page) || 50, u = a * o;
2377
- let d = t.selectFrom("user_organizations").innerJoin(
2374
+ let c = t.selectFrom("user_organizations").innerJoin(
2378
2375
  "organizations",
2379
2376
  "organizations.id",
2380
2377
  "user_organizations.organization_id"
@@ -2390,14 +2387,14 @@ function ki(t) {
2390
2387
  "organizations.updated_at",
2391
2388
  "user_organizations.created_at as joined_at"
2392
2389
  ]).where("user_organizations.tenant_id", "=", e).where("user_organizations.user_id", "=", n);
2393
- d = d.orderBy("user_organizations.created_at", "desc"), o > 0 && (d = d.limit(o).offset(u));
2394
- const c = await d.execute(), h = await t.selectFrom("user_organizations").innerJoin(
2390
+ c = c.orderBy("user_organizations.created_at", "desc"), o > 0 && (c = c.limit(o).offset(u));
2391
+ const d = await c.execute(), h = await t.selectFrom("user_organizations").innerJoin(
2395
2392
  "organizations",
2396
2393
  "organizations.id",
2397
2394
  "user_organizations.organization_id"
2398
2395
  ).select(t.fn.count("user_organizations.id").as("count")).where("user_organizations.tenant_id", "=", e).where("user_organizations.user_id", "=", n).executeTakeFirst();
2399
2396
  return {
2400
- organizations: c.map((l) => ({
2397
+ organizations: d.map((l) => ({
2401
2398
  id: l.id,
2402
2399
  name: l.name,
2403
2400
  display_name: l.display_name,
@@ -2431,9 +2428,9 @@ function Ii(t) {
2431
2428
  function Ai(t) {
2432
2429
  return {
2433
2430
  // CRUD operations
2434
- create: Ti(t),
2435
- get: Si(t),
2436
- list: xi(t),
2431
+ create: xi(t),
2432
+ get: Ti(t),
2433
+ list: Si(t),
2437
2434
  listUserOrganizations: ki(t),
2438
2435
  remove: Ei(t),
2439
2436
  update: Ii(t)
@@ -2460,7 +2457,7 @@ function Vn(t) {
2460
2457
  function Ee(t) {
2461
2458
  return typeof t == "function";
2462
2459
  }
2463
- function qt(t) {
2460
+ function jt(t) {
2464
2461
  return typeof t == "object" && t !== null;
2465
2462
  }
2466
2463
  function Pi(t) {
@@ -2513,7 +2510,7 @@ const z = s({
2513
2510
  alias: e
2514
2511
  });
2515
2512
  }
2516
- }), xe = s({
2513
+ }), Se = s({
2517
2514
  is(t) {
2518
2515
  return t.kind === "TableNode";
2519
2516
  },
@@ -2531,13 +2528,13 @@ const z = s({
2531
2528
  }
2532
2529
  });
2533
2530
  function J(t) {
2534
- return qt(t) && Ee(t.toOperationNode);
2531
+ return jt(t) && Ee(t.toOperationNode);
2535
2532
  }
2536
2533
  function $i(t) {
2537
- return qt(t) && "expressionType" in t && J(t);
2534
+ return jt(t) && "expressionType" in t && J(t);
2538
2535
  }
2539
2536
  function Di(t) {
2540
- return qt(t) && "expression" in t && G(t.alias) && J(t);
2537
+ return jt(t) && "expression" in t && G(t.alias) && J(t);
2541
2538
  }
2542
2539
  const Y = s({
2543
2540
  is(t) {
@@ -2688,10 +2685,10 @@ const Y = s({
2688
2685
  ...zi,
2689
2686
  "&&",
2690
2687
  "||"
2691
- ], qi = ["exists", "not exists"], ji = ["not", "-", ...qi], Li = [
2688
+ ], ji = ["exists", "not exists"], qi = ["not", "-", ...ji], Li = [
2692
2689
  ...Fi,
2693
2690
  ...Gn,
2694
- ...ji,
2691
+ ...qi,
2695
2692
  "between",
2696
2693
  "between symmetric"
2697
2694
  ], ke = s({
@@ -2727,7 +2724,7 @@ const mn = s({
2727
2724
  kind: "SelectAllNode"
2728
2725
  });
2729
2726
  }
2730
- }), jt = s({
2727
+ }), qt = s({
2731
2728
  is(t) {
2732
2729
  return t.kind === "ReferenceNode";
2733
2730
  },
@@ -2747,7 +2744,7 @@ const mn = s({
2747
2744
  }
2748
2745
  });
2749
2746
  function Hn(t) {
2750
- return qt(t) && J(t) && G(t.dynamicReference);
2747
+ return jt(t) && J(t) && G(t.dynamicReference);
2751
2748
  }
2752
2749
  const Yt = s({
2753
2750
  is(t) {
@@ -2803,7 +2800,7 @@ function Ut(t, e) {
2803
2800
  return Yt.create(n, Zn(e));
2804
2801
  }
2805
2802
  function Mi(t) {
2806
- if (Wt(t))
2803
+ if (Bt(t))
2807
2804
  return Mt(t);
2808
2805
  if (Hn(t))
2809
2806
  return t.toOperationNode();
@@ -2819,7 +2816,7 @@ function Zn(t) {
2819
2816
  if (t)
2820
2817
  return t === "asc" || t === "desc" ? R.createWithSql(t) : t.toOperationNode();
2821
2818
  }
2822
- const Tt = s({
2819
+ const xt = s({
2823
2820
  is(t) {
2824
2821
  return t.kind === "JSONReferenceNode";
2825
2822
  },
@@ -2871,28 +2868,28 @@ const Tt = s({
2871
2868
  });
2872
2869
  }
2873
2870
  });
2874
- function Wi(t) {
2871
+ function Bi(t) {
2875
2872
  return G(t) ? me(t) : t.toOperationNode();
2876
2873
  }
2877
2874
  function _t(t) {
2878
- return le(t) ? t.map((e) => q(e)) : [q(t)];
2875
+ return le(t) ? t.map((e) => j(e)) : [j(t)];
2879
2876
  }
2880
- function q(t) {
2881
- return Wt(t) ? Mt(t) : Wi(t);
2877
+ function j(t) {
2878
+ return Bt(t) ? Mt(t) : Bi(t);
2882
2879
  }
2883
- function Bi(t, e) {
2880
+ function Wi(t, e) {
2884
2881
  const n = me(t);
2885
2882
  if (bn(e))
2886
- return Tt.create(n, er.create(ke.create(e)));
2883
+ return xt.create(n, er.create(ke.create(e)));
2887
2884
  const r = e.slice(0, -1);
2888
2885
  if (bn(r))
2889
- return Tt.create(n, it.create(ke.create(r)));
2886
+ return xt.create(n, it.create(ke.create(r)));
2890
2887
  throw new Error(`Invalid JSON operator: ${e}`);
2891
2888
  }
2892
2889
  function me(t) {
2893
2890
  const e = ".";
2894
2891
  if (!t.includes(e))
2895
- return jt.create(mn.create(t));
2892
+ return qt.create(mn.create(t));
2896
2893
  const n = t.split(e).map(tr);
2897
2894
  if (n.length === 3)
2898
2895
  return Ui(n);
@@ -2910,11 +2907,11 @@ function Ki(t) {
2910
2907
  }
2911
2908
  function Ui(t) {
2912
2909
  const [e, n, r] = t;
2913
- return jt.create(mn.create(r), xe.createWithSchema(e, n));
2910
+ return qt.create(mn.create(r), Se.createWithSchema(e, n));
2914
2911
  }
2915
2912
  function Qi(t) {
2916
2913
  const [e, n] = t;
2917
- return jt.create(mn.create(n), xe.create(e));
2914
+ return qt.create(mn.create(n), Se.create(e));
2918
2915
  }
2919
2916
  function tr(t) {
2920
2917
  return t.trim();
@@ -2961,7 +2958,7 @@ function Yi(t) {
2961
2958
  return le(t) ? Hi(t) : $(t);
2962
2959
  }
2963
2960
  function $(t) {
2964
- return Wt(t) ? Mt(t) : he.create(t);
2961
+ return Bt(t) ? Mt(t) : he.create(t);
2965
2962
  }
2966
2963
  function hn(t) {
2967
2964
  return _n(t) || Un(t) || Qn(t);
@@ -2972,7 +2969,7 @@ function fn(t) {
2972
2969
  return he.createImmediate(t);
2973
2970
  }
2974
2971
  function Hi(t) {
2975
- return t.some(Wt) ? Gi.create(t.map((e) => $(e))) : Vi.create(t);
2972
+ return t.some(Bt) ? Gi.create(t.map((e) => $(e))) : Vi.create(t);
2976
2973
  }
2977
2974
  const mt = s({
2978
2975
  is(t) {
@@ -2993,10 +2990,10 @@ function K(t) {
2993
2990
  throw new Error(`invalid arguments: ${JSON.stringify(t)}`);
2994
2991
  }
2995
2992
  function pn(t, e, n) {
2996
- return Xi(e) && nr(n) ? Xe.create(q(t), Xt(e), he.createImmediate(n)) : Xe.create(q(t), Xt(e), Yi(n));
2993
+ return Xi(e) && nr(n) ? Xe.create(j(t), Xt(e), he.createImmediate(n)) : Xe.create(j(t), Xt(e), Yi(n));
2997
2994
  }
2998
2995
  function ht(t, e, n) {
2999
- return Xe.create(q(t), Xt(e), q(n));
2996
+ return Xe.create(j(t), Xt(e), j(n));
3000
2997
  }
3001
2998
  function On(t, e) {
3002
2999
  return Ht(Object.entries(t).filter(([, n]) => !Ot(n)).map(([n, r]) => pn(n, nr(r) ? "is" : "=", r)), e);
@@ -3005,9 +3002,9 @@ function Ht(t, e, n = !0) {
3005
3002
  const r = e === "and" ? _e.create : tt.create;
3006
3003
  if (t.length === 0)
3007
3004
  return Xe.create(he.createImmediate(1), ke.create("="), he.createImmediate(e === "and" ? 1 : 0));
3008
- let a = Tn(t[0]);
3005
+ let a = xn(t[0]);
3009
3006
  for (let o = 1; o < t.length; ++o)
3010
- a = r(a, Tn(t[o]));
3007
+ a = r(a, xn(t[o]));
3011
3008
  return t.length > 1 && n ? mt.create(a) : a;
3012
3009
  }
3013
3010
  function Xi(t) {
@@ -3023,7 +3020,7 @@ function Xt(t) {
3023
3020
  return t.toOperationNode();
3024
3021
  throw new Error(`invalid operator ${JSON.stringify(t)}`);
3025
3022
  }
3026
- function Tn(t) {
3023
+ function xn(t) {
3027
3024
  return J(t) ? t.toOperationNode() : t;
3028
3025
  }
3029
3026
  const Ze = s({
@@ -3042,7 +3039,7 @@ const Ze = s({
3042
3039
  items: s([...t.items, ...e])
3043
3040
  });
3044
3041
  }
3045
- }), Sn = s({
3042
+ }), Tn = s({
3046
3043
  is(t) {
3047
3044
  return t.kind === "PartitionByNode";
3048
3045
  },
@@ -3076,10 +3073,10 @@ const Ze = s({
3076
3073
  cloneWithPartitionByItems(t, e) {
3077
3074
  return s({
3078
3075
  ...t,
3079
- partitionBy: t.partitionBy ? Sn.cloneWithItems(t.partitionBy, e) : Sn.create(e)
3076
+ partitionBy: t.partitionBy ? Tn.cloneWithItems(t.partitionBy, e) : Tn.create(e)
3080
3077
  });
3081
3078
  }
3082
- }), St = s({
3079
+ }), Tt = s({
3083
3080
  is(t) {
3084
3081
  return t.kind === "FromNode";
3085
3082
  },
@@ -3095,7 +3092,7 @@ const Ze = s({
3095
3092
  froms: s([...t.froms, ...e])
3096
3093
  });
3097
3094
  }
3098
- }), xn = s({
3095
+ }), Sn = s({
3099
3096
  is(t) {
3100
3097
  return t.kind === "GroupByNode";
3101
3098
  },
@@ -3127,7 +3124,7 @@ const Ze = s({
3127
3124
  having: e === "And" ? _e.create(t.having, n) : tt.create(t.having, n)
3128
3125
  });
3129
3126
  }
3130
- }), T = s({
3127
+ }), x = s({
3131
3128
  is(t) {
3132
3129
  return t.kind === "SelectQueryNode";
3133
3130
  },
@@ -3140,7 +3137,7 @@ const Ze = s({
3140
3137
  createFrom(t, e) {
3141
3138
  return s({
3142
3139
  kind: "SelectQueryNode",
3143
- from: St.create(t),
3140
+ from: Tt.create(t),
3144
3141
  ...e && { with: e }
3145
3142
  });
3146
3143
  },
@@ -3177,7 +3174,7 @@ const Ze = s({
3177
3174
  cloneWithGroupByItems(t, e) {
3178
3175
  return s({
3179
3176
  ...t,
3180
- groupBy: t.groupBy ? xn.cloneWithItems(t.groupBy, e) : xn.create(e)
3177
+ groupBy: t.groupBy ? Sn.cloneWithItems(t.groupBy, e) : Sn.create(e)
3181
3178
  });
3182
3179
  },
3183
3180
  cloneWithLimit(t, e) {
@@ -3251,16 +3248,16 @@ function Ie(t, e) {
3251
3248
  }
3252
3249
  });
3253
3250
  }
3254
- var W;
3255
- const dt = class dt {
3251
+ var B;
3252
+ const ct = class ct {
3256
3253
  constructor(e) {
3257
- C(this, W);
3258
- O(this, W, s(e));
3254
+ C(this, B);
3255
+ O(this, B, s(e));
3259
3256
  }
3260
3257
  on(...e) {
3261
- return new dt({
3262
- ...i(this, W),
3263
- joinNode: ot.cloneWithOn(i(this, W).joinNode, K(e))
3258
+ return new ct({
3259
+ ...i(this, B),
3260
+ joinNode: ot.cloneWithOn(i(this, B).joinNode, K(e))
3264
3261
  });
3265
3262
  }
3266
3263
  /**
@@ -3270,18 +3267,18 @@ const dt = class dt {
3270
3267
  * See {@link WhereInterface.whereRef} for documentation and examples.
3271
3268
  */
3272
3269
  onRef(e, n, r) {
3273
- return new dt({
3274
- ...i(this, W),
3275
- joinNode: ot.cloneWithOn(i(this, W).joinNode, ht(e, n, r))
3270
+ return new ct({
3271
+ ...i(this, B),
3272
+ joinNode: ot.cloneWithOn(i(this, B).joinNode, ht(e, n, r))
3276
3273
  });
3277
3274
  }
3278
3275
  /**
3279
3276
  * Adds `on true`.
3280
3277
  */
3281
3278
  onTrue() {
3282
- return new dt({
3283
- ...i(this, W),
3284
- joinNode: ot.cloneWithOn(i(this, W).joinNode, R.createWithSql("true"))
3279
+ return new ct({
3280
+ ...i(this, B),
3281
+ joinNode: ot.cloneWithOn(i(this, B).joinNode, R.createWithSql("true"))
3285
3282
  });
3286
3283
  }
3287
3284
  /**
@@ -3292,12 +3289,12 @@ const dt = class dt {
3292
3289
  return e(this);
3293
3290
  }
3294
3291
  toOperationNode() {
3295
- return i(this, W).joinNode;
3292
+ return i(this, B).joinNode;
3296
3293
  }
3297
3294
  };
3298
- W = new WeakMap();
3299
- let xt = dt;
3300
- Ie(xt, "don't await JoinBuilder instances. They are never executed directly and are always just a part of a query.");
3295
+ B = new WeakMap();
3296
+ let St = ct;
3297
+ Ie(St, "don't await JoinBuilder instances. They are never executed directly and are always just a part of a query.");
3301
3298
  const Zi = s({
3302
3299
  is(t) {
3303
3300
  return t.kind === "PartitionByItemNode";
@@ -3382,7 +3379,7 @@ const st = s({
3382
3379
  createSelectAllFromTable(t) {
3383
3380
  return s({
3384
3381
  kind: "SelectionNode",
3385
- selection: jt.createSelectAll(t)
3382
+ selection: qt.createSelectAll(t)
3386
3383
  });
3387
3384
  }
3388
3385
  });
@@ -3397,7 +3394,7 @@ function ar(t) {
3397
3394
  }
3398
3395
  function In(t) {
3399
3396
  if (G(t))
3400
- return st.createSelectAllFromTable(B(t));
3397
+ return st.createSelectAllFromTable(W(t));
3401
3398
  throw new Error(`invalid value selectAll expression: ${JSON.stringify(t)}`);
3402
3399
  }
3403
3400
  const ts = s({
@@ -3442,7 +3439,7 @@ const ts = s({
3442
3439
  cloneWithFromItems(t, e) {
3443
3440
  return s({
3444
3441
  ...t,
3445
- from: t.from ? St.cloneWithFroms(t.from, e) : St.create(e)
3442
+ from: t.from ? Tt.cloneWithFroms(t.from, e) : Tt.create(e)
3446
3443
  });
3447
3444
  },
3448
3445
  cloneWithUpdates(t, e) {
@@ -3480,7 +3477,7 @@ const ts = s({
3480
3477
  create(t, e) {
3481
3478
  return s({
3482
3479
  kind: "DeleteQueryNode",
3483
- from: St.create(t),
3480
+ from: Tt.create(t),
3484
3481
  ...e && { with: e }
3485
3482
  });
3486
3483
  },
@@ -3623,7 +3620,7 @@ const ts = s({
3623
3620
  }
3624
3621
  }), M = s({
3625
3622
  is(t) {
3626
- return T.is(t) || ts.is(t) || ns.is(t) || rs.is(t) || os.is(t);
3623
+ return x.is(t) || ts.is(t) || ns.is(t) || rs.is(t) || os.is(t);
3627
3624
  },
3628
3625
  cloneWithWhere(t, e) {
3629
3626
  return s({
@@ -3699,14 +3696,14 @@ const us = s({
3699
3696
  });
3700
3697
  }
3701
3698
  });
3702
- function ds(t, e) {
3699
+ function cs(t, e) {
3703
3700
  if (!_n(t) && !Vn(t))
3704
3701
  throw new Error(`Invalid top expression: ${t}`);
3705
- if (!Ot(e) && !cs(e))
3702
+ if (!Ot(e) && !ds(e))
3706
3703
  throw new Error(`Invalid top modifiers: ${e}`);
3707
3704
  return us.create(t, e);
3708
3705
  }
3709
- function cs(t) {
3706
+ function ds(t) {
3710
3707
  return t === "percent" || t === "with ties" || t === "percent with ties";
3711
3708
  }
3712
3709
  const ls = s({
@@ -3795,16 +3792,16 @@ function ms() {
3795
3792
  function H() {
3796
3793
  return new hs();
3797
3794
  }
3798
- var je;
3795
+ var qe;
3799
3796
  class hs {
3800
3797
  constructor() {
3801
- C(this, je);
3798
+ C(this, qe);
3802
3799
  }
3803
3800
  get queryId() {
3804
- return i(this, je) === void 0 && O(this, je, _s(8)), i(this, je);
3801
+ return i(this, qe) === void 0 && O(this, qe, _s(8)), i(this, qe);
3805
3802
  }
3806
3803
  }
3807
- je = new WeakMap();
3804
+ qe = new WeakMap();
3808
3805
  var $t;
3809
3806
  class fs {
3810
3807
  constructor() {
@@ -4696,7 +4693,7 @@ class gs extends fs {
4696
4693
  const r = super.transformReferences(n);
4697
4694
  return r.table.table.schema ? r : {
4698
4695
  ...r,
4699
- table: xe.createWithSchema(i(this, Le), r.table.table.identifier.name)
4696
+ table: Se.createWithSchema(i(this, Le), r.table.table.identifier.name)
4700
4697
  };
4701
4698
  }
4702
4699
  }
@@ -4715,7 +4712,7 @@ Le = new WeakMap(), Ne = new WeakMap(), ve = new WeakMap(), I = new WeakSet(), o
4715
4712
  const r = /* @__PURE__ */ new Set();
4716
4713
  return "with" in n && n.with && w(this, I, ur).call(this, n.with, r), r;
4717
4714
  }, $e = function(n, r) {
4718
- const a = xe.is(n) ? n : fe.is(n) && xe.is(n.node) ? n.node : null;
4715
+ const a = Se.is(n) ? n : fe.is(n) && Se.is(n.node) ? n.node : null;
4719
4716
  a && w(this, I, en).call(this, a.table, r);
4720
4717
  }, en = function(n, r) {
4721
4718
  const a = n.identifier.name;
@@ -4727,7 +4724,7 @@ Le = new WeakMap(), Ne = new WeakMap(), ve = new WeakMap(), I = new WeakSet(), o
4727
4724
  }
4728
4725
  };
4729
4726
  var ft;
4730
- class dr {
4727
+ class cr {
4731
4728
  constructor(e) {
4732
4729
  C(this, ft);
4733
4730
  O(this, ft, new gs(e));
@@ -4799,11 +4796,11 @@ class Ns {
4799
4796
  }
4800
4797
  async *stream(e, n, r) {
4801
4798
  const a = new Rn(), o = new Rn();
4802
- this.provideConnection(async (d) => (a.resolve(d), await o.promise)).catch((d) => a.reject(d));
4799
+ this.provideConnection(async (c) => (a.resolve(c), await o.promise)).catch((c) => a.reject(c));
4803
4800
  const u = await a.promise;
4804
4801
  try {
4805
- for await (const d of u.streamQuery(e, n))
4806
- yield await w(this, gt, tn).call(this, d, r);
4802
+ for await (const c of u.streamQuery(e, n))
4803
+ yield await w(this, gt, tn).call(this, c, r);
4807
4804
  } finally {
4808
4805
  o.resolve();
4809
4806
  }
@@ -4844,9 +4841,9 @@ class Fe extends Ns {
4844
4841
  return new Fe([]);
4845
4842
  }
4846
4843
  }
4847
- const cr = new Fe();
4844
+ const dr = new Fe();
4848
4845
  function Cs(t, e) {
4849
- return new xt({
4846
+ return new St({
4850
4847
  joinNode: ot.create(t, It(e))
4851
4848
  });
4852
4849
  }
@@ -4857,7 +4854,7 @@ function bs() {
4857
4854
  }
4858
4855
  function Ae(t, e) {
4859
4856
  if (e.length === 3)
4860
- return Ts(t, e[0], e[1], e[2]);
4857
+ return xs(t, e[0], e[1], e[2]);
4861
4858
  if (e.length === 2)
4862
4859
  return Os(t, e[0], e[1]);
4863
4860
  throw new Error("not implemented");
@@ -4865,10 +4862,10 @@ function Ae(t, e) {
4865
4862
  function Os(t, e, n) {
4866
4863
  return n(Cs(t, e)).toOperationNode();
4867
4864
  }
4868
- function Ts(t, e, n, r) {
4865
+ function xs(t, e, n, r) {
4869
4866
  return ot.createWithOn(t, It(e), ht(n, "=", r));
4870
4867
  }
4871
- const Ss = s({
4868
+ const Ts = s({
4872
4869
  is(t) {
4873
4870
  return t.kind === "OffsetNode";
4874
4871
  },
@@ -4878,7 +4875,7 @@ const Ss = s({
4878
4875
  offset: t
4879
4876
  });
4880
4877
  }
4881
- }), xs = s({
4878
+ }), Ss = s({
4882
4879
  is(t) {
4883
4880
  return t.kind === "GroupByItemNode";
4884
4881
  },
@@ -4890,7 +4887,7 @@ const Ss = s({
4890
4887
  }
4891
4888
  });
4892
4889
  function ks(t) {
4893
- return t = Ee(t) ? t(Jt()) : t, _t(t).map(xs.create);
4890
+ return t = Ee(t) ? t(Jt()) : t, _t(t).map(Ss.create);
4894
4891
  }
4895
4892
  const Es = s({
4896
4893
  is(t) {
@@ -4952,27 +4949,27 @@ const Dt = class Dt {
4952
4949
  }
4953
4950
  };
4954
4951
  te = new WeakMap();
4955
- let x = Dt;
4956
- var We, ue;
4952
+ let S = Dt;
4953
+ var Be, ue;
4957
4954
  class gn {
4958
4955
  constructor(e, n) {
4959
- C(this, We);
4956
+ C(this, Be);
4960
4957
  C(this, ue);
4961
- O(this, We, e), O(this, ue, n);
4958
+ O(this, Be, e), O(this, ue, n);
4962
4959
  }
4963
4960
  /** @private */
4964
4961
  get expression() {
4965
- return i(this, We);
4962
+ return i(this, Be);
4966
4963
  }
4967
4964
  /** @private */
4968
4965
  get alias() {
4969
4966
  return i(this, ue);
4970
4967
  }
4971
4968
  toOperationNode() {
4972
- return fe.create(i(this, We).toOperationNode(), J(i(this, ue)) ? i(this, ue).toOperationNode() : z.create(i(this, ue)));
4969
+ return fe.create(i(this, Be).toOperationNode(), J(i(this, ue)) ? i(this, ue).toOperationNode() : z.create(i(this, ue)));
4973
4970
  }
4974
4971
  }
4975
- We = new WeakMap(), ue = new WeakMap();
4972
+ Be = new WeakMap(), ue = new WeakMap();
4976
4973
  var be;
4977
4974
  const Rt = class Rt {
4978
4975
  constructor(e) {
@@ -5081,85 +5078,85 @@ const N = class N {
5081
5078
  having(...e) {
5082
5079
  return new N({
5083
5080
  ...i(this, _),
5084
- queryNode: T.cloneWithHaving(i(this, _).queryNode, K(e))
5081
+ queryNode: x.cloneWithHaving(i(this, _).queryNode, K(e))
5085
5082
  });
5086
5083
  }
5087
5084
  havingRef(e, n, r) {
5088
5085
  return new N({
5089
5086
  ...i(this, _),
5090
- queryNode: T.cloneWithHaving(i(this, _).queryNode, ht(e, n, r))
5087
+ queryNode: x.cloneWithHaving(i(this, _).queryNode, ht(e, n, r))
5091
5088
  });
5092
5089
  }
5093
5090
  select(e) {
5094
5091
  return new N({
5095
5092
  ...i(this, _),
5096
- queryNode: T.cloneWithSelections(i(this, _).queryNode, rr(e))
5093
+ queryNode: x.cloneWithSelections(i(this, _).queryNode, rr(e))
5097
5094
  });
5098
5095
  }
5099
5096
  distinctOn(e) {
5100
5097
  return new N({
5101
5098
  ...i(this, _),
5102
- queryNode: T.cloneWithDistinctOn(i(this, _).queryNode, _t(e))
5099
+ queryNode: x.cloneWithDistinctOn(i(this, _).queryNode, _t(e))
5103
5100
  });
5104
5101
  }
5105
5102
  modifyFront(e) {
5106
5103
  return new N({
5107
5104
  ...i(this, _),
5108
- queryNode: T.cloneWithFrontModifier(i(this, _).queryNode, Y.createWithExpression(e.toOperationNode()))
5105
+ queryNode: x.cloneWithFrontModifier(i(this, _).queryNode, Y.createWithExpression(e.toOperationNode()))
5109
5106
  });
5110
5107
  }
5111
5108
  modifyEnd(e) {
5112
5109
  return new N({
5113
5110
  ...i(this, _),
5114
- queryNode: T.cloneWithEndModifier(i(this, _).queryNode, Y.createWithExpression(e.toOperationNode()))
5111
+ queryNode: x.cloneWithEndModifier(i(this, _).queryNode, Y.createWithExpression(e.toOperationNode()))
5115
5112
  });
5116
5113
  }
5117
5114
  distinct() {
5118
5115
  return new N({
5119
5116
  ...i(this, _),
5120
- queryNode: T.cloneWithFrontModifier(i(this, _).queryNode, Y.create("Distinct"))
5117
+ queryNode: x.cloneWithFrontModifier(i(this, _).queryNode, Y.create("Distinct"))
5121
5118
  });
5122
5119
  }
5123
5120
  forUpdate(e) {
5124
5121
  return new N({
5125
5122
  ...i(this, _),
5126
- queryNode: T.cloneWithEndModifier(i(this, _).queryNode, Y.create("ForUpdate", e ? vt(e).map(B) : void 0))
5123
+ queryNode: x.cloneWithEndModifier(i(this, _).queryNode, Y.create("ForUpdate", e ? vt(e).map(W) : void 0))
5127
5124
  });
5128
5125
  }
5129
5126
  forShare(e) {
5130
5127
  return new N({
5131
5128
  ...i(this, _),
5132
- queryNode: T.cloneWithEndModifier(i(this, _).queryNode, Y.create("ForShare", e ? vt(e).map(B) : void 0))
5129
+ queryNode: x.cloneWithEndModifier(i(this, _).queryNode, Y.create("ForShare", e ? vt(e).map(W) : void 0))
5133
5130
  });
5134
5131
  }
5135
5132
  forKeyShare(e) {
5136
5133
  return new N({
5137
5134
  ...i(this, _),
5138
- queryNode: T.cloneWithEndModifier(i(this, _).queryNode, Y.create("ForKeyShare", e ? vt(e).map(B) : void 0))
5135
+ queryNode: x.cloneWithEndModifier(i(this, _).queryNode, Y.create("ForKeyShare", e ? vt(e).map(W) : void 0))
5139
5136
  });
5140
5137
  }
5141
5138
  forNoKeyUpdate(e) {
5142
5139
  return new N({
5143
5140
  ...i(this, _),
5144
- queryNode: T.cloneWithEndModifier(i(this, _).queryNode, Y.create("ForNoKeyUpdate", e ? vt(e).map(B) : void 0))
5141
+ queryNode: x.cloneWithEndModifier(i(this, _).queryNode, Y.create("ForNoKeyUpdate", e ? vt(e).map(W) : void 0))
5145
5142
  });
5146
5143
  }
5147
5144
  skipLocked() {
5148
5145
  return new N({
5149
5146
  ...i(this, _),
5150
- queryNode: T.cloneWithEndModifier(i(this, _).queryNode, Y.create("SkipLocked"))
5147
+ queryNode: x.cloneWithEndModifier(i(this, _).queryNode, Y.create("SkipLocked"))
5151
5148
  });
5152
5149
  }
5153
5150
  noWait() {
5154
5151
  return new N({
5155
5152
  ...i(this, _),
5156
- queryNode: T.cloneWithEndModifier(i(this, _).queryNode, Y.create("NoWait"))
5153
+ queryNode: x.cloneWithEndModifier(i(this, _).queryNode, Y.create("NoWait"))
5157
5154
  });
5158
5155
  }
5159
5156
  selectAll(e) {
5160
5157
  return new N({
5161
5158
  ...i(this, _),
5162
- queryNode: T.cloneWithSelections(i(this, _).queryNode, ar(e))
5159
+ queryNode: x.cloneWithSelections(i(this, _).queryNode, ar(e))
5163
5160
  });
5164
5161
  }
5165
5162
  innerJoin(...e) {
@@ -5201,73 +5198,73 @@ const N = class N {
5201
5198
  orderBy(...e) {
5202
5199
  return new N({
5203
5200
  ...i(this, _),
5204
- queryNode: T.cloneWithOrderByItems(i(this, _).queryNode, Xn(e))
5201
+ queryNode: x.cloneWithOrderByItems(i(this, _).queryNode, Xn(e))
5205
5202
  });
5206
5203
  }
5207
5204
  groupBy(e) {
5208
5205
  return new N({
5209
5206
  ...i(this, _),
5210
- queryNode: T.cloneWithGroupByItems(i(this, _).queryNode, ks(e))
5207
+ queryNode: x.cloneWithGroupByItems(i(this, _).queryNode, ks(e))
5211
5208
  });
5212
5209
  }
5213
5210
  limit(e) {
5214
5211
  return new N({
5215
5212
  ...i(this, _),
5216
- queryNode: T.cloneWithLimit(i(this, _).queryNode, ls.create($(e)))
5213
+ queryNode: x.cloneWithLimit(i(this, _).queryNode, ls.create($(e)))
5217
5214
  });
5218
5215
  }
5219
5216
  offset(e) {
5220
5217
  return new N({
5221
5218
  ...i(this, _),
5222
- queryNode: T.cloneWithOffset(i(this, _).queryNode, Ss.create($(e)))
5219
+ queryNode: x.cloneWithOffset(i(this, _).queryNode, Ts.create($(e)))
5223
5220
  });
5224
5221
  }
5225
5222
  fetch(e, n = "only") {
5226
5223
  return new N({
5227
5224
  ...i(this, _),
5228
- queryNode: T.cloneWithFetch(i(this, _).queryNode, As(e, n))
5225
+ queryNode: x.cloneWithFetch(i(this, _).queryNode, As(e, n))
5229
5226
  });
5230
5227
  }
5231
5228
  top(e, n) {
5232
5229
  return new N({
5233
5230
  ...i(this, _),
5234
- queryNode: M.cloneWithTop(i(this, _).queryNode, ds(e, n))
5231
+ queryNode: M.cloneWithTop(i(this, _).queryNode, cs(e, n))
5235
5232
  });
5236
5233
  }
5237
5234
  union(e) {
5238
5235
  return new N({
5239
5236
  ...i(this, _),
5240
- queryNode: T.cloneWithSetOperations(i(this, _).queryNode, Pe("union", e, !1))
5237
+ queryNode: x.cloneWithSetOperations(i(this, _).queryNode, Pe("union", e, !1))
5241
5238
  });
5242
5239
  }
5243
5240
  unionAll(e) {
5244
5241
  return new N({
5245
5242
  ...i(this, _),
5246
- queryNode: T.cloneWithSetOperations(i(this, _).queryNode, Pe("union", e, !0))
5243
+ queryNode: x.cloneWithSetOperations(i(this, _).queryNode, Pe("union", e, !0))
5247
5244
  });
5248
5245
  }
5249
5246
  intersect(e) {
5250
5247
  return new N({
5251
5248
  ...i(this, _),
5252
- queryNode: T.cloneWithSetOperations(i(this, _).queryNode, Pe("intersect", e, !1))
5249
+ queryNode: x.cloneWithSetOperations(i(this, _).queryNode, Pe("intersect", e, !1))
5253
5250
  });
5254
5251
  }
5255
5252
  intersectAll(e) {
5256
5253
  return new N({
5257
5254
  ...i(this, _),
5258
- queryNode: T.cloneWithSetOperations(i(this, _).queryNode, Pe("intersect", e, !0))
5255
+ queryNode: x.cloneWithSetOperations(i(this, _).queryNode, Pe("intersect", e, !0))
5259
5256
  });
5260
5257
  }
5261
5258
  except(e) {
5262
5259
  return new N({
5263
5260
  ...i(this, _),
5264
- queryNode: T.cloneWithSetOperations(i(this, _).queryNode, Pe("except", e, !1))
5261
+ queryNode: x.cloneWithSetOperations(i(this, _).queryNode, Pe("except", e, !1))
5265
5262
  });
5266
5263
  }
5267
5264
  exceptAll(e) {
5268
5265
  return new N({
5269
5266
  ...i(this, _),
5270
- queryNode: T.cloneWithSetOperations(i(this, _).queryNode, Pe("except", e, !0))
5267
+ queryNode: x.cloneWithSetOperations(i(this, _).queryNode, Pe("except", e, !0))
5271
5268
  });
5272
5269
  }
5273
5270
  as(e) {
@@ -5276,7 +5273,7 @@ const N = class N {
5276
5273
  clearSelect() {
5277
5274
  return new N({
5278
5275
  ...i(this, _),
5279
- queryNode: T.cloneWithoutSelections(i(this, _).queryNode)
5276
+ queryNode: x.cloneWithoutSelections(i(this, _).queryNode)
5280
5277
  });
5281
5278
  }
5282
5279
  clearWhere() {
@@ -5288,25 +5285,25 @@ const N = class N {
5288
5285
  clearLimit() {
5289
5286
  return new N({
5290
5287
  ...i(this, _),
5291
- queryNode: T.cloneWithoutLimit(i(this, _).queryNode)
5288
+ queryNode: x.cloneWithoutLimit(i(this, _).queryNode)
5292
5289
  });
5293
5290
  }
5294
5291
  clearOffset() {
5295
5292
  return new N({
5296
5293
  ...i(this, _),
5297
- queryNode: T.cloneWithoutOffset(i(this, _).queryNode)
5294
+ queryNode: x.cloneWithoutOffset(i(this, _).queryNode)
5298
5295
  });
5299
5296
  }
5300
5297
  clearOrderBy() {
5301
5298
  return new N({
5302
5299
  ...i(this, _),
5303
- queryNode: T.cloneWithoutOrderBy(i(this, _).queryNode)
5300
+ queryNode: x.cloneWithoutOrderBy(i(this, _).queryNode)
5304
5301
  });
5305
5302
  }
5306
5303
  clearGroupBy() {
5307
5304
  return new N({
5308
5305
  ...i(this, _),
5309
- queryNode: T.cloneWithoutGroupBy(i(this, _).queryNode)
5306
+ queryNode: x.cloneWithoutGroupBy(i(this, _).queryNode)
5310
5307
  });
5311
5308
  }
5312
5309
  $call(e) {
@@ -5327,7 +5324,7 @@ const N = class N {
5327
5324
  return new N(i(this, _));
5328
5325
  }
5329
5326
  $asTuple() {
5330
- return new x(this.toOperationNode());
5327
+ return new S(this.toOperationNode());
5331
5328
  }
5332
5329
  withPlugin(e) {
5333
5330
  return new N({
@@ -5373,15 +5370,15 @@ Ie(Et, "don't await SelectQueryBuilder instances directly. To execute the query
5373
5370
  function $s(t) {
5374
5371
  return new Et(t);
5375
5372
  }
5376
- var Be, Ke;
5373
+ var We, Ke;
5377
5374
  class lr {
5378
5375
  constructor(e, n) {
5379
- C(this, Be);
5376
+ C(this, We);
5380
5377
  C(this, Ke);
5381
- O(this, Be, e), O(this, Ke, n);
5378
+ O(this, We, e), O(this, Ke, n);
5382
5379
  }
5383
5380
  get expression() {
5384
- return i(this, Be);
5381
+ return i(this, We);
5385
5382
  }
5386
5383
  get alias() {
5387
5384
  return i(this, Ke);
@@ -5390,10 +5387,10 @@ class lr {
5390
5387
  return !0;
5391
5388
  }
5392
5389
  toOperationNode() {
5393
- return fe.create(i(this, Be).toOperationNode(), z.create(i(this, Ke)));
5390
+ return fe.create(i(this, We).toOperationNode(), z.create(i(this, Ke)));
5394
5391
  }
5395
5392
  }
5396
- Be = new WeakMap(), Ke = new WeakMap();
5393
+ We = new WeakMap(), Ke = new WeakMap();
5397
5394
  Ie(lr, "don't await AliasedSelectQueryBuilder instances directly. AliasedSelectQueryBuilder should never be executed directly since it's always a part of another query.");
5398
5395
  const ye = s({
5399
5396
  is(t) {
@@ -5632,8 +5629,8 @@ const se = class se {
5632
5629
  }
5633
5630
  };
5634
5631
  A = new WeakMap();
5635
- let qe = se;
5636
- Ie(qe, "don't await AggregateFunctionBuilder instances. They are never executed directly and are always just a part of a query.");
5632
+ let je = se;
5633
+ Ie(je, "don't await AggregateFunctionBuilder instances. They are never executed directly and are always just a part of a query.");
5637
5634
  var Ue, Qe;
5638
5635
  class Ds {
5639
5636
  constructor(e, n) {
@@ -5655,7 +5652,7 @@ class Ds {
5655
5652
  }
5656
5653
  Ue = new WeakMap(), Qe = new WeakMap();
5657
5654
  function Rs() {
5658
- const t = (n, r) => new x(Fn.create(n, _t(r ?? []))), e = (n, r) => new qe({
5655
+ const t = (n, r) => new S(Fn.create(n, _t(r ?? []))), e = (n, r) => new je({
5659
5656
  aggregateFunctionNode: ye.create(n, r ? _t(r) : void 0)
5660
5657
  });
5661
5658
  return Object.assign(t, {
@@ -5670,7 +5667,7 @@ function Rs() {
5670
5667
  return e("count", [n]);
5671
5668
  },
5672
5669
  countAll(n) {
5673
- return new qe({
5670
+ return new je({
5674
5671
  aggregateFunctionNode: ye.create("count", ar(n))
5675
5672
  });
5676
5673
  },
@@ -5687,15 +5684,15 @@ function Rs() {
5687
5684
  return t("any", [n]);
5688
5685
  },
5689
5686
  jsonAgg(n) {
5690
- return new qe({
5687
+ return new je({
5691
5688
  aggregateFunctionNode: ye.create("json_agg", [
5692
- G(n) ? B(n) : n.toOperationNode()
5689
+ G(n) ? W(n) : n.toOperationNode()
5693
5690
  ])
5694
5691
  });
5695
5692
  },
5696
5693
  toJson(n) {
5697
- return new x(Fn.create("to_json", [
5698
- G(n) ? B(n) : n.toOperationNode()
5694
+ return new S(Fn.create("to_json", [
5695
+ G(n) ? W(n) : n.toOperationNode()
5699
5696
  ]));
5700
5697
  }
5701
5698
  });
@@ -5713,7 +5710,7 @@ const zs = s({
5713
5710
  }
5714
5711
  });
5715
5712
  function Fs(t, e) {
5716
- return zs.create(ke.create(t), q(e));
5713
+ return zs.create(ke.create(t), j(e));
5717
5714
  }
5718
5715
  const ne = s({
5719
5716
  is(t) {
@@ -5748,7 +5745,7 @@ const ne = s({
5748
5745
  }
5749
5746
  });
5750
5747
  var Ve;
5751
- class qs {
5748
+ class js {
5752
5749
  constructor(e) {
5753
5750
  C(this, Ve);
5754
5751
  O(this, Ve, s(e));
@@ -5768,7 +5765,7 @@ class _r {
5768
5765
  O(this, Ge, s(e));
5769
5766
  }
5770
5767
  then(e) {
5771
- return new js({
5768
+ return new qs({
5772
5769
  ...i(this, Ge),
5773
5770
  node: ne.cloneWithThen(i(this, Ge).node, hn(e) ? fn(e) : $(e))
5774
5771
  });
@@ -5776,7 +5773,7 @@ class _r {
5776
5773
  }
5777
5774
  Ge = new WeakMap();
5778
5775
  var Q;
5779
- class js {
5776
+ class qs {
5780
5777
  constructor(e) {
5781
5778
  C(this, Q);
5782
5779
  O(this, Q, s(e));
@@ -5796,10 +5793,10 @@ class js {
5796
5793
  });
5797
5794
  }
5798
5795
  end() {
5799
- return new x(ne.cloneWith(i(this, Q).node, { isStatement: !1 }));
5796
+ return new S(ne.cloneWith(i(this, Q).node, { isStatement: !1 }));
5800
5797
  }
5801
5798
  endCase() {
5802
- return new x(ne.cloneWith(i(this, Q).node, { isStatement: !0 }));
5799
+ return new S(ne.cloneWith(i(this, Q).node, { isStatement: !0 }));
5803
5800
  }
5804
5801
  }
5805
5802
  Q = new WeakMap();
@@ -5810,14 +5807,14 @@ class Ls {
5810
5807
  O(this, Ye, s(e));
5811
5808
  }
5812
5809
  end() {
5813
- return new x(ne.cloneWith(i(this, Ye).node, { isStatement: !1 }));
5810
+ return new S(ne.cloneWith(i(this, Ye).node, { isStatement: !1 }));
5814
5811
  }
5815
5812
  endCase() {
5816
- return new x(ne.cloneWith(i(this, Ye).node, { isStatement: !0 }));
5813
+ return new S(ne.cloneWith(i(this, Ye).node, { isStatement: !0 }));
5817
5814
  }
5818
5815
  }
5819
5816
  Ye = new WeakMap();
5820
- const qn = s({
5817
+ const jn = s({
5821
5818
  is(t) {
5822
5819
  return t.kind === "JSONPathLegNode";
5823
5820
  },
@@ -5957,14 +5954,14 @@ class ut {
5957
5954
  }
5958
5955
  }
5959
5956
  V = new WeakMap(), yt = new WeakSet(), an = function(e, n) {
5960
- return Tt.is(i(this, V)) ? new jn(Tt.cloneWithTraversal(i(this, V), it.is(i(this, V).traversal) ? it.cloneWithLeg(i(this, V).traversal, qn.create(e, n)) : er.cloneWithValue(i(this, V).traversal, he.createImmediate(n)))) : new jn(it.cloneWithLeg(i(this, V), qn.create(e, n)));
5957
+ return xt.is(i(this, V)) ? new qn(xt.cloneWithTraversal(i(this, V), it.is(i(this, V).traversal) ? it.cloneWithLeg(i(this, V).traversal, jn.create(e, n)) : er.cloneWithValue(i(this, V).traversal, he.createImmediate(n)))) : new qn(it.cloneWithLeg(i(this, V), jn.create(e, n)));
5961
5958
  };
5962
- var Te;
5963
- class jn extends ut {
5959
+ var xe;
5960
+ class qn extends ut {
5964
5961
  constructor(n) {
5965
5962
  super(n);
5966
- C(this, Te);
5967
- O(this, Te, n);
5963
+ C(this, xe);
5964
+ O(this, xe, n);
5968
5965
  }
5969
5966
  /** @private */
5970
5967
  get expressionType() {
@@ -5979,22 +5976,22 @@ class jn extends ut {
5979
5976
  * returns a copy of this `JSONPathBuilder` with a new output type.
5980
5977
  */
5981
5978
  $castTo() {
5982
- return new ut(i(this, Te));
5979
+ return new ut(i(this, xe));
5983
5980
  }
5984
5981
  $notNull() {
5985
- return new ut(i(this, Te));
5982
+ return new ut(i(this, xe));
5986
5983
  }
5987
5984
  toOperationNode() {
5988
- return i(this, Te);
5985
+ return i(this, xe);
5989
5986
  }
5990
5987
  }
5991
- Te = new WeakMap();
5992
- var He, de;
5988
+ xe = new WeakMap();
5989
+ var He, ce;
5993
5990
  class Js {
5994
5991
  constructor(e, n) {
5995
5992
  C(this, He);
5996
- C(this, de);
5997
- O(this, He, e), O(this, de, n);
5993
+ C(this, ce);
5994
+ O(this, He, e), O(this, ce, n);
5998
5995
  }
5999
5996
  /** @private */
6000
5997
  get expression() {
@@ -6002,13 +5999,13 @@ class Js {
6002
5999
  }
6003
6000
  /** @private */
6004
6001
  get alias() {
6005
- return i(this, de);
6002
+ return i(this, ce);
6006
6003
  }
6007
6004
  toOperationNode() {
6008
- return fe.create(i(this, He).toOperationNode(), J(i(this, de)) ? i(this, de).toOperationNode() : z.create(i(this, de)));
6005
+ return fe.create(i(this, He).toOperationNode(), J(i(this, ce)) ? i(this, ce).toOperationNode() : z.create(i(this, ce)));
6009
6006
  }
6010
6007
  }
6011
- He = new WeakMap(), de = new WeakMap();
6008
+ He = new WeakMap(), ce = new WeakMap();
6012
6009
  const Ln = s({
6013
6010
  is(t) {
6014
6011
  return t.kind === "TupleNode";
@@ -6051,7 +6048,7 @@ const Ln = s({
6051
6048
  "jsonb",
6052
6049
  "blob",
6053
6050
  "varbinary"
6054
- ], Ws = [
6051
+ ], Bs = [
6055
6052
  /^varchar\(\d+\)$/,
6056
6053
  /^char\(\d+\)$/,
6057
6054
  /^decimal\(\d+, \d+\)$/,
@@ -6063,7 +6060,7 @@ const Ln = s({
6063
6060
  /^timestamp\(\d+\)$/,
6064
6061
  /^timestamptz\(\d+\)$/,
6065
6062
  /^varbinary\(\d+\)$/
6066
- ], Bs = s({
6063
+ ], Ws = s({
6067
6064
  is(t) {
6068
6065
  return t.kind === "DataTypeNode";
6069
6066
  },
@@ -6075,13 +6072,13 @@ const Ln = s({
6075
6072
  }
6076
6073
  });
6077
6074
  function Ks(t) {
6078
- return !!(Ms.includes(t) || Ws.some((e) => e.test(t)));
6075
+ return !!(Ms.includes(t) || Bs.some((e) => e.test(t)));
6079
6076
  }
6080
6077
  function Us(t) {
6081
6078
  if (J(t))
6082
6079
  return t.toOperationNode();
6083
6080
  if (Ks(t))
6084
- return Bs.create(t);
6081
+ return Ws.create(t);
6085
6082
  throw new Error(`invalid column data type ${JSON.stringify(t)}`);
6086
6083
  }
6087
6084
  const Qs = s({
@@ -6096,12 +6093,12 @@ const Qs = s({
6096
6093
  });
6097
6094
  }
6098
6095
  });
6099
- function yn(t = cr) {
6096
+ function yn(t = dr) {
6100
6097
  function e(a, o, u) {
6101
- return new x(pn(a, o, u));
6098
+ return new S(pn(a, o, u));
6102
6099
  }
6103
6100
  function n(a, o) {
6104
- return new x(Fs(a, o));
6101
+ return new S(Fs(a, o));
6105
6102
  }
6106
6103
  const r = Object.assign(e, {
6107
6104
  fn: void 0,
@@ -6110,34 +6107,34 @@ function yn(t = cr) {
6110
6107
  return $s({
6111
6108
  queryId: H(),
6112
6109
  executor: t,
6113
- queryNode: T.createFrom(Vs(a))
6110
+ queryNode: x.createFrom(Vs(a))
6114
6111
  });
6115
6112
  },
6116
6113
  case(a) {
6117
- return new qs({
6118
- node: ne.create(Ot(a) ? void 0 : q(a))
6114
+ return new js({
6115
+ node: ne.create(Ot(a) ? void 0 : j(a))
6119
6116
  });
6120
6117
  },
6121
6118
  ref(a, o) {
6122
- return Ot(o) ? new x(me(a)) : new ut(Bi(a, o));
6119
+ return Ot(o) ? new S(me(a)) : new ut(Wi(a, o));
6123
6120
  },
6124
6121
  jsonPath() {
6125
6122
  return new ut(it.create());
6126
6123
  },
6127
6124
  table(a) {
6128
- return new x(B(a));
6125
+ return new S(W(a));
6129
6126
  },
6130
6127
  val(a) {
6131
- return new x($(a));
6128
+ return new S($(a));
6132
6129
  },
6133
6130
  refTuple(...a) {
6134
- return new x(Ln.create(a.map(q)));
6131
+ return new S(Ln.create(a.map(j)));
6135
6132
  },
6136
6133
  tuple(...a) {
6137
- return new x(Ln.create(a.map($)));
6134
+ return new S(Ln.create(a.map($)));
6138
6135
  },
6139
6136
  lit(a) {
6140
- return new x(fn(a));
6137
+ return new S(fn(a));
6141
6138
  },
6142
6139
  unary: n,
6143
6140
  not(a) {
@@ -6150,26 +6147,26 @@ function yn(t = cr) {
6150
6147
  return n("-", a);
6151
6148
  },
6152
6149
  between(a, o, u) {
6153
- return new x(Xe.create(q(a), ke.create("between"), _e.create($(o), $(u))));
6150
+ return new S(Xe.create(j(a), ke.create("between"), _e.create($(o), $(u))));
6154
6151
  },
6155
6152
  betweenSymmetric(a, o, u) {
6156
- return new x(Xe.create(q(a), ke.create("between symmetric"), _e.create($(o), $(u))));
6153
+ return new S(Xe.create(j(a), ke.create("between symmetric"), _e.create($(o), $(u))));
6157
6154
  },
6158
6155
  and(a) {
6159
- return le(a) ? new x(Ht(a, "and")) : new x(On(a, "and"));
6156
+ return le(a) ? new S(Ht(a, "and")) : new S(On(a, "and"));
6160
6157
  },
6161
6158
  or(a) {
6162
- return le(a) ? new x(Ht(a, "or")) : new x(On(a, "or"));
6159
+ return le(a) ? new S(Ht(a, "or")) : new S(On(a, "or"));
6163
6160
  },
6164
6161
  parens(...a) {
6165
6162
  const o = K(a);
6166
- return mt.is(o) ? new x(o) : new x(mt.create(o));
6163
+ return mt.is(o) ? new S(o) : new S(mt.create(o));
6167
6164
  },
6168
6165
  cast(a, o) {
6169
- return new x(Qs.create(q(a), Us(o)));
6166
+ return new S(Qs.create(j(a), Us(o)));
6170
6167
  },
6171
6168
  withSchema(a) {
6172
- return yn(t.withPluginAtFront(new dr(a)));
6169
+ return yn(t.withPluginAtFront(new cr(a)));
6173
6170
  }
6174
6171
  });
6175
6172
  return r.fn = Rs(), r.eb = r, r;
@@ -6191,7 +6188,7 @@ function mr(t) {
6191
6188
  return t(Jt()).toOperationNode();
6192
6189
  throw new Error(`invalid aliased expression: ${JSON.stringify(t)}`);
6193
6190
  }
6194
- function Wt(t) {
6191
+ function Bt(t) {
6195
6192
  return $i(t) || Di(t) || Ee(t);
6196
6193
  }
6197
6194
  function Vs(t) {
@@ -6204,25 +6201,25 @@ function Gs(t) {
6204
6201
  const e = " as ";
6205
6202
  if (t.includes(e)) {
6206
6203
  const [n, r] = t.split(e).map(hr);
6207
- return fe.create(B(n), z.create(r));
6204
+ return fe.create(W(n), z.create(r));
6208
6205
  } else
6209
- return B(t);
6206
+ return W(t);
6210
6207
  }
6211
- function B(t) {
6208
+ function W(t) {
6212
6209
  const e = ".";
6213
6210
  if (t.includes(e)) {
6214
6211
  const [n, r] = t.split(e).map(hr);
6215
- return xe.createWithSchema(n, r);
6212
+ return Se.createWithSchema(n, r);
6216
6213
  } else
6217
- return xe.create(t);
6214
+ return Se.create(t);
6218
6215
  }
6219
6216
  function hr(t) {
6220
6217
  return t.trim();
6221
6218
  }
6222
- var P, j, Ct, on, sn;
6223
- const ct = class ct {
6219
+ var P, q, Ct, on, sn;
6220
+ const dt = class dt {
6224
6221
  constructor(e) {
6225
- C(this, j);
6222
+ C(this, q);
6226
6223
  C(this, P);
6227
6224
  O(this, P, s(e));
6228
6225
  }
@@ -6235,62 +6232,62 @@ const ct = class ct {
6235
6232
  return new fr(this, e);
6236
6233
  }
6237
6234
  $castTo() {
6238
- return new ct({ ...i(this, P) });
6235
+ return new dt({ ...i(this, P) });
6239
6236
  }
6240
6237
  $notNull() {
6241
- return new ct(i(this, P));
6238
+ return new dt(i(this, P));
6242
6239
  }
6243
6240
  withPlugin(e) {
6244
- return new ct({
6241
+ return new dt({
6245
6242
  ...i(this, P),
6246
6243
  plugins: i(this, P).plugins !== void 0 ? s([...i(this, P).plugins, e]) : s([e])
6247
6244
  });
6248
6245
  }
6249
6246
  toOperationNode() {
6250
- return w(this, j, on).call(this, w(this, j, Ct).call(this));
6247
+ return w(this, q, on).call(this, w(this, q, Ct).call(this));
6251
6248
  }
6252
6249
  compile(e) {
6253
- return w(this, j, sn).call(this, w(this, j, Ct).call(this, e));
6250
+ return w(this, q, sn).call(this, w(this, q, Ct).call(this, e));
6254
6251
  }
6255
6252
  async execute(e) {
6256
- const n = w(this, j, Ct).call(this, e);
6257
- return n.executeQuery(w(this, j, sn).call(this, n), i(this, P).queryId);
6253
+ const n = w(this, q, Ct).call(this, e);
6254
+ return n.executeQuery(w(this, q, sn).call(this, n), i(this, P).queryId);
6258
6255
  }
6259
6256
  };
6260
- P = new WeakMap(), j = new WeakSet(), Ct = function(e) {
6261
- const n = e !== void 0 ? e.getExecutor() : cr;
6257
+ P = new WeakMap(), q = new WeakSet(), Ct = function(e) {
6258
+ const n = e !== void 0 ? e.getExecutor() : dr;
6262
6259
  return i(this, P).plugins !== void 0 ? n.withPlugins(i(this, P).plugins) : n;
6263
6260
  }, on = function(e) {
6264
6261
  return e.transformQuery(i(this, P).rawNode, i(this, P).queryId);
6265
6262
  }, sn = function(e) {
6266
- return e.compileQuery(w(this, j, on).call(this, e), i(this, P).queryId);
6263
+ return e.compileQuery(w(this, q, on).call(this, e), i(this, P).queryId);
6267
6264
  };
6268
- let At = ct;
6265
+ let At = dt;
6269
6266
  function ie(t) {
6270
6267
  return new At(t);
6271
6268
  }
6272
6269
  Ie(At, "don't await RawBuilder instances directly. To execute the query you need to call `execute`");
6273
- var Se, ce;
6270
+ var Te, de;
6274
6271
  class fr {
6275
6272
  constructor(e, n) {
6276
- C(this, Se);
6277
- C(this, ce);
6278
- O(this, Se, e), O(this, ce, n);
6273
+ C(this, Te);
6274
+ C(this, de);
6275
+ O(this, Te, e), O(this, de, n);
6279
6276
  }
6280
6277
  get expression() {
6281
- return i(this, Se);
6278
+ return i(this, Te);
6282
6279
  }
6283
6280
  get alias() {
6284
- return i(this, ce);
6281
+ return i(this, de);
6285
6282
  }
6286
6283
  get rawBuilder() {
6287
- return i(this, Se);
6284
+ return i(this, Te);
6288
6285
  }
6289
6286
  toOperationNode() {
6290
- return fe.create(i(this, Se).toOperationNode(), J(i(this, ce)) ? i(this, ce).toOperationNode() : z.create(i(this, ce)));
6287
+ return fe.create(i(this, Te).toOperationNode(), J(i(this, de)) ? i(this, de).toOperationNode() : z.create(i(this, de)));
6291
6288
  }
6292
6289
  }
6293
- Se = new WeakMap(), ce = new WeakMap();
6290
+ Te = new WeakMap(), de = new WeakMap();
6294
6291
  Ie(fr, "don't await AliasedRawBuilder instances directly. AliasedRawBuilder should never be executed directly since it's always a part of another query.");
6295
6292
  const g = Object.assign((t, ...e) => ie({
6296
6293
  queryId: H(),
@@ -6314,7 +6311,7 @@ const g = Object.assign((t, ...e) => ie({
6314
6311
  table(t) {
6315
6312
  return ie({
6316
6313
  queryId: H(),
6317
- rawNode: R.createWithChild(B(t))
6314
+ rawNode: R.createWithChild(W(t))
6318
6315
  });
6319
6316
  },
6320
6317
  id(...t) {
@@ -6361,7 +6358,7 @@ class Ys {
6361
6358
  }
6362
6359
  }
6363
6360
  const Hs = "kysely_migration", Mn = "kysely_migration_lock", Xs = !1, Qt = "migration_lock", Zs = s({ __noMigrations__: !0 });
6364
- var k, m, rt, X, Z, De, gr, ee, yr, wr, Nr, vr, Cr, un, Re, dn, br, Or, Tr, cn, Sr, xr, kr, Er, Ir, at;
6361
+ var k, m, rt, X, Z, De, gr, ee, yr, wr, Nr, vr, Cr, un, Re, cn, br, Or, xr, dn, Tr, Sr, kr, Er, Ir, at;
6365
6362
  class pr {
6366
6363
  constructor(e) {
6367
6364
  C(this, m);
@@ -6375,7 +6372,7 @@ class pr {
6375
6372
  */
6376
6373
  async getMigrations() {
6377
6374
  const e = await w(this, m, Re).call(this, i(this, m, Z)) ? await i(this, k).db.withPlugin(i(this, m, ee)).selectFrom(i(this, m, Z)).select(["name", "timestamp"]).execute() : [];
6378
- return (await w(this, m, cn).call(this)).map(({ name: r, ...a }) => {
6375
+ return (await w(this, m, dn).call(this)).map(({ name: r, ...a }) => {
6379
6376
  const o = e.find((u) => u.name === r);
6380
6377
  return {
6381
6378
  name: r,
@@ -6461,9 +6458,9 @@ class pr {
6461
6458
  return w(this, m, rt).call(this, ({ migrations: n, executedMigrations: r, pendingMigrations: a }) => {
6462
6459
  if (e === Zs)
6463
6460
  return { direction: "Down", step: 1 / 0 };
6464
- if (!n.find((d) => d.name === e))
6461
+ if (!n.find((c) => c.name === e))
6465
6462
  throw new Error(`migration "${e}" doesn't exist`);
6466
- const o = r.indexOf(e), u = a.findIndex((d) => d.name === e);
6463
+ const o = r.indexOf(e), u = a.findIndex((c) => c.name === e);
6467
6464
  if (o !== -1)
6468
6465
  return {
6469
6466
  direction: "Down",
@@ -6524,7 +6521,7 @@ k = new WeakMap(), m = new WeakSet(), rt = async function(e) {
6524
6521
  }, gr = function() {
6525
6522
  return i(this, k).allowUnorderedMigrations ?? Xs;
6526
6523
  }, ee = function() {
6527
- return i(this, m, X) ? new dr(i(this, m, X)) : new Ys();
6524
+ return i(this, m, X) ? new cr(i(this, m, X)) : new Ys();
6528
6525
  }, yr = async function() {
6529
6526
  await w(this, m, wr).call(this), await w(this, m, Nr).call(this), await w(this, m, vr).call(this), await w(this, m, Cr).call(this);
6530
6527
  }, wr = async function() {
@@ -6552,11 +6549,11 @@ k = new WeakMap(), m = new WeakSet(), rt = async function(e) {
6552
6549
  throw e;
6553
6550
  }
6554
6551
  }, Cr = async function() {
6555
- if (!await w(this, m, dn).call(this))
6552
+ if (!await w(this, m, cn).call(this))
6556
6553
  try {
6557
6554
  await i(this, k).db.withPlugin(i(this, m, ee)).insertInto(i(this, m, De)).values({ id: Qt, is_locked: 0 }).execute();
6558
6555
  } catch (e) {
6559
- if (!await w(this, m, dn).call(this))
6556
+ if (!await w(this, m, cn).call(this))
6560
6557
  throw e;
6561
6558
  }
6562
6559
  }, un = async function() {
@@ -6566,7 +6563,7 @@ k = new WeakMap(), m = new WeakSet(), rt = async function(e) {
6566
6563
  return (await i(this, k).db.introspection.getTables({
6567
6564
  withInternalKyselyTables: !0
6568
6565
  })).some((a) => a.name === e && (!n || a.schema === n));
6569
- }, dn = async function() {
6566
+ }, cn = async function() {
6570
6567
  return !!await i(this, k).db.withPlugin(i(this, m, ee)).selectFrom(i(this, m, De)).where("id", "=", Qt).select("id").executeTakeFirst();
6571
6568
  }, br = async function(e) {
6572
6569
  const n = i(this, k).db.getExecutor().adapter, r = s({
@@ -6579,34 +6576,34 @@ k = new WeakMap(), m = new WeakSet(), rt = async function(e) {
6579
6576
  const u = await w(this, m, Or).call(this, o);
6580
6577
  if (u.migrations.length === 0)
6581
6578
  return { results: [] };
6582
- const { direction: d, step: c } = e(u);
6583
- return c <= 0 ? { results: [] } : d === "Down" ? await w(this, m, Er).call(this, o, u, c) : d === "Up" ? await w(this, m, Ir).call(this, o, u, c) : { results: [] };
6579
+ const { direction: c, step: d } = e(u);
6580
+ return d <= 0 ? { results: [] } : c === "Down" ? await w(this, m, Er).call(this, o, u, d) : c === "Up" ? await w(this, m, Ir).call(this, o, u, d) : { results: [] };
6584
6581
  } finally {
6585
6582
  await n.releaseMigrationLock(o, r);
6586
6583
  }
6587
6584
  };
6588
6585
  return n.supportsTransactionalDdl ? i(this, k).db.transaction().execute(a) : i(this, k).db.connection().execute(a);
6589
6586
  }, Or = async function(e) {
6590
- const n = await w(this, m, cn).call(this), r = await w(this, m, Sr).call(this, e);
6591
- w(this, m, xr).call(this, n, r), i(this, m, gr) || w(this, m, kr).call(this, n, r);
6592
- const a = w(this, m, Tr).call(this, n, r);
6587
+ const n = await w(this, m, dn).call(this), r = await w(this, m, Tr).call(this, e);
6588
+ w(this, m, Sr).call(this, n, r), i(this, m, gr) || w(this, m, kr).call(this, n, r);
6589
+ const a = w(this, m, xr).call(this, n, r);
6593
6590
  return s({
6594
6591
  migrations: n,
6595
6592
  executedMigrations: r,
6596
6593
  lastMigration: Pi(r),
6597
6594
  pendingMigrations: a
6598
6595
  });
6599
- }, Tr = function(e, n) {
6596
+ }, xr = function(e, n) {
6600
6597
  return e.filter((r) => !n.includes(r.name));
6601
- }, cn = async function() {
6598
+ }, dn = async function() {
6602
6599
  const e = await i(this, k).provider.getMigrations();
6603
6600
  return Object.keys(e).sort().map((n) => ({
6604
6601
  ...e[n],
6605
6602
  name: n
6606
6603
  }));
6607
- }, Sr = async function(e) {
6604
+ }, Tr = async function(e) {
6608
6605
  return (await e.withPlugin(i(this, m, ee)).selectFrom(i(this, m, Z)).select("name").orderBy(["timestamp", "name"]).execute()).map((r) => r.name);
6609
- }, xr = function(e, n) {
6606
+ }, Sr = function(e, n) {
6610
6607
  for (const r of n)
6611
6608
  if (!e.some((a) => a.name === r))
6612
6609
  throw new Error(`corrupted migrations: previously executed migration ${r} is missing`);
@@ -6615,26 +6612,26 @@ k = new WeakMap(), m = new WeakSet(), rt = async function(e) {
6615
6612
  if (e[r].name !== n[r])
6616
6613
  throw new Error(`corrupted migrations: expected previously executed migration ${n[r]} to be at index ${r} but ${e[r].name} was found in its place. New migrations must always have a name that comes alphabetically after the last executed migration.`);
6617
6614
  }, Er = async function(e, n, r) {
6618
- const a = n.executedMigrations.slice().reverse().slice(0, r).map((u) => n.migrations.find((d) => d.name === u)), o = a.map((u) => ({
6615
+ const a = n.executedMigrations.slice().reverse().slice(0, r).map((u) => n.migrations.find((c) => c.name === u)), o = a.map((u) => ({
6619
6616
  migrationName: u.name,
6620
6617
  direction: "Down",
6621
6618
  status: "NotExecuted"
6622
6619
  }));
6623
6620
  for (let u = 0; u < o.length; ++u) {
6624
- const d = a[u];
6621
+ const c = a[u];
6625
6622
  try {
6626
- d.down && (await d.down(e), await e.withPlugin(i(this, m, ee)).deleteFrom(i(this, m, Z)).where("name", "=", d.name).execute(), o[u] = {
6627
- migrationName: d.name,
6623
+ c.down && (await c.down(e), await e.withPlugin(i(this, m, ee)).deleteFrom(i(this, m, Z)).where("name", "=", c.name).execute(), o[u] = {
6624
+ migrationName: c.name,
6628
6625
  direction: "Down",
6629
6626
  status: "Success"
6630
6627
  });
6631
- } catch (c) {
6628
+ } catch (d) {
6632
6629
  throw o[u] = {
6633
- migrationName: d.name,
6630
+ migrationName: c.name,
6634
6631
  direction: "Down",
6635
6632
  status: "Error"
6636
6633
  }, new Vt({
6637
- error: c,
6634
+ error: d,
6638
6635
  results: o
6639
6636
  });
6640
6637
  }
@@ -6647,23 +6644,23 @@ k = new WeakMap(), m = new WeakSet(), rt = async function(e) {
6647
6644
  status: "NotExecuted"
6648
6645
  }));
6649
6646
  for (let u = 0; u < o.length; u++) {
6650
- const d = n.pendingMigrations[u];
6647
+ const c = n.pendingMigrations[u];
6651
6648
  try {
6652
- await d.up(e), await e.withPlugin(i(this, m, ee)).insertInto(i(this, m, Z)).values({
6653
- name: d.name,
6649
+ await c.up(e), await e.withPlugin(i(this, m, ee)).insertInto(i(this, m, Z)).values({
6650
+ name: c.name,
6654
6651
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
6655
6652
  }).execute(), o[u] = {
6656
- migrationName: d.name,
6653
+ migrationName: c.name,
6657
6654
  direction: "Up",
6658
6655
  status: "Success"
6659
6656
  };
6660
- } catch (c) {
6657
+ } catch (d) {
6661
6658
  throw o[u] = {
6662
- migrationName: d.name,
6659
+ migrationName: c.name,
6663
6660
  direction: "Up",
6664
6661
  status: "Error"
6665
6662
  }, new Vt({
6666
- error: c,
6663
+ error: d,
6667
6664
  results: o
6668
6665
  });
6669
6666
  }
@@ -6793,7 +6790,7 @@ const uu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6793
6790
  down: su,
6794
6791
  up: iu
6795
6792
  }, Symbol.toStringTag, { value: "Module" }));
6796
- async function du(t) {
6793
+ async function cu(t) {
6797
6794
  await t.schema.createTable("logs").addColumn("id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("category", "varchar(255)", (e) => e.notNull()).addColumn("tenant_id", "varchar(64)").addColumn("user_id", "varchar(64)").addForeignKeyConstraint(
6798
6795
  "tenant_id_constraint",
6799
6796
  ["tenant_id"],
@@ -6802,13 +6799,13 @@ async function du(t) {
6802
6799
  (e) => e.onDelete("cascade")
6803
6800
  ).addColumn("ip", "varchar(255)").addColumn("type", "varchar(8)", (e) => e.notNull()).addColumn("date", "varchar(25)", (e) => e.notNull()).addColumn("client_id", "varchar(255)").addColumn("client_name", "varchar(255)").addColumn("user_agent", "varchar(255)").addColumn("description", "varchar(255)").addColumn("details", "varchar(2048)").execute();
6804
6801
  }
6805
- async function cu(t) {
6802
+ async function du(t) {
6806
6803
  await t.schema.dropTable("logs").execute();
6807
6804
  }
6808
6805
  const lu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6809
6806
  __proto__: null,
6810
- down: cu,
6811
- up: du
6807
+ down: du,
6808
+ up: cu
6812
6809
  }, Symbol.toStringTag, { value: "Module" }));
6813
6810
  async function _u(t) {
6814
6811
  }
@@ -6892,22 +6889,22 @@ async function Ou(t) {
6892
6889
  (e) => e.notNull()
6893
6890
  ).execute();
6894
6891
  }
6895
- async function Tu(t) {
6892
+ async function xu(t) {
6896
6893
  await t.schema.alterTable("passwords").dropColumn("password").execute();
6897
6894
  }
6898
- const Su = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6895
+ const Tu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6899
6896
  __proto__: null,
6900
- down: Tu,
6897
+ down: xu,
6901
6898
  up: Ou
6902
6899
  }, Symbol.toStringTag, { value: "Module" }));
6903
- async function xu(t) {
6900
+ async function Su(t) {
6904
6901
  }
6905
6902
  async function ku(t) {
6906
6903
  }
6907
6904
  const Eu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6908
6905
  __proto__: null,
6909
6906
  down: ku,
6910
- up: xu
6907
+ up: Su
6911
6908
  }, Symbol.toStringTag, { value: "Module" }));
6912
6909
  async function Iu(t) {
6913
6910
  }
@@ -6933,12 +6930,12 @@ async function zu(t) {
6933
6930
  async function Fu(t) {
6934
6931
  await t.schema.dropIndex("users_email_index").execute();
6935
6932
  }
6936
- const qu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6933
+ const ju = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6937
6934
  __proto__: null,
6938
6935
  down: Fu,
6939
6936
  up: zu
6940
6937
  }, Symbol.toStringTag, { value: "Module" }));
6941
- async function ju(t) {
6938
+ async function qu(t) {
6942
6939
  await t.schema.alterTable("users").addColumn("profileData", "varchar(2048)").execute();
6943
6940
  }
6944
6941
  async function Lu(t) {
@@ -6947,17 +6944,17 @@ async function Lu(t) {
6947
6944
  const Ju = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6948
6945
  __proto__: null,
6949
6946
  down: Lu,
6950
- up: ju
6947
+ up: qu
6951
6948
  }, Symbol.toStringTag, { value: "Module" }));
6952
6949
  async function Mu(t) {
6953
6950
  await t.schema.createIndex("users_linked_to_index").on("users").column("linked_to").execute();
6954
6951
  }
6955
- async function Wu(t) {
6952
+ async function Bu(t) {
6956
6953
  await t.schema.dropIndex("users_linked_to_index");
6957
6954
  }
6958
- const Bu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6955
+ const Wu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6959
6956
  __proto__: null,
6960
- down: Wu,
6957
+ down: Bu,
6961
6958
  up: Mu
6962
6959
  }, Symbol.toStringTag, { value: "Module" }));
6963
6960
  async function Ku(t) {
@@ -7003,185 +7000,185 @@ const Zu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7003
7000
  down: Xu,
7004
7001
  up: Hu
7005
7002
  }, Symbol.toStringTag, { value: "Module" }));
7006
- async function ed(t) {
7003
+ async function ec(t) {
7007
7004
  }
7008
- async function td(t) {
7005
+ async function tc(t) {
7009
7006
  }
7010
- const nd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7007
+ const nc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7011
7008
  __proto__: null,
7012
- down: td,
7013
- up: ed
7009
+ down: tc,
7010
+ up: ec
7014
7011
  }, Symbol.toStringTag, { value: "Module" }));
7015
- async function rd(t) {
7012
+ async function rc(t) {
7016
7013
  await t.schema.alterTable("otps").addColumn("audience", "varchar(255)").execute();
7017
7014
  }
7018
- async function ad(t) {
7015
+ async function ac(t) {
7019
7016
  await t.schema.alterTable("otps").dropColumn("audience").execute();
7020
7017
  }
7021
- const od = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7018
+ const oc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7022
7019
  __proto__: null,
7023
- down: ad,
7024
- up: rd
7020
+ down: ac,
7021
+ up: rc
7025
7022
  }, Symbol.toStringTag, { value: "Module" }));
7026
- async function id(t) {
7023
+ async function ic(t) {
7027
7024
  }
7028
- async function sd(t) {
7025
+ async function sc(t) {
7029
7026
  }
7030
- const ud = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7027
+ const uc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7031
7028
  __proto__: null,
7032
- down: sd,
7033
- up: id
7029
+ down: sc,
7030
+ up: ic
7034
7031
  }, Symbol.toStringTag, { value: "Module" }));
7035
- async function dd(t) {
7032
+ async function cc(t) {
7036
7033
  await t.schema.alterTable("logs").dropColumn("category").execute();
7037
7034
  }
7038
- async function cd(t) {
7035
+ async function dc(t) {
7039
7036
  await t.schema.alterTable("logs").addColumn("category", "varchar(255)", (e) => e.notNull()).execute();
7040
7037
  }
7041
- const ld = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7038
+ const lc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7042
7039
  __proto__: null,
7043
- down: cd,
7044
- up: dd
7040
+ down: dc,
7041
+ up: cc
7045
7042
  }, Symbol.toStringTag, { value: "Module" }));
7046
- async function _d(t) {
7043
+ async function _c(t) {
7047
7044
  await t.schema.alterTable("users").dropColumn("tags").execute();
7048
7045
  }
7049
- async function md(t) {
7046
+ async function mc(t) {
7050
7047
  await t.schema.alterTable("users").addColumn("tags", "varchar(255)").execute();
7051
7048
  }
7052
- const hd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7049
+ const hc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7053
7050
  __proto__: null,
7054
- down: md,
7055
- up: _d
7051
+ down: mc,
7052
+ up: _c
7056
7053
  }, Symbol.toStringTag, { value: "Module" }));
7057
- async function fd(t) {
7054
+ async function fc(t) {
7058
7055
  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();
7059
7056
  }
7060
- async function pd(t) {
7057
+ async function pc(t) {
7061
7058
  await t.schema.dropIndex("logs_user_id"), await t.schema.dropIndex("logs_tenant_id"), await t.schema.dropIndex("logs_date");
7062
7059
  }
7063
- const gd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7060
+ const gc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7064
7061
  __proto__: null,
7065
- down: pd,
7066
- up: fd
7062
+ down: pc,
7063
+ up: fc
7067
7064
  }, Symbol.toStringTag, { value: "Module" }));
7068
- async function yd(t) {
7065
+ async function yc(t) {
7069
7066
  await t.schema.alterTable("logs").dropColumn("details").execute(), await t.schema.alterTable("logs").addColumn("details", "varchar(8192)").execute();
7070
7067
  }
7071
- async function wd(t) {
7068
+ async function wc(t) {
7072
7069
  await t.schema.alterTable("logs").dropColumn("details").execute(), await t.schema.alterTable("logs").addColumn("details", "varchar(2048)").execute();
7073
7070
  }
7074
- const Nd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7071
+ const Nc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7075
7072
  __proto__: null,
7076
- down: wd,
7077
- up: yd
7073
+ down: wc,
7074
+ up: yc
7078
7075
  }, Symbol.toStringTag, { value: "Module" }));
7079
- async function vd(t) {
7076
+ async function vc(t) {
7080
7077
  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();
7081
7078
  }
7082
- async function Cd(t) {
7079
+ async function Cc(t) {
7083
7080
  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();
7084
7081
  }
7085
- const bd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7082
+ const bc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7086
7083
  __proto__: null,
7087
- down: Cd,
7088
- up: vd
7084
+ down: Cc,
7085
+ up: vc
7089
7086
  }, Symbol.toStringTag, { value: "Module" }));
7090
- async function Od(t) {
7087
+ async function Oc(t) {
7091
7088
  await t.schema.createIndex("users_name_index").on("users").column("name").execute();
7092
7089
  }
7093
- async function Td(t) {
7090
+ async function xc(t) {
7094
7091
  await t.schema.dropIndex("users_name_index").execute();
7095
7092
  }
7096
- const Sd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7093
+ const Tc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7097
7094
  __proto__: null,
7098
- down: Td,
7099
- up: Od
7095
+ down: xc,
7096
+ up: Oc
7100
7097
  }, Symbol.toStringTag, { value: "Module" }));
7101
- async function xd(t) {
7098
+ async function Sc(t) {
7102
7099
  }
7103
- async function kd(t) {
7100
+ async function kc(t) {
7104
7101
  await t.schema.alterTable("users").dropConstraint("unique_email_provider").execute();
7105
7102
  }
7106
- const Ed = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7103
+ const Ec = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7107
7104
  __proto__: null,
7108
- down: kd,
7109
- up: xd
7105
+ down: kc,
7106
+ up: Sc
7110
7107
  }, Symbol.toStringTag, { value: "Module" }));
7111
- async function Id(t) {
7108
+ async function Ic(t) {
7112
7109
  await t.schema.alterTable("otps").dropColumn("state").execute(), await t.schema.alterTable("otps").addColumn("state", "varchar(8192)").execute();
7113
7110
  }
7114
- async function Ad(t) {
7111
+ async function Ac(t) {
7115
7112
  await t.schema.alterTable("otps").dropColumn("state").execute(), await t.schema.alterTable("otps").addColumn("state", "varchar(1024)").execute();
7116
7113
  }
7117
- const Pd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7114
+ const Pc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7118
7115
  __proto__: null,
7119
- down: Ad,
7120
- up: Id
7116
+ down: Ac,
7117
+ up: Ic
7121
7118
  }, Symbol.toStringTag, { value: "Module" }));
7122
- async function $d(t) {
7119
+ async function $c(t) {
7123
7120
  await t.schema.alterTable("tickets").dropColumn("state").execute(), await t.schema.alterTable("tickets").addColumn("state", "varchar(8192)").execute();
7124
7121
  }
7125
- async function Dd(t) {
7122
+ async function Dc(t) {
7126
7123
  await t.schema.alterTable("tickets").dropColumn("state").execute(), await t.schema.alterTable("tickets").addColumn("state", "varchar(1024)").execute();
7127
7124
  }
7128
- const Rd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7125
+ const Rc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7129
7126
  __proto__: null,
7130
- down: Dd,
7131
- up: $d
7127
+ down: Dc,
7128
+ up: $c
7132
7129
  }, Symbol.toStringTag, { value: "Module" }));
7133
- async function zd(t) {
7130
+ async function zc(t) {
7134
7131
  await t.schema.createTable("branding").addColumn(
7135
7132
  "tenant_id",
7136
7133
  "varchar(255)",
7137
7134
  (e) => e.references("tenants.id").onDelete("cascade").notNull().primaryKey()
7138
7135
  ).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();
7139
7136
  }
7140
- async function Fd(t) {
7137
+ async function Fc(t) {
7141
7138
  await t.schema.dropTable("branding").execute();
7142
7139
  }
7143
- const qd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7140
+ const jc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7144
7141
  __proto__: null,
7145
- down: Fd,
7146
- up: zd
7142
+ down: Fc,
7143
+ up: zc
7147
7144
  }, Symbol.toStringTag, { value: "Module" }));
7148
- async function jd(t) {
7145
+ async function qc(t) {
7149
7146
  }
7150
- async function Ld(t) {
7147
+ async function Lc(t) {
7151
7148
  }
7152
- const Jd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7149
+ const Jc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7153
7150
  __proto__: null,
7154
- down: Ld,
7155
- up: jd
7151
+ down: Lc,
7152
+ up: qc
7156
7153
  }, Symbol.toStringTag, { value: "Module" }));
7157
- async function Md(t) {
7154
+ async function Mc(t) {
7158
7155
  }
7159
- async function Wd(t) {
7156
+ async function Bc(t) {
7160
7157
  }
7161
- const Bd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7158
+ const Wc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7162
7159
  __proto__: null,
7163
- down: Wd,
7164
- up: Md
7160
+ down: Bc,
7161
+ up: Mc
7165
7162
  }, Symbol.toStringTag, { value: "Module" }));
7166
- async function Kd(t) {
7163
+ async function Kc(t) {
7167
7164
  }
7168
- async function Ud(t) {
7165
+ async function Uc(t) {
7169
7166
  }
7170
- const Qd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7167
+ const Qc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7171
7168
  __proto__: null,
7172
- down: Ud,
7173
- up: Kd
7169
+ down: Uc,
7170
+ up: Kc
7174
7171
  }, Symbol.toStringTag, { value: "Module" }));
7175
- async function Vd(t) {
7172
+ async function Vc(t) {
7176
7173
  }
7177
- async function Gd(t) {
7174
+ async function Gc(t) {
7178
7175
  }
7179
- const Yd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7176
+ const Yc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7180
7177
  __proto__: null,
7181
- down: Gd,
7182
- up: Vd
7178
+ down: Gc,
7179
+ up: Vc
7183
7180
  }, Symbol.toStringTag, { value: "Module" }));
7184
- async function Hd(t) {
7181
+ async function Hc(t) {
7185
7182
  await t.schema.createTable("authentication_codes").addColumn(
7186
7183
  "tenant_id",
7187
7184
  "varchar(255)",
@@ -7192,55 +7189,55 @@ async function Hd(t) {
7192
7189
  (e) => e.references("applications.id").onDelete("cascade").notNull()
7193
7190
  ).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();
7194
7191
  }
7195
- async function Xd(t) {
7192
+ async function Xc(t) {
7196
7193
  await t.schema.dropTable("authentication_codes").execute();
7197
7194
  }
7198
- const Zd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7195
+ const Zc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7199
7196
  __proto__: null,
7200
- down: Xd,
7201
- up: Hd
7197
+ down: Xc,
7198
+ up: Hc
7202
7199
  }, Symbol.toStringTag, { value: "Module" }));
7203
- async function ec(t) {
7200
+ async function ed(t) {
7204
7201
  }
7205
- async function tc(t) {
7202
+ async function td(t) {
7206
7203
  }
7207
- const nc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7204
+ const nd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7208
7205
  __proto__: null,
7209
- down: tc,
7210
- up: ec
7206
+ down: td,
7207
+ up: ed
7211
7208
  }, Symbol.toStringTag, { value: "Module" }));
7212
- async function rc(t) {
7209
+ async function rd(t) {
7213
7210
  await t.schema.alterTable("otps").addColumn("ip", "varchar(64)").execute();
7214
7211
  }
7215
- async function ac(t) {
7212
+ async function ad(t) {
7216
7213
  await t.schema.alterTable("otps").dropColumn("ip").execute();
7217
7214
  }
7218
- const oc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7215
+ const od = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7219
7216
  __proto__: null,
7220
- down: ac,
7221
- up: rc
7217
+ down: ad,
7218
+ up: rd
7222
7219
  }, Symbol.toStringTag, { value: "Module" }));
7223
- async function ic(t) {
7220
+ async function id(t) {
7224
7221
  await t.schema.alterTable("logs").dropColumn("user_agent").execute(), await t.schema.alterTable("logs").addColumn("user_agent", "varchar(1024)").execute();
7225
7222
  }
7226
- async function sc(t) {
7223
+ async function sd(t) {
7227
7224
  await t.schema.alterTable("logs").dropColumn("user_agent").execute(), await t.schema.alterTable("logs").addColumn("user_agent", "varchar(255)").execute();
7228
7225
  }
7229
- const uc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7226
+ const ud = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7230
7227
  __proto__: null,
7231
- down: sc,
7232
- up: ic
7228
+ down: sd,
7229
+ up: id
7233
7230
  }, Symbol.toStringTag, { value: "Module" }));
7234
- async function dc(t) {
7231
+ async function cd(t) {
7235
7232
  }
7236
- async function cc(t) {
7233
+ async function dd(t) {
7237
7234
  }
7238
- const lc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7235
+ const ld = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7239
7236
  __proto__: null,
7240
- down: cc,
7241
- up: dc
7237
+ down: dd,
7238
+ up: cd
7242
7239
  }, Symbol.toStringTag, { value: "Module" }));
7243
- async function _c(t) {
7240
+ async function _d(t) {
7244
7241
  await t.schema.createTable("hooks").addColumn("hook_id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn(
7245
7242
  "tenant_id",
7246
7243
  "varchar(255)",
@@ -7251,33 +7248,33 @@ async function _c(t) {
7251
7248
  (e) => e.defaultTo(!1).notNull()
7252
7249
  ).addColumn("priority", "integer").execute();
7253
7250
  }
7254
- async function mc(t) {
7251
+ async function md(t) {
7255
7252
  await t.schema.dropTable("hooks").execute();
7256
7253
  }
7257
- const hc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7254
+ const hd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7258
7255
  __proto__: null,
7259
- down: mc,
7260
- up: _c
7256
+ down: md,
7257
+ up: _d
7261
7258
  }, Symbol.toStringTag, { value: "Module" }));
7262
- async function fc(t) {
7259
+ async function fd(t) {
7263
7260
  }
7264
- async function pc(t) {
7261
+ async function pd(t) {
7265
7262
  }
7266
- const gc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7263
+ const gd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7267
7264
  __proto__: null,
7268
- down: pc,
7269
- up: fc
7265
+ down: pd,
7266
+ up: fd
7270
7267
  }, Symbol.toStringTag, { value: "Module" }));
7271
- async function yc(t) {
7268
+ async function yd(t) {
7272
7269
  }
7273
- async function wc(t) {
7270
+ async function wd(t) {
7274
7271
  }
7275
- const Nc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7272
+ const Nd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7276
7273
  __proto__: null,
7277
- down: wc,
7278
- up: yc
7274
+ down: wd,
7275
+ up: yd
7279
7276
  }, Symbol.toStringTag, { value: "Module" }));
7280
- async function vc(t) {
7277
+ async function vd(t) {
7281
7278
  await t.schema.createTable("logins").addColumn("login_id", "varchar(255)", (e) => e.primaryKey()).addColumn(
7282
7279
  "tenant_id",
7283
7280
  "varchar(255)",
@@ -7294,7 +7291,7 @@ async function vc(t) {
7294
7291
  (e) => e.onDelete("cascade")
7295
7292
  ).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();
7296
7293
  }
7297
- async function Cc(t) {
7294
+ async function Cd(t) {
7298
7295
  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(
7299
7296
  "codes_user_id_tenant_id_constraint",
7300
7297
  ["user_id", "tenant_id"],
@@ -7303,90 +7300,90 @@ async function Cc(t) {
7303
7300
  (e) => e.onDelete("cascade")
7304
7301
  ).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();
7305
7302
  }
7306
- const bc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7303
+ const bd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7307
7304
  __proto__: null,
7308
- down: Cc,
7309
- up: vc
7305
+ down: Cd,
7306
+ up: vd
7310
7307
  }, Symbol.toStringTag, { value: "Module" }));
7311
- async function Oc(t) {
7308
+ async function Od(t) {
7312
7309
  }
7313
- async function Tc(t) {
7310
+ async function xd(t) {
7314
7311
  }
7315
- const Sc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7312
+ const Td = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7316
7313
  __proto__: null,
7317
- down: Tc,
7318
- up: Oc
7314
+ down: xd,
7315
+ up: Od
7319
7316
  }, Symbol.toStringTag, { value: "Module" }));
7320
- async function xc(t) {
7317
+ async function Sd(t) {
7321
7318
  await t.schema.alterTable("logins").addColumn("auth0Client", "varchar(256)").execute();
7322
7319
  }
7323
- async function kc(t) {
7320
+ async function kd(t) {
7324
7321
  await t.schema.alterTable("logins").dropColumn("auth0Client").execute();
7325
7322
  }
7326
- const Ec = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7323
+ const Ed = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7327
7324
  __proto__: null,
7328
- down: kc,
7329
- up: xc
7325
+ down: kd,
7326
+ up: Sd
7330
7327
  }, Symbol.toStringTag, { value: "Module" }));
7331
- async function Ic(t) {
7328
+ async function Id(t) {
7332
7329
  await t.schema.alterTable("logins").dropColumn("authParams_state").execute(), await t.schema.alterTable("logins").addColumn("authParams_state", "varchar(8192)").execute();
7333
7330
  }
7334
- async function Ac(t) {
7331
+ async function Ad(t) {
7335
7332
  await t.schema.alterTable("logins").dropColumn("authParams_state").execute(), await t.schema.alterTable("logins").addColumn("authParams_state", "varchar(511)").execute();
7336
7333
  }
7337
- const Pc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7334
+ const Pd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7338
7335
  __proto__: null,
7339
- down: Ac,
7340
- up: Ic
7336
+ down: Ad,
7337
+ up: Id
7341
7338
  }, Symbol.toStringTag, { value: "Module" }));
7342
- async function $c(t) {
7339
+ async function $d(t) {
7343
7340
  }
7344
- async function Dc(t) {
7341
+ async function Dd(t) {
7345
7342
  }
7346
- const Rc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7343
+ const Rd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7347
7344
  __proto__: null,
7348
- down: Dc,
7349
- up: $c
7345
+ down: Dd,
7346
+ up: $d
7350
7347
  }, Symbol.toStringTag, { value: "Module" }));
7351
- async function zc(t) {
7348
+ async function zd(t) {
7352
7349
  }
7353
- async function Fc(t) {
7350
+ async function Fd(t) {
7354
7351
  }
7355
- const qc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7352
+ const jd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7356
7353
  __proto__: null,
7357
- down: Fc,
7358
- up: zc
7354
+ down: Fd,
7355
+ up: zd
7359
7356
  }, Symbol.toStringTag, { value: "Module" }));
7360
- async function jc(t) {
7357
+ async function qd(t) {
7361
7358
  await t.schema.alterTable("logins").addColumn("authParams_nonce", "varchar(255)").execute();
7362
7359
  }
7363
- async function Lc(t) {
7360
+ async function Ld(t) {
7364
7361
  await t.schema.alterTable("logins").dropColumn("nonce").execute();
7365
7362
  }
7366
- const Jc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7363
+ const Jd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7367
7364
  __proto__: null,
7368
- down: Lc,
7369
- up: jc
7365
+ down: Ld,
7366
+ up: qd
7370
7367
  }, Symbol.toStringTag, { value: "Module" }));
7371
- async function Mc(t) {
7368
+ async function Md(t) {
7372
7369
  }
7373
- async function Wc(t) {
7370
+ async function Bd(t) {
7374
7371
  }
7375
- const Bc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7372
+ const Wd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7376
7373
  __proto__: null,
7377
- down: Wc,
7378
- up: Mc
7374
+ down: Bd,
7375
+ up: Md
7379
7376
  }, Symbol.toStringTag, { value: "Module" }));
7380
- async function Kc(t) {
7377
+ async function Kd(t) {
7381
7378
  }
7382
- async function Uc(t) {
7379
+ async function Ud(t) {
7383
7380
  }
7384
- const Qc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7381
+ const Qd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7385
7382
  __proto__: null,
7386
- down: Uc,
7387
- up: Kc
7383
+ down: Ud,
7384
+ up: Kd
7388
7385
  }, Symbol.toStringTag, { value: "Module" }));
7389
- async function Vc(t) {
7386
+ async function Vd(t) {
7390
7387
  await t.schema.dropTable("codes").execute(), await t.schema.createTable("codes").addColumn("code_id", "varchar(255)", (e) => e.notNull()).addColumn(
7391
7388
  "tenant_id",
7392
7389
  "varchar(255)",
@@ -7402,7 +7399,7 @@ async function Vc(t) {
7402
7399
  "code_type"
7403
7400
  ]).execute();
7404
7401
  }
7405
- async function Gc(t) {
7402
+ async function Gd(t) {
7406
7403
  await t.schema.dropTable("codes").execute(), await t.schema.createTable("codes").addColumn("code_id", "varchar(255)", (e) => e.primaryKey()).addColumn(
7407
7404
  "tenant_id",
7408
7405
  "varchar(255)",
@@ -7415,15 +7412,15 @@ async function Gc(t) {
7415
7412
  (e) => e.onDelete("cascade")
7416
7413
  ).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();
7417
7414
  }
7418
- const Yc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7415
+ const Yd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7419
7416
  __proto__: null,
7420
- down: Gc,
7421
- up: Vc
7417
+ down: Gd,
7418
+ up: Vd
7422
7419
  }, Symbol.toStringTag, { value: "Module" }));
7423
- async function Hc(t) {
7420
+ async function Hd(t) {
7424
7421
  await t.schema.dropTable("otps").execute(), await t.schema.dropTable("authentication_codes").execute();
7425
7422
  }
7426
- async function Xc(t) {
7423
+ async function Xd(t) {
7427
7424
  await t.schema.alterTable("keys").addColumn("private_key", "varchar(2048)").addColumn("public_key", "varchar(2048)").execute(), await t.schema.createTable("otps").addColumn(
7428
7425
  "tenant_id",
7429
7426
  "varchar(255)",
@@ -7442,10 +7439,10 @@ async function Xc(t) {
7442
7439
  (e) => e.references("applications.id").onDelete("cascade").notNull()
7443
7440
  ).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();
7444
7441
  }
7445
- const Zc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7442
+ const Zd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7446
7443
  __proto__: null,
7447
- down: Xc,
7448
- up: Hc
7444
+ down: Xd,
7445
+ up: Hd
7449
7446
  }, Symbol.toStringTag, { value: "Module" }));
7450
7447
  async function el(t) {
7451
7448
  await t.schema.createIndex("IDX_logs_tenant_date_type_user").on("logs").columns(["tenant_id", "date", "type", "user_id"]).execute();
@@ -7494,14 +7491,14 @@ const ul = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7494
7491
  down: sl,
7495
7492
  up: il
7496
7493
  }, Symbol.toStringTag, { value: "Module" }));
7497
- async function dl(t) {
7498
- }
7499
7494
  async function cl(t) {
7500
7495
  }
7496
+ async function dl(t) {
7497
+ }
7501
7498
  const ll = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7502
7499
  __proto__: null,
7503
- down: cl,
7504
- up: dl
7500
+ down: dl,
7501
+ up: cl
7505
7502
  }, Symbol.toStringTag, { value: "Module" }));
7506
7503
  async function _l(t) {
7507
7504
  }
@@ -7545,14 +7542,14 @@ const bl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7545
7542
  }, Symbol.toStringTag, { value: "Module" }));
7546
7543
  async function Ol(t) {
7547
7544
  }
7548
- async function Tl(t) {
7545
+ async function xl(t) {
7549
7546
  }
7550
- const Sl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7547
+ const Tl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7551
7548
  __proto__: null,
7552
- down: Tl,
7549
+ down: xl,
7553
7550
  up: Ol
7554
7551
  }, Symbol.toStringTag, { value: "Module" }));
7555
- async function xl(t) {
7552
+ async function Sl(t) {
7556
7553
  await t.schema.alterTable("logins").addColumn("authParams_act_as", "varchar(255)").execute();
7557
7554
  }
7558
7555
  async function kl(t) {
@@ -7561,7 +7558,7 @@ async function kl(t) {
7561
7558
  const El = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7562
7559
  __proto__: null,
7563
7560
  down: kl,
7564
- up: xl
7561
+ up: Sl
7565
7562
  }, Symbol.toStringTag, { value: "Module" }));
7566
7563
  async function Il(t) {
7567
7564
  await t.schema.alterTable("codes").addColumn("code_verifier", "varchar(128)").execute();
@@ -7607,12 +7604,12 @@ async function Fl(t) {
7607
7604
  (e) => e.references("applications.id").onDelete("cascade").notNull()
7608
7605
  ).addColumn("email", "varchar(255)", (e) => e.notNull()).addColumn("nonce", "varchar(255)").addColumn("state", "varchar(1024)").addColumn("scope", "varchar(1024)").addColumn("response_type", "varchar(256)").addColumn("response_mode", "varchar(256)").addColumn("redirect_uri", "varchar(1024)").addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("expires_at", "varchar(255)", (e) => e.notNull()).addColumn("used_at", "varchar(255)").execute();
7609
7606
  }
7610
- const ql = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7607
+ const jl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7611
7608
  __proto__: null,
7612
7609
  down: Fl,
7613
7610
  up: zl
7614
7611
  }, Symbol.toStringTag, { value: "Module" }));
7615
- async function jl(t) {
7612
+ async function ql(t) {
7616
7613
  }
7617
7614
  async function Ll(t) {
7618
7615
  await t.schema.alterTable("logins").dropColumn("ip").dropColumn("useragent").execute();
@@ -7620,7 +7617,7 @@ async function Ll(t) {
7620
7617
  const Jl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7621
7618
  __proto__: null,
7622
7619
  down: Ll,
7623
- up: jl
7620
+ up: ql
7624
7621
  }, Symbol.toStringTag, { value: "Module" }));
7625
7622
  async function Ml(t) {
7626
7623
  await t.schema.createTable("refresh_tokens").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn(
@@ -7635,12 +7632,12 @@ async function Ml(t) {
7635
7632
  (e) => e.onDelete("cascade")
7636
7633
  ).addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("expires_at", "varchar(35)").addColumn("idle_expires_at", "varchar(35)").addColumn("last_exchanged_at", "varchar(35)").addColumn("device", "varchar(2048)", (e) => e.notNull()).addColumn("resource_servers", "varchar(2048)", (e) => e.notNull()).addColumn("rotating", "boolean", (e) => e.notNull()).execute();
7637
7634
  }
7638
- async function Wl(t) {
7635
+ async function Bl(t) {
7639
7636
  await t.schema.dropTable("refresh_tokens").execute();
7640
7637
  }
7641
- const Bl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7638
+ const Wl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7642
7639
  __proto__: null,
7643
- down: Wl,
7640
+ down: Bl,
7644
7641
  up: Ml
7645
7642
  }, Symbol.toStringTag, { value: "Module" }));
7646
7643
  async function Kl(t) {
@@ -7750,14 +7747,14 @@ const u_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7750
7747
  down: s_,
7751
7748
  up: i_
7752
7749
  }, Symbol.toStringTag, { value: "Module" }));
7753
- async function d_(t) {
7754
- }
7755
7750
  async function c_(t) {
7756
7751
  }
7752
+ async function d_(t) {
7753
+ }
7757
7754
  const l_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7758
7755
  __proto__: null,
7759
- down: c_,
7760
- up: d_
7756
+ down: d_,
7757
+ up: c_
7761
7758
  }, Symbol.toStringTag, { value: "Module" }));
7762
7759
  async function __(t) {
7763
7760
  await t.schema.createTable("sessions").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addForeignKeyConstraint(
@@ -7835,15 +7832,15 @@ const b_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7835
7832
  async function O_(t) {
7836
7833
  await t.schema.createTable("forms").addColumn("id", "varchar(255)", (e) => e.primaryKey()).addColumn("name", "varchar(255)", (e) => e.notNull()).addColumn("tenant_id", "varchar(255)", (e) => e.notNull()).addColumn("messages", "varchar(255)").addColumn("languages", "varchar(255)").addColumn("translations", "varchar(4096)").addColumn("nodes", "varchar(4096)").addColumn("start", "varchar(255)").addColumn("ending", "varchar(255)").addColumn("style", "varchar(1042)").addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("updated_at", "varchar(255)", (e) => e.notNull()).execute(), await t.schema.createIndex("forms_tenant_id_idx").on("forms").column("tenant_id").execute();
7837
7834
  }
7838
- async function T_(t) {
7835
+ async function x_(t) {
7839
7836
  await t.schema.dropTable("forms").execute();
7840
7837
  }
7841
- const S_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7838
+ const T_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7842
7839
  __proto__: null,
7843
- down: T_,
7840
+ down: x_,
7844
7841
  up: O_
7845
7842
  }, Symbol.toStringTag, { value: "Module" }));
7846
- async function x_(t) {
7843
+ async function S_(t) {
7847
7844
  await t.schema.alterTable("hooks").addColumn("form_id", "text").execute(), await t.schema.alterTable("hooks").addColumn("url_tmp", "varchar(512)").execute(), await t.updateTable("hooks").set((e) => ({ url_tmp: e.ref("url") })).execute(), await t.schema.alterTable("hooks").dropColumn("url").execute(), await t.schema.alterTable("hooks").renameColumn("url_tmp", "url").execute();
7848
7845
  }
7849
7846
  async function k_(t) {
@@ -7852,7 +7849,7 @@ async function k_(t) {
7852
7849
  const E_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7853
7850
  __proto__: null,
7854
7851
  down: k_,
7855
- up: x_
7852
+ up: S_
7856
7853
  }, Symbol.toStringTag, { value: "Module" }));
7857
7854
  async function I_(t) {
7858
7855
  await t.schema.alterTable("login_sessions").addColumn(
@@ -7890,12 +7887,12 @@ async function z_(t) {
7890
7887
  async function F_(t) {
7891
7888
  await t.schema.dropIndex("IDX_sessions_login_session_id").on("sessions").execute();
7892
7889
  }
7893
- const q_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7890
+ const j_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7894
7891
  __proto__: null,
7895
7892
  down: F_,
7896
7893
  up: z_
7897
7894
  }, Symbol.toStringTag, { value: "Module" }));
7898
- async function j_(t) {
7895
+ async function q_(t) {
7899
7896
  await t.schema.alterTable("codes").addColumn("code_challenge", "varchar(128)").execute(), await t.schema.alterTable("codes").addColumn("code_challenge_method", "varchar(5)").execute();
7900
7897
  }
7901
7898
  async function L_(t) {
@@ -7904,17 +7901,17 @@ async function L_(t) {
7904
7901
  const J_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7905
7902
  __proto__: null,
7906
7903
  down: L_,
7907
- up: j_
7904
+ up: q_
7908
7905
  }, Symbol.toStringTag, { value: "Module" }));
7909
7906
  async function M_(t) {
7910
7907
  await t.schema.alterTable("codes").addColumn("redirect_uri", "varchar(1024)").execute();
7911
7908
  }
7912
- async function W_(t) {
7909
+ async function B_(t) {
7913
7910
  await t.schema.alterTable("codes").dropColumn("redirect_uri").execute();
7914
7911
  }
7915
- const B_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7912
+ const W_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7916
7913
  __proto__: null,
7917
- down: W_,
7914
+ down: B_,
7918
7915
  up: M_
7919
7916
  }, Symbol.toStringTag, { value: "Module" }));
7920
7917
  async function K_(t) {
@@ -8076,16 +8073,16 @@ const um = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8076
8073
  down: sm,
8077
8074
  up: im
8078
8075
  }, Symbol.toStringTag, { value: "Module" }));
8079
- async function dm(t) {
8076
+ async function cm(t) {
8080
8077
  await t.schema.createTable("organizations").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(191)", (e) => e.notNull()).addColumn("name", "varchar(256)", (e) => e.notNull()).addColumn("display_name", "varchar(256)").addColumn("branding", "text").addColumn("metadata", "text").addColumn("enabled_connections", "text").addColumn("token_quota", "text").addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("updated_at", "varchar(35)", (e) => e.notNull()).execute(), await t.schema.createIndex("idx_organizations_tenant_id").on("organizations").column("tenant_id").execute(), await t.schema.createIndex("idx_organizations_tenant_name_unique").on("organizations").columns(["tenant_id", "name"]).unique().execute();
8081
8078
  }
8082
- async function cm(t) {
8079
+ async function dm(t) {
8083
8080
  await t.schema.dropTable("organizations").execute();
8084
8081
  }
8085
8082
  const lm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8086
8083
  __proto__: null,
8087
- down: cm,
8088
- up: dm
8084
+ down: dm,
8085
+ up: cm
8089
8086
  }, Symbol.toStringTag, { value: "Module" }));
8090
8087
  async function _m(t) {
8091
8088
  await t.schema.createTable("user_organizations").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(191)", (e) => e.notNull()).addColumn("user_id", "varchar(191)", (e) => e.notNull()).addColumn("organization_id", "varchar(21)", (e) => e.notNull()).addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("updated_at", "varchar(35)", (e) => e.notNull()).addUniqueConstraint("user_organizations_unique", [
@@ -8227,10 +8224,10 @@ async function Cm(t) {
8227
8224
  ), console.log(
8228
8225
  `Dropped foreign key constraint ${o} from ${u}`
8229
8226
  );
8230
- } catch (d) {
8227
+ } catch (c) {
8231
8228
  console.warn(
8232
8229
  `Failed to drop constraint ${o} from ${u}:`,
8233
- d
8230
+ c
8234
8231
  );
8235
8232
  }
8236
8233
  }
@@ -8357,9 +8354,9 @@ async function bm(t) {
8357
8354
  });
8358
8355
  }
8359
8356
  async function Om(t) {
8360
- await Pr(t) === "mysql" ? await Tm(t) : await Sm(t);
8357
+ await Pr(t) === "mysql" ? await xm(t) : await Tm(t);
8361
8358
  }
8362
- async function Tm(t) {
8359
+ async function xm(t) {
8363
8360
  await t.transaction().execute(async (e) => {
8364
8361
  await g`ALTER TABLE refresh_tokens DROP FOREIGN KEY refresh_tokens_client_fk`.execute(
8365
8362
  e
@@ -8376,7 +8373,7 @@ async function Tm(t) {
8376
8373
  );
8377
8374
  });
8378
8375
  }
8379
- async function Sm(t) {
8376
+ async function Tm(t) {
8380
8377
  await t.transaction().execute(async (e) => {
8381
8378
  await g`CREATE TABLE refresh_tokens_temp AS SELECT * FROM refresh_tokens`.execute(
8382
8379
  e
@@ -8406,7 +8403,7 @@ async function Sm(t) {
8406
8403
  FROM login_sessions_temp`.execute(e), await g`DROP TABLE login_sessions_temp`.execute(e);
8407
8404
  });
8408
8405
  }
8409
- const xm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8406
+ const Sm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8410
8407
  __proto__: null,
8411
8408
  down: Om,
8412
8409
  up: vm
@@ -8450,6 +8447,50 @@ const $m = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8450
8447
  __proto__: null,
8451
8448
  down: Pm,
8452
8449
  up: Am
8450
+ }, Symbol.toStringTag, { value: "Module" }));
8451
+ async function Dm(t) {
8452
+ await t.schema.createIndex("users_phone_tenant_provider_index").on("users").columns(["tenant_id", "phone_number", "provider"]).execute();
8453
+ }
8454
+ async function Rm(t) {
8455
+ await t.schema.dropIndex("users_phone_tenant_provider_index").execute();
8456
+ }
8457
+ const zm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8458
+ __proto__: null,
8459
+ down: Rm,
8460
+ up: Dm
8461
+ }, Symbol.toStringTag, { value: "Module" }));
8462
+ async function Fm(t) {
8463
+ await t.schema.createIndex("login_sessions_id_index").on("login_sessions").column("id").execute();
8464
+ }
8465
+ async function jm(t) {
8466
+ await t.schema.dropIndex("login_sessions_id_index").execute();
8467
+ }
8468
+ const qm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8469
+ __proto__: null,
8470
+ down: jm,
8471
+ up: Fm
8472
+ }, Symbol.toStringTag, { value: "Module" }));
8473
+ async function Lm(t) {
8474
+ await t.schema.createIndex("connections_tenant_id_index").on("connections").column("tenant_id").execute();
8475
+ }
8476
+ async function Jm(t) {
8477
+ await t.schema.dropIndex("connections_tenant_id_index").execute();
8478
+ }
8479
+ const Mm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8480
+ __proto__: null,
8481
+ down: Jm,
8482
+ up: Lm
8483
+ }, Symbol.toStringTag, { value: "Module" }));
8484
+ async function Bm(t) {
8485
+ await t.schema.dropIndex("idx_user_organizations_tenant_id").execute();
8486
+ }
8487
+ async function Wm(t) {
8488
+ await t.schema.createIndex("idx_user_organizations_tenant_id").on("user_organizations").column("tenant_id").execute();
8489
+ }
8490
+ const Km = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8491
+ __proto__: null,
8492
+ down: Wm,
8493
+ up: Bm
8453
8494
  }, Symbol.toStringTag, { value: "Module" })), $r = {
8454
8495
  m1_init: nu,
8455
8496
  m2_magicLink: ou,
@@ -8459,52 +8500,52 @@ const $m = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8459
8500
  m6_sessions: gu,
8460
8501
  m7_passwords: Nu,
8461
8502
  m8_logsTableNewFields: bu,
8462
- m9_passwordTableNewField: Su,
8503
+ m9_passwordTableNewField: Tu,
8463
8504
  n01_codesTable: Eu,
8464
8505
  n11_universalLoginSession: Pu,
8465
8506
  n12_userFields: Ru,
8466
- n13_userEmailIndex: qu,
8507
+ n13_userEmailIndex: ju,
8467
8508
  n14_profileDataField: Ju,
8468
- n15_userEmailIndex: Bu,
8509
+ n15_userEmailIndex: Wu,
8469
8510
  n16_userLocale: Qu,
8470
8511
  n17_signingKeys: Yu,
8471
8512
  n18_logsFields: Zu,
8472
- n19_connectionsUserinfo: nd,
8473
- n20_missingFields: od,
8474
- n21_sessionDeletedAt: ud,
8475
- n22_dropLogsFields: ld,
8476
- n23_dropUsersFields: hd,
8477
- n24_logsIndexes: gd,
8478
- n25_logDescMaxLength: Nd,
8479
- n26_logsTableExtraFields: bd,
8480
- n27_usersTableNameIndex: Sd,
8481
- n28_usersEmailConstrain: Ed,
8482
- n29_increaseOtpStateLength: Pd,
8483
- n30_increaseTicketStateLength: Rd,
8484
- n31_branding: qd,
8485
- n32_indexesAndNotNull: Jd,
8486
- n33_vendorIdInUniversalLoginSession: Bd,
8487
- n34_auth0ClientInUniversalLoginSession: Qd,
8488
- n35_increaseUniversalSessionStateLength: Yd,
8489
- n36_authenticationCodes: Zd,
8490
- n37_disableSignUps: nc,
8491
- n38_otpIpAddress: oc,
8492
- n39_increaseUserAgentLength: uc,
8493
- n40_userId: lc,
8494
- n41_hooks: hc,
8495
- n42_userIdIndexes: gc,
8496
- n43_userIdIndexes: Nc,
8497
- n44_codes: bc,
8498
- n45_hookProperties: Sc,
8499
- n46_loginAuth0Client: Ec,
8500
- n47_loginAuth0Client: Pc,
8501
- n48_saml: Rc,
8502
- n49_removeFields: qc,
8503
- n50_authParamsNonce: Jc,
8504
- n51_connectionid: Bc,
8505
- n52_cert: Qc,
8506
- n53_codes_primary_key: Yc,
8507
- n54_cleanup_tables: Zc,
8513
+ n19_connectionsUserinfo: nc,
8514
+ n20_missingFields: oc,
8515
+ n21_sessionDeletedAt: uc,
8516
+ n22_dropLogsFields: lc,
8517
+ n23_dropUsersFields: hc,
8518
+ n24_logsIndexes: gc,
8519
+ n25_logDescMaxLength: Nc,
8520
+ n26_logsTableExtraFields: bc,
8521
+ n27_usersTableNameIndex: Tc,
8522
+ n28_usersEmailConstrain: Ec,
8523
+ n29_increaseOtpStateLength: Pc,
8524
+ n30_increaseTicketStateLength: Rc,
8525
+ n31_branding: jc,
8526
+ n32_indexesAndNotNull: Jc,
8527
+ n33_vendorIdInUniversalLoginSession: Wc,
8528
+ n34_auth0ClientInUniversalLoginSession: Qc,
8529
+ n35_increaseUniversalSessionStateLength: Yc,
8530
+ n36_authenticationCodes: Zc,
8531
+ n37_disableSignUps: nd,
8532
+ n38_otpIpAddress: od,
8533
+ n39_increaseUserAgentLength: ud,
8534
+ n40_userId: ld,
8535
+ n41_hooks: hd,
8536
+ n42_userIdIndexes: gd,
8537
+ n43_userIdIndexes: Nd,
8538
+ n44_codes: bd,
8539
+ n45_hookProperties: Td,
8540
+ n46_loginAuth0Client: Ed,
8541
+ n47_loginAuth0Client: Pd,
8542
+ n48_saml: Rd,
8543
+ n49_removeFields: jd,
8544
+ n50_authParamsNonce: Jd,
8545
+ n51_connectionid: Wd,
8546
+ n52_cert: Qd,
8547
+ n53_codes_primary_key: Yd,
8548
+ n54_cleanup_tables: Zd,
8508
8549
  n55_logs_index: nl,
8509
8550
  n56_application_fields: ol,
8510
8551
  n57_prompt_settings: ul,
@@ -8513,13 +8554,13 @@ const $m = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8513
8554
  n60_users_metadata: gl,
8514
8555
  n61_userLocales: Nl,
8515
8556
  n62_prompt: bl,
8516
- n63_connection_cleanup: Sl,
8557
+ n63_connection_cleanup: Tl,
8517
8558
  n64_act_as: El,
8518
8559
  n65_code_verifier: Pl,
8519
8560
  n66_email_providers: Rl,
8520
- n67_drop_tickets: ql,
8561
+ n67_drop_tickets: jl,
8521
8562
  n68_login_useragents: Jl,
8522
- n70_refresh_tokens: Bl,
8563
+ n70_refresh_tokens: Wl,
8523
8564
  n71_session_new_fields: Ql,
8524
8565
  n72_session_primary_key: Yl,
8525
8566
  n73_drop_sessions: Zl,
@@ -8531,13 +8572,13 @@ const $m = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8531
8572
  n79_drop_sessions_2: g_,
8532
8573
  n80_recreate_custom_domains: N_,
8533
8574
  n81_phone: b_,
8534
- n82_forms: S_,
8575
+ n82_forms: T_,
8535
8576
  n83_addFormsIdToHooks: E_,
8536
8577
  n84_login_completed: P_,
8537
8578
  n85_add_login_session_id_to_sessions: R_,
8538
- n86_index_sessions_login_session_id: q_,
8579
+ n86_index_sessions_login_session_id: j_,
8539
8580
  n87_code_challenge: J_,
8540
- n88_add_redirect_uri_to_codes: B_,
8581
+ n88_add_redirect_uri_to_codes: W_,
8541
8582
  n89_add_nonce_and_state_to_codes: Q_,
8542
8583
  n90_themes: Y_,
8543
8584
  n91_resource_servers_rules_permissions: Z_,
@@ -8548,11 +8589,15 @@ const $m = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8548
8589
  n96_create_user_organizations_table: hm,
8549
8590
  n97_add_organization_to_user_permissions_and_roles: gm,
8550
8591
  n98_clients: Nm,
8551
- n99_update_client_foreign_keys: xm,
8592
+ n99_update_client_foreign_keys: Sm,
8552
8593
  o001_client_grants: Im,
8553
- o002_drop_applications: $m
8594
+ o002_drop_applications: $m,
8595
+ o003_phone_number_index: zm,
8596
+ o004_login_sessions_id_index: qm,
8597
+ o005_connections_tenant_index: Mm,
8598
+ o006_remove_redundant_user_organizations_tenant_index: Km
8554
8599
  };
8555
- async function qm(t, e = !1) {
8600
+ async function Ym(t, e = !1) {
8556
8601
  e && console.log("migrating...");
8557
8602
  const n = new Ar($r), r = new pr({
8558
8603
  db: t,
@@ -8565,7 +8610,7 @@ async function qm(t, e = !1) {
8565
8610
  }), a)
8566
8611
  throw console.error("failed to migrate"), console.error(a), a;
8567
8612
  }
8568
- async function jm(t) {
8613
+ async function Hm(t) {
8569
8614
  console.log("migrating...");
8570
8615
  const e = new Ar($r), n = new pr({
8571
8616
  db: t,
@@ -8576,7 +8621,7 @@ async function jm(t) {
8576
8621
  }), r)
8577
8622
  throw console.error("failed to migrate"), console.error(r), r;
8578
8623
  }
8579
- function Lm(t) {
8624
+ function Xm(t) {
8580
8625
  return {
8581
8626
  branding: co(t),
8582
8627
  cleanup: Lo(t),
@@ -8590,11 +8635,11 @@ function Lm(t) {
8590
8635
  forms: Uo(t),
8591
8636
  hooks: po(t),
8592
8637
  keys: Za(t),
8593
- loginSessions: So(t),
8638
+ loginSessions: To(t),
8594
8639
  logs: ua(t),
8595
8640
  passwords: ya(t),
8596
8641
  promptSettings: Eo(t),
8597
- refreshTokens: jo(t),
8642
+ refreshTokens: qo(t),
8598
8643
  resourceServers: Xo(t),
8599
8644
  rolePermissions: ui(t),
8600
8645
  userPermissions: mi(t),
@@ -8609,7 +8654,7 @@ function Lm(t) {
8609
8654
  };
8610
8655
  }
8611
8656
  export {
8612
- Lm as default,
8613
- jm as migrateDown,
8614
- qm as migrateToLatest
8657
+ Xm as default,
8658
+ Hm as migrateDown,
8659
+ Ym as migrateToLatest
8615
8660
  };