@authhero/kysely-adapter 10.48.0 → 10.50.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.
@@ -27,9 +27,9 @@ function Jr(t) {
27
27
  return async (e, n) => {
28
28
  const { identities: r, ...a } = n, o = {
29
29
  ...a,
30
+ login_count: a.login_count ?? 0,
30
31
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
31
32
  updated_at: (/* @__PURE__ */ new Date()).toISOString(),
32
- login_count: 0,
33
33
  tenant_id: e,
34
34
  email_verified: n.email_verified ? 1 : 0,
35
35
  is_social: n.is_social ? 1 : 0,
@@ -96,7 +96,7 @@ function Mr(t) {
96
96
  ]);
97
97
  if (!r)
98
98
  return null;
99
- const { tenant_id: o, ...u } = r, d = {
99
+ const { tenant_id: o, ...u } = r, c = {
100
100
  ...u,
101
101
  email: r.email || "",
102
102
  email_verified: r.email_verified === 1,
@@ -113,51 +113,51 @@ function Mr(t) {
113
113
  ...a.map(Bn)
114
114
  ]
115
115
  };
116
- return T(d);
116
+ return T(c);
117
117
  };
118
118
  }
119
119
  function L(t, e, n, r) {
120
120
  const a = [];
121
121
  let o = "", u = !1;
122
- for (let c = 0; c < n.length; c++) {
123
- const h = n[c];
122
+ for (let d = 0; d < n.length; d++) {
123
+ const h = n[d];
124
124
  h === '"' ? (u = !u, o += h) : h === " " && !u ? o.trim() && (a.push(o.trim()), o = "") : o += h;
125
125
  }
126
- return o.trim() && a.push(o.trim()), a.map((c) => c.replace(/^([^:]+)=/g, "$1:")).map((c) => {
127
- let h = c.startsWith("-"), p = null, l = "", y = !1, f;
128
- if (c.startsWith("-_exists_:"))
129
- p = c.substring(10), y = !0, h = !0;
130
- else if (c.startsWith("_exists_:"))
131
- p = c.substring(9), y = !0, h = !1;
132
- else if (c.includes(":")) {
133
- const v = h ? c.substring(1) : c, b = v.indexOf(":");
126
+ return o.trim() && a.push(o.trim()), a.map((d) => d.replace(/^([^:]+)=/g, "$1:")).map((d) => {
127
+ let h = d.startsWith("-"), p = null, l = "", y = !1, f;
128
+ if (d.startsWith("-_exists_:"))
129
+ p = d.substring(10), y = !0, h = !0;
130
+ else if (d.startsWith("_exists_:"))
131
+ p = d.substring(9), y = !0, h = !1;
132
+ else if (d.includes(":")) {
133
+ const v = h ? d.substring(1) : d, b = v.indexOf(":");
134
134
  p = v.substring(0, b), l = v.substring(b + 1), y = !1, l.startsWith(">=") ? (f = ">=", l = l.substring(2)) : l.startsWith(">") ? (f = ">", l = l.substring(1)) : l.startsWith("<=") ? (f = "<=", l = l.substring(2)) : l.startsWith("<") ? (f = "<", l = l.substring(1)) : f = "=", l.startsWith('"') && l.endsWith('"') && l.length > 1 && (l = l.slice(1, -1));
135
135
  } else
136
- p = null, l = c, y = !1;
136
+ p = null, l = d, y = !1;
137
137
  return { key: p, value: l, isNegation: h, isExistsQuery: y, operator: f };
138
- }).forEach(({ key: c, value: h, isNegation: p, isExistsQuery: l, operator: y }) => {
139
- if (c)
138
+ }).forEach(({ key: d, value: h, isNegation: p, isExistsQuery: l, operator: y }) => {
139
+ if (d)
140
140
  if (l)
141
- p ? e = e.where(c, "is", null) : e = e.where(c, "is not", null);
141
+ p ? e = e.where(d, "is", null) : e = e.where(d, "is not", null);
142
142
  else if (p)
143
143
  switch (y) {
144
144
  case ">":
145
- e = e.where(c, "<=", h);
145
+ e = e.where(d, "<=", h);
146
146
  break;
147
147
  case ">=":
148
- e = e.where(c, "<", h);
148
+ e = e.where(d, "<", h);
149
149
  break;
150
150
  case "<":
151
- e = e.where(c, ">=", h);
151
+ e = e.where(d, ">=", h);
152
152
  break;
153
153
  case "<=":
154
- e = e.where(c, ">", h);
154
+ e = e.where(d, ">", h);
155
155
  break;
156
156
  default:
157
- e = e.where(c, "!=", h);
157
+ e = e.where(d, "!=", h);
158
158
  }
159
159
  else
160
- e = e.where(c, y, h);
160
+ e = e.where(d, y, h);
161
161
  else if (h) {
162
162
  const { ref: f } = t.dynamic;
163
163
  e = e.where(
@@ -173,13 +173,13 @@ function F(t) {
173
173
  }
174
174
  function Br(t) {
175
175
  return async (e, n = {}) => {
176
- const { page: r = 0, per_page: a = 50, include_totals: o = !1, sort: u, q: d } = n;
177
- let c = t.selectFrom("users").where("users.tenant_id", "=", e);
178
- if (d && (c = L(t, c, d, ["email", "name", "phone_number"])), u && u.sort_by) {
176
+ const { page: r = 0, per_page: a = 50, include_totals: o = !1, sort: u, q: c } = n;
177
+ let d = t.selectFrom("users").where("users.tenant_id", "=", e);
178
+ if (c && (d = L(t, d, c, ["email", "name", "phone_number"])), u && u.sort_by) {
179
179
  const { ref: b } = t.dynamic;
180
- c = c.orderBy(b(u.sort_by), u.sort_order);
180
+ d = d.orderBy(b(u.sort_by), u.sort_order);
181
181
  }
182
- const p = await c.offset(r * a).limit(a).selectAll().execute(), l = p.map((b) => b.user_id), y = l.length ? await t.selectFrom("users").selectAll().where("users.tenant_id", "=", e).where("users.linked_to", "in", l).execute() : [], f = p.map((b) => {
182
+ const p = await d.offset(r * a).limit(a).selectAll().execute(), l = p.map((b) => b.user_id), y = l.length ? await t.selectFrom("users").selectAll().where("users.tenant_id", "=", e).where("users.linked_to", "in", l).execute() : [], f = p.map((b) => {
183
183
  const E = y.filter(
184
184
  (D) => D.linked_to === b.user_id
185
185
  );
@@ -207,7 +207,7 @@ function Br(t) {
207
207
  limit: 0,
208
208
  length: 0
209
209
  };
210
- const { count: v } = await c.select((b) => b.fn.countAll().as("count")).executeTakeFirstOrThrow();
210
+ const { count: v } = await d.select((b) => b.fn.countAll().as("count")).executeTakeFirstOrThrow();
211
211
  return {
212
212
  users: f,
213
213
  start: r * a,
@@ -279,9 +279,9 @@ let Gr = (t) => crypto.getRandomValues(new Uint8Array(t)), Yr = (t, e, n) => {
279
279
  return (o = e) => {
280
280
  let u = "";
281
281
  for (; ; ) {
282
- let d = n(a), c = a;
283
- for (; c--; )
284
- if (u += t[d[c] & r] || "", u.length === o) return u;
282
+ let c = n(a), d = a;
283
+ for (; d--; )
284
+ if (u += t[c[d] & r] || "", u.length === o) return u;
285
285
  }
286
286
  };
287
287
  }, Hr = (t, e = 21) => Yr(t, e, Gr), re = (t = 21) => {
@@ -310,12 +310,12 @@ function Zr(t) {
310
310
  function ea(t) {
311
311
  return async (e) => {
312
312
  let n = t.selectFrom("tenants");
313
- const { page: r = 0, per_page: a = 50, include_totals: o = !1, sort: u, q: d } = e;
313
+ const { page: r = 0, per_page: a = 50, include_totals: o = !1, sort: u, q: c } = e;
314
314
  if (u && u.sort_by) {
315
315
  const { ref: f } = t.dynamic;
316
316
  n = n.orderBy(f(u.sort_by), u.sort_order);
317
317
  }
318
- d && (n = n.where((f) => f.or([f("name", "like", `%${d}%`)])));
318
+ c && (n = n.where((f) => f.or([f("name", "like", `%${c}%`)])));
319
319
  const p = (await n.offset(r * a).limit(a).selectAll().execute()).map(T);
320
320
  if (!o)
321
321
  return {
@@ -400,10 +400,10 @@ function Kn(t) {
400
400
  }
401
401
  function ia(t) {
402
402
  return async (e, n = {}) => {
403
- const { page: r = 0, per_page: a = 50, include_totals: o = !1, sort: u, q: d } = n;
404
- let c = t.selectFrom("logs").where("logs.tenant_id", "=", e);
405
- d && (c = L(t, c, d, ["user_id", "ip"]));
406
- let h = c;
403
+ const { page: r = 0, per_page: a = 50, include_totals: o = !1, sort: u, q: c } = n;
404
+ let d = t.selectFrom("logs").where("logs.tenant_id", "=", e);
405
+ c && (d = L(t, d, c, ["user_id", "ip"]));
406
+ let h = d;
407
407
  if (u && u.sort_by) {
408
408
  const { ref: f } = t.dynamic;
409
409
  h = h.orderBy(f(u.sort_by), u.sort_order);
@@ -417,7 +417,7 @@ function ia(t) {
417
417
  limit: 0,
418
418
  length: 0
419
419
  };
420
- const { count: y } = await c.select((f) => f.fn.countAll().as("count")).executeTakeFirstOrThrow();
420
+ const { count: y } = await d.select((f) => f.fn.countAll().as("count")).executeTakeFirstOrThrow();
421
421
  return {
422
422
  logs: l,
423
423
  start: r * a,
@@ -439,20 +439,20 @@ function ua(t) {
439
439
  get: sa(t)
440
440
  };
441
441
  }
442
- function da(t) {
442
+ function ca(t) {
443
443
  return async (e, n) => {
444
444
  const r = await t.selectFrom("sessions").where("sessions.tenant_id", "=", e).where("sessions.id", "=", n).selectAll().executeTakeFirst();
445
445
  if (!r)
446
446
  return null;
447
- const { tenant_id: a, device: o, clients: u, ...d } = r;
447
+ const { tenant_id: a, device: o, clients: u, ...c } = r;
448
448
  return {
449
- ...d,
449
+ ...c,
450
450
  device: JSON.parse(o),
451
451
  clients: JSON.parse(u)
452
452
  };
453
453
  };
454
454
  }
455
- function ca(t) {
455
+ function da(t) {
456
456
  return async (e, n) => {
457
457
  const r = {
458
458
  ...n,
@@ -485,10 +485,10 @@ function _a(t) {
485
485
  }
486
486
  function ma(t) {
487
487
  return async (e, n = {}) => {
488
- const { page: r = 0, per_page: a = 50, include_totals: o = !1, sort: u, q: d } = n;
489
- let c = t.selectFrom("sessions").where("sessions.tenant_id", "=", e);
490
- d && (c = L(t, c, d, ["user_id", "session_id"]));
491
- let h = c;
488
+ const { page: r = 0, per_page: a = 50, include_totals: o = !1, sort: u, q: c } = n;
489
+ let d = t.selectFrom("sessions").where("sessions.tenant_id", "=", e);
490
+ c && (d = L(t, d, c, ["user_id", "session_id"]));
491
+ let h = d;
492
492
  if (u && u.sort_by) {
493
493
  const { ref: v } = t.dynamic;
494
494
  h = h.orderBy(v(u.sort_by), u.sort_order);
@@ -506,7 +506,7 @@ function ma(t) {
506
506
  limit: 0,
507
507
  length: 0
508
508
  };
509
- const { count: y } = await c.select((v) => v.fn.countAll().as("count")).executeTakeFirstOrThrow(), f = F(y);
509
+ const { count: y } = await d.select((v) => v.fn.countAll().as("count")).executeTakeFirstOrThrow(), f = F(y);
510
510
  return {
511
511
  sessions: l,
512
512
  start: r * a,
@@ -517,8 +517,8 @@ function ma(t) {
517
517
  }
518
518
  function ha(t) {
519
519
  return {
520
- create: ca(t),
521
- get: da(t),
520
+ create: da(t),
521
+ get: ca(t),
522
522
  list: ma(t),
523
523
  remove: la(t),
524
524
  update: _a(t)
@@ -562,9 +562,9 @@ function ya(t) {
562
562
  function wa(t) {
563
563
  return async (e, n = {}) => {
564
564
  const { page: r = 0, per_page: a = 50, include_totals: o = !1, q: u } = n;
565
- let d = t.selectFrom("codes").where("codes.tenant_id", "=", e);
566
- u && (d = L(t, d, u, ["code", "login_id"]));
567
- const p = (await d.offset(r * a).limit(a).selectAll().execute()).map((y) => {
565
+ let c = t.selectFrom("codes").where("codes.tenant_id", "=", e);
566
+ u && (c = L(t, c, u, ["code", "login_id"]));
567
+ const p = (await c.offset(r * a).limit(a).selectAll().execute()).map((y) => {
568
568
  const { tenant_id: f, ...v } = y;
569
569
  return zr.parse(T(v));
570
570
  });
@@ -575,7 +575,7 @@ function wa(t) {
575
575
  limit: 0,
576
576
  length: 0
577
577
  };
578
- const { count: l } = await d.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
578
+ const { count: l } = await c.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
579
579
  return {
580
580
  codes: p,
581
581
  start: r * a,
@@ -663,9 +663,9 @@ function Aa(t) {
663
663
  function Pa(t) {
664
664
  return async (e, n = {}) => {
665
665
  const { page: r = 0, per_page: a = 50, include_totals: o = !1, q: u } = n;
666
- let d = t.selectFrom("connections").where("connections.tenant_id", "=", e);
667
- u && (d = L(t, d, u, ["user_id", "ip"]));
668
- const p = (await d.offset(r * a).limit(a).selectAll().execute()).map(
666
+ let c = t.selectFrom("connections").where("connections.tenant_id", "=", e);
667
+ u && (c = L(t, c, u, ["user_id", "ip"]));
668
+ const p = (await c.offset(r * a).limit(a).selectAll().execute()).map(
669
669
  (y) => T({
670
670
  ...y,
671
671
  options: JSON.parse(y.options)
@@ -678,7 +678,7 @@ function Pa(t) {
678
678
  limit: 0,
679
679
  length: 0
680
680
  };
681
- const { count: l } = await d.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
681
+ const { count: l } = await c.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
682
682
  return {
683
683
  connections: p,
684
684
  start: r * a,
@@ -901,27 +901,27 @@ function Ma(t) {
901
901
  }
902
902
  function Ba(t) {
903
903
  return async (e, n) => {
904
- const r = (/* @__PURE__ */ new Date()).toISOString(), a = re(), { scope: o, authorization_details_types: u, ...d } = n, c = {
904
+ const r = (/* @__PURE__ */ new Date()).toISOString(), a = re(), { scope: o, authorization_details_types: u, ...c } = n, d = {
905
905
  id: a,
906
906
  tenant_id: e,
907
- ...d,
907
+ ...c,
908
908
  scope: o ? JSON.stringify(o) : "[]",
909
909
  authorization_details_types: u ? JSON.stringify(u) : "[]",
910
910
  // Convert booleans to integers for database storage
911
- allow_any_organization: d.allow_any_organization !== void 0 ? d.allow_any_organization ? 1 : 0 : void 0,
912
- is_system: d.is_system !== void 0 ? d.is_system ? 1 : 0 : void 0,
911
+ allow_any_organization: c.allow_any_organization !== void 0 ? c.allow_any_organization ? 1 : 0 : void 0,
912
+ is_system: c.is_system !== void 0 ? c.is_system ? 1 : 0 : void 0,
913
913
  created_at: r,
914
914
  updated_at: r
915
915
  };
916
- return await t.insertInto("client_grants").values(c).execute(), T({
916
+ return await t.insertInto("client_grants").values(d).execute(), T({
917
917
  id: a,
918
918
  tenant_id: e,
919
- ...d,
919
+ ...c,
920
920
  scope: o || [],
921
921
  authorization_details_types: u || [],
922
922
  // Ensure boolean fields have proper defaults
923
- allow_any_organization: d.allow_any_organization ?? !1,
924
- is_system: d.is_system ?? !1,
923
+ allow_any_organization: c.allow_any_organization ?? !1,
924
+ is_system: c.is_system ?? !1,
925
925
  created_at: r,
926
926
  updated_at: r
927
927
  });
@@ -951,24 +951,24 @@ function Wa(t) {
951
951
  }
952
952
  function Ka(t) {
953
953
  return async (e, n = {}) => {
954
- const { page: r = 0, per_page: a = 50, include_totals: o = !1, q: u, sort: d } = n;
955
- let c = t.selectFrom("client_grants").where("client_grants.tenant_id", "=", e);
954
+ const { page: r = 0, per_page: a = 50, include_totals: o = !1, q: u, sort: c } = n;
955
+ let d = t.selectFrom("client_grants").where("client_grants.tenant_id", "=", e);
956
956
  if (u) {
957
957
  const f = u.trim(), v = f.split(/\s+/), b = v.length === 1 ? v[0] : void 0, E = b ? b.match(/^(-)?([a-zA-Z_][a-zA-Z0-9_]*):"?([^"]*)"?$/) : null, D = E ? E[3] : "", ae = /^(>=|>|<=|<)/.test(D || "");
958
958
  if (E && !ae && D) {
959
959
  const U = !!E[1], pe = E[2], { ref: Nt } = t.dynamic, ge = Nt(`client_grants.${pe}`);
960
960
  if (pe === "allow_any_organization") {
961
961
  const nt = D === "true" ? 1 : 0;
962
- U ? c = c.where(ge, "!=", nt) : c = c.where(ge, "=", nt);
962
+ U ? d = d.where(ge, "!=", nt) : d = d.where(ge, "=", nt);
963
963
  } else
964
- U ? c = c.where(ge, "!=", D) : c = c.where(ge, "=", D);
964
+ U ? d = d.where(ge, "!=", D) : d = d.where(ge, "=", D);
965
965
  } else
966
- c = L(t, c, f, []);
966
+ d = L(t, d, f, []);
967
967
  }
968
- let h = c;
969
- if (d) {
968
+ let h = d;
969
+ if (c) {
970
970
  const { ref: f } = t.dynamic;
971
- h = h.orderBy(f(d.sort_by), d.sort_order);
971
+ h = h.orderBy(f(c.sort_by), c.sort_order);
972
972
  } else
973
973
  h = h.orderBy("client_grants.created_at", "desc");
974
974
  h = h.limit(a).offset(r * a);
@@ -996,7 +996,7 @@ function Ka(t) {
996
996
  limit: 0,
997
997
  length: 0
998
998
  };
999
- const { count: y } = await c.select((f) => f.fn.countAll().as("count")).executeTakeFirstOrThrow();
999
+ const { count: y } = await d.select((f) => f.fn.countAll().as("count")).executeTakeFirstOrThrow();
1000
1000
  return {
1001
1001
  client_grants: l,
1002
1002
  start: r * a,
@@ -1010,13 +1010,13 @@ function Ua(t) {
1010
1010
  }
1011
1011
  function Qa(t) {
1012
1012
  return async (e, n, r) => {
1013
- const a = (/* @__PURE__ */ new Date()).toISOString(), { scope: o, authorization_details_types: u, ...d } = r, c = {
1014
- ...d,
1013
+ const a = (/* @__PURE__ */ new Date()).toISOString(), { scope: o, authorization_details_types: u, ...c } = r, d = {
1014
+ ...c,
1015
1015
  updated_at: a
1016
1016
  };
1017
- return o !== void 0 && (c.scope = JSON.stringify(o)), u !== void 0 && (c.authorization_details_types = JSON.stringify(
1017
+ return o !== void 0 && (d.scope = JSON.stringify(o)), u !== void 0 && (d.authorization_details_types = JSON.stringify(
1018
1018
  u
1019
- )), d.allow_any_organization !== void 0 && (c.allow_any_organization = d.allow_any_organization ? 1 : 0), d.is_system !== void 0 && (c.is_system = d.is_system ? 1 : 0), ((await t.updateTable("client_grants").set(c).where("client_grants.tenant_id", "=", e).where("client_grants.id", "=", n).executeTakeFirst()).numUpdatedRows ?? 0n) > 0n;
1019
+ )), c.allow_any_organization !== void 0 && (d.allow_any_organization = c.allow_any_organization ? 1 : 0), c.is_system !== void 0 && (d.is_system = c.is_system ? 1 : 0), ((await t.updateTable("client_grants").set(d).where("client_grants.tenant_id", "=", e).where("client_grants.id", "=", n).executeTakeFirst()).numUpdatedRows ?? 0n) > 0n;
1020
1020
  };
1021
1021
  }
1022
1022
  function Va(t) {
@@ -1052,10 +1052,10 @@ function Ga(t) {
1052
1052
  require_proof_of_possession: !!n.require_proof_of_possession,
1053
1053
  // Parse JSON string fields back to objects/arrays
1054
1054
  connections: a.map(
1055
- (d) => Fr.parse(
1055
+ (c) => Fr.parse(
1056
1056
  T({
1057
- ...d,
1058
- options: d.options ? JSON.parse(d.options) : {}
1057
+ ...c,
1058
+ options: c.options ? JSON.parse(c.options) : {}
1059
1059
  })
1060
1060
  )
1061
1061
  ),
@@ -1080,10 +1080,7 @@ function Ga(t) {
1080
1080
  client_authentication_methods: n.client_authentication_methods ? JSON.parse(n.client_authentication_methods) : {},
1081
1081
  signed_request_object: n.signed_request_object ? JSON.parse(n.signed_request_object) : {},
1082
1082
  token_quota: n.token_quota ? JSON.parse(n.token_quota) : {},
1083
- tenant: T(r),
1084
- // Extract legacy fields from client_metadata
1085
- disable_sign_ups: o.disable_sign_ups === "true",
1086
- email_validation: o.email_validation || "disabled"
1083
+ tenant: T(r)
1087
1084
  };
1088
1085
  }
1089
1086
  };
@@ -1097,23 +1094,23 @@ function Ya(t) {
1097
1094
  sort: o,
1098
1095
  q: u
1099
1096
  } = e;
1100
- let d = t.selectFrom("keys").where(
1097
+ let c = t.selectFrom("keys").where(
1101
1098
  (f) => f.or([
1102
1099
  f("revoked_at", ">", (/* @__PURE__ */ new Date()).toISOString()),
1103
1100
  f("revoked_at", "is", null)
1104
1101
  ])
1105
1102
  );
1106
- u && (d = L(t, d, u, [
1103
+ u && (c = L(t, c, u, [
1107
1104
  "kid",
1108
1105
  "connection",
1109
1106
  "fingerprint",
1110
1107
  "thumbprint",
1111
1108
  "type"
1112
1109
  ]));
1113
- let c = d.select((f) => f.fn.count("kid").as("count"));
1110
+ let d = c.select((f) => f.fn.count("kid").as("count"));
1114
1111
  const h = n * r;
1115
- d = d.limit(r).offset(h), o && (d = d.orderBy(o.sort_by, o.sort_order));
1116
- const p = await d.selectAll().execute();
1112
+ c = c.limit(r).offset(h), o && (c = c.orderBy(o.sort_by, o.sort_order));
1113
+ const p = await c.selectAll().execute();
1117
1114
  if (!a)
1118
1115
  return {
1119
1116
  signingKeys: p,
@@ -1121,7 +1118,7 @@ function Ya(t) {
1121
1118
  limit: 0,
1122
1119
  length: 0
1123
1120
  };
1124
- const l = await c.executeTakeFirst(), y = F((l == null ? void 0 : l.count) ?? 0);
1121
+ const l = await d.executeTakeFirst(), y = F((l == null ? void 0 : l.count) ?? 0);
1125
1122
  return {
1126
1123
  signingKeys: p,
1127
1124
  start: h,
@@ -1219,8 +1216,8 @@ function so(t) {
1219
1216
  colors_primary: a,
1220
1217
  colors_page_background_type: o,
1221
1218
  colors_page_background_start: u,
1222
- colors_page_background_end: d,
1223
- colors_page_background_angle_dev: c,
1219
+ colors_page_background_end: c,
1220
+ colors_page_background_angle_dev: d,
1224
1221
  font_url: h,
1225
1222
  ...p
1226
1223
  } = n;
@@ -1231,8 +1228,8 @@ function so(t) {
1231
1228
  page_background: {
1232
1229
  type: o,
1233
1230
  start: u,
1234
- end: d,
1235
- angle_deg: c
1231
+ end: c,
1232
+ angle_deg: d
1236
1233
  }
1237
1234
  },
1238
1235
  font: h ? { url: h } : void 0
@@ -1241,14 +1238,14 @@ function so(t) {
1241
1238
  }
1242
1239
  function uo(t) {
1243
1240
  return async (e, n) => {
1244
- var u, d, c, h, p, l, y, f, v, b, E, D, ae, U, pe, Nt, ge, nt;
1241
+ var u, c, d, h, p, l, y, f, v, b, E, D, ae, U, pe, Nt, ge, nt;
1245
1242
  const { colors: r, font: a, ...o } = n;
1246
1243
  try {
1247
1244
  await t.insertInto("branding").values({
1248
1245
  ...o,
1249
1246
  colors_primary: r == null ? void 0 : r.primary,
1250
- colors_page_background_type: (d = (u = n.colors) == null ? void 0 : u.page_background) == null ? void 0 : d.type,
1251
- colors_page_background_start: (h = (c = n.colors) == null ? void 0 : c.page_background) == null ? void 0 : h.start,
1247
+ colors_page_background_type: (c = (u = n.colors) == null ? void 0 : u.page_background) == null ? void 0 : c.type,
1248
+ colors_page_background_start: (h = (d = n.colors) == null ? void 0 : d.page_background) == null ? void 0 : h.start,
1252
1249
  colors_page_background_end: (l = (p = n.colors) == null ? void 0 : p.page_background) == null ? void 0 : l.end,
1253
1250
  colors_page_background_angle_dev: (f = (y = n.colors) == null ? void 0 : y.page_background) == null ? void 0 : f.angle_deg,
1254
1251
  font_url: (v = n.font) == null ? void 0 : v.url,
@@ -1276,9 +1273,9 @@ function co(t) {
1276
1273
  function lo(t) {
1277
1274
  return async (e, n = {}) => {
1278
1275
  const { page: r = 0, per_page: a = 50, include_totals: o = !1, q: u } = n;
1279
- let d = t.selectFrom("hooks").where("hooks.tenant_id", "=", e);
1280
- u && (d = L(t, d, u, ["url", "form_id"]));
1281
- const p = (await d.offset(r * a).limit(a).selectAll().execute()).map((y) => {
1276
+ let c = t.selectFrom("hooks").where("hooks.tenant_id", "=", e);
1277
+ u && (c = L(t, c, u, ["url", "form_id"]));
1278
+ const p = (await c.offset(r * a).limit(a).selectAll().execute()).map((y) => {
1282
1279
  const { tenant_id: f, enabled: v, synchronous: b, ...E } = y;
1283
1280
  return T({
1284
1281
  ...E,
@@ -1293,7 +1290,7 @@ function lo(t) {
1293
1290
  limit: 0,
1294
1291
  length: 0
1295
1292
  };
1296
- const { count: l } = await d.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
1293
+ const { count: l } = await c.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
1297
1294
  return {
1298
1295
  hooks: p,
1299
1296
  start: r * a,
@@ -1509,10 +1506,10 @@ function Io(t) {
1509
1506
  credentials: a,
1510
1507
  settings: o,
1511
1508
  enabled: u,
1512
- ...d
1509
+ ...c
1513
1510
  } = n;
1514
1511
  return T({
1515
- ...d,
1512
+ ...c,
1516
1513
  credentials: JSON.parse(a),
1517
1514
  settings: JSON.parse(o),
1518
1515
  enabled: !!u
@@ -1593,10 +1590,10 @@ function Fo(t) {
1593
1590
  }
1594
1591
  function jo(t) {
1595
1592
  return async (e, n = {}) => {
1596
- const { page: r = 0, per_page: a = 50, include_totals: o = !1, sort: u, q: d } = n;
1597
- let c = t.selectFrom("refresh_tokens").where("refresh_tokens.tenant_id", "=", e);
1598
- d && (c = L(t, c, d, ["token", "session_id"]));
1599
- let h = c;
1593
+ const { page: r = 0, per_page: a = 50, include_totals: o = !1, sort: u, q: c } = n;
1594
+ let d = t.selectFrom("refresh_tokens").where("refresh_tokens.tenant_id", "=", e);
1595
+ c && (d = L(t, d, c, ["token", "session_id"]));
1596
+ let h = d;
1600
1597
  if (u && u.sort_by) {
1601
1598
  const { ref: v } = t.dynamic;
1602
1599
  h = h.orderBy(v(u.sort_by), u.sort_order);
@@ -1615,7 +1612,7 @@ function jo(t) {
1615
1612
  limit: 0,
1616
1613
  length: 0
1617
1614
  };
1618
- const { count: y } = await c.select((v) => v.fn.countAll().as("count")).executeTakeFirstOrThrow(), f = F(y);
1615
+ const { count: y } = await d.select((v) => v.fn.countAll().as("count")).executeTakeFirstOrThrow(), f = F(y);
1619
1616
  return {
1620
1617
  refresh_tokens: l,
1621
1618
  start: r * a,
@@ -1684,9 +1681,9 @@ function Jo(t) {
1684
1681
  function Mo(t) {
1685
1682
  return async (e, n = {}) => {
1686
1683
  const { page: r = 0, per_page: a = 50, include_totals: o = !1, q: u } = n;
1687
- let d = t.selectFrom("forms").where("tenant_id", "=", e);
1688
- u && (d = L(t, d, u, []));
1689
- const p = (await d.offset(r * a).limit(a).selectAll().execute()).map((y) => {
1684
+ let c = t.selectFrom("forms").where("tenant_id", "=", e);
1685
+ u && (c = L(t, c, u, []));
1686
+ const p = (await c.offset(r * a).limit(a).selectAll().execute()).map((y) => {
1690
1687
  const f = { ...y };
1691
1688
  if (typeof f.nodes == "string")
1692
1689
  try {
@@ -1712,7 +1709,7 @@ function Mo(t) {
1712
1709
  limit: 0,
1713
1710
  length: 0
1714
1711
  };
1715
- const { count: l } = await d.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
1712
+ const { count: l } = await c.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
1716
1713
  return {
1717
1714
  forms: p,
1718
1715
  start: r * a,
@@ -1779,16 +1776,16 @@ function Qo(t) {
1779
1776
  updated_at: r
1780
1777
  }, o = Lr.parse(a), {
1781
1778
  verificationKey: u,
1782
- scopes: d,
1783
- options: c,
1779
+ scopes: c,
1780
+ options: d,
1784
1781
  skip_consent_for_verifiable_first_party_clients: h,
1785
1782
  allow_offline_access: p,
1786
1783
  ...l
1787
1784
  } = o, y = {
1788
1785
  ...l,
1789
1786
  tenant_id: e,
1790
- scopes: d ? JSON.stringify(d) : "[]",
1791
- options: c ? JSON.stringify(c) : "{}",
1787
+ scopes: c ? JSON.stringify(c) : "[]",
1788
+ options: d ? JSON.stringify(d) : "{}",
1792
1789
  skip_consent_for_verifiable_first_party_clients: h ? 1 : 0,
1793
1790
  allow_offline_access: p ? 1 : 0,
1794
1791
  verification_key: u,
@@ -1805,15 +1802,15 @@ function Vo(t) {
1805
1802
  const a = r, {
1806
1803
  verification_key: o,
1807
1804
  scopes: u,
1808
- options: d,
1809
- skip_consent_for_verifiable_first_party_clients: c,
1805
+ options: c,
1806
+ skip_consent_for_verifiable_first_party_clients: d,
1810
1807
  allow_offline_access: h,
1811
1808
  ...p
1812
1809
  } = a, l = {
1813
1810
  ...p,
1814
1811
  scopes: u ? JSON.parse(u) : [],
1815
- options: d ? JSON.parse(d) : {},
1816
- skip_consent_for_verifiable_first_party_clients: !!c,
1812
+ options: c ? JSON.parse(c) : {},
1813
+ skip_consent_for_verifiable_first_party_clients: !!d,
1817
1814
  allow_offline_access: !!h,
1818
1815
  // Convert verification_key back to verificationKey for API
1819
1816
  verificationKey: o
@@ -1824,19 +1821,19 @@ function Vo(t) {
1824
1821
  function Go(t) {
1825
1822
  return async (e, n = {}) => {
1826
1823
  const { page: r = 0, per_page: a = 50, include_totals: o = !1, q: u } = n;
1827
- let d = t.selectFrom("resource_servers").where("resource_servers.tenant_id", "=", e);
1824
+ let c = t.selectFrom("resource_servers").where("resource_servers.tenant_id", "=", e);
1828
1825
  if (u) {
1829
1826
  const y = u.trim(), f = y.split(/\s+/), v = f.length === 1 ? f[0] : void 0, b = v ? v.match(/^(-)?(name|identifier):(.*)$/) : null, E = b ? b[3] : "", D = /^(>=|>|<=|<)/.test(E || "");
1830
1827
  if (b && !D) {
1831
1828
  const ae = !!b[1], U = b[2] === "name" ? "resource_servers.name" : "resource_servers.identifier";
1832
- d = ae ? d.where(U, "not like", `%${E}%`) : d.where(U, "like", `%${E}%`);
1829
+ c = ae ? c.where(U, "not like", `%${E}%`) : c.where(U, "like", `%${E}%`);
1833
1830
  } else
1834
- d = L(t, d, y, [
1831
+ c = L(t, c, y, [
1835
1832
  "resource_servers.name",
1836
1833
  "resource_servers.identifier"
1837
1834
  ]);
1838
1835
  }
1839
- const p = (await d.offset(r * a).limit(a).selectAll().execute()).map((y) => {
1836
+ const p = (await c.offset(r * a).limit(a).selectAll().execute()).map((y) => {
1840
1837
  const f = y, {
1841
1838
  verification_key: v,
1842
1839
  scopes: b,
@@ -1862,7 +1859,7 @@ function Go(t) {
1862
1859
  limit: 0,
1863
1860
  length: 0
1864
1861
  };
1865
- const { count: l } = await d.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
1862
+ const { count: l } = await c.select((y) => y.fn.countAll().as("count")).executeTakeFirstOrThrow();
1866
1863
  return {
1867
1864
  resource_servers: p,
1868
1865
  start: r * a,
@@ -1883,8 +1880,8 @@ function Ho(t) {
1883
1880
  verificationKey: a,
1884
1881
  scopes: o,
1885
1882
  options: u,
1886
- skip_consent_for_verifiable_first_party_clients: d,
1887
- allow_offline_access: c,
1883
+ skip_consent_for_verifiable_first_party_clients: c,
1884
+ allow_offline_access: d,
1888
1885
  ...h
1889
1886
  } = r, p = {
1890
1887
  ...h,
@@ -1894,7 +1891,7 @@ function Ho(t) {
1894
1891
  const y = await t.selectFrom("resource_servers").select("options").where("tenant_id", "=", e).where("id", "=", n).executeTakeFirst(), v = { ...y != null && y.options ? JSON.parse(y.options) : {}, ...u };
1895
1892
  p.options = JSON.stringify(v);
1896
1893
  }
1897
- d !== void 0 && (p.skip_consent_for_verifiable_first_party_clients = d ? 1 : 0), c !== void 0 && (p.allow_offline_access = c ? 1 : 0);
1894
+ c !== void 0 && (p.skip_consent_for_verifiable_first_party_clients = c ? 1 : 0), d !== void 0 && (p.allow_offline_access = d ? 1 : 0);
1898
1895
  const l = await t.updateTable("resource_servers").set(p).where("tenant_id", "=", e).where("id", "=", n).executeTakeFirst();
1899
1896
  return Number(l.numUpdatedRows) > 0;
1900
1897
  };
@@ -1938,17 +1935,17 @@ function ti(t) {
1938
1935
  let r = t.selectFrom("roles").where("roles.tenant_id", "=", e);
1939
1936
  const { page: a = 0, per_page: o = 50, include_totals: u = !1 } = n;
1940
1937
  n.q && (r = L(t, r, n.q, ["name"]));
1941
- const c = await r.offset(a * o).limit(o).selectAll().execute();
1938
+ const d = await r.offset(a * o).limit(o).selectAll().execute();
1942
1939
  if (!u)
1943
1940
  return {
1944
- roles: c,
1941
+ roles: d,
1945
1942
  start: a * o,
1946
1943
  limit: o,
1947
- length: c.length
1944
+ length: d.length
1948
1945
  };
1949
1946
  const { count: h } = await r.select((p) => p.fn.countAll().as("count")).executeTakeFirstOrThrow();
1950
1947
  return {
1951
- roles: c,
1948
+ roles: d,
1952
1949
  start: a * o,
1953
1950
  limit: o,
1954
1951
  length: F(h)
@@ -1998,10 +1995,10 @@ function oi(t) {
1998
1995
  };
1999
1996
  try {
2000
1997
  await t.insertInto("role_permissions").values(u).execute();
2001
- } catch (d) {
2002
- if (d.code === "SQLITE_CONSTRAINT_PRIMARYKEY" || d.code === "SQLITE_CONSTRAINT_UNIQUE")
1998
+ } catch (c) {
1999
+ if (c.code === "SQLITE_CONSTRAINT_PRIMARYKEY" || c.code === "SQLITE_CONSTRAINT_UNIQUE")
2003
2000
  continue;
2004
- throw d;
2001
+ throw c;
2005
2002
  }
2006
2003
  }
2007
2004
  return !0;
@@ -2031,7 +2028,7 @@ function ii(t) {
2031
2028
  function si(t) {
2032
2029
  return async (e, n, r = {}) => {
2033
2030
  const { page: a = 0, per_page: o = 50, include_totals: u = !1 } = r;
2034
- let d = t.selectFrom("role_permissions").leftJoin(
2031
+ let c = t.selectFrom("role_permissions").leftJoin(
2035
2032
  "resource_servers",
2036
2033
  (l) => l.onRef(
2037
2034
  "role_permissions.tenant_id",
@@ -2049,7 +2046,7 @@ function si(t) {
2049
2046
  "role_permissions.created_at",
2050
2047
  "resource_servers.name as resource_server_name"
2051
2048
  ]).where("role_permissions.tenant_id", "=", e).where("role_permissions.role_id", "=", n);
2052
- const p = (await d.offset(a * o).limit(o).execute()).map((l) => ({
2049
+ const p = (await c.offset(a * o).limit(o).execute()).map((l) => ({
2053
2050
  role_id: l.role_id,
2054
2051
  resource_server_identifier: l.resource_server_identifier,
2055
2052
  resource_server_name: l.resource_server_name || l.resource_server_identifier,
@@ -2059,7 +2056,7 @@ function si(t) {
2059
2056
  // No description available from role_permissions directly
2060
2057
  created_at: l.created_at
2061
2058
  }));
2062
- return u && await d.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow(), p;
2059
+ return u && await c.select((l) => l.fn.countAll().as("count")).executeTakeFirstOrThrow(), p;
2063
2060
  };
2064
2061
  }
2065
2062
  function ui(t) {
@@ -2069,7 +2066,7 @@ function ui(t) {
2069
2066
  list: si(t)
2070
2067
  };
2071
2068
  }
2072
- function di(t) {
2069
+ function ci(t) {
2073
2070
  return async (e, n, r, a) => {
2074
2071
  const o = (/* @__PURE__ */ new Date()).toISOString();
2075
2072
  try {
@@ -2087,7 +2084,7 @@ function di(t) {
2087
2084
  }
2088
2085
  };
2089
2086
  }
2090
- function ci(t) {
2087
+ function di(t) {
2091
2088
  return async (e, n, r, a) => {
2092
2089
  try {
2093
2090
  let o = t.deleteFrom("user_permissions").where("tenant_id", "=", e).where("user_id", "=", n).where(
@@ -2105,7 +2102,7 @@ function li(t) {
2105
2102
  return async (e, n, r, a) => {
2106
2103
  let o = t.selectFrom("user_permissions").leftJoin(
2107
2104
  "resource_servers",
2108
- (d) => d.onRef(
2105
+ (c) => c.onRef(
2109
2106
  "user_permissions.tenant_id",
2110
2107
  "=",
2111
2108
  "resource_servers.tenant_id"
@@ -2126,23 +2123,23 @@ function li(t) {
2126
2123
  "user_permissions.organization_id",
2127
2124
  "=",
2128
2125
  a
2129
- )), (await o.execute()).map((d) => ({
2130
- resource_server_identifier: d.resource_server_identifier,
2131
- permission_name: d.permission_name,
2126
+ )), (await o.execute()).map((c) => ({
2127
+ resource_server_identifier: c.resource_server_identifier,
2128
+ permission_name: c.permission_name,
2132
2129
  description: null,
2133
2130
  // No description available from user_permissions directly
2134
- resource_server_name: d.resource_server_name || d.resource_server_identifier,
2131
+ resource_server_name: c.resource_server_name || c.resource_server_identifier,
2135
2132
  // Fallback to identifier if name is null
2136
- user_id: d.user_id,
2137
- created_at: d.created_at,
2138
- organization_id: d.organization_id === "" ? void 0 : d.organization_id
2133
+ user_id: c.user_id,
2134
+ created_at: c.created_at,
2135
+ organization_id: c.organization_id === "" ? void 0 : c.organization_id
2139
2136
  }));
2140
2137
  };
2141
2138
  }
2142
2139
  function _i(t) {
2143
2140
  return {
2144
- create: di(t),
2145
- remove: ci(t),
2141
+ create: ci(t),
2142
+ remove: di(t),
2146
2143
  list: li(t)
2147
2144
  };
2148
2145
  }
@@ -2158,7 +2155,7 @@ function hi(t) {
2158
2155
  return async (e, n, r, a) => {
2159
2156
  let o = t.selectFrom("user_roles as ur").innerJoin(
2160
2157
  "roles as r",
2161
- (d) => d.onRef("ur.role_id", "=", "r.id").onRef("ur.tenant_id", "=", "r.tenant_id")
2158
+ (c) => c.onRef("ur.role_id", "=", "r.id").onRef("ur.tenant_id", "=", "r.tenant_id")
2162
2159
  ).select([
2163
2160
  "r.id",
2164
2161
  "r.name",
@@ -2281,11 +2278,11 @@ function Ci(t) {
2281
2278
  }
2282
2279
  function bi(t) {
2283
2280
  return async (e, n, r) => {
2284
- const { branding: a, metadata: o, enabled_connections: u, token_quota: d, ...c } = r, h = {
2285
- ...c,
2281
+ const { branding: a, metadata: o, enabled_connections: u, token_quota: c, ...d } = r, h = {
2282
+ ...d,
2286
2283
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
2287
2284
  };
2288
- return a !== void 0 && (h.branding = JSON.stringify(a)), o !== void 0 && (h.metadata = JSON.stringify(o)), u !== void 0 && (h.enabled_connections = JSON.stringify(u)), d !== void 0 && (h.token_quota = JSON.stringify(d)), (await t.updateTable("organizations").set(h).where("tenant_id", "=", e).where("id", "=", n).execute()).length > 0;
2285
+ return a !== void 0 && (h.branding = JSON.stringify(a)), o !== void 0 && (h.metadata = JSON.stringify(o)), u !== void 0 && (h.enabled_connections = JSON.stringify(u)), c !== void 0 && (h.token_quota = JSON.stringify(c)), (await t.updateTable("organizations").set(h).where("tenant_id", "=", e).where("id", "=", n).execute()).length > 0;
2289
2286
  };
2290
2287
  }
2291
2288
  function Oi(t) {
@@ -2345,20 +2342,20 @@ function Si(t) {
2345
2342
  }
2346
2343
  }
2347
2344
  u = u.orderBy("created_at", "desc"), a > 0 && (u = u.limit(a).offset(o));
2348
- const d = await u.execute();
2349
- let c = t.selectFrom("user_organizations").select(t.fn.count("id").as("count")).where("tenant_id", "=", e);
2345
+ const c = await u.execute();
2346
+ let d = t.selectFrom("user_organizations").select(t.fn.count("id").as("count")).where("tenant_id", "=", e);
2350
2347
  if (n != null && n.q) {
2351
2348
  if (n.q.startsWith("user_id:")) {
2352
2349
  const l = n.q.replace("user_id:", "");
2353
- c = c.where("user_id", "=", l);
2350
+ d = d.where("user_id", "=", l);
2354
2351
  } else if (n.q.startsWith("organization_id:")) {
2355
2352
  const l = n.q.replace("organization_id:", "");
2356
- c = c.where("organization_id", "=", l);
2353
+ d = d.where("organization_id", "=", l);
2357
2354
  }
2358
2355
  }
2359
- const h = await c.executeTakeFirst();
2356
+ const h = await d.executeTakeFirst();
2360
2357
  return {
2361
- userOrganizations: d.map((l) => ({
2358
+ userOrganizations: c.map((l) => ({
2362
2359
  id: l.id,
2363
2360
  user_id: l.user_id,
2364
2361
  organization_id: l.organization_id,
@@ -2374,7 +2371,7 @@ function Si(t) {
2374
2371
  function ki(t) {
2375
2372
  return async (e, n, r) => {
2376
2373
  const a = (r == null ? void 0 : r.page) || 0, o = (r == null ? void 0 : r.per_page) || 50, u = a * o;
2377
- let d = t.selectFrom("user_organizations").innerJoin(
2374
+ let c = t.selectFrom("user_organizations").innerJoin(
2378
2375
  "organizations",
2379
2376
  "organizations.id",
2380
2377
  "user_organizations.organization_id"
@@ -2390,14 +2387,14 @@ function ki(t) {
2390
2387
  "organizations.updated_at",
2391
2388
  "user_organizations.created_at as joined_at"
2392
2389
  ]).where("user_organizations.tenant_id", "=", e).where("user_organizations.user_id", "=", n);
2393
- d = d.orderBy("user_organizations.created_at", "desc"), o > 0 && (d = d.limit(o).offset(u));
2394
- const c = await d.execute(), h = await t.selectFrom("user_organizations").innerJoin(
2390
+ c = c.orderBy("user_organizations.created_at", "desc"), o > 0 && (c = c.limit(o).offset(u));
2391
+ const d = await c.execute(), h = await t.selectFrom("user_organizations").innerJoin(
2395
2392
  "organizations",
2396
2393
  "organizations.id",
2397
2394
  "user_organizations.organization_id"
2398
2395
  ).select(t.fn.count("user_organizations.id").as("count")).where("user_organizations.tenant_id", "=", e).where("user_organizations.user_id", "=", n).executeTakeFirst();
2399
2396
  return {
2400
- organizations: c.map((l) => ({
2397
+ organizations: d.map((l) => ({
2401
2398
  id: l.id,
2402
2399
  name: l.name,
2403
2400
  display_name: l.display_name,
@@ -3252,13 +3249,13 @@ function Ie(t, e) {
3252
3249
  });
3253
3250
  }
3254
3251
  var B;
3255
- const dt = class dt {
3252
+ const ct = class ct {
3256
3253
  constructor(e) {
3257
3254
  C(this, B);
3258
3255
  O(this, B, s(e));
3259
3256
  }
3260
3257
  on(...e) {
3261
- return new dt({
3258
+ return new ct({
3262
3259
  ...i(this, B),
3263
3260
  joinNode: ot.cloneWithOn(i(this, B).joinNode, K(e))
3264
3261
  });
@@ -3270,7 +3267,7 @@ const dt = class dt {
3270
3267
  * See {@link WhereInterface.whereRef} for documentation and examples.
3271
3268
  */
3272
3269
  onRef(e, n, r) {
3273
- return new dt({
3270
+ return new ct({
3274
3271
  ...i(this, B),
3275
3272
  joinNode: ot.cloneWithOn(i(this, B).joinNode, ht(e, n, r))
3276
3273
  });
@@ -3279,7 +3276,7 @@ const dt = class dt {
3279
3276
  * Adds `on true`.
3280
3277
  */
3281
3278
  onTrue() {
3282
- return new dt({
3279
+ return new ct({
3283
3280
  ...i(this, B),
3284
3281
  joinNode: ot.cloneWithOn(i(this, B).joinNode, R.createWithSql("true"))
3285
3282
  });
@@ -3296,7 +3293,7 @@ const dt = class dt {
3296
3293
  }
3297
3294
  };
3298
3295
  B = new WeakMap();
3299
- let St = dt;
3296
+ let St = ct;
3300
3297
  Ie(St, "don't await JoinBuilder instances. They are never executed directly and are always just a part of a query.");
3301
3298
  const Zi = s({
3302
3299
  is(t) {
@@ -3699,14 +3696,14 @@ const us = s({
3699
3696
  });
3700
3697
  }
3701
3698
  });
3702
- function ds(t, e) {
3699
+ function cs(t, e) {
3703
3700
  if (!_n(t) && !Vn(t))
3704
3701
  throw new Error(`Invalid top expression: ${t}`);
3705
- if (!Ot(e) && !cs(e))
3702
+ if (!Ot(e) && !ds(e))
3706
3703
  throw new Error(`Invalid top modifiers: ${e}`);
3707
3704
  return us.create(t, e);
3708
3705
  }
3709
- function cs(t) {
3706
+ function ds(t) {
3710
3707
  return t === "percent" || t === "with ties" || t === "percent with ties";
3711
3708
  }
3712
3709
  const ls = s({
@@ -4727,7 +4724,7 @@ Le = new WeakMap(), Ne = new WeakMap(), ve = new WeakMap(), I = new WeakSet(), o
4727
4724
  }
4728
4725
  };
4729
4726
  var ft;
4730
- class dr {
4727
+ class cr {
4731
4728
  constructor(e) {
4732
4729
  C(this, ft);
4733
4730
  O(this, ft, new gs(e));
@@ -4799,11 +4796,11 @@ class Ns {
4799
4796
  }
4800
4797
  async *stream(e, n, r) {
4801
4798
  const a = new Rn(), o = new Rn();
4802
- this.provideConnection(async (d) => (a.resolve(d), await o.promise)).catch((d) => a.reject(d));
4799
+ this.provideConnection(async (c) => (a.resolve(c), await o.promise)).catch((c) => a.reject(c));
4803
4800
  const u = await a.promise;
4804
4801
  try {
4805
- for await (const d of u.streamQuery(e, n))
4806
- yield await w(this, gt, tn).call(this, d, r);
4802
+ for await (const c of u.streamQuery(e, n))
4803
+ yield await w(this, gt, tn).call(this, c, r);
4807
4804
  } finally {
4808
4805
  o.resolve();
4809
4806
  }
@@ -4844,7 +4841,7 @@ class Fe extends Ns {
4844
4841
  return new Fe([]);
4845
4842
  }
4846
4843
  }
4847
- const cr = new Fe();
4844
+ const dr = new Fe();
4848
4845
  function Cs(t, e) {
4849
4846
  return new St({
4850
4847
  joinNode: ot.create(t, It(e))
@@ -5231,7 +5228,7 @@ const N = class N {
5231
5228
  top(e, n) {
5232
5229
  return new N({
5233
5230
  ...i(this, _),
5234
- queryNode: M.cloneWithTop(i(this, _).queryNode, ds(e, n))
5231
+ queryNode: M.cloneWithTop(i(this, _).queryNode, cs(e, n))
5235
5232
  });
5236
5233
  }
5237
5234
  union(e) {
@@ -5989,12 +5986,12 @@ class qn extends ut {
5989
5986
  }
5990
5987
  }
5991
5988
  xe = new WeakMap();
5992
- var He, de;
5989
+ var He, ce;
5993
5990
  class Js {
5994
5991
  constructor(e, n) {
5995
5992
  C(this, He);
5996
- C(this, de);
5997
- O(this, He, e), O(this, de, n);
5993
+ C(this, ce);
5994
+ O(this, He, e), O(this, ce, n);
5998
5995
  }
5999
5996
  /** @private */
6000
5997
  get expression() {
@@ -6002,13 +5999,13 @@ class Js {
6002
5999
  }
6003
6000
  /** @private */
6004
6001
  get alias() {
6005
- return i(this, de);
6002
+ return i(this, ce);
6006
6003
  }
6007
6004
  toOperationNode() {
6008
- return fe.create(i(this, He).toOperationNode(), J(i(this, de)) ? i(this, de).toOperationNode() : z.create(i(this, de)));
6005
+ return fe.create(i(this, He).toOperationNode(), J(i(this, ce)) ? i(this, ce).toOperationNode() : z.create(i(this, ce)));
6009
6006
  }
6010
6007
  }
6011
- He = new WeakMap(), de = new WeakMap();
6008
+ He = new WeakMap(), ce = new WeakMap();
6012
6009
  const Ln = s({
6013
6010
  is(t) {
6014
6011
  return t.kind === "TupleNode";
@@ -6096,7 +6093,7 @@ const Qs = s({
6096
6093
  });
6097
6094
  }
6098
6095
  });
6099
- function yn(t = cr) {
6096
+ function yn(t = dr) {
6100
6097
  function e(a, o, u) {
6101
6098
  return new S(pn(a, o, u));
6102
6099
  }
@@ -6169,7 +6166,7 @@ function yn(t = cr) {
6169
6166
  return new S(Qs.create(j(a), Us(o)));
6170
6167
  },
6171
6168
  withSchema(a) {
6172
- return yn(t.withPluginAtFront(new dr(a)));
6169
+ return yn(t.withPluginAtFront(new cr(a)));
6173
6170
  }
6174
6171
  });
6175
6172
  return r.fn = Rs(), r.eb = r, r;
@@ -6220,7 +6217,7 @@ function hr(t) {
6220
6217
  return t.trim();
6221
6218
  }
6222
6219
  var P, q, Ct, on, sn;
6223
- const ct = class ct {
6220
+ const dt = class dt {
6224
6221
  constructor(e) {
6225
6222
  C(this, q);
6226
6223
  C(this, P);
@@ -6235,13 +6232,13 @@ const ct = class ct {
6235
6232
  return new fr(this, e);
6236
6233
  }
6237
6234
  $castTo() {
6238
- return new ct({ ...i(this, P) });
6235
+ return new dt({ ...i(this, P) });
6239
6236
  }
6240
6237
  $notNull() {
6241
- return new ct(i(this, P));
6238
+ return new dt(i(this, P));
6242
6239
  }
6243
6240
  withPlugin(e) {
6244
- return new ct({
6241
+ return new dt({
6245
6242
  ...i(this, P),
6246
6243
  plugins: i(this, P).plugins !== void 0 ? s([...i(this, P).plugins, e]) : s([e])
6247
6244
  });
@@ -6258,39 +6255,39 @@ const ct = class ct {
6258
6255
  }
6259
6256
  };
6260
6257
  P = new WeakMap(), q = new WeakSet(), Ct = function(e) {
6261
- const n = e !== void 0 ? e.getExecutor() : cr;
6258
+ const n = e !== void 0 ? e.getExecutor() : dr;
6262
6259
  return i(this, P).plugins !== void 0 ? n.withPlugins(i(this, P).plugins) : n;
6263
6260
  }, on = function(e) {
6264
6261
  return e.transformQuery(i(this, P).rawNode, i(this, P).queryId);
6265
6262
  }, sn = function(e) {
6266
6263
  return e.compileQuery(w(this, q, on).call(this, e), i(this, P).queryId);
6267
6264
  };
6268
- let At = ct;
6265
+ let At = dt;
6269
6266
  function ie(t) {
6270
6267
  return new At(t);
6271
6268
  }
6272
6269
  Ie(At, "don't await RawBuilder instances directly. To execute the query you need to call `execute`");
6273
- var Te, ce;
6270
+ var Te, de;
6274
6271
  class fr {
6275
6272
  constructor(e, n) {
6276
6273
  C(this, Te);
6277
- C(this, ce);
6278
- O(this, Te, e), O(this, ce, n);
6274
+ C(this, de);
6275
+ O(this, Te, e), O(this, de, n);
6279
6276
  }
6280
6277
  get expression() {
6281
6278
  return i(this, Te);
6282
6279
  }
6283
6280
  get alias() {
6284
- return i(this, ce);
6281
+ return i(this, de);
6285
6282
  }
6286
6283
  get rawBuilder() {
6287
6284
  return i(this, Te);
6288
6285
  }
6289
6286
  toOperationNode() {
6290
- return fe.create(i(this, Te).toOperationNode(), J(i(this, ce)) ? i(this, ce).toOperationNode() : z.create(i(this, ce)));
6287
+ return fe.create(i(this, Te).toOperationNode(), J(i(this, de)) ? i(this, de).toOperationNode() : z.create(i(this, de)));
6291
6288
  }
6292
6289
  }
6293
- Te = new WeakMap(), ce = new WeakMap();
6290
+ Te = new WeakMap(), de = new WeakMap();
6294
6291
  Ie(fr, "don't await AliasedRawBuilder instances directly. AliasedRawBuilder should never be executed directly since it's always a part of another query.");
6295
6292
  const g = Object.assign((t, ...e) => ie({
6296
6293
  queryId: H(),
@@ -6361,7 +6358,7 @@ class Ys {
6361
6358
  }
6362
6359
  }
6363
6360
  const Hs = "kysely_migration", Mn = "kysely_migration_lock", Xs = !1, Qt = "migration_lock", Zs = s({ __noMigrations__: !0 });
6364
- var k, m, rt, X, Z, De, gr, ee, yr, wr, Nr, vr, Cr, un, Re, dn, br, Or, xr, cn, Tr, Sr, kr, Er, Ir, at;
6361
+ var k, m, rt, X, Z, De, gr, ee, yr, wr, Nr, vr, Cr, un, Re, cn, br, Or, xr, dn, Tr, Sr, kr, Er, Ir, at;
6365
6362
  class pr {
6366
6363
  constructor(e) {
6367
6364
  C(this, m);
@@ -6375,7 +6372,7 @@ class pr {
6375
6372
  */
6376
6373
  async getMigrations() {
6377
6374
  const e = await w(this, m, Re).call(this, i(this, m, Z)) ? await i(this, k).db.withPlugin(i(this, m, ee)).selectFrom(i(this, m, Z)).select(["name", "timestamp"]).execute() : [];
6378
- return (await w(this, m, cn).call(this)).map(({ name: r, ...a }) => {
6375
+ return (await w(this, m, dn).call(this)).map(({ name: r, ...a }) => {
6379
6376
  const o = e.find((u) => u.name === r);
6380
6377
  return {
6381
6378
  name: r,
@@ -6461,9 +6458,9 @@ class pr {
6461
6458
  return w(this, m, rt).call(this, ({ migrations: n, executedMigrations: r, pendingMigrations: a }) => {
6462
6459
  if (e === Zs)
6463
6460
  return { direction: "Down", step: 1 / 0 };
6464
- if (!n.find((d) => d.name === e))
6461
+ if (!n.find((c) => c.name === e))
6465
6462
  throw new Error(`migration "${e}" doesn't exist`);
6466
- const o = r.indexOf(e), u = a.findIndex((d) => d.name === e);
6463
+ const o = r.indexOf(e), u = a.findIndex((c) => c.name === e);
6467
6464
  if (o !== -1)
6468
6465
  return {
6469
6466
  direction: "Down",
@@ -6524,7 +6521,7 @@ k = new WeakMap(), m = new WeakSet(), rt = async function(e) {
6524
6521
  }, gr = function() {
6525
6522
  return i(this, k).allowUnorderedMigrations ?? Xs;
6526
6523
  }, ee = function() {
6527
- return i(this, m, X) ? new dr(i(this, m, X)) : new Ys();
6524
+ return i(this, m, X) ? new cr(i(this, m, X)) : new Ys();
6528
6525
  }, yr = async function() {
6529
6526
  await w(this, m, wr).call(this), await w(this, m, Nr).call(this), await w(this, m, vr).call(this), await w(this, m, Cr).call(this);
6530
6527
  }, wr = async function() {
@@ -6552,11 +6549,11 @@ k = new WeakMap(), m = new WeakSet(), rt = async function(e) {
6552
6549
  throw e;
6553
6550
  }
6554
6551
  }, Cr = async function() {
6555
- if (!await w(this, m, dn).call(this))
6552
+ if (!await w(this, m, cn).call(this))
6556
6553
  try {
6557
6554
  await i(this, k).db.withPlugin(i(this, m, ee)).insertInto(i(this, m, De)).values({ id: Qt, is_locked: 0 }).execute();
6558
6555
  } catch (e) {
6559
- if (!await w(this, m, dn).call(this))
6556
+ if (!await w(this, m, cn).call(this))
6560
6557
  throw e;
6561
6558
  }
6562
6559
  }, un = async function() {
@@ -6566,7 +6563,7 @@ k = new WeakMap(), m = new WeakSet(), rt = async function(e) {
6566
6563
  return (await i(this, k).db.introspection.getTables({
6567
6564
  withInternalKyselyTables: !0
6568
6565
  })).some((a) => a.name === e && (!n || a.schema === n));
6569
- }, dn = async function() {
6566
+ }, cn = async function() {
6570
6567
  return !!await i(this, k).db.withPlugin(i(this, m, ee)).selectFrom(i(this, m, De)).where("id", "=", Qt).select("id").executeTakeFirst();
6571
6568
  }, br = async function(e) {
6572
6569
  const n = i(this, k).db.getExecutor().adapter, r = s({
@@ -6579,15 +6576,15 @@ k = new WeakMap(), m = new WeakSet(), rt = async function(e) {
6579
6576
  const u = await w(this, m, Or).call(this, o);
6580
6577
  if (u.migrations.length === 0)
6581
6578
  return { results: [] };
6582
- const { direction: d, step: c } = e(u);
6583
- return c <= 0 ? { results: [] } : d === "Down" ? await w(this, m, Er).call(this, o, u, c) : d === "Up" ? await w(this, m, Ir).call(this, o, u, c) : { results: [] };
6579
+ const { direction: c, step: d } = e(u);
6580
+ return d <= 0 ? { results: [] } : c === "Down" ? await w(this, m, Er).call(this, o, u, d) : c === "Up" ? await w(this, m, Ir).call(this, o, u, d) : { results: [] };
6584
6581
  } finally {
6585
6582
  await n.releaseMigrationLock(o, r);
6586
6583
  }
6587
6584
  };
6588
6585
  return n.supportsTransactionalDdl ? i(this, k).db.transaction().execute(a) : i(this, k).db.connection().execute(a);
6589
6586
  }, Or = async function(e) {
6590
- const n = await w(this, m, cn).call(this), r = await w(this, m, Tr).call(this, e);
6587
+ const n = await w(this, m, dn).call(this), r = await w(this, m, Tr).call(this, e);
6591
6588
  w(this, m, Sr).call(this, n, r), i(this, m, gr) || w(this, m, kr).call(this, n, r);
6592
6589
  const a = w(this, m, xr).call(this, n, r);
6593
6590
  return s({
@@ -6598,7 +6595,7 @@ k = new WeakMap(), m = new WeakSet(), rt = async function(e) {
6598
6595
  });
6599
6596
  }, xr = function(e, n) {
6600
6597
  return e.filter((r) => !n.includes(r.name));
6601
- }, cn = async function() {
6598
+ }, dn = async function() {
6602
6599
  const e = await i(this, k).provider.getMigrations();
6603
6600
  return Object.keys(e).sort().map((n) => ({
6604
6601
  ...e[n],
@@ -6615,26 +6612,26 @@ k = new WeakMap(), m = new WeakSet(), rt = async function(e) {
6615
6612
  if (e[r].name !== n[r])
6616
6613
  throw new Error(`corrupted migrations: expected previously executed migration ${n[r]} to be at index ${r} but ${e[r].name} was found in its place. New migrations must always have a name that comes alphabetically after the last executed migration.`);
6617
6614
  }, Er = async function(e, n, r) {
6618
- const a = n.executedMigrations.slice().reverse().slice(0, r).map((u) => n.migrations.find((d) => d.name === u)), o = a.map((u) => ({
6615
+ const a = n.executedMigrations.slice().reverse().slice(0, r).map((u) => n.migrations.find((c) => c.name === u)), o = a.map((u) => ({
6619
6616
  migrationName: u.name,
6620
6617
  direction: "Down",
6621
6618
  status: "NotExecuted"
6622
6619
  }));
6623
6620
  for (let u = 0; u < o.length; ++u) {
6624
- const d = a[u];
6621
+ const c = a[u];
6625
6622
  try {
6626
- d.down && (await d.down(e), await e.withPlugin(i(this, m, ee)).deleteFrom(i(this, m, Z)).where("name", "=", d.name).execute(), o[u] = {
6627
- migrationName: d.name,
6623
+ c.down && (await c.down(e), await e.withPlugin(i(this, m, ee)).deleteFrom(i(this, m, Z)).where("name", "=", c.name).execute(), o[u] = {
6624
+ migrationName: c.name,
6628
6625
  direction: "Down",
6629
6626
  status: "Success"
6630
6627
  });
6631
- } catch (c) {
6628
+ } catch (d) {
6632
6629
  throw o[u] = {
6633
- migrationName: d.name,
6630
+ migrationName: c.name,
6634
6631
  direction: "Down",
6635
6632
  status: "Error"
6636
6633
  }, new Vt({
6637
- error: c,
6634
+ error: d,
6638
6635
  results: o
6639
6636
  });
6640
6637
  }
@@ -6647,23 +6644,23 @@ k = new WeakMap(), m = new WeakSet(), rt = async function(e) {
6647
6644
  status: "NotExecuted"
6648
6645
  }));
6649
6646
  for (let u = 0; u < o.length; u++) {
6650
- const d = n.pendingMigrations[u];
6647
+ const c = n.pendingMigrations[u];
6651
6648
  try {
6652
- await d.up(e), await e.withPlugin(i(this, m, ee)).insertInto(i(this, m, Z)).values({
6653
- name: d.name,
6649
+ await c.up(e), await e.withPlugin(i(this, m, ee)).insertInto(i(this, m, Z)).values({
6650
+ name: c.name,
6654
6651
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
6655
6652
  }).execute(), o[u] = {
6656
- migrationName: d.name,
6653
+ migrationName: c.name,
6657
6654
  direction: "Up",
6658
6655
  status: "Success"
6659
6656
  };
6660
- } catch (c) {
6657
+ } catch (d) {
6661
6658
  throw o[u] = {
6662
- migrationName: d.name,
6659
+ migrationName: c.name,
6663
6660
  direction: "Up",
6664
6661
  status: "Error"
6665
6662
  }, new Vt({
6666
- error: c,
6663
+ error: d,
6667
6664
  results: o
6668
6665
  });
6669
6666
  }
@@ -6793,7 +6790,7 @@ const uu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6793
6790
  down: su,
6794
6791
  up: iu
6795
6792
  }, Symbol.toStringTag, { value: "Module" }));
6796
- async function du(t) {
6793
+ async function cu(t) {
6797
6794
  await t.schema.createTable("logs").addColumn("id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("category", "varchar(255)", (e) => e.notNull()).addColumn("tenant_id", "varchar(64)").addColumn("user_id", "varchar(64)").addForeignKeyConstraint(
6798
6795
  "tenant_id_constraint",
6799
6796
  ["tenant_id"],
@@ -6802,13 +6799,13 @@ async function du(t) {
6802
6799
  (e) => e.onDelete("cascade")
6803
6800
  ).addColumn("ip", "varchar(255)").addColumn("type", "varchar(8)", (e) => e.notNull()).addColumn("date", "varchar(25)", (e) => e.notNull()).addColumn("client_id", "varchar(255)").addColumn("client_name", "varchar(255)").addColumn("user_agent", "varchar(255)").addColumn("description", "varchar(255)").addColumn("details", "varchar(2048)").execute();
6804
6801
  }
6805
- async function cu(t) {
6802
+ async function du(t) {
6806
6803
  await t.schema.dropTable("logs").execute();
6807
6804
  }
6808
6805
  const lu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6809
6806
  __proto__: null,
6810
- down: cu,
6811
- up: du
6807
+ down: du,
6808
+ up: cu
6812
6809
  }, Symbol.toStringTag, { value: "Module" }));
6813
6810
  async function _u(t) {
6814
6811
  }
@@ -7003,185 +7000,185 @@ const Zu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7003
7000
  down: Xu,
7004
7001
  up: Hu
7005
7002
  }, Symbol.toStringTag, { value: "Module" }));
7006
- async function ed(t) {
7003
+ async function ec(t) {
7007
7004
  }
7008
- async function td(t) {
7005
+ async function tc(t) {
7009
7006
  }
7010
- const nd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7007
+ const nc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7011
7008
  __proto__: null,
7012
- down: td,
7013
- up: ed
7009
+ down: tc,
7010
+ up: ec
7014
7011
  }, Symbol.toStringTag, { value: "Module" }));
7015
- async function rd(t) {
7012
+ async function rc(t) {
7016
7013
  await t.schema.alterTable("otps").addColumn("audience", "varchar(255)").execute();
7017
7014
  }
7018
- async function ad(t) {
7015
+ async function ac(t) {
7019
7016
  await t.schema.alterTable("otps").dropColumn("audience").execute();
7020
7017
  }
7021
- const od = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7018
+ const oc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7022
7019
  __proto__: null,
7023
- down: ad,
7024
- up: rd
7020
+ down: ac,
7021
+ up: rc
7025
7022
  }, Symbol.toStringTag, { value: "Module" }));
7026
- async function id(t) {
7023
+ async function ic(t) {
7027
7024
  }
7028
- async function sd(t) {
7025
+ async function sc(t) {
7029
7026
  }
7030
- const ud = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7027
+ const uc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7031
7028
  __proto__: null,
7032
- down: sd,
7033
- up: id
7029
+ down: sc,
7030
+ up: ic
7034
7031
  }, Symbol.toStringTag, { value: "Module" }));
7035
- async function dd(t) {
7032
+ async function cc(t) {
7036
7033
  await t.schema.alterTable("logs").dropColumn("category").execute();
7037
7034
  }
7038
- async function cd(t) {
7035
+ async function dc(t) {
7039
7036
  await t.schema.alterTable("logs").addColumn("category", "varchar(255)", (e) => e.notNull()).execute();
7040
7037
  }
7041
- const ld = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7038
+ const lc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7042
7039
  __proto__: null,
7043
- down: cd,
7044
- up: dd
7040
+ down: dc,
7041
+ up: cc
7045
7042
  }, Symbol.toStringTag, { value: "Module" }));
7046
- async function _d(t) {
7043
+ async function _c(t) {
7047
7044
  await t.schema.alterTable("users").dropColumn("tags").execute();
7048
7045
  }
7049
- async function md(t) {
7046
+ async function mc(t) {
7050
7047
  await t.schema.alterTable("users").addColumn("tags", "varchar(255)").execute();
7051
7048
  }
7052
- const hd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7049
+ const hc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7053
7050
  __proto__: null,
7054
- down: md,
7055
- up: _d
7051
+ down: mc,
7052
+ up: _c
7056
7053
  }, Symbol.toStringTag, { value: "Module" }));
7057
- async function fd(t) {
7054
+ async function fc(t) {
7058
7055
  await t.schema.createIndex("logs_user_id").on("logs").column("user_id").execute(), await t.schema.createIndex("logs_tenant_id").on("logs").column("tenant_id").execute(), await t.schema.createIndex("logs_date").on("logs").column("date").execute();
7059
7056
  }
7060
- async function pd(t) {
7057
+ async function pc(t) {
7061
7058
  await t.schema.dropIndex("logs_user_id"), await t.schema.dropIndex("logs_tenant_id"), await t.schema.dropIndex("logs_date");
7062
7059
  }
7063
- const gd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7060
+ const gc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7064
7061
  __proto__: null,
7065
- down: pd,
7066
- up: fd
7062
+ down: pc,
7063
+ up: fc
7067
7064
  }, Symbol.toStringTag, { value: "Module" }));
7068
- async function yd(t) {
7065
+ async function yc(t) {
7069
7066
  await t.schema.alterTable("logs").dropColumn("details").execute(), await t.schema.alterTable("logs").addColumn("details", "varchar(8192)").execute();
7070
7067
  }
7071
- async function wd(t) {
7068
+ async function wc(t) {
7072
7069
  await t.schema.alterTable("logs").dropColumn("details").execute(), await t.schema.alterTable("logs").addColumn("details", "varchar(2048)").execute();
7073
7070
  }
7074
- const Nd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7071
+ const Nc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7075
7072
  __proto__: null,
7076
- down: wd,
7077
- up: yd
7073
+ down: wc,
7074
+ up: yc
7078
7075
  }, Symbol.toStringTag, { value: "Module" }));
7079
- async function vd(t) {
7076
+ async function vc(t) {
7080
7077
  await t.schema.alterTable("logs").addColumn("user_name", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("auth0_client", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("isMobile", "boolean").execute(), await t.schema.alterTable("logs").addColumn("connection", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("connection_id", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("audience", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("scope", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("strategy", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("strategy_type", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("hostname", "varchar(255)").execute(), await t.schema.alterTable("logs").addColumn("session_connection", "varchar(255)").execute();
7081
7078
  }
7082
- async function Cd(t) {
7079
+ async function Cc(t) {
7083
7080
  await t.schema.alterTable("logs").dropColumn("user_name").execute(), await t.schema.alterTable("logs").dropColumn("auth0_client").execute(), await t.schema.alterTable("logs").dropColumn("isMobile").execute(), await t.schema.alterTable("logs").dropColumn("connection").execute(), await t.schema.alterTable("logs").dropColumn("connection_id").execute(), await t.schema.alterTable("logs").dropColumn("audience").execute(), await t.schema.alterTable("logs").dropColumn("scope").execute(), await t.schema.alterTable("logs").dropColumn("strategy").execute(), await t.schema.alterTable("logs").dropColumn("strategy_type").execute(), await t.schema.alterTable("logs").dropColumn("hostname").execute(), await t.schema.alterTable("logs").dropColumn("session_connection").execute();
7084
7081
  }
7085
- const bd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7082
+ const bc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7086
7083
  __proto__: null,
7087
- down: Cd,
7088
- up: vd
7084
+ down: Cc,
7085
+ up: vc
7089
7086
  }, Symbol.toStringTag, { value: "Module" }));
7090
- async function Od(t) {
7087
+ async function Oc(t) {
7091
7088
  await t.schema.createIndex("users_name_index").on("users").column("name").execute();
7092
7089
  }
7093
- async function xd(t) {
7090
+ async function xc(t) {
7094
7091
  await t.schema.dropIndex("users_name_index").execute();
7095
7092
  }
7096
- const Td = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7093
+ const Tc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7097
7094
  __proto__: null,
7098
- down: xd,
7099
- up: Od
7095
+ down: xc,
7096
+ up: Oc
7100
7097
  }, Symbol.toStringTag, { value: "Module" }));
7101
- async function Sd(t) {
7098
+ async function Sc(t) {
7102
7099
  }
7103
- async function kd(t) {
7100
+ async function kc(t) {
7104
7101
  await t.schema.alterTable("users").dropConstraint("unique_email_provider").execute();
7105
7102
  }
7106
- const Ed = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7103
+ const Ec = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7107
7104
  __proto__: null,
7108
- down: kd,
7109
- up: Sd
7105
+ down: kc,
7106
+ up: Sc
7110
7107
  }, Symbol.toStringTag, { value: "Module" }));
7111
- async function Id(t) {
7108
+ async function Ic(t) {
7112
7109
  await t.schema.alterTable("otps").dropColumn("state").execute(), await t.schema.alterTable("otps").addColumn("state", "varchar(8192)").execute();
7113
7110
  }
7114
- async function Ad(t) {
7111
+ async function Ac(t) {
7115
7112
  await t.schema.alterTable("otps").dropColumn("state").execute(), await t.schema.alterTable("otps").addColumn("state", "varchar(1024)").execute();
7116
7113
  }
7117
- const Pd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7114
+ const Pc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7118
7115
  __proto__: null,
7119
- down: Ad,
7120
- up: Id
7116
+ down: Ac,
7117
+ up: Ic
7121
7118
  }, Symbol.toStringTag, { value: "Module" }));
7122
- async function $d(t) {
7119
+ async function $c(t) {
7123
7120
  await t.schema.alterTable("tickets").dropColumn("state").execute(), await t.schema.alterTable("tickets").addColumn("state", "varchar(8192)").execute();
7124
7121
  }
7125
- async function Dd(t) {
7122
+ async function Dc(t) {
7126
7123
  await t.schema.alterTable("tickets").dropColumn("state").execute(), await t.schema.alterTable("tickets").addColumn("state", "varchar(1024)").execute();
7127
7124
  }
7128
- const Rd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7125
+ const Rc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7129
7126
  __proto__: null,
7130
- down: Dd,
7131
- up: $d
7127
+ down: Dc,
7128
+ up: $c
7132
7129
  }, Symbol.toStringTag, { value: "Module" }));
7133
- async function zd(t) {
7130
+ async function zc(t) {
7134
7131
  await t.schema.createTable("branding").addColumn(
7135
7132
  "tenant_id",
7136
7133
  "varchar(255)",
7137
7134
  (e) => e.references("tenants.id").onDelete("cascade").notNull().primaryKey()
7138
7135
  ).addColumn("logo_url", "varchar(512)").addColumn("favicon_url", "varchar(512)").addColumn("font_url", "varchar(512)").addColumn("colors_primary", "varchar(8)").addColumn("colors_page_background_type", "varchar(32)").addColumn("colors_page_background_start", "varchar(8)").addColumn("colors_page_background_end", "varchar(8)").addColumn("colors_page_background_angle_dev", "integer").execute();
7139
7136
  }
7140
- async function Fd(t) {
7137
+ async function Fc(t) {
7141
7138
  await t.schema.dropTable("branding").execute();
7142
7139
  }
7143
- const jd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7140
+ const jc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7144
7141
  __proto__: null,
7145
- down: Fd,
7146
- up: zd
7142
+ down: Fc,
7143
+ up: zc
7147
7144
  }, Symbol.toStringTag, { value: "Module" }));
7148
- async function qd(t) {
7145
+ async function qc(t) {
7149
7146
  }
7150
- async function Ld(t) {
7147
+ async function Lc(t) {
7151
7148
  }
7152
- const Jd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7149
+ const Jc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7153
7150
  __proto__: null,
7154
- down: Ld,
7155
- up: qd
7151
+ down: Lc,
7152
+ up: qc
7156
7153
  }, Symbol.toStringTag, { value: "Module" }));
7157
- async function Md(t) {
7154
+ async function Mc(t) {
7158
7155
  }
7159
- async function Bd(t) {
7156
+ async function Bc(t) {
7160
7157
  }
7161
- const Wd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7158
+ const Wc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7162
7159
  __proto__: null,
7163
- down: Bd,
7164
- up: Md
7160
+ down: Bc,
7161
+ up: Mc
7165
7162
  }, Symbol.toStringTag, { value: "Module" }));
7166
- async function Kd(t) {
7163
+ async function Kc(t) {
7167
7164
  }
7168
- async function Ud(t) {
7165
+ async function Uc(t) {
7169
7166
  }
7170
- const Qd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7167
+ const Qc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7171
7168
  __proto__: null,
7172
- down: Ud,
7173
- up: Kd
7169
+ down: Uc,
7170
+ up: Kc
7174
7171
  }, Symbol.toStringTag, { value: "Module" }));
7175
- async function Vd(t) {
7172
+ async function Vc(t) {
7176
7173
  }
7177
- async function Gd(t) {
7174
+ async function Gc(t) {
7178
7175
  }
7179
- const Yd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7176
+ const Yc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7180
7177
  __proto__: null,
7181
- down: Gd,
7182
- up: Vd
7178
+ down: Gc,
7179
+ up: Vc
7183
7180
  }, Symbol.toStringTag, { value: "Module" }));
7184
- async function Hd(t) {
7181
+ async function Hc(t) {
7185
7182
  await t.schema.createTable("authentication_codes").addColumn(
7186
7183
  "tenant_id",
7187
7184
  "varchar(255)",
@@ -7192,55 +7189,55 @@ async function Hd(t) {
7192
7189
  (e) => e.references("applications.id").onDelete("cascade").notNull()
7193
7190
  ).addColumn("user_id", "varchar(255)", (e) => e.notNull()).addColumn("nonce", "varchar(255)").addColumn("state", "varchar(8192)").addColumn("scope", "varchar(1024)").addColumn("response_type", "varchar(256)").addColumn("response_mode", "varchar(256)").addColumn("redirect_uri", "varchar(1024)").addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("expires_at", "varchar(255)", (e) => e.notNull()).addColumn("used_at", "varchar(255)").execute();
7194
7191
  }
7195
- async function Xd(t) {
7192
+ async function Xc(t) {
7196
7193
  await t.schema.dropTable("authentication_codes").execute();
7197
7194
  }
7198
- const Zd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7195
+ const Zc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7199
7196
  __proto__: null,
7200
- down: Xd,
7201
- up: Hd
7197
+ down: Xc,
7198
+ up: Hc
7202
7199
  }, Symbol.toStringTag, { value: "Module" }));
7203
- async function ec(t) {
7200
+ async function ed(t) {
7204
7201
  }
7205
- async function tc(t) {
7202
+ async function td(t) {
7206
7203
  }
7207
- const nc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7204
+ const nd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7208
7205
  __proto__: null,
7209
- down: tc,
7210
- up: ec
7206
+ down: td,
7207
+ up: ed
7211
7208
  }, Symbol.toStringTag, { value: "Module" }));
7212
- async function rc(t) {
7209
+ async function rd(t) {
7213
7210
  await t.schema.alterTable("otps").addColumn("ip", "varchar(64)").execute();
7214
7211
  }
7215
- async function ac(t) {
7212
+ async function ad(t) {
7216
7213
  await t.schema.alterTable("otps").dropColumn("ip").execute();
7217
7214
  }
7218
- const oc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7215
+ const od = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7219
7216
  __proto__: null,
7220
- down: ac,
7221
- up: rc
7217
+ down: ad,
7218
+ up: rd
7222
7219
  }, Symbol.toStringTag, { value: "Module" }));
7223
- async function ic(t) {
7220
+ async function id(t) {
7224
7221
  await t.schema.alterTable("logs").dropColumn("user_agent").execute(), await t.schema.alterTable("logs").addColumn("user_agent", "varchar(1024)").execute();
7225
7222
  }
7226
- async function sc(t) {
7223
+ async function sd(t) {
7227
7224
  await t.schema.alterTable("logs").dropColumn("user_agent").execute(), await t.schema.alterTable("logs").addColumn("user_agent", "varchar(255)").execute();
7228
7225
  }
7229
- const uc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7226
+ const ud = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7230
7227
  __proto__: null,
7231
- down: sc,
7232
- up: ic
7228
+ down: sd,
7229
+ up: id
7233
7230
  }, Symbol.toStringTag, { value: "Module" }));
7234
- async function dc(t) {
7231
+ async function cd(t) {
7235
7232
  }
7236
- async function cc(t) {
7233
+ async function dd(t) {
7237
7234
  }
7238
- const lc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7235
+ const ld = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7239
7236
  __proto__: null,
7240
- down: cc,
7241
- up: dc
7237
+ down: dd,
7238
+ up: cd
7242
7239
  }, Symbol.toStringTag, { value: "Module" }));
7243
- async function _c(t) {
7240
+ async function _d(t) {
7244
7241
  await t.schema.createTable("hooks").addColumn("hook_id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn(
7245
7242
  "tenant_id",
7246
7243
  "varchar(255)",
@@ -7251,33 +7248,33 @@ async function _c(t) {
7251
7248
  (e) => e.defaultTo(!1).notNull()
7252
7249
  ).addColumn("priority", "integer").execute();
7253
7250
  }
7254
- async function mc(t) {
7251
+ async function md(t) {
7255
7252
  await t.schema.dropTable("hooks").execute();
7256
7253
  }
7257
- const hc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7254
+ const hd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7258
7255
  __proto__: null,
7259
- down: mc,
7260
- up: _c
7256
+ down: md,
7257
+ up: _d
7261
7258
  }, Symbol.toStringTag, { value: "Module" }));
7262
- async function fc(t) {
7259
+ async function fd(t) {
7263
7260
  }
7264
- async function pc(t) {
7261
+ async function pd(t) {
7265
7262
  }
7266
- const gc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7263
+ const gd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7267
7264
  __proto__: null,
7268
- down: pc,
7269
- up: fc
7265
+ down: pd,
7266
+ up: fd
7270
7267
  }, Symbol.toStringTag, { value: "Module" }));
7271
- async function yc(t) {
7268
+ async function yd(t) {
7272
7269
  }
7273
- async function wc(t) {
7270
+ async function wd(t) {
7274
7271
  }
7275
- const Nc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7272
+ const Nd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7276
7273
  __proto__: null,
7277
- down: wc,
7278
- up: yc
7274
+ down: wd,
7275
+ up: yd
7279
7276
  }, Symbol.toStringTag, { value: "Module" }));
7280
- async function vc(t) {
7277
+ async function vd(t) {
7281
7278
  await t.schema.createTable("logins").addColumn("login_id", "varchar(255)", (e) => e.primaryKey()).addColumn(
7282
7279
  "tenant_id",
7283
7280
  "varchar(255)",
@@ -7294,7 +7291,7 @@ async function vc(t) {
7294
7291
  (e) => e.onDelete("cascade")
7295
7292
  ).addColumn("code_type", "varchar(255)", (e) => e.notNull()).addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("expires_at", "varchar(255)", (e) => e.notNull()).addColumn("used_at", "varchar(255)").execute();
7296
7293
  }
7297
- async function Cc(t) {
7294
+ async function Cd(t) {
7298
7295
  await t.schema.dropTable("logins").execute(), await t.schema.alterTable("passwords").dropColumn("algorithm").execute(), await t.schema.dropTable("codes").execute(), await t.schema.createTable("codes").addColumn("id", "varchar(255)", (e) => e.primaryKey()).addColumn("code", "varchar(255)", (e) => e.notNull()).addColumn("user_id", "varchar(255)").addColumn("tenant_id", "varchar(255)").addForeignKeyConstraint(
7299
7296
  "codes_user_id_tenant_id_constraint",
7300
7297
  ["user_id", "tenant_id"],
@@ -7303,90 +7300,90 @@ async function Cc(t) {
7303
7300
  (e) => e.onDelete("cascade")
7304
7301
  ).addColumn("type", "varchar(255)", (e) => e.notNull()).addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("expires_at", "varchar(255)", (e) => e.notNull()).addColumn("used_at", "varchar(255)").execute();
7305
7302
  }
7306
- const bc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7303
+ const bd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7307
7304
  __proto__: null,
7308
- down: Cc,
7309
- up: vc
7305
+ down: Cd,
7306
+ up: vd
7310
7307
  }, Symbol.toStringTag, { value: "Module" }));
7311
- async function Oc(t) {
7308
+ async function Od(t) {
7312
7309
  }
7313
- async function xc(t) {
7310
+ async function xd(t) {
7314
7311
  }
7315
- const Tc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7312
+ const Td = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7316
7313
  __proto__: null,
7317
- down: xc,
7318
- up: Oc
7314
+ down: xd,
7315
+ up: Od
7319
7316
  }, Symbol.toStringTag, { value: "Module" }));
7320
- async function Sc(t) {
7317
+ async function Sd(t) {
7321
7318
  await t.schema.alterTable("logins").addColumn("auth0Client", "varchar(256)").execute();
7322
7319
  }
7323
- async function kc(t) {
7320
+ async function kd(t) {
7324
7321
  await t.schema.alterTable("logins").dropColumn("auth0Client").execute();
7325
7322
  }
7326
- const Ec = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7323
+ const Ed = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7327
7324
  __proto__: null,
7328
- down: kc,
7329
- up: Sc
7325
+ down: kd,
7326
+ up: Sd
7330
7327
  }, Symbol.toStringTag, { value: "Module" }));
7331
- async function Ic(t) {
7328
+ async function Id(t) {
7332
7329
  await t.schema.alterTable("logins").dropColumn("authParams_state").execute(), await t.schema.alterTable("logins").addColumn("authParams_state", "varchar(8192)").execute();
7333
7330
  }
7334
- async function Ac(t) {
7331
+ async function Ad(t) {
7335
7332
  await t.schema.alterTable("logins").dropColumn("authParams_state").execute(), await t.schema.alterTable("logins").addColumn("authParams_state", "varchar(511)").execute();
7336
7333
  }
7337
- const Pc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7334
+ const Pd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7338
7335
  __proto__: null,
7339
- down: Ac,
7340
- up: Ic
7336
+ down: Ad,
7337
+ up: Id
7341
7338
  }, Symbol.toStringTag, { value: "Module" }));
7342
- async function $c(t) {
7339
+ async function $d(t) {
7343
7340
  }
7344
- async function Dc(t) {
7341
+ async function Dd(t) {
7345
7342
  }
7346
- const Rc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7343
+ const Rd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7347
7344
  __proto__: null,
7348
- down: Dc,
7349
- up: $c
7345
+ down: Dd,
7346
+ up: $d
7350
7347
  }, Symbol.toStringTag, { value: "Module" }));
7351
- async function zc(t) {
7348
+ async function zd(t) {
7352
7349
  }
7353
- async function Fc(t) {
7350
+ async function Fd(t) {
7354
7351
  }
7355
- const jc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7352
+ const jd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7356
7353
  __proto__: null,
7357
- down: Fc,
7358
- up: zc
7354
+ down: Fd,
7355
+ up: zd
7359
7356
  }, Symbol.toStringTag, { value: "Module" }));
7360
- async function qc(t) {
7357
+ async function qd(t) {
7361
7358
  await t.schema.alterTable("logins").addColumn("authParams_nonce", "varchar(255)").execute();
7362
7359
  }
7363
- async function Lc(t) {
7360
+ async function Ld(t) {
7364
7361
  await t.schema.alterTable("logins").dropColumn("nonce").execute();
7365
7362
  }
7366
- const Jc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7363
+ const Jd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7367
7364
  __proto__: null,
7368
- down: Lc,
7369
- up: qc
7365
+ down: Ld,
7366
+ up: qd
7370
7367
  }, Symbol.toStringTag, { value: "Module" }));
7371
- async function Mc(t) {
7368
+ async function Md(t) {
7372
7369
  }
7373
- async function Bc(t) {
7370
+ async function Bd(t) {
7374
7371
  }
7375
- const Wc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7372
+ const Wd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7376
7373
  __proto__: null,
7377
- down: Bc,
7378
- up: Mc
7374
+ down: Bd,
7375
+ up: Md
7379
7376
  }, Symbol.toStringTag, { value: "Module" }));
7380
- async function Kc(t) {
7377
+ async function Kd(t) {
7381
7378
  }
7382
- async function Uc(t) {
7379
+ async function Ud(t) {
7383
7380
  }
7384
- const Qc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7381
+ const Qd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7385
7382
  __proto__: null,
7386
- down: Uc,
7387
- up: Kc
7383
+ down: Ud,
7384
+ up: Kd
7388
7385
  }, Symbol.toStringTag, { value: "Module" }));
7389
- async function Vc(t) {
7386
+ async function Vd(t) {
7390
7387
  await t.schema.dropTable("codes").execute(), await t.schema.createTable("codes").addColumn("code_id", "varchar(255)", (e) => e.notNull()).addColumn(
7391
7388
  "tenant_id",
7392
7389
  "varchar(255)",
@@ -7402,7 +7399,7 @@ async function Vc(t) {
7402
7399
  "code_type"
7403
7400
  ]).execute();
7404
7401
  }
7405
- async function Gc(t) {
7402
+ async function Gd(t) {
7406
7403
  await t.schema.dropTable("codes").execute(), await t.schema.createTable("codes").addColumn("code_id", "varchar(255)", (e) => e.primaryKey()).addColumn(
7407
7404
  "tenant_id",
7408
7405
  "varchar(255)",
@@ -7415,15 +7412,15 @@ async function Gc(t) {
7415
7412
  (e) => e.onDelete("cascade")
7416
7413
  ).addColumn("code_type", "varchar(255)", (e) => e.notNull()).addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("expires_at", "varchar(255)", (e) => e.notNull()).addColumn("used_at", "varchar(255)").execute();
7417
7414
  }
7418
- const Yc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7415
+ const Yd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7419
7416
  __proto__: null,
7420
- down: Gc,
7421
- up: Vc
7417
+ down: Gd,
7418
+ up: Vd
7422
7419
  }, Symbol.toStringTag, { value: "Module" }));
7423
- async function Hc(t) {
7420
+ async function Hd(t) {
7424
7421
  await t.schema.dropTable("otps").execute(), await t.schema.dropTable("authentication_codes").execute();
7425
7422
  }
7426
- async function Xc(t) {
7423
+ async function Xd(t) {
7427
7424
  await t.schema.alterTable("keys").addColumn("private_key", "varchar(2048)").addColumn("public_key", "varchar(2048)").execute(), await t.schema.createTable("otps").addColumn(
7428
7425
  "tenant_id",
7429
7426
  "varchar(255)",
@@ -7442,10 +7439,10 @@ async function Xc(t) {
7442
7439
  (e) => e.references("applications.id").onDelete("cascade").notNull()
7443
7440
  ).addColumn("user_id", "varchar(255)", (e) => e.notNull()).addColumn("nonce", "varchar(255)").addColumn("state", "varchar(8192)").addColumn("scope", "varchar(1024)").addColumn("response_type", "varchar(256)").addColumn("response_mode", "varchar(256)").addColumn("redirect_uri", "varchar(1024)").addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("expires_at", "varchar(255)", (e) => e.notNull()).addColumn("used_at", "varchar(255)").execute();
7444
7441
  }
7445
- const Zc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7442
+ const Zd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7446
7443
  __proto__: null,
7447
- down: Xc,
7448
- up: Hc
7444
+ down: Xd,
7445
+ up: Hd
7449
7446
  }, Symbol.toStringTag, { value: "Module" }));
7450
7447
  async function el(t) {
7451
7448
  await t.schema.createIndex("IDX_logs_tenant_date_type_user").on("logs").columns(["tenant_id", "date", "type", "user_id"]).execute();
@@ -7494,14 +7491,14 @@ const ul = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7494
7491
  down: sl,
7495
7492
  up: il
7496
7493
  }, Symbol.toStringTag, { value: "Module" }));
7497
- async function dl(t) {
7498
- }
7499
7494
  async function cl(t) {
7500
7495
  }
7496
+ async function dl(t) {
7497
+ }
7501
7498
  const ll = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7502
7499
  __proto__: null,
7503
- down: cl,
7504
- up: dl
7500
+ down: dl,
7501
+ up: cl
7505
7502
  }, Symbol.toStringTag, { value: "Module" }));
7506
7503
  async function _l(t) {
7507
7504
  }
@@ -7750,14 +7747,14 @@ const u_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7750
7747
  down: s_,
7751
7748
  up: i_
7752
7749
  }, Symbol.toStringTag, { value: "Module" }));
7753
- async function d_(t) {
7754
- }
7755
7750
  async function c_(t) {
7756
7751
  }
7752
+ async function d_(t) {
7753
+ }
7757
7754
  const l_ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7758
7755
  __proto__: null,
7759
- down: c_,
7760
- up: d_
7756
+ down: d_,
7757
+ up: c_
7761
7758
  }, Symbol.toStringTag, { value: "Module" }));
7762
7759
  async function __(t) {
7763
7760
  await t.schema.createTable("sessions").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addForeignKeyConstraint(
@@ -8076,16 +8073,16 @@ const um = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8076
8073
  down: sm,
8077
8074
  up: im
8078
8075
  }, Symbol.toStringTag, { value: "Module" }));
8079
- async function dm(t) {
8076
+ async function cm(t) {
8080
8077
  await t.schema.createTable("organizations").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(191)", (e) => e.notNull()).addColumn("name", "varchar(256)", (e) => e.notNull()).addColumn("display_name", "varchar(256)").addColumn("branding", "text").addColumn("metadata", "text").addColumn("enabled_connections", "text").addColumn("token_quota", "text").addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("updated_at", "varchar(35)", (e) => e.notNull()).execute(), await t.schema.createIndex("idx_organizations_tenant_id").on("organizations").column("tenant_id").execute(), await t.schema.createIndex("idx_organizations_tenant_name_unique").on("organizations").columns(["tenant_id", "name"]).unique().execute();
8081
8078
  }
8082
- async function cm(t) {
8079
+ async function dm(t) {
8083
8080
  await t.schema.dropTable("organizations").execute();
8084
8081
  }
8085
8082
  const lm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8086
8083
  __proto__: null,
8087
- down: cm,
8088
- up: dm
8084
+ down: dm,
8085
+ up: cm
8089
8086
  }, Symbol.toStringTag, { value: "Module" }));
8090
8087
  async function _m(t) {
8091
8088
  await t.schema.createTable("user_organizations").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(191)", (e) => e.notNull()).addColumn("user_id", "varchar(191)", (e) => e.notNull()).addColumn("organization_id", "varchar(21)", (e) => e.notNull()).addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("updated_at", "varchar(35)", (e) => e.notNull()).addUniqueConstraint("user_organizations_unique", [
@@ -8227,10 +8224,10 @@ async function Cm(t) {
8227
8224
  ), console.log(
8228
8225
  `Dropped foreign key constraint ${o} from ${u}`
8229
8226
  );
8230
- } catch (d) {
8227
+ } catch (c) {
8231
8228
  console.warn(
8232
8229
  `Failed to drop constraint ${o} from ${u}:`,
8233
- d
8230
+ c
8234
8231
  );
8235
8232
  }
8236
8233
  }
@@ -8513,42 +8510,42 @@ const Km = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8513
8510
  n16_userLocale: Qu,
8514
8511
  n17_signingKeys: Yu,
8515
8512
  n18_logsFields: Zu,
8516
- n19_connectionsUserinfo: nd,
8517
- n20_missingFields: od,
8518
- n21_sessionDeletedAt: ud,
8519
- n22_dropLogsFields: ld,
8520
- n23_dropUsersFields: hd,
8521
- n24_logsIndexes: gd,
8522
- n25_logDescMaxLength: Nd,
8523
- n26_logsTableExtraFields: bd,
8524
- n27_usersTableNameIndex: Td,
8525
- n28_usersEmailConstrain: Ed,
8526
- n29_increaseOtpStateLength: Pd,
8527
- n30_increaseTicketStateLength: Rd,
8528
- n31_branding: jd,
8529
- n32_indexesAndNotNull: Jd,
8530
- n33_vendorIdInUniversalLoginSession: Wd,
8531
- n34_auth0ClientInUniversalLoginSession: Qd,
8532
- n35_increaseUniversalSessionStateLength: Yd,
8533
- n36_authenticationCodes: Zd,
8534
- n37_disableSignUps: nc,
8535
- n38_otpIpAddress: oc,
8536
- n39_increaseUserAgentLength: uc,
8537
- n40_userId: lc,
8538
- n41_hooks: hc,
8539
- n42_userIdIndexes: gc,
8540
- n43_userIdIndexes: Nc,
8541
- n44_codes: bc,
8542
- n45_hookProperties: Tc,
8543
- n46_loginAuth0Client: Ec,
8544
- n47_loginAuth0Client: Pc,
8545
- n48_saml: Rc,
8546
- n49_removeFields: jc,
8547
- n50_authParamsNonce: Jc,
8548
- n51_connectionid: Wc,
8549
- n52_cert: Qc,
8550
- n53_codes_primary_key: Yc,
8551
- n54_cleanup_tables: Zc,
8513
+ n19_connectionsUserinfo: nc,
8514
+ n20_missingFields: oc,
8515
+ n21_sessionDeletedAt: uc,
8516
+ n22_dropLogsFields: lc,
8517
+ n23_dropUsersFields: hc,
8518
+ n24_logsIndexes: gc,
8519
+ n25_logDescMaxLength: Nc,
8520
+ n26_logsTableExtraFields: bc,
8521
+ n27_usersTableNameIndex: Tc,
8522
+ n28_usersEmailConstrain: Ec,
8523
+ n29_increaseOtpStateLength: Pc,
8524
+ n30_increaseTicketStateLength: Rc,
8525
+ n31_branding: jc,
8526
+ n32_indexesAndNotNull: Jc,
8527
+ n33_vendorIdInUniversalLoginSession: Wc,
8528
+ n34_auth0ClientInUniversalLoginSession: Qc,
8529
+ n35_increaseUniversalSessionStateLength: Yc,
8530
+ n36_authenticationCodes: Zc,
8531
+ n37_disableSignUps: nd,
8532
+ n38_otpIpAddress: od,
8533
+ n39_increaseUserAgentLength: ud,
8534
+ n40_userId: ld,
8535
+ n41_hooks: hd,
8536
+ n42_userIdIndexes: gd,
8537
+ n43_userIdIndexes: Nd,
8538
+ n44_codes: bd,
8539
+ n45_hookProperties: Td,
8540
+ n46_loginAuth0Client: Ed,
8541
+ n47_loginAuth0Client: Pd,
8542
+ n48_saml: Rd,
8543
+ n49_removeFields: jd,
8544
+ n50_authParamsNonce: Jd,
8545
+ n51_connectionid: Wd,
8546
+ n52_cert: Qd,
8547
+ n53_codes_primary_key: Yd,
8548
+ n54_cleanup_tables: Zd,
8552
8549
  n55_logs_index: nl,
8553
8550
  n56_application_fields: ol,
8554
8551
  n57_prompt_settings: ul,