@authhero/kysely-adapter 10.56.0 → 10.57.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
- var Ma = Object.defineProperty;
1
+ var Ja = Object.defineProperty;
2
2
  var bn = (t) => {
3
3
  throw TypeError(t);
4
4
  };
5
- var qa = (t, e, n) => e in t ? Ma(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
5
+ var qa = (t, e, n) => e in t ? Ja(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
6
6
  var ie = (t, e, n) => qa(t, typeof e != "symbol" ? e + "" : e, n), Ut = (t, e, n) => e.has(t) || bn("Cannot " + n);
7
- var i = (t, e, n) => (Ut(t, e, "read from private field"), n ? n.call(t) : e.get(t)), C = (t, e, n) => e.has(t) ? bn("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), b = (t, e, n, a) => (Ut(t, e, "write to private field"), a ? a.call(t, n) : e.set(t, n), n), y = (t, e, n) => (Ut(t, e, "access private method"), n);
7
+ var i = (t, e, n) => (Ut(t, e, "read from private field"), n ? n.call(t) : e.get(t)), C = (t, e, n) => e.has(t) ? bn("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), b = (t, e, n, a) => (Ut(t, e, "write to private field"), a ? a.call(t, n) : e.set(t, n), n), w = (t, e, n) => (Ut(t, e, "access private method"), n);
8
8
  import { parseUserId as fn, codeSchema as Ba, connectionSchema as Wa, loginSessionSchema as Ka, promptSettingSchema as Ua, formSchema as bt, resourceServerSchema as Qa } from "@authhero/adapter-interfaces";
9
9
  import "@hono/zod-openapi";
10
10
  var Ze = class extends Error {
@@ -96,7 +96,7 @@ function Ga(t) {
96
96
  ]);
97
97
  if (!a)
98
98
  return null;
99
- const { tenant_id: o, ...u } = a, d = {
99
+ const { tenant_id: o, ...u } = a, c = {
100
100
  ...u,
101
101
  email: a.email || "",
102
102
  email_verified: a.email_verified === 1,
@@ -113,56 +113,56 @@ function Ga(t) {
113
113
  ...r.map(Qn)
114
114
  ]
115
115
  };
116
- return O(d);
116
+ return O(c);
117
117
  };
118
118
  }
119
- function M(t, e, n, a) {
119
+ function J(t, e, n, a) {
120
120
  const r = [];
121
121
  let o = "", u = !1;
122
- for (let c = 0; c < n.length; c++) {
123
- const h = n[c];
122
+ for (let l = 0; l < n.length; l++) {
123
+ const h = n[l];
124
124
  h === '"' ? (u = !u, o += h) : h === " " && !u ? o.trim() && (r.push(o.trim()), o = "") : o += h;
125
125
  }
126
- return o.trim() && r.push(o.trim()), r.map((c) => c.replace(/^([^:]+)=/g, "$1:")).map((c) => {
127
- let h = c.startsWith("-"), g = null, l = "", w = !1, f;
128
- if (c.startsWith("-_exists_:"))
129
- g = c.substring(10), w = !0, h = !0;
130
- else if (c.startsWith("_exists_:"))
131
- g = c.substring(9), w = !0, h = !1;
132
- else if (c.includes(":")) {
133
- const v = h ? c.substring(1) : c, x = v.indexOf(":");
134
- g = v.substring(0, x), l = v.substring(x + 1), w = !1, l.startsWith(">=") ? (f = ">=", l = l.substring(2)) : l.startsWith(">") ? (f = ">", l = l.substring(1)) : l.startsWith("<=") ? (f = "<=", l = l.substring(2)) : l.startsWith("<") ? (f = "<", l = l.substring(1)) : f = "=", l.startsWith('"') && l.endsWith('"') && l.length > 1 && (l = l.slice(1, -1));
126
+ return o.trim() && r.push(o.trim()), r.map((l) => l.replace(/^([^:]+)=/g, "$1:")).map((l) => {
127
+ let h = l.startsWith("-"), p = null, d = "", y = !1, f;
128
+ if (l.startsWith("-_exists_:"))
129
+ p = l.substring(10), y = !0, h = !0;
130
+ else if (l.startsWith("_exists_:"))
131
+ p = l.substring(9), y = !0, h = !1;
132
+ else if (l.includes(":")) {
133
+ const N = h ? l.substring(1) : l, x = N.indexOf(":");
134
+ p = N.substring(0, x), d = N.substring(x + 1), y = !1, d.startsWith(">=") ? (f = ">=", d = d.substring(2)) : d.startsWith(">") ? (f = ">", d = d.substring(1)) : d.startsWith("<=") ? (f = "<=", d = d.substring(2)) : d.startsWith("<") ? (f = "<", d = d.substring(1)) : f = "=", d.startsWith('"') && d.endsWith('"') && d.length > 1 && (d = d.slice(1, -1));
135
135
  } else
136
- g = null, l = c, w = !1;
137
- return { key: g, value: l, isNegation: h, isExistsQuery: w, operator: f };
138
- }).forEach(({ key: c, value: h, isNegation: g, isExistsQuery: l, operator: w }) => {
139
- if (c)
140
- if (l)
141
- g ? e = e.where(c, "is", null) : e = e.where(c, "is not", null);
142
- else if (g)
143
- switch (w) {
136
+ p = null, d = l, y = !1;
137
+ return { key: p, value: d, isNegation: h, isExistsQuery: y, operator: f };
138
+ }).forEach(({ key: l, value: h, isNegation: p, isExistsQuery: d, operator: y }) => {
139
+ if (l)
140
+ if (d)
141
+ p ? e = e.where(l, "is", null) : e = e.where(l, "is not", null);
142
+ else if (p)
143
+ switch (y) {
144
144
  case ">":
145
- e = e.where(c, "<=", h);
145
+ e = e.where(l, "<=", h);
146
146
  break;
147
147
  case ">=":
148
- e = e.where(c, "<", h);
148
+ e = e.where(l, "<", h);
149
149
  break;
150
150
  case "<":
151
- e = e.where(c, ">=", h);
151
+ e = e.where(l, ">=", h);
152
152
  break;
153
153
  case "<=":
154
- e = e.where(c, ">", h);
154
+ e = e.where(l, ">", h);
155
155
  break;
156
156
  default:
157
- e = e.where(c, "!=", h);
157
+ e = e.where(l, "!=", h);
158
158
  }
159
159
  else
160
- e = e.where(c, w, h);
160
+ e = e.where(l, y, h);
161
161
  else if (h) {
162
162
  const { ref: f } = t.dynamic;
163
163
  e = e.where(
164
- (v) => v.or(
165
- a.map((x) => v(f(x), "like", `%${h}%`))
164
+ (N) => N.or(
165
+ a.map((x) => N(f(x), "like", `%${h}%`))
166
166
  )
167
167
  );
168
168
  }
@@ -173,14 +173,14 @@ function j(t) {
173
173
  }
174
174
  function Ya(t) {
175
175
  return async (e, n = {}) => {
176
- const { page: a = 0, per_page: r = 50, include_totals: o = !1, sort: u, q: d } = n;
177
- let c = t.selectFrom("users").where("users.tenant_id", "=", e);
178
- if (d && (c = M(t, c, d, ["email", "name", "phone_number"])), u && u.sort_by) {
176
+ const { page: a = 0, per_page: r = 50, include_totals: o = !1, sort: u, q: c } = n;
177
+ let l = t.selectFrom("users").where("users.tenant_id", "=", e);
178
+ if (c && (l = J(t, l, c, ["email", "name", "phone_number"])), u && u.sort_by) {
179
179
  const { ref: x } = t.dynamic;
180
- c = c.orderBy(x(u.sort_by), u.sort_order);
180
+ l = l.orderBy(x(u.sort_by), u.sort_order);
181
181
  }
182
- const g = await c.offset(a * r).limit(r).selectAll().execute(), l = g.map((x) => x.user_id), w = l.length ? await t.selectFrom("users").selectAll().where("users.tenant_id", "=", e).where("users.linked_to", "in", l).execute() : [], f = g.map((x) => {
183
- const E = w.filter(
182
+ const p = await l.offset(a * r).limit(r).selectAll().execute(), d = p.map((x) => x.user_id), y = d.length ? await t.selectFrom("users").selectAll().where("users.tenant_id", "=", e).where("users.linked_to", "in", d).execute() : [], f = p.map((x) => {
183
+ const E = y.filter(
184
184
  (z) => z.linked_to === x.user_id
185
185
  );
186
186
  return O({
@@ -207,12 +207,12 @@ function Ya(t) {
207
207
  limit: 0,
208
208
  length: 0
209
209
  };
210
- const { count: v } = await c.select((x) => x.fn.countAll().as("count")).executeTakeFirstOrThrow();
210
+ const { count: N } = await l.select((x) => x.fn.countAll().as("count")).executeTakeFirstOrThrow();
211
211
  return {
212
212
  users: f,
213
213
  start: a * r,
214
214
  limit: r,
215
- length: j(v)
215
+ length: j(N)
216
216
  };
217
217
  };
218
218
  }
@@ -279,9 +279,9 @@ let nr = (t) => crypto.getRandomValues(new Uint8Array(t)), ar = (t, e, n) => {
279
279
  return (o = e) => {
280
280
  let u = "";
281
281
  for (; ; ) {
282
- let d = n(r), c = r | 0;
283
- for (; c--; )
284
- if (u += t[d[c] & a] || "", u.length >= o) return u;
282
+ let c = n(r), l = r | 0;
283
+ for (; l--; )
284
+ if (u += t[c[l] & a] || "", u.length >= o) return u;
285
285
  }
286
286
  };
287
287
  }, rr = (t, e = 21) => ar(t, e | 0, nr), re = (t = 21) => {
@@ -356,29 +356,29 @@ function sr(t) {
356
356
  function ur(t) {
357
357
  return async (e) => {
358
358
  let n = t.selectFrom("tenants");
359
- const { page: a = 0, per_page: r = 50, include_totals: o = !1, sort: u, q: d } = e;
359
+ const { page: a = 0, per_page: r = 50, include_totals: o = !1, sort: u, q: c } = e;
360
360
  if (u && u.sort_by) {
361
361
  const { ref: f } = t.dynamic;
362
362
  n = n.orderBy(f(u.sort_by), u.sort_order);
363
363
  }
364
- d && (n = n.where(
365
- (f) => f.or([f("friendly_name", "like", `%${d}%`)])
364
+ c && (n = n.where(
365
+ (f) => f.or([f("friendly_name", "like", `%${c}%`)])
366
366
  ));
367
- const g = (await n.offset(a * r).limit(r).selectAll().execute()).map(Yn);
367
+ const p = (await n.offset(a * r).limit(r).selectAll().execute()).map(Yn);
368
368
  if (!o)
369
369
  return {
370
- tenants: g
370
+ tenants: p
371
371
  };
372
- const { count: l } = await n.select((f) => f.fn.countAll().as("count")).executeTakeFirstOrThrow(), w = j(l);
372
+ const { count: d } = await n.select((f) => f.fn.countAll().as("count")).executeTakeFirstOrThrow(), y = j(d);
373
373
  return {
374
- tenants: g,
374
+ tenants: p,
375
375
  start: a * r,
376
376
  limit: r,
377
- length: w
377
+ length: y
378
378
  };
379
379
  };
380
380
  }
381
- function dr(t) {
381
+ function cr(t) {
382
382
  return async (e, n) => {
383
383
  const r = {
384
384
  ...Hn(n),
@@ -388,16 +388,16 @@ function dr(t) {
388
388
  await t.updateTable("tenants").set(r).where("id", "=", e).execute();
389
389
  };
390
390
  }
391
- function cr(t) {
391
+ function lr(t) {
392
392
  return async (e) => (await t.deleteFrom("tenants").where("tenants.id", "=", e).execute()).length === 1;
393
393
  }
394
- function lr(t) {
394
+ function dr(t) {
395
395
  return {
396
396
  create: ir(t),
397
397
  get: sr(t),
398
398
  list: ur(t),
399
- update: dr(t),
400
- remove: cr(t)
399
+ update: cr(t),
400
+ remove: lr(t)
401
401
  };
402
402
  }
403
403
  function On(t) {
@@ -406,18 +406,27 @@ function On(t) {
406
406
  const _r = 1024;
407
407
  function mr(t) {
408
408
  return async (e, n) => {
409
- var o, u, d;
410
- const a = n.user_agent.slice(0, _r), r = n.log_id || re();
409
+ var o, u, c, l, h, p, d, y, f, N, x;
410
+ const a = (o = n.user_agent) == null ? void 0 : o.slice(0, _r), r = n.log_id || re();
411
411
  return await t.insertInto("logs").values({
412
412
  ...n,
413
413
  log_id: r,
414
414
  tenant_id: e,
415
415
  user_agent: a,
416
- description: (o = n.description) == null ? void 0 : o.substring(0, 256),
416
+ description: (u = n.description) == null ? void 0 : u.substring(0, 256),
417
417
  isMobile: n.isMobile ? 1 : 0,
418
- scope: (u = n.scope) == null ? void 0 : u.join(","),
418
+ scope: n.scope,
419
419
  auth0_client: On(n.auth0_client),
420
- details: (d = On(n.details)) == null ? void 0 : d.substring(0, 8192)
420
+ details: (c = On(n.details)) == null ? void 0 : c.substring(0, 8192),
421
+ // Extract location_info fields for separate columns
422
+ country_code: (l = n.location_info) == null ? void 0 : l.country_code,
423
+ country_code3: (h = n.location_info) == null ? void 0 : h.country_code3,
424
+ country_name: (p = n.location_info) == null ? void 0 : p.country_name,
425
+ city_name: (d = n.location_info) == null ? void 0 : d.city_name,
426
+ latitude: (y = n.location_info) == null ? void 0 : y.latitude,
427
+ longitude: (f = n.location_info) == null ? void 0 : f.longitude,
428
+ time_zone: (N = n.location_info) == null ? void 0 : N.time_zone,
429
+ continent_code: (x = n.location_info) == null ? void 0 : x.continent_code
421
430
  }).execute(), {
422
431
  ...n,
423
432
  log_id: r,
@@ -442,35 +451,46 @@ function Xn(t) {
442
451
  auth0_client: Tn(t.auth0_client),
443
452
  details: Tn(t.details),
444
453
  isMobile: !!t.isMobile,
445
- scope: t.scope ? t.scope.split(",") : void 0,
446
- log_id: t.log_id
454
+ scope: t.scope || void 0,
455
+ log_id: t.log_id,
456
+ // Reconstruct location_info from separate columns
457
+ location_info: t.country_code ? {
458
+ country_code: t.country_code,
459
+ country_code3: t.country_code3 || "",
460
+ country_name: t.country_name || "",
461
+ city_name: t.city_name || "",
462
+ latitude: t.latitude || "",
463
+ longitude: t.longitude || "",
464
+ time_zone: t.time_zone || "",
465
+ continent_code: t.continent_code || ""
466
+ } : void 0
447
467
  };
448
468
  }
449
469
  function hr(t) {
450
470
  return async (e, n = {}) => {
451
- const { page: a = 0, per_page: r = 50, include_totals: o = !1, sort: u, q: d } = n;
452
- let c = t.selectFrom("logs").where("logs.tenant_id", "=", e);
453
- d && (c = M(t, c, d, ["user_id", "ip"]));
454
- let h = c;
471
+ const { page: a = 0, per_page: r = 50, include_totals: o = !1, sort: u, q: c } = n;
472
+ let l = t.selectFrom("logs").where("logs.tenant_id", "=", e);
473
+ c && (l = J(t, l, c, ["user_id", "ip"]));
474
+ let h = l;
455
475
  if (u && u.sort_by) {
456
476
  const { ref: f } = t.dynamic;
457
477
  h = h.orderBy(f(u.sort_by), u.sort_order);
458
478
  }
459
479
  h = h.offset(a * r).limit(r);
460
- const l = (await h.selectAll().execute()).map(Xn);
480
+ const d = (await h.selectAll().execute()).map(Xn);
461
481
  if (!o)
462
482
  return {
463
- logs: l,
483
+ logs: d,
464
484
  start: 0,
465
485
  limit: 0,
466
486
  length: 0
467
487
  };
468
- const { count: w } = await c.select((f) => f.fn.countAll().as("count")).executeTakeFirstOrThrow();
488
+ const { count: y } = await l.select((f) => f.fn.countAll().as("count")).executeTakeFirstOrThrow();
469
489
  return {
470
- logs: l,
490
+ logs: d,
471
491
  start: a * r,
472
492
  limit: r,
473
- length: j(w)
493
+ length: j(y)
474
494
  };
475
495
  };
476
496
  }
@@ -492,9 +512,9 @@ function gr(t) {
492
512
  const a = await t.selectFrom("sessions").where("sessions.tenant_id", "=", e).where("sessions.id", "=", n).selectAll().executeTakeFirst();
493
513
  if (!a)
494
514
  return null;
495
- const { tenant_id: r, device: o, clients: u, ...d } = a;
515
+ const { tenant_id: r, device: o, clients: u, ...c } = a;
496
516
  return {
497
- ...d,
517
+ ...c,
498
518
  device: JSON.parse(o),
499
519
  clients: JSON.parse(u)
500
520
  };
@@ -533,30 +553,30 @@ function Nr(t) {
533
553
  }
534
554
  function vr(t) {
535
555
  return async (e, n = {}) => {
536
- const { page: a = 0, per_page: r = 50, include_totals: o = !1, sort: u, q: d } = n;
537
- let c = t.selectFrom("sessions").where("sessions.tenant_id", "=", e);
538
- d && (c = M(t, c, d, ["user_id", "session_id"]));
539
- let h = c;
556
+ const { page: a = 0, per_page: r = 50, include_totals: o = !1, sort: u, q: c } = n;
557
+ let l = t.selectFrom("sessions").where("sessions.tenant_id", "=", e);
558
+ c && (l = J(t, l, c, ["user_id", "session_id"]));
559
+ let h = l;
540
560
  if (u && u.sort_by) {
541
- const { ref: v } = t.dynamic;
542
- h = h.orderBy(v(u.sort_by), u.sort_order);
561
+ const { ref: N } = t.dynamic;
562
+ h = h.orderBy(N(u.sort_by), u.sort_order);
543
563
  }
544
564
  h = h.offset(a * r).limit(r);
545
- const l = (await h.selectAll().execute()).map((v) => ({
546
- ...v,
547
- device: JSON.parse(v.device),
548
- clients: JSON.parse(v.clients)
565
+ const d = (await h.selectAll().execute()).map((N) => ({
566
+ ...N,
567
+ device: JSON.parse(N.device),
568
+ clients: JSON.parse(N.clients)
549
569
  }));
550
570
  if (!o)
551
571
  return {
552
- sessions: l,
572
+ sessions: d,
553
573
  start: 0,
554
574
  limit: 0,
555
575
  length: 0
556
576
  };
557
- const { count: w } = await c.select((v) => v.fn.countAll().as("count")).executeTakeFirstOrThrow(), f = j(w);
577
+ const { count: y } = await l.select((N) => N.fn.countAll().as("count")).executeTakeFirstOrThrow(), f = j(y);
558
578
  return {
559
- sessions: l,
579
+ sessions: d,
560
580
  start: a * r,
561
581
  limit: r,
562
582
  length: f
@@ -610,25 +630,25 @@ function Tr(t) {
610
630
  function Sr(t) {
611
631
  return async (e, n = {}) => {
612
632
  const { page: a = 0, per_page: r = 50, include_totals: o = !1, q: u } = n;
613
- let d = t.selectFrom("codes").where("codes.tenant_id", "=", e);
614
- u && (d = M(t, d, u, ["code", "login_id"]));
615
- const g = (await d.offset(a * r).limit(r).selectAll().execute()).map((w) => {
616
- const { tenant_id: f, ...v } = w;
617
- return Ba.parse(O(v));
633
+ let c = t.selectFrom("codes").where("codes.tenant_id", "=", e);
634
+ u && (c = J(t, c, u, ["code", "login_id"]));
635
+ const p = (await c.offset(a * r).limit(r).selectAll().execute()).map((y) => {
636
+ const { tenant_id: f, ...N } = y;
637
+ return Ba.parse(O(N));
618
638
  });
619
639
  if (!o)
620
640
  return {
621
- codes: g,
641
+ codes: p,
622
642
  start: 0,
623
643
  limit: 0,
624
644
  length: 0
625
645
  };
626
- const { count: l } = await d.select((w) => w.fn.countAll().as("count")).executeTakeFirstOrThrow();
646
+ const { count: d } = await c.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
627
647
  return {
628
- codes: g,
648
+ codes: p,
629
649
  start: a * r,
630
650
  limit: r,
631
- length: j(l)
651
+ length: j(d)
632
652
  };
633
653
  };
634
654
  }
@@ -696,7 +716,7 @@ function jr() {
696
716
  function Lr() {
697
717
  return Nt("invite");
698
718
  }
699
- function Jr(t) {
719
+ function Mr(t) {
700
720
  return async (e, n) => {
701
721
  const a = {
702
722
  id: n.id || Rr(),
@@ -712,30 +732,30 @@ function Jr(t) {
712
732
  }).execute(), a;
713
733
  };
714
734
  }
715
- function Mr(t) {
735
+ function Jr(t) {
716
736
  return async (e, n = {}) => {
717
737
  const { page: a = 0, per_page: r = 50, include_totals: o = !1, q: u } = n;
718
- let d = t.selectFrom("connections").where("connections.tenant_id", "=", e);
719
- u && (d = M(t, d, u, ["user_id", "ip"]));
720
- const g = (await d.offset(a * r).limit(r).selectAll().execute()).map(
721
- (w) => O({
722
- ...w,
723
- options: JSON.parse(w.options)
738
+ let c = t.selectFrom("connections").where("connections.tenant_id", "=", e);
739
+ u && (c = J(t, c, u, ["user_id", "ip"]));
740
+ const p = (await c.offset(a * r).limit(r).selectAll().execute()).map(
741
+ (y) => O({
742
+ ...y,
743
+ options: JSON.parse(y.options)
724
744
  })
725
745
  );
726
746
  if (!o)
727
747
  return {
728
- connections: g,
748
+ connections: p,
729
749
  start: 0,
730
750
  limit: 0,
731
751
  length: 0
732
752
  };
733
- const { count: l } = await d.select((w) => w.fn.countAll().as("count")).executeTakeFirstOrThrow();
753
+ const { count: d } = await c.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
734
754
  return {
735
- connections: g,
755
+ connections: p,
736
756
  start: a * r,
737
757
  limit: r,
738
- length: j(l)
758
+ length: j(d)
739
759
  };
740
760
  };
741
761
  }
@@ -765,9 +785,9 @@ function Wr(t) {
765
785
  }
766
786
  function Kr(t) {
767
787
  return {
768
- create: Jr(t),
788
+ create: Mr(t),
769
789
  get: Br(t),
770
- list: Mr(t),
790
+ list: Jr(t),
771
791
  remove: qr(t),
772
792
  update: Wr(t)
773
793
  };
@@ -987,27 +1007,27 @@ function Hr(t) {
987
1007
  }
988
1008
  function Xr(t) {
989
1009
  return async (e, n) => {
990
- const a = (/* @__PURE__ */ new Date()).toISOString(), r = re(), { scope: o, authorization_details_types: u, ...d } = n, c = {
1010
+ const a = (/* @__PURE__ */ new Date()).toISOString(), r = re(), { scope: o, authorization_details_types: u, ...c } = n, l = {
991
1011
  id: r,
992
1012
  tenant_id: e,
993
- ...d,
1013
+ ...c,
994
1014
  scope: o ? JSON.stringify(o) : "[]",
995
1015
  authorization_details_types: u ? JSON.stringify(u) : "[]",
996
1016
  // Convert booleans to integers for database storage
997
- allow_any_organization: d.allow_any_organization !== void 0 ? d.allow_any_organization ? 1 : 0 : void 0,
998
- is_system: d.is_system !== void 0 ? d.is_system ? 1 : 0 : void 0,
1017
+ allow_any_organization: c.allow_any_organization !== void 0 ? c.allow_any_organization ? 1 : 0 : void 0,
1018
+ is_system: c.is_system !== void 0 ? c.is_system ? 1 : 0 : void 0,
999
1019
  created_at: a,
1000
1020
  updated_at: a
1001
1021
  };
1002
- return await t.insertInto("client_grants").values(c).execute(), O({
1022
+ return await t.insertInto("client_grants").values(l).execute(), O({
1003
1023
  id: r,
1004
1024
  tenant_id: e,
1005
- ...d,
1025
+ ...c,
1006
1026
  scope: o || [],
1007
1027
  authorization_details_types: u || [],
1008
1028
  // Ensure boolean fields have proper defaults
1009
- allow_any_organization: d.allow_any_organization ?? !1,
1010
- is_system: d.is_system ?? !1,
1029
+ allow_any_organization: c.allow_any_organization ?? !1,
1030
+ is_system: c.is_system ?? !1,
1011
1031
  created_at: a,
1012
1032
  updated_at: a
1013
1033
  });
@@ -1037,29 +1057,29 @@ function Zr(t) {
1037
1057
  }
1038
1058
  function eo(t) {
1039
1059
  return async (e, n = {}) => {
1040
- const { page: a = 0, per_page: r = 50, include_totals: o = !1, q: u, sort: d } = n;
1041
- let c = t.selectFrom("client_grants").where("client_grants.tenant_id", "=", e);
1060
+ const { page: a = 0, per_page: r = 50, include_totals: o = !1, q: u, sort: c } = n;
1061
+ let l = t.selectFrom("client_grants").where("client_grants.tenant_id", "=", e);
1042
1062
  if (u) {
1043
- const f = u.trim(), v = f.split(/\s+/), x = v.length === 1 ? v[0] : void 0, E = x ? x.match(/^(-)?([a-zA-Z_][a-zA-Z0-9_]*):"?([^"]*)"?$/) : null, z = E ? E[3] : "", oe = /^(>=|>|<=|<)/.test(z || "");
1063
+ const f = u.trim(), N = f.split(/\s+/), x = N.length === 1 ? N[0] : void 0, E = x ? x.match(/^(-)?([a-zA-Z_][a-zA-Z0-9_]*):"?([^"]*)"?$/) : null, z = E ? E[3] : "", oe = /^(>=|>|<=|<)/.test(z || "");
1044
1064
  if (E && !oe && z) {
1045
1065
  const U = !!E[1], we = E[2], { ref: vt } = t.dynamic, Ne = vt(`client_grants.${we}`);
1046
1066
  if (we === "allow_any_organization") {
1047
1067
  const at = z === "true" ? 1 : 0;
1048
- U ? c = c.where(Ne, "!=", at) : c = c.where(Ne, "=", at);
1068
+ U ? l = l.where(Ne, "!=", at) : l = l.where(Ne, "=", at);
1049
1069
  } else
1050
- U ? c = c.where(Ne, "!=", z) : c = c.where(Ne, "=", z);
1070
+ U ? l = l.where(Ne, "!=", z) : l = l.where(Ne, "=", z);
1051
1071
  } else
1052
- c = M(t, c, f, []);
1072
+ l = J(t, l, f, []);
1053
1073
  }
1054
- let h = c;
1055
- if (d) {
1074
+ let h = l;
1075
+ if (c) {
1056
1076
  const { ref: f } = t.dynamic;
1057
- h = h.orderBy(f(d.sort_by), d.sort_order);
1077
+ h = h.orderBy(f(c.sort_by), c.sort_order);
1058
1078
  } else
1059
1079
  h = h.orderBy("client_grants.created_at", "desc");
1060
1080
  h = h.limit(r).offset(a * r);
1061
- const l = (await h.selectAll().execute()).map((f) => {
1062
- const v = {
1081
+ const d = (await h.selectAll().execute()).map((f) => {
1082
+ const N = {
1063
1083
  id: f.id,
1064
1084
  client_id: f.client_id,
1065
1085
  audience: f.audience,
@@ -1073,21 +1093,21 @@ function eo(t) {
1073
1093
  created_at: f.created_at,
1074
1094
  updated_at: f.updated_at
1075
1095
  };
1076
- return O(v);
1096
+ return O(N);
1077
1097
  });
1078
1098
  if (!o)
1079
1099
  return {
1080
- client_grants: l,
1100
+ client_grants: d,
1081
1101
  start: 0,
1082
1102
  limit: 0,
1083
1103
  length: 0
1084
1104
  };
1085
- const { count: w } = await c.select((f) => f.fn.countAll().as("count")).executeTakeFirstOrThrow();
1105
+ const { count: y } = await l.select((f) => f.fn.countAll().as("count")).executeTakeFirstOrThrow();
1086
1106
  return {
1087
- client_grants: l,
1107
+ client_grants: d,
1088
1108
  start: a * r,
1089
1109
  limit: r,
1090
- length: j(w)
1110
+ length: j(y)
1091
1111
  };
1092
1112
  };
1093
1113
  }
@@ -1096,13 +1116,13 @@ function to(t) {
1096
1116
  }
1097
1117
  function no(t) {
1098
1118
  return async (e, n, a) => {
1099
- const r = (/* @__PURE__ */ new Date()).toISOString(), { scope: o, authorization_details_types: u, ...d } = a, c = {
1100
- ...d,
1119
+ const r = (/* @__PURE__ */ new Date()).toISOString(), { scope: o, authorization_details_types: u, ...c } = a, l = {
1120
+ ...c,
1101
1121
  updated_at: r
1102
1122
  };
1103
- return o !== void 0 && (c.scope = JSON.stringify(o)), u !== void 0 && (c.authorization_details_types = JSON.stringify(
1123
+ return o !== void 0 && (l.scope = JSON.stringify(o)), u !== void 0 && (l.authorization_details_types = JSON.stringify(
1104
1124
  u
1105
- )), 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;
1125
+ )), c.allow_any_organization !== void 0 && (l.allow_any_organization = c.allow_any_organization ? 1 : 0), c.is_system !== void 0 && (l.is_system = c.is_system ? 1 : 0), ((await t.updateTable("client_grants").set(l).where("client_grants.tenant_id", "=", e).where("client_grants.id", "=", n).executeTakeFirst()).numUpdatedRows ?? 0n) > 0n;
1106
1126
  };
1107
1127
  }
1108
1128
  function ao(t) {
@@ -1138,10 +1158,10 @@ function ro(t) {
1138
1158
  require_proof_of_possession: !!n.require_proof_of_possession,
1139
1159
  // Parse JSON string fields back to objects/arrays
1140
1160
  connections: r.map(
1141
- (d) => Wa.parse(
1161
+ (c) => Wa.parse(
1142
1162
  O({
1143
- ...d,
1144
- options: d.options ? JSON.parse(d.options) : {}
1163
+ ...c,
1164
+ options: c.options ? JSON.parse(c.options) : {}
1145
1165
  })
1146
1166
  )
1147
1167
  ),
@@ -1180,36 +1200,36 @@ function oo(t) {
1180
1200
  sort: o,
1181
1201
  q: u
1182
1202
  } = e;
1183
- let d = t.selectFrom("keys").where(
1203
+ let c = t.selectFrom("keys").where(
1184
1204
  (f) => f.or([
1185
1205
  f("revoked_at", ">", (/* @__PURE__ */ new Date()).toISOString()),
1186
1206
  f("revoked_at", "is", null)
1187
1207
  ])
1188
1208
  );
1189
- u && (d = M(t, d, u, [
1209
+ u && (c = J(t, c, u, [
1190
1210
  "kid",
1191
1211
  "connection",
1192
1212
  "fingerprint",
1193
1213
  "thumbprint",
1194
1214
  "type"
1195
1215
  ]));
1196
- let c = d.select((f) => f.fn.count("kid").as("count"));
1216
+ let l = c.select((f) => f.fn.count("kid").as("count"));
1197
1217
  const h = n * a;
1198
- d = d.limit(a).offset(h), o && (d = d.orderBy(o.sort_by, o.sort_order));
1199
- const g = await d.selectAll().execute();
1218
+ c = c.limit(a).offset(h), o && (c = c.orderBy(o.sort_by, o.sort_order));
1219
+ const p = await c.selectAll().execute();
1200
1220
  if (!r)
1201
1221
  return {
1202
- signingKeys: g,
1222
+ signingKeys: p,
1203
1223
  start: 0,
1204
1224
  limit: 0,
1205
1225
  length: 0
1206
1226
  };
1207
- const l = await c.executeTakeFirst(), w = j((l == null ? void 0 : l.count) ?? 0);
1227
+ const d = await l.executeTakeFirst(), y = j((d == null ? void 0 : d.count) ?? 0);
1208
1228
  return {
1209
- signingKeys: g,
1229
+ signingKeys: p,
1210
1230
  start: h,
1211
1231
  limit: a,
1212
- length: w
1232
+ length: y
1213
1233
  };
1214
1234
  };
1215
1235
  }
@@ -1302,20 +1322,20 @@ function go(t) {
1302
1322
  colors_primary: r,
1303
1323
  colors_page_background_type: o,
1304
1324
  colors_page_background_start: u,
1305
- colors_page_background_end: d,
1306
- colors_page_background_angle_dev: c,
1325
+ colors_page_background_end: c,
1326
+ colors_page_background_angle_dev: l,
1307
1327
  font_url: h,
1308
- ...g
1328
+ ...p
1309
1329
  } = n;
1310
1330
  return O({
1311
- ...g,
1331
+ ...p,
1312
1332
  colors: {
1313
1333
  primary: r,
1314
1334
  page_background: {
1315
1335
  type: o,
1316
1336
  start: u,
1317
- end: d,
1318
- angle_deg: c
1337
+ end: c,
1338
+ angle_deg: l
1319
1339
  }
1320
1340
  },
1321
1341
  font: h ? { url: h } : void 0
@@ -1324,17 +1344,17 @@ function go(t) {
1324
1344
  }
1325
1345
  function yo(t) {
1326
1346
  return async (e, n) => {
1327
- var u, d, c, h, g, l, w, f, v, x, E, z, oe, U, we, vt, Ne, at;
1347
+ var u, c, l, h, p, d, y, f, N, x, E, z, oe, U, we, vt, Ne, at;
1328
1348
  const { colors: a, font: r, ...o } = n;
1329
1349
  try {
1330
1350
  await t.insertInto("branding").values({
1331
1351
  ...o,
1332
1352
  colors_primary: a == null ? void 0 : a.primary,
1333
- colors_page_background_type: (d = (u = n.colors) == null ? void 0 : u.page_background) == null ? void 0 : d.type,
1334
- colors_page_background_start: (h = (c = n.colors) == null ? void 0 : c.page_background) == null ? void 0 : h.start,
1335
- colors_page_background_end: (l = (g = n.colors) == null ? void 0 : g.page_background) == null ? void 0 : l.end,
1336
- colors_page_background_angle_dev: (f = (w = n.colors) == null ? void 0 : w.page_background) == null ? void 0 : f.angle_deg,
1337
- font_url: (v = n.font) == null ? void 0 : v.url,
1353
+ colors_page_background_type: (c = (u = n.colors) == null ? void 0 : u.page_background) == null ? void 0 : c.type,
1354
+ colors_page_background_start: (h = (l = n.colors) == null ? void 0 : l.page_background) == null ? void 0 : h.start,
1355
+ colors_page_background_end: (d = (p = n.colors) == null ? void 0 : p.page_background) == null ? void 0 : d.end,
1356
+ colors_page_background_angle_dev: (f = (y = n.colors) == null ? void 0 : y.page_background) == null ? void 0 : f.angle_deg,
1357
+ font_url: (N = n.font) == null ? void 0 : N.url,
1338
1358
  tenant_id: e
1339
1359
  }).execute();
1340
1360
  } catch {
@@ -1359,29 +1379,29 @@ function wo(t) {
1359
1379
  function No(t) {
1360
1380
  return async (e, n = {}) => {
1361
1381
  const { page: a = 0, per_page: r = 50, include_totals: o = !1, q: u } = n;
1362
- let d = t.selectFrom("hooks").where("hooks.tenant_id", "=", e);
1363
- u && (d = M(t, d, u, ["url", "form_id"]));
1364
- const g = (await d.offset(a * r).limit(r).selectAll().execute()).map((w) => {
1365
- const { tenant_id: f, enabled: v, synchronous: x, ...E } = w;
1382
+ let c = t.selectFrom("hooks").where("hooks.tenant_id", "=", e);
1383
+ u && (c = J(t, c, u, ["url", "form_id"]));
1384
+ const p = (await c.offset(a * r).limit(r).selectAll().execute()).map((y) => {
1385
+ const { tenant_id: f, enabled: N, synchronous: x, ...E } = y;
1366
1386
  return O({
1367
1387
  ...E,
1368
- enabled: !!v,
1388
+ enabled: !!N,
1369
1389
  synchronous: !!x
1370
1390
  });
1371
1391
  });
1372
1392
  if (!o)
1373
1393
  return {
1374
- hooks: g,
1394
+ hooks: p,
1375
1395
  start: 0,
1376
1396
  limit: 0,
1377
1397
  length: 0
1378
1398
  };
1379
- const { count: l } = await d.select((w) => w.fn.countAll().as("count")).executeTakeFirstOrThrow();
1399
+ const { count: d } = await c.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
1380
1400
  return {
1381
- hooks: g,
1401
+ hooks: p,
1382
1402
  start: a * r,
1383
1403
  limit: r,
1384
- length: j(l)
1404
+ length: j(d)
1385
1405
  };
1386
1406
  };
1387
1407
  }
@@ -1592,17 +1612,17 @@ function Lo(t) {
1592
1612
  credentials: r,
1593
1613
  settings: o,
1594
1614
  enabled: u,
1595
- ...d
1615
+ ...c
1596
1616
  } = n;
1597
1617
  return O({
1598
- ...d,
1618
+ ...c,
1599
1619
  credentials: JSON.parse(r),
1600
1620
  settings: JSON.parse(o),
1601
1621
  enabled: !!u
1602
1622
  });
1603
1623
  };
1604
1624
  }
1605
- function Jo(t) {
1625
+ function Mo(t) {
1606
1626
  return async (e, n) => {
1607
1627
  const { credentials: a, settings: r, enabled: o, ...u } = n;
1608
1628
  await t.updateTable("email_providers").set({
@@ -1613,7 +1633,7 @@ function Jo(t) {
1613
1633
  }).where("tenant_id", "=", e).execute();
1614
1634
  };
1615
1635
  }
1616
- function Mo(t) {
1636
+ function Jo(t) {
1617
1637
  return async (e, n) => {
1618
1638
  const { credentials: a, settings: r, enabled: o, ...u } = n;
1619
1639
  await t.insertInto("email_providers").values({
@@ -1630,8 +1650,8 @@ function Mo(t) {
1630
1650
  function qo(t) {
1631
1651
  return {
1632
1652
  get: Lo(t),
1633
- create: Mo(t),
1634
- update: Jo(t)
1653
+ create: Jo(t),
1654
+ update: Mo(t)
1635
1655
  };
1636
1656
  }
1637
1657
  function Bo(t) {
@@ -1676,31 +1696,31 @@ function Uo(t) {
1676
1696
  }
1677
1697
  function Qo(t) {
1678
1698
  return async (e, n = {}) => {
1679
- const { page: a = 0, per_page: r = 50, include_totals: o = !1, sort: u, q: d } = n;
1680
- let c = t.selectFrom("refresh_tokens").where("refresh_tokens.tenant_id", "=", e);
1681
- d && (c = M(t, c, d, ["token", "session_id"]));
1682
- let h = c;
1699
+ const { page: a = 0, per_page: r = 50, include_totals: o = !1, sort: u, q: c } = n;
1700
+ let l = t.selectFrom("refresh_tokens").where("refresh_tokens.tenant_id", "=", e);
1701
+ c && (l = J(t, l, c, ["token", "session_id"]));
1702
+ let h = l;
1683
1703
  if (u && u.sort_by) {
1684
- const { ref: v } = t.dynamic;
1685
- h = h.orderBy(v(u.sort_by), u.sort_order);
1704
+ const { ref: N } = t.dynamic;
1705
+ h = h.orderBy(N(u.sort_by), u.sort_order);
1686
1706
  }
1687
1707
  h = h.offset(a * r).limit(r);
1688
- const l = (await h.selectAll().execute()).map((v) => ({
1689
- ...v,
1690
- rotating: !!v.rotating,
1691
- device: v.device ? JSON.parse(v.device) : {},
1692
- resource_servers: v.resource_servers ? JSON.parse(v.resource_servers) : []
1708
+ const d = (await h.selectAll().execute()).map((N) => ({
1709
+ ...N,
1710
+ rotating: !!N.rotating,
1711
+ device: N.device ? JSON.parse(N.device) : {},
1712
+ resource_servers: N.resource_servers ? JSON.parse(N.resource_servers) : []
1693
1713
  }));
1694
1714
  if (!o)
1695
1715
  return {
1696
- refresh_tokens: l,
1716
+ refresh_tokens: d,
1697
1717
  start: 0,
1698
1718
  limit: 0,
1699
1719
  length: 0
1700
1720
  };
1701
- const { count: w } = await c.select((v) => v.fn.countAll().as("count")).executeTakeFirstOrThrow(), f = j(w);
1721
+ const { count: y } = await l.select((N) => N.fn.countAll().as("count")).executeTakeFirstOrThrow(), f = j(y);
1702
1722
  return {
1703
- refresh_tokens: l,
1723
+ refresh_tokens: d,
1704
1724
  start: a * r,
1705
1725
  limit: r,
1706
1726
  length: f
@@ -1767,10 +1787,10 @@ function Yo(t) {
1767
1787
  function Ho(t) {
1768
1788
  return async (e, n = {}) => {
1769
1789
  const { page: a = 0, per_page: r = 50, include_totals: o = !1, q: u } = n;
1770
- let d = t.selectFrom("forms").where("tenant_id", "=", e);
1771
- u && (d = M(t, d, u, []));
1772
- const g = (await d.offset(a * r).limit(r).selectAll().execute()).map((w) => {
1773
- const f = { ...w };
1790
+ let c = t.selectFrom("forms").where("tenant_id", "=", e);
1791
+ u && (c = J(t, c, u, []));
1792
+ const p = (await c.offset(a * r).limit(r).selectAll().execute()).map((y) => {
1793
+ const f = { ...y };
1774
1794
  if (typeof f.nodes == "string")
1775
1795
  try {
1776
1796
  f.nodes = JSON.parse(f.nodes);
@@ -1790,17 +1810,17 @@ function Ho(t) {
1790
1810
  });
1791
1811
  if (!o)
1792
1812
  return {
1793
- forms: g,
1813
+ forms: p,
1794
1814
  start: 0,
1795
1815
  limit: 0,
1796
1816
  length: 0
1797
1817
  };
1798
- const { count: l } = await d.select((w) => w.fn.countAll().as("count")).executeTakeFirstOrThrow();
1818
+ const { count: d } = await c.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
1799
1819
  return {
1800
- forms: g,
1820
+ forms: p,
1801
1821
  start: a * r,
1802
1822
  limit: r,
1803
- length: j(l)
1823
+ length: j(d)
1804
1824
  };
1805
1825
  };
1806
1826
  }
@@ -1862,23 +1882,23 @@ function ni(t) {
1862
1882
  updated_at: a
1863
1883
  }, o = Qa.parse(r), {
1864
1884
  verificationKey: u,
1865
- scopes: d,
1866
- options: c,
1885
+ scopes: c,
1886
+ options: l,
1867
1887
  skip_consent_for_verifiable_first_party_clients: h,
1868
- allow_offline_access: g,
1869
- ...l
1870
- } = o, w = {
1871
- ...l,
1888
+ allow_offline_access: p,
1889
+ ...d
1890
+ } = o, y = {
1891
+ ...d,
1872
1892
  tenant_id: e,
1873
- scopes: d ? JSON.stringify(d) : "[]",
1874
- options: c ? JSON.stringify(c) : "{}",
1893
+ scopes: c ? JSON.stringify(c) : "[]",
1894
+ options: l ? JSON.stringify(l) : "{}",
1875
1895
  skip_consent_for_verifiable_first_party_clients: h ? 1 : 0,
1876
- allow_offline_access: g ? 1 : 0,
1896
+ allow_offline_access: p ? 1 : 0,
1877
1897
  verification_key: u,
1878
1898
  created_at: a,
1879
1899
  updated_at: a
1880
1900
  };
1881
- return await t.insertInto("resource_servers").values(w).execute(), O(o);
1901
+ return await t.insertInto("resource_servers").values(y).execute(), O(o);
1882
1902
  };
1883
1903
  }
1884
1904
  function ai(t) {
@@ -1888,40 +1908,40 @@ function ai(t) {
1888
1908
  const r = a, {
1889
1909
  verification_key: o,
1890
1910
  scopes: u,
1891
- options: d,
1892
- skip_consent_for_verifiable_first_party_clients: c,
1911
+ options: c,
1912
+ skip_consent_for_verifiable_first_party_clients: l,
1893
1913
  allow_offline_access: h,
1894
- ...g
1895
- } = r, l = {
1896
- ...g,
1914
+ ...p
1915
+ } = r, d = {
1916
+ ...p,
1897
1917
  scopes: u ? JSON.parse(u) : [],
1898
- options: d ? JSON.parse(d) : {},
1899
- skip_consent_for_verifiable_first_party_clients: !!c,
1918
+ options: c ? JSON.parse(c) : {},
1919
+ skip_consent_for_verifiable_first_party_clients: !!l,
1900
1920
  allow_offline_access: !!h,
1901
1921
  // Convert verification_key back to verificationKey for API
1902
1922
  verificationKey: o
1903
1923
  };
1904
- return O(l);
1924
+ return O(d);
1905
1925
  };
1906
1926
  }
1907
1927
  function ri(t) {
1908
1928
  return async (e, n = {}) => {
1909
1929
  const { page: a = 0, per_page: r = 50, include_totals: o = !1, q: u } = n;
1910
- let d = t.selectFrom("resource_servers").where("resource_servers.tenant_id", "=", e);
1930
+ let c = t.selectFrom("resource_servers").where("resource_servers.tenant_id", "=", e);
1911
1931
  if (u) {
1912
- const w = u.trim(), f = w.split(/\s+/), v = f.length === 1 ? f[0] : void 0, x = v ? v.match(/^(-)?(name|identifier):(.*)$/) : null, E = x ? x[3] : "", z = /^(>=|>|<=|<)/.test(E || "");
1932
+ const y = u.trim(), f = y.split(/\s+/), N = f.length === 1 ? f[0] : void 0, x = N ? N.match(/^(-)?(name|identifier):(.*)$/) : null, E = x ? x[3] : "", z = /^(>=|>|<=|<)/.test(E || "");
1913
1933
  if (x && !z) {
1914
1934
  const oe = !!x[1], U = x[2] === "name" ? "resource_servers.name" : "resource_servers.identifier";
1915
- d = oe ? d.where(U, "not like", `%${E}%`) : d.where(U, "like", `%${E}%`);
1935
+ c = oe ? c.where(U, "not like", `%${E}%`) : c.where(U, "like", `%${E}%`);
1916
1936
  } else
1917
- d = M(t, d, w, [
1937
+ c = J(t, c, y, [
1918
1938
  "resource_servers.name",
1919
1939
  "resource_servers.identifier"
1920
1940
  ]);
1921
1941
  }
1922
- const g = (await d.offset(a * r).limit(r).selectAll().execute()).map((w) => {
1923
- const f = w, {
1924
- verification_key: v,
1942
+ const p = (await c.offset(a * r).limit(r).selectAll().execute()).map((y) => {
1943
+ const f = y, {
1944
+ verification_key: N,
1925
1945
  scopes: x,
1926
1946
  options: E,
1927
1947
  skip_consent_for_verifiable_first_party_clients: z,
@@ -1934,23 +1954,23 @@ function ri(t) {
1934
1954
  skip_consent_for_verifiable_first_party_clients: !!z,
1935
1955
  allow_offline_access: !!oe,
1936
1956
  // Convert verification_key back to verificationKey for API
1937
- verificationKey: v
1957
+ verificationKey: N
1938
1958
  };
1939
1959
  return O(we);
1940
1960
  });
1941
1961
  if (!o)
1942
1962
  return {
1943
- resource_servers: g,
1963
+ resource_servers: p,
1944
1964
  start: 0,
1945
1965
  limit: 0,
1946
1966
  length: 0
1947
1967
  };
1948
- const { count: l } = await d.select((w) => w.fn.countAll().as("count")).executeTakeFirstOrThrow();
1968
+ const { count: d } = await c.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
1949
1969
  return {
1950
- resource_servers: g,
1970
+ resource_servers: p,
1951
1971
  start: a * r,
1952
1972
  limit: r,
1953
- length: j(l)
1973
+ length: j(d)
1954
1974
  };
1955
1975
  };
1956
1976
  }
@@ -1966,20 +1986,20 @@ function ii(t) {
1966
1986
  verificationKey: r,
1967
1987
  scopes: o,
1968
1988
  options: u,
1969
- skip_consent_for_verifiable_first_party_clients: d,
1970
- allow_offline_access: c,
1989
+ skip_consent_for_verifiable_first_party_clients: c,
1990
+ allow_offline_access: l,
1971
1991
  ...h
1972
- } = a, g = {
1992
+ } = a, p = {
1973
1993
  ...h,
1974
1994
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
1975
1995
  };
1976
- if (r !== void 0 && (g.verification_key = r), o !== void 0 && (g.scopes = JSON.stringify(o)), u !== void 0) {
1977
- const w = await t.selectFrom("resource_servers").select("options").where("tenant_id", "=", e).where("id", "=", n).executeTakeFirst(), v = { ...w != null && w.options ? JSON.parse(w.options) : {}, ...u };
1978
- g.options = JSON.stringify(v);
1996
+ if (r !== void 0 && (p.verification_key = r), o !== void 0 && (p.scopes = JSON.stringify(o)), u !== void 0) {
1997
+ const y = await t.selectFrom("resource_servers").select("options").where("tenant_id", "=", e).where("id", "=", n).executeTakeFirst(), N = { ...y != null && y.options ? JSON.parse(y.options) : {}, ...u };
1998
+ p.options = JSON.stringify(N);
1979
1999
  }
1980
- d !== void 0 && (g.skip_consent_for_verifiable_first_party_clients = d ? 1 : 0), c !== void 0 && (g.allow_offline_access = c ? 1 : 0);
1981
- const l = await t.updateTable("resource_servers").set(g).where("tenant_id", "=", e).where("id", "=", n).executeTakeFirst();
1982
- return Number(l.numUpdatedRows) > 0;
2000
+ c !== void 0 && (p.skip_consent_for_verifiable_first_party_clients = c ? 1 : 0), l !== void 0 && (p.allow_offline_access = l ? 1 : 0);
2001
+ const d = await t.updateTable("resource_servers").set(p).where("tenant_id", "=", e).where("id", "=", n).executeTakeFirst();
2002
+ return Number(d.numUpdatedRows) > 0;
1983
2003
  };
1984
2004
  }
1985
2005
  function si(t) {
@@ -2008,7 +2028,7 @@ function ui(t) {
2008
2028
  };
2009
2029
  };
2010
2030
  }
2011
- function di(t) {
2031
+ function ci(t) {
2012
2032
  return async (e, n) => {
2013
2033
  const a = await t.selectFrom("roles").selectAll().where("roles.tenant_id", "=", e).where("roles.id", "=", n).executeTakeFirst();
2014
2034
  return a ? {
@@ -2016,29 +2036,29 @@ function di(t) {
2016
2036
  } : null;
2017
2037
  };
2018
2038
  }
2019
- function ci(t) {
2039
+ function li(t) {
2020
2040
  return async (e, n) => {
2021
2041
  let a = t.selectFrom("roles").where("roles.tenant_id", "=", e);
2022
2042
  const { page: r = 0, per_page: o = 50, include_totals: u = !1 } = n;
2023
- n.q && (a = M(t, a, n.q, ["name"]));
2024
- const c = await a.offset(r * o).limit(o).selectAll().execute();
2043
+ n.q && (a = J(t, a, n.q, ["name"]));
2044
+ const l = await a.offset(r * o).limit(o).selectAll().execute();
2025
2045
  if (!u)
2026
2046
  return {
2027
- roles: c,
2047
+ roles: l,
2028
2048
  start: r * o,
2029
2049
  limit: o,
2030
- length: c.length
2050
+ length: l.length
2031
2051
  };
2032
- const { count: h } = await a.select((g) => g.fn.countAll().as("count")).executeTakeFirstOrThrow();
2052
+ const { count: h } = await a.select((p) => p.fn.countAll().as("count")).executeTakeFirstOrThrow();
2033
2053
  return {
2034
- roles: c,
2054
+ roles: l,
2035
2055
  start: r * o,
2036
2056
  limit: o,
2037
2057
  length: j(h)
2038
2058
  };
2039
2059
  };
2040
2060
  }
2041
- function li(t) {
2061
+ function di(t) {
2042
2062
  return async (e, n, a) => {
2043
2063
  const r = {
2044
2064
  ...a,
@@ -2056,9 +2076,9 @@ function _i(t) {
2056
2076
  function mi(t) {
2057
2077
  return {
2058
2078
  create: ui(t),
2059
- get: di(t),
2060
- list: ci(t),
2061
- update: li(t),
2079
+ get: ci(t),
2080
+ list: li(t),
2081
+ update: di(t),
2062
2082
  remove: _i(t)
2063
2083
  };
2064
2084
  }
@@ -2081,10 +2101,10 @@ function hi(t) {
2081
2101
  };
2082
2102
  try {
2083
2103
  await t.insertInto("role_permissions").values(u).execute();
2084
- } catch (d) {
2085
- if (d.code === "SQLITE_CONSTRAINT_PRIMARYKEY" || d.code === "SQLITE_CONSTRAINT_UNIQUE")
2104
+ } catch (c) {
2105
+ if (c.code === "SQLITE_CONSTRAINT_PRIMARYKEY" || c.code === "SQLITE_CONSTRAINT_UNIQUE")
2086
2106
  continue;
2087
- throw d;
2107
+ throw c;
2088
2108
  }
2089
2109
  }
2090
2110
  return !0;
@@ -2114,9 +2134,9 @@ function fi(t) {
2114
2134
  function pi(t) {
2115
2135
  return async (e, n, a = {}) => {
2116
2136
  const { page: r = 0, per_page: o = 50, include_totals: u = !1 } = a;
2117
- let d = t.selectFrom("role_permissions").leftJoin(
2137
+ let c = t.selectFrom("role_permissions").leftJoin(
2118
2138
  "resource_servers",
2119
- (l) => l.onRef(
2139
+ (d) => d.onRef(
2120
2140
  "role_permissions.tenant_id",
2121
2141
  "=",
2122
2142
  "resource_servers.tenant_id"
@@ -2132,17 +2152,17 @@ function pi(t) {
2132
2152
  "role_permissions.created_at",
2133
2153
  "resource_servers.name as resource_server_name"
2134
2154
  ]).where("role_permissions.tenant_id", "=", e).where("role_permissions.role_id", "=", n);
2135
- const g = (await d.offset(r * o).limit(o).execute()).map((l) => ({
2136
- role_id: l.role_id,
2137
- resource_server_identifier: l.resource_server_identifier,
2138
- resource_server_name: l.resource_server_name || l.resource_server_identifier,
2155
+ const p = (await c.offset(r * o).limit(o).execute()).map((d) => ({
2156
+ role_id: d.role_id,
2157
+ resource_server_identifier: d.resource_server_identifier,
2158
+ resource_server_name: d.resource_server_name || d.resource_server_identifier,
2139
2159
  // Fallback to identifier if name is null
2140
- permission_name: l.permission_name,
2160
+ permission_name: d.permission_name,
2141
2161
  description: null,
2142
2162
  // No description available from role_permissions directly
2143
- created_at: l.created_at
2163
+ created_at: d.created_at
2144
2164
  }));
2145
- return u && await d.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow(), g;
2165
+ return u && await c.select((d) => d.fn.countAll().as("count")).executeTakeFirstOrThrow(), p;
2146
2166
  };
2147
2167
  }
2148
2168
  function gi(t) {
@@ -2188,7 +2208,7 @@ function Ni(t) {
2188
2208
  return async (e, n, a, r) => {
2189
2209
  let o = t.selectFrom("user_permissions").leftJoin(
2190
2210
  "resource_servers",
2191
- (d) => d.onRef(
2211
+ (c) => c.onRef(
2192
2212
  "user_permissions.tenant_id",
2193
2213
  "=",
2194
2214
  "resource_servers.tenant_id"
@@ -2209,16 +2229,16 @@ function Ni(t) {
2209
2229
  "user_permissions.organization_id",
2210
2230
  "=",
2211
2231
  r
2212
- )), (await o.execute()).map((d) => ({
2213
- resource_server_identifier: d.resource_server_identifier,
2214
- permission_name: d.permission_name,
2232
+ )), (await o.execute()).map((c) => ({
2233
+ resource_server_identifier: c.resource_server_identifier,
2234
+ permission_name: c.permission_name,
2215
2235
  description: null,
2216
2236
  // No description available from user_permissions directly
2217
- resource_server_name: d.resource_server_name || d.resource_server_identifier,
2237
+ resource_server_name: c.resource_server_name || c.resource_server_identifier,
2218
2238
  // Fallback to identifier if name is null
2219
- user_id: d.user_id,
2220
- created_at: d.created_at,
2221
- organization_id: d.organization_id === "" ? void 0 : d.organization_id
2239
+ user_id: c.user_id,
2240
+ created_at: c.created_at,
2241
+ organization_id: c.organization_id === "" ? void 0 : c.organization_id
2222
2242
  }));
2223
2243
  };
2224
2244
  }
@@ -2241,7 +2261,7 @@ function xi(t) {
2241
2261
  return async (e, n, a, r) => {
2242
2262
  let o = t.selectFrom("user_roles as ur").innerJoin(
2243
2263
  "roles as r",
2244
- (d) => d.onRef("ur.role_id", "=", "r.id").onRef("ur.tenant_id", "=", "r.tenant_id")
2264
+ (c) => c.onRef("ur.role_id", "=", "r.id").onRef("ur.tenant_id", "=", "r.tenant_id")
2245
2265
  ).select([
2246
2266
  "r.id",
2247
2267
  "r.name",
@@ -2364,8 +2384,8 @@ function Ai(t) {
2364
2384
  }
2365
2385
  function $i(t) {
2366
2386
  return async (e, n, a) => {
2367
- const { branding: r, metadata: o, enabled_connections: u, token_quota: d, ...c } = a, h = {
2368
- ...c,
2387
+ const { branding: r, metadata: o, enabled_connections: u, token_quota: c, ...l } = a, h = {
2388
+ ...l,
2369
2389
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
2370
2390
  };
2371
2391
  return wt(
@@ -2424,33 +2444,33 @@ function Ri(t) {
2424
2444
  let u = t.selectFrom("user_organizations").selectAll().where("tenant_id", "=", e);
2425
2445
  if (n != null && n.q) {
2426
2446
  if (n.q.startsWith("user_id:")) {
2427
- const l = n.q.replace("user_id:", "");
2428
- u = u.where("user_id", "=", l);
2447
+ const d = n.q.replace("user_id:", "");
2448
+ u = u.where("user_id", "=", d);
2429
2449
  } else if (n.q.startsWith("organization_id:")) {
2430
- const l = n.q.replace("organization_id:", "");
2431
- u = u.where("organization_id", "=", l);
2450
+ const d = n.q.replace("organization_id:", "");
2451
+ u = u.where("organization_id", "=", d);
2432
2452
  }
2433
2453
  }
2434
2454
  u = u.orderBy("created_at", "desc"), r > 0 && (u = u.limit(r).offset(o));
2435
- const d = await u.execute();
2436
- let c = t.selectFrom("user_organizations").select(t.fn.count("id").as("count")).where("tenant_id", "=", e);
2455
+ const c = await u.execute();
2456
+ let l = t.selectFrom("user_organizations").select(t.fn.count("id").as("count")).where("tenant_id", "=", e);
2437
2457
  if (n != null && n.q) {
2438
2458
  if (n.q.startsWith("user_id:")) {
2439
- const l = n.q.replace("user_id:", "");
2440
- c = c.where("user_id", "=", l);
2459
+ const d = n.q.replace("user_id:", "");
2460
+ l = l.where("user_id", "=", d);
2441
2461
  } else if (n.q.startsWith("organization_id:")) {
2442
- const l = n.q.replace("organization_id:", "");
2443
- c = c.where("organization_id", "=", l);
2462
+ const d = n.q.replace("organization_id:", "");
2463
+ l = l.where("organization_id", "=", d);
2444
2464
  }
2445
2465
  }
2446
- const h = await c.executeTakeFirst();
2466
+ const h = await l.executeTakeFirst();
2447
2467
  return {
2448
- userOrganizations: d.map((l) => ({
2449
- id: l.id,
2450
- user_id: l.user_id,
2451
- organization_id: l.organization_id,
2452
- created_at: l.created_at,
2453
- updated_at: l.updated_at
2468
+ userOrganizations: c.map((d) => ({
2469
+ id: d.id,
2470
+ user_id: d.user_id,
2471
+ organization_id: d.organization_id,
2472
+ created_at: d.created_at,
2473
+ updated_at: d.updated_at
2454
2474
  })),
2455
2475
  start: o,
2456
2476
  limit: r,
@@ -2461,7 +2481,7 @@ function Ri(t) {
2461
2481
  function Fi(t) {
2462
2482
  return async (e, n, a) => {
2463
2483
  const r = (a == null ? void 0 : a.page) || 0, o = (a == null ? void 0 : a.per_page) || 50, u = r * o;
2464
- let d = t.selectFrom("user_organizations").innerJoin(
2484
+ let c = t.selectFrom("user_organizations").innerJoin(
2465
2485
  "organizations",
2466
2486
  "organizations.id",
2467
2487
  "user_organizations.organization_id"
@@ -2477,25 +2497,25 @@ function Fi(t) {
2477
2497
  "organizations.updated_at",
2478
2498
  "user_organizations.created_at as joined_at"
2479
2499
  ]).where("user_organizations.tenant_id", "=", e).where("user_organizations.user_id", "=", n);
2480
- d = d.orderBy("user_organizations.created_at", "desc"), o > 0 && (d = d.limit(o).offset(u));
2481
- const c = await d.execute(), h = await t.selectFrom("user_organizations").innerJoin(
2500
+ c = c.orderBy("user_organizations.created_at", "desc"), o > 0 && (c = c.limit(o).offset(u));
2501
+ const l = await c.execute(), h = await t.selectFrom("user_organizations").innerJoin(
2482
2502
  "organizations",
2483
2503
  "organizations.id",
2484
2504
  "user_organizations.organization_id"
2485
2505
  ).select(t.fn.count("user_organizations.id").as("count")).where("user_organizations.tenant_id", "=", e).where("user_organizations.user_id", "=", n).executeTakeFirst();
2486
2506
  return {
2487
- organizations: c.map((l) => ({
2488
- id: l.id,
2489
- name: l.name,
2490
- display_name: l.display_name,
2491
- branding: l.branding ? JSON.parse(l.branding) : void 0,
2492
- metadata: l.metadata ? JSON.parse(l.metadata) : {},
2493
- enabled_connections: l.enabled_connections ? JSON.parse(l.enabled_connections) : [],
2494
- token_quota: l.token_quota ? JSON.parse(l.token_quota) : void 0,
2495
- created_at: l.created_at,
2496
- updated_at: l.updated_at,
2507
+ organizations: l.map((d) => ({
2508
+ id: d.id,
2509
+ name: d.name,
2510
+ display_name: d.display_name,
2511
+ branding: d.branding ? JSON.parse(d.branding) : void 0,
2512
+ metadata: d.metadata ? JSON.parse(d.metadata) : {},
2513
+ enabled_connections: d.enabled_connections ? JSON.parse(d.enabled_connections) : [],
2514
+ token_quota: d.token_quota ? JSON.parse(d.token_quota) : void 0,
2515
+ created_at: d.created_at,
2516
+ updated_at: d.updated_at,
2497
2517
  // Add membership info
2498
- joined_at: l.joined_at
2518
+ joined_at: d.joined_at
2499
2519
  })),
2500
2520
  start: u,
2501
2521
  limit: o,
@@ -2515,7 +2535,7 @@ function Li(t) {
2515
2535
  return (await t.updateTable("user_organizations").set(r).where("id", "=", n).where("tenant_id", "=", e).execute()).length > 0;
2516
2536
  };
2517
2537
  }
2518
- function Ji(t) {
2538
+ function Mi(t) {
2519
2539
  return {
2520
2540
  // CRUD operations
2521
2541
  create: Di(t),
@@ -2526,9 +2546,9 @@ function Ji(t) {
2526
2546
  update: Li(t)
2527
2547
  };
2528
2548
  }
2529
- function Mi(t) {
2549
+ function Ji(t) {
2530
2550
  return async (e, n) => {
2531
- const a = Lr(), r = (/* @__PURE__ */ new Date()).toISOString(), o = n.ttl_sec || 604800, u = new Date(Date.now() + o * 1e3).toISOString(), d = wt(
2551
+ const a = Lr(), r = (/* @__PURE__ */ new Date()).toISOString(), o = n.ttl_sec || 604800, u = new Date(Date.now() + o * 1e3).toISOString(), c = wt(
2532
2552
  {
2533
2553
  id: a,
2534
2554
  tenant_id: e,
@@ -2550,15 +2570,15 @@ function Mi(t) {
2550
2570
  ["inviter", "invitee", "app_metadata", "user_metadata", "roles"]
2551
2571
  );
2552
2572
  try {
2553
- await t.insertInto("invites").values(d).execute();
2554
- } catch (c) {
2555
- throw c.code === "SQLITE_CONSTRAINT_UNIQUE" || c.message.includes("AlreadyExists") ? new Ze(409, {
2573
+ await t.insertInto("invites").values(c).execute();
2574
+ } catch (l) {
2575
+ throw l.code === "SQLITE_CONSTRAINT_UNIQUE" || l.message.includes("AlreadyExists") ? new Ze(409, {
2556
2576
  message: "Invite already exists"
2557
- }) : c;
2577
+ }) : l;
2558
2578
  }
2559
2579
  return {
2560
2580
  id: a,
2561
- organization_id: d.organization_id,
2581
+ organization_id: c.organization_id,
2562
2582
  inviter: n.inviter,
2563
2583
  invitee: n.invitee,
2564
2584
  client_id: n.client_id,
@@ -2569,7 +2589,7 @@ function Mi(t) {
2569
2589
  app_metadata: n.app_metadata || {},
2570
2590
  user_metadata: n.user_metadata || {},
2571
2591
  roles: n.roles || [],
2572
- ticket_id: d.ticket_id || void 0,
2592
+ ticket_id: c.ticket_id || void 0,
2573
2593
  ttl_sec: o,
2574
2594
  send_invitation_email: n.send_invitation_email ?? !0
2575
2595
  };
@@ -2618,7 +2638,7 @@ function Wi(t) {
2618
2638
  a = a.offset(u);
2619
2639
  }
2620
2640
  const o = (await a.execute()).map((u) => {
2621
- const d = Zn(u, {
2641
+ const c = Zn(u, {
2622
2642
  inviter: {},
2623
2643
  invitee: {},
2624
2644
  app_metadata: {},
@@ -2626,7 +2646,7 @@ function Wi(t) {
2626
2646
  roles: []
2627
2647
  });
2628
2648
  return O({
2629
- ...d,
2649
+ ...c,
2630
2650
  send_invitation_email: u.send_invitation_email === 1
2631
2651
  });
2632
2652
  });
@@ -2651,7 +2671,7 @@ function Ui(t) {
2651
2671
  }
2652
2672
  function Qi(t) {
2653
2673
  return {
2654
- create: Mi(t),
2674
+ create: Ji(t),
2655
2675
  get: Bi(t),
2656
2676
  list: Wi(t),
2657
2677
  remove: Ki(t),
@@ -2679,7 +2699,7 @@ function na(t) {
2679
2699
  function Ee(t) {
2680
2700
  return typeof t == "function";
2681
2701
  }
2682
- function Jt(t) {
2702
+ function Mt(t) {
2683
2703
  return typeof t == "object" && t !== null;
2684
2704
  }
2685
2705
  function Vi(t) {
@@ -2750,13 +2770,13 @@ const F = s({
2750
2770
  }
2751
2771
  });
2752
2772
  function q(t) {
2753
- return Jt(t) && Ee(t.toOperationNode);
2773
+ return Mt(t) && Ee(t.toOperationNode);
2754
2774
  }
2755
2775
  function Gi(t) {
2756
- return Jt(t) && "expressionType" in t && q(t);
2776
+ return Mt(t) && "expressionType" in t && q(t);
2757
2777
  }
2758
2778
  function Yi(t) {
2759
- return Jt(t) && "expression" in t && G(t.alias) && q(t);
2779
+ return Mt(t) && "expression" in t && G(t.alias) && q(t);
2760
2780
  }
2761
2781
  const Y = s({
2762
2782
  is(t) {
@@ -2946,7 +2966,7 @@ const gn = s({
2946
2966
  kind: "SelectAllNode"
2947
2967
  });
2948
2968
  }
2949
- }), Mt = s({
2969
+ }), Jt = s({
2950
2970
  is(t) {
2951
2971
  return t.kind === "ReferenceNode";
2952
2972
  },
@@ -2966,7 +2986,7 @@ const gn = s({
2966
2986
  }
2967
2987
  });
2968
2988
  function oa(t) {
2969
- return Jt(t) && q(t) && G(t.dynamicReference);
2989
+ return Mt(t) && q(t) && G(t.dynamicReference);
2970
2990
  }
2971
2991
  const Xt = s({
2972
2992
  is(t) {
@@ -3093,7 +3113,7 @@ const Tt = s({
3093
3113
  function os(t) {
3094
3114
  return G(t) ? fe(t) : t.toOperationNode();
3095
3115
  }
3096
- function lt(t) {
3116
+ function dt(t) {
3097
3117
  return me(t) ? t.map((e) => L(e)) : [L(t)];
3098
3118
  }
3099
3119
  function L(t) {
@@ -3111,12 +3131,12 @@ function is(t, e) {
3111
3131
  function fe(t) {
3112
3132
  const e = ".";
3113
3133
  if (!t.includes(e))
3114
- return Mt.create(gn.create(t));
3134
+ return Jt.create(gn.create(t));
3115
3135
  const n = t.split(e).map(ua);
3116
3136
  if (n.length === 3)
3117
3137
  return us(n);
3118
3138
  if (n.length === 2)
3119
- return ds(n);
3139
+ return cs(n);
3120
3140
  throw new Error(`invalid column reference ${t}`);
3121
3141
  }
3122
3142
  function ss(t) {
@@ -3129,16 +3149,16 @@ function ss(t) {
3129
3149
  }
3130
3150
  function us(t) {
3131
3151
  const [e, n, a] = t;
3132
- return Mt.create(gn.create(a), _e.createWithSchema(e, n));
3152
+ return Jt.create(gn.create(a), _e.createWithSchema(e, n));
3133
3153
  }
3134
- function ds(t) {
3154
+ function cs(t) {
3135
3155
  const [e, n] = t;
3136
- return Mt.create(gn.create(n), _e.create(e));
3156
+ return Jt.create(gn.create(n), _e.create(e));
3137
3157
  }
3138
3158
  function ua(t) {
3139
3159
  return t.trim();
3140
3160
  }
3141
- const cs = s({
3161
+ const ls = s({
3142
3162
  is(t) {
3143
3163
  return t.kind === "PrimitiveValueListNode";
3144
3164
  },
@@ -3148,7 +3168,7 @@ const cs = s({
3148
3168
  values: s([...t])
3149
3169
  });
3150
3170
  }
3151
- }), ls = s({
3171
+ }), ds = s({
3152
3172
  is(t) {
3153
3173
  return t.kind === "ValueListNode";
3154
3174
  },
@@ -3191,7 +3211,7 @@ function Nn(t) {
3191
3211
  return pe.createImmediate(t);
3192
3212
  }
3193
3213
  function ms(t) {
3194
- return t.some(Kt) ? ls.create(t.map((e) => D(e))) : cs.create(t);
3214
+ return t.some(Kt) ? ds.create(t.map((e) => D(e))) : ls.create(t);
3195
3215
  }
3196
3216
  const _t = s({
3197
3217
  is(t) {
@@ -3212,13 +3232,13 @@ function K(t) {
3212
3232
  throw new Error(`invalid arguments: ${JSON.stringify(t)}`);
3213
3233
  }
3214
3234
  function vn(t, e, n) {
3215
- return hs(e) && da(n) ? et.create(L(t), en(e), pe.createImmediate(n)) : et.create(L(t), en(e), _s(n));
3235
+ return hs(e) && ca(n) ? et.create(L(t), en(e), pe.createImmediate(n)) : et.create(L(t), en(e), _s(n));
3216
3236
  }
3217
3237
  function mt(t, e, n) {
3218
3238
  return et.create(L(t), en(e), L(n));
3219
3239
  }
3220
3240
  function In(t, e) {
3221
- return Zt(Object.entries(t).filter(([, n]) => !Ot(n)).map(([n, a]) => vn(n, da(a) ? "is" : "=", a)), e);
3241
+ return Zt(Object.entries(t).filter(([, n]) => !Ot(n)).map(([n, a]) => vn(n, ca(a) ? "is" : "=", a)), e);
3222
3242
  }
3223
3243
  function Zt(t, e, n = !0) {
3224
3244
  const a = e === "and" ? he.create : nt.create;
@@ -3232,7 +3252,7 @@ function Zt(t, e, n = !0) {
3232
3252
  function hs(t) {
3233
3253
  return t === "is" || t === "is not";
3234
3254
  }
3235
- function da(t) {
3255
+ function ca(t) {
3236
3256
  return ta(t) || ea(t);
3237
3257
  }
3238
3258
  function en(t) {
@@ -3465,13 +3485,13 @@ function Ae(t, e) {
3465
3485
  });
3466
3486
  }
3467
3487
  var B;
3468
- const dt = class dt {
3488
+ const ct = class ct {
3469
3489
  constructor(e) {
3470
3490
  C(this, B);
3471
3491
  b(this, B, s(e));
3472
3492
  }
3473
3493
  on(...e) {
3474
- return new dt({
3494
+ return new ct({
3475
3495
  ...i(this, B),
3476
3496
  joinNode: it.cloneWithOn(i(this, B).joinNode, K(e))
3477
3497
  });
@@ -3483,7 +3503,7 @@ const dt = class dt {
3483
3503
  * See {@link WhereInterface.whereRef} for documentation and examples.
3484
3504
  */
3485
3505
  onRef(e, n, a) {
3486
- return new dt({
3506
+ return new ct({
3487
3507
  ...i(this, B),
3488
3508
  joinNode: it.cloneWithOn(i(this, B).joinNode, mt(e, n, a))
3489
3509
  });
@@ -3492,7 +3512,7 @@ const dt = class dt {
3492
3512
  * Adds `on true`.
3493
3513
  */
3494
3514
  onTrue() {
3495
- return new dt({
3515
+ return new ct({
3496
3516
  ...i(this, B),
3497
3517
  joinNode: it.cloneWithOn(i(this, B).joinNode, R.createWithSql("true"))
3498
3518
  });
@@ -3509,7 +3529,7 @@ const dt = class dt {
3509
3529
  }
3510
3530
  };
3511
3531
  B = new WeakMap();
3512
- let kt = dt;
3532
+ let kt = ct;
3513
3533
  Ae(kt, "don't await JoinBuilder instances. They are never executed directly and are always just a part of a query.");
3514
3534
  const fs = s({
3515
3535
  is(t) {
@@ -3523,7 +3543,7 @@ const fs = s({
3523
3543
  }
3524
3544
  });
3525
3545
  function ps(t) {
3526
- return lt(t).map(fs.create);
3546
+ return dt(t).map(fs.create);
3527
3547
  }
3528
3548
  var ve;
3529
3549
  const Dt = class Dt {
@@ -3595,17 +3615,17 @@ const ut = s({
3595
3615
  createSelectAllFromTable(t) {
3596
3616
  return s({
3597
3617
  kind: "SelectionNode",
3598
- selection: Mt.createSelectAll(t)
3618
+ selection: Jt.createSelectAll(t)
3599
3619
  });
3600
3620
  }
3601
3621
  });
3602
- function ca(t) {
3603
- return Ee(t) ? ca(t(Bt())) : me(t) ? t.map((e) => Dn(e)) : [Dn(t)];
3622
+ function la(t) {
3623
+ return Ee(t) ? la(t(Bt())) : me(t) ? t.map((e) => Dn(e)) : [Dn(t)];
3604
3624
  }
3605
3625
  function Dn(t) {
3606
3626
  return G(t) ? ut.create(ss(t)) : oa(t) ? ut.create(t.toOperationNode()) : ut.create(Na(t));
3607
3627
  }
3608
- function la(t) {
3628
+ function da(t) {
3609
3629
  return t ? Array.isArray(t) ? t.map(zn) : [zn(t)] : [ut.createSelectAll()];
3610
3630
  }
3611
3631
  function zn(t) {
@@ -4014,16 +4034,16 @@ function Is() {
4014
4034
  function H() {
4015
4035
  return new Es();
4016
4036
  }
4017
- var Je;
4037
+ var Me;
4018
4038
  class Es {
4019
4039
  constructor() {
4020
- C(this, Je);
4040
+ C(this, Me);
4021
4041
  }
4022
4042
  get queryId() {
4023
- return i(this, Je) === void 0 && b(this, Je, ks(8)), i(this, Je);
4043
+ return i(this, Me) === void 0 && b(this, Me, ks(8)), i(this, Me);
4024
4044
  }
4025
4045
  }
4026
- Je = new WeakMap();
4046
+ Me = new WeakMap();
4027
4047
  var zt;
4028
4048
  class As {
4029
4049
  constructor() {
@@ -4886,23 +4906,23 @@ const $s = s({
4886
4906
  json_agg: !0,
4887
4907
  to_json: !0
4888
4908
  };
4889
- var Me, Ce, xe, I, nn, _a, ma, ha, De, an, fa;
4909
+ var Je, Ce, xe, I, nn, _a, ma, ha, De, an, fa;
4890
4910
  class Ds extends As {
4891
4911
  constructor(n) {
4892
4912
  super();
4893
4913
  C(this, I);
4894
- C(this, Me);
4914
+ C(this, Je);
4895
4915
  C(this, Ce, /* @__PURE__ */ new Set());
4896
4916
  C(this, xe, /* @__PURE__ */ new Set());
4897
- b(this, Me, n);
4917
+ b(this, Je, n);
4898
4918
  }
4899
4919
  transformNodeImpl(n) {
4900
- if (!y(this, I, _a).call(this, n))
4920
+ if (!w(this, I, _a).call(this, n))
4901
4921
  return super.transformNodeImpl(n);
4902
- const a = y(this, I, ha).call(this, n);
4922
+ const a = w(this, I, ha).call(this, n);
4903
4923
  for (const u of a)
4904
4924
  i(this, xe).add(u);
4905
- const r = y(this, I, ma).call(this, n);
4925
+ const r = w(this, I, ma).call(this, n);
4906
4926
  for (const u of r)
4907
4927
  i(this, Ce).add(u);
4908
4928
  const o = super.transformNodeImpl(n);
@@ -4916,30 +4936,30 @@ class Ds extends As {
4916
4936
  const a = super.transformSchemableIdentifier(n);
4917
4937
  return a.schema || !i(this, Ce).has(n.identifier.name) ? a : {
4918
4938
  ...a,
4919
- schema: F.create(i(this, Me))
4939
+ schema: F.create(i(this, Je))
4920
4940
  };
4921
4941
  }
4922
4942
  transformReferences(n) {
4923
4943
  const a = super.transformReferences(n);
4924
4944
  return a.table.table.schema ? a : {
4925
4945
  ...a,
4926
- table: _e.createWithSchema(i(this, Me), a.table.table.identifier.name)
4946
+ table: _e.createWithSchema(i(this, Je), a.table.table.identifier.name)
4927
4947
  };
4928
4948
  }
4929
4949
  transformAggregateFunction(n) {
4930
4950
  return {
4931
4951
  ...super.transformAggregateFunction({ ...n, aggregated: [] }),
4932
- aggregated: y(this, I, nn).call(this, n, "aggregated")
4952
+ aggregated: w(this, I, nn).call(this, n, "aggregated")
4933
4953
  };
4934
4954
  }
4935
4955
  transformFunction(n) {
4936
4956
  return {
4937
4957
  ...super.transformFunction({ ...n, arguments: [] }),
4938
- arguments: y(this, I, nn).call(this, n, "arguments")
4958
+ arguments: w(this, I, nn).call(this, n, "arguments")
4939
4959
  };
4940
4960
  }
4941
4961
  }
4942
- Me = new WeakMap(), Ce = new WeakMap(), xe = new WeakMap(), I = new WeakSet(), nn = function(n, a) {
4962
+ Je = new WeakMap(), Ce = new WeakMap(), xe = new WeakMap(), I = new WeakSet(), nn = function(n, a) {
4943
4963
  return Ps[n.func] ? n[a].map((r) => !_e.is(r) || r.table.schema ? this.transformNode(r) : {
4944
4964
  ...r,
4945
4965
  table: this.transformIdentifier(r.table.identifier)
@@ -4948,19 +4968,19 @@ Me = new WeakMap(), Ce = new WeakMap(), xe = new WeakMap(), I = new WeakSet(), n
4948
4968
  return n.kind in $s;
4949
4969
  }, ma = function(n) {
4950
4970
  const a = /* @__PURE__ */ new Set();
4951
- if ("name" in n && n.name && Ht.is(n.name) && y(this, I, an).call(this, n.name, a), "from" in n && n.from)
4971
+ if ("name" in n && n.name && Ht.is(n.name) && w(this, I, an).call(this, n.name, a), "from" in n && n.from)
4952
4972
  for (const r of n.from.froms)
4953
- y(this, I, De).call(this, r, a);
4954
- if ("into" in n && n.into && y(this, I, De).call(this, n.into, a), "table" in n && n.table && y(this, I, De).call(this, n.table, a), "joins" in n && n.joins)
4973
+ w(this, I, De).call(this, r, a);
4974
+ if ("into" in n && n.into && w(this, I, De).call(this, n.into, a), "table" in n && n.table && w(this, I, De).call(this, n.table, a), "joins" in n && n.joins)
4955
4975
  for (const r of n.joins)
4956
- y(this, I, De).call(this, r.table, a);
4957
- return "using" in n && n.using && y(this, I, De).call(this, n.using, a), a;
4976
+ w(this, I, De).call(this, r.table, a);
4977
+ return "using" in n && n.using && w(this, I, De).call(this, n.using, a), a;
4958
4978
  }, ha = function(n) {
4959
4979
  const a = /* @__PURE__ */ new Set();
4960
- return "with" in n && n.with && y(this, I, fa).call(this, n.with, a), a;
4980
+ return "with" in n && n.with && w(this, I, fa).call(this, n.with, a), a;
4961
4981
  }, De = function(n, a) {
4962
4982
  const r = _e.is(n) ? n : ye.is(n) && _e.is(n.node) ? n.node : null;
4963
- r && y(this, I, an).call(this, r.table, a);
4983
+ r && w(this, I, an).call(this, r.table, a);
4964
4984
  }, an = function(n, a) {
4965
4985
  const r = n.identifier.name;
4966
4986
  !i(this, Ce).has(r) && !i(this, xe).has(r) && a.add(r);
@@ -4985,7 +5005,7 @@ class pa {
4985
5005
  }
4986
5006
  ht = new WeakMap();
4987
5007
  var ft, qe, Be;
4988
- class Jn {
5008
+ class Mn {
4989
5009
  constructor() {
4990
5010
  C(this, ft);
4991
5011
  C(this, qe);
@@ -5005,9 +5025,9 @@ class Jn {
5005
5025
  }
5006
5026
  }
5007
5027
  ft = new WeakMap(), qe = new WeakMap(), Be = new WeakMap();
5008
- const Mn = /* @__PURE__ */ new Set();
5028
+ const Jn = /* @__PURE__ */ new Set();
5009
5029
  function zs(t) {
5010
- Mn.has(t) || (Mn.add(t), console.log(t));
5030
+ Jn.has(t) || (Jn.add(t), console.log(t));
5011
5031
  }
5012
5032
  const Rs = s([]);
5013
5033
  var be, pt, rn;
@@ -5037,17 +5057,17 @@ class Fs {
5037
5057
  }
5038
5058
  async executeQuery(e, n) {
5039
5059
  return await this.provideConnection(async (a) => {
5040
- const r = await a.executeQuery(e), o = await y(this, pt, rn).call(this, r, n);
5060
+ const r = await a.executeQuery(e), o = await w(this, pt, rn).call(this, r, n);
5041
5061
  return js(r, o), o;
5042
5062
  });
5043
5063
  }
5044
5064
  async *stream(e, n, a) {
5045
- const r = new Jn(), o = new Jn();
5046
- this.provideConnection(async (d) => (r.resolve(d), await o.promise)).catch((d) => r.reject(d));
5065
+ const r = new Mn(), o = new Mn();
5066
+ this.provideConnection(async (c) => (r.resolve(c), await o.promise)).catch((c) => r.reject(c));
5047
5067
  const u = await r.promise;
5048
5068
  try {
5049
- for await (const d of u.streamQuery(e, n))
5050
- yield await y(this, pt, rn).call(this, d, a);
5069
+ for await (const c of u.streamQuery(e, n))
5070
+ yield await w(this, pt, rn).call(this, c, a);
5051
5071
  } finally {
5052
5072
  o.resolve();
5053
5073
  }
@@ -5094,7 +5114,7 @@ function Ls(t, e) {
5094
5114
  joinNode: it.create(t, $t(e))
5095
5115
  });
5096
5116
  }
5097
- function Js() {
5117
+ function Ms() {
5098
5118
  return new It({
5099
5119
  overNode: tn.create()
5100
5120
  });
@@ -5103,10 +5123,10 @@ function $e(t, e) {
5103
5123
  if (e.length === 3)
5104
5124
  return qs(t, e[0], e[1], e[2]);
5105
5125
  if (e.length === 2)
5106
- return Ms(t, e[0], e[1]);
5126
+ return Js(t, e[0], e[1]);
5107
5127
  throw new Error("not implemented");
5108
5128
  }
5109
- function Ms(t, e, n) {
5129
+ function Js(t, e, n) {
5110
5130
  return n(Ls(t, e)).toOperationNode();
5111
5131
  }
5112
5132
  function qs(t, e, n, a) {
@@ -5134,7 +5154,7 @@ const Bs = s({
5134
5154
  }
5135
5155
  });
5136
5156
  function Ks(t) {
5137
- return t = Ee(t) ? t(Bt()) : t, lt(t).map(Ws.create);
5157
+ return t = Ee(t) ? t(Bt()) : t, dt(t).map(Ws.create);
5138
5158
  }
5139
5159
  const Us = s({
5140
5160
  is(t) {
@@ -5197,12 +5217,12 @@ const Rt = class Rt {
5197
5217
  };
5198
5218
  ne = new WeakMap();
5199
5219
  let T = Rt;
5200
- var We, de;
5220
+ var We, ce;
5201
5221
  class Cn {
5202
5222
  constructor(e, n) {
5203
5223
  C(this, We);
5204
- C(this, de);
5205
- b(this, We, e), b(this, de, n);
5224
+ C(this, ce);
5225
+ b(this, We, e), b(this, ce, n);
5206
5226
  }
5207
5227
  /** @private */
5208
5228
  get expression() {
@@ -5210,13 +5230,13 @@ class Cn {
5210
5230
  }
5211
5231
  /** @private */
5212
5232
  get alias() {
5213
- return i(this, de);
5233
+ return i(this, ce);
5214
5234
  }
5215
5235
  toOperationNode() {
5216
- return ye.create(i(this, We).toOperationNode(), q(i(this, de)) ? i(this, de).toOperationNode() : F.create(i(this, de)));
5236
+ return ye.create(i(this, We).toOperationNode(), q(i(this, ce)) ? i(this, ce).toOperationNode() : F.create(i(this, ce)));
5217
5237
  }
5218
5238
  }
5219
- We = new WeakMap(), de = new WeakMap();
5239
+ We = new WeakMap(), ce = new WeakMap();
5220
5240
  var Oe;
5221
5241
  const Ft = class Ft {
5222
5242
  constructor(e) {
@@ -5300,7 +5320,7 @@ function Gs(t) {
5300
5320
  return t === "only" || t === "with ties";
5301
5321
  }
5302
5322
  var _;
5303
- const N = class N {
5323
+ const v = class v {
5304
5324
  constructor(e) {
5305
5325
  C(this, _);
5306
5326
  b(this, _, s(e));
@@ -5311,205 +5331,205 @@ const N = class N {
5311
5331
  return !0;
5312
5332
  }
5313
5333
  where(...e) {
5314
- return new N({
5334
+ return new v({
5315
5335
  ...i(this, _),
5316
5336
  queryNode: A.cloneWithWhere(i(this, _).queryNode, K(e))
5317
5337
  });
5318
5338
  }
5319
5339
  whereRef(e, n, a) {
5320
- return new N({
5340
+ return new v({
5321
5341
  ...i(this, _),
5322
5342
  queryNode: A.cloneWithWhere(i(this, _).queryNode, mt(e, n, a))
5323
5343
  });
5324
5344
  }
5325
5345
  having(...e) {
5326
- return new N({
5346
+ return new v({
5327
5347
  ...i(this, _),
5328
5348
  queryNode: S.cloneWithHaving(i(this, _).queryNode, K(e))
5329
5349
  });
5330
5350
  }
5331
5351
  havingRef(e, n, a) {
5332
- return new N({
5352
+ return new v({
5333
5353
  ...i(this, _),
5334
5354
  queryNode: S.cloneWithHaving(i(this, _).queryNode, mt(e, n, a))
5335
5355
  });
5336
5356
  }
5337
5357
  select(e) {
5338
- return new N({
5358
+ return new v({
5339
5359
  ...i(this, _),
5340
- queryNode: S.cloneWithSelections(i(this, _).queryNode, ca(e))
5360
+ queryNode: S.cloneWithSelections(i(this, _).queryNode, la(e))
5341
5361
  });
5342
5362
  }
5343
5363
  distinctOn(e) {
5344
- return new N({
5364
+ return new v({
5345
5365
  ...i(this, _),
5346
- queryNode: S.cloneWithDistinctOn(i(this, _).queryNode, lt(e))
5366
+ queryNode: S.cloneWithDistinctOn(i(this, _).queryNode, dt(e))
5347
5367
  });
5348
5368
  }
5349
5369
  modifyFront(e) {
5350
- return new N({
5370
+ return new v({
5351
5371
  ...i(this, _),
5352
5372
  queryNode: S.cloneWithFrontModifier(i(this, _).queryNode, Y.createWithExpression(e.toOperationNode()))
5353
5373
  });
5354
5374
  }
5355
5375
  modifyEnd(e) {
5356
- return new N({
5376
+ return new v({
5357
5377
  ...i(this, _),
5358
5378
  queryNode: A.cloneWithEndModifier(i(this, _).queryNode, Y.createWithExpression(e.toOperationNode()))
5359
5379
  });
5360
5380
  }
5361
5381
  distinct() {
5362
- return new N({
5382
+ return new v({
5363
5383
  ...i(this, _),
5364
5384
  queryNode: S.cloneWithFrontModifier(i(this, _).queryNode, Y.create("Distinct"))
5365
5385
  });
5366
5386
  }
5367
5387
  forUpdate(e) {
5368
- return new N({
5388
+ return new v({
5369
5389
  ...i(this, _),
5370
5390
  queryNode: A.cloneWithEndModifier(i(this, _).queryNode, Y.create("ForUpdate", e ? Ct(e).map(W) : void 0))
5371
5391
  });
5372
5392
  }
5373
5393
  forShare(e) {
5374
- return new N({
5394
+ return new v({
5375
5395
  ...i(this, _),
5376
5396
  queryNode: A.cloneWithEndModifier(i(this, _).queryNode, Y.create("ForShare", e ? Ct(e).map(W) : void 0))
5377
5397
  });
5378
5398
  }
5379
5399
  forKeyShare(e) {
5380
- return new N({
5400
+ return new v({
5381
5401
  ...i(this, _),
5382
5402
  queryNode: A.cloneWithEndModifier(i(this, _).queryNode, Y.create("ForKeyShare", e ? Ct(e).map(W) : void 0))
5383
5403
  });
5384
5404
  }
5385
5405
  forNoKeyUpdate(e) {
5386
- return new N({
5406
+ return new v({
5387
5407
  ...i(this, _),
5388
5408
  queryNode: A.cloneWithEndModifier(i(this, _).queryNode, Y.create("ForNoKeyUpdate", e ? Ct(e).map(W) : void 0))
5389
5409
  });
5390
5410
  }
5391
5411
  skipLocked() {
5392
- return new N({
5412
+ return new v({
5393
5413
  ...i(this, _),
5394
5414
  queryNode: A.cloneWithEndModifier(i(this, _).queryNode, Y.create("SkipLocked"))
5395
5415
  });
5396
5416
  }
5397
5417
  noWait() {
5398
- return new N({
5418
+ return new v({
5399
5419
  ...i(this, _),
5400
5420
  queryNode: A.cloneWithEndModifier(i(this, _).queryNode, Y.create("NoWait"))
5401
5421
  });
5402
5422
  }
5403
5423
  selectAll(e) {
5404
- return new N({
5424
+ return new v({
5405
5425
  ...i(this, _),
5406
- queryNode: S.cloneWithSelections(i(this, _).queryNode, la(e))
5426
+ queryNode: S.cloneWithSelections(i(this, _).queryNode, da(e))
5407
5427
  });
5408
5428
  }
5409
5429
  innerJoin(...e) {
5410
- return new N({
5430
+ return new v({
5411
5431
  ...i(this, _),
5412
5432
  queryNode: A.cloneWithJoin(i(this, _).queryNode, $e("InnerJoin", e))
5413
5433
  });
5414
5434
  }
5415
5435
  leftJoin(...e) {
5416
- return new N({
5436
+ return new v({
5417
5437
  ...i(this, _),
5418
5438
  queryNode: A.cloneWithJoin(i(this, _).queryNode, $e("LeftJoin", e))
5419
5439
  });
5420
5440
  }
5421
5441
  rightJoin(...e) {
5422
- return new N({
5442
+ return new v({
5423
5443
  ...i(this, _),
5424
5444
  queryNode: A.cloneWithJoin(i(this, _).queryNode, $e("RightJoin", e))
5425
5445
  });
5426
5446
  }
5427
5447
  fullJoin(...e) {
5428
- return new N({
5448
+ return new v({
5429
5449
  ...i(this, _),
5430
5450
  queryNode: A.cloneWithJoin(i(this, _).queryNode, $e("FullJoin", e))
5431
5451
  });
5432
5452
  }
5433
5453
  innerJoinLateral(...e) {
5434
- return new N({
5454
+ return new v({
5435
5455
  ...i(this, _),
5436
5456
  queryNode: A.cloneWithJoin(i(this, _).queryNode, $e("LateralInnerJoin", e))
5437
5457
  });
5438
5458
  }
5439
5459
  leftJoinLateral(...e) {
5440
- return new N({
5460
+ return new v({
5441
5461
  ...i(this, _),
5442
5462
  queryNode: A.cloneWithJoin(i(this, _).queryNode, $e("LateralLeftJoin", e))
5443
5463
  });
5444
5464
  }
5445
5465
  orderBy(...e) {
5446
- return new N({
5466
+ return new v({
5447
5467
  ...i(this, _),
5448
5468
  queryNode: S.cloneWithOrderByItems(i(this, _).queryNode, yn(e))
5449
5469
  });
5450
5470
  }
5451
5471
  groupBy(e) {
5452
- return new N({
5472
+ return new v({
5453
5473
  ...i(this, _),
5454
5474
  queryNode: S.cloneWithGroupByItems(i(this, _).queryNode, Ks(e))
5455
5475
  });
5456
5476
  }
5457
5477
  limit(e) {
5458
- return new N({
5478
+ return new v({
5459
5479
  ...i(this, _),
5460
5480
  queryNode: S.cloneWithLimit(i(this, _).queryNode, Ss.create(D(e)))
5461
5481
  });
5462
5482
  }
5463
5483
  offset(e) {
5464
- return new N({
5484
+ return new v({
5465
5485
  ...i(this, _),
5466
5486
  queryNode: S.cloneWithOffset(i(this, _).queryNode, Bs.create(D(e)))
5467
5487
  });
5468
5488
  }
5469
5489
  fetch(e, n = "only") {
5470
- return new N({
5490
+ return new v({
5471
5491
  ...i(this, _),
5472
5492
  queryNode: S.cloneWithFetch(i(this, _).queryNode, Vs(e, n))
5473
5493
  });
5474
5494
  }
5475
5495
  top(e, n) {
5476
- return new N({
5496
+ return new v({
5477
5497
  ...i(this, _),
5478
5498
  queryNode: A.cloneWithTop(i(this, _).queryNode, Os(e, n))
5479
5499
  });
5480
5500
  }
5481
5501
  union(e) {
5482
- return new N({
5502
+ return new v({
5483
5503
  ...i(this, _),
5484
5504
  queryNode: S.cloneWithSetOperations(i(this, _).queryNode, Pe("union", e, !1))
5485
5505
  });
5486
5506
  }
5487
5507
  unionAll(e) {
5488
- return new N({
5508
+ return new v({
5489
5509
  ...i(this, _),
5490
5510
  queryNode: S.cloneWithSetOperations(i(this, _).queryNode, Pe("union", e, !0))
5491
5511
  });
5492
5512
  }
5493
5513
  intersect(e) {
5494
- return new N({
5514
+ return new v({
5495
5515
  ...i(this, _),
5496
5516
  queryNode: S.cloneWithSetOperations(i(this, _).queryNode, Pe("intersect", e, !1))
5497
5517
  });
5498
5518
  }
5499
5519
  intersectAll(e) {
5500
- return new N({
5520
+ return new v({
5501
5521
  ...i(this, _),
5502
5522
  queryNode: S.cloneWithSetOperations(i(this, _).queryNode, Pe("intersect", e, !0))
5503
5523
  });
5504
5524
  }
5505
5525
  except(e) {
5506
- return new N({
5526
+ return new v({
5507
5527
  ...i(this, _),
5508
5528
  queryNode: S.cloneWithSetOperations(i(this, _).queryNode, Pe("except", e, !1))
5509
5529
  });
5510
5530
  }
5511
5531
  exceptAll(e) {
5512
- return new N({
5532
+ return new v({
5513
5533
  ...i(this, _),
5514
5534
  queryNode: S.cloneWithSetOperations(i(this, _).queryNode, Pe("except", e, !0))
5515
5535
  });
@@ -5518,37 +5538,37 @@ const N = class N {
5518
5538
  return new ya(this, e);
5519
5539
  }
5520
5540
  clearSelect() {
5521
- return new N({
5541
+ return new v({
5522
5542
  ...i(this, _),
5523
5543
  queryNode: S.cloneWithoutSelections(i(this, _).queryNode)
5524
5544
  });
5525
5545
  }
5526
5546
  clearWhere() {
5527
- return new N({
5547
+ return new v({
5528
5548
  ...i(this, _),
5529
5549
  queryNode: A.cloneWithoutWhere(i(this, _).queryNode)
5530
5550
  });
5531
5551
  }
5532
5552
  clearLimit() {
5533
- return new N({
5553
+ return new v({
5534
5554
  ...i(this, _),
5535
5555
  queryNode: S.cloneWithoutLimit(i(this, _).queryNode)
5536
5556
  });
5537
5557
  }
5538
5558
  clearOffset() {
5539
- return new N({
5559
+ return new v({
5540
5560
  ...i(this, _),
5541
5561
  queryNode: S.cloneWithoutOffset(i(this, _).queryNode)
5542
5562
  });
5543
5563
  }
5544
5564
  clearOrderBy() {
5545
- return new N({
5565
+ return new v({
5546
5566
  ...i(this, _),
5547
5567
  queryNode: S.cloneWithoutOrderBy(i(this, _).queryNode)
5548
5568
  });
5549
5569
  }
5550
5570
  clearGroupBy() {
5551
- return new N({
5571
+ return new v({
5552
5572
  ...i(this, _),
5553
5573
  queryNode: S.cloneWithoutGroupBy(i(this, _).queryNode)
5554
5574
  });
@@ -5557,24 +5577,24 @@ const N = class N {
5557
5577
  return e(this);
5558
5578
  }
5559
5579
  $if(e, n) {
5560
- return e ? n(this) : new N({
5580
+ return e ? n(this) : new v({
5561
5581
  ...i(this, _)
5562
5582
  });
5563
5583
  }
5564
5584
  $castTo() {
5565
- return new N(i(this, _));
5585
+ return new v(i(this, _));
5566
5586
  }
5567
5587
  $narrowType() {
5568
- return new N(i(this, _));
5588
+ return new v(i(this, _));
5569
5589
  }
5570
5590
  $assertType() {
5571
- return new N(i(this, _));
5591
+ return new v(i(this, _));
5572
5592
  }
5573
5593
  $asTuple() {
5574
5594
  return new T(this.toOperationNode());
5575
5595
  }
5576
5596
  withPlugin(e) {
5577
- return new N({
5597
+ return new v({
5578
5598
  ...i(this, _),
5579
5599
  executor: i(this, _).executor.withPlugin(e)
5580
5600
  });
@@ -5605,14 +5625,14 @@ const N = class N {
5605
5625
  yield* r.rows;
5606
5626
  }
5607
5627
  async explain(e, n) {
5608
- return await new N({
5628
+ return await new v({
5609
5629
  ...i(this, _),
5610
5630
  queryNode: A.cloneWithExplain(i(this, _).queryNode, e, n)
5611
5631
  }).execute();
5612
5632
  }
5613
5633
  };
5614
5634
  _ = new WeakMap();
5615
- let Et = N;
5635
+ let Et = v;
5616
5636
  Ae(Et, "don't await SelectQueryBuilder instances directly. To execute the query you need to call `execute` or `executeTakeFirst`.");
5617
5637
  function Ys(t) {
5618
5638
  return new Et(t);
@@ -5872,7 +5892,7 @@ const te = class te {
5872
5892
  * ```
5873
5893
  */
5874
5894
  over(e) {
5875
- const n = Js();
5895
+ const n = Ms();
5876
5896
  return new te({
5877
5897
  ...i(this, $),
5878
5898
  aggregateFunctionNode: ue.cloneWithOver(i(this, $).aggregateFunctionNode, (e ? e(n) : n).toOperationNode())
@@ -5934,8 +5954,8 @@ class Hs {
5934
5954
  }
5935
5955
  Qe = new WeakMap(), Ve = new WeakMap();
5936
5956
  function Xs() {
5937
- const t = (n, a) => new T(qn.create(n, lt(a ?? []))), e = (n, a) => new Le({
5938
- aggregateFunctionNode: ue.create(n, a ? lt(a) : void 0)
5957
+ const t = (n, a) => new T(qn.create(n, dt(a ?? []))), e = (n, a) => new Le({
5958
+ aggregateFunctionNode: ue.create(n, a ? dt(a) : void 0)
5939
5959
  });
5940
5960
  return Object.assign(t, {
5941
5961
  agg: e,
@@ -5950,7 +5970,7 @@ function Xs() {
5950
5970
  },
5951
5971
  countAll(n) {
5952
5972
  return new Le({
5953
- aggregateFunctionNode: ue.create("count", la(n))
5973
+ aggregateFunctionNode: ue.create("count", da(n))
5954
5974
  });
5955
5975
  },
5956
5976
  max(n) {
@@ -6108,7 +6128,7 @@ const Bn = s({
6108
6128
  });
6109
6129
  }
6110
6130
  });
6111
- var V, gt, dn;
6131
+ var V, gt, cn;
6112
6132
  class un {
6113
6133
  constructor(e) {
6114
6134
  C(this, gt);
@@ -6183,7 +6203,7 @@ class un {
6183
6203
  * ```
6184
6204
  */
6185
6205
  at(e) {
6186
- return y(this, gt, dn).call(this, "ArrayLocation", e);
6206
+ return w(this, gt, cn).call(this, "ArrayLocation", e);
6187
6207
  }
6188
6208
  /**
6189
6209
  * Access a property of a JSON object.
@@ -6235,10 +6255,10 @@ class un {
6235
6255
  * ```
6236
6256
  */
6237
6257
  key(e) {
6238
- return y(this, gt, dn).call(this, "Member", e);
6258
+ return w(this, gt, cn).call(this, "Member", e);
6239
6259
  }
6240
6260
  }
6241
- V = new WeakMap(), gt = new WeakSet(), dn = function(e, n) {
6261
+ V = new WeakMap(), gt = new WeakSet(), cn = function(e, n) {
6242
6262
  return Tt.is(i(this, V)) ? new At(Tt.cloneWithTraversal(i(this, V), st.is(i(this, V).traversal) ? st.cloneWithLeg(i(this, V).traversal, Bn.create(e, n)) : sa.cloneWithValue(i(this, V).traversal, pe.createImmediate(n)))) : new At(st.cloneWithLeg(i(this, V), Bn.create(e, n)));
6243
6263
  };
6244
6264
  var Se;
@@ -6272,12 +6292,12 @@ const Lt = class Lt extends un {
6272
6292
  };
6273
6293
  Se = new WeakMap();
6274
6294
  let At = Lt;
6275
- var Xe, ce;
6295
+ var Xe, le;
6276
6296
  class ru {
6277
6297
  constructor(e, n) {
6278
6298
  C(this, Xe);
6279
- C(this, ce);
6280
- b(this, Xe, e), b(this, ce, n);
6299
+ C(this, le);
6300
+ b(this, Xe, e), b(this, le, n);
6281
6301
  }
6282
6302
  /** @private */
6283
6303
  get expression() {
@@ -6285,13 +6305,13 @@ class ru {
6285
6305
  }
6286
6306
  /** @private */
6287
6307
  get alias() {
6288
- return i(this, ce);
6308
+ return i(this, le);
6289
6309
  }
6290
6310
  toOperationNode() {
6291
- return ye.create(i(this, Xe).toOperationNode(), q(i(this, ce)) ? i(this, ce).toOperationNode() : F.create(i(this, ce)));
6311
+ return ye.create(i(this, Xe).toOperationNode(), q(i(this, le)) ? i(this, le).toOperationNode() : F.create(i(this, le)));
6292
6312
  }
6293
6313
  }
6294
- Xe = new WeakMap(), ce = new WeakMap();
6314
+ Xe = new WeakMap(), le = new WeakMap();
6295
6315
  const Wn = s({
6296
6316
  is(t) {
6297
6317
  return t.kind === "TupleNode";
@@ -6372,14 +6392,14 @@ const Wn = s({
6372
6392
  function uu(t) {
6373
6393
  return !!(ou.includes(t) || iu.some((e) => e.test(t)));
6374
6394
  }
6375
- function du(t) {
6395
+ function cu(t) {
6376
6396
  if (q(t))
6377
6397
  return t.toOperationNode();
6378
6398
  if (uu(t))
6379
6399
  return su.create(t);
6380
6400
  throw new Error(`invalid column data type ${JSON.stringify(t)}`);
6381
6401
  }
6382
- const cu = s({
6402
+ const lu = s({
6383
6403
  is(t) {
6384
6404
  return t.kind === "CastNode";
6385
6405
  },
@@ -6405,7 +6425,7 @@ function xn(t = ga) {
6405
6425
  return Ys({
6406
6426
  queryId: H(),
6407
6427
  executor: t,
6408
- queryNode: S.createFrom(lu(r))
6428
+ queryNode: S.createFrom(du(r))
6409
6429
  });
6410
6430
  },
6411
6431
  case(r) {
@@ -6461,7 +6481,7 @@ function xn(t = ga) {
6461
6481
  return _t.is(o) ? new T(o) : new T(_t.create(o));
6462
6482
  },
6463
6483
  cast(r, o) {
6464
- return new T(cu.create(L(r), du(o)));
6484
+ return new T(lu.create(L(r), cu(o)));
6465
6485
  },
6466
6486
  withSchema(r) {
6467
6487
  return xn(t.withPluginAtFront(new pa(r)));
@@ -6489,7 +6509,7 @@ function Na(t) {
6489
6509
  function Kt(t) {
6490
6510
  return Gi(t) || Yi(t) || Ee(t);
6491
6511
  }
6492
- function lu(t) {
6512
+ function du(t) {
6493
6513
  return me(t) ? t.map((e) => $t(e)) : [$t(t)];
6494
6514
  }
6495
6515
  function $t(t) {
@@ -6514,10 +6534,10 @@ function W(t) {
6514
6534
  function va(t) {
6515
6535
  return t.trim();
6516
6536
  }
6517
- var P, J, xt, cn, ln;
6518
- const ct = class ct {
6537
+ var P, M, xt, ln, dn;
6538
+ const lt = class lt {
6519
6539
  constructor(e) {
6520
- C(this, J);
6540
+ C(this, M);
6521
6541
  C(this, P);
6522
6542
  b(this, P, s(e));
6523
6543
  }
@@ -6530,64 +6550,64 @@ const ct = class ct {
6530
6550
  return new Ca(this, e);
6531
6551
  }
6532
6552
  $castTo() {
6533
- return new ct({ ...i(this, P) });
6553
+ return new lt({ ...i(this, P) });
6534
6554
  }
6535
6555
  $notNull() {
6536
- return new ct(i(this, P));
6556
+ return new lt(i(this, P));
6537
6557
  }
6538
6558
  withPlugin(e) {
6539
- return new ct({
6559
+ return new lt({
6540
6560
  ...i(this, P),
6541
6561
  plugins: i(this, P).plugins !== void 0 ? s([...i(this, P).plugins, e]) : s([e])
6542
6562
  });
6543
6563
  }
6544
6564
  toOperationNode() {
6545
- return y(this, J, cn).call(this, y(this, J, xt).call(this));
6565
+ return w(this, M, ln).call(this, w(this, M, xt).call(this));
6546
6566
  }
6547
6567
  compile(e) {
6548
- return y(this, J, ln).call(this, y(this, J, xt).call(this, e));
6568
+ return w(this, M, dn).call(this, w(this, M, xt).call(this, e));
6549
6569
  }
6550
6570
  async execute(e) {
6551
- const n = y(this, J, xt).call(this, e);
6552
- return n.executeQuery(y(this, J, ln).call(this, n), i(this, P).queryId);
6571
+ const n = w(this, M, xt).call(this, e);
6572
+ return n.executeQuery(w(this, M, dn).call(this, n), i(this, P).queryId);
6553
6573
  }
6554
6574
  };
6555
- P = new WeakMap(), J = new WeakSet(), xt = function(e) {
6575
+ P = new WeakMap(), M = new WeakSet(), xt = function(e) {
6556
6576
  const n = e !== void 0 ? e.getExecutor() : ga;
6557
6577
  return i(this, P).plugins !== void 0 ? n.withPlugins(i(this, P).plugins) : n;
6558
- }, cn = function(e) {
6559
- return e.transformQuery(i(this, P).rawNode, i(this, P).queryId);
6560
6578
  }, ln = function(e) {
6561
- return e.compileQuery(y(this, J, cn).call(this, e), i(this, P).queryId);
6579
+ return e.transformQuery(i(this, P).rawNode, i(this, P).queryId);
6580
+ }, dn = function(e) {
6581
+ return e.compileQuery(w(this, M, ln).call(this, e), i(this, P).queryId);
6562
6582
  };
6563
- let Pt = ct;
6583
+ let Pt = lt;
6564
6584
  function se(t) {
6565
6585
  return new Pt(t);
6566
6586
  }
6567
6587
  Ae(Pt, "don't await RawBuilder instances directly. To execute the query you need to call `execute`");
6568
- var ke, le;
6588
+ var ke, de;
6569
6589
  class Ca {
6570
6590
  constructor(e, n) {
6571
6591
  C(this, ke);
6572
- C(this, le);
6573
- b(this, ke, e), b(this, le, n);
6592
+ C(this, de);
6593
+ b(this, ke, e), b(this, de, n);
6574
6594
  }
6575
6595
  get expression() {
6576
6596
  return i(this, ke);
6577
6597
  }
6578
6598
  get alias() {
6579
- return i(this, le);
6599
+ return i(this, de);
6580
6600
  }
6581
6601
  get rawBuilder() {
6582
6602
  return i(this, ke);
6583
6603
  }
6584
6604
  toOperationNode() {
6585
- return ye.create(i(this, ke).toOperationNode(), q(i(this, le)) ? i(this, le).toOperationNode() : F.create(i(this, le)));
6605
+ return ye.create(i(this, ke).toOperationNode(), q(i(this, de)) ? i(this, de).toOperationNode() : F.create(i(this, de)));
6586
6606
  }
6587
6607
  }
6588
- ke = new WeakMap(), le = new WeakMap();
6608
+ ke = new WeakMap(), de = new WeakMap();
6589
6609
  Ae(Ca, "don't await AliasedRawBuilder instances directly. AliasedRawBuilder should never be executed directly since it's always a part of another query.");
6590
- const p = Object.assign((t, ...e) => se({
6610
+ const g = Object.assign((t, ...e) => se({
6591
6611
  queryId: H(),
6592
6612
  rawNode: R.create(t, (e == null ? void 0 : e.map(Kn)) ?? [])
6593
6613
  }), {
@@ -6634,7 +6654,7 @@ const p = Object.assign((t, ...e) => se({
6634
6654
  rawNode: R.createWithSql(t)
6635
6655
  });
6636
6656
  },
6637
- join(t, e = p`, `) {
6657
+ join(t, e = g`, `) {
6638
6658
  const n = new Array(2 * t.length - 1), a = e.toOperationNode();
6639
6659
  for (let r = 0; r < t.length; ++r)
6640
6660
  n[2 * r] = Kn(t[r]), r !== t.length - 1 && (n[2 * r + 1] = a);
@@ -6669,8 +6689,8 @@ class xa {
6669
6689
  * The returned array is sorted by migration name.
6670
6690
  */
6671
6691
  async getMigrations() {
6672
- const e = await y(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"]).$narrowType().execute() : [];
6673
- return (await y(this, m, hn).call(this)).map(({ name: a, ...r }) => {
6692
+ 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"]).$narrowType().execute() : [];
6693
+ return (await w(this, m, hn).call(this)).map(({ name: a, ...r }) => {
6674
6694
  const o = e.find((u) => u.name === a);
6675
6695
  return {
6676
6696
  name: a,
@@ -6726,7 +6746,7 @@ class xa {
6726
6746
  * ```
6727
6747
  */
6728
6748
  async migrateToLatest() {
6729
- return y(this, m, rt).call(this, () => ({ direction: "Up", step: 1 / 0 }));
6749
+ return w(this, m, rt).call(this, () => ({ direction: "Up", step: 1 / 0 }));
6730
6750
  }
6731
6751
  /**
6732
6752
  * Migrate up/down to a specific migration.
@@ -6780,12 +6800,12 @@ class xa {
6780
6800
  * ```
6781
6801
  */
6782
6802
  async migrateTo(e) {
6783
- return y(this, m, rt).call(this, ({ migrations: n, executedMigrations: a, pendingMigrations: r }) => {
6803
+ return w(this, m, rt).call(this, ({ migrations: n, executedMigrations: a, pendingMigrations: r }) => {
6784
6804
  if (e === pu)
6785
6805
  return { direction: "Down", step: 1 / 0 };
6786
- if (!n.find((d) => d.name === e))
6806
+ if (!n.find((c) => c.name === e))
6787
6807
  throw new Error(`migration "${e}" doesn't exist`);
6788
- const o = a.indexOf(e), u = r.findIndex((d) => d.name === e);
6808
+ const o = a.indexOf(e), u = r.findIndex((c) => c.name === e);
6789
6809
  if (o !== -1)
6790
6810
  return {
6791
6811
  direction: "Down",
@@ -6825,7 +6845,7 @@ class xa {
6825
6845
  * ```
6826
6846
  */
6827
6847
  async migrateUp() {
6828
- return y(this, m, rt).call(this, () => ({ direction: "Up", step: 1 }));
6848
+ return w(this, m, rt).call(this, () => ({ direction: "Up", step: 1 }));
6829
6849
  }
6830
6850
  /**
6831
6851
  * Migrate one step down.
@@ -6856,12 +6876,12 @@ class xa {
6856
6876
  * ```
6857
6877
  */
6858
6878
  async migrateDown() {
6859
- return y(this, m, rt).call(this, () => ({ direction: "Down", step: 1 }));
6879
+ return w(this, m, rt).call(this, () => ({ direction: "Down", step: 1 }));
6860
6880
  }
6861
6881
  }
6862
6882
  k = new WeakMap(), m = new WeakSet(), rt = async function(e) {
6863
6883
  try {
6864
- return await y(this, m, Oa).call(this), await y(this, m, Ea).call(this, e);
6884
+ return await w(this, m, Oa).call(this), await w(this, m, Ea).call(this, e);
6865
6885
  } catch (n) {
6866
6886
  return n instanceof Yt ? n.resultSet : { error: n };
6867
6887
  }
@@ -6876,37 +6896,37 @@ k = new WeakMap(), m = new WeakSet(), rt = async function(e) {
6876
6896
  }, ee = function() {
6877
6897
  return i(this, m, X) ? new pa(i(this, m, X)) : new mu();
6878
6898
  }, Oa = async function() {
6879
- await y(this, m, Ta).call(this), await y(this, m, Sa).call(this), await y(this, m, ka).call(this), await y(this, m, Ia).call(this);
6899
+ await w(this, m, Ta).call(this), await w(this, m, Sa).call(this), await w(this, m, ka).call(this), await w(this, m, Ia).call(this);
6880
6900
  }, Ta = async function() {
6881
- if (i(this, m, X) && !await y(this, m, _n).call(this))
6901
+ if (i(this, m, X) && !await w(this, m, _n).call(this))
6882
6902
  try {
6883
- await y(this, m, ot).call(this, i(this, k).db.schema.createSchema(i(this, m, X)));
6903
+ await w(this, m, ot).call(this, i(this, k).db.schema.createSchema(i(this, m, X)));
6884
6904
  } catch (e) {
6885
- if (!await y(this, m, _n).call(this))
6905
+ if (!await w(this, m, _n).call(this))
6886
6906
  throw e;
6887
6907
  }
6888
6908
  }, Sa = async function() {
6889
- if (!await y(this, m, Re).call(this, i(this, m, Z)))
6909
+ if (!await w(this, m, Re).call(this, i(this, m, Z)))
6890
6910
  try {
6891
- i(this, m, X) && await y(this, m, ot).call(this, i(this, k).db.schema.createSchema(i(this, m, X))), await y(this, m, ot).call(this, i(this, k).db.schema.withPlugin(i(this, m, ee)).createTable(i(this, m, Z)).addColumn("name", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("timestamp", "varchar(255)", (e) => e.notNull()));
6911
+ i(this, m, X) && await w(this, m, ot).call(this, i(this, k).db.schema.createSchema(i(this, m, X))), await w(this, m, ot).call(this, i(this, k).db.schema.withPlugin(i(this, m, ee)).createTable(i(this, m, Z)).addColumn("name", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("timestamp", "varchar(255)", (e) => e.notNull()));
6892
6912
  } catch (e) {
6893
- if (!await y(this, m, Re).call(this, i(this, m, Z)))
6913
+ if (!await w(this, m, Re).call(this, i(this, m, Z)))
6894
6914
  throw e;
6895
6915
  }
6896
6916
  }, ka = async function() {
6897
- if (!await y(this, m, Re).call(this, i(this, m, ze)))
6917
+ if (!await w(this, m, Re).call(this, i(this, m, ze)))
6898
6918
  try {
6899
- await y(this, m, ot).call(this, i(this, k).db.schema.withPlugin(i(this, m, ee)).createTable(i(this, m, ze)).addColumn("id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("is_locked", "integer", (e) => e.notNull().defaultTo(0)));
6919
+ await w(this, m, ot).call(this, i(this, k).db.schema.withPlugin(i(this, m, ee)).createTable(i(this, m, ze)).addColumn("id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("is_locked", "integer", (e) => e.notNull().defaultTo(0)));
6900
6920
  } catch (e) {
6901
- if (!await y(this, m, Re).call(this, i(this, m, ze)))
6921
+ if (!await w(this, m, Re).call(this, i(this, m, ze)))
6902
6922
  throw e;
6903
6923
  }
6904
6924
  }, Ia = async function() {
6905
- if (!await y(this, m, mn).call(this))
6925
+ if (!await w(this, m, mn).call(this))
6906
6926
  try {
6907
6927
  await i(this, k).db.withPlugin(i(this, m, ee)).insertInto(i(this, m, ze)).values({ id: Gt, is_locked: 0 }).execute();
6908
6928
  } catch (e) {
6909
- if (!await y(this, m, mn).call(this))
6929
+ if (!await w(this, m, mn).call(this))
6910
6930
  throw e;
6911
6931
  }
6912
6932
  }, _n = async function() {
@@ -6926,20 +6946,20 @@ k = new WeakMap(), m = new WeakSet(), rt = async function(e) {
6926
6946
  }), r = async (o) => {
6927
6947
  try {
6928
6948
  await n.acquireMigrationLock(o, a);
6929
- const u = await y(this, m, Aa).call(this, o);
6949
+ const u = await w(this, m, Aa).call(this, o);
6930
6950
  if (u.migrations.length === 0)
6931
6951
  return { results: [] };
6932
- const { direction: d, step: c } = e(u);
6933
- return c <= 0 ? { results: [] } : d === "Down" ? await y(this, m, Ra).call(this, o, u, c) : d === "Up" ? await y(this, m, Fa).call(this, o, u, c) : { results: [] };
6952
+ const { direction: c, step: l } = e(u);
6953
+ return l <= 0 ? { results: [] } : c === "Down" ? await w(this, m, Ra).call(this, o, u, l) : c === "Up" ? await w(this, m, Fa).call(this, o, u, l) : { results: [] };
6934
6954
  } finally {
6935
6955
  await n.releaseMigrationLock(o, a);
6936
6956
  }
6937
6957
  };
6938
6958
  return n.supportsTransactionalDdl ? i(this, k).db.transaction().execute(r) : i(this, k).db.connection().execute(r);
6939
6959
  }, Aa = async function(e) {
6940
- const n = await y(this, m, hn).call(this), a = await y(this, m, Pa).call(this, e);
6941
- y(this, m, Da).call(this, n, a), i(this, m, ba) || y(this, m, za).call(this, n, a);
6942
- const r = y(this, m, $a).call(this, n, a);
6960
+ const n = await w(this, m, hn).call(this), a = await w(this, m, Pa).call(this, e);
6961
+ w(this, m, Da).call(this, n, a), i(this, m, ba) || w(this, m, za).call(this, n, a);
6962
+ const r = w(this, m, $a).call(this, n, a);
6943
6963
  return s({
6944
6964
  migrations: n,
6945
6965
  executedMigrations: a,
@@ -6966,26 +6986,26 @@ k = new WeakMap(), m = new WeakSet(), rt = async function(e) {
6966
6986
  if (e[a].name !== n[a])
6967
6987
  throw new Error(`corrupted migrations: expected previously executed migration ${n[a]} to be at index ${a} but ${e[a].name} was found in its place. New migrations must always have a name that comes alphabetically after the last executed migration.`);
6968
6988
  }, Ra = async function(e, n, a) {
6969
- const r = n.executedMigrations.slice().reverse().slice(0, a).map((u) => n.migrations.find((d) => d.name === u)), o = r.map((u) => ({
6989
+ const r = n.executedMigrations.slice().reverse().slice(0, a).map((u) => n.migrations.find((c) => c.name === u)), o = r.map((u) => ({
6970
6990
  migrationName: u.name,
6971
6991
  direction: "Down",
6972
6992
  status: "NotExecuted"
6973
6993
  }));
6974
6994
  for (let u = 0; u < o.length; ++u) {
6975
- const d = r[u];
6995
+ const c = r[u];
6976
6996
  try {
6977
- 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] = {
6978
- migrationName: d.name,
6997
+ 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] = {
6998
+ migrationName: c.name,
6979
6999
  direction: "Down",
6980
7000
  status: "Success"
6981
7001
  });
6982
- } catch (c) {
7002
+ } catch (l) {
6983
7003
  throw o[u] = {
6984
- migrationName: d.name,
7004
+ migrationName: c.name,
6985
7005
  direction: "Down",
6986
7006
  status: "Error"
6987
7007
  }, new Yt({
6988
- error: c,
7008
+ error: l,
6989
7009
  results: o
6990
7010
  });
6991
7011
  }
@@ -6998,23 +7018,23 @@ k = new WeakMap(), m = new WeakSet(), rt = async function(e) {
6998
7018
  status: "NotExecuted"
6999
7019
  }));
7000
7020
  for (let u = 0; u < o.length; u++) {
7001
- const d = n.pendingMigrations[u];
7021
+ const c = n.pendingMigrations[u];
7002
7022
  try {
7003
- await d.up(e), await e.withPlugin(i(this, m, ee)).insertInto(i(this, m, Z)).values({
7004
- name: d.name,
7023
+ await c.up(e), await e.withPlugin(i(this, m, ee)).insertInto(i(this, m, Z)).values({
7024
+ name: c.name,
7005
7025
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
7006
7026
  }).execute(), o[u] = {
7007
- migrationName: d.name,
7027
+ migrationName: c.name,
7008
7028
  direction: "Up",
7009
7029
  status: "Success"
7010
7030
  };
7011
- } catch (c) {
7031
+ } catch (l) {
7012
7032
  throw o[u] = {
7013
- migrationName: d.name,
7033
+ migrationName: c.name,
7014
7034
  direction: "Up",
7015
7035
  status: "Error"
7016
7036
  }, new Yt({
7017
- error: c,
7037
+ error: l,
7018
7038
  results: o
7019
7039
  });
7020
7040
  }
@@ -7230,12 +7250,12 @@ async function ju(t) {
7230
7250
  }
7231
7251
  async function Lu(t) {
7232
7252
  }
7233
- const Ju = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7253
+ const Mu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7234
7254
  __proto__: null,
7235
7255
  down: Lu,
7236
7256
  up: ju
7237
7257
  }, Symbol.toStringTag, { value: "Module" }));
7238
- async function Mu(t) {
7258
+ async function Ju(t) {
7239
7259
  await t.schema.alterTable("passwords").addColumn(
7240
7260
  "password",
7241
7261
  "varchar(255)",
@@ -7249,7 +7269,7 @@ async function qu(t) {
7249
7269
  const Bu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7250
7270
  __proto__: null,
7251
7271
  down: qu,
7252
- up: Mu
7272
+ up: Ju
7253
7273
  }, Symbol.toStringTag, { value: "Module" }));
7254
7274
  async function Wu(t) {
7255
7275
  }
@@ -7281,48 +7301,48 @@ const Xu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7281
7301
  async function Zu(t) {
7282
7302
  await t.schema.createIndex("users_email_index").on("users").column("email").execute();
7283
7303
  }
7284
- async function ed(t) {
7304
+ async function ec(t) {
7285
7305
  await t.schema.dropIndex("users_email_index").execute();
7286
7306
  }
7287
- const td = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7307
+ const tc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7288
7308
  __proto__: null,
7289
- down: ed,
7309
+ down: ec,
7290
7310
  up: Zu
7291
7311
  }, Symbol.toStringTag, { value: "Module" }));
7292
- async function nd(t) {
7312
+ async function nc(t) {
7293
7313
  await t.schema.alterTable("users").addColumn("profileData", "varchar(2048)").execute();
7294
7314
  }
7295
- async function ad(t) {
7315
+ async function ac(t) {
7296
7316
  await t.schema.alterTable("users").dropColumn("profileData").execute();
7297
7317
  }
7298
- const rd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7318
+ const rc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7299
7319
  __proto__: null,
7300
- down: ad,
7301
- up: nd
7320
+ down: ac,
7321
+ up: nc
7302
7322
  }, Symbol.toStringTag, { value: "Module" }));
7303
- async function od(t) {
7323
+ async function oc(t) {
7304
7324
  await t.schema.createIndex("users_linked_to_index").on("users").column("linked_to").execute();
7305
7325
  }
7306
- async function id(t) {
7326
+ async function ic(t) {
7307
7327
  await t.schema.dropIndex("users_linked_to_index");
7308
7328
  }
7309
- const sd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7329
+ const sc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7310
7330
  __proto__: null,
7311
- down: id,
7312
- up: od
7331
+ down: ic,
7332
+ up: oc
7313
7333
  }, Symbol.toStringTag, { value: "Module" }));
7314
- async function ud(t) {
7334
+ async function uc(t) {
7315
7335
  await t.schema.alterTable("users").addColumn("locale", "varchar(255)").execute();
7316
7336
  }
7317
- async function dd(t) {
7337
+ async function cc(t) {
7318
7338
  await t.schema.alterTable("users").dropColumn("locale").execute();
7319
7339
  }
7320
- const cd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7340
+ const lc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7321
7341
  __proto__: null,
7322
- down: dd,
7323
- up: ud
7342
+ down: cc,
7343
+ up: uc
7324
7344
  }, Symbol.toStringTag, { value: "Module" }));
7325
- async function ld(t) {
7345
+ async function dc(t) {
7326
7346
  await t.schema.createTable("keys").addColumn("kid", "varchar(255)", (e) => e.primaryKey()).addColumn(
7327
7347
  "tenant_id",
7328
7348
  "varchar(255)",
@@ -7337,202 +7357,202 @@ async function ld(t) {
7337
7357
  (e) => e.references("connections.id").onDelete("cascade")
7338
7358
  ).execute();
7339
7359
  }
7340
- async function _d(t) {
7360
+ async function _c(t) {
7341
7361
  await t.schema.dropTable("keys").execute();
7342
7362
  }
7343
- const md = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7363
+ const mc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7344
7364
  __proto__: null,
7345
- down: _d,
7346
- up: ld
7365
+ down: _c,
7366
+ up: dc
7347
7367
  }, Symbol.toStringTag, { value: "Module" }));
7348
- async function hd(t) {
7368
+ async function hc(t) {
7349
7369
  }
7350
- async function fd(t) {
7370
+ async function fc(t) {
7351
7371
  }
7352
- const pd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7372
+ const pc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7353
7373
  __proto__: null,
7354
- down: fd,
7355
- up: hd
7374
+ down: fc,
7375
+ up: hc
7356
7376
  }, Symbol.toStringTag, { value: "Module" }));
7357
- async function gd(t) {
7377
+ async function gc(t) {
7358
7378
  }
7359
- async function yd(t) {
7379
+ async function yc(t) {
7360
7380
  }
7361
- const wd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7381
+ const wc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7362
7382
  __proto__: null,
7363
- down: yd,
7364
- up: gd
7383
+ down: yc,
7384
+ up: gc
7365
7385
  }, Symbol.toStringTag, { value: "Module" }));
7366
- async function Nd(t) {
7386
+ async function Nc(t) {
7367
7387
  await t.schema.alterTable("otps").addColumn("audience", "varchar(255)").execute();
7368
7388
  }
7369
- async function vd(t) {
7389
+ async function vc(t) {
7370
7390
  await t.schema.alterTable("otps").dropColumn("audience").execute();
7371
7391
  }
7372
- const Cd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7392
+ const Cc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7373
7393
  __proto__: null,
7374
- down: vd,
7375
- up: Nd
7394
+ down: vc,
7395
+ up: Nc
7376
7396
  }, Symbol.toStringTag, { value: "Module" }));
7377
- async function xd(t) {
7397
+ async function xc(t) {
7378
7398
  }
7379
- async function bd(t) {
7399
+ async function bc(t) {
7380
7400
  }
7381
- const Od = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7401
+ const Oc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7382
7402
  __proto__: null,
7383
- down: bd,
7384
- up: xd
7403
+ down: bc,
7404
+ up: xc
7385
7405
  }, Symbol.toStringTag, { value: "Module" }));
7386
- async function Td(t) {
7406
+ async function Tc(t) {
7387
7407
  await t.schema.alterTable("logs").dropColumn("category").execute();
7388
7408
  }
7389
- async function Sd(t) {
7409
+ async function Sc(t) {
7390
7410
  await t.schema.alterTable("logs").addColumn("category", "varchar(255)", (e) => e.notNull()).execute();
7391
7411
  }
7392
- const kd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7412
+ const kc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7393
7413
  __proto__: null,
7394
- down: Sd,
7395
- up: Td
7414
+ down: Sc,
7415
+ up: Tc
7396
7416
  }, Symbol.toStringTag, { value: "Module" }));
7397
- async function Id(t) {
7417
+ async function Ic(t) {
7398
7418
  await t.schema.alterTable("users").dropColumn("tags").execute();
7399
7419
  }
7400
- async function Ed(t) {
7420
+ async function Ec(t) {
7401
7421
  await t.schema.alterTable("users").addColumn("tags", "varchar(255)").execute();
7402
7422
  }
7403
- const Ad = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7423
+ const Ac = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7404
7424
  __proto__: null,
7405
- down: Ed,
7406
- up: Id
7425
+ down: Ec,
7426
+ up: Ic
7407
7427
  }, Symbol.toStringTag, { value: "Module" }));
7408
- async function $d(t) {
7428
+ async function $c(t) {
7409
7429
  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();
7410
7430
  }
7411
- async function Pd(t) {
7431
+ async function Pc(t) {
7412
7432
  await t.schema.dropIndex("logs_user_id"), await t.schema.dropIndex("logs_tenant_id"), await t.schema.dropIndex("logs_date");
7413
7433
  }
7414
- const Dd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7434
+ const Dc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7415
7435
  __proto__: null,
7416
- down: Pd,
7417
- up: $d
7436
+ down: Pc,
7437
+ up: $c
7418
7438
  }, Symbol.toStringTag, { value: "Module" }));
7419
- async function zd(t) {
7439
+ async function zc(t) {
7420
7440
  await t.schema.alterTable("logs").dropColumn("details").execute(), await t.schema.alterTable("logs").addColumn("details", "varchar(8192)").execute();
7421
7441
  }
7422
- async function Rd(t) {
7442
+ async function Rc(t) {
7423
7443
  await t.schema.alterTable("logs").dropColumn("details").execute(), await t.schema.alterTable("logs").addColumn("details", "varchar(2048)").execute();
7424
7444
  }
7425
- const Fd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7445
+ const Fc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7426
7446
  __proto__: null,
7427
- down: Rd,
7428
- up: zd
7447
+ down: Rc,
7448
+ up: zc
7429
7449
  }, Symbol.toStringTag, { value: "Module" }));
7430
- async function jd(t) {
7450
+ async function jc(t) {
7431
7451
  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();
7432
7452
  }
7433
- async function Ld(t) {
7453
+ async function Lc(t) {
7434
7454
  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();
7435
7455
  }
7436
- const Jd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7456
+ const Mc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7437
7457
  __proto__: null,
7438
- down: Ld,
7439
- up: jd
7458
+ down: Lc,
7459
+ up: jc
7440
7460
  }, Symbol.toStringTag, { value: "Module" }));
7441
- async function Md(t) {
7461
+ async function Jc(t) {
7442
7462
  await t.schema.createIndex("users_name_index").on("users").column("name").execute();
7443
7463
  }
7444
- async function qd(t) {
7464
+ async function qc(t) {
7445
7465
  await t.schema.dropIndex("users_name_index").execute();
7446
7466
  }
7447
- const Bd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7467
+ const Bc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7448
7468
  __proto__: null,
7449
- down: qd,
7450
- up: Md
7469
+ down: qc,
7470
+ up: Jc
7451
7471
  }, Symbol.toStringTag, { value: "Module" }));
7452
- async function Wd(t) {
7472
+ async function Wc(t) {
7453
7473
  }
7454
- async function Kd(t) {
7474
+ async function Kc(t) {
7455
7475
  await t.schema.alterTable("users").dropConstraint("unique_email_provider").execute();
7456
7476
  }
7457
- const Ud = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7477
+ const Uc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7458
7478
  __proto__: null,
7459
- down: Kd,
7460
- up: Wd
7479
+ down: Kc,
7480
+ up: Wc
7461
7481
  }, Symbol.toStringTag, { value: "Module" }));
7462
- async function Qd(t) {
7482
+ async function Qc(t) {
7463
7483
  await t.schema.alterTable("otps").dropColumn("state").execute(), await t.schema.alterTable("otps").addColumn("state", "varchar(8192)").execute();
7464
7484
  }
7465
- async function Vd(t) {
7485
+ async function Vc(t) {
7466
7486
  await t.schema.alterTable("otps").dropColumn("state").execute(), await t.schema.alterTable("otps").addColumn("state", "varchar(1024)").execute();
7467
7487
  }
7468
- const Gd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7488
+ const Gc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7469
7489
  __proto__: null,
7470
- down: Vd,
7471
- up: Qd
7490
+ down: Vc,
7491
+ up: Qc
7472
7492
  }, Symbol.toStringTag, { value: "Module" }));
7473
- async function Yd(t) {
7493
+ async function Yc(t) {
7474
7494
  await t.schema.alterTable("tickets").dropColumn("state").execute(), await t.schema.alterTable("tickets").addColumn("state", "varchar(8192)").execute();
7475
7495
  }
7476
- async function Hd(t) {
7496
+ async function Hc(t) {
7477
7497
  await t.schema.alterTable("tickets").dropColumn("state").execute(), await t.schema.alterTable("tickets").addColumn("state", "varchar(1024)").execute();
7478
7498
  }
7479
- const Xd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7499
+ const Xc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7480
7500
  __proto__: null,
7481
- down: Hd,
7482
- up: Yd
7501
+ down: Hc,
7502
+ up: Yc
7483
7503
  }, Symbol.toStringTag, { value: "Module" }));
7484
- async function Zd(t) {
7504
+ async function Zc(t) {
7485
7505
  await t.schema.createTable("branding").addColumn(
7486
7506
  "tenant_id",
7487
7507
  "varchar(255)",
7488
7508
  (e) => e.references("tenants.id").onDelete("cascade").notNull().primaryKey()
7489
7509
  ).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();
7490
7510
  }
7491
- async function ec(t) {
7511
+ async function el(t) {
7492
7512
  await t.schema.dropTable("branding").execute();
7493
7513
  }
7494
- const tc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7514
+ const tl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7495
7515
  __proto__: null,
7496
- down: ec,
7497
- up: Zd
7516
+ down: el,
7517
+ up: Zc
7498
7518
  }, Symbol.toStringTag, { value: "Module" }));
7499
- async function nc(t) {
7519
+ async function nl(t) {
7500
7520
  }
7501
- async function ac(t) {
7521
+ async function al(t) {
7502
7522
  }
7503
- const rc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7523
+ const rl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7504
7524
  __proto__: null,
7505
- down: ac,
7506
- up: nc
7525
+ down: al,
7526
+ up: nl
7507
7527
  }, Symbol.toStringTag, { value: "Module" }));
7508
- async function oc(t) {
7528
+ async function ol(t) {
7509
7529
  }
7510
- async function ic(t) {
7530
+ async function il(t) {
7511
7531
  }
7512
- const sc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7532
+ const sl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7513
7533
  __proto__: null,
7514
- down: ic,
7515
- up: oc
7534
+ down: il,
7535
+ up: ol
7516
7536
  }, Symbol.toStringTag, { value: "Module" }));
7517
- async function uc(t) {
7537
+ async function ul(t) {
7518
7538
  }
7519
- async function dc(t) {
7539
+ async function cl(t) {
7520
7540
  }
7521
- const cc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7541
+ const ll = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7522
7542
  __proto__: null,
7523
- down: dc,
7524
- up: uc
7543
+ down: cl,
7544
+ up: ul
7525
7545
  }, Symbol.toStringTag, { value: "Module" }));
7526
- async function lc(t) {
7546
+ async function dl(t) {
7527
7547
  }
7528
- async function _c(t) {
7548
+ async function _l(t) {
7529
7549
  }
7530
- const mc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7550
+ const ml = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7531
7551
  __proto__: null,
7532
- down: _c,
7533
- up: lc
7552
+ down: _l,
7553
+ up: dl
7534
7554
  }, Symbol.toStringTag, { value: "Module" }));
7535
- async function hc(t) {
7555
+ async function hl(t) {
7536
7556
  await t.schema.createTable("authentication_codes").addColumn(
7537
7557
  "tenant_id",
7538
7558
  "varchar(255)",
@@ -7543,55 +7563,55 @@ async function hc(t) {
7543
7563
  (e) => e.references("applications.id").onDelete("cascade").notNull()
7544
7564
  ).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();
7545
7565
  }
7546
- async function fc(t) {
7566
+ async function fl(t) {
7547
7567
  await t.schema.dropTable("authentication_codes").execute();
7548
7568
  }
7549
- const pc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7569
+ const pl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7550
7570
  __proto__: null,
7551
- down: fc,
7552
- up: hc
7571
+ down: fl,
7572
+ up: hl
7553
7573
  }, Symbol.toStringTag, { value: "Module" }));
7554
- async function gc(t) {
7574
+ async function gl(t) {
7555
7575
  }
7556
- async function yc(t) {
7576
+ async function yl(t) {
7557
7577
  }
7558
- const wc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7578
+ const wl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7559
7579
  __proto__: null,
7560
- down: yc,
7561
- up: gc
7580
+ down: yl,
7581
+ up: gl
7562
7582
  }, Symbol.toStringTag, { value: "Module" }));
7563
- async function Nc(t) {
7583
+ async function Nl(t) {
7564
7584
  await t.schema.alterTable("otps").addColumn("ip", "varchar(64)").execute();
7565
7585
  }
7566
- async function vc(t) {
7586
+ async function vl(t) {
7567
7587
  await t.schema.alterTable("otps").dropColumn("ip").execute();
7568
7588
  }
7569
- const Cc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7589
+ const Cl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7570
7590
  __proto__: null,
7571
- down: vc,
7572
- up: Nc
7591
+ down: vl,
7592
+ up: Nl
7573
7593
  }, Symbol.toStringTag, { value: "Module" }));
7574
- async function xc(t) {
7594
+ async function xl(t) {
7575
7595
  await t.schema.alterTable("logs").dropColumn("user_agent").execute(), await t.schema.alterTable("logs").addColumn("user_agent", "varchar(1024)").execute();
7576
7596
  }
7577
- async function bc(t) {
7597
+ async function bl(t) {
7578
7598
  await t.schema.alterTable("logs").dropColumn("user_agent").execute(), await t.schema.alterTable("logs").addColumn("user_agent", "varchar(255)").execute();
7579
7599
  }
7580
- const Oc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7600
+ const Ol = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7581
7601
  __proto__: null,
7582
- down: bc,
7583
- up: xc
7602
+ down: bl,
7603
+ up: xl
7584
7604
  }, Symbol.toStringTag, { value: "Module" }));
7585
- async function Tc(t) {
7605
+ async function Tl(t) {
7586
7606
  }
7587
- async function Sc(t) {
7607
+ async function Sl(t) {
7588
7608
  }
7589
- const kc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7609
+ const kl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7590
7610
  __proto__: null,
7591
- down: Sc,
7592
- up: Tc
7611
+ down: Sl,
7612
+ up: Tl
7593
7613
  }, Symbol.toStringTag, { value: "Module" }));
7594
- async function Ic(t) {
7614
+ async function Il(t) {
7595
7615
  await t.schema.createTable("hooks").addColumn("hook_id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn(
7596
7616
  "tenant_id",
7597
7617
  "varchar(255)",
@@ -7602,33 +7622,33 @@ async function Ic(t) {
7602
7622
  (e) => e.defaultTo(!1).notNull()
7603
7623
  ).addColumn("priority", "integer").execute();
7604
7624
  }
7605
- async function Ec(t) {
7625
+ async function El(t) {
7606
7626
  await t.schema.dropTable("hooks").execute();
7607
7627
  }
7608
- const Ac = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7628
+ const Al = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7609
7629
  __proto__: null,
7610
- down: Ec,
7611
- up: Ic
7630
+ down: El,
7631
+ up: Il
7612
7632
  }, Symbol.toStringTag, { value: "Module" }));
7613
- async function $c(t) {
7633
+ async function $l(t) {
7614
7634
  }
7615
- async function Pc(t) {
7635
+ async function Pl(t) {
7616
7636
  }
7617
- const Dc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7637
+ const Dl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7618
7638
  __proto__: null,
7619
- down: Pc,
7620
- up: $c
7639
+ down: Pl,
7640
+ up: $l
7621
7641
  }, Symbol.toStringTag, { value: "Module" }));
7622
- async function zc(t) {
7642
+ async function zl(t) {
7623
7643
  }
7624
- async function Rc(t) {
7644
+ async function Rl(t) {
7625
7645
  }
7626
- const Fc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7646
+ const Fl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7627
7647
  __proto__: null,
7628
- down: Rc,
7629
- up: zc
7648
+ down: Rl,
7649
+ up: zl
7630
7650
  }, Symbol.toStringTag, { value: "Module" }));
7631
- async function jc(t) {
7651
+ async function jl(t) {
7632
7652
  await t.schema.createTable("logins").addColumn("login_id", "varchar(255)", (e) => e.primaryKey()).addColumn(
7633
7653
  "tenant_id",
7634
7654
  "varchar(255)",
@@ -7645,7 +7665,7 @@ async function jc(t) {
7645
7665
  (e) => e.onDelete("cascade")
7646
7666
  ).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();
7647
7667
  }
7648
- async function Lc(t) {
7668
+ async function Ll(t) {
7649
7669
  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(
7650
7670
  "codes_user_id_tenant_id_constraint",
7651
7671
  ["user_id", "tenant_id"],
@@ -7654,90 +7674,90 @@ async function Lc(t) {
7654
7674
  (e) => e.onDelete("cascade")
7655
7675
  ).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();
7656
7676
  }
7657
- const Jc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7677
+ const Ml = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7658
7678
  __proto__: null,
7659
- down: Lc,
7660
- up: jc
7679
+ down: Ll,
7680
+ up: jl
7661
7681
  }, Symbol.toStringTag, { value: "Module" }));
7662
- async function Mc(t) {
7682
+ async function Jl(t) {
7663
7683
  }
7664
- async function qc(t) {
7684
+ async function ql(t) {
7665
7685
  }
7666
- const Bc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7686
+ const Bl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7667
7687
  __proto__: null,
7668
- down: qc,
7669
- up: Mc
7688
+ down: ql,
7689
+ up: Jl
7670
7690
  }, Symbol.toStringTag, { value: "Module" }));
7671
- async function Wc(t) {
7691
+ async function Wl(t) {
7672
7692
  await t.schema.alterTable("logins").addColumn("auth0Client", "varchar(256)").execute();
7673
7693
  }
7674
- async function Kc(t) {
7694
+ async function Kl(t) {
7675
7695
  await t.schema.alterTable("logins").dropColumn("auth0Client").execute();
7676
7696
  }
7677
- const Uc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7697
+ const Ul = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7678
7698
  __proto__: null,
7679
- down: Kc,
7680
- up: Wc
7699
+ down: Kl,
7700
+ up: Wl
7681
7701
  }, Symbol.toStringTag, { value: "Module" }));
7682
- async function Qc(t) {
7702
+ async function Ql(t) {
7683
7703
  await t.schema.alterTable("logins").dropColumn("authParams_state").execute(), await t.schema.alterTable("logins").addColumn("authParams_state", "varchar(8192)").execute();
7684
7704
  }
7685
- async function Vc(t) {
7705
+ async function Vl(t) {
7686
7706
  await t.schema.alterTable("logins").dropColumn("authParams_state").execute(), await t.schema.alterTable("logins").addColumn("authParams_state", "varchar(511)").execute();
7687
7707
  }
7688
- const Gc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7708
+ const Gl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7689
7709
  __proto__: null,
7690
- down: Vc,
7691
- up: Qc
7710
+ down: Vl,
7711
+ up: Ql
7692
7712
  }, Symbol.toStringTag, { value: "Module" }));
7693
- async function Yc(t) {
7713
+ async function Yl(t) {
7694
7714
  }
7695
- async function Hc(t) {
7715
+ async function Hl(t) {
7696
7716
  }
7697
- const Xc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7717
+ const Xl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7698
7718
  __proto__: null,
7699
- down: Hc,
7700
- up: Yc
7719
+ down: Hl,
7720
+ up: Yl
7701
7721
  }, Symbol.toStringTag, { value: "Module" }));
7702
- async function Zc(t) {
7722
+ async function Zl(t) {
7703
7723
  }
7704
- async function el(t) {
7724
+ async function ed(t) {
7705
7725
  }
7706
- const tl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7726
+ const td = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7707
7727
  __proto__: null,
7708
- down: el,
7709
- up: Zc
7728
+ down: ed,
7729
+ up: Zl
7710
7730
  }, Symbol.toStringTag, { value: "Module" }));
7711
- async function nl(t) {
7731
+ async function nd(t) {
7712
7732
  await t.schema.alterTable("logins").addColumn("authParams_nonce", "varchar(255)").execute();
7713
7733
  }
7714
- async function al(t) {
7734
+ async function ad(t) {
7715
7735
  await t.schema.alterTable("logins").dropColumn("nonce").execute();
7716
7736
  }
7717
- const rl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7737
+ const rd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7718
7738
  __proto__: null,
7719
- down: al,
7720
- up: nl
7739
+ down: ad,
7740
+ up: nd
7721
7741
  }, Symbol.toStringTag, { value: "Module" }));
7722
- async function ol(t) {
7742
+ async function od(t) {
7723
7743
  }
7724
- async function il(t) {
7744
+ async function id(t) {
7725
7745
  }
7726
- const sl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7746
+ const sd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7727
7747
  __proto__: null,
7728
- down: il,
7729
- up: ol
7748
+ down: id,
7749
+ up: od
7730
7750
  }, Symbol.toStringTag, { value: "Module" }));
7731
- async function ul(t) {
7751
+ async function ud(t) {
7732
7752
  }
7733
- async function dl(t) {
7753
+ async function cd(t) {
7734
7754
  }
7735
- const cl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7755
+ const ld = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7736
7756
  __proto__: null,
7737
- down: dl,
7738
- up: ul
7757
+ down: cd,
7758
+ up: ud
7739
7759
  }, Symbol.toStringTag, { value: "Module" }));
7740
- async function ll(t) {
7760
+ async function dd(t) {
7741
7761
  await t.schema.dropTable("codes").execute(), await t.schema.createTable("codes").addColumn("code_id", "varchar(255)", (e) => e.notNull()).addColumn(
7742
7762
  "tenant_id",
7743
7763
  "varchar(255)",
@@ -7753,7 +7773,7 @@ async function ll(t) {
7753
7773
  "code_type"
7754
7774
  ]).execute();
7755
7775
  }
7756
- async function _l(t) {
7776
+ async function _d(t) {
7757
7777
  await t.schema.dropTable("codes").execute(), await t.schema.createTable("codes").addColumn("code_id", "varchar(255)", (e) => e.primaryKey()).addColumn(
7758
7778
  "tenant_id",
7759
7779
  "varchar(255)",
@@ -7766,15 +7786,15 @@ async function _l(t) {
7766
7786
  (e) => e.onDelete("cascade")
7767
7787
  ).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();
7768
7788
  }
7769
- const ml = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7789
+ const md = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7770
7790
  __proto__: null,
7771
- down: _l,
7772
- up: ll
7791
+ down: _d,
7792
+ up: dd
7773
7793
  }, Symbol.toStringTag, { value: "Module" }));
7774
- async function hl(t) {
7794
+ async function hd(t) {
7775
7795
  await t.schema.dropTable("otps").execute(), await t.schema.dropTable("authentication_codes").execute();
7776
7796
  }
7777
- async function fl(t) {
7797
+ async function fd(t) {
7778
7798
  await t.schema.alterTable("keys").addColumn("private_key", "varchar(2048)").addColumn("public_key", "varchar(2048)").execute(), await t.schema.createTable("otps").addColumn(
7779
7799
  "tenant_id",
7780
7800
  "varchar(255)",
@@ -7793,32 +7813,32 @@ async function fl(t) {
7793
7813
  (e) => e.references("applications.id").onDelete("cascade").notNull()
7794
7814
  ).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();
7795
7815
  }
7796
- const pl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7816
+ const pd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7797
7817
  __proto__: null,
7798
- down: fl,
7799
- up: hl
7818
+ down: fd,
7819
+ up: hd
7800
7820
  }, Symbol.toStringTag, { value: "Module" }));
7801
- async function gl(t) {
7821
+ async function gd(t) {
7802
7822
  await t.schema.createIndex("IDX_logs_tenant_date_type_user").on("logs").columns(["tenant_id", "date", "type", "user_id"]).execute();
7803
7823
  }
7804
- async function yl(t) {
7824
+ async function yd(t) {
7805
7825
  await t.schema.dropIndex("IDX_logs_tenant_date_type_user").on("logs").execute();
7806
7826
  }
7807
- const wl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7827
+ const wd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7808
7828
  __proto__: null,
7809
- down: yl,
7810
- up: gl
7829
+ down: yd,
7830
+ up: gd
7811
7831
  }, Symbol.toStringTag, { value: "Module" }));
7812
- async function Nl(t) {
7832
+ async function Nd(t) {
7813
7833
  }
7814
- async function vl(t) {
7834
+ async function vd(t) {
7815
7835
  }
7816
- const Cl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7836
+ const Cd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7817
7837
  __proto__: null,
7818
- down: vl,
7819
- up: Nl
7838
+ down: vd,
7839
+ up: Nd
7820
7840
  }, Symbol.toStringTag, { value: "Module" }));
7821
- async function xl(t) {
7841
+ async function xd(t) {
7822
7842
  await t.schema.createTable("prompt_settings").addColumn("tenant_id", "varchar(64)", (e) => e.primaryKey()).addColumn(
7823
7843
  "universal_login_experience",
7824
7844
  "varchar(16)",
@@ -7837,95 +7857,95 @@ async function xl(t) {
7837
7857
  (e) => e.defaultTo(!1).notNull()
7838
7858
  ).execute();
7839
7859
  }
7840
- async function bl(t) {
7860
+ async function bd(t) {
7841
7861
  await t.schema.dropTable("prompt_settings").execute();
7842
7862
  }
7843
- const Ol = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7863
+ const Od = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7844
7864
  __proto__: null,
7845
- down: bl,
7846
- up: xl
7865
+ down: bd,
7866
+ up: xd
7847
7867
  }, Symbol.toStringTag, { value: "Module" }));
7848
- async function Tl(t) {
7868
+ async function Td(t) {
7849
7869
  }
7850
- async function Sl(t) {
7870
+ async function Sd(t) {
7851
7871
  }
7852
- const kl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7872
+ const kd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7853
7873
  __proto__: null,
7854
- down: Sl,
7855
- up: Tl
7874
+ down: Sd,
7875
+ up: Td
7856
7876
  }, Symbol.toStringTag, { value: "Module" }));
7857
- async function Il(t) {
7877
+ async function Id(t) {
7858
7878
  }
7859
- async function El(t) {
7879
+ async function Ed(t) {
7860
7880
  }
7861
- const Al = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7881
+ const Ad = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7862
7882
  __proto__: null,
7863
- down: El,
7864
- up: Il
7883
+ down: Ed,
7884
+ up: Id
7865
7885
  }, Symbol.toStringTag, { value: "Module" }));
7866
- async function $l(t) {
7886
+ async function $d(t) {
7867
7887
  }
7868
- async function Pl(t) {
7888
+ async function Pd(t) {
7869
7889
  }
7870
- const Dl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7890
+ const Dd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7871
7891
  __proto__: null,
7872
- down: Pl,
7873
- up: $l
7892
+ down: Pd,
7893
+ up: $d
7874
7894
  }, Symbol.toStringTag, { value: "Module" }));
7875
- async function zl(t) {
7895
+ async function zd(t) {
7876
7896
  await t.schema.alterTable("logins").addColumn("authParams_ui_locales", "varchar(32)").execute();
7877
7897
  }
7878
- async function Rl(t) {
7898
+ async function Rd(t) {
7879
7899
  await t.schema.alterTable("logins").dropColumn("authParams_ui_locales").execute();
7880
7900
  }
7881
- const Fl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7901
+ const Fd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7882
7902
  __proto__: null,
7883
- down: Rl,
7884
- up: zl
7903
+ down: Rd,
7904
+ up: zd
7885
7905
  }, Symbol.toStringTag, { value: "Module" }));
7886
- async function jl(t) {
7906
+ async function jd(t) {
7887
7907
  await t.schema.alterTable("logins").addColumn("authParams_prompt", "varchar(16)").execute();
7888
7908
  }
7889
- async function Ll(t) {
7909
+ async function Ld(t) {
7890
7910
  await t.schema.alterTable("logins").dropColumn("authParams_prompt").execute();
7891
7911
  }
7892
- const Jl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7912
+ const Md = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7893
7913
  __proto__: null,
7894
- down: Ll,
7895
- up: jl
7914
+ down: Ld,
7915
+ up: jd
7896
7916
  }, Symbol.toStringTag, { value: "Module" }));
7897
- async function Ml(t) {
7917
+ async function Jd(t) {
7898
7918
  }
7899
- async function ql(t) {
7919
+ async function qd(t) {
7900
7920
  }
7901
- const Bl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7921
+ const Bd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7902
7922
  __proto__: null,
7903
- down: ql,
7904
- up: Ml
7923
+ down: qd,
7924
+ up: Jd
7905
7925
  }, Symbol.toStringTag, { value: "Module" }));
7906
- async function Wl(t) {
7926
+ async function Wd(t) {
7907
7927
  await t.schema.alterTable("logins").addColumn("authParams_act_as", "varchar(255)").execute();
7908
7928
  }
7909
- async function Kl(t) {
7929
+ async function Kd(t) {
7910
7930
  await t.schema.alterTable("logins").dropColumn("authParam_act_as").execute();
7911
7931
  }
7912
- const Ul = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7932
+ const Ud = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7913
7933
  __proto__: null,
7914
- down: Kl,
7915
- up: Wl
7934
+ down: Kd,
7935
+ up: Wd
7916
7936
  }, Symbol.toStringTag, { value: "Module" }));
7917
- async function Ql(t) {
7937
+ async function Qd(t) {
7918
7938
  await t.schema.alterTable("codes").addColumn("code_verifier", "varchar(128)").execute();
7919
7939
  }
7920
- async function Vl(t) {
7940
+ async function Vd(t) {
7921
7941
  await t.schema.alterTable("codes").dropColumn("code_verifier").execute();
7922
7942
  }
7923
- const Gl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7943
+ const Gd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7924
7944
  __proto__: null,
7925
- down: Vl,
7926
- up: Ql
7945
+ down: Vd,
7946
+ up: Qd
7927
7947
  }, Symbol.toStringTag, { value: "Module" }));
7928
- async function Yl(t) {
7948
+ async function Yd(t) {
7929
7949
  await t.schema.createTable("email_providers").addColumn("tenant_id", "varchar(255)", (e) => e.primaryKey()).addColumn("name", "varchar(255)", (e) => e.notNull()).addColumn("enabled", "boolean", (e) => e.notNull()).addColumn("default_from_address", "varchar(255)").addColumn(
7930
7950
  "credentials",
7931
7951
  "varchar(2048)",
@@ -7936,15 +7956,15 @@ async function Yl(t) {
7936
7956
  (e) => e.notNull().defaultTo("{}")
7937
7957
  ).addColumn("created_at", "varchar(29)", (e) => e.notNull()).addColumn("updated_at", "varchar(29)", (e) => e.notNull()).execute();
7938
7958
  }
7939
- async function Hl(t) {
7959
+ async function Hd(t) {
7940
7960
  await t.schema.dropTable("email_providers").execute();
7941
7961
  }
7942
- const Xl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7962
+ const Xd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7943
7963
  __proto__: null,
7944
- down: Hl,
7945
- up: Yl
7964
+ down: Hd,
7965
+ up: Yd
7946
7966
  }, Symbol.toStringTag, { value: "Module" }));
7947
- async function Zl(t) {
7967
+ async function Zd(t) {
7948
7968
  await t.schema.dropTable("tickets").execute();
7949
7969
  }
7950
7970
  async function e_(t) {
@@ -7961,7 +7981,7 @@ async function e_(t) {
7961
7981
  const t_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7962
7982
  __proto__: null,
7963
7983
  down: e_,
7964
- up: Zl
7984
+ up: Zd
7965
7985
  }, Symbol.toStringTag, { value: "Module" }));
7966
7986
  async function n_(t) {
7967
7987
  }
@@ -7996,14 +8016,14 @@ const s_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7996
8016
  }, Symbol.toStringTag, { value: "Module" }));
7997
8017
  async function u_(t) {
7998
8018
  }
7999
- async function d_(t) {
8019
+ async function c_(t) {
8000
8020
  }
8001
- const c_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8021
+ const l_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8002
8022
  __proto__: null,
8003
- down: d_,
8023
+ down: c_,
8004
8024
  up: u_
8005
8025
  }, Symbol.toStringTag, { value: "Module" }));
8006
- async function l_(t) {
8026
+ async function d_(t) {
8007
8027
  await t.schema.dropTable("sessions").execute(), await t.schema.dropTable("refresh_tokens").execute();
8008
8028
  }
8009
8029
  async function __(t) {
@@ -8028,7 +8048,7 @@ async function __(t) {
8028
8048
  const m_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8029
8049
  __proto__: null,
8030
8050
  down: __,
8031
- up: l_
8051
+ up: d_
8032
8052
  }, Symbol.toStringTag, { value: "Module" }));
8033
8053
  async function h_(t) {
8034
8054
  await t.schema.createTable("sessions_2").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addForeignKeyConstraint(
@@ -8178,12 +8198,12 @@ async function j_(t) {
8178
8198
  async function L_(t) {
8179
8199
  await t.schema.alterTable("users").dropColumn("phone_number").dropColumn("phone_verified").dropColumn("username").execute();
8180
8200
  }
8181
- const J_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8201
+ const M_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8182
8202
  __proto__: null,
8183
8203
  down: L_,
8184
8204
  up: j_
8185
8205
  }, Symbol.toStringTag, { value: "Module" }));
8186
- async function M_(t) {
8206
+ async function J_(t) {
8187
8207
  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();
8188
8208
  }
8189
8209
  async function q_(t) {
@@ -8192,7 +8212,7 @@ async function q_(t) {
8192
8212
  const B_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8193
8213
  __proto__: null,
8194
8214
  down: q_,
8195
- up: M_
8215
+ up: J_
8196
8216
  }, Symbol.toStringTag, { value: "Module" }));
8197
8217
  async function W_(t) {
8198
8218
  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();
@@ -8271,15 +8291,15 @@ const sm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8271
8291
  async function um(t) {
8272
8292
  await t.schema.alterTable("codes").addColumn("nonce", "varchar(1024)").execute(), await t.schema.alterTable("codes").addColumn("state", "varchar(2048)").execute();
8273
8293
  }
8274
- async function dm(t) {
8294
+ async function cm(t) {
8275
8295
  await t.schema.alterTable("codes").dropColumn("nonce").execute(), await t.schema.alterTable("codes").dropColumn("state").execute();
8276
8296
  }
8277
- const cm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8297
+ const lm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8278
8298
  __proto__: null,
8279
- down: dm,
8299
+ down: cm,
8280
8300
  up: um
8281
8301
  }, Symbol.toStringTag, { value: "Module" }));
8282
- async function lm(t) {
8302
+ async function dm(t) {
8283
8303
  await t.schema.createTable("themes").addColumn(
8284
8304
  "tenant_id",
8285
8305
  "varchar(255)",
@@ -8360,7 +8380,7 @@ async function _m(t) {
8360
8380
  const mm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8361
8381
  __proto__: null,
8362
8382
  down: _m,
8363
- up: lm
8383
+ up: dm
8364
8384
  }, Symbol.toStringTag, { value: "Module" }));
8365
8385
  async function hm(t) {
8366
8386
  await t.schema.createTable("resource_servers").addColumn("id", "varchar(21)", (e) => e.notNull()).addColumn("tenant_id", "varchar(191)", (e) => e.notNull()).addColumn("identifier", "varchar(191)", (e) => e.notNull()).addColumn("name", "varchar(255)", (e) => e.notNull()).addColumn("scopes", "varchar(4096)").addColumn("signing_alg", "varchar(64)").addColumn("signing_secret", "varchar(2048)").addColumn("token_lifetime", "integer").addColumn("token_lifetime_for_web", "integer").addColumn("skip_consent_for_verifiable_first_party_clients", "integer").addColumn("allow_offline_access", "integer").addColumn("verification_key", "varchar(4096)").addColumn("options", "varchar(4096)").addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("updated_at", "varchar(35)", (e) => e.notNull()).addPrimaryKeyConstraint("resource_servers_pk", ["tenant_id", "id"]).execute(), await t.schema.createIndex("resource_servers_tenant_identifier_uq").on("resource_servers").columns(["tenant_id", "identifier"]).unique().execute(), await t.schema.createTable("roles").addColumn("id", "varchar(21)", (e) => e.notNull()).addColumn("tenant_id", "varchar(191)", (e) => e.notNull()).addColumn("name", "varchar(50)", (e) => e.notNull()).addColumn("description", "varchar(255)").addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("updated_at", "varchar(35)", (e) => e.notNull()).addPrimaryKeyConstraint("roles_pk", ["tenant_id", "id"]).execute(), await t.schema.createIndex("roles_tenant_name_uq").on("roles").columns(["tenant_id", "name"]).unique().execute();
@@ -8552,17 +8572,17 @@ const Fm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8552
8572
  }, Symbol.toStringTag, { value: "Module" }));
8553
8573
  async function La(t) {
8554
8574
  try {
8555
- return await p`SELECT VERSION()`.execute(t), "mysql";
8575
+ return await g`SELECT VERSION()`.execute(t), "mysql";
8556
8576
  } catch {
8557
8577
  return "sqlite";
8558
8578
  }
8559
8579
  }
8560
8580
  async function jm(t) {
8561
- await La(t) === "mysql" ? await Lm(t) : await Jm(t);
8581
+ await La(t) === "mysql" ? await Lm(t) : await Mm(t);
8562
8582
  }
8563
8583
  async function Lm(t) {
8564
8584
  await t.transaction().execute(async (e) => {
8565
- const n = await p`
8585
+ const n = await g`
8566
8586
  SELECT
8567
8587
  rc.CONSTRAINT_NAME,
8568
8588
  rc.TABLE_NAME
@@ -8573,15 +8593,15 @@ async function Lm(t) {
8573
8593
  for (const r of n.rows) {
8574
8594
  const o = r.CONSTRAINT_NAME, u = r.TABLE_NAME;
8575
8595
  try {
8576
- await p`ALTER TABLE ${p.raw(u)} DROP FOREIGN KEY ${p.raw(o)}`.execute(
8596
+ await g`ALTER TABLE ${g.raw(u)} DROP FOREIGN KEY ${g.raw(o)}`.execute(
8577
8597
  e
8578
8598
  ), console.log(
8579
8599
  `Dropped foreign key constraint ${o} from ${u}`
8580
8600
  );
8581
- } catch (d) {
8601
+ } catch (c) {
8582
8602
  console.warn(
8583
8603
  `Failed to drop constraint ${o} from ${u}:`,
8584
- d
8604
+ c
8585
8605
  );
8586
8606
  }
8587
8607
  }
@@ -8592,56 +8612,56 @@ async function Lm(t) {
8592
8612
  ];
8593
8613
  for (const r of a)
8594
8614
  try {
8595
- await p`DROP TABLE IF EXISTS ${p.raw(r)}`.execute(e);
8615
+ await g`DROP TABLE IF EXISTS ${g.raw(r)}`.execute(e);
8596
8616
  } catch (o) {
8597
8617
  console.warn(`Failed to drop backup table ${r}:`, o);
8598
8618
  }
8599
- await p`CREATE TABLE sessions_backup AS SELECT * FROM sessions`.execute(
8619
+ await g`CREATE TABLE sessions_backup AS SELECT * FROM sessions`.execute(
8600
8620
  e
8601
- ), await p`CREATE TABLE login_sessions_backup AS SELECT * FROM login_sessions`.execute(
8621
+ ), await g`CREATE TABLE login_sessions_backup AS SELECT * FROM login_sessions`.execute(
8602
8622
  e
8603
- ), await p`CREATE TABLE refresh_tokens_backup AS SELECT * FROM refresh_tokens`.execute(
8623
+ ), await g`CREATE TABLE refresh_tokens_backup AS SELECT * FROM refresh_tokens`.execute(
8604
8624
  e
8605
- ), await p`DROP TABLE sessions`.execute(e), await p`DROP TABLE login_sessions`.execute(e), await p`DROP TABLE refresh_tokens`.execute(e), await e.schema.createTable("refresh_tokens").addColumn("id", "varchar(21)", (r) => r.notNull()).addColumn("tenant_id", "varchar(255)", (r) => r.notNull()).addColumn("client_id", "varchar(191)", (r) => r.notNull()).addColumn("session_id", "varchar(21)", (r) => r.notNull()).addColumn("user_id", "varchar(255)").addColumn("resource_servers", "text", (r) => r.notNull()).addColumn("device", "text", (r) => r.notNull()).addColumn("rotating", "boolean", (r) => r.notNull()).addColumn("created_at", "varchar(35)", (r) => r.notNull()).addColumn("expires_at", "varchar(35)").addColumn("idle_expires_at", "varchar(35)").addColumn("last_exchanged_at", "varchar(35)").addPrimaryKeyConstraint("refresh_tokens_pk", ["tenant_id", "id"]).execute(), await p`ALTER TABLE refresh_tokens
8625
+ ), await g`DROP TABLE sessions`.execute(e), await g`DROP TABLE login_sessions`.execute(e), await g`DROP TABLE refresh_tokens`.execute(e), await e.schema.createTable("refresh_tokens").addColumn("id", "varchar(21)", (r) => r.notNull()).addColumn("tenant_id", "varchar(255)", (r) => r.notNull()).addColumn("client_id", "varchar(191)", (r) => r.notNull()).addColumn("session_id", "varchar(21)", (r) => r.notNull()).addColumn("user_id", "varchar(255)").addColumn("resource_servers", "text", (r) => r.notNull()).addColumn("device", "text", (r) => r.notNull()).addColumn("rotating", "boolean", (r) => r.notNull()).addColumn("created_at", "varchar(35)", (r) => r.notNull()).addColumn("expires_at", "varchar(35)").addColumn("idle_expires_at", "varchar(35)").addColumn("last_exchanged_at", "varchar(35)").addPrimaryKeyConstraint("refresh_tokens_pk", ["tenant_id", "id"]).execute(), await g`ALTER TABLE refresh_tokens
8606
8626
  ADD CONSTRAINT refresh_tokens_tenant_fk
8607
8627
  FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON DELETE CASCADE`.execute(
8608
8628
  e
8609
- ), await p`ALTER TABLE refresh_tokens
8629
+ ), await g`ALTER TABLE refresh_tokens
8610
8630
  ADD CONSTRAINT refresh_tokens_client_fk
8611
8631
  FOREIGN KEY (tenant_id, client_id) REFERENCES clients(tenant_id, client_id) ON DELETE CASCADE`.execute(
8612
8632
  e
8613
- ), await e.schema.createTable("sessions").addColumn("id", "varchar(21)", (r) => r.notNull()).addColumn("tenant_id", "varchar(191)", (r) => r.notNull()).addColumn("user_id", "varchar(255)").addColumn("created_at", "varchar(35)", (r) => r.notNull()).addColumn("updated_at", "varchar(35)", (r) => r.notNull()).addColumn("expires_at", "varchar(35)").addColumn("idle_expires_at", "varchar(35)").addColumn("authenticated_at", "varchar(35)").addColumn("last_interaction_at", "varchar(35)").addColumn("used_at", "varchar(35)").addColumn("revoked_at", "varchar(35)").addColumn("device", "text", (r) => r.notNull()).addColumn("clients", "text", (r) => r.notNull()).addColumn("login_session_id", "varchar(21)").addPrimaryKeyConstraint("sessions_pk", ["tenant_id", "id"]).execute(), await p`ALTER TABLE sessions
8633
+ ), await e.schema.createTable("sessions").addColumn("id", "varchar(21)", (r) => r.notNull()).addColumn("tenant_id", "varchar(191)", (r) => r.notNull()).addColumn("user_id", "varchar(255)").addColumn("created_at", "varchar(35)", (r) => r.notNull()).addColumn("updated_at", "varchar(35)", (r) => r.notNull()).addColumn("expires_at", "varchar(35)").addColumn("idle_expires_at", "varchar(35)").addColumn("authenticated_at", "varchar(35)").addColumn("last_interaction_at", "varchar(35)").addColumn("used_at", "varchar(35)").addColumn("revoked_at", "varchar(35)").addColumn("device", "text", (r) => r.notNull()).addColumn("clients", "text", (r) => r.notNull()).addColumn("login_session_id", "varchar(21)").addPrimaryKeyConstraint("sessions_pk", ["tenant_id", "id"]).execute(), await g`ALTER TABLE sessions
8614
8634
  ADD CONSTRAINT sessions_user_fk
8615
8635
  FOREIGN KEY (user_id, tenant_id) REFERENCES users(user_id, tenant_id) ON DELETE CASCADE`.execute(
8616
8636
  e
8617
- ), await e.schema.createTable("login_sessions").addColumn("id", "varchar(21)", (r) => r.notNull()).addColumn("tenant_id", "varchar(255)", (r) => r.notNull()).addColumn("session_id", "varchar(21)").addColumn("csrf_token", "varchar(21)", (r) => r.notNull()).addColumn("authParams_client_id", "varchar(191)", (r) => r.notNull()).addColumn("authParams_vendor_id", "varchar(255)").addColumn("authParams_username", "varchar(255)").addColumn("authParams_response_type", "varchar(255)").addColumn("authParams_response_mode", "varchar(255)").addColumn("authParams_audience", "varchar(255)").addColumn("authParams_scope", "text").addColumn("authParams_state", "text").addColumn("authParams_nonce", "varchar(255)").addColumn("authParams_code_challenge_method", "varchar(255)").addColumn("authParams_code_challenge", "varchar(255)").addColumn("authParams_redirect_uri", "text").addColumn("authParams_organization", "varchar(255)").addColumn("authParams_prompt", "varchar(32)").addColumn("authParams_act_as", "varchar(256)").addColumn("authParams_ui_locales", "varchar(32)").addColumn("authorization_url", "text").addColumn("created_at", "varchar(35)", (r) => r.notNull()).addColumn("updated_at", "varchar(35)", (r) => r.notNull()).addColumn("expires_at", "varchar(35)", (r) => r.notNull()).addColumn("ip", "varchar(39)").addColumn("useragent", "text").addColumn("auth0Client", "varchar(255)").addColumn("login_completed", "integer", (r) => r.defaultTo(0)).addPrimaryKeyConstraint("login_sessions_pk", ["tenant_id", "id"]).execute(), await p`ALTER TABLE login_sessions
8637
+ ), await e.schema.createTable("login_sessions").addColumn("id", "varchar(21)", (r) => r.notNull()).addColumn("tenant_id", "varchar(255)", (r) => r.notNull()).addColumn("session_id", "varchar(21)").addColumn("csrf_token", "varchar(21)", (r) => r.notNull()).addColumn("authParams_client_id", "varchar(191)", (r) => r.notNull()).addColumn("authParams_vendor_id", "varchar(255)").addColumn("authParams_username", "varchar(255)").addColumn("authParams_response_type", "varchar(255)").addColumn("authParams_response_mode", "varchar(255)").addColumn("authParams_audience", "varchar(255)").addColumn("authParams_scope", "text").addColumn("authParams_state", "text").addColumn("authParams_nonce", "varchar(255)").addColumn("authParams_code_challenge_method", "varchar(255)").addColumn("authParams_code_challenge", "varchar(255)").addColumn("authParams_redirect_uri", "text").addColumn("authParams_organization", "varchar(255)").addColumn("authParams_prompt", "varchar(32)").addColumn("authParams_act_as", "varchar(256)").addColumn("authParams_ui_locales", "varchar(32)").addColumn("authorization_url", "text").addColumn("created_at", "varchar(35)", (r) => r.notNull()).addColumn("updated_at", "varchar(35)", (r) => r.notNull()).addColumn("expires_at", "varchar(35)", (r) => r.notNull()).addColumn("ip", "varchar(39)").addColumn("useragent", "text").addColumn("auth0Client", "varchar(255)").addColumn("login_completed", "integer", (r) => r.defaultTo(0)).addPrimaryKeyConstraint("login_sessions_pk", ["tenant_id", "id"]).execute(), await g`ALTER TABLE login_sessions
8618
8638
  ADD CONSTRAINT login_sessions_tenant_fk
8619
8639
  FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON DELETE CASCADE`.execute(
8620
8640
  e
8621
- ), await p`ALTER TABLE login_sessions
8641
+ ), await g`ALTER TABLE login_sessions
8622
8642
  ADD CONSTRAINT login_sessions_client_fk
8623
8643
  FOREIGN KEY (tenant_id, authParams_client_id) REFERENCES clients(tenant_id, client_id) ON DELETE CASCADE`.execute(
8624
8644
  e
8625
- ), await p`ALTER TABLE login_sessions
8645
+ ), await g`ALTER TABLE login_sessions
8626
8646
  ADD CONSTRAINT login_sessions_session_fk
8627
8647
  FOREIGN KEY (tenant_id, session_id) REFERENCES sessions(tenant_id, id) ON DELETE CASCADE`.execute(
8628
8648
  e
8629
- ), await p`INSERT INTO refresh_tokens
8649
+ ), await g`INSERT INTO refresh_tokens
8630
8650
  SELECT id, tenant_id, client_id, session_id, user_id, resource_servers, device, rotating,
8631
8651
  created_at, expires_at, idle_expires_at, last_exchanged_at
8632
- FROM refresh_tokens_backup`.execute(e), await p`INSERT INTO sessions
8652
+ FROM refresh_tokens_backup`.execute(e), await g`INSERT INTO sessions
8633
8653
  SELECT id, tenant_id, user_id, created_at, updated_at, expires_at, idle_expires_at,
8634
8654
  authenticated_at, last_interaction_at, used_at, revoked_at, device, clients, login_session_id
8635
- FROM sessions_backup`.execute(e), await p`INSERT INTO login_sessions
8655
+ FROM sessions_backup`.execute(e), await g`INSERT INTO login_sessions
8636
8656
  SELECT id, tenant_id, session_id, csrf_token, authParams_client_id, authParams_vendor_id, authParams_username,
8637
8657
  authParams_response_type, authParams_response_mode, authParams_audience, authParams_scope, authParams_state,
8638
8658
  authParams_nonce, authParams_code_challenge_method, authParams_code_challenge, authParams_redirect_uri,
8639
8659
  authParams_organization, authParams_prompt, authParams_act_as, authParams_ui_locales, authorization_url,
8640
8660
  created_at, updated_at, expires_at, ip, useragent, auth0Client, login_completed
8641
- FROM login_sessions_backup`.execute(e), await p`DROP TABLE sessions_backup`.execute(e), await p`DROP TABLE login_sessions_backup`.execute(e), await p`DROP TABLE refresh_tokens_backup`.execute(e);
8661
+ FROM login_sessions_backup`.execute(e), await g`DROP TABLE sessions_backup`.execute(e), await g`DROP TABLE login_sessions_backup`.execute(e), await g`DROP TABLE refresh_tokens_backup`.execute(e);
8642
8662
  });
8643
8663
  }
8644
- async function Jm(t) {
8664
+ async function Mm(t) {
8645
8665
  await t.transaction().execute(async (e) => {
8646
8666
  const n = [
8647
8667
  "sessions_backup",
@@ -8650,17 +8670,17 @@ async function Jm(t) {
8650
8670
  ];
8651
8671
  for (const a of n)
8652
8672
  try {
8653
- await p`DROP TABLE IF EXISTS ${p.raw(a)}`.execute(e);
8673
+ await g`DROP TABLE IF EXISTS ${g.raw(a)}`.execute(e);
8654
8674
  } catch (r) {
8655
8675
  console.warn(`Failed to drop backup table ${a}:`, r);
8656
8676
  }
8657
- await p`CREATE TABLE sessions_backup AS SELECT * FROM sessions`.execute(
8677
+ await g`CREATE TABLE sessions_backup AS SELECT * FROM sessions`.execute(
8658
8678
  e
8659
- ), await p`CREATE TABLE login_sessions_backup AS SELECT * FROM login_sessions`.execute(
8679
+ ), await g`CREATE TABLE login_sessions_backup AS SELECT * FROM login_sessions`.execute(
8660
8680
  e
8661
- ), await p`CREATE TABLE refresh_tokens_backup AS SELECT * FROM refresh_tokens`.execute(
8681
+ ), await g`CREATE TABLE refresh_tokens_backup AS SELECT * FROM refresh_tokens`.execute(
8662
8682
  e
8663
- ), await p`DROP TABLE sessions`.execute(e), await p`DROP TABLE login_sessions`.execute(e), await p`DROP TABLE refresh_tokens`.execute(e), await e.schema.createTable("refresh_tokens").addColumn("id", "varchar(21)", (a) => a.notNull()).addColumn(
8683
+ ), await g`DROP TABLE sessions`.execute(e), await g`DROP TABLE login_sessions`.execute(e), await g`DROP TABLE refresh_tokens`.execute(e), await e.schema.createTable("refresh_tokens").addColumn("id", "varchar(21)", (a) => a.notNull()).addColumn(
8664
8684
  "tenant_id",
8665
8685
  "varchar(255)",
8666
8686
  (a) => a.references("tenants.id").onDelete("cascade").notNull()
@@ -8692,35 +8712,35 @@ async function Jm(t) {
8692
8712
  "sessions",
8693
8713
  ["tenant_id", "id"],
8694
8714
  (a) => a.onDelete("cascade")
8695
- ).execute(), await p`INSERT INTO refresh_tokens
8715
+ ).execute(), await g`INSERT INTO refresh_tokens
8696
8716
  SELECT id, tenant_id, client_id, session_id, user_id, resource_servers, device, rotating,
8697
8717
  created_at, expires_at, idle_expires_at, last_exchanged_at
8698
- FROM refresh_tokens_backup`.execute(e), await p`INSERT INTO sessions
8718
+ FROM refresh_tokens_backup`.execute(e), await g`INSERT INTO sessions
8699
8719
  SELECT id, tenant_id, user_id, created_at, updated_at, expires_at, idle_expires_at,
8700
8720
  authenticated_at, last_interaction_at, used_at, revoked_at, device, clients, login_session_id
8701
- FROM sessions_backup`.execute(e), await p`INSERT INTO login_sessions
8721
+ FROM sessions_backup`.execute(e), await g`INSERT INTO login_sessions
8702
8722
  SELECT id, tenant_id, session_id, csrf_token, authParams_client_id, authParams_vendor_id, authParams_username,
8703
8723
  authParams_response_type, authParams_response_mode, authParams_audience, authParams_scope, authParams_state,
8704
8724
  authParams_nonce, authParams_code_challenge_method, authParams_code_challenge, authParams_redirect_uri,
8705
8725
  authParams_organization, authParams_prompt, authParams_act_as, authParams_ui_locales, authorization_url,
8706
8726
  created_at, updated_at, expires_at, ip, useragent, auth0Client, login_completed
8707
- FROM login_sessions_backup`.execute(e), await p`DROP TABLE sessions_backup`.execute(e), await p`DROP TABLE login_sessions_backup`.execute(e), await p`DROP TABLE refresh_tokens_backup`.execute(e);
8727
+ FROM login_sessions_backup`.execute(e), await g`DROP TABLE sessions_backup`.execute(e), await g`DROP TABLE login_sessions_backup`.execute(e), await g`DROP TABLE refresh_tokens_backup`.execute(e);
8708
8728
  });
8709
8729
  }
8710
- async function Mm(t) {
8730
+ async function Jm(t) {
8711
8731
  await La(t) === "mysql" ? await qm(t) : await Bm(t);
8712
8732
  }
8713
8733
  async function qm(t) {
8714
8734
  await t.transaction().execute(async (e) => {
8715
- await p`ALTER TABLE refresh_tokens DROP FOREIGN KEY refresh_tokens_client_fk`.execute(
8735
+ await g`ALTER TABLE refresh_tokens DROP FOREIGN KEY refresh_tokens_client_fk`.execute(
8716
8736
  e
8717
- ), await p`ALTER TABLE login_sessions DROP FOREIGN KEY login_sessions_client_fk`.execute(
8737
+ ), await g`ALTER TABLE login_sessions DROP FOREIGN KEY login_sessions_client_fk`.execute(
8718
8738
  e
8719
- ), await p`ALTER TABLE refresh_tokens DROP PRIMARY KEY`.execute(e), await p`ALTER TABLE refresh_tokens ADD PRIMARY KEY (id)`.execute(e), await p`ALTER TABLE sessions DROP PRIMARY KEY`.execute(e), await p`ALTER TABLE sessions ADD PRIMARY KEY (id)`.execute(e), await p`ALTER TABLE login_sessions DROP PRIMARY KEY`.execute(e), await p`ALTER TABLE login_sessions ADD PRIMARY KEY (id)`.execute(e), await p`ALTER TABLE refresh_tokens
8739
+ ), await g`ALTER TABLE refresh_tokens DROP PRIMARY KEY`.execute(e), await g`ALTER TABLE refresh_tokens ADD PRIMARY KEY (id)`.execute(e), await g`ALTER TABLE sessions DROP PRIMARY KEY`.execute(e), await g`ALTER TABLE sessions ADD PRIMARY KEY (id)`.execute(e), await g`ALTER TABLE login_sessions DROP PRIMARY KEY`.execute(e), await g`ALTER TABLE login_sessions ADD PRIMARY KEY (id)`.execute(e), await g`ALTER TABLE refresh_tokens
8720
8740
  ADD CONSTRAINT refresh_tokens_application_fk
8721
8741
  FOREIGN KEY (client_id) REFERENCES applications(id) ON DELETE CASCADE`.execute(
8722
8742
  e
8723
- ), await p`ALTER TABLE login_sessions
8743
+ ), await g`ALTER TABLE login_sessions
8724
8744
  ADD CONSTRAINT login_sessions_application_fk
8725
8745
  FOREIGN KEY (authParams_client_id) REFERENCES applications(id) ON DELETE CASCADE`.execute(
8726
8746
  e
@@ -8729,9 +8749,9 @@ async function qm(t) {
8729
8749
  }
8730
8750
  async function Bm(t) {
8731
8751
  await t.transaction().execute(async (e) => {
8732
- await p`CREATE TABLE refresh_tokens_temp AS SELECT * FROM refresh_tokens`.execute(
8752
+ await g`CREATE TABLE refresh_tokens_temp AS SELECT * FROM refresh_tokens`.execute(
8733
8753
  e
8734
- ), await p`DROP TABLE refresh_tokens`.execute(e), await e.schema.createTable("refresh_tokens").addColumn("id", "varchar(21)", (n) => n.primaryKey()).addColumn(
8754
+ ), await g`DROP TABLE refresh_tokens`.execute(e), await e.schema.createTable("refresh_tokens").addColumn("id", "varchar(21)", (n) => n.primaryKey()).addColumn(
8735
8755
  "tenant_id",
8736
8756
  "varchar(255)",
8737
8757
  (n) => n.references("tenants.id").onDelete("cascade").notNull()
@@ -8739,12 +8759,12 @@ async function Bm(t) {
8739
8759
  "client_id",
8740
8760
  "varchar(21)",
8741
8761
  (n) => n.references("applications.id").onDelete("cascade").notNull()
8742
- ).addColumn("session_id", "varchar(21)", (n) => n.notNull()).addColumn("user_id", "varchar(255)").addColumn("resource_servers", "varchar(255)", (n) => n.notNull()).addColumn("device", "varchar(255)", (n) => n.notNull()).addColumn("rotating", "boolean", (n) => n.notNull()).addColumn("created_at", "varchar(35)", (n) => n.notNull()).addColumn("expires_at", "varchar(35)").addColumn("idle_expires_at", "varchar(35)").addColumn("last_exchanged_at", "varchar(35)").execute(), await p`INSERT INTO refresh_tokens
8762
+ ).addColumn("session_id", "varchar(21)", (n) => n.notNull()).addColumn("user_id", "varchar(255)").addColumn("resource_servers", "varchar(255)", (n) => n.notNull()).addColumn("device", "varchar(255)", (n) => n.notNull()).addColumn("rotating", "boolean", (n) => n.notNull()).addColumn("created_at", "varchar(35)", (n) => n.notNull()).addColumn("expires_at", "varchar(35)").addColumn("idle_expires_at", "varchar(35)").addColumn("last_exchanged_at", "varchar(35)").execute(), await g`INSERT INTO refresh_tokens
8743
8763
  SELECT id, tenant_id, client_id, session_id, user_id, resource_servers, device, rotating,
8744
8764
  created_at, expires_at, idle_expires_at, last_exchanged_at
8745
- FROM refresh_tokens_temp`.execute(e), await p`DROP TABLE refresh_tokens_temp`.execute(e), await p`CREATE TABLE login_sessions_temp AS SELECT * FROM login_sessions`.execute(
8765
+ FROM refresh_tokens_temp`.execute(e), await g`DROP TABLE refresh_tokens_temp`.execute(e), await g`CREATE TABLE login_sessions_temp AS SELECT * FROM login_sessions`.execute(
8746
8766
  e
8747
- ), await p`DROP TABLE login_sessions`.execute(e), await e.schema.createTable("login_sessions").addColumn("id", "varchar(21)", (n) => n.primaryKey()).addColumn(
8767
+ ), await g`DROP TABLE login_sessions`.execute(e), await e.schema.createTable("login_sessions").addColumn("id", "varchar(21)", (n) => n.primaryKey()).addColumn(
8748
8768
  "tenant_id",
8749
8769
  "varchar(255)",
8750
8770
  (n) => n.references("tenants.id").onDelete("cascade").notNull()
@@ -8752,14 +8772,14 @@ async function Bm(t) {
8752
8772
  "authParams_client_id",
8753
8773
  "varchar(191)",
8754
8774
  (n) => n.references("applications.id").onDelete("cascade").notNull()
8755
- ).execute(), await p`INSERT INTO login_sessions (id, tenant_id, session_id, csrf_token, authParams_client_id)
8775
+ ).execute(), await g`INSERT INTO login_sessions (id, tenant_id, session_id, csrf_token, authParams_client_id)
8756
8776
  SELECT id, tenant_id, session_id, csrf_token, authParams_client_id
8757
- FROM login_sessions_temp`.execute(e), await p`DROP TABLE login_sessions_temp`.execute(e);
8777
+ FROM login_sessions_temp`.execute(e), await g`DROP TABLE login_sessions_temp`.execute(e);
8758
8778
  });
8759
8779
  }
8760
8780
  const Wm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8761
8781
  __proto__: null,
8762
- down: Mm,
8782
+ down: Jm,
8763
8783
  up: jm
8764
8784
  }, Symbol.toStringTag, { value: "Module" }));
8765
8785
  async function Km(t) {
@@ -8846,24 +8866,24 @@ const uh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8846
8866
  down: sh,
8847
8867
  up: ih
8848
8868
  }, Symbol.toStringTag, { value: "Module" }));
8849
- async function dh(t) {
8869
+ async function ch(t) {
8850
8870
  await t.schema.createTable("tenant_settings").addColumn(
8851
8871
  "tenant_id",
8852
8872
  "varchar(191)",
8853
8873
  (e) => e.references("tenants.id").onDelete("cascade").notNull().primaryKey()
8854
8874
  ).addColumn("idle_session_lifetime", "integer").addColumn("session_lifetime", "integer").addColumn("session_cookie", "text").addColumn("enable_client_connections", "integer").addColumn("default_redirection_uri", "text").addColumn("enabled_locales", "text").addColumn("default_directory", "varchar(255)").addColumn("error_page", "text").addColumn("flags", "text").addColumn("friendly_name", "varchar(255)").addColumn("picture_url", "text").addColumn("support_email", "varchar(255)").addColumn("support_url", "text").addColumn("sandbox_version", "varchar(50)").addColumn("sandbox_versions_available", "text").addColumn("change_password", "text").addColumn("guardian_mfa_page", "text").addColumn("default_audience", "varchar(255)").addColumn("default_organization", "varchar(255)").addColumn("sessions", "text").execute();
8855
8875
  }
8856
- async function ch(t) {
8876
+ async function lh(t) {
8857
8877
  await t.schema.dropTable("tenant_settings").execute();
8858
8878
  }
8859
- const lh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8879
+ const dh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8860
8880
  __proto__: null,
8861
- down: ch,
8862
- up: dh
8881
+ down: lh,
8882
+ up: ch
8863
8883
  }, Symbol.toStringTag, { value: "Module" }));
8864
8884
  async function _h(t) {
8865
8885
  if (await t.schema.alterTable("tenants").addColumn("idle_session_lifetime", "integer").execute(), await t.schema.alterTable("tenants").addColumn("session_lifetime", "integer").execute(), await t.schema.alterTable("tenants").addColumn("session_cookie", "text").execute(), await t.schema.alterTable("tenants").addColumn("allowed_logout_urls", "text").execute(), await t.schema.alterTable("tenants").addColumn("ephemeral_session_lifetime", "integer").execute(), await t.schema.alterTable("tenants").addColumn("idle_ephemeral_session_lifetime", "integer").execute(), await t.schema.alterTable("tenants").addColumn("default_redirection_uri", "text").execute(), await t.schema.alterTable("tenants").addColumn("enabled_locales", "text").execute(), await t.schema.alterTable("tenants").addColumn("default_directory", "varchar(255)").execute(), await t.schema.alterTable("tenants").addColumn("error_page", "text").execute(), await t.schema.alterTable("tenants").addColumn("flags", "text").execute(), await t.schema.alterTable("tenants").addColumn("friendly_name", "varchar(255)").execute(), await t.schema.alterTable("tenants").addColumn("picture_url", "text").execute(), await t.schema.alterTable("tenants").addColumn("support_email", "varchar(255)").execute(), await t.schema.alterTable("tenants").addColumn("sandbox_version", "varchar(50)").execute(), await t.schema.alterTable("tenants").addColumn("sandbox_versions_available", "text").execute(), await t.schema.alterTable("tenants").addColumn("legacy_sandbox_version", "varchar(50)").execute(), await t.schema.alterTable("tenants").addColumn("change_password", "text").execute(), await t.schema.alterTable("tenants").addColumn("guardian_mfa_page", "text").execute(), await t.schema.alterTable("tenants").addColumn("device_flow", "text").execute(), await t.schema.alterTable("tenants").addColumn("default_token_quota", "text").execute(), await t.schema.alterTable("tenants").addColumn("default_audience", "varchar(255)").execute(), await t.schema.alterTable("tenants").addColumn("default_organization", "varchar(255)").execute(), await t.schema.alterTable("tenants").addColumn("sessions", "text").execute(), await t.schema.alterTable("tenants").addColumn("oidc_logout", "text").execute(), await t.schema.alterTable("tenants").addColumn("allow_organization_name_in_authentication_api", "integer").execute(), await t.schema.alterTable("tenants").addColumn("customize_mfa_in_postlogin_action", "integer").execute(), await t.schema.alterTable("tenants").addColumn("acr_values_supported", "text").execute(), await t.schema.alterTable("tenants").addColumn("mtls", "text").execute(), await t.schema.alterTable("tenants").addColumn("pushed_authorization_requests_supported", "integer").execute(), await t.schema.alterTable("tenants").addColumn("authorization_response_iss_parameter_supported", "integer").execute(), await t.updateTable("tenants").set({
8866
- friendly_name: p`name`
8886
+ friendly_name: g`name`
8867
8887
  }).execute(), await t.schema.alterTable("tenants").dropColumn("language").execute(), await t.schema.alterTable("tenants").dropColumn("logo").execute(), await t.schema.alterTable("tenants").dropColumn("primary_color").execute(), await t.schema.alterTable("tenants").dropColumn("secondary_color").execute(), await t.schema.alterTable("tenants").dropColumn("name").execute(), (await t.selectFrom("tenant_settings").select("tenant_id").limit(1).execute()).length > 0) {
8868
8888
  const n = await t.selectFrom("tenant_settings").selectAll().execute();
8869
8889
  for (const a of n)
@@ -8946,7 +8966,7 @@ async function mh(t) {
8946
8966
  sessions: n.sessions
8947
8967
  }).execute();
8948
8968
  await t.schema.alterTable("tenants").dropColumn("idle_session_lifetime").dropColumn("session_lifetime").dropColumn("session_cookie").dropColumn("enable_client_connections").dropColumn("default_redirection_uri").dropColumn("enabled_locales").dropColumn("default_directory").dropColumn("error_page").dropColumn("flags").dropColumn("friendly_name").dropColumn("picture_url").dropColumn("support_email").dropColumn("sandbox_version").dropColumn("sandbox_versions_available").dropColumn("change_password").dropColumn("guardian_mfa_page").dropColumn("default_audience").dropColumn("default_organization").dropColumn("sessions").execute(), await t.schema.alterTable("tenants").addColumn("name", "varchar(255)").execute(), await t.updateTable("tenants").set({
8949
- name: p`COALESCE(friendly_name, id)`
8969
+ name: g`COALESCE(friendly_name, id)`
8950
8970
  }).execute(), await t.schema.alterTable("tenants").addColumn("language", "varchar(255)").execute(), await t.schema.alterTable("tenants").addColumn("logo", "text").execute(), await t.schema.alterTable("tenants").addColumn("primary_color", "varchar(50)").execute(), await t.schema.alterTable("tenants").addColumn("secondary_color", "varchar(50)").execute();
8951
8971
  }
8952
8972
  const hh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -8975,7 +8995,18 @@ const Nh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8975
8995
  __proto__: null,
8976
8996
  down: wh,
8977
8997
  up: yh
8978
- }, Symbol.toStringTag, { value: "Module" })), Ja = {
8998
+ }, Symbol.toStringTag, { value: "Module" }));
8999
+ async function vh(t) {
9000
+ await t.schema.alterTable("logs").addColumn("country_code", "varchar(2)").execute(), await t.schema.alterTable("logs").addColumn("country_code3", "varchar(3)").execute(), await t.schema.alterTable("logs").addColumn("country_name", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("city_name", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("latitude", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("longitude", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("time_zone", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("continent_code", "varchar(2)").execute();
9001
+ }
9002
+ async function Ch(t) {
9003
+ await t.schema.alterTable("logs").dropColumn("country_code").execute(), await t.schema.alterTable("logs").dropColumn("country_code3").execute(), await t.schema.alterTable("logs").dropColumn("country_name").execute(), await t.schema.alterTable("logs").dropColumn("city_name").execute(), await t.schema.alterTable("logs").dropColumn("latitude").execute(), await t.schema.alterTable("logs").dropColumn("longitude").execute(), await t.schema.alterTable("logs").dropColumn("time_zone").execute(), await t.schema.alterTable("logs").dropColumn("continent_code").execute();
9004
+ }
9005
+ const xh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9006
+ __proto__: null,
9007
+ down: Ch,
9008
+ up: vh
9009
+ }, Symbol.toStringTag, { value: "Module" })), Ma = {
8979
9010
  m1_init: wu,
8980
9011
  m2_magicLink: Cu,
8981
9012
  m3_updateAt: Ou,
@@ -8983,69 +9014,69 @@ const Nh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8983
9014
  m5_userProfile: Au,
8984
9015
  m6_sessions: Du,
8985
9016
  m7_passwords: Fu,
8986
- m8_logsTableNewFields: Ju,
9017
+ m8_logsTableNewFields: Mu,
8987
9018
  m9_passwordTableNewField: Bu,
8988
9019
  n01_codesTable: Uu,
8989
9020
  n11_universalLoginSession: Gu,
8990
9021
  n12_userFields: Xu,
8991
- n13_userEmailIndex: td,
8992
- n14_profileDataField: rd,
8993
- n15_userEmailIndex: sd,
8994
- n16_userLocale: cd,
8995
- n17_signingKeys: md,
8996
- n18_logsFields: pd,
8997
- n19_connectionsUserinfo: wd,
8998
- n20_missingFields: Cd,
8999
- n21_sessionDeletedAt: Od,
9000
- n22_dropLogsFields: kd,
9001
- n23_dropUsersFields: Ad,
9002
- n24_logsIndexes: Dd,
9003
- n25_logDescMaxLength: Fd,
9004
- n26_logsTableExtraFields: Jd,
9005
- n27_usersTableNameIndex: Bd,
9006
- n28_usersEmailConstrain: Ud,
9007
- n29_increaseOtpStateLength: Gd,
9008
- n30_increaseTicketStateLength: Xd,
9009
- n31_branding: tc,
9010
- n32_indexesAndNotNull: rc,
9011
- n33_vendorIdInUniversalLoginSession: sc,
9012
- n34_auth0ClientInUniversalLoginSession: cc,
9013
- n35_increaseUniversalSessionStateLength: mc,
9014
- n36_authenticationCodes: pc,
9015
- n37_disableSignUps: wc,
9016
- n38_otpIpAddress: Cc,
9017
- n39_increaseUserAgentLength: Oc,
9018
- n40_userId: kc,
9019
- n41_hooks: Ac,
9020
- n42_userIdIndexes: Dc,
9021
- n43_userIdIndexes: Fc,
9022
- n44_codes: Jc,
9023
- n45_hookProperties: Bc,
9024
- n46_loginAuth0Client: Uc,
9025
- n47_loginAuth0Client: Gc,
9026
- n48_saml: Xc,
9027
- n49_removeFields: tl,
9028
- n50_authParamsNonce: rl,
9029
- n51_connectionid: sl,
9030
- n52_cert: cl,
9031
- n53_codes_primary_key: ml,
9032
- n54_cleanup_tables: pl,
9033
- n55_logs_index: wl,
9034
- n56_application_fields: Cl,
9035
- n57_prompt_settings: Ol,
9036
- n58_connection_client_id: kl,
9037
- n59_connection_options: Al,
9038
- n60_users_metadata: Dl,
9039
- n61_userLocales: Fl,
9040
- n62_prompt: Jl,
9041
- n63_connection_cleanup: Bl,
9042
- n64_act_as: Ul,
9043
- n65_code_verifier: Gl,
9044
- n66_email_providers: Xl,
9022
+ n13_userEmailIndex: tc,
9023
+ n14_profileDataField: rc,
9024
+ n15_userEmailIndex: sc,
9025
+ n16_userLocale: lc,
9026
+ n17_signingKeys: mc,
9027
+ n18_logsFields: pc,
9028
+ n19_connectionsUserinfo: wc,
9029
+ n20_missingFields: Cc,
9030
+ n21_sessionDeletedAt: Oc,
9031
+ n22_dropLogsFields: kc,
9032
+ n23_dropUsersFields: Ac,
9033
+ n24_logsIndexes: Dc,
9034
+ n25_logDescMaxLength: Fc,
9035
+ n26_logsTableExtraFields: Mc,
9036
+ n27_usersTableNameIndex: Bc,
9037
+ n28_usersEmailConstrain: Uc,
9038
+ n29_increaseOtpStateLength: Gc,
9039
+ n30_increaseTicketStateLength: Xc,
9040
+ n31_branding: tl,
9041
+ n32_indexesAndNotNull: rl,
9042
+ n33_vendorIdInUniversalLoginSession: sl,
9043
+ n34_auth0ClientInUniversalLoginSession: ll,
9044
+ n35_increaseUniversalSessionStateLength: ml,
9045
+ n36_authenticationCodes: pl,
9046
+ n37_disableSignUps: wl,
9047
+ n38_otpIpAddress: Cl,
9048
+ n39_increaseUserAgentLength: Ol,
9049
+ n40_userId: kl,
9050
+ n41_hooks: Al,
9051
+ n42_userIdIndexes: Dl,
9052
+ n43_userIdIndexes: Fl,
9053
+ n44_codes: Ml,
9054
+ n45_hookProperties: Bl,
9055
+ n46_loginAuth0Client: Ul,
9056
+ n47_loginAuth0Client: Gl,
9057
+ n48_saml: Xl,
9058
+ n49_removeFields: td,
9059
+ n50_authParamsNonce: rd,
9060
+ n51_connectionid: sd,
9061
+ n52_cert: ld,
9062
+ n53_codes_primary_key: md,
9063
+ n54_cleanup_tables: pd,
9064
+ n55_logs_index: wd,
9065
+ n56_application_fields: Cd,
9066
+ n57_prompt_settings: Od,
9067
+ n58_connection_client_id: kd,
9068
+ n59_connection_options: Ad,
9069
+ n60_users_metadata: Dd,
9070
+ n61_userLocales: Fd,
9071
+ n62_prompt: Md,
9072
+ n63_connection_cleanup: Bd,
9073
+ n64_act_as: Ud,
9074
+ n65_code_verifier: Gd,
9075
+ n66_email_providers: Xd,
9045
9076
  n67_drop_tickets: t_,
9046
9077
  n68_login_useragents: r_,
9047
9078
  n70_refresh_tokens: s_,
9048
- n71_session_new_fields: c_,
9079
+ n71_session_new_fields: l_,
9049
9080
  n72_session_primary_key: m_,
9050
9081
  n73_drop_sessions: p_,
9051
9082
  n74_custom_domains: w_,
@@ -9055,7 +9086,7 @@ const Nh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9055
9086
  n78_login_sessions: A_,
9056
9087
  n79_drop_sessions_2: D_,
9057
9088
  n80_recreate_custom_domains: F_,
9058
- n81_phone: J_,
9089
+ n81_phone: M_,
9059
9090
  n82_forms: B_,
9060
9091
  n83_addFormsIdToHooks: U_,
9061
9092
  n84_login_completed: G_,
@@ -9063,7 +9094,7 @@ const Nh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9063
9094
  n86_index_sessions_login_session_id: tm,
9064
9095
  n87_code_challenge: rm,
9065
9096
  n88_add_redirect_uri_to_codes: sm,
9066
- n89_add_nonce_and_state_to_codes: cm,
9097
+ n89_add_nonce_and_state_to_codes: lm,
9067
9098
  n90_themes: mm,
9068
9099
  n91_resource_servers_rules_permissions: pm,
9069
9100
  n92_role_permissions: wm,
@@ -9080,14 +9111,15 @@ const Nh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9080
9111
  o004_login_sessions_id_index: nh,
9081
9112
  o005_connections_tenant_index: oh,
9082
9113
  o006_remove_redundant_user_organizations_tenant_index: uh,
9083
- o007_tenant_settings: lh,
9114
+ o007_tenant_settings: dh,
9084
9115
  o008_merge_tenant_settings_into_tenants: hh,
9085
9116
  o009_create_invites_table: gh,
9086
- o010_add_log_id_to_logs: Nh
9117
+ o010_add_log_id_to_logs: Nh,
9118
+ o011_add_location_info_to_logs: xh
9087
9119
  };
9088
- async function Oh(t, e = !1) {
9120
+ async function kh(t, e = !1) {
9089
9121
  e && console.log("migrating...");
9090
- const n = new ja(Ja), a = new xa({
9122
+ const n = new ja(Ma), a = new xa({
9091
9123
  db: t,
9092
9124
  provider: n
9093
9125
  }), { error: r, results: o } = await a.migrateToLatest();
@@ -9098,9 +9130,9 @@ async function Oh(t, e = !1) {
9098
9130
  }), r)
9099
9131
  throw console.error("failed to migrate"), console.error(r), r;
9100
9132
  }
9101
- async function Th(t) {
9133
+ async function Ih(t) {
9102
9134
  console.log("migrating...");
9103
- const e = new ja(Ja), n = new xa({
9135
+ const e = new ja(Ma), n = new xa({
9104
9136
  db: t,
9105
9137
  provider: e
9106
9138
  }), { error: a, results: r } = await n.migrateDown();
@@ -9109,7 +9141,7 @@ async function Th(t) {
9109
9141
  }), a)
9110
9142
  throw console.error("failed to migrate"), console.error(a), a;
9111
9143
  }
9112
- function Sh(t) {
9144
+ function Eh(t) {
9113
9145
  return {
9114
9146
  branding: wo(t),
9115
9147
  cleanup: Go(t),
@@ -9135,15 +9167,15 @@ function Sh(t) {
9135
9167
  userRoles: Si(t),
9136
9168
  roles: mi(t),
9137
9169
  sessions: Cr(t),
9138
- tenants: lr(t),
9170
+ tenants: dr(t),
9139
9171
  themes: Eo(t),
9140
9172
  users: er(t),
9141
9173
  organizations: Pi(t),
9142
- userOrganizations: Ji(t)
9174
+ userOrganizations: Mi(t)
9143
9175
  };
9144
9176
  }
9145
9177
  export {
9146
- Sh as default,
9147
- Th as migrateDown,
9148
- Oh as migrateToLatest
9178
+ Eh as default,
9179
+ Ih as migrateDown,
9180
+ kh as migrateToLatest
9149
9181
  };