@authhero/kysely-adapter 10.46.0 → 10.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,9 +3,9 @@ var wn = (t) => {
3
3
  throw TypeError(t);
4
4
  };
5
5
  var Rr = (t, e, n) => e in t ? Dr(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
6
- var oe = (t, e, n) => Rr(t, typeof e != "symbol" ? e + "" : e, n), Bt = (t, e, n) => e.has(t) || wn("Cannot " + n);
7
- var i = (t, e, n) => (Bt(t, e, "read from private field"), n ? n.call(t) : e.get(t)), C = (t, e, n) => e.has(t) ? wn("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), O = (t, e, n, r) => (Bt(t, e, "write to private field"), r ? r.call(t, n) : e.set(t, n), n), y = (t, e, n) => (Bt(t, e, "access private method"), n);
8
- import { parseUserId as ln, codeSchema as zr, connectionSchema as Fr, loginSessionSchema as qr, promptSettingSchema as jr, formSchema as bt, resourceServerSchema as Lr } from "@authhero/adapter-interfaces";
6
+ var oe = (t, e, n) => Rr(t, typeof e != "symbol" ? e + "" : e, n), Wt = (t, e, n) => e.has(t) || wn("Cannot " + n);
7
+ var i = (t, e, n) => (Wt(t, e, "read from private field"), n ? n.call(t) : e.get(t)), C = (t, e, n) => e.has(t) ? wn("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), O = (t, e, n, r) => (Wt(t, e, "write to private field"), r ? r.call(t, n) : e.set(t, n), n), w = (t, e, n) => (Wt(t, e, "access private method"), n);
8
+ import { parseUserId as ln, codeSchema as zr, connectionSchema as Fr, loginSessionSchema as jr, promptSettingSchema as qr, formSchema as bt, resourceServerSchema as Lr } from "@authhero/adapter-interfaces";
9
9
  import "@hono/zod-openapi";
10
10
  var lt = class extends Error {
11
11
  constructor(e = 500, n) {
@@ -50,26 +50,26 @@ function Jr(t) {
50
50
  };
51
51
  };
52
52
  }
53
- function S(t) {
53
+ function T(t) {
54
54
  if (t == null || typeof t != "object")
55
55
  return t;
56
56
  if (Array.isArray(t))
57
57
  return t.map(
58
58
  (n) => (
59
59
  // Only recurse into objects; leave primitives untouched
60
- n !== null && typeof n == "object" ? S(n) : n
60
+ n !== null && typeof n == "object" ? T(n) : n
61
61
  )
62
62
  );
63
63
  const e = { ...t };
64
64
  for (const n in e) {
65
65
  const r = e[n];
66
66
  r === null ? delete e[n] : r !== null && typeof r == "object" && (Array.isArray(r) ? e[n] = r.map(
67
- (a) => a !== null && typeof a == "object" ? S(a) : a
68
- ) : e[n] = S(r));
67
+ (a) => a !== null && typeof a == "object" ? T(a) : a
68
+ ) : e[n] = T(r));
69
69
  }
70
70
  return e;
71
71
  }
72
- function Wn(t) {
72
+ function Bn(t) {
73
73
  let e = {};
74
74
  try {
75
75
  e = JSON.parse(t.profileData || "{}");
@@ -110,10 +110,10 @@ function Mr(t) {
110
110
  user_id: ln(r.user_id).id,
111
111
  isSocial: !!r.is_social
112
112
  },
113
- ...a.map(Wn)
113
+ ...a.map(Bn)
114
114
  ]
115
115
  };
116
- return S(d);
116
+ return T(d);
117
117
  };
118
118
  }
119
119
  function L(t, e, n, r) {
@@ -124,23 +124,23 @@ function L(t, e, n, r) {
124
124
  h === '"' ? (u = !u, o += h) : h === " " && !u ? o.trim() && (a.push(o.trim()), o = "") : o += h;
125
125
  }
126
126
  return o.trim() && a.push(o.trim()), a.map((c) => c.replace(/^([^:]+)=/g, "$1:")).map((c) => {
127
- let h = c.startsWith("-"), p = null, l = "", w = !1, f;
127
+ let h = c.startsWith("-"), p = null, l = "", y = !1, f;
128
128
  if (c.startsWith("-_exists_:"))
129
- p = c.substring(10), w = !0, h = !0;
129
+ p = c.substring(10), y = !0, h = !0;
130
130
  else if (c.startsWith("_exists_:"))
131
- p = c.substring(9), w = !0, h = !1;
131
+ p = c.substring(9), y = !0, h = !1;
132
132
  else if (c.includes(":")) {
133
133
  const v = h ? c.substring(1) : c, b = v.indexOf(":");
134
- p = v.substring(0, b), l = v.substring(b + 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));
134
+ p = v.substring(0, b), l = v.substring(b + 1), y = !1, l.startsWith(">=") ? (f = ">=", l = l.substring(2)) : l.startsWith(">") ? (f = ">", l = l.substring(1)) : l.startsWith("<=") ? (f = "<=", l = l.substring(2)) : l.startsWith("<") ? (f = "<", l = l.substring(1)) : f = "=", l.startsWith('"') && l.endsWith('"') && l.length > 1 && (l = l.slice(1, -1));
135
135
  } else
136
- p = null, l = c, w = !1;
137
- return { key: p, value: l, isNegation: h, isExistsQuery: w, operator: f };
138
- }).forEach(({ key: c, value: h, isNegation: p, isExistsQuery: l, operator: w }) => {
136
+ p = null, l = c, y = !1;
137
+ return { key: p, value: l, isNegation: h, isExistsQuery: y, operator: f };
138
+ }).forEach(({ key: c, value: h, isNegation: p, isExistsQuery: l, operator: y }) => {
139
139
  if (c)
140
140
  if (l)
141
141
  p ? e = e.where(c, "is", null) : e = e.where(c, "is not", null);
142
142
  else if (p)
143
- switch (w) {
143
+ switch (y) {
144
144
  case ">":
145
145
  e = e.where(c, "<=", h);
146
146
  break;
@@ -157,7 +157,7 @@ function L(t, e, n, r) {
157
157
  e = e.where(c, "!=", h);
158
158
  }
159
159
  else
160
- e = e.where(c, w, h);
160
+ e = e.where(c, y, h);
161
161
  else if (h) {
162
162
  const { ref: f } = t.dynamic;
163
163
  e = e.where(
@@ -171,19 +171,19 @@ function L(t, e, n, r) {
171
171
  function F(t) {
172
172
  return typeof t == "string" ? parseInt(t, 10) : typeof t == "bigint" ? Number(t) : t;
173
173
  }
174
- function Wr(t) {
174
+ function Br(t) {
175
175
  return async (e, n = {}) => {
176
176
  const { page: r = 0, per_page: a = 50, include_totals: o = !1, sort: u, q: d } = n;
177
177
  let c = t.selectFrom("users").where("users.tenant_id", "=", e);
178
- if (d && (c = L(t, c, d, ["email", "name"])), u && u.sort_by) {
178
+ if (d && (c = L(t, c, d, ["email", "name", "phone_number"])), u && u.sort_by) {
179
179
  const { ref: b } = t.dynamic;
180
180
  c = c.orderBy(b(u.sort_by), u.sort_order);
181
181
  }
182
- const p = await c.offset(r * a).limit(a).selectAll().execute(), l = p.map((b) => b.user_id), w = l.length ? await t.selectFrom("users").selectAll().where("users.tenant_id", "=", e).where("users.linked_to", "in", l).execute() : [], f = p.map((b) => {
183
- const E = w.filter(
182
+ const p = await c.offset(r * a).limit(a).selectAll().execute(), l = p.map((b) => b.user_id), y = l.length ? await t.selectFrom("users").selectAll().where("users.tenant_id", "=", e).where("users.linked_to", "in", l).execute() : [], f = p.map((b) => {
183
+ const E = y.filter(
184
184
  (D) => D.linked_to === b.user_id
185
185
  );
186
- return S({
186
+ return T({
187
187
  ...b,
188
188
  email_verified: b.email_verified === 1,
189
189
  is_social: b.is_social === 1,
@@ -196,7 +196,7 @@ function Wr(t) {
196
196
  user_id: ln(b.user_id).id,
197
197
  isSocial: !!b.is_social
198
198
  },
199
- ...E.map(Wn)
199
+ ...E.map(Bn)
200
200
  ]
201
201
  });
202
202
  });
@@ -216,7 +216,7 @@ function Wr(t) {
216
216
  };
217
217
  };
218
218
  }
219
- function Br(t) {
219
+ function Wr(t) {
220
220
  return async (e, n) => (await t.deleteFrom("users").where("users.tenant_id", "=", e).where("users.linked_to", "=", n).execute(), (await t.deleteFrom("users").where("users.tenant_id", "=", e).where("users.user_id", "=", n).execute()).length === 1);
221
221
  }
222
222
  function et(t, e = "", n = {}) {
@@ -227,7 +227,7 @@ function et(t, e = "", n = {}) {
227
227
  }
228
228
  return n;
229
229
  }
230
- function Bn(t, e) {
230
+ function Wn(t, e) {
231
231
  const n = {};
232
232
  for (const [r, a] of Object.entries(t)) {
233
233
  const o = e.find(
@@ -265,9 +265,9 @@ function Ur(t) {
265
265
  function Qr(t) {
266
266
  return {
267
267
  create: Jr(t),
268
- remove: Br(t),
268
+ remove: Wr(t),
269
269
  get: Mr(t),
270
- list: Wr(t),
270
+ list: Br(t),
271
271
  update: Kr(t),
272
272
  // TODO - think about this more when other issues fixed
273
273
  unlink: Ur(t)
@@ -304,7 +304,7 @@ function Xr(t) {
304
304
  function Zr(t) {
305
305
  return async (e) => {
306
306
  const n = await t.selectFrom("tenants").where("tenants.id", "=", e).selectAll().executeTakeFirst();
307
- return n ? S(n) : null;
307
+ return n ? T(n) : null;
308
308
  };
309
309
  }
310
310
  function ea(t) {
@@ -316,17 +316,17 @@ function ea(t) {
316
316
  n = n.orderBy(f(u.sort_by), u.sort_order);
317
317
  }
318
318
  d && (n = n.where((f) => f.or([f("name", "like", `%${d}%`)])));
319
- const p = (await n.offset(r * a).limit(a).selectAll().execute()).map(S);
319
+ const p = (await n.offset(r * a).limit(a).selectAll().execute()).map(T);
320
320
  if (!o)
321
321
  return {
322
322
  tenants: p
323
323
  };
324
- const { count: l } = await n.select((f) => f.fn.countAll().as("count")).executeTakeFirstOrThrow(), w = F(l);
324
+ const { count: l } = await n.select((f) => f.fn.countAll().as("count")).executeTakeFirstOrThrow(), y = F(l);
325
325
  return {
326
326
  tenants: p,
327
327
  start: r * a,
328
328
  limit: a,
329
- length: w
329
+ length: y
330
330
  };
331
331
  };
332
332
  }
@@ -417,12 +417,12 @@ function ia(t) {
417
417
  limit: 0,
418
418
  length: 0
419
419
  };
420
- const { count: w } = await c.select((f) => f.fn.countAll().as("count")).executeTakeFirstOrThrow();
420
+ const { count: y } = await c.select((f) => f.fn.countAll().as("count")).executeTakeFirstOrThrow();
421
421
  return {
422
422
  logs: l,
423
423
  start: r * a,
424
424
  limit: a,
425
- length: F(w)
425
+ length: F(y)
426
426
  };
427
427
  };
428
428
  }
@@ -506,7 +506,7 @@ function ma(t) {
506
506
  limit: 0,
507
507
  length: 0
508
508
  };
509
- const { count: w } = await c.select((v) => v.fn.countAll().as("count")).executeTakeFirstOrThrow(), f = F(w);
509
+ const { count: y } = await c.select((v) => v.fn.countAll().as("count")).executeTakeFirstOrThrow(), f = F(y);
510
510
  return {
511
511
  sessions: l,
512
512
  start: r * a,
@@ -564,9 +564,9 @@ function wa(t) {
564
564
  const { page: r = 0, per_page: a = 50, include_totals: o = !1, q: u } = n;
565
565
  let d = t.selectFrom("codes").where("codes.tenant_id", "=", e);
566
566
  u && (d = L(t, d, u, ["code", "login_id"]));
567
- const p = (await d.offset(r * a).limit(a).selectAll().execute()).map((w) => {
568
- const { tenant_id: f, ...v } = w;
569
- return zr.parse(S(v));
567
+ const p = (await d.offset(r * a).limit(a).selectAll().execute()).map((y) => {
568
+ const { tenant_id: f, ...v } = y;
569
+ return zr.parse(T(v));
570
570
  });
571
571
  if (!o)
572
572
  return {
@@ -575,7 +575,7 @@ function wa(t) {
575
575
  limit: 0,
576
576
  length: 0
577
577
  };
578
- const { count: l } = await d.select((w) => w.fn.countAll().as("count")).executeTakeFirstOrThrow();
578
+ const { count: l } = await d.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
579
579
  return {
580
580
  codes: p,
581
581
  start: r * a,
@@ -604,7 +604,7 @@ function Ca(t) {
604
604
  let a = t.selectFrom("codes").where("codes.code_id", "=", n).where("codes.code_type", "=", r);
605
605
  e.length && (a = a.where("codes.tenant_id", "=", e));
606
606
  const o = await a.selectAll().executeTakeFirst();
607
- return o ? S(o) : null;
607
+ return o ? T(o) : null;
608
608
  };
609
609
  }
610
610
  function ba(t) {
@@ -619,7 +619,7 @@ function Oa(t) {
619
619
  get: Ca(t)
620
620
  };
621
621
  }
622
- const Ta = 17, Sa = {
622
+ const xa = 17, Ta = {
623
623
  organization: "org_",
624
624
  connection: "con_",
625
625
  action: "act_",
@@ -629,10 +629,10 @@ const Ta = 17, Sa = {
629
629
  guardian_factor: "gfa_"
630
630
  };
631
631
  function Ft(t) {
632
- const r = Hr("0123456789abcdefghijklmnopqrstuvwxyz", Ta)();
633
- return `${Sa[t]}${r}`;
632
+ const r = Hr("0123456789abcdefghijklmnopqrstuvwxyz", xa)();
633
+ return `${Ta[t]}${r}`;
634
634
  }
635
- function xa() {
635
+ function Sa() {
636
636
  return Ft("organization");
637
637
  }
638
638
  function ka() {
@@ -666,9 +666,9 @@ function Pa(t) {
666
666
  let d = t.selectFrom("connections").where("connections.tenant_id", "=", e);
667
667
  u && (d = L(t, d, u, ["user_id", "ip"]));
668
668
  const p = (await d.offset(r * a).limit(a).selectAll().execute()).map(
669
- (w) => S({
670
- ...w,
671
- options: JSON.parse(w.options)
669
+ (y) => T({
670
+ ...y,
671
+ options: JSON.parse(y.options)
672
672
  })
673
673
  );
674
674
  if (!o)
@@ -678,7 +678,7 @@ function Pa(t) {
678
678
  limit: 0,
679
679
  length: 0
680
680
  };
681
- const { count: l } = await d.select((w) => w.fn.countAll().as("count")).executeTakeFirstOrThrow();
681
+ const { count: l } = await d.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
682
682
  return {
683
683
  connections: p,
684
684
  start: r * a,
@@ -693,7 +693,7 @@ function $a(t) {
693
693
  function Da(t) {
694
694
  return async (e, n) => {
695
695
  const r = await t.selectFrom("connections").where("connections.tenant_id", "=", e).where("connections.id", "=", n).selectAll().executeTakeFirst();
696
- return r ? S({
696
+ return r ? T({
697
697
  ...r,
698
698
  options: JSON.parse(r.options)
699
699
  }) : null;
@@ -779,13 +779,13 @@ function Fa(t) {
779
779
  }).execute(), r;
780
780
  };
781
781
  }
782
- function qa(t) {
782
+ function ja(t) {
783
783
  return async (e, n) => {
784
784
  const r = await t.selectFrom("clients").where("clients.tenant_id", "=", e).where("clients.client_id", "=", n).selectAll().executeTakeFirst();
785
785
  if (!r)
786
786
  return null;
787
787
  const { tenant_id: a, ...o } = r;
788
- return S({
788
+ return T({
789
789
  ...o,
790
790
  // Convert integer fields back to booleans
791
791
  global: !!r.global,
@@ -824,7 +824,7 @@ function qa(t) {
824
824
  });
825
825
  };
826
826
  }
827
- function ja(t) {
827
+ function qa(t) {
828
828
  return async (e, n) => {
829
829
  let r = t.selectFrom("clients").where("clients.tenant_id", "=", e);
830
830
  return n != null && n.per_page && (r = r.limit(n.per_page)), n != null && n.page && (n != null && n.per_page) && (r = r.offset((n.page - 1) * n.per_page)), {
@@ -893,13 +893,13 @@ function Ja(t) {
893
893
  function Ma(t) {
894
894
  return {
895
895
  create: Fa(t),
896
- get: qa(t),
897
- list: ja(t),
896
+ get: ja(t),
897
+ list: qa(t),
898
898
  remove: La(t),
899
899
  update: Ja(t)
900
900
  };
901
901
  }
902
- function Wa(t) {
902
+ function Ba(t) {
903
903
  return async (e, n) => {
904
904
  const r = (/* @__PURE__ */ new Date()).toISOString(), a = re(), { scope: o, authorization_details_types: u, ...d } = n, c = {
905
905
  id: a,
@@ -913,7 +913,7 @@ function Wa(t) {
913
913
  created_at: r,
914
914
  updated_at: r
915
915
  };
916
- return await t.insertInto("client_grants").values(c).execute(), S({
916
+ return await t.insertInto("client_grants").values(c).execute(), T({
917
917
  id: a,
918
918
  tenant_id: e,
919
919
  ...d,
@@ -927,7 +927,7 @@ function Wa(t) {
927
927
  });
928
928
  };
929
929
  }
930
- function Ba(t) {
930
+ function Wa(t) {
931
931
  return async (e, n) => {
932
932
  const r = await t.selectFrom("client_grants").selectAll().where("client_grants.tenant_id", "=", e).where("client_grants.id", "=", n).executeTakeFirst();
933
933
  if (!r)
@@ -946,7 +946,7 @@ function Ba(t) {
946
946
  created_at: r.created_at,
947
947
  updated_at: r.updated_at
948
948
  };
949
- return S(a);
949
+ return T(a);
950
950
  };
951
951
  }
952
952
  function Ka(t) {
@@ -987,7 +987,7 @@ function Ka(t) {
987
987
  created_at: f.created_at,
988
988
  updated_at: f.updated_at
989
989
  };
990
- return S(v);
990
+ return T(v);
991
991
  });
992
992
  if (!o)
993
993
  return {
@@ -996,12 +996,12 @@ function Ka(t) {
996
996
  limit: 0,
997
997
  length: 0
998
998
  };
999
- const { count: w } = await c.select((f) => f.fn.countAll().as("count")).executeTakeFirstOrThrow();
999
+ const { count: y } = await c.select((f) => f.fn.countAll().as("count")).executeTakeFirstOrThrow();
1000
1000
  return {
1001
1001
  client_grants: l,
1002
1002
  start: r * a,
1003
1003
  limit: a,
1004
- length: F(w)
1004
+ length: F(y)
1005
1005
  };
1006
1006
  };
1007
1007
  }
@@ -1021,8 +1021,8 @@ function Qa(t) {
1021
1021
  }
1022
1022
  function Va(t) {
1023
1023
  return {
1024
- create: Wa(t),
1025
- get: Ba(t),
1024
+ create: Ba(t),
1025
+ get: Wa(t),
1026
1026
  list: Ka(t),
1027
1027
  remove: Ua(t),
1028
1028
  update: Qa(t)
@@ -1053,7 +1053,7 @@ function Ga(t) {
1053
1053
  // Parse JSON string fields back to objects/arrays
1054
1054
  connections: a.map(
1055
1055
  (d) => Fr.parse(
1056
- S({
1056
+ T({
1057
1057
  ...d,
1058
1058
  options: d.options ? JSON.parse(d.options) : {}
1059
1059
  })
@@ -1080,7 +1080,7 @@ function Ga(t) {
1080
1080
  client_authentication_methods: n.client_authentication_methods ? JSON.parse(n.client_authentication_methods) : {},
1081
1081
  signed_request_object: n.signed_request_object ? JSON.parse(n.signed_request_object) : {},
1082
1082
  token_quota: n.token_quota ? JSON.parse(n.token_quota) : {},
1083
- tenant: S(r),
1083
+ tenant: T(r),
1084
1084
  // Extract legacy fields from client_metadata
1085
1085
  disable_sign_ups: o.disable_sign_ups === "true",
1086
1086
  email_validation: o.email_validation || "disabled"
@@ -1121,12 +1121,12 @@ function Ya(t) {
1121
1121
  limit: 0,
1122
1122
  length: 0
1123
1123
  };
1124
- const l = await c.executeTakeFirst(), w = F((l == null ? void 0 : l.count) ?? 0);
1124
+ const l = await c.executeTakeFirst(), y = F((l == null ? void 0 : l.count) ?? 0);
1125
1125
  return {
1126
1126
  signingKeys: p,
1127
1127
  start: h,
1128
1128
  limit: r,
1129
- length: w
1129
+ length: y
1130
1130
  };
1131
1131
  };
1132
1132
  }
@@ -1224,7 +1224,7 @@ function so(t) {
1224
1224
  font_url: h,
1225
1225
  ...p
1226
1226
  } = n;
1227
- return S({
1227
+ return T({
1228
1228
  ...p,
1229
1229
  colors: {
1230
1230
  primary: a,
@@ -1241,7 +1241,7 @@ function so(t) {
1241
1241
  }
1242
1242
  function uo(t) {
1243
1243
  return async (e, n) => {
1244
- var u, d, c, h, p, l, w, f, v, b, E, D, ae, U, pe, Nt, ge, nt;
1244
+ var u, d, c, h, p, l, y, f, v, b, E, D, ae, U, pe, Nt, ge, nt;
1245
1245
  const { colors: r, font: a, ...o } = n;
1246
1246
  try {
1247
1247
  await t.insertInto("branding").values({
@@ -1250,7 +1250,7 @@ function uo(t) {
1250
1250
  colors_page_background_type: (d = (u = n.colors) == null ? void 0 : u.page_background) == null ? void 0 : d.type,
1251
1251
  colors_page_background_start: (h = (c = n.colors) == null ? void 0 : c.page_background) == null ? void 0 : h.start,
1252
1252
  colors_page_background_end: (l = (p = n.colors) == null ? void 0 : p.page_background) == null ? void 0 : l.end,
1253
- colors_page_background_angle_dev: (f = (w = n.colors) == null ? void 0 : w.page_background) == null ? void 0 : f.angle_deg,
1253
+ colors_page_background_angle_dev: (f = (y = n.colors) == null ? void 0 : y.page_background) == null ? void 0 : f.angle_deg,
1254
1254
  font_url: (v = n.font) == null ? void 0 : v.url,
1255
1255
  tenant_id: e
1256
1256
  }).execute();
@@ -1278,9 +1278,9 @@ function lo(t) {
1278
1278
  const { page: r = 0, per_page: a = 50, include_totals: o = !1, q: u } = n;
1279
1279
  let d = t.selectFrom("hooks").where("hooks.tenant_id", "=", e);
1280
1280
  u && (d = L(t, d, u, ["url", "form_id"]));
1281
- const p = (await d.offset(r * a).limit(a).selectAll().execute()).map((w) => {
1282
- const { tenant_id: f, enabled: v, synchronous: b, ...E } = w;
1283
- return S({
1281
+ const p = (await d.offset(r * a).limit(a).selectAll().execute()).map((y) => {
1282
+ const { tenant_id: f, enabled: v, synchronous: b, ...E } = y;
1283
+ return T({
1284
1284
  ...E,
1285
1285
  enabled: !!v,
1286
1286
  synchronous: !!b
@@ -1293,7 +1293,7 @@ function lo(t) {
1293
1293
  limit: 0,
1294
1294
  length: 0
1295
1295
  };
1296
- const { count: l } = await d.select((w) => w.fn.countAll().as("count")).executeTakeFirstOrThrow();
1296
+ const { count: l } = await d.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
1297
1297
  return {
1298
1298
  hooks: p,
1299
1299
  start: r * a,
@@ -1305,7 +1305,7 @@ function lo(t) {
1305
1305
  function _o(t) {
1306
1306
  return async (e, n) => {
1307
1307
  const r = await t.selectFrom("hooks").where("hooks.tenant_id", "=", e).where("hooks.hook_id", "=", n).selectAll().executeTakeFirst();
1308
- return r ? S({
1308
+ return r ? T({
1309
1309
  ...r,
1310
1310
  enabled: !!r.enabled,
1311
1311
  synchronous: !!r.synchronous
@@ -1383,8 +1383,8 @@ function wo(t) {
1383
1383
  fonts_subtitle_bold: !!r.fonts_subtitle_bold,
1384
1384
  fonts_title_bold: !!r.fonts_title_bold
1385
1385
  };
1386
- return S(
1387
- Bn(a, [
1386
+ return T(
1387
+ Wn(a, [
1388
1388
  "widget",
1389
1389
  "colors",
1390
1390
  "borders",
@@ -1414,9 +1414,9 @@ function vo(t) {
1414
1414
  function Co(t) {
1415
1415
  return async (e, n) => {
1416
1416
  const r = await t.selectFrom("login_sessions").where("login_sessions.id", "=", n).selectAll().executeTakeFirst();
1417
- return r ? qr.parse(
1418
- Bn(
1419
- S({
1417
+ return r ? jr.parse(
1418
+ Wn(
1419
+ T({
1420
1420
  ...r,
1421
1421
  login_completed: !!r.login_completed
1422
1422
  }),
@@ -1449,21 +1449,21 @@ function Oo(t) {
1449
1449
  })
1450
1450
  ).where("login_sessions.id", "=", n).where("login_sessions.tenant_id", "=", e).execute()).length === 1;
1451
1451
  }
1452
- function To(t) {
1452
+ function xo(t) {
1453
1453
  return async (e, n) => (await t.deleteFrom("login_sessions").where("login_sessions.tenant_id", "=", e).where("login_sessions.id", "=", n).execute()).length > 0;
1454
1454
  }
1455
- function So(t) {
1455
+ function To(t) {
1456
1456
  return {
1457
1457
  create: bo(t),
1458
1458
  get: Co(t),
1459
1459
  update: Oo(t),
1460
- remove: To(t)
1460
+ remove: xo(t)
1461
1461
  };
1462
1462
  }
1463
- function xo(t) {
1463
+ function So(t) {
1464
1464
  return async (e) => {
1465
1465
  const [n] = await t.selectFrom("prompt_settings").where("prompt_settings.tenant_id", "=", e).selectAll().execute();
1466
- return S({
1466
+ return T({
1467
1467
  identifier_first: !!(n != null && n.identifier_first),
1468
1468
  password_first: !!(n != null && n.password_first),
1469
1469
  webauthn_platform_first_factor: !!(n != null && n.webauthn_platform_first_factor),
@@ -1472,7 +1472,7 @@ function xo(t) {
1472
1472
  };
1473
1473
  }
1474
1474
  function Cn(t) {
1475
- return S({
1475
+ return T({
1476
1476
  ...t,
1477
1477
  webauthn_platform_first_factor: t.webauthn_platform_first_factor ? !!t.webauthn_platform_first_factor : void 0,
1478
1478
  identifier_first: t.identifier_first ? !!t.identifier_first : void 0,
@@ -1483,7 +1483,7 @@ function Cn(t) {
1483
1483
  function ko(t) {
1484
1484
  return async (e, n) => {
1485
1485
  try {
1486
- const r = jr.parse(n);
1486
+ const r = qr.parse(n);
1487
1487
  await t.insertInto("prompt_settings").values({
1488
1488
  ...Cn(r),
1489
1489
  tenant_id: e
@@ -1495,7 +1495,7 @@ function ko(t) {
1495
1495
  }
1496
1496
  function Eo(t) {
1497
1497
  return {
1498
- get: xo(t),
1498
+ get: So(t),
1499
1499
  set: ko(t)
1500
1500
  };
1501
1501
  }
@@ -1511,7 +1511,7 @@ function Io(t) {
1511
1511
  enabled: u,
1512
1512
  ...d
1513
1513
  } = n;
1514
- return S({
1514
+ return T({
1515
1515
  ...d,
1516
1516
  credentials: JSON.parse(a),
1517
1517
  settings: JSON.parse(o),
@@ -1591,7 +1591,7 @@ function Fo(t) {
1591
1591
  return !!(await t.updateTable("refresh_tokens").set(a).where("tenant_id", "=", e).where("refresh_tokens.id", "=", n).execute()).length;
1592
1592
  };
1593
1593
  }
1594
- function qo(t) {
1594
+ function jo(t) {
1595
1595
  return async (e, n = {}) => {
1596
1596
  const { page: r = 0, per_page: a = 50, include_totals: o = !1, sort: u, q: d } = n;
1597
1597
  let c = t.selectFrom("refresh_tokens").where("refresh_tokens.tenant_id", "=", e);
@@ -1615,7 +1615,7 @@ function qo(t) {
1615
1615
  limit: 0,
1616
1616
  length: 0
1617
1617
  };
1618
- const { count: w } = await c.select((v) => v.fn.countAll().as("count")).executeTakeFirstOrThrow(), f = F(w);
1618
+ const { count: y } = await c.select((v) => v.fn.countAll().as("count")).executeTakeFirstOrThrow(), f = F(y);
1619
1619
  return {
1620
1620
  refresh_tokens: l,
1621
1621
  start: r * a,
@@ -1624,11 +1624,11 @@ function qo(t) {
1624
1624
  };
1625
1625
  };
1626
1626
  }
1627
- function jo(t) {
1627
+ function qo(t) {
1628
1628
  return {
1629
1629
  create: Ro(t),
1630
1630
  get: Do(t),
1631
- list: qo(t),
1631
+ list: jo(t),
1632
1632
  remove: zo(t),
1633
1633
  update: Fo(t)
1634
1634
  };
@@ -1686,8 +1686,8 @@ function Mo(t) {
1686
1686
  const { page: r = 0, per_page: a = 50, include_totals: o = !1, q: u } = n;
1687
1687
  let d = t.selectFrom("forms").where("tenant_id", "=", e);
1688
1688
  u && (d = L(t, d, u, []));
1689
- const p = (await d.offset(r * a).limit(a).selectAll().execute()).map((w) => {
1690
- const f = { ...w };
1689
+ const p = (await d.offset(r * a).limit(a).selectAll().execute()).map((y) => {
1690
+ const f = { ...y };
1691
1691
  if (typeof f.nodes == "string")
1692
1692
  try {
1693
1693
  f.nodes = JSON.parse(f.nodes);
@@ -1703,7 +1703,7 @@ function Mo(t) {
1703
1703
  f.ending = JSON.parse(f.ending);
1704
1704
  } catch {
1705
1705
  }
1706
- return bt.parse(S(f));
1706
+ return bt.parse(T(f));
1707
1707
  });
1708
1708
  if (!o)
1709
1709
  return {
@@ -1712,7 +1712,7 @@ function Mo(t) {
1712
1712
  limit: 0,
1713
1713
  length: 0
1714
1714
  };
1715
- const { count: l } = await d.select((w) => w.fn.countAll().as("count")).executeTakeFirstOrThrow();
1715
+ const { count: l } = await d.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
1716
1716
  return {
1717
1717
  forms: p,
1718
1718
  start: r * a,
@@ -1721,13 +1721,13 @@ function Mo(t) {
1721
1721
  };
1722
1722
  };
1723
1723
  }
1724
- function Wo(t) {
1724
+ function Bo(t) {
1725
1725
  return async (e, n) => {
1726
1726
  const { numDeletedRows: r } = await t.deleteFrom("forms").where("id", "=", n).where("tenant_id", "=", e).executeTakeFirst();
1727
1727
  return r > 0;
1728
1728
  };
1729
1729
  }
1730
- function Bo(t) {
1730
+ function Wo(t) {
1731
1731
  return async (e, n) => {
1732
1732
  const r = await t.selectFrom("forms").selectAll().where("forms.id", "=", n).where("tenant_id", "=", e).executeTakeFirst();
1733
1733
  if (!r) return null;
@@ -1747,7 +1747,7 @@ function Bo(t) {
1747
1747
  a.ending = JSON.parse(a.ending);
1748
1748
  } catch {
1749
1749
  }
1750
- return bt.parse(S(a));
1750
+ return bt.parse(T(a));
1751
1751
  };
1752
1752
  }
1753
1753
  function Ko(t) {
@@ -1764,9 +1764,9 @@ function Ko(t) {
1764
1764
  function Uo(t) {
1765
1765
  return {
1766
1766
  create: Jo(t),
1767
- get: Bo(t),
1767
+ get: Wo(t),
1768
1768
  list: Mo(t),
1769
- remove: Wo(t),
1769
+ remove: Bo(t),
1770
1770
  update: Ko(t)
1771
1771
  };
1772
1772
  }
@@ -1784,7 +1784,7 @@ function Qo(t) {
1784
1784
  skip_consent_for_verifiable_first_party_clients: h,
1785
1785
  allow_offline_access: p,
1786
1786
  ...l
1787
- } = o, w = {
1787
+ } = o, y = {
1788
1788
  ...l,
1789
1789
  tenant_id: e,
1790
1790
  scopes: d ? JSON.stringify(d) : "[]",
@@ -1795,7 +1795,7 @@ function Qo(t) {
1795
1795
  created_at: r,
1796
1796
  updated_at: r
1797
1797
  };
1798
- return await t.insertInto("resource_servers").values(w).execute(), S(o);
1798
+ return await t.insertInto("resource_servers").values(y).execute(), T(o);
1799
1799
  };
1800
1800
  }
1801
1801
  function Vo(t) {
@@ -1818,7 +1818,7 @@ function Vo(t) {
1818
1818
  // Convert verification_key back to verificationKey for API
1819
1819
  verificationKey: o
1820
1820
  };
1821
- return S(l);
1821
+ return T(l);
1822
1822
  };
1823
1823
  }
1824
1824
  function Go(t) {
@@ -1826,18 +1826,18 @@ function Go(t) {
1826
1826
  const { page: r = 0, per_page: a = 50, include_totals: o = !1, q: u } = n;
1827
1827
  let d = t.selectFrom("resource_servers").where("resource_servers.tenant_id", "=", e);
1828
1828
  if (u) {
1829
- const w = u.trim(), f = w.split(/\s+/), v = f.length === 1 ? f[0] : void 0, b = v ? v.match(/^(-)?(name|identifier):(.*)$/) : null, E = b ? b[3] : "", D = /^(>=|>|<=|<)/.test(E || "");
1829
+ const y = u.trim(), f = y.split(/\s+/), v = f.length === 1 ? f[0] : void 0, b = v ? v.match(/^(-)?(name|identifier):(.*)$/) : null, E = b ? b[3] : "", D = /^(>=|>|<=|<)/.test(E || "");
1830
1830
  if (b && !D) {
1831
1831
  const ae = !!b[1], U = b[2] === "name" ? "resource_servers.name" : "resource_servers.identifier";
1832
1832
  d = ae ? d.where(U, "not like", `%${E}%`) : d.where(U, "like", `%${E}%`);
1833
1833
  } else
1834
- d = L(t, d, w, [
1834
+ d = L(t, d, y, [
1835
1835
  "resource_servers.name",
1836
1836
  "resource_servers.identifier"
1837
1837
  ]);
1838
1838
  }
1839
- const p = (await d.offset(r * a).limit(a).selectAll().execute()).map((w) => {
1840
- const f = w, {
1839
+ const p = (await d.offset(r * a).limit(a).selectAll().execute()).map((y) => {
1840
+ const f = y, {
1841
1841
  verification_key: v,
1842
1842
  scopes: b,
1843
1843
  options: E,
@@ -1853,7 +1853,7 @@ function Go(t) {
1853
1853
  // Convert verification_key back to verificationKey for API
1854
1854
  verificationKey: v
1855
1855
  };
1856
- return S(pe);
1856
+ return T(pe);
1857
1857
  });
1858
1858
  if (!o)
1859
1859
  return {
@@ -1862,7 +1862,7 @@ function Go(t) {
1862
1862
  limit: 0,
1863
1863
  length: 0
1864
1864
  };
1865
- const { count: l } = await d.select((w) => w.fn.countAll().as("count")).executeTakeFirstOrThrow();
1865
+ const { count: l } = await d.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
1866
1866
  return {
1867
1867
  resource_servers: p,
1868
1868
  start: r * a,
@@ -1890,7 +1890,11 @@ function Ho(t) {
1890
1890
  ...h,
1891
1891
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
1892
1892
  };
1893
- a !== void 0 && (p.verification_key = a), o !== void 0 && (p.scopes = JSON.stringify(o)), u !== void 0 && (p.options = JSON.stringify(u)), d !== void 0 && (p.skip_consent_for_verifiable_first_party_clients = d ? 1 : 0), c !== void 0 && (p.allow_offline_access = c ? 1 : 0);
1893
+ if (a !== void 0 && (p.verification_key = a), o !== void 0 && (p.scopes = JSON.stringify(o)), u !== void 0) {
1894
+ const y = await t.selectFrom("resource_servers").select("options").where("tenant_id", "=", e).where("id", "=", n).executeTakeFirst(), v = { ...y != null && y.options ? JSON.parse(y.options) : {}, ...u };
1895
+ p.options = JSON.stringify(v);
1896
+ }
1897
+ d !== void 0 && (p.skip_consent_for_verifiable_first_party_clients = d ? 1 : 0), c !== void 0 && (p.allow_offline_access = c ? 1 : 0);
1894
1898
  const l = await t.updateTable("resource_servers").set(p).where("tenant_id", "=", e).where("id", "=", n).executeTakeFirst();
1895
1899
  return Number(l.numUpdatedRows) > 0;
1896
1900
  };
@@ -2210,7 +2214,7 @@ function wi(t) {
2210
2214
  return async (e, n) => {
2211
2215
  const r = {
2212
2216
  ...n,
2213
- id: n.id || xa(),
2217
+ id: n.id || Sa(),
2214
2218
  tenant_id: e,
2215
2219
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
2216
2220
  updated_at: (/* @__PURE__ */ new Date()).toISOString(),
@@ -2239,7 +2243,7 @@ function wi(t) {
2239
2243
  function Ni(t) {
2240
2244
  return async (e, n) => {
2241
2245
  const r = await t.selectFrom("organizations").selectAll().where("tenant_id", "=", e).where("id", "=", n).executeTakeFirst();
2242
- return r ? S({
2246
+ return r ? T({
2243
2247
  ...r,
2244
2248
  branding: r.branding ? JSON.parse(r.branding) : {},
2245
2249
  metadata: r.metadata ? JSON.parse(r.metadata) : {},
@@ -2256,7 +2260,7 @@ function vi(t) {
2256
2260
  r = r.offset(u);
2257
2261
  }
2258
2262
  const o = (await r.execute()).map(
2259
- (u) => S({
2263
+ (u) => T({
2260
2264
  ...u,
2261
2265
  branding: u.branding ? JSON.parse(u.branding) : {},
2262
2266
  metadata: u.metadata ? JSON.parse(u.metadata) : {},
@@ -2293,7 +2297,7 @@ function Oi(t) {
2293
2297
  update: bi(t)
2294
2298
  };
2295
2299
  }
2296
- function Ti(t) {
2300
+ function xi(t) {
2297
2301
  return async (e, n) => {
2298
2302
  const r = {
2299
2303
  id: re(),
@@ -2315,7 +2319,7 @@ function Ti(t) {
2315
2319
  };
2316
2320
  };
2317
2321
  }
2318
- function Si(t) {
2322
+ function Ti(t) {
2319
2323
  return async (e, n) => {
2320
2324
  const r = await t.selectFrom("user_organizations").selectAll().where("id", "=", n).where("tenant_id", "=", e).executeTakeFirst();
2321
2325
  return r ? {
@@ -2327,7 +2331,7 @@ function Si(t) {
2327
2331
  } : null;
2328
2332
  };
2329
2333
  }
2330
- function xi(t) {
2334
+ function Si(t) {
2331
2335
  return async (e, n) => {
2332
2336
  const r = (n == null ? void 0 : n.page) || 0, a = (n == null ? void 0 : n.per_page) || 50, o = r * a;
2333
2337
  let u = t.selectFrom("user_organizations").selectAll().where("tenant_id", "=", e);
@@ -2427,9 +2431,9 @@ function Ii(t) {
2427
2431
  function Ai(t) {
2428
2432
  return {
2429
2433
  // CRUD operations
2430
- create: Ti(t),
2431
- get: Si(t),
2432
- list: xi(t),
2434
+ create: xi(t),
2435
+ get: Ti(t),
2436
+ list: Si(t),
2433
2437
  listUserOrganizations: ki(t),
2434
2438
  remove: Ei(t),
2435
2439
  update: Ii(t)
@@ -2456,7 +2460,7 @@ function Vn(t) {
2456
2460
  function Ee(t) {
2457
2461
  return typeof t == "function";
2458
2462
  }
2459
- function qt(t) {
2463
+ function jt(t) {
2460
2464
  return typeof t == "object" && t !== null;
2461
2465
  }
2462
2466
  function Pi(t) {
@@ -2509,7 +2513,7 @@ const z = s({
2509
2513
  alias: e
2510
2514
  });
2511
2515
  }
2512
- }), xe = s({
2516
+ }), Se = s({
2513
2517
  is(t) {
2514
2518
  return t.kind === "TableNode";
2515
2519
  },
@@ -2527,13 +2531,13 @@ const z = s({
2527
2531
  }
2528
2532
  });
2529
2533
  function J(t) {
2530
- return qt(t) && Ee(t.toOperationNode);
2534
+ return jt(t) && Ee(t.toOperationNode);
2531
2535
  }
2532
2536
  function $i(t) {
2533
- return qt(t) && "expressionType" in t && J(t);
2537
+ return jt(t) && "expressionType" in t && J(t);
2534
2538
  }
2535
2539
  function Di(t) {
2536
- return qt(t) && "expression" in t && G(t.alias) && J(t);
2540
+ return jt(t) && "expression" in t && G(t.alias) && J(t);
2537
2541
  }
2538
2542
  const Y = s({
2539
2543
  is(t) {
@@ -2684,10 +2688,10 @@ const Y = s({
2684
2688
  ...zi,
2685
2689
  "&&",
2686
2690
  "||"
2687
- ], qi = ["exists", "not exists"], ji = ["not", "-", ...qi], Li = [
2691
+ ], ji = ["exists", "not exists"], qi = ["not", "-", ...ji], Li = [
2688
2692
  ...Fi,
2689
2693
  ...Gn,
2690
- ...ji,
2694
+ ...qi,
2691
2695
  "between",
2692
2696
  "between symmetric"
2693
2697
  ], ke = s({
@@ -2723,7 +2727,7 @@ const mn = s({
2723
2727
  kind: "SelectAllNode"
2724
2728
  });
2725
2729
  }
2726
- }), jt = s({
2730
+ }), qt = s({
2727
2731
  is(t) {
2728
2732
  return t.kind === "ReferenceNode";
2729
2733
  },
@@ -2743,7 +2747,7 @@ const mn = s({
2743
2747
  }
2744
2748
  });
2745
2749
  function Hn(t) {
2746
- return qt(t) && J(t) && G(t.dynamicReference);
2750
+ return jt(t) && J(t) && G(t.dynamicReference);
2747
2751
  }
2748
2752
  const Yt = s({
2749
2753
  is(t) {
@@ -2799,7 +2803,7 @@ function Ut(t, e) {
2799
2803
  return Yt.create(n, Zn(e));
2800
2804
  }
2801
2805
  function Mi(t) {
2802
- if (Wt(t))
2806
+ if (Bt(t))
2803
2807
  return Mt(t);
2804
2808
  if (Hn(t))
2805
2809
  return t.toOperationNode();
@@ -2815,7 +2819,7 @@ function Zn(t) {
2815
2819
  if (t)
2816
2820
  return t === "asc" || t === "desc" ? R.createWithSql(t) : t.toOperationNode();
2817
2821
  }
2818
- const Tt = s({
2822
+ const xt = s({
2819
2823
  is(t) {
2820
2824
  return t.kind === "JSONReferenceNode";
2821
2825
  },
@@ -2867,28 +2871,28 @@ const Tt = s({
2867
2871
  });
2868
2872
  }
2869
2873
  });
2870
- function Wi(t) {
2874
+ function Bi(t) {
2871
2875
  return G(t) ? me(t) : t.toOperationNode();
2872
2876
  }
2873
2877
  function _t(t) {
2874
- return le(t) ? t.map((e) => q(e)) : [q(t)];
2878
+ return le(t) ? t.map((e) => j(e)) : [j(t)];
2875
2879
  }
2876
- function q(t) {
2877
- return Wt(t) ? Mt(t) : Wi(t);
2880
+ function j(t) {
2881
+ return Bt(t) ? Mt(t) : Bi(t);
2878
2882
  }
2879
- function Bi(t, e) {
2883
+ function Wi(t, e) {
2880
2884
  const n = me(t);
2881
2885
  if (bn(e))
2882
- return Tt.create(n, er.create(ke.create(e)));
2886
+ return xt.create(n, er.create(ke.create(e)));
2883
2887
  const r = e.slice(0, -1);
2884
2888
  if (bn(r))
2885
- return Tt.create(n, it.create(ke.create(r)));
2889
+ return xt.create(n, it.create(ke.create(r)));
2886
2890
  throw new Error(`Invalid JSON operator: ${e}`);
2887
2891
  }
2888
2892
  function me(t) {
2889
2893
  const e = ".";
2890
2894
  if (!t.includes(e))
2891
- return jt.create(mn.create(t));
2895
+ return qt.create(mn.create(t));
2892
2896
  const n = t.split(e).map(tr);
2893
2897
  if (n.length === 3)
2894
2898
  return Ui(n);
@@ -2906,11 +2910,11 @@ function Ki(t) {
2906
2910
  }
2907
2911
  function Ui(t) {
2908
2912
  const [e, n, r] = t;
2909
- return jt.create(mn.create(r), xe.createWithSchema(e, n));
2913
+ return qt.create(mn.create(r), Se.createWithSchema(e, n));
2910
2914
  }
2911
2915
  function Qi(t) {
2912
2916
  const [e, n] = t;
2913
- return jt.create(mn.create(n), xe.create(e));
2917
+ return qt.create(mn.create(n), Se.create(e));
2914
2918
  }
2915
2919
  function tr(t) {
2916
2920
  return t.trim();
@@ -2957,7 +2961,7 @@ function Yi(t) {
2957
2961
  return le(t) ? Hi(t) : $(t);
2958
2962
  }
2959
2963
  function $(t) {
2960
- return Wt(t) ? Mt(t) : he.create(t);
2964
+ return Bt(t) ? Mt(t) : he.create(t);
2961
2965
  }
2962
2966
  function hn(t) {
2963
2967
  return _n(t) || Un(t) || Qn(t);
@@ -2968,7 +2972,7 @@ function fn(t) {
2968
2972
  return he.createImmediate(t);
2969
2973
  }
2970
2974
  function Hi(t) {
2971
- return t.some(Wt) ? Gi.create(t.map((e) => $(e))) : Vi.create(t);
2975
+ return t.some(Bt) ? Gi.create(t.map((e) => $(e))) : Vi.create(t);
2972
2976
  }
2973
2977
  const mt = s({
2974
2978
  is(t) {
@@ -2989,10 +2993,10 @@ function K(t) {
2989
2993
  throw new Error(`invalid arguments: ${JSON.stringify(t)}`);
2990
2994
  }
2991
2995
  function pn(t, e, n) {
2992
- return Xi(e) && nr(n) ? Xe.create(q(t), Xt(e), he.createImmediate(n)) : Xe.create(q(t), Xt(e), Yi(n));
2996
+ return Xi(e) && nr(n) ? Xe.create(j(t), Xt(e), he.createImmediate(n)) : Xe.create(j(t), Xt(e), Yi(n));
2993
2997
  }
2994
2998
  function ht(t, e, n) {
2995
- return Xe.create(q(t), Xt(e), q(n));
2999
+ return Xe.create(j(t), Xt(e), j(n));
2996
3000
  }
2997
3001
  function On(t, e) {
2998
3002
  return Ht(Object.entries(t).filter(([, n]) => !Ot(n)).map(([n, r]) => pn(n, nr(r) ? "is" : "=", r)), e);
@@ -3001,9 +3005,9 @@ function Ht(t, e, n = !0) {
3001
3005
  const r = e === "and" ? _e.create : tt.create;
3002
3006
  if (t.length === 0)
3003
3007
  return Xe.create(he.createImmediate(1), ke.create("="), he.createImmediate(e === "and" ? 1 : 0));
3004
- let a = Tn(t[0]);
3008
+ let a = xn(t[0]);
3005
3009
  for (let o = 1; o < t.length; ++o)
3006
- a = r(a, Tn(t[o]));
3010
+ a = r(a, xn(t[o]));
3007
3011
  return t.length > 1 && n ? mt.create(a) : a;
3008
3012
  }
3009
3013
  function Xi(t) {
@@ -3019,7 +3023,7 @@ function Xt(t) {
3019
3023
  return t.toOperationNode();
3020
3024
  throw new Error(`invalid operator ${JSON.stringify(t)}`);
3021
3025
  }
3022
- function Tn(t) {
3026
+ function xn(t) {
3023
3027
  return J(t) ? t.toOperationNode() : t;
3024
3028
  }
3025
3029
  const Ze = s({
@@ -3038,7 +3042,7 @@ const Ze = s({
3038
3042
  items: s([...t.items, ...e])
3039
3043
  });
3040
3044
  }
3041
- }), Sn = s({
3045
+ }), Tn = s({
3042
3046
  is(t) {
3043
3047
  return t.kind === "PartitionByNode";
3044
3048
  },
@@ -3072,10 +3076,10 @@ const Ze = s({
3072
3076
  cloneWithPartitionByItems(t, e) {
3073
3077
  return s({
3074
3078
  ...t,
3075
- partitionBy: t.partitionBy ? Sn.cloneWithItems(t.partitionBy, e) : Sn.create(e)
3079
+ partitionBy: t.partitionBy ? Tn.cloneWithItems(t.partitionBy, e) : Tn.create(e)
3076
3080
  });
3077
3081
  }
3078
- }), St = s({
3082
+ }), Tt = s({
3079
3083
  is(t) {
3080
3084
  return t.kind === "FromNode";
3081
3085
  },
@@ -3091,7 +3095,7 @@ const Ze = s({
3091
3095
  froms: s([...t.froms, ...e])
3092
3096
  });
3093
3097
  }
3094
- }), xn = s({
3098
+ }), Sn = s({
3095
3099
  is(t) {
3096
3100
  return t.kind === "GroupByNode";
3097
3101
  },
@@ -3123,7 +3127,7 @@ const Ze = s({
3123
3127
  having: e === "And" ? _e.create(t.having, n) : tt.create(t.having, n)
3124
3128
  });
3125
3129
  }
3126
- }), T = s({
3130
+ }), x = s({
3127
3131
  is(t) {
3128
3132
  return t.kind === "SelectQueryNode";
3129
3133
  },
@@ -3136,7 +3140,7 @@ const Ze = s({
3136
3140
  createFrom(t, e) {
3137
3141
  return s({
3138
3142
  kind: "SelectQueryNode",
3139
- from: St.create(t),
3143
+ from: Tt.create(t),
3140
3144
  ...e && { with: e }
3141
3145
  });
3142
3146
  },
@@ -3173,7 +3177,7 @@ const Ze = s({
3173
3177
  cloneWithGroupByItems(t, e) {
3174
3178
  return s({
3175
3179
  ...t,
3176
- groupBy: t.groupBy ? xn.cloneWithItems(t.groupBy, e) : xn.create(e)
3180
+ groupBy: t.groupBy ? Sn.cloneWithItems(t.groupBy, e) : Sn.create(e)
3177
3181
  });
3178
3182
  },
3179
3183
  cloneWithLimit(t, e) {
@@ -3247,16 +3251,16 @@ function Ie(t, e) {
3247
3251
  }
3248
3252
  });
3249
3253
  }
3250
- var W;
3254
+ var B;
3251
3255
  const dt = class dt {
3252
3256
  constructor(e) {
3253
- C(this, W);
3254
- O(this, W, s(e));
3257
+ C(this, B);
3258
+ O(this, B, s(e));
3255
3259
  }
3256
3260
  on(...e) {
3257
3261
  return new dt({
3258
- ...i(this, W),
3259
- joinNode: ot.cloneWithOn(i(this, W).joinNode, K(e))
3262
+ ...i(this, B),
3263
+ joinNode: ot.cloneWithOn(i(this, B).joinNode, K(e))
3260
3264
  });
3261
3265
  }
3262
3266
  /**
@@ -3267,8 +3271,8 @@ const dt = class dt {
3267
3271
  */
3268
3272
  onRef(e, n, r) {
3269
3273
  return new dt({
3270
- ...i(this, W),
3271
- joinNode: ot.cloneWithOn(i(this, W).joinNode, ht(e, n, r))
3274
+ ...i(this, B),
3275
+ joinNode: ot.cloneWithOn(i(this, B).joinNode, ht(e, n, r))
3272
3276
  });
3273
3277
  }
3274
3278
  /**
@@ -3276,8 +3280,8 @@ const dt = class dt {
3276
3280
  */
3277
3281
  onTrue() {
3278
3282
  return new dt({
3279
- ...i(this, W),
3280
- joinNode: ot.cloneWithOn(i(this, W).joinNode, R.createWithSql("true"))
3283
+ ...i(this, B),
3284
+ joinNode: ot.cloneWithOn(i(this, B).joinNode, R.createWithSql("true"))
3281
3285
  });
3282
3286
  }
3283
3287
  /**
@@ -3288,12 +3292,12 @@ const dt = class dt {
3288
3292
  return e(this);
3289
3293
  }
3290
3294
  toOperationNode() {
3291
- return i(this, W).joinNode;
3295
+ return i(this, B).joinNode;
3292
3296
  }
3293
3297
  };
3294
- W = new WeakMap();
3295
- let xt = dt;
3296
- Ie(xt, "don't await JoinBuilder instances. They are never executed directly and are always just a part of a query.");
3298
+ B = new WeakMap();
3299
+ let St = dt;
3300
+ Ie(St, "don't await JoinBuilder instances. They are never executed directly and are always just a part of a query.");
3297
3301
  const Zi = s({
3298
3302
  is(t) {
3299
3303
  return t.kind === "PartitionByItemNode";
@@ -3378,7 +3382,7 @@ const st = s({
3378
3382
  createSelectAllFromTable(t) {
3379
3383
  return s({
3380
3384
  kind: "SelectionNode",
3381
- selection: jt.createSelectAll(t)
3385
+ selection: qt.createSelectAll(t)
3382
3386
  });
3383
3387
  }
3384
3388
  });
@@ -3393,7 +3397,7 @@ function ar(t) {
3393
3397
  }
3394
3398
  function In(t) {
3395
3399
  if (G(t))
3396
- return st.createSelectAllFromTable(B(t));
3400
+ return st.createSelectAllFromTable(W(t));
3397
3401
  throw new Error(`invalid value selectAll expression: ${JSON.stringify(t)}`);
3398
3402
  }
3399
3403
  const ts = s({
@@ -3438,7 +3442,7 @@ const ts = s({
3438
3442
  cloneWithFromItems(t, e) {
3439
3443
  return s({
3440
3444
  ...t,
3441
- from: t.from ? St.cloneWithFroms(t.from, e) : St.create(e)
3445
+ from: t.from ? Tt.cloneWithFroms(t.from, e) : Tt.create(e)
3442
3446
  });
3443
3447
  },
3444
3448
  cloneWithUpdates(t, e) {
@@ -3476,7 +3480,7 @@ const ts = s({
3476
3480
  create(t, e) {
3477
3481
  return s({
3478
3482
  kind: "DeleteQueryNode",
3479
- from: St.create(t),
3483
+ from: Tt.create(t),
3480
3484
  ...e && { with: e }
3481
3485
  });
3482
3486
  },
@@ -3619,7 +3623,7 @@ const ts = s({
3619
3623
  }
3620
3624
  }), M = s({
3621
3625
  is(t) {
3622
- return T.is(t) || ts.is(t) || ns.is(t) || rs.is(t) || os.is(t);
3626
+ return x.is(t) || ts.is(t) || ns.is(t) || rs.is(t) || os.is(t);
3623
3627
  },
3624
3628
  cloneWithWhere(t, e) {
3625
3629
  return s({
@@ -3791,16 +3795,16 @@ function ms() {
3791
3795
  function H() {
3792
3796
  return new hs();
3793
3797
  }
3794
- var je;
3798
+ var qe;
3795
3799
  class hs {
3796
3800
  constructor() {
3797
- C(this, je);
3801
+ C(this, qe);
3798
3802
  }
3799
3803
  get queryId() {
3800
- return i(this, je) === void 0 && O(this, je, _s(8)), i(this, je);
3804
+ return i(this, qe) === void 0 && O(this, qe, _s(8)), i(this, qe);
3801
3805
  }
3802
3806
  }
3803
- je = new WeakMap();
3807
+ qe = new WeakMap();
3804
3808
  var $t;
3805
3809
  class fs {
3806
3810
  constructor() {
@@ -4666,12 +4670,12 @@ class gs extends fs {
4666
4670
  O(this, Le, n);
4667
4671
  }
4668
4672
  transformNodeImpl(n) {
4669
- if (!y(this, I, or).call(this, n))
4673
+ if (!w(this, I, or).call(this, n))
4670
4674
  return super.transformNodeImpl(n);
4671
- const r = y(this, I, sr).call(this, n);
4675
+ const r = w(this, I, sr).call(this, n);
4672
4676
  for (const u of r)
4673
4677
  i(this, ve).add(u);
4674
- const a = y(this, I, ir).call(this, n);
4678
+ const a = w(this, I, ir).call(this, n);
4675
4679
  for (const u of a)
4676
4680
  i(this, Ne).add(u);
4677
4681
  const o = super.transformNodeImpl(n);
@@ -4692,7 +4696,7 @@ class gs extends fs {
4692
4696
  const r = super.transformReferences(n);
4693
4697
  return r.table.table.schema ? r : {
4694
4698
  ...r,
4695
- table: xe.createWithSchema(i(this, Le), r.table.table.identifier.name)
4699
+ table: Se.createWithSchema(i(this, Le), r.table.table.identifier.name)
4696
4700
  };
4697
4701
  }
4698
4702
  }
@@ -4700,19 +4704,19 @@ Le = new WeakMap(), Ne = new WeakMap(), ve = new WeakMap(), I = new WeakSet(), o
4700
4704
  return n.kind in ps;
4701
4705
  }, ir = function(n) {
4702
4706
  const r = /* @__PURE__ */ new Set();
4703
- if ("name" in n && n.name && Gt.is(n.name) && y(this, I, en).call(this, n.name, r), "from" in n && n.from)
4707
+ if ("name" in n && n.name && Gt.is(n.name) && w(this, I, en).call(this, n.name, r), "from" in n && n.from)
4704
4708
  for (const a of n.from.froms)
4705
- y(this, I, $e).call(this, a, r);
4706
- if ("into" in n && n.into && y(this, I, $e).call(this, n.into, r), "table" in n && n.table && y(this, I, $e).call(this, n.table, r), "joins" in n && n.joins)
4709
+ w(this, I, $e).call(this, a, r);
4710
+ if ("into" in n && n.into && w(this, I, $e).call(this, n.into, r), "table" in n && n.table && w(this, I, $e).call(this, n.table, r), "joins" in n && n.joins)
4707
4711
  for (const a of n.joins)
4708
- y(this, I, $e).call(this, a.table, r);
4709
- return "using" in n && n.using && y(this, I, $e).call(this, n.using, r), r;
4712
+ w(this, I, $e).call(this, a.table, r);
4713
+ return "using" in n && n.using && w(this, I, $e).call(this, n.using, r), r;
4710
4714
  }, sr = function(n) {
4711
4715
  const r = /* @__PURE__ */ new Set();
4712
- return "with" in n && n.with && y(this, I, ur).call(this, n.with, r), r;
4716
+ return "with" in n && n.with && w(this, I, ur).call(this, n.with, r), r;
4713
4717
  }, $e = function(n, r) {
4714
- const a = xe.is(n) ? n : fe.is(n) && xe.is(n.node) ? n.node : null;
4715
- a && y(this, I, en).call(this, a.table, r);
4718
+ const a = Se.is(n) ? n : fe.is(n) && Se.is(n.node) ? n.node : null;
4719
+ a && w(this, I, en).call(this, a.table, r);
4716
4720
  }, en = function(n, r) {
4717
4721
  const a = n.identifier.name;
4718
4722
  !i(this, Ne).has(a) && !i(this, ve).has(a) && r.add(a);
@@ -4789,7 +4793,7 @@ class Ns {
4789
4793
  }
4790
4794
  async executeQuery(e, n) {
4791
4795
  return await this.provideConnection(async (r) => {
4792
- const a = await r.executeQuery(e), o = await y(this, gt, tn).call(this, a, n);
4796
+ const a = await r.executeQuery(e), o = await w(this, gt, tn).call(this, a, n);
4793
4797
  return vs(a, o), o;
4794
4798
  });
4795
4799
  }
@@ -4799,7 +4803,7 @@ class Ns {
4799
4803
  const u = await a.promise;
4800
4804
  try {
4801
4805
  for await (const d of u.streamQuery(e, n))
4802
- yield await y(this, gt, tn).call(this, d, r);
4806
+ yield await w(this, gt, tn).call(this, d, r);
4803
4807
  } finally {
4804
4808
  o.resolve();
4805
4809
  }
@@ -4842,7 +4846,7 @@ class Fe extends Ns {
4842
4846
  }
4843
4847
  const cr = new Fe();
4844
4848
  function Cs(t, e) {
4845
- return new xt({
4849
+ return new St({
4846
4850
  joinNode: ot.create(t, It(e))
4847
4851
  });
4848
4852
  }
@@ -4853,7 +4857,7 @@ function bs() {
4853
4857
  }
4854
4858
  function Ae(t, e) {
4855
4859
  if (e.length === 3)
4856
- return Ts(t, e[0], e[1], e[2]);
4860
+ return xs(t, e[0], e[1], e[2]);
4857
4861
  if (e.length === 2)
4858
4862
  return Os(t, e[0], e[1]);
4859
4863
  throw new Error("not implemented");
@@ -4861,10 +4865,10 @@ function Ae(t, e) {
4861
4865
  function Os(t, e, n) {
4862
4866
  return n(Cs(t, e)).toOperationNode();
4863
4867
  }
4864
- function Ts(t, e, n, r) {
4868
+ function xs(t, e, n, r) {
4865
4869
  return ot.createWithOn(t, It(e), ht(n, "=", r));
4866
4870
  }
4867
- const Ss = s({
4871
+ const Ts = s({
4868
4872
  is(t) {
4869
4873
  return t.kind === "OffsetNode";
4870
4874
  },
@@ -4874,7 +4878,7 @@ const Ss = s({
4874
4878
  offset: t
4875
4879
  });
4876
4880
  }
4877
- }), xs = s({
4881
+ }), Ss = s({
4878
4882
  is(t) {
4879
4883
  return t.kind === "GroupByItemNode";
4880
4884
  },
@@ -4886,7 +4890,7 @@ const Ss = s({
4886
4890
  }
4887
4891
  });
4888
4892
  function ks(t) {
4889
- return t = Ee(t) ? t(Jt()) : t, _t(t).map(xs.create);
4893
+ return t = Ee(t) ? t(Jt()) : t, _t(t).map(Ss.create);
4890
4894
  }
4891
4895
  const Es = s({
4892
4896
  is(t) {
@@ -4948,27 +4952,27 @@ const Dt = class Dt {
4948
4952
  }
4949
4953
  };
4950
4954
  te = new WeakMap();
4951
- let x = Dt;
4952
- var We, ue;
4955
+ let S = Dt;
4956
+ var Be, ue;
4953
4957
  class gn {
4954
4958
  constructor(e, n) {
4955
- C(this, We);
4959
+ C(this, Be);
4956
4960
  C(this, ue);
4957
- O(this, We, e), O(this, ue, n);
4961
+ O(this, Be, e), O(this, ue, n);
4958
4962
  }
4959
4963
  /** @private */
4960
4964
  get expression() {
4961
- return i(this, We);
4965
+ return i(this, Be);
4962
4966
  }
4963
4967
  /** @private */
4964
4968
  get alias() {
4965
4969
  return i(this, ue);
4966
4970
  }
4967
4971
  toOperationNode() {
4968
- return fe.create(i(this, We).toOperationNode(), J(i(this, ue)) ? i(this, ue).toOperationNode() : z.create(i(this, ue)));
4972
+ return fe.create(i(this, Be).toOperationNode(), J(i(this, ue)) ? i(this, ue).toOperationNode() : z.create(i(this, ue)));
4969
4973
  }
4970
4974
  }
4971
- We = new WeakMap(), ue = new WeakMap();
4975
+ Be = new WeakMap(), ue = new WeakMap();
4972
4976
  var be;
4973
4977
  const Rt = class Rt {
4974
4978
  constructor(e) {
@@ -5077,85 +5081,85 @@ const N = class N {
5077
5081
  having(...e) {
5078
5082
  return new N({
5079
5083
  ...i(this, _),
5080
- queryNode: T.cloneWithHaving(i(this, _).queryNode, K(e))
5084
+ queryNode: x.cloneWithHaving(i(this, _).queryNode, K(e))
5081
5085
  });
5082
5086
  }
5083
5087
  havingRef(e, n, r) {
5084
5088
  return new N({
5085
5089
  ...i(this, _),
5086
- queryNode: T.cloneWithHaving(i(this, _).queryNode, ht(e, n, r))
5090
+ queryNode: x.cloneWithHaving(i(this, _).queryNode, ht(e, n, r))
5087
5091
  });
5088
5092
  }
5089
5093
  select(e) {
5090
5094
  return new N({
5091
5095
  ...i(this, _),
5092
- queryNode: T.cloneWithSelections(i(this, _).queryNode, rr(e))
5096
+ queryNode: x.cloneWithSelections(i(this, _).queryNode, rr(e))
5093
5097
  });
5094
5098
  }
5095
5099
  distinctOn(e) {
5096
5100
  return new N({
5097
5101
  ...i(this, _),
5098
- queryNode: T.cloneWithDistinctOn(i(this, _).queryNode, _t(e))
5102
+ queryNode: x.cloneWithDistinctOn(i(this, _).queryNode, _t(e))
5099
5103
  });
5100
5104
  }
5101
5105
  modifyFront(e) {
5102
5106
  return new N({
5103
5107
  ...i(this, _),
5104
- queryNode: T.cloneWithFrontModifier(i(this, _).queryNode, Y.createWithExpression(e.toOperationNode()))
5108
+ queryNode: x.cloneWithFrontModifier(i(this, _).queryNode, Y.createWithExpression(e.toOperationNode()))
5105
5109
  });
5106
5110
  }
5107
5111
  modifyEnd(e) {
5108
5112
  return new N({
5109
5113
  ...i(this, _),
5110
- queryNode: T.cloneWithEndModifier(i(this, _).queryNode, Y.createWithExpression(e.toOperationNode()))
5114
+ queryNode: x.cloneWithEndModifier(i(this, _).queryNode, Y.createWithExpression(e.toOperationNode()))
5111
5115
  });
5112
5116
  }
5113
5117
  distinct() {
5114
5118
  return new N({
5115
5119
  ...i(this, _),
5116
- queryNode: T.cloneWithFrontModifier(i(this, _).queryNode, Y.create("Distinct"))
5120
+ queryNode: x.cloneWithFrontModifier(i(this, _).queryNode, Y.create("Distinct"))
5117
5121
  });
5118
5122
  }
5119
5123
  forUpdate(e) {
5120
5124
  return new N({
5121
5125
  ...i(this, _),
5122
- queryNode: T.cloneWithEndModifier(i(this, _).queryNode, Y.create("ForUpdate", e ? vt(e).map(B) : void 0))
5126
+ queryNode: x.cloneWithEndModifier(i(this, _).queryNode, Y.create("ForUpdate", e ? vt(e).map(W) : void 0))
5123
5127
  });
5124
5128
  }
5125
5129
  forShare(e) {
5126
5130
  return new N({
5127
5131
  ...i(this, _),
5128
- queryNode: T.cloneWithEndModifier(i(this, _).queryNode, Y.create("ForShare", e ? vt(e).map(B) : void 0))
5132
+ queryNode: x.cloneWithEndModifier(i(this, _).queryNode, Y.create("ForShare", e ? vt(e).map(W) : void 0))
5129
5133
  });
5130
5134
  }
5131
5135
  forKeyShare(e) {
5132
5136
  return new N({
5133
5137
  ...i(this, _),
5134
- queryNode: T.cloneWithEndModifier(i(this, _).queryNode, Y.create("ForKeyShare", e ? vt(e).map(B) : void 0))
5138
+ queryNode: x.cloneWithEndModifier(i(this, _).queryNode, Y.create("ForKeyShare", e ? vt(e).map(W) : void 0))
5135
5139
  });
5136
5140
  }
5137
5141
  forNoKeyUpdate(e) {
5138
5142
  return new N({
5139
5143
  ...i(this, _),
5140
- queryNode: T.cloneWithEndModifier(i(this, _).queryNode, Y.create("ForNoKeyUpdate", e ? vt(e).map(B) : void 0))
5144
+ queryNode: x.cloneWithEndModifier(i(this, _).queryNode, Y.create("ForNoKeyUpdate", e ? vt(e).map(W) : void 0))
5141
5145
  });
5142
5146
  }
5143
5147
  skipLocked() {
5144
5148
  return new N({
5145
5149
  ...i(this, _),
5146
- queryNode: T.cloneWithEndModifier(i(this, _).queryNode, Y.create("SkipLocked"))
5150
+ queryNode: x.cloneWithEndModifier(i(this, _).queryNode, Y.create("SkipLocked"))
5147
5151
  });
5148
5152
  }
5149
5153
  noWait() {
5150
5154
  return new N({
5151
5155
  ...i(this, _),
5152
- queryNode: T.cloneWithEndModifier(i(this, _).queryNode, Y.create("NoWait"))
5156
+ queryNode: x.cloneWithEndModifier(i(this, _).queryNode, Y.create("NoWait"))
5153
5157
  });
5154
5158
  }
5155
5159
  selectAll(e) {
5156
5160
  return new N({
5157
5161
  ...i(this, _),
5158
- queryNode: T.cloneWithSelections(i(this, _).queryNode, ar(e))
5162
+ queryNode: x.cloneWithSelections(i(this, _).queryNode, ar(e))
5159
5163
  });
5160
5164
  }
5161
5165
  innerJoin(...e) {
@@ -5197,31 +5201,31 @@ const N = class N {
5197
5201
  orderBy(...e) {
5198
5202
  return new N({
5199
5203
  ...i(this, _),
5200
- queryNode: T.cloneWithOrderByItems(i(this, _).queryNode, Xn(e))
5204
+ queryNode: x.cloneWithOrderByItems(i(this, _).queryNode, Xn(e))
5201
5205
  });
5202
5206
  }
5203
5207
  groupBy(e) {
5204
5208
  return new N({
5205
5209
  ...i(this, _),
5206
- queryNode: T.cloneWithGroupByItems(i(this, _).queryNode, ks(e))
5210
+ queryNode: x.cloneWithGroupByItems(i(this, _).queryNode, ks(e))
5207
5211
  });
5208
5212
  }
5209
5213
  limit(e) {
5210
5214
  return new N({
5211
5215
  ...i(this, _),
5212
- queryNode: T.cloneWithLimit(i(this, _).queryNode, ls.create($(e)))
5216
+ queryNode: x.cloneWithLimit(i(this, _).queryNode, ls.create($(e)))
5213
5217
  });
5214
5218
  }
5215
5219
  offset(e) {
5216
5220
  return new N({
5217
5221
  ...i(this, _),
5218
- queryNode: T.cloneWithOffset(i(this, _).queryNode, Ss.create($(e)))
5222
+ queryNode: x.cloneWithOffset(i(this, _).queryNode, Ts.create($(e)))
5219
5223
  });
5220
5224
  }
5221
5225
  fetch(e, n = "only") {
5222
5226
  return new N({
5223
5227
  ...i(this, _),
5224
- queryNode: T.cloneWithFetch(i(this, _).queryNode, As(e, n))
5228
+ queryNode: x.cloneWithFetch(i(this, _).queryNode, As(e, n))
5225
5229
  });
5226
5230
  }
5227
5231
  top(e, n) {
@@ -5233,37 +5237,37 @@ const N = class N {
5233
5237
  union(e) {
5234
5238
  return new N({
5235
5239
  ...i(this, _),
5236
- queryNode: T.cloneWithSetOperations(i(this, _).queryNode, Pe("union", e, !1))
5240
+ queryNode: x.cloneWithSetOperations(i(this, _).queryNode, Pe("union", e, !1))
5237
5241
  });
5238
5242
  }
5239
5243
  unionAll(e) {
5240
5244
  return new N({
5241
5245
  ...i(this, _),
5242
- queryNode: T.cloneWithSetOperations(i(this, _).queryNode, Pe("union", e, !0))
5246
+ queryNode: x.cloneWithSetOperations(i(this, _).queryNode, Pe("union", e, !0))
5243
5247
  });
5244
5248
  }
5245
5249
  intersect(e) {
5246
5250
  return new N({
5247
5251
  ...i(this, _),
5248
- queryNode: T.cloneWithSetOperations(i(this, _).queryNode, Pe("intersect", e, !1))
5252
+ queryNode: x.cloneWithSetOperations(i(this, _).queryNode, Pe("intersect", e, !1))
5249
5253
  });
5250
5254
  }
5251
5255
  intersectAll(e) {
5252
5256
  return new N({
5253
5257
  ...i(this, _),
5254
- queryNode: T.cloneWithSetOperations(i(this, _).queryNode, Pe("intersect", e, !0))
5258
+ queryNode: x.cloneWithSetOperations(i(this, _).queryNode, Pe("intersect", e, !0))
5255
5259
  });
5256
5260
  }
5257
5261
  except(e) {
5258
5262
  return new N({
5259
5263
  ...i(this, _),
5260
- queryNode: T.cloneWithSetOperations(i(this, _).queryNode, Pe("except", e, !1))
5264
+ queryNode: x.cloneWithSetOperations(i(this, _).queryNode, Pe("except", e, !1))
5261
5265
  });
5262
5266
  }
5263
5267
  exceptAll(e) {
5264
5268
  return new N({
5265
5269
  ...i(this, _),
5266
- queryNode: T.cloneWithSetOperations(i(this, _).queryNode, Pe("except", e, !0))
5270
+ queryNode: x.cloneWithSetOperations(i(this, _).queryNode, Pe("except", e, !0))
5267
5271
  });
5268
5272
  }
5269
5273
  as(e) {
@@ -5272,7 +5276,7 @@ const N = class N {
5272
5276
  clearSelect() {
5273
5277
  return new N({
5274
5278
  ...i(this, _),
5275
- queryNode: T.cloneWithoutSelections(i(this, _).queryNode)
5279
+ queryNode: x.cloneWithoutSelections(i(this, _).queryNode)
5276
5280
  });
5277
5281
  }
5278
5282
  clearWhere() {
@@ -5284,25 +5288,25 @@ const N = class N {
5284
5288
  clearLimit() {
5285
5289
  return new N({
5286
5290
  ...i(this, _),
5287
- queryNode: T.cloneWithoutLimit(i(this, _).queryNode)
5291
+ queryNode: x.cloneWithoutLimit(i(this, _).queryNode)
5288
5292
  });
5289
5293
  }
5290
5294
  clearOffset() {
5291
5295
  return new N({
5292
5296
  ...i(this, _),
5293
- queryNode: T.cloneWithoutOffset(i(this, _).queryNode)
5297
+ queryNode: x.cloneWithoutOffset(i(this, _).queryNode)
5294
5298
  });
5295
5299
  }
5296
5300
  clearOrderBy() {
5297
5301
  return new N({
5298
5302
  ...i(this, _),
5299
- queryNode: T.cloneWithoutOrderBy(i(this, _).queryNode)
5303
+ queryNode: x.cloneWithoutOrderBy(i(this, _).queryNode)
5300
5304
  });
5301
5305
  }
5302
5306
  clearGroupBy() {
5303
5307
  return new N({
5304
5308
  ...i(this, _),
5305
- queryNode: T.cloneWithoutGroupBy(i(this, _).queryNode)
5309
+ queryNode: x.cloneWithoutGroupBy(i(this, _).queryNode)
5306
5310
  });
5307
5311
  }
5308
5312
  $call(e) {
@@ -5323,7 +5327,7 @@ const N = class N {
5323
5327
  return new N(i(this, _));
5324
5328
  }
5325
5329
  $asTuple() {
5326
- return new x(this.toOperationNode());
5330
+ return new S(this.toOperationNode());
5327
5331
  }
5328
5332
  withPlugin(e) {
5329
5333
  return new N({
@@ -5369,15 +5373,15 @@ Ie(Et, "don't await SelectQueryBuilder instances directly. To execute the query
5369
5373
  function $s(t) {
5370
5374
  return new Et(t);
5371
5375
  }
5372
- var Be, Ke;
5376
+ var We, Ke;
5373
5377
  class lr {
5374
5378
  constructor(e, n) {
5375
- C(this, Be);
5379
+ C(this, We);
5376
5380
  C(this, Ke);
5377
- O(this, Be, e), O(this, Ke, n);
5381
+ O(this, We, e), O(this, Ke, n);
5378
5382
  }
5379
5383
  get expression() {
5380
- return i(this, Be);
5384
+ return i(this, We);
5381
5385
  }
5382
5386
  get alias() {
5383
5387
  return i(this, Ke);
@@ -5386,10 +5390,10 @@ class lr {
5386
5390
  return !0;
5387
5391
  }
5388
5392
  toOperationNode() {
5389
- return fe.create(i(this, Be).toOperationNode(), z.create(i(this, Ke)));
5393
+ return fe.create(i(this, We).toOperationNode(), z.create(i(this, Ke)));
5390
5394
  }
5391
5395
  }
5392
- Be = new WeakMap(), Ke = new WeakMap();
5396
+ We = new WeakMap(), Ke = new WeakMap();
5393
5397
  Ie(lr, "don't await AliasedSelectQueryBuilder instances directly. AliasedSelectQueryBuilder should never be executed directly since it's always a part of another query.");
5394
5398
  const ye = s({
5395
5399
  is(t) {
@@ -5628,8 +5632,8 @@ const se = class se {
5628
5632
  }
5629
5633
  };
5630
5634
  A = new WeakMap();
5631
- let qe = se;
5632
- Ie(qe, "don't await AggregateFunctionBuilder instances. They are never executed directly and are always just a part of a query.");
5635
+ let je = se;
5636
+ Ie(je, "don't await AggregateFunctionBuilder instances. They are never executed directly and are always just a part of a query.");
5633
5637
  var Ue, Qe;
5634
5638
  class Ds {
5635
5639
  constructor(e, n) {
@@ -5651,7 +5655,7 @@ class Ds {
5651
5655
  }
5652
5656
  Ue = new WeakMap(), Qe = new WeakMap();
5653
5657
  function Rs() {
5654
- const t = (n, r) => new x(Fn.create(n, _t(r ?? []))), e = (n, r) => new qe({
5658
+ const t = (n, r) => new S(Fn.create(n, _t(r ?? []))), e = (n, r) => new je({
5655
5659
  aggregateFunctionNode: ye.create(n, r ? _t(r) : void 0)
5656
5660
  });
5657
5661
  return Object.assign(t, {
@@ -5666,7 +5670,7 @@ function Rs() {
5666
5670
  return e("count", [n]);
5667
5671
  },
5668
5672
  countAll(n) {
5669
- return new qe({
5673
+ return new je({
5670
5674
  aggregateFunctionNode: ye.create("count", ar(n))
5671
5675
  });
5672
5676
  },
@@ -5683,15 +5687,15 @@ function Rs() {
5683
5687
  return t("any", [n]);
5684
5688
  },
5685
5689
  jsonAgg(n) {
5686
- return new qe({
5690
+ return new je({
5687
5691
  aggregateFunctionNode: ye.create("json_agg", [
5688
- G(n) ? B(n) : n.toOperationNode()
5692
+ G(n) ? W(n) : n.toOperationNode()
5689
5693
  ])
5690
5694
  });
5691
5695
  },
5692
5696
  toJson(n) {
5693
- return new x(Fn.create("to_json", [
5694
- G(n) ? B(n) : n.toOperationNode()
5697
+ return new S(Fn.create("to_json", [
5698
+ G(n) ? W(n) : n.toOperationNode()
5695
5699
  ]));
5696
5700
  }
5697
5701
  });
@@ -5709,7 +5713,7 @@ const zs = s({
5709
5713
  }
5710
5714
  });
5711
5715
  function Fs(t, e) {
5712
- return zs.create(ke.create(t), q(e));
5716
+ return zs.create(ke.create(t), j(e));
5713
5717
  }
5714
5718
  const ne = s({
5715
5719
  is(t) {
@@ -5744,7 +5748,7 @@ const ne = s({
5744
5748
  }
5745
5749
  });
5746
5750
  var Ve;
5747
- class qs {
5751
+ class js {
5748
5752
  constructor(e) {
5749
5753
  C(this, Ve);
5750
5754
  O(this, Ve, s(e));
@@ -5764,7 +5768,7 @@ class _r {
5764
5768
  O(this, Ge, s(e));
5765
5769
  }
5766
5770
  then(e) {
5767
- return new js({
5771
+ return new qs({
5768
5772
  ...i(this, Ge),
5769
5773
  node: ne.cloneWithThen(i(this, Ge).node, hn(e) ? fn(e) : $(e))
5770
5774
  });
@@ -5772,7 +5776,7 @@ class _r {
5772
5776
  }
5773
5777
  Ge = new WeakMap();
5774
5778
  var Q;
5775
- class js {
5779
+ class qs {
5776
5780
  constructor(e) {
5777
5781
  C(this, Q);
5778
5782
  O(this, Q, s(e));
@@ -5792,10 +5796,10 @@ class js {
5792
5796
  });
5793
5797
  }
5794
5798
  end() {
5795
- return new x(ne.cloneWith(i(this, Q).node, { isStatement: !1 }));
5799
+ return new S(ne.cloneWith(i(this, Q).node, { isStatement: !1 }));
5796
5800
  }
5797
5801
  endCase() {
5798
- return new x(ne.cloneWith(i(this, Q).node, { isStatement: !0 }));
5802
+ return new S(ne.cloneWith(i(this, Q).node, { isStatement: !0 }));
5799
5803
  }
5800
5804
  }
5801
5805
  Q = new WeakMap();
@@ -5806,14 +5810,14 @@ class Ls {
5806
5810
  O(this, Ye, s(e));
5807
5811
  }
5808
5812
  end() {
5809
- return new x(ne.cloneWith(i(this, Ye).node, { isStatement: !1 }));
5813
+ return new S(ne.cloneWith(i(this, Ye).node, { isStatement: !1 }));
5810
5814
  }
5811
5815
  endCase() {
5812
- return new x(ne.cloneWith(i(this, Ye).node, { isStatement: !0 }));
5816
+ return new S(ne.cloneWith(i(this, Ye).node, { isStatement: !0 }));
5813
5817
  }
5814
5818
  }
5815
5819
  Ye = new WeakMap();
5816
- const qn = s({
5820
+ const jn = s({
5817
5821
  is(t) {
5818
5822
  return t.kind === "JSONPathLegNode";
5819
5823
  },
@@ -5897,7 +5901,7 @@ class ut {
5897
5901
  * ```
5898
5902
  */
5899
5903
  at(e) {
5900
- return y(this, yt, an).call(this, "ArrayLocation", e);
5904
+ return w(this, yt, an).call(this, "ArrayLocation", e);
5901
5905
  }
5902
5906
  /**
5903
5907
  * Access a property of a JSON object.
@@ -5949,18 +5953,18 @@ class ut {
5949
5953
  * ```
5950
5954
  */
5951
5955
  key(e) {
5952
- return y(this, yt, an).call(this, "Member", e);
5956
+ return w(this, yt, an).call(this, "Member", e);
5953
5957
  }
5954
5958
  }
5955
5959
  V = new WeakMap(), yt = new WeakSet(), an = function(e, n) {
5956
- return Tt.is(i(this, V)) ? new jn(Tt.cloneWithTraversal(i(this, V), it.is(i(this, V).traversal) ? it.cloneWithLeg(i(this, V).traversal, qn.create(e, n)) : er.cloneWithValue(i(this, V).traversal, he.createImmediate(n)))) : new jn(it.cloneWithLeg(i(this, V), qn.create(e, n)));
5960
+ return xt.is(i(this, V)) ? new qn(xt.cloneWithTraversal(i(this, V), it.is(i(this, V).traversal) ? it.cloneWithLeg(i(this, V).traversal, jn.create(e, n)) : er.cloneWithValue(i(this, V).traversal, he.createImmediate(n)))) : new qn(it.cloneWithLeg(i(this, V), jn.create(e, n)));
5957
5961
  };
5958
- var Te;
5959
- class jn extends ut {
5962
+ var xe;
5963
+ class qn extends ut {
5960
5964
  constructor(n) {
5961
5965
  super(n);
5962
- C(this, Te);
5963
- O(this, Te, n);
5966
+ C(this, xe);
5967
+ O(this, xe, n);
5964
5968
  }
5965
5969
  /** @private */
5966
5970
  get expressionType() {
@@ -5975,16 +5979,16 @@ class jn extends ut {
5975
5979
  * returns a copy of this `JSONPathBuilder` with a new output type.
5976
5980
  */
5977
5981
  $castTo() {
5978
- return new ut(i(this, Te));
5982
+ return new ut(i(this, xe));
5979
5983
  }
5980
5984
  $notNull() {
5981
- return new ut(i(this, Te));
5985
+ return new ut(i(this, xe));
5982
5986
  }
5983
5987
  toOperationNode() {
5984
- return i(this, Te);
5988
+ return i(this, xe);
5985
5989
  }
5986
5990
  }
5987
- Te = new WeakMap();
5991
+ xe = new WeakMap();
5988
5992
  var He, de;
5989
5993
  class Js {
5990
5994
  constructor(e, n) {
@@ -6047,7 +6051,7 @@ const Ln = s({
6047
6051
  "jsonb",
6048
6052
  "blob",
6049
6053
  "varbinary"
6050
- ], Ws = [
6054
+ ], Bs = [
6051
6055
  /^varchar\(\d+\)$/,
6052
6056
  /^char\(\d+\)$/,
6053
6057
  /^decimal\(\d+, \d+\)$/,
@@ -6059,7 +6063,7 @@ const Ln = s({
6059
6063
  /^timestamp\(\d+\)$/,
6060
6064
  /^timestamptz\(\d+\)$/,
6061
6065
  /^varbinary\(\d+\)$/
6062
- ], Bs = s({
6066
+ ], Ws = s({
6063
6067
  is(t) {
6064
6068
  return t.kind === "DataTypeNode";
6065
6069
  },
@@ -6071,13 +6075,13 @@ const Ln = s({
6071
6075
  }
6072
6076
  });
6073
6077
  function Ks(t) {
6074
- return !!(Ms.includes(t) || Ws.some((e) => e.test(t)));
6078
+ return !!(Ms.includes(t) || Bs.some((e) => e.test(t)));
6075
6079
  }
6076
6080
  function Us(t) {
6077
6081
  if (J(t))
6078
6082
  return t.toOperationNode();
6079
6083
  if (Ks(t))
6080
- return Bs.create(t);
6084
+ return Ws.create(t);
6081
6085
  throw new Error(`invalid column data type ${JSON.stringify(t)}`);
6082
6086
  }
6083
6087
  const Qs = s({
@@ -6094,10 +6098,10 @@ const Qs = s({
6094
6098
  });
6095
6099
  function yn(t = cr) {
6096
6100
  function e(a, o, u) {
6097
- return new x(pn(a, o, u));
6101
+ return new S(pn(a, o, u));
6098
6102
  }
6099
6103
  function n(a, o) {
6100
- return new x(Fs(a, o));
6104
+ return new S(Fs(a, o));
6101
6105
  }
6102
6106
  const r = Object.assign(e, {
6103
6107
  fn: void 0,
@@ -6106,34 +6110,34 @@ function yn(t = cr) {
6106
6110
  return $s({
6107
6111
  queryId: H(),
6108
6112
  executor: t,
6109
- queryNode: T.createFrom(Vs(a))
6113
+ queryNode: x.createFrom(Vs(a))
6110
6114
  });
6111
6115
  },
6112
6116
  case(a) {
6113
- return new qs({
6114
- node: ne.create(Ot(a) ? void 0 : q(a))
6117
+ return new js({
6118
+ node: ne.create(Ot(a) ? void 0 : j(a))
6115
6119
  });
6116
6120
  },
6117
6121
  ref(a, o) {
6118
- return Ot(o) ? new x(me(a)) : new ut(Bi(a, o));
6122
+ return Ot(o) ? new S(me(a)) : new ut(Wi(a, o));
6119
6123
  },
6120
6124
  jsonPath() {
6121
6125
  return new ut(it.create());
6122
6126
  },
6123
6127
  table(a) {
6124
- return new x(B(a));
6128
+ return new S(W(a));
6125
6129
  },
6126
6130
  val(a) {
6127
- return new x($(a));
6131
+ return new S($(a));
6128
6132
  },
6129
6133
  refTuple(...a) {
6130
- return new x(Ln.create(a.map(q)));
6134
+ return new S(Ln.create(a.map(j)));
6131
6135
  },
6132
6136
  tuple(...a) {
6133
- return new x(Ln.create(a.map($)));
6137
+ return new S(Ln.create(a.map($)));
6134
6138
  },
6135
6139
  lit(a) {
6136
- return new x(fn(a));
6140
+ return new S(fn(a));
6137
6141
  },
6138
6142
  unary: n,
6139
6143
  not(a) {
@@ -6146,23 +6150,23 @@ function yn(t = cr) {
6146
6150
  return n("-", a);
6147
6151
  },
6148
6152
  between(a, o, u) {
6149
- return new x(Xe.create(q(a), ke.create("between"), _e.create($(o), $(u))));
6153
+ return new S(Xe.create(j(a), ke.create("between"), _e.create($(o), $(u))));
6150
6154
  },
6151
6155
  betweenSymmetric(a, o, u) {
6152
- return new x(Xe.create(q(a), ke.create("between symmetric"), _e.create($(o), $(u))));
6156
+ return new S(Xe.create(j(a), ke.create("between symmetric"), _e.create($(o), $(u))));
6153
6157
  },
6154
6158
  and(a) {
6155
- return le(a) ? new x(Ht(a, "and")) : new x(On(a, "and"));
6159
+ return le(a) ? new S(Ht(a, "and")) : new S(On(a, "and"));
6156
6160
  },
6157
6161
  or(a) {
6158
- return le(a) ? new x(Ht(a, "or")) : new x(On(a, "or"));
6162
+ return le(a) ? new S(Ht(a, "or")) : new S(On(a, "or"));
6159
6163
  },
6160
6164
  parens(...a) {
6161
6165
  const o = K(a);
6162
- return mt.is(o) ? new x(o) : new x(mt.create(o));
6166
+ return mt.is(o) ? new S(o) : new S(mt.create(o));
6163
6167
  },
6164
6168
  cast(a, o) {
6165
- return new x(Qs.create(q(a), Us(o)));
6169
+ return new S(Qs.create(j(a), Us(o)));
6166
6170
  },
6167
6171
  withSchema(a) {
6168
6172
  return yn(t.withPluginAtFront(new dr(a)));
@@ -6187,7 +6191,7 @@ function mr(t) {
6187
6191
  return t(Jt()).toOperationNode();
6188
6192
  throw new Error(`invalid aliased expression: ${JSON.stringify(t)}`);
6189
6193
  }
6190
- function Wt(t) {
6194
+ function Bt(t) {
6191
6195
  return $i(t) || Di(t) || Ee(t);
6192
6196
  }
6193
6197
  function Vs(t) {
@@ -6200,25 +6204,25 @@ function Gs(t) {
6200
6204
  const e = " as ";
6201
6205
  if (t.includes(e)) {
6202
6206
  const [n, r] = t.split(e).map(hr);
6203
- return fe.create(B(n), z.create(r));
6207
+ return fe.create(W(n), z.create(r));
6204
6208
  } else
6205
- return B(t);
6209
+ return W(t);
6206
6210
  }
6207
- function B(t) {
6211
+ function W(t) {
6208
6212
  const e = ".";
6209
6213
  if (t.includes(e)) {
6210
6214
  const [n, r] = t.split(e).map(hr);
6211
- return xe.createWithSchema(n, r);
6215
+ return Se.createWithSchema(n, r);
6212
6216
  } else
6213
- return xe.create(t);
6217
+ return Se.create(t);
6214
6218
  }
6215
6219
  function hr(t) {
6216
6220
  return t.trim();
6217
6221
  }
6218
- var P, j, Ct, on, sn;
6222
+ var P, q, Ct, on, sn;
6219
6223
  const ct = class ct {
6220
6224
  constructor(e) {
6221
- C(this, j);
6225
+ C(this, q);
6222
6226
  C(this, P);
6223
6227
  O(this, P, s(e));
6224
6228
  }
@@ -6243,50 +6247,50 @@ const ct = class ct {
6243
6247
  });
6244
6248
  }
6245
6249
  toOperationNode() {
6246
- return y(this, j, on).call(this, y(this, j, Ct).call(this));
6250
+ return w(this, q, on).call(this, w(this, q, Ct).call(this));
6247
6251
  }
6248
6252
  compile(e) {
6249
- return y(this, j, sn).call(this, y(this, j, Ct).call(this, e));
6253
+ return w(this, q, sn).call(this, w(this, q, Ct).call(this, e));
6250
6254
  }
6251
6255
  async execute(e) {
6252
- const n = y(this, j, Ct).call(this, e);
6253
- return n.executeQuery(y(this, j, sn).call(this, n), i(this, P).queryId);
6256
+ const n = w(this, q, Ct).call(this, e);
6257
+ return n.executeQuery(w(this, q, sn).call(this, n), i(this, P).queryId);
6254
6258
  }
6255
6259
  };
6256
- P = new WeakMap(), j = new WeakSet(), Ct = function(e) {
6260
+ P = new WeakMap(), q = new WeakSet(), Ct = function(e) {
6257
6261
  const n = e !== void 0 ? e.getExecutor() : cr;
6258
6262
  return i(this, P).plugins !== void 0 ? n.withPlugins(i(this, P).plugins) : n;
6259
6263
  }, on = function(e) {
6260
6264
  return e.transformQuery(i(this, P).rawNode, i(this, P).queryId);
6261
6265
  }, sn = function(e) {
6262
- return e.compileQuery(y(this, j, on).call(this, e), i(this, P).queryId);
6266
+ return e.compileQuery(w(this, q, on).call(this, e), i(this, P).queryId);
6263
6267
  };
6264
6268
  let At = ct;
6265
6269
  function ie(t) {
6266
6270
  return new At(t);
6267
6271
  }
6268
6272
  Ie(At, "don't await RawBuilder instances directly. To execute the query you need to call `execute`");
6269
- var Se, ce;
6273
+ var Te, ce;
6270
6274
  class fr {
6271
6275
  constructor(e, n) {
6272
- C(this, Se);
6276
+ C(this, Te);
6273
6277
  C(this, ce);
6274
- O(this, Se, e), O(this, ce, n);
6278
+ O(this, Te, e), O(this, ce, n);
6275
6279
  }
6276
6280
  get expression() {
6277
- return i(this, Se);
6281
+ return i(this, Te);
6278
6282
  }
6279
6283
  get alias() {
6280
6284
  return i(this, ce);
6281
6285
  }
6282
6286
  get rawBuilder() {
6283
- return i(this, Se);
6287
+ return i(this, Te);
6284
6288
  }
6285
6289
  toOperationNode() {
6286
- return fe.create(i(this, Se).toOperationNode(), J(i(this, ce)) ? i(this, ce).toOperationNode() : z.create(i(this, ce)));
6290
+ return fe.create(i(this, Te).toOperationNode(), J(i(this, ce)) ? i(this, ce).toOperationNode() : z.create(i(this, ce)));
6287
6291
  }
6288
6292
  }
6289
- Se = new WeakMap(), ce = new WeakMap();
6293
+ Te = new WeakMap(), ce = new WeakMap();
6290
6294
  Ie(fr, "don't await AliasedRawBuilder instances directly. AliasedRawBuilder should never be executed directly since it's always a part of another query.");
6291
6295
  const g = Object.assign((t, ...e) => ie({
6292
6296
  queryId: H(),
@@ -6310,7 +6314,7 @@ const g = Object.assign((t, ...e) => ie({
6310
6314
  table(t) {
6311
6315
  return ie({
6312
6316
  queryId: H(),
6313
- rawNode: R.createWithChild(B(t))
6317
+ rawNode: R.createWithChild(W(t))
6314
6318
  });
6315
6319
  },
6316
6320
  id(...t) {
@@ -6357,7 +6361,7 @@ class Ys {
6357
6361
  }
6358
6362
  }
6359
6363
  const Hs = "kysely_migration", Mn = "kysely_migration_lock", Xs = !1, Qt = "migration_lock", Zs = s({ __noMigrations__: !0 });
6360
- var k, m, rt, X, Z, De, gr, ee, yr, wr, Nr, vr, Cr, un, Re, dn, br, Or, Tr, cn, Sr, xr, kr, Er, Ir, at;
6364
+ var k, m, rt, X, Z, De, gr, ee, yr, wr, Nr, vr, Cr, un, Re, dn, br, Or, xr, cn, Tr, Sr, kr, Er, Ir, at;
6361
6365
  class pr {
6362
6366
  constructor(e) {
6363
6367
  C(this, m);
@@ -6370,8 +6374,8 @@ class pr {
6370
6374
  * The returned array is sorted by migration name.
6371
6375
  */
6372
6376
  async getMigrations() {
6373
- 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"]).execute() : [];
6374
- return (await y(this, m, cn).call(this)).map(({ name: r, ...a }) => {
6377
+ const e = await w(this, m, Re).call(this, i(this, m, Z)) ? await i(this, k).db.withPlugin(i(this, m, ee)).selectFrom(i(this, m, Z)).select(["name", "timestamp"]).execute() : [];
6378
+ return (await w(this, m, cn).call(this)).map(({ name: r, ...a }) => {
6375
6379
  const o = e.find((u) => u.name === r);
6376
6380
  return {
6377
6381
  name: r,
@@ -6428,7 +6432,7 @@ class pr {
6428
6432
  * ```
6429
6433
  */
6430
6434
  async migrateToLatest() {
6431
- return y(this, m, rt).call(this, () => ({ direction: "Up", step: 1 / 0 }));
6435
+ return w(this, m, rt).call(this, () => ({ direction: "Up", step: 1 / 0 }));
6432
6436
  }
6433
6437
  /**
6434
6438
  * Migrate up/down to a specific migration.
@@ -6454,7 +6458,7 @@ class pr {
6454
6458
  * ```
6455
6459
  */
6456
6460
  async migrateTo(e) {
6457
- return y(this, m, rt).call(this, ({ migrations: n, executedMigrations: r, pendingMigrations: a }) => {
6461
+ return w(this, m, rt).call(this, ({ migrations: n, executedMigrations: r, pendingMigrations: a }) => {
6458
6462
  if (e === Zs)
6459
6463
  return { direction: "Down", step: 1 / 0 };
6460
6464
  if (!n.find((d) => d.name === e))
@@ -6485,7 +6489,7 @@ class pr {
6485
6489
  * ```
6486
6490
  */
6487
6491
  async migrateUp() {
6488
- return y(this, m, rt).call(this, () => ({ direction: "Up", step: 1 }));
6492
+ return w(this, m, rt).call(this, () => ({ direction: "Up", step: 1 }));
6489
6493
  }
6490
6494
  /**
6491
6495
  * Migrate one step down.
@@ -6502,12 +6506,12 @@ class pr {
6502
6506
  * ```
6503
6507
  */
6504
6508
  async migrateDown() {
6505
- return y(this, m, rt).call(this, () => ({ direction: "Down", step: 1 }));
6509
+ return w(this, m, rt).call(this, () => ({ direction: "Down", step: 1 }));
6506
6510
  }
6507
6511
  }
6508
6512
  k = new WeakMap(), m = new WeakSet(), rt = async function(e) {
6509
6513
  try {
6510
- return await y(this, m, yr).call(this), await y(this, m, br).call(this, e);
6514
+ return await w(this, m, yr).call(this), await w(this, m, br).call(this, e);
6511
6515
  } catch (n) {
6512
6516
  return n instanceof Vt ? n.resultSet : { error: n };
6513
6517
  }
@@ -6522,37 +6526,37 @@ k = new WeakMap(), m = new WeakSet(), rt = async function(e) {
6522
6526
  }, ee = function() {
6523
6527
  return i(this, m, X) ? new dr(i(this, m, X)) : new Ys();
6524
6528
  }, yr = async function() {
6525
- await y(this, m, wr).call(this), await y(this, m, Nr).call(this), await y(this, m, vr).call(this), await y(this, m, Cr).call(this);
6529
+ await w(this, m, wr).call(this), await w(this, m, Nr).call(this), await w(this, m, vr).call(this), await w(this, m, Cr).call(this);
6526
6530
  }, wr = async function() {
6527
- if (i(this, m, X) && !await y(this, m, un).call(this))
6531
+ if (i(this, m, X) && !await w(this, m, un).call(this))
6528
6532
  try {
6529
- await y(this, m, at).call(this, i(this, k).db.schema.createSchema(i(this, m, X)));
6533
+ await w(this, m, at).call(this, i(this, k).db.schema.createSchema(i(this, m, X)));
6530
6534
  } catch (e) {
6531
- if (!await y(this, m, un).call(this))
6535
+ if (!await w(this, m, un).call(this))
6532
6536
  throw e;
6533
6537
  }
6534
6538
  }, Nr = async function() {
6535
- if (!await y(this, m, Re).call(this, i(this, m, Z)))
6539
+ if (!await w(this, m, Re).call(this, i(this, m, Z)))
6536
6540
  try {
6537
- i(this, m, X) && await y(this, m, at).call(this, i(this, k).db.schema.createSchema(i(this, m, X))), await y(this, m, at).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()));
6541
+ i(this, m, X) && await w(this, m, at).call(this, i(this, k).db.schema.createSchema(i(this, m, X))), await w(this, m, at).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()));
6538
6542
  } catch (e) {
6539
- if (!await y(this, m, Re).call(this, i(this, m, Z)))
6543
+ if (!await w(this, m, Re).call(this, i(this, m, Z)))
6540
6544
  throw e;
6541
6545
  }
6542
6546
  }, vr = async function() {
6543
- if (!await y(this, m, Re).call(this, i(this, m, De)))
6547
+ if (!await w(this, m, Re).call(this, i(this, m, De)))
6544
6548
  try {
6545
- await y(this, m, at).call(this, i(this, k).db.schema.withPlugin(i(this, m, ee)).createTable(i(this, m, De)).addColumn("id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("is_locked", "integer", (e) => e.notNull().defaultTo(0)));
6549
+ await w(this, m, at).call(this, i(this, k).db.schema.withPlugin(i(this, m, ee)).createTable(i(this, m, De)).addColumn("id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("is_locked", "integer", (e) => e.notNull().defaultTo(0)));
6546
6550
  } catch (e) {
6547
- if (!await y(this, m, Re).call(this, i(this, m, De)))
6551
+ if (!await w(this, m, Re).call(this, i(this, m, De)))
6548
6552
  throw e;
6549
6553
  }
6550
6554
  }, Cr = async function() {
6551
- if (!await y(this, m, dn).call(this))
6555
+ if (!await w(this, m, dn).call(this))
6552
6556
  try {
6553
6557
  await i(this, k).db.withPlugin(i(this, m, ee)).insertInto(i(this, m, De)).values({ id: Qt, is_locked: 0 }).execute();
6554
6558
  } catch (e) {
6555
- if (!await y(this, m, dn).call(this))
6559
+ if (!await w(this, m, dn).call(this))
6556
6560
  throw e;
6557
6561
  }
6558
6562
  }, un = async function() {
@@ -6572,27 +6576,27 @@ k = new WeakMap(), m = new WeakSet(), rt = async function(e) {
6572
6576
  }), a = async (o) => {
6573
6577
  try {
6574
6578
  await n.acquireMigrationLock(o, r);
6575
- const u = await y(this, m, Or).call(this, o);
6579
+ const u = await w(this, m, Or).call(this, o);
6576
6580
  if (u.migrations.length === 0)
6577
6581
  return { results: [] };
6578
6582
  const { direction: d, step: c } = e(u);
6579
- return c <= 0 ? { results: [] } : d === "Down" ? await y(this, m, Er).call(this, o, u, c) : d === "Up" ? await y(this, m, Ir).call(this, o, u, c) : { results: [] };
6583
+ return c <= 0 ? { results: [] } : d === "Down" ? await w(this, m, Er).call(this, o, u, c) : d === "Up" ? await w(this, m, Ir).call(this, o, u, c) : { results: [] };
6580
6584
  } finally {
6581
6585
  await n.releaseMigrationLock(o, r);
6582
6586
  }
6583
6587
  };
6584
6588
  return n.supportsTransactionalDdl ? i(this, k).db.transaction().execute(a) : i(this, k).db.connection().execute(a);
6585
6589
  }, Or = async function(e) {
6586
- const n = await y(this, m, cn).call(this), r = await y(this, m, Sr).call(this, e);
6587
- y(this, m, xr).call(this, n, r), i(this, m, gr) || y(this, m, kr).call(this, n, r);
6588
- const a = y(this, m, Tr).call(this, n, r);
6590
+ const n = await w(this, m, cn).call(this), r = await w(this, m, Tr).call(this, e);
6591
+ w(this, m, Sr).call(this, n, r), i(this, m, gr) || w(this, m, kr).call(this, n, r);
6592
+ const a = w(this, m, xr).call(this, n, r);
6589
6593
  return s({
6590
6594
  migrations: n,
6591
6595
  executedMigrations: r,
6592
6596
  lastMigration: Pi(r),
6593
6597
  pendingMigrations: a
6594
6598
  });
6595
- }, Tr = function(e, n) {
6599
+ }, xr = function(e, n) {
6596
6600
  return e.filter((r) => !n.includes(r.name));
6597
6601
  }, cn = async function() {
6598
6602
  const e = await i(this, k).provider.getMigrations();
@@ -6600,9 +6604,9 @@ k = new WeakMap(), m = new WeakSet(), rt = async function(e) {
6600
6604
  ...e[n],
6601
6605
  name: n
6602
6606
  }));
6603
- }, Sr = async function(e) {
6607
+ }, Tr = async function(e) {
6604
6608
  return (await e.withPlugin(i(this, m, ee)).selectFrom(i(this, m, Z)).select("name").orderBy(["timestamp", "name"]).execute()).map((r) => r.name);
6605
- }, xr = function(e, n) {
6609
+ }, Sr = function(e, n) {
6606
6610
  for (const r of n)
6607
6611
  if (!e.some((a) => a.name === r))
6608
6612
  throw new Error(`corrupted migrations: previously executed migration ${r} is missing`);
@@ -6888,22 +6892,22 @@ async function Ou(t) {
6888
6892
  (e) => e.notNull()
6889
6893
  ).execute();
6890
6894
  }
6891
- async function Tu(t) {
6895
+ async function xu(t) {
6892
6896
  await t.schema.alterTable("passwords").dropColumn("password").execute();
6893
6897
  }
6894
- const Su = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6898
+ const Tu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6895
6899
  __proto__: null,
6896
- down: Tu,
6900
+ down: xu,
6897
6901
  up: Ou
6898
6902
  }, Symbol.toStringTag, { value: "Module" }));
6899
- async function xu(t) {
6903
+ async function Su(t) {
6900
6904
  }
6901
6905
  async function ku(t) {
6902
6906
  }
6903
6907
  const Eu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6904
6908
  __proto__: null,
6905
6909
  down: ku,
6906
- up: xu
6910
+ up: Su
6907
6911
  }, Symbol.toStringTag, { value: "Module" }));
6908
6912
  async function Iu(t) {
6909
6913
  }
@@ -6929,12 +6933,12 @@ async function zu(t) {
6929
6933
  async function Fu(t) {
6930
6934
  await t.schema.dropIndex("users_email_index").execute();
6931
6935
  }
6932
- const qu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6936
+ const ju = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6933
6937
  __proto__: null,
6934
6938
  down: Fu,
6935
6939
  up: zu
6936
6940
  }, Symbol.toStringTag, { value: "Module" }));
6937
- async function ju(t) {
6941
+ async function qu(t) {
6938
6942
  await t.schema.alterTable("users").addColumn("profileData", "varchar(2048)").execute();
6939
6943
  }
6940
6944
  async function Lu(t) {
@@ -6943,17 +6947,17 @@ async function Lu(t) {
6943
6947
  const Ju = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6944
6948
  __proto__: null,
6945
6949
  down: Lu,
6946
- up: ju
6950
+ up: qu
6947
6951
  }, Symbol.toStringTag, { value: "Module" }));
6948
6952
  async function Mu(t) {
6949
6953
  await t.schema.createIndex("users_linked_to_index").on("users").column("linked_to").execute();
6950
6954
  }
6951
- async function Wu(t) {
6955
+ async function Bu(t) {
6952
6956
  await t.schema.dropIndex("users_linked_to_index");
6953
6957
  }
6954
- const Bu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6958
+ const Wu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6955
6959
  __proto__: null,
6956
- down: Wu,
6960
+ down: Bu,
6957
6961
  up: Mu
6958
6962
  }, Symbol.toStringTag, { value: "Module" }));
6959
6963
  async function Ku(t) {
@@ -7086,15 +7090,15 @@ const bd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7086
7090
  async function Od(t) {
7087
7091
  await t.schema.createIndex("users_name_index").on("users").column("name").execute();
7088
7092
  }
7089
- async function Td(t) {
7093
+ async function xd(t) {
7090
7094
  await t.schema.dropIndex("users_name_index").execute();
7091
7095
  }
7092
- const Sd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7096
+ const Td = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7093
7097
  __proto__: null,
7094
- down: Td,
7098
+ down: xd,
7095
7099
  up: Od
7096
7100
  }, Symbol.toStringTag, { value: "Module" }));
7097
- async function xd(t) {
7101
+ async function Sd(t) {
7098
7102
  }
7099
7103
  async function kd(t) {
7100
7104
  await t.schema.alterTable("users").dropConstraint("unique_email_provider").execute();
@@ -7102,7 +7106,7 @@ async function kd(t) {
7102
7106
  const Ed = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7103
7107
  __proto__: null,
7104
7108
  down: kd,
7105
- up: xd
7109
+ up: Sd
7106
7110
  }, Symbol.toStringTag, { value: "Module" }));
7107
7111
  async function Id(t) {
7108
7112
  await t.schema.alterTable("otps").dropColumn("state").execute(), await t.schema.alterTable("otps").addColumn("state", "varchar(8192)").execute();
@@ -7136,27 +7140,27 @@ async function zd(t) {
7136
7140
  async function Fd(t) {
7137
7141
  await t.schema.dropTable("branding").execute();
7138
7142
  }
7139
- const qd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7143
+ const jd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7140
7144
  __proto__: null,
7141
7145
  down: Fd,
7142
7146
  up: zd
7143
7147
  }, Symbol.toStringTag, { value: "Module" }));
7144
- async function jd(t) {
7148
+ async function qd(t) {
7145
7149
  }
7146
7150
  async function Ld(t) {
7147
7151
  }
7148
7152
  const Jd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7149
7153
  __proto__: null,
7150
7154
  down: Ld,
7151
- up: jd
7155
+ up: qd
7152
7156
  }, Symbol.toStringTag, { value: "Module" }));
7153
7157
  async function Md(t) {
7154
7158
  }
7155
- async function Wd(t) {
7159
+ async function Bd(t) {
7156
7160
  }
7157
- const Bd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7161
+ const Wd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7158
7162
  __proto__: null,
7159
- down: Wd,
7163
+ down: Bd,
7160
7164
  up: Md
7161
7165
  }, Symbol.toStringTag, { value: "Module" }));
7162
7166
  async function Kd(t) {
@@ -7306,14 +7310,14 @@ const bc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7306
7310
  }, Symbol.toStringTag, { value: "Module" }));
7307
7311
  async function Oc(t) {
7308
7312
  }
7309
- async function Tc(t) {
7313
+ async function xc(t) {
7310
7314
  }
7311
- const Sc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7315
+ const Tc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7312
7316
  __proto__: null,
7313
- down: Tc,
7317
+ down: xc,
7314
7318
  up: Oc
7315
7319
  }, Symbol.toStringTag, { value: "Module" }));
7316
- async function xc(t) {
7320
+ async function Sc(t) {
7317
7321
  await t.schema.alterTable("logins").addColumn("auth0Client", "varchar(256)").execute();
7318
7322
  }
7319
7323
  async function kc(t) {
@@ -7322,7 +7326,7 @@ async function kc(t) {
7322
7326
  const Ec = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7323
7327
  __proto__: null,
7324
7328
  down: kc,
7325
- up: xc
7329
+ up: Sc
7326
7330
  }, Symbol.toStringTag, { value: "Module" }));
7327
7331
  async function Ic(t) {
7328
7332
  await t.schema.alterTable("logins").dropColumn("authParams_state").execute(), await t.schema.alterTable("logins").addColumn("authParams_state", "varchar(8192)").execute();
@@ -7348,12 +7352,12 @@ async function zc(t) {
7348
7352
  }
7349
7353
  async function Fc(t) {
7350
7354
  }
7351
- const qc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7355
+ const jc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7352
7356
  __proto__: null,
7353
7357
  down: Fc,
7354
7358
  up: zc
7355
7359
  }, Symbol.toStringTag, { value: "Module" }));
7356
- async function jc(t) {
7360
+ async function qc(t) {
7357
7361
  await t.schema.alterTable("logins").addColumn("authParams_nonce", "varchar(255)").execute();
7358
7362
  }
7359
7363
  async function Lc(t) {
@@ -7362,15 +7366,15 @@ async function Lc(t) {
7362
7366
  const Jc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7363
7367
  __proto__: null,
7364
7368
  down: Lc,
7365
- up: jc
7369
+ up: qc
7366
7370
  }, Symbol.toStringTag, { value: "Module" }));
7367
7371
  async function Mc(t) {
7368
7372
  }
7369
- async function Wc(t) {
7373
+ async function Bc(t) {
7370
7374
  }
7371
- const Bc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7375
+ const Wc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7372
7376
  __proto__: null,
7373
- down: Wc,
7377
+ down: Bc,
7374
7378
  up: Mc
7375
7379
  }, Symbol.toStringTag, { value: "Module" }));
7376
7380
  async function Kc(t) {
@@ -7541,14 +7545,14 @@ const bl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7541
7545
  }, Symbol.toStringTag, { value: "Module" }));
7542
7546
  async function Ol(t) {
7543
7547
  }
7544
- async function Tl(t) {
7548
+ async function xl(t) {
7545
7549
  }
7546
- const Sl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7550
+ const Tl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7547
7551
  __proto__: null,
7548
- down: Tl,
7552
+ down: xl,
7549
7553
  up: Ol
7550
7554
  }, Symbol.toStringTag, { value: "Module" }));
7551
- async function xl(t) {
7555
+ async function Sl(t) {
7552
7556
  await t.schema.alterTable("logins").addColumn("authParams_act_as", "varchar(255)").execute();
7553
7557
  }
7554
7558
  async function kl(t) {
@@ -7557,7 +7561,7 @@ async function kl(t) {
7557
7561
  const El = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7558
7562
  __proto__: null,
7559
7563
  down: kl,
7560
- up: xl
7564
+ up: Sl
7561
7565
  }, Symbol.toStringTag, { value: "Module" }));
7562
7566
  async function Il(t) {
7563
7567
  await t.schema.alterTable("codes").addColumn("code_verifier", "varchar(128)").execute();
@@ -7603,12 +7607,12 @@ async function Fl(t) {
7603
7607
  (e) => e.references("applications.id").onDelete("cascade").notNull()
7604
7608
  ).addColumn("email", "varchar(255)", (e) => e.notNull()).addColumn("nonce", "varchar(255)").addColumn("state", "varchar(1024)").addColumn("scope", "varchar(1024)").addColumn("response_type", "varchar(256)").addColumn("response_mode", "varchar(256)").addColumn("redirect_uri", "varchar(1024)").addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("expires_at", "varchar(255)", (e) => e.notNull()).addColumn("used_at", "varchar(255)").execute();
7605
7609
  }
7606
- const ql = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7610
+ const jl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7607
7611
  __proto__: null,
7608
7612
  down: Fl,
7609
7613
  up: zl
7610
7614
  }, Symbol.toStringTag, { value: "Module" }));
7611
- async function jl(t) {
7615
+ async function ql(t) {
7612
7616
  }
7613
7617
  async function Ll(t) {
7614
7618
  await t.schema.alterTable("logins").dropColumn("ip").dropColumn("useragent").execute();
@@ -7616,7 +7620,7 @@ async function Ll(t) {
7616
7620
  const Jl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7617
7621
  __proto__: null,
7618
7622
  down: Ll,
7619
- up: jl
7623
+ up: ql
7620
7624
  }, Symbol.toStringTag, { value: "Module" }));
7621
7625
  async function Ml(t) {
7622
7626
  await t.schema.createTable("refresh_tokens").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn(
@@ -7631,12 +7635,12 @@ async function Ml(t) {
7631
7635
  (e) => e.onDelete("cascade")
7632
7636
  ).addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("expires_at", "varchar(35)").addColumn("idle_expires_at", "varchar(35)").addColumn("last_exchanged_at", "varchar(35)").addColumn("device", "varchar(2048)", (e) => e.notNull()).addColumn("resource_servers", "varchar(2048)", (e) => e.notNull()).addColumn("rotating", "boolean", (e) => e.notNull()).execute();
7633
7637
  }
7634
- async function Wl(t) {
7638
+ async function Bl(t) {
7635
7639
  await t.schema.dropTable("refresh_tokens").execute();
7636
7640
  }
7637
- const Bl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7641
+ const Wl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7638
7642
  __proto__: null,
7639
- down: Wl,
7643
+ down: Bl,
7640
7644
  up: Ml
7641
7645
  }, Symbol.toStringTag, { value: "Module" }));
7642
7646
  async function Kl(t) {
@@ -7831,15 +7835,15 @@ const b_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7831
7835
  async function O_(t) {
7832
7836
  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();
7833
7837
  }
7834
- async function T_(t) {
7838
+ async function x_(t) {
7835
7839
  await t.schema.dropTable("forms").execute();
7836
7840
  }
7837
- const S_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7841
+ const T_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7838
7842
  __proto__: null,
7839
- down: T_,
7843
+ down: x_,
7840
7844
  up: O_
7841
7845
  }, Symbol.toStringTag, { value: "Module" }));
7842
- async function x_(t) {
7846
+ async function S_(t) {
7843
7847
  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();
7844
7848
  }
7845
7849
  async function k_(t) {
@@ -7848,7 +7852,7 @@ async function k_(t) {
7848
7852
  const E_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7849
7853
  __proto__: null,
7850
7854
  down: k_,
7851
- up: x_
7855
+ up: S_
7852
7856
  }, Symbol.toStringTag, { value: "Module" }));
7853
7857
  async function I_(t) {
7854
7858
  await t.schema.alterTable("login_sessions").addColumn(
@@ -7886,12 +7890,12 @@ async function z_(t) {
7886
7890
  async function F_(t) {
7887
7891
  await t.schema.dropIndex("IDX_sessions_login_session_id").on("sessions").execute();
7888
7892
  }
7889
- const q_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7893
+ const j_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7890
7894
  __proto__: null,
7891
7895
  down: F_,
7892
7896
  up: z_
7893
7897
  }, Symbol.toStringTag, { value: "Module" }));
7894
- async function j_(t) {
7898
+ async function q_(t) {
7895
7899
  await t.schema.alterTable("codes").addColumn("code_challenge", "varchar(128)").execute(), await t.schema.alterTable("codes").addColumn("code_challenge_method", "varchar(5)").execute();
7896
7900
  }
7897
7901
  async function L_(t) {
@@ -7900,17 +7904,17 @@ async function L_(t) {
7900
7904
  const J_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7901
7905
  __proto__: null,
7902
7906
  down: L_,
7903
- up: j_
7907
+ up: q_
7904
7908
  }, Symbol.toStringTag, { value: "Module" }));
7905
7909
  async function M_(t) {
7906
7910
  await t.schema.alterTable("codes").addColumn("redirect_uri", "varchar(1024)").execute();
7907
7911
  }
7908
- async function W_(t) {
7912
+ async function B_(t) {
7909
7913
  await t.schema.alterTable("codes").dropColumn("redirect_uri").execute();
7910
7914
  }
7911
- const B_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7915
+ const W_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7912
7916
  __proto__: null,
7913
- down: W_,
7917
+ down: B_,
7914
7918
  up: M_
7915
7919
  }, Symbol.toStringTag, { value: "Module" }));
7916
7920
  async function K_(t) {
@@ -8353,9 +8357,9 @@ async function bm(t) {
8353
8357
  });
8354
8358
  }
8355
8359
  async function Om(t) {
8356
- await Pr(t) === "mysql" ? await Tm(t) : await Sm(t);
8360
+ await Pr(t) === "mysql" ? await xm(t) : await Tm(t);
8357
8361
  }
8358
- async function Tm(t) {
8362
+ async function xm(t) {
8359
8363
  await t.transaction().execute(async (e) => {
8360
8364
  await g`ALTER TABLE refresh_tokens DROP FOREIGN KEY refresh_tokens_client_fk`.execute(
8361
8365
  e
@@ -8372,7 +8376,7 @@ async function Tm(t) {
8372
8376
  );
8373
8377
  });
8374
8378
  }
8375
- async function Sm(t) {
8379
+ async function Tm(t) {
8376
8380
  await t.transaction().execute(async (e) => {
8377
8381
  await g`CREATE TABLE refresh_tokens_temp AS SELECT * FROM refresh_tokens`.execute(
8378
8382
  e
@@ -8402,7 +8406,7 @@ async function Sm(t) {
8402
8406
  FROM login_sessions_temp`.execute(e), await g`DROP TABLE login_sessions_temp`.execute(e);
8403
8407
  });
8404
8408
  }
8405
- const xm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8409
+ const Sm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8406
8410
  __proto__: null,
8407
8411
  down: Om,
8408
8412
  up: vm
@@ -8446,6 +8450,50 @@ const $m = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8446
8450
  __proto__: null,
8447
8451
  down: Pm,
8448
8452
  up: Am
8453
+ }, Symbol.toStringTag, { value: "Module" }));
8454
+ async function Dm(t) {
8455
+ await t.schema.createIndex("users_phone_tenant_provider_index").on("users").columns(["tenant_id", "phone_number", "provider"]).execute();
8456
+ }
8457
+ async function Rm(t) {
8458
+ await t.schema.dropIndex("users_phone_tenant_provider_index").execute();
8459
+ }
8460
+ const zm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8461
+ __proto__: null,
8462
+ down: Rm,
8463
+ up: Dm
8464
+ }, Symbol.toStringTag, { value: "Module" }));
8465
+ async function Fm(t) {
8466
+ await t.schema.createIndex("login_sessions_id_index").on("login_sessions").column("id").execute();
8467
+ }
8468
+ async function jm(t) {
8469
+ await t.schema.dropIndex("login_sessions_id_index").execute();
8470
+ }
8471
+ const qm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8472
+ __proto__: null,
8473
+ down: jm,
8474
+ up: Fm
8475
+ }, Symbol.toStringTag, { value: "Module" }));
8476
+ async function Lm(t) {
8477
+ await t.schema.createIndex("connections_tenant_id_index").on("connections").column("tenant_id").execute();
8478
+ }
8479
+ async function Jm(t) {
8480
+ await t.schema.dropIndex("connections_tenant_id_index").execute();
8481
+ }
8482
+ const Mm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8483
+ __proto__: null,
8484
+ down: Jm,
8485
+ up: Lm
8486
+ }, Symbol.toStringTag, { value: "Module" }));
8487
+ async function Bm(t) {
8488
+ await t.schema.dropIndex("idx_user_organizations_tenant_id").execute();
8489
+ }
8490
+ async function Wm(t) {
8491
+ await t.schema.createIndex("idx_user_organizations_tenant_id").on("user_organizations").column("tenant_id").execute();
8492
+ }
8493
+ const Km = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8494
+ __proto__: null,
8495
+ down: Wm,
8496
+ up: Bm
8449
8497
  }, Symbol.toStringTag, { value: "Module" })), $r = {
8450
8498
  m1_init: nu,
8451
8499
  m2_magicLink: ou,
@@ -8455,13 +8503,13 @@ const $m = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8455
8503
  m6_sessions: gu,
8456
8504
  m7_passwords: Nu,
8457
8505
  m8_logsTableNewFields: bu,
8458
- m9_passwordTableNewField: Su,
8506
+ m9_passwordTableNewField: Tu,
8459
8507
  n01_codesTable: Eu,
8460
8508
  n11_universalLoginSession: Pu,
8461
8509
  n12_userFields: Ru,
8462
- n13_userEmailIndex: qu,
8510
+ n13_userEmailIndex: ju,
8463
8511
  n14_profileDataField: Ju,
8464
- n15_userEmailIndex: Bu,
8512
+ n15_userEmailIndex: Wu,
8465
8513
  n16_userLocale: Qu,
8466
8514
  n17_signingKeys: Yu,
8467
8515
  n18_logsFields: Zu,
@@ -8473,13 +8521,13 @@ const $m = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8473
8521
  n24_logsIndexes: gd,
8474
8522
  n25_logDescMaxLength: Nd,
8475
8523
  n26_logsTableExtraFields: bd,
8476
- n27_usersTableNameIndex: Sd,
8524
+ n27_usersTableNameIndex: Td,
8477
8525
  n28_usersEmailConstrain: Ed,
8478
8526
  n29_increaseOtpStateLength: Pd,
8479
8527
  n30_increaseTicketStateLength: Rd,
8480
- n31_branding: qd,
8528
+ n31_branding: jd,
8481
8529
  n32_indexesAndNotNull: Jd,
8482
- n33_vendorIdInUniversalLoginSession: Bd,
8530
+ n33_vendorIdInUniversalLoginSession: Wd,
8483
8531
  n34_auth0ClientInUniversalLoginSession: Qd,
8484
8532
  n35_increaseUniversalSessionStateLength: Yd,
8485
8533
  n36_authenticationCodes: Zd,
@@ -8491,13 +8539,13 @@ const $m = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8491
8539
  n42_userIdIndexes: gc,
8492
8540
  n43_userIdIndexes: Nc,
8493
8541
  n44_codes: bc,
8494
- n45_hookProperties: Sc,
8542
+ n45_hookProperties: Tc,
8495
8543
  n46_loginAuth0Client: Ec,
8496
8544
  n47_loginAuth0Client: Pc,
8497
8545
  n48_saml: Rc,
8498
- n49_removeFields: qc,
8546
+ n49_removeFields: jc,
8499
8547
  n50_authParamsNonce: Jc,
8500
- n51_connectionid: Bc,
8548
+ n51_connectionid: Wc,
8501
8549
  n52_cert: Qc,
8502
8550
  n53_codes_primary_key: Yc,
8503
8551
  n54_cleanup_tables: Zc,
@@ -8509,13 +8557,13 @@ const $m = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8509
8557
  n60_users_metadata: gl,
8510
8558
  n61_userLocales: Nl,
8511
8559
  n62_prompt: bl,
8512
- n63_connection_cleanup: Sl,
8560
+ n63_connection_cleanup: Tl,
8513
8561
  n64_act_as: El,
8514
8562
  n65_code_verifier: Pl,
8515
8563
  n66_email_providers: Rl,
8516
- n67_drop_tickets: ql,
8564
+ n67_drop_tickets: jl,
8517
8565
  n68_login_useragents: Jl,
8518
- n70_refresh_tokens: Bl,
8566
+ n70_refresh_tokens: Wl,
8519
8567
  n71_session_new_fields: Ql,
8520
8568
  n72_session_primary_key: Yl,
8521
8569
  n73_drop_sessions: Zl,
@@ -8527,13 +8575,13 @@ const $m = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8527
8575
  n79_drop_sessions_2: g_,
8528
8576
  n80_recreate_custom_domains: N_,
8529
8577
  n81_phone: b_,
8530
- n82_forms: S_,
8578
+ n82_forms: T_,
8531
8579
  n83_addFormsIdToHooks: E_,
8532
8580
  n84_login_completed: P_,
8533
8581
  n85_add_login_session_id_to_sessions: R_,
8534
- n86_index_sessions_login_session_id: q_,
8582
+ n86_index_sessions_login_session_id: j_,
8535
8583
  n87_code_challenge: J_,
8536
- n88_add_redirect_uri_to_codes: B_,
8584
+ n88_add_redirect_uri_to_codes: W_,
8537
8585
  n89_add_nonce_and_state_to_codes: Q_,
8538
8586
  n90_themes: Y_,
8539
8587
  n91_resource_servers_rules_permissions: Z_,
@@ -8544,11 +8592,15 @@ const $m = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8544
8592
  n96_create_user_organizations_table: hm,
8545
8593
  n97_add_organization_to_user_permissions_and_roles: gm,
8546
8594
  n98_clients: Nm,
8547
- n99_update_client_foreign_keys: xm,
8595
+ n99_update_client_foreign_keys: Sm,
8548
8596
  o001_client_grants: Im,
8549
- o002_drop_applications: $m
8597
+ o002_drop_applications: $m,
8598
+ o003_phone_number_index: zm,
8599
+ o004_login_sessions_id_index: qm,
8600
+ o005_connections_tenant_index: Mm,
8601
+ o006_remove_redundant_user_organizations_tenant_index: Km
8550
8602
  };
8551
- async function qm(t, e = !1) {
8603
+ async function Ym(t, e = !1) {
8552
8604
  e && console.log("migrating...");
8553
8605
  const n = new Ar($r), r = new pr({
8554
8606
  db: t,
@@ -8561,7 +8613,7 @@ async function qm(t, e = !1) {
8561
8613
  }), a)
8562
8614
  throw console.error("failed to migrate"), console.error(a), a;
8563
8615
  }
8564
- async function jm(t) {
8616
+ async function Hm(t) {
8565
8617
  console.log("migrating...");
8566
8618
  const e = new Ar($r), n = new pr({
8567
8619
  db: t,
@@ -8572,7 +8624,7 @@ async function jm(t) {
8572
8624
  }), r)
8573
8625
  throw console.error("failed to migrate"), console.error(r), r;
8574
8626
  }
8575
- function Lm(t) {
8627
+ function Xm(t) {
8576
8628
  return {
8577
8629
  branding: co(t),
8578
8630
  cleanup: Lo(t),
@@ -8586,11 +8638,11 @@ function Lm(t) {
8586
8638
  forms: Uo(t),
8587
8639
  hooks: po(t),
8588
8640
  keys: Za(t),
8589
- loginSessions: So(t),
8641
+ loginSessions: To(t),
8590
8642
  logs: ua(t),
8591
8643
  passwords: ya(t),
8592
8644
  promptSettings: Eo(t),
8593
- refreshTokens: jo(t),
8645
+ refreshTokens: qo(t),
8594
8646
  resourceServers: Xo(t),
8595
8647
  rolePermissions: ui(t),
8596
8648
  userPermissions: mi(t),
@@ -8605,7 +8657,7 @@ function Lm(t) {
8605
8657
  };
8606
8658
  }
8607
8659
  export {
8608
- Lm as default,
8609
- jm as migrateDown,
8610
- qm as migrateToLatest
8660
+ Xm as default,
8661
+ Hm as migrateDown,
8662
+ Ym as migrateToLatest
8611
8663
  };