@authhero/kysely-adapter 10.35.0 → 10.36.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.
@@ -7,7 +7,7 @@ var z = (t, e, r) => Re(t, typeof e != "symbol" ? e + "" : e, r), V = (t, e, r)
7
7
  var d = (t, e, r) => (V(t, e, "read from private field"), r ? r.call(t) : e.get(t)), N = (t, e, r) => e.has(t) ? ue("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), L = (t, e, r, a) => (V(t, e, "write to private field"), a ? a.call(t, r) : e.set(t, r), r), m = (t, e, r) => (V(t, e, "access private method"), r);
8
8
  import { parseUserId as ae, codeSchema as Ke, connectionSchema as Ue, loginSessionSchema as Be, promptSettingSchema as Qe, formSchema as Q, resourceServerSchema as qe } from "@authhero/adapter-interfaces";
9
9
  import "@hono/zod-openapi";
10
- var X = class extends Error {
10
+ var Y = class extends Error {
11
11
  constructor(e = 500, r) {
12
12
  super(r == null ? void 0 : r.message, { cause: r == null ? void 0 : r.cause });
13
13
  z(this, "res");
@@ -39,7 +39,7 @@ function Ve(t) {
39
39
  try {
40
40
  await t.insertInto("users").values(n).execute();
41
41
  } catch (s) {
42
- throw s.code === "SQLITE_CONSTRAINT_UNIQUE" || s.message.includes("AlreadyExists") ? new X(409, { message: "User already exists" }) : new X(500, { message: `${s.code}, ${s.message}` });
42
+ throw s.code === "SQLITE_CONSTRAINT_UNIQUE" || s.message.includes("AlreadyExists") ? new Y(409, { message: "User already exists" }) : new Y(500, { message: `${s.code}, ${s.message}` });
43
43
  }
44
44
  return {
45
45
  ...n,
@@ -234,7 +234,7 @@ function ge(t, e) {
234
234
  }
235
235
  return r;
236
236
  }
237
- function Xe(t) {
237
+ function Ye(t) {
238
238
  return async (e, r, a) => {
239
239
  const o = A({
240
240
  ...a,
@@ -245,7 +245,7 @@ function Xe(t) {
245
245
  return (await t.updateTable("users").set(o).where("users.tenant_id", "=", e).where("users.user_id", "=", r).execute()).length === 1;
246
246
  };
247
247
  }
248
- function Ye(t) {
248
+ function Xe(t) {
249
249
  return async (e, r, a, o) => {
250
250
  const n = { linked_to: null };
251
251
  return (await t.updateTable("users").set(n).where("users.tenant_id", "=", e).where("users.user_id", "=", `${a}|${o}`).where("users.linked_to", "=", `${r}`).execute()).length === 1;
@@ -257,9 +257,9 @@ function Ze(t) {
257
257
  remove: He(t),
258
258
  get: We(t),
259
259
  list: Ge(t),
260
- update: Xe(t),
260
+ update: Ye(t),
261
261
  // TODO - think about this more when other issues fixed
262
- unlink: Ye(t)
262
+ unlink: Xe(t)
263
263
  };
264
264
  }
265
265
  const et = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
@@ -748,7 +748,7 @@ function Jt(t) {
748
748
  return null;
749
749
  const a = await t.selectFrom("tenants").selectAll().where("id", "=", r.tenant_id).executeTakeFirst();
750
750
  if (!a)
751
- throw new X(404, { message: "Tenant not found" });
751
+ throw new Y(404, { message: "Tenant not found" });
752
752
  const o = await t.selectFrom("connections").where("tenant_id", "=", r.tenant_id).selectAll().execute();
753
753
  return {
754
754
  ...r,
@@ -850,7 +850,7 @@ function Ht(t) {
850
850
  } : null;
851
851
  };
852
852
  }
853
- function Xt(t) {
853
+ function Yt(t) {
854
854
  return {
855
855
  create: Qt(t),
856
856
  get: Wt(t),
@@ -860,7 +860,7 @@ function Xt(t) {
860
860
  update: Gt(t)
861
861
  };
862
862
  }
863
- function Yt(t) {
863
+ function Xt(t) {
864
864
  return async (e) => {
865
865
  const [r] = await t.selectFrom("branding").where("branding.tenant_id", "=", e).selectAll().execute();
866
866
  if (!r)
@@ -920,7 +920,7 @@ function Zt(t) {
920
920
  }
921
921
  function er(t) {
922
922
  return {
923
- get: Yt(t),
923
+ get: Xt(t),
924
924
  set: Zt(t)
925
925
  };
926
926
  }
@@ -1645,7 +1645,7 @@ function Hr(t) {
1645
1645
  }
1646
1646
  };
1647
1647
  }
1648
- function Xr(t) {
1648
+ function Yr(t) {
1649
1649
  return async (e, r, a = { page: 0, per_page: 50, include_totals: !1 }) => (await t.selectFrom("role_permissions").leftJoin(
1650
1650
  "resource_servers",
1651
1651
  (s) => s.onRef(
@@ -1674,11 +1674,11 @@ function Xr(t) {
1674
1674
  created_at: s.created_at
1675
1675
  }));
1676
1676
  }
1677
- function Yr(t) {
1677
+ function Xr(t) {
1678
1678
  return {
1679
1679
  assign: Gr(t),
1680
1680
  remove: Hr(t),
1681
- list: Xr(t)
1681
+ list: Yr(t)
1682
1682
  };
1683
1683
  }
1684
1684
  function Zr(t) {
@@ -1761,6 +1761,53 @@ function ra(t) {
1761
1761
  };
1762
1762
  }
1763
1763
  function aa(t) {
1764
+ return async (e, r) => await t.selectFrom("user_roles as ur").innerJoin(
1765
+ "roles as r",
1766
+ (o) => o.onRef("ur.role_id", "=", "r.id").onRef("ur.tenant_id", "=", "r.tenant_id")
1767
+ ).select([
1768
+ "r.id",
1769
+ "r.name",
1770
+ "r.description",
1771
+ "r.created_at",
1772
+ "r.updated_at"
1773
+ ]).where("ur.tenant_id", "=", e).where("ur.user_id", "=", r).execute();
1774
+ }
1775
+ function na(t) {
1776
+ return async (e, r, a) => {
1777
+ if (a.length === 0) return !0;
1778
+ const o = (/* @__PURE__ */ new Date()).toISOString();
1779
+ try {
1780
+ for (const n of a)
1781
+ try {
1782
+ await t.insertInto("user_roles").values({ tenant_id: e, user_id: r, role_id: n, created_at: o }).execute();
1783
+ } catch (s) {
1784
+ if (s.code === "SQLITE_CONSTRAINT_PRIMARYKEY" || s.code === "SQLITE_CONSTRAINT_UNIQUE")
1785
+ continue;
1786
+ throw s;
1787
+ }
1788
+ return !0;
1789
+ } catch (n) {
1790
+ return console.error("Error assigning user roles:", n), !1;
1791
+ }
1792
+ };
1793
+ }
1794
+ function oa(t) {
1795
+ return async (e, r, a) => {
1796
+ try {
1797
+ return a.length && await t.deleteFrom("user_roles").where("tenant_id", "=", e).where("user_id", "=", r).where((o) => o("role_id", "in", a)).execute(), !0;
1798
+ } catch (o) {
1799
+ return console.error("Error removing user roles:", o), !1;
1800
+ }
1801
+ };
1802
+ }
1803
+ function sa(t) {
1804
+ return {
1805
+ list: aa(t),
1806
+ assign: na(t),
1807
+ remove: oa(t)
1808
+ };
1809
+ }
1810
+ function ia(t) {
1764
1811
  return t[t.length - 1];
1765
1812
  }
1766
1813
  function y(t) {
@@ -1776,7 +1823,7 @@ const B = y({
1776
1823
  name: t
1777
1824
  });
1778
1825
  }
1779
- }), Y = y({
1826
+ }), X = y({
1780
1827
  is(t) {
1781
1828
  return t.kind === "SchemableIdentifierNode";
1782
1829
  },
@@ -1793,7 +1840,7 @@ const B = y({
1793
1840
  identifier: B.create(e)
1794
1841
  });
1795
1842
  }
1796
- }), na = y({
1843
+ }), la = y({
1797
1844
  is(t) {
1798
1845
  return t.kind === "AliasNode";
1799
1846
  },
@@ -1811,18 +1858,18 @@ const B = y({
1811
1858
  create(t) {
1812
1859
  return y({
1813
1860
  kind: "TableNode",
1814
- table: Y.create(t)
1861
+ table: X.create(t)
1815
1862
  });
1816
1863
  },
1817
1864
  createWithSchema(t, e) {
1818
1865
  return y({
1819
1866
  kind: "TableNode",
1820
- table: Y.createWithSchema(t, e)
1867
+ table: X.createWithSchema(t, e)
1821
1868
  });
1822
1869
  }
1823
1870
  });
1824
1871
  var q;
1825
- class oa {
1872
+ class ca {
1826
1873
  constructor() {
1827
1874
  z(this, "nodeStack", []);
1828
1875
  N(this, q, y({
@@ -2656,7 +2703,7 @@ class oa {
2656
2703
  }
2657
2704
  }
2658
2705
  q = new WeakMap();
2659
- const sa = y({
2706
+ const da = y({
2660
2707
  AlterTableNode: !0,
2661
2708
  CreateIndexNode: !0,
2662
2709
  CreateSchemaNode: !0,
@@ -2676,7 +2723,7 @@ const sa = y({
2676
2723
  MergeQueryNode: !0
2677
2724
  });
2678
2725
  var M, k, $, w, ye, ve, Ne, P, Z, Ce;
2679
- class ia extends oa {
2726
+ class ua extends ca {
2680
2727
  constructor(r) {
2681
2728
  super();
2682
2729
  N(this, w);
@@ -2717,10 +2764,10 @@ class ia extends oa {
2717
2764
  }
2718
2765
  }
2719
2766
  M = new WeakMap(), k = new WeakMap(), $ = new WeakMap(), w = new WeakSet(), ye = function(r) {
2720
- return r.kind in sa;
2767
+ return r.kind in da;
2721
2768
  }, ve = function(r) {
2722
2769
  const a = /* @__PURE__ */ new Set();
2723
- if ("name" in r && r.name && Y.is(r.name) && m(this, w, Z).call(this, r.name, a), "from" in r && r.from)
2770
+ if ("name" in r && r.name && X.is(r.name) && m(this, w, Z).call(this, r.name, a), "from" in r && r.from)
2724
2771
  for (const o of r.from.froms)
2725
2772
  m(this, w, P).call(this, o, a);
2726
2773
  if ("into" in r && r.into && m(this, w, P).call(this, r.into, a), "table" in r && r.table && m(this, w, P).call(this, r.table, a), "joins" in r && r.joins)
@@ -2731,7 +2778,7 @@ M = new WeakMap(), k = new WeakMap(), $ = new WeakMap(), w = new WeakSet(), ye =
2731
2778
  const a = /* @__PURE__ */ new Set();
2732
2779
  return "with" in r && r.with && m(this, w, Ce).call(this, r.with, a), a;
2733
2780
  }, P = function(r, a) {
2734
- const o = W.is(r) ? r : na.is(r) && W.is(r.node) ? r.node : null;
2781
+ const o = W.is(r) ? r : la.is(r) && W.is(r.node) ? r.node : null;
2735
2782
  o && m(this, w, Z).call(this, o.table, a);
2736
2783
  }, Z = function(r, a) {
2737
2784
  const o = r.identifier.name;
@@ -2743,10 +2790,10 @@ M = new WeakMap(), k = new WeakMap(), $ = new WeakMap(), w = new WeakSet(), ye =
2743
2790
  }
2744
2791
  };
2745
2792
  var R;
2746
- class la {
2793
+ class ma {
2747
2794
  constructor(e) {
2748
2795
  N(this, R);
2749
- L(this, R, new ia(e));
2796
+ L(this, R, new ua(e));
2750
2797
  }
2751
2798
  transformQuery(e) {
2752
2799
  return d(this, R).transformNode(e.node);
@@ -2756,7 +2803,7 @@ class la {
2756
2803
  }
2757
2804
  }
2758
2805
  R = new WeakMap();
2759
- class ca {
2806
+ class _a {
2760
2807
  transformQuery(e) {
2761
2808
  return e.node;
2762
2809
  }
@@ -2764,7 +2811,7 @@ class ca {
2764
2811
  return e.result;
2765
2812
  }
2766
2813
  }
2767
- const da = "kysely_migration", fe = "kysely_migration_lock", ua = !1, G = "migration_lock", ma = y({ __noMigrations__: !0 });
2814
+ const ha = "kysely_migration", fe = "kysely_migration_lock", fa = !1, G = "migration_lock", pa = y({ __noMigrations__: !0 });
2768
2815
  var p, i, E, x, T, j, xe, S, Te, Se, Oe, ke, $e, ee, F, te, Ie, De, Pe, re, je, Fe, Me, Ae, ze, J;
2769
2816
  class be {
2770
2817
  constructor(e) {
@@ -2863,7 +2910,7 @@ class be {
2863
2910
  */
2864
2911
  async migrateTo(e) {
2865
2912
  return m(this, i, E).call(this, ({ migrations: r, executedMigrations: a, pendingMigrations: o }) => {
2866
- if (e === ma)
2913
+ if (e === pa)
2867
2914
  return { direction: "Down", step: 1 / 0 };
2868
2915
  if (!r.find((l) => l.name === e))
2869
2916
  throw new Error(`migration "${e}" doesn't exist`);
@@ -2922,13 +2969,13 @@ p = new WeakMap(), i = new WeakSet(), E = async function(e) {
2922
2969
  }, x = function() {
2923
2970
  return d(this, p).migrationTableSchema;
2924
2971
  }, T = function() {
2925
- return d(this, p).migrationTableName ?? da;
2972
+ return d(this, p).migrationTableName ?? ha;
2926
2973
  }, j = function() {
2927
2974
  return d(this, p).migrationLockTableName ?? fe;
2928
2975
  }, xe = function() {
2929
- return d(this, p).allowUnorderedMigrations ?? ua;
2976
+ return d(this, p).allowUnorderedMigrations ?? fa;
2930
2977
  }, S = function() {
2931
- return d(this, i, x) ? new la(d(this, i, x)) : new ca();
2978
+ return d(this, i, x) ? new ma(d(this, i, x)) : new _a();
2932
2979
  }, Te = async function() {
2933
2980
  await m(this, i, Se).call(this), await m(this, i, Oe).call(this), await m(this, i, ke).call(this), await m(this, i, $e).call(this);
2934
2981
  }, Se = async function() {
@@ -2997,7 +3044,7 @@ p = new WeakMap(), i = new WeakSet(), E = async function(e) {
2997
3044
  return y({
2998
3045
  migrations: r,
2999
3046
  executedMigrations: a,
3000
- lastMigration: aa(a),
3047
+ lastMigration: ia(a),
3001
3048
  pendingMigrations: o
3002
3049
  });
3003
3050
  }, Pe = function(e, r) {
@@ -3097,7 +3144,7 @@ class Le {
3097
3144
  return this.migrations;
3098
3145
  }
3099
3146
  }
3100
- async function _a(t) {
3147
+ async function ga(t) {
3101
3148
  await t.schema.createTable("tenants").addColumn("id", "varchar(255)", (e) => e.primaryKey()).addColumn("name", "varchar(255)").addColumn("audience", "varchar(255)").addColumn("sender_email", "varchar(255)").addColumn("sender_name", "varchar(255)").addColumn("language", "varchar(255)").addColumn("logo", "varchar(255)").addColumn("primary_color", "varchar(255)").addColumn("secondary_color", "varchar(255)").addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("updated_at", "varchar(255)", (e) => e.notNull()).execute(), await t.schema.createTable("users").addColumn("user_id", "varchar(255)", (e) => e.notNull()).addColumn(
3102
3149
  "tenant_id",
3103
3150
  "varchar(255)",
@@ -3169,35 +3216,35 @@ async function _a(t) {
3169
3216
  (e) => e.references("tenants.id").onDelete("cascade").notNull()
3170
3217
  ).addColumn("domain", "varchar(255)", (e) => e.notNull()).addColumn("email_service", "varchar(255)").addColumn("email_api_key", "varchar(255)").addColumn("dkim_private_key", "varchar(2048)").addColumn("dkim_public_key", "varchar(2048)").addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("updated_at", "varchar(255)", (e) => e.notNull()).execute();
3171
3218
  }
3172
- async function ha(t) {
3219
+ async function wa(t) {
3173
3220
  await t.schema.dropTable("domains").execute(), await t.schema.dropTable("members").execute(), await t.schema.dropTable("users").execute(), await t.schema.dropTable("connections").execute(), await t.schema.dropTable("applications").execute(), await t.schema.dropTable("migrations").execute(), await t.schema.dropTable("tenants").execute();
3174
3221
  }
3175
- const fa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3222
+ const ya = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3176
3223
  __proto__: null,
3177
- down: ha,
3178
- up: _a
3224
+ down: wa,
3225
+ up: ga
3179
3226
  }, Symbol.toStringTag, { value: "Module" }));
3180
- async function pa(t) {
3227
+ async function va(t) {
3181
3228
  await t.schema.alterTable("tenants").addColumn("support_url", "varchar(255)").execute();
3182
3229
  }
3183
- async function ga(t) {
3230
+ async function Na(t) {
3184
3231
  await t.schema.alterTable("tenants").dropColumn("support_url").execute();
3185
3232
  }
3186
- const wa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3233
+ const Ca = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3187
3234
  __proto__: null,
3188
- down: ga,
3189
- up: pa
3235
+ down: Na,
3236
+ up: va
3190
3237
  }, Symbol.toStringTag, { value: "Module" }));
3191
- async function ya(t) {
3238
+ async function ba(t) {
3192
3239
  }
3193
- async function va(t) {
3240
+ async function xa(t) {
3194
3241
  }
3195
- const Na = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3242
+ const Ta = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3196
3243
  __proto__: null,
3197
- down: va,
3198
- up: ya
3244
+ down: xa,
3245
+ up: ba
3199
3246
  }, Symbol.toStringTag, { value: "Module" }));
3200
- async function Ca(t) {
3247
+ async function Sa(t) {
3201
3248
  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(
3202
3249
  "tenant_id_constraint",
3203
3250
  ["tenant_id"],
@@ -3206,24 +3253,24 @@ async function Ca(t) {
3206
3253
  (e) => e.onDelete("cascade")
3207
3254
  ).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();
3208
3255
  }
3209
- async function ba(t) {
3256
+ async function Oa(t) {
3210
3257
  await t.schema.dropTable("logs").execute();
3211
3258
  }
3212
- const xa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3259
+ const ka = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3213
3260
  __proto__: null,
3214
- down: ba,
3215
- up: Ca
3261
+ down: Oa,
3262
+ up: Sa
3216
3263
  }, Symbol.toStringTag, { value: "Module" }));
3217
- async function Ta(t) {
3264
+ async function $a(t) {
3218
3265
  }
3219
- async function Sa(t) {
3266
+ async function Ia(t) {
3220
3267
  }
3221
- const Oa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3268
+ const Da = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3222
3269
  __proto__: null,
3223
- down: Sa,
3224
- up: Ta
3270
+ down: Ia,
3271
+ up: $a
3225
3272
  }, Symbol.toStringTag, { value: "Module" }));
3226
- async function ka(t) {
3273
+ async function Pa(t) {
3227
3274
  await t.schema.createTable("sessions").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addForeignKeyConstraint(
3228
3275
  "user_id_constraint",
3229
3276
  ["user_id", "tenant_id"],
@@ -3248,15 +3295,15 @@ async function ka(t) {
3248
3295
  (e) => e.references("applications.id").onDelete("cascade").notNull()
3249
3296
  ).addColumn("code", "varchar(255)", (e) => e.notNull()).addColumn("email", "varchar(255)", (e) => e.notNull()).addColumn("user_id", "varchar(255)").addColumn("send", "varchar(255)").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(), await t.schema.createIndex("otps_email_index").on("otps").column("email").execute(), await t.schema.createIndex("otps_expires_at_index").on("otps").column("expires_at").execute();
3250
3297
  }
3251
- async function $a(t) {
3298
+ async function ja(t) {
3252
3299
  await t.schema.dropTable("sessions").execute(), await t.schema.dropTable("tickets").execute(), await t.schema.dropTable("otps").execute();
3253
3300
  }
3254
- const Ia = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3301
+ const Fa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3255
3302
  __proto__: null,
3256
- down: $a,
3257
- up: ka
3303
+ down: ja,
3304
+ up: Pa
3258
3305
  }, Symbol.toStringTag, { value: "Module" }));
3259
- async function Da(t) {
3306
+ async function Ma(t) {
3260
3307
  await t.schema.createTable("passwords").addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addPrimaryKeyConstraint("passwords_pkey", ["user_id", "tenant_id"]).addForeignKeyConstraint(
3261
3308
  "user_id_constraint",
3262
3309
  ["user_id", "tenant_id"],
@@ -3271,24 +3318,24 @@ async function Da(t) {
3271
3318
  (e) => e.onDelete("cascade")
3272
3319
  ).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(), await t.schema.createIndex("codes_expires_at_index").on("codes").column("expires_at").execute();
3273
3320
  }
3274
- async function Pa(t) {
3321
+ async function Aa(t) {
3275
3322
  await t.schema.dropTable("passwords").execute(), await t.schema.dropTable("codes").execute();
3276
3323
  }
3277
- const ja = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3324
+ const za = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3278
3325
  __proto__: null,
3279
- down: Pa,
3280
- up: Da
3326
+ down: Aa,
3327
+ up: Ma
3281
3328
  }, Symbol.toStringTag, { value: "Module" }));
3282
- async function Fa(t) {
3329
+ async function La(t) {
3283
3330
  }
3284
- async function Ma(t) {
3331
+ async function Ea(t) {
3285
3332
  }
3286
- const Aa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3333
+ const Ja = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3287
3334
  __proto__: null,
3288
- down: Ma,
3289
- up: Fa
3335
+ down: Ea,
3336
+ up: La
3290
3337
  }, Symbol.toStringTag, { value: "Module" }));
3291
- async function za(t) {
3338
+ async function Ra(t) {
3292
3339
  await t.schema.alterTable("passwords").addColumn(
3293
3340
  "password",
3294
3341
  "varchar(255)",
@@ -3296,288 +3343,288 @@ async function za(t) {
3296
3343
  (e) => e.notNull()
3297
3344
  ).execute();
3298
3345
  }
3299
- async function La(t) {
3346
+ async function Ka(t) {
3300
3347
  await t.schema.alterTable("passwords").dropColumn("password").execute();
3301
3348
  }
3302
- const Ea = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3349
+ const Ua = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3303
3350
  __proto__: null,
3304
- down: La,
3305
- up: za
3351
+ down: Ka,
3352
+ up: Ra
3306
3353
  }, Symbol.toStringTag, { value: "Module" }));
3307
- async function Ja(t) {
3354
+ async function Ba(t) {
3308
3355
  }
3309
- async function Ra(t) {
3356
+ async function Qa(t) {
3310
3357
  }
3311
- const Ka = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3358
+ const qa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3312
3359
  __proto__: null,
3313
- down: Ra,
3314
- up: Ja
3360
+ down: Qa,
3361
+ up: Ba
3315
3362
  }, Symbol.toStringTag, { value: "Module" }));
3316
- async function Ua(t) {
3363
+ async function Va(t) {
3317
3364
  }
3318
- async function Ba(t) {
3365
+ async function Wa(t) {
3319
3366
  }
3320
- const Qa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3367
+ const Ga = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3321
3368
  __proto__: null,
3322
- down: Ba,
3323
- up: Ua
3369
+ down: Wa,
3370
+ up: Va
3324
3371
  }, Symbol.toStringTag, { value: "Module" }));
3325
- async function qa(t) {
3372
+ async function Ha(t) {
3326
3373
  }
3327
- async function Va(t) {
3374
+ async function Ya(t) {
3328
3375
  }
3329
- const Wa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3376
+ const Xa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3330
3377
  __proto__: null,
3331
- down: Va,
3332
- up: qa
3378
+ down: Ya,
3379
+ up: Ha
3333
3380
  }, Symbol.toStringTag, { value: "Module" }));
3334
- async function Ga(t) {
3381
+ async function Za(t) {
3335
3382
  await t.schema.createIndex("users_email_index").on("users").column("email").execute();
3336
3383
  }
3337
- async function Ha(t) {
3384
+ async function en(t) {
3338
3385
  await t.schema.dropIndex("users_email_index").execute();
3339
3386
  }
3340
- const Xa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3387
+ const tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3341
3388
  __proto__: null,
3342
- down: Ha,
3343
- up: Ga
3389
+ down: en,
3390
+ up: Za
3344
3391
  }, Symbol.toStringTag, { value: "Module" }));
3345
- async function Ya(t) {
3392
+ async function rn(t) {
3346
3393
  await t.schema.alterTable("users").addColumn("profileData", "varchar(2048)").execute();
3347
3394
  }
3348
- async function Za(t) {
3395
+ async function an(t) {
3349
3396
  await t.schema.alterTable("users").dropColumn("profileData").execute();
3350
3397
  }
3351
- const en = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3398
+ const nn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3352
3399
  __proto__: null,
3353
- down: Za,
3354
- up: Ya
3400
+ down: an,
3401
+ up: rn
3355
3402
  }, Symbol.toStringTag, { value: "Module" }));
3356
- async function tn(t) {
3403
+ async function on(t) {
3357
3404
  await t.schema.createIndex("users_linked_to_index").on("users").column("linked_to").execute();
3358
3405
  }
3359
- async function rn(t) {
3406
+ async function sn(t) {
3360
3407
  await t.schema.dropIndex("users_linked_to_index");
3361
3408
  }
3362
- const an = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3409
+ const ln = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3363
3410
  __proto__: null,
3364
- down: rn,
3365
- up: tn
3411
+ down: sn,
3412
+ up: on
3366
3413
  }, Symbol.toStringTag, { value: "Module" }));
3367
- async function nn(t) {
3414
+ async function cn(t) {
3368
3415
  await t.schema.alterTable("users").addColumn("locale", "varchar(255)").execute();
3369
3416
  }
3370
- async function on(t) {
3417
+ async function dn(t) {
3371
3418
  await t.schema.alterTable("users").dropColumn("locale").execute();
3372
3419
  }
3373
- const sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3420
+ const un = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3374
3421
  __proto__: null,
3375
- down: on,
3376
- up: nn
3422
+ down: dn,
3423
+ up: cn
3377
3424
  }, Symbol.toStringTag, { value: "Module" }));
3378
- async function ln(t) {
3425
+ async function mn(t) {
3379
3426
  await t.schema.createTable("keys").addColumn("kid", "varchar(255)", (e) => e.primaryKey()).addColumn(
3380
3427
  "tenant_id",
3381
3428
  "varchar(255)",
3382
3429
  (e) => e.references("tenants.id").onDelete("cascade")
3383
3430
  ).addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("revoked_at", "varchar(255)").addColumn("cert", "varchar(2048)").addColumn("pkcs7", "varchar(2048)").addColumn("fingerprint", "varchar(256)").addColumn("thumbprint", "varchar(256)").addColumn("current_since", "varchar(256)").addColumn("current_until", "varchar(256)").execute();
3384
3431
  }
3385
- async function cn(t) {
3432
+ async function _n(t) {
3386
3433
  await t.schema.dropTable("keys").execute();
3387
3434
  }
3388
- const dn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3435
+ const hn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3389
3436
  __proto__: null,
3390
- down: cn,
3391
- up: ln
3437
+ down: _n,
3438
+ up: mn
3392
3439
  }, Symbol.toStringTag, { value: "Module" }));
3393
- async function un(t) {
3440
+ async function fn(t) {
3394
3441
  }
3395
- async function mn(t) {
3442
+ async function pn(t) {
3396
3443
  }
3397
- const _n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3444
+ const gn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3398
3445
  __proto__: null,
3399
- down: mn,
3400
- up: un
3446
+ down: pn,
3447
+ up: fn
3401
3448
  }, Symbol.toStringTag, { value: "Module" }));
3402
- async function hn(t) {
3449
+ async function wn(t) {
3403
3450
  }
3404
- async function fn(t) {
3451
+ async function yn(t) {
3405
3452
  }
3406
- const pn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3453
+ const vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3407
3454
  __proto__: null,
3408
- down: fn,
3409
- up: hn
3455
+ down: yn,
3456
+ up: wn
3410
3457
  }, Symbol.toStringTag, { value: "Module" }));
3411
- async function gn(t) {
3458
+ async function Nn(t) {
3412
3459
  await t.schema.alterTable("otps").addColumn("audience", "varchar(255)").execute();
3413
3460
  }
3414
- async function wn(t) {
3461
+ async function Cn(t) {
3415
3462
  await t.schema.alterTable("otps").dropColumn("audience").execute();
3416
3463
  }
3417
- const yn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3464
+ const bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3418
3465
  __proto__: null,
3419
- down: wn,
3420
- up: gn
3466
+ down: Cn,
3467
+ up: Nn
3421
3468
  }, Symbol.toStringTag, { value: "Module" }));
3422
- async function vn(t) {
3469
+ async function xn(t) {
3423
3470
  }
3424
- async function Nn(t) {
3471
+ async function Tn(t) {
3425
3472
  }
3426
- const Cn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3473
+ const Sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3427
3474
  __proto__: null,
3428
- down: Nn,
3429
- up: vn
3475
+ down: Tn,
3476
+ up: xn
3430
3477
  }, Symbol.toStringTag, { value: "Module" }));
3431
- async function bn(t) {
3478
+ async function On(t) {
3432
3479
  await t.schema.alterTable("logs").dropColumn("category").execute();
3433
3480
  }
3434
- async function xn(t) {
3481
+ async function kn(t) {
3435
3482
  await t.schema.alterTable("logs").addColumn("category", "varchar(255)", (e) => e.notNull()).execute();
3436
3483
  }
3437
- const Tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3484
+ const $n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3438
3485
  __proto__: null,
3439
- down: xn,
3440
- up: bn
3486
+ down: kn,
3487
+ up: On
3441
3488
  }, Symbol.toStringTag, { value: "Module" }));
3442
- async function Sn(t) {
3489
+ async function In(t) {
3443
3490
  await t.schema.alterTable("users").dropColumn("tags").execute();
3444
3491
  }
3445
- async function On(t) {
3492
+ async function Dn(t) {
3446
3493
  await t.schema.alterTable("users").addColumn("tags", "varchar(255)").execute();
3447
3494
  }
3448
- const kn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3495
+ const Pn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3449
3496
  __proto__: null,
3450
- down: On,
3451
- up: Sn
3497
+ down: Dn,
3498
+ up: In
3452
3499
  }, Symbol.toStringTag, { value: "Module" }));
3453
- async function $n(t) {
3500
+ async function jn(t) {
3454
3501
  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();
3455
3502
  }
3456
- async function In(t) {
3503
+ async function Fn(t) {
3457
3504
  await t.schema.dropIndex("logs_user_id"), await t.schema.dropIndex("logs_tenant_id"), await t.schema.dropIndex("logs_date");
3458
3505
  }
3459
- const Dn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3506
+ const Mn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3460
3507
  __proto__: null,
3461
- down: In,
3462
- up: $n
3508
+ down: Fn,
3509
+ up: jn
3463
3510
  }, Symbol.toStringTag, { value: "Module" }));
3464
- async function Pn(t) {
3511
+ async function An(t) {
3465
3512
  await t.schema.alterTable("logs").dropColumn("details").execute(), await t.schema.alterTable("logs").addColumn("details", "varchar(8192)").execute();
3466
3513
  }
3467
- async function jn(t) {
3514
+ async function zn(t) {
3468
3515
  await t.schema.alterTable("logs").dropColumn("details").execute(), await t.schema.alterTable("logs").addColumn("details", "varchar(2048)").execute();
3469
3516
  }
3470
- const Fn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3517
+ const Ln = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3471
3518
  __proto__: null,
3472
- down: jn,
3473
- up: Pn
3519
+ down: zn,
3520
+ up: An
3474
3521
  }, Symbol.toStringTag, { value: "Module" }));
3475
- async function Mn(t) {
3522
+ async function En(t) {
3476
3523
  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();
3477
3524
  }
3478
- async function An(t) {
3525
+ async function Jn(t) {
3479
3526
  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();
3480
3527
  }
3481
- const zn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3528
+ const Rn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3482
3529
  __proto__: null,
3483
- down: An,
3484
- up: Mn
3530
+ down: Jn,
3531
+ up: En
3485
3532
  }, Symbol.toStringTag, { value: "Module" }));
3486
- async function Ln(t) {
3533
+ async function Kn(t) {
3487
3534
  await t.schema.createIndex("users_name_index").on("users").column("name").execute();
3488
3535
  }
3489
- async function En(t) {
3536
+ async function Un(t) {
3490
3537
  await t.schema.dropIndex("users_name_index").execute();
3491
3538
  }
3492
- const Jn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3539
+ const Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3493
3540
  __proto__: null,
3494
- down: En,
3495
- up: Ln
3541
+ down: Un,
3542
+ up: Kn
3496
3543
  }, Symbol.toStringTag, { value: "Module" }));
3497
- async function Rn(t) {
3544
+ async function Qn(t) {
3498
3545
  }
3499
- async function Kn(t) {
3546
+ async function qn(t) {
3500
3547
  await t.schema.alterTable("users").dropConstraint("unique_email_provider").execute();
3501
3548
  }
3502
- const Un = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3549
+ const Vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3503
3550
  __proto__: null,
3504
- down: Kn,
3505
- up: Rn
3551
+ down: qn,
3552
+ up: Qn
3506
3553
  }, Symbol.toStringTag, { value: "Module" }));
3507
- async function Bn(t) {
3554
+ async function Wn(t) {
3508
3555
  await t.schema.alterTable("otps").dropColumn("state").execute(), await t.schema.alterTable("otps").addColumn("state", "varchar(8192)").execute();
3509
3556
  }
3510
- async function Qn(t) {
3557
+ async function Gn(t) {
3511
3558
  await t.schema.alterTable("otps").dropColumn("state").execute(), await t.schema.alterTable("otps").addColumn("state", "varchar(1024)").execute();
3512
3559
  }
3513
- const qn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3560
+ const Hn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3514
3561
  __proto__: null,
3515
- down: Qn,
3516
- up: Bn
3562
+ down: Gn,
3563
+ up: Wn
3517
3564
  }, Symbol.toStringTag, { value: "Module" }));
3518
- async function Vn(t) {
3565
+ async function Yn(t) {
3519
3566
  await t.schema.alterTable("tickets").dropColumn("state").execute(), await t.schema.alterTable("tickets").addColumn("state", "varchar(8192)").execute();
3520
3567
  }
3521
- async function Wn(t) {
3568
+ async function Xn(t) {
3522
3569
  await t.schema.alterTable("tickets").dropColumn("state").execute(), await t.schema.alterTable("tickets").addColumn("state", "varchar(1024)").execute();
3523
3570
  }
3524
- const Gn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3571
+ const Zn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3525
3572
  __proto__: null,
3526
- down: Wn,
3527
- up: Vn
3573
+ down: Xn,
3574
+ up: Yn
3528
3575
  }, Symbol.toStringTag, { value: "Module" }));
3529
- async function Hn(t) {
3576
+ async function eo(t) {
3530
3577
  await t.schema.createTable("branding").addColumn(
3531
3578
  "tenant_id",
3532
3579
  "varchar(255)",
3533
3580
  (e) => e.references("tenants.id").onDelete("cascade").notNull().primaryKey()
3534
3581
  ).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();
3535
3582
  }
3536
- async function Xn(t) {
3583
+ async function to(t) {
3537
3584
  await t.schema.dropTable("branding").execute();
3538
3585
  }
3539
- const Yn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3586
+ const ro = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3540
3587
  __proto__: null,
3541
- down: Xn,
3542
- up: Hn
3588
+ down: to,
3589
+ up: eo
3543
3590
  }, Symbol.toStringTag, { value: "Module" }));
3544
- async function Zn(t) {
3591
+ async function ao(t) {
3545
3592
  }
3546
- async function eo(t) {
3593
+ async function no(t) {
3547
3594
  }
3548
- const to = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3595
+ const oo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3549
3596
  __proto__: null,
3550
- down: eo,
3551
- up: Zn
3597
+ down: no,
3598
+ up: ao
3552
3599
  }, Symbol.toStringTag, { value: "Module" }));
3553
- async function ro(t) {
3600
+ async function so(t) {
3554
3601
  }
3555
- async function ao(t) {
3602
+ async function io(t) {
3556
3603
  }
3557
- const no = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3604
+ const lo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3558
3605
  __proto__: null,
3559
- down: ao,
3560
- up: ro
3606
+ down: io,
3607
+ up: so
3561
3608
  }, Symbol.toStringTag, { value: "Module" }));
3562
- async function oo(t) {
3609
+ async function co(t) {
3563
3610
  }
3564
- async function so(t) {
3611
+ async function uo(t) {
3565
3612
  }
3566
- const io = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3613
+ const mo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3567
3614
  __proto__: null,
3568
- down: so,
3569
- up: oo
3615
+ down: uo,
3616
+ up: co
3570
3617
  }, Symbol.toStringTag, { value: "Module" }));
3571
- async function lo(t) {
3618
+ async function _o(t) {
3572
3619
  }
3573
- async function co(t) {
3620
+ async function ho(t) {
3574
3621
  }
3575
- const uo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3622
+ const fo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3576
3623
  __proto__: null,
3577
- down: co,
3578
- up: lo
3624
+ down: ho,
3625
+ up: _o
3579
3626
  }, Symbol.toStringTag, { value: "Module" }));
3580
- async function mo(t) {
3627
+ async function po(t) {
3581
3628
  await t.schema.createTable("authentication_codes").addColumn(
3582
3629
  "tenant_id",
3583
3630
  "varchar(255)",
@@ -3588,55 +3635,55 @@ async function mo(t) {
3588
3635
  (e) => e.references("applications.id").onDelete("cascade").notNull()
3589
3636
  ).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();
3590
3637
  }
3591
- async function _o(t) {
3638
+ async function go(t) {
3592
3639
  await t.schema.dropTable("authentication_codes").execute();
3593
3640
  }
3594
- const ho = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3641
+ const wo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3595
3642
  __proto__: null,
3596
- down: _o,
3597
- up: mo
3643
+ down: go,
3644
+ up: po
3598
3645
  }, Symbol.toStringTag, { value: "Module" }));
3599
- async function fo(t) {
3646
+ async function yo(t) {
3600
3647
  }
3601
- async function po(t) {
3648
+ async function vo(t) {
3602
3649
  }
3603
- const go = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3650
+ const No = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3604
3651
  __proto__: null,
3605
- down: po,
3606
- up: fo
3652
+ down: vo,
3653
+ up: yo
3607
3654
  }, Symbol.toStringTag, { value: "Module" }));
3608
- async function wo(t) {
3655
+ async function Co(t) {
3609
3656
  await t.schema.alterTable("otps").addColumn("ip", "varchar(64)").execute();
3610
3657
  }
3611
- async function yo(t) {
3658
+ async function bo(t) {
3612
3659
  await t.schema.alterTable("otps").dropColumn("ip").execute();
3613
3660
  }
3614
- const vo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3661
+ const xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3615
3662
  __proto__: null,
3616
- down: yo,
3617
- up: wo
3663
+ down: bo,
3664
+ up: Co
3618
3665
  }, Symbol.toStringTag, { value: "Module" }));
3619
- async function No(t) {
3666
+ async function To(t) {
3620
3667
  await t.schema.alterTable("logs").dropColumn("user_agent").execute(), await t.schema.alterTable("logs").addColumn("user_agent", "varchar(1024)").execute();
3621
3668
  }
3622
- async function Co(t) {
3669
+ async function So(t) {
3623
3670
  await t.schema.alterTable("logs").dropColumn("user_agent").execute(), await t.schema.alterTable("logs").addColumn("user_agent", "varchar(255)").execute();
3624
3671
  }
3625
- const bo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3672
+ const Oo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3626
3673
  __proto__: null,
3627
- down: Co,
3628
- up: No
3674
+ down: So,
3675
+ up: To
3629
3676
  }, Symbol.toStringTag, { value: "Module" }));
3630
- async function xo(t) {
3677
+ async function ko(t) {
3631
3678
  }
3632
- async function To(t) {
3679
+ async function $o(t) {
3633
3680
  }
3634
- const So = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3681
+ const Io = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3635
3682
  __proto__: null,
3636
- down: To,
3637
- up: xo
3683
+ down: $o,
3684
+ up: ko
3638
3685
  }, Symbol.toStringTag, { value: "Module" }));
3639
- async function Oo(t) {
3686
+ async function Do(t) {
3640
3687
  await t.schema.createTable("hooks").addColumn("hook_id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn(
3641
3688
  "tenant_id",
3642
3689
  "varchar(255)",
@@ -3647,33 +3694,33 @@ async function Oo(t) {
3647
3694
  (e) => e.defaultTo(!1).notNull()
3648
3695
  ).addColumn("priority", "integer").execute();
3649
3696
  }
3650
- async function ko(t) {
3697
+ async function Po(t) {
3651
3698
  await t.schema.dropTable("hooks").execute();
3652
3699
  }
3653
- const $o = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3700
+ const jo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3654
3701
  __proto__: null,
3655
- down: ko,
3656
- up: Oo
3702
+ down: Po,
3703
+ up: Do
3657
3704
  }, Symbol.toStringTag, { value: "Module" }));
3658
- async function Io(t) {
3705
+ async function Fo(t) {
3659
3706
  }
3660
- async function Do(t) {
3707
+ async function Mo(t) {
3661
3708
  }
3662
- const Po = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3709
+ const Ao = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3663
3710
  __proto__: null,
3664
- down: Do,
3665
- up: Io
3711
+ down: Mo,
3712
+ up: Fo
3666
3713
  }, Symbol.toStringTag, { value: "Module" }));
3667
- async function jo(t) {
3714
+ async function zo(t) {
3668
3715
  }
3669
- async function Fo(t) {
3716
+ async function Lo(t) {
3670
3717
  }
3671
- const Mo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3718
+ const Eo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3672
3719
  __proto__: null,
3673
- down: Fo,
3674
- up: jo
3720
+ down: Lo,
3721
+ up: zo
3675
3722
  }, Symbol.toStringTag, { value: "Module" }));
3676
- async function Ao(t) {
3723
+ async function Jo(t) {
3677
3724
  await t.schema.createTable("logins").addColumn("login_id", "varchar(255)", (e) => e.primaryKey()).addColumn(
3678
3725
  "tenant_id",
3679
3726
  "varchar(255)",
@@ -3690,7 +3737,7 @@ async function Ao(t) {
3690
3737
  (e) => e.onDelete("cascade")
3691
3738
  ).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();
3692
3739
  }
3693
- async function zo(t) {
3740
+ async function Ro(t) {
3694
3741
  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(
3695
3742
  "codes_user_id_tenant_id_constraint",
3696
3743
  ["user_id", "tenant_id"],
@@ -3699,90 +3746,90 @@ async function zo(t) {
3699
3746
  (e) => e.onDelete("cascade")
3700
3747
  ).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();
3701
3748
  }
3702
- const Lo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3749
+ const Ko = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3703
3750
  __proto__: null,
3704
- down: zo,
3705
- up: Ao
3751
+ down: Ro,
3752
+ up: Jo
3706
3753
  }, Symbol.toStringTag, { value: "Module" }));
3707
- async function Eo(t) {
3754
+ async function Uo(t) {
3708
3755
  }
3709
- async function Jo(t) {
3756
+ async function Bo(t) {
3710
3757
  }
3711
- const Ro = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3758
+ const Qo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3712
3759
  __proto__: null,
3713
- down: Jo,
3714
- up: Eo
3760
+ down: Bo,
3761
+ up: Uo
3715
3762
  }, Symbol.toStringTag, { value: "Module" }));
3716
- async function Ko(t) {
3763
+ async function qo(t) {
3717
3764
  await t.schema.alterTable("logins").addColumn("auth0Client", "varchar(256)").execute();
3718
3765
  }
3719
- async function Uo(t) {
3766
+ async function Vo(t) {
3720
3767
  await t.schema.alterTable("logins").dropColumn("auth0Client").execute();
3721
3768
  }
3722
- const Bo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3769
+ const Wo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3723
3770
  __proto__: null,
3724
- down: Uo,
3725
- up: Ko
3771
+ down: Vo,
3772
+ up: qo
3726
3773
  }, Symbol.toStringTag, { value: "Module" }));
3727
- async function Qo(t) {
3774
+ async function Go(t) {
3728
3775
  await t.schema.alterTable("logins").dropColumn("authParams_state").execute(), await t.schema.alterTable("logins").addColumn("authParams_state", "varchar(8192)").execute();
3729
3776
  }
3730
- async function qo(t) {
3777
+ async function Ho(t) {
3731
3778
  await t.schema.alterTable("logins").dropColumn("authParams_state").execute(), await t.schema.alterTable("logins").addColumn("authParams_state", "varchar(511)").execute();
3732
3779
  }
3733
- const Vo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3780
+ const Yo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3734
3781
  __proto__: null,
3735
- down: qo,
3736
- up: Qo
3782
+ down: Ho,
3783
+ up: Go
3737
3784
  }, Symbol.toStringTag, { value: "Module" }));
3738
- async function Wo(t) {
3785
+ async function Xo(t) {
3739
3786
  }
3740
- async function Go(t) {
3787
+ async function Zo(t) {
3741
3788
  }
3742
- const Ho = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3789
+ const es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3743
3790
  __proto__: null,
3744
- down: Go,
3745
- up: Wo
3791
+ down: Zo,
3792
+ up: Xo
3746
3793
  }, Symbol.toStringTag, { value: "Module" }));
3747
- async function Xo(t) {
3794
+ async function ts(t) {
3748
3795
  }
3749
- async function Yo(t) {
3796
+ async function rs(t) {
3750
3797
  }
3751
- const Zo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3798
+ const as = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3752
3799
  __proto__: null,
3753
- down: Yo,
3754
- up: Xo
3800
+ down: rs,
3801
+ up: ts
3755
3802
  }, Symbol.toStringTag, { value: "Module" }));
3756
- async function es(t) {
3803
+ async function ns(t) {
3757
3804
  await t.schema.alterTable("logins").addColumn("authParams_nonce", "varchar(255)").execute();
3758
3805
  }
3759
- async function ts(t) {
3806
+ async function os(t) {
3760
3807
  await t.schema.alterTable("logins").dropColumn("nonce").execute();
3761
3808
  }
3762
- const rs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3809
+ const ss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3763
3810
  __proto__: null,
3764
- down: ts,
3765
- up: es
3811
+ down: os,
3812
+ up: ns
3766
3813
  }, Symbol.toStringTag, { value: "Module" }));
3767
- async function as(t) {
3814
+ async function is(t) {
3768
3815
  }
3769
- async function ns(t) {
3816
+ async function ls(t) {
3770
3817
  }
3771
- const os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3818
+ const cs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3772
3819
  __proto__: null,
3773
- down: ns,
3774
- up: as
3820
+ down: ls,
3821
+ up: is
3775
3822
  }, Symbol.toStringTag, { value: "Module" }));
3776
- async function ss(t) {
3823
+ async function ds(t) {
3777
3824
  }
3778
- async function is(t) {
3825
+ async function us(t) {
3779
3826
  }
3780
- const ls = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3827
+ const ms = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3781
3828
  __proto__: null,
3782
- down: is,
3783
- up: ss
3829
+ down: us,
3830
+ up: ds
3784
3831
  }, Symbol.toStringTag, { value: "Module" }));
3785
- async function cs(t) {
3832
+ async function _s(t) {
3786
3833
  await t.schema.dropTable("codes").execute(), await t.schema.createTable("codes").addColumn("code_id", "varchar(255)", (e) => e.notNull()).addColumn(
3787
3834
  "tenant_id",
3788
3835
  "varchar(255)",
@@ -3798,7 +3845,7 @@ async function cs(t) {
3798
3845
  "code_type"
3799
3846
  ]).execute();
3800
3847
  }
3801
- async function ds(t) {
3848
+ async function hs(t) {
3802
3849
  await t.schema.dropTable("codes").execute(), await t.schema.createTable("codes").addColumn("code_id", "varchar(255)", (e) => e.primaryKey()).addColumn(
3803
3850
  "tenant_id",
3804
3851
  "varchar(255)",
@@ -3811,15 +3858,15 @@ async function ds(t) {
3811
3858
  (e) => e.onDelete("cascade")
3812
3859
  ).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();
3813
3860
  }
3814
- const us = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3861
+ const fs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3815
3862
  __proto__: null,
3816
- down: ds,
3817
- up: cs
3863
+ down: hs,
3864
+ up: _s
3818
3865
  }, Symbol.toStringTag, { value: "Module" }));
3819
- async function ms(t) {
3866
+ async function ps(t) {
3820
3867
  await t.schema.dropTable("otps").execute(), await t.schema.dropTable("authentication_codes").execute();
3821
3868
  }
3822
- async function _s(t) {
3869
+ async function gs(t) {
3823
3870
  await t.schema.alterTable("keys").addColumn("private_key", "varchar(2048)").addColumn("public_key", "varchar(2048)").execute(), await t.schema.createTable("otps").addColumn(
3824
3871
  "tenant_id",
3825
3872
  "varchar(255)",
@@ -3838,32 +3885,32 @@ async function _s(t) {
3838
3885
  (e) => e.references("applications.id").onDelete("cascade").notNull()
3839
3886
  ).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();
3840
3887
  }
3841
- const hs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3888
+ const ws = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3842
3889
  __proto__: null,
3843
- down: _s,
3844
- up: ms
3890
+ down: gs,
3891
+ up: ps
3845
3892
  }, Symbol.toStringTag, { value: "Module" }));
3846
- async function fs(t) {
3893
+ async function ys(t) {
3847
3894
  await t.schema.createIndex("IDX_logs_tenant_date_type_user").on("logs").columns(["tenant_id", "date", "type", "user_id"]).execute();
3848
3895
  }
3849
- async function ps(t) {
3896
+ async function vs(t) {
3850
3897
  await t.schema.dropIndex("IDX_logs_tenant_date_type_user").on("logs").execute();
3851
3898
  }
3852
- const gs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3899
+ const Ns = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3853
3900
  __proto__: null,
3854
- down: ps,
3855
- up: fs
3901
+ down: vs,
3902
+ up: ys
3856
3903
  }, Symbol.toStringTag, { value: "Module" }));
3857
- async function ws(t) {
3904
+ async function Cs(t) {
3858
3905
  }
3859
- async function ys(t) {
3906
+ async function bs(t) {
3860
3907
  }
3861
- const vs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3908
+ const xs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3862
3909
  __proto__: null,
3863
- down: ys,
3864
- up: ws
3910
+ down: bs,
3911
+ up: Cs
3865
3912
  }, Symbol.toStringTag, { value: "Module" }));
3866
- async function Ns(t) {
3913
+ async function Ts(t) {
3867
3914
  await t.schema.createTable("prompt_settings").addColumn("tenant_id", "varchar(64)", (e) => e.primaryKey()).addColumn(
3868
3915
  "universal_login_experience",
3869
3916
  "varchar(16)",
@@ -3882,95 +3929,95 @@ async function Ns(t) {
3882
3929
  (e) => e.defaultTo(!1).notNull()
3883
3930
  ).execute();
3884
3931
  }
3885
- async function Cs(t) {
3932
+ async function Ss(t) {
3886
3933
  await t.schema.dropTable("prompt_settings").execute();
3887
3934
  }
3888
- const bs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3935
+ const Os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3889
3936
  __proto__: null,
3890
- down: Cs,
3891
- up: Ns
3937
+ down: Ss,
3938
+ up: Ts
3892
3939
  }, Symbol.toStringTag, { value: "Module" }));
3893
- async function xs(t) {
3940
+ async function ks(t) {
3894
3941
  }
3895
- async function Ts(t) {
3942
+ async function $s(t) {
3896
3943
  }
3897
- const Ss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3944
+ const Is = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3898
3945
  __proto__: null,
3899
- down: Ts,
3900
- up: xs
3946
+ down: $s,
3947
+ up: ks
3901
3948
  }, Symbol.toStringTag, { value: "Module" }));
3902
- async function Os(t) {
3949
+ async function Ds(t) {
3903
3950
  }
3904
- async function ks(t) {
3951
+ async function Ps(t) {
3905
3952
  }
3906
- const $s = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3953
+ const js = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3907
3954
  __proto__: null,
3908
- down: ks,
3909
- up: Os
3955
+ down: Ps,
3956
+ up: Ds
3910
3957
  }, Symbol.toStringTag, { value: "Module" }));
3911
- async function Is(t) {
3958
+ async function Fs(t) {
3912
3959
  }
3913
- async function Ds(t) {
3960
+ async function Ms(t) {
3914
3961
  }
3915
- const Ps = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3962
+ const As = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3916
3963
  __proto__: null,
3917
- down: Ds,
3918
- up: Is
3964
+ down: Ms,
3965
+ up: Fs
3919
3966
  }, Symbol.toStringTag, { value: "Module" }));
3920
- async function js(t) {
3967
+ async function zs(t) {
3921
3968
  await t.schema.alterTable("logins").addColumn("authParams_ui_locales", "varchar(32)").execute();
3922
3969
  }
3923
- async function Fs(t) {
3970
+ async function Ls(t) {
3924
3971
  await t.schema.alterTable("logins").dropColumn("authParams_ui_locales").execute();
3925
3972
  }
3926
- const Ms = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3973
+ const Es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3927
3974
  __proto__: null,
3928
- down: Fs,
3929
- up: js
3975
+ down: Ls,
3976
+ up: zs
3930
3977
  }, Symbol.toStringTag, { value: "Module" }));
3931
- async function As(t) {
3978
+ async function Js(t) {
3932
3979
  await t.schema.alterTable("logins").addColumn("authParams_prompt", "varchar(16)").execute();
3933
3980
  }
3934
- async function zs(t) {
3981
+ async function Rs(t) {
3935
3982
  await t.schema.alterTable("logins").dropColumn("authParams_prompt").execute();
3936
3983
  }
3937
- const Ls = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3984
+ const Ks = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3938
3985
  __proto__: null,
3939
- down: zs,
3940
- up: As
3986
+ down: Rs,
3987
+ up: Js
3941
3988
  }, Symbol.toStringTag, { value: "Module" }));
3942
- async function Es(t) {
3989
+ async function Us(t) {
3943
3990
  }
3944
- async function Js(t) {
3991
+ async function Bs(t) {
3945
3992
  }
3946
- const Rs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3993
+ const Qs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3947
3994
  __proto__: null,
3948
- down: Js,
3949
- up: Es
3995
+ down: Bs,
3996
+ up: Us
3950
3997
  }, Symbol.toStringTag, { value: "Module" }));
3951
- async function Ks(t) {
3998
+ async function qs(t) {
3952
3999
  await t.schema.alterTable("logins").addColumn("authParams_act_as", "varchar(255)").execute();
3953
4000
  }
3954
- async function Us(t) {
4001
+ async function Vs(t) {
3955
4002
  await t.schema.alterTable("logins").dropColumn("authParam_act_as").execute();
3956
4003
  }
3957
- const Bs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4004
+ const Ws = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3958
4005
  __proto__: null,
3959
- down: Us,
3960
- up: Ks
4006
+ down: Vs,
4007
+ up: qs
3961
4008
  }, Symbol.toStringTag, { value: "Module" }));
3962
- async function Qs(t) {
4009
+ async function Gs(t) {
3963
4010
  await t.schema.alterTable("codes").addColumn("code_verifier", "varchar(128)").execute();
3964
4011
  }
3965
- async function qs(t) {
4012
+ async function Hs(t) {
3966
4013
  await t.schema.alterTable("codes").dropColumn("code_verifier").execute();
3967
4014
  }
3968
- const Vs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4015
+ const Ys = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3969
4016
  __proto__: null,
3970
- down: qs,
3971
- up: Qs
4017
+ down: Hs,
4018
+ up: Gs
3972
4019
  }, Symbol.toStringTag, { value: "Module" }));
3973
- async function Ws(t) {
4020
+ async function Xs(t) {
3974
4021
  await t.schema.createTable("email_providers").addColumn("tenant_id", "varchar(255)", (e) => e.primaryKey()).addColumn("name", "varchar(255)", (e) => e.notNull()).addColumn("enabled", "boolean", (e) => e.notNull()).addColumn("default_from_address", "varchar(255)").addColumn(
3975
4022
  "credentials",
3976
4023
  "varchar(2048)",
@@ -3981,18 +4028,18 @@ async function Ws(t) {
3981
4028
  (e) => e.notNull().defaultTo("{}")
3982
4029
  ).addColumn("created_at", "varchar(29)", (e) => e.notNull()).addColumn("updated_at", "varchar(29)", (e) => e.notNull()).execute();
3983
4030
  }
3984
- async function Gs(t) {
4031
+ async function Zs(t) {
3985
4032
  await t.schema.dropTable("email_providers").execute();
3986
4033
  }
3987
- const Hs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4034
+ const ei = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3988
4035
  __proto__: null,
3989
- down: Gs,
3990
- up: Ws
4036
+ down: Zs,
4037
+ up: Xs
3991
4038
  }, Symbol.toStringTag, { value: "Module" }));
3992
- async function Xs(t) {
4039
+ async function ti(t) {
3993
4040
  await t.schema.dropTable("tickets").execute();
3994
4041
  }
3995
- async function Ys(t) {
4042
+ async function ri(t) {
3996
4043
  await t.schema.createTable("tickets").addColumn(
3997
4044
  "tenant_id",
3998
4045
  "varchar(255)",
@@ -4003,22 +4050,22 @@ async function Ys(t) {
4003
4050
  (e) => e.references("applications.id").onDelete("cascade").notNull()
4004
4051
  ).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();
4005
4052
  }
4006
- const Zs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4053
+ const ai = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4007
4054
  __proto__: null,
4008
- down: Ys,
4009
- up: Xs
4055
+ down: ri,
4056
+ up: ti
4010
4057
  }, Symbol.toStringTag, { value: "Module" }));
4011
- async function ei(t) {
4058
+ async function ni(t) {
4012
4059
  }
4013
- async function ti(t) {
4060
+ async function oi(t) {
4014
4061
  await t.schema.alterTable("logins").dropColumn("ip").dropColumn("useragent").execute();
4015
4062
  }
4016
- const ri = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4063
+ const si = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4017
4064
  __proto__: null,
4018
- down: ti,
4019
- up: ei
4065
+ down: oi,
4066
+ up: ni
4020
4067
  }, Symbol.toStringTag, { value: "Module" }));
4021
- async function ai(t) {
4068
+ async function ii(t) {
4022
4069
  await t.schema.createTable("refresh_tokens").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn(
4023
4070
  "client_id",
4024
4071
  "varchar(21)",
@@ -4031,27 +4078,27 @@ async function ai(t) {
4031
4078
  (e) => e.onDelete("cascade")
4032
4079
  ).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();
4033
4080
  }
4034
- async function ni(t) {
4081
+ async function li(t) {
4035
4082
  await t.schema.dropTable("refresh_tokens").execute();
4036
4083
  }
4037
- const oi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4084
+ const ci = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4038
4085
  __proto__: null,
4039
- down: ni,
4040
- up: ai
4086
+ down: li,
4087
+ up: ii
4041
4088
  }, Symbol.toStringTag, { value: "Module" }));
4042
- async function si(t) {
4089
+ async function di(t) {
4043
4090
  }
4044
- async function ii(t) {
4091
+ async function ui(t) {
4045
4092
  }
4046
- const li = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4093
+ const mi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4047
4094
  __proto__: null,
4048
- down: ii,
4049
- up: si
4095
+ down: ui,
4096
+ up: di
4050
4097
  }, Symbol.toStringTag, { value: "Module" }));
4051
- async function ci(t) {
4098
+ async function _i(t) {
4052
4099
  await t.schema.dropTable("sessions").execute(), await t.schema.dropTable("refresh_tokens").execute();
4053
4100
  }
4054
- async function di(t) {
4101
+ async function hi(t) {
4055
4102
  await t.schema.createTable("sessions").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addForeignKeyConstraint(
4056
4103
  "sessions_user_id_constraint",
4057
4104
  ["user_id", "tenant_id"],
@@ -4070,12 +4117,12 @@ async function di(t) {
4070
4117
  (e) => e.onDelete("cascade")
4071
4118
  ).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();
4072
4119
  }
4073
- const ui = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4120
+ const fi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4074
4121
  __proto__: null,
4075
- down: di,
4076
- up: ci
4122
+ down: hi,
4123
+ up: _i
4077
4124
  }, Symbol.toStringTag, { value: "Module" }));
4078
- async function mi(t) {
4125
+ async function pi(t) {
4079
4126
  await t.schema.createTable("sessions_2").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addForeignKeyConstraint(
4080
4127
  "sessions_2_user_id_constraint",
4081
4128
  ["user_id", "tenant_id"],
@@ -4094,15 +4141,15 @@ async function mi(t) {
4094
4141
  (e) => e.onDelete("cascade")
4095
4142
  ).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();
4096
4143
  }
4097
- async function _i(t) {
4144
+ async function gi(t) {
4098
4145
  await t.schema.dropTable("sessions_2").execute(), await t.schema.dropTable("refresh_tokens_2").execute();
4099
4146
  }
4100
- const hi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4147
+ const wi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4101
4148
  __proto__: null,
4102
- down: _i,
4103
- up: mi
4149
+ down: gi,
4150
+ up: pi
4104
4151
  }, Symbol.toStringTag, { value: "Module" }));
4105
- async function fi(t) {
4152
+ async function yi(t) {
4106
4153
  await t.schema.createTable("custom_domains").addColumn(
4107
4154
  "custom_domain_id",
4108
4155
  "varchar(21)",
@@ -4113,49 +4160,49 @@ async function fi(t) {
4113
4160
  (e) => e.references("tenants.id").onDelete("cascade").notNull()
4114
4161
  ).addColumn("domain", "varchar(255)", (e) => e.notNull()).addColumn("primary", "boolean", (e) => e.notNull()).addColumn("status", "varchar(50)", (e) => e.notNull()).addColumn("type", "varchar(50)", (e) => e.notNull()).addColumn("origin_domain_name", "varchar(255)").addColumn("verification", "varchar(2048)").addColumn("custom_client_ip_header", "varchar(50)").addColumn("tls_policy", "varchar(50)").addColumn("domain_metadata", "varchar(2048)").addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("updated_at", "varchar(35)", (e) => e.notNull()).execute(), await t.schema.dropTable("domains").execute();
4115
4162
  }
4116
- async function pi(t) {
4163
+ async function vi(t) {
4117
4164
  await t.schema.dropTable("custom_domains").execute(), await t.schema.createTable("domains").addColumn("id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn(
4118
4165
  "tenant_id",
4119
4166
  "varchar(255)",
4120
4167
  (e) => e.references("tenants.id").onDelete("cascade").notNull()
4121
4168
  ).addColumn("domain", "varchar(255)", (e) => e.notNull()).addColumn("email_service", "varchar(255)").addColumn("email_api_key", "varchar(255)").addColumn("dkim_private_key", "varchar(2048)").addColumn("dkim_public_key", "varchar(2048)").addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("updated_at", "varchar(255)", (e) => e.notNull()).execute();
4122
4169
  }
4123
- const gi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4170
+ const Ni = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4124
4171
  __proto__: null,
4125
- down: pi,
4126
- up: fi
4172
+ down: vi,
4173
+ up: yi
4127
4174
  }, Symbol.toStringTag, { value: "Module" }));
4128
- async function wi(t) {
4175
+ async function Ci(t) {
4129
4176
  }
4130
- async function yi(t) {
4177
+ async function bi(t) {
4131
4178
  await t.schema.alterTable("logins").dropColumn("authParams_organization").dropColumn("authorization_url").execute();
4132
4179
  }
4133
- const vi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4180
+ const xi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4134
4181
  __proto__: null,
4135
- down: yi,
4136
- up: wi
4182
+ down: bi,
4183
+ up: Ci
4137
4184
  }, Symbol.toStringTag, { value: "Module" }));
4138
- async function Ni(t) {
4185
+ async function Ti(t) {
4139
4186
  await t.schema.alterTable("logins").dropColumn("authorization_url").execute(), await t.schema.alterTable("logins").addColumn("authorization_url", "varchar(2048)").execute();
4140
4187
  }
4141
- async function Ci(t) {
4188
+ async function Si(t) {
4142
4189
  await t.schema.alterTable("logins").dropColumn("authorization_url").execute(), await t.schema.alterTable("logins").addColumn("authorization_url", "varchar(1024)").execute();
4143
4190
  }
4144
- const bi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4191
+ const Oi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4145
4192
  __proto__: null,
4146
- down: Ci,
4147
- up: Ni
4193
+ down: Si,
4194
+ up: Ti
4148
4195
  }, Symbol.toStringTag, { value: "Module" }));
4149
- async function xi(t) {
4196
+ async function ki(t) {
4150
4197
  }
4151
- async function Ti(t) {
4198
+ async function $i(t) {
4152
4199
  }
4153
- const Si = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4200
+ const Ii = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4154
4201
  __proto__: null,
4155
- down: Ti,
4156
- up: xi
4202
+ down: $i,
4203
+ up: ki
4157
4204
  }, Symbol.toStringTag, { value: "Module" }));
4158
- async function Oi(t) {
4205
+ async function Di(t) {
4159
4206
  await t.schema.createTable("sessions").addColumn("id", "varchar(21)", (e) => e.primaryKey()).addColumn("tenant_id", "varchar(255)").addColumn("user_id", "varchar(255)").addForeignKeyConstraint(
4160
4207
  "sessions_user_id_constraint",
4161
4208
  ["user_id", "tenant_id"],
@@ -4182,25 +4229,25 @@ async function Oi(t) {
4182
4229
  (e) => e.onDelete("cascade")
4183
4230
  ).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();
4184
4231
  }
4185
- async function ki(t) {
4232
+ async function Pi(t) {
4186
4233
  await t.schema.dropTable("sessions").execute(), await t.schema.dropTable("login_sessions").execute(), await t.schema.dropTable("refresh_tokens").execute();
4187
4234
  }
4188
- const $i = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4235
+ const ji = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4189
4236
  __proto__: null,
4190
- down: ki,
4191
- up: Oi
4237
+ down: Pi,
4238
+ up: Di
4192
4239
  }, Symbol.toStringTag, { value: "Module" }));
4193
- async function Ii(t) {
4240
+ async function Fi(t) {
4194
4241
  await t.schema.dropTable("logins").execute(), await t.schema.dropTable("sessions_2").execute(), await t.schema.dropTable("refresh_tokens_2").execute();
4195
4242
  }
4196
- async function Di(t) {
4243
+ async function Mi(t) {
4197
4244
  }
4198
- const Pi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4245
+ const Ai = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4199
4246
  __proto__: null,
4200
- down: Di,
4201
- up: Ii
4247
+ down: Mi,
4248
+ up: Fi
4202
4249
  }, Symbol.toStringTag, { value: "Module" }));
4203
- async function ji(t) {
4250
+ async function zi(t) {
4204
4251
  await t.schema.dropTable("custom_domains").execute(), await t.schema.createTable("custom_domains").addColumn(
4205
4252
  "custom_domain_id",
4206
4253
  "varchar(256)",
@@ -4211,120 +4258,120 @@ async function ji(t) {
4211
4258
  (e) => e.references("tenants.id").onDelete("cascade").notNull()
4212
4259
  ).addColumn("domain", "varchar(255)", (e) => e.notNull()).addColumn("primary", "boolean", (e) => e.notNull()).addColumn("status", "varchar(50)", (e) => e.notNull()).addColumn("type", "varchar(50)", (e) => e.notNull()).addColumn("origin_domain_name", "varchar(255)").addColumn("verification", "varchar(2048)").addColumn("custom_client_ip_header", "varchar(50)").addColumn("tls_policy", "varchar(50)").addColumn("domain_metadata", "varchar(2048)").addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("updated_at", "varchar(35)", (e) => e.notNull()).execute();
4213
4260
  }
4214
- async function Fi(t) {
4261
+ async function Li(t) {
4215
4262
  }
4216
- const Mi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4263
+ const Ei = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4217
4264
  __proto__: null,
4218
- down: Fi,
4219
- up: ji
4265
+ down: Li,
4266
+ up: zi
4220
4267
  }, Symbol.toStringTag, { value: "Module" }));
4221
- async function Ai(t) {
4268
+ async function Ji(t) {
4222
4269
  }
4223
- async function zi(t) {
4270
+ async function Ri(t) {
4224
4271
  await t.schema.alterTable("users").dropColumn("phone_number").dropColumn("phone_verified").dropColumn("username").execute();
4225
4272
  }
4226
- const Li = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4273
+ const Ki = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4227
4274
  __proto__: null,
4228
- down: zi,
4229
- up: Ai
4275
+ down: Ri,
4276
+ up: Ji
4230
4277
  }, Symbol.toStringTag, { value: "Module" }));
4231
- async function Ei(t) {
4278
+ async function Ui(t) {
4232
4279
  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();
4233
4280
  }
4234
- async function Ji(t) {
4281
+ async function Bi(t) {
4235
4282
  await t.schema.dropTable("forms").execute();
4236
4283
  }
4237
- const Ri = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4284
+ const Qi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4238
4285
  __proto__: null,
4239
- down: Ji,
4240
- up: Ei
4286
+ down: Bi,
4287
+ up: Ui
4241
4288
  }, Symbol.toStringTag, { value: "Module" }));
4242
- async function Ki(t) {
4289
+ async function qi(t) {
4243
4290
  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();
4244
4291
  }
4245
- async function Ui(t) {
4292
+ async function Vi(t) {
4246
4293
  await t.schema.dropTable("hooks").ifExists().execute(), await t.schema.createTable("hooks").addColumn("hook_id", "text", (e) => e.primaryKey()).addColumn("tenant_id", "text", (e) => e.notNull()).addColumn("trigger_id", "text", (e) => e.notNull()).addColumn("enabled", "integer", (e) => e.notNull().defaultTo(0)).addColumn("url", "varchar(512)", (e) => e.notNull()).addColumn("synchronous", "integer", (e) => e.notNull().defaultTo(0)).addColumn("priority", "integer").addColumn("created_at", "text", (e) => e.notNull()).addColumn("updated_at", "text", (e) => e.notNull()).execute();
4247
4294
  }
4248
- const Bi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4295
+ const Wi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4249
4296
  __proto__: null,
4250
- down: Ui,
4251
- up: Ki
4297
+ down: Vi,
4298
+ up: qi
4252
4299
  }, Symbol.toStringTag, { value: "Module" }));
4253
- async function Qi(t) {
4300
+ async function Gi(t) {
4254
4301
  await t.schema.alterTable("login_sessions").addColumn(
4255
4302
  "login_completed",
4256
4303
  "boolean",
4257
4304
  (e) => e.notNull().defaultTo(0)
4258
4305
  ).execute();
4259
4306
  }
4260
- async function qi(t) {
4307
+ async function Hi(t) {
4261
4308
  await t.schema.alterTable("login_sessions").dropColumn("login_completed").execute();
4262
4309
  }
4263
- const Vi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4310
+ const Yi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4264
4311
  __proto__: null,
4265
- down: qi,
4266
- up: Qi
4312
+ down: Hi,
4313
+ up: Gi
4267
4314
  }, Symbol.toStringTag, { value: "Module" }));
4268
- async function Wi(t) {
4315
+ async function Xi(t) {
4269
4316
  await t.schema.alterTable("sessions").addColumn(
4270
4317
  "login_session_id",
4271
4318
  "varchar(21)",
4272
4319
  (e) => e.references("login_sessions.id").onDelete("set null")
4273
4320
  ).execute();
4274
4321
  }
4275
- async function Gi(t) {
4322
+ async function Zi(t) {
4276
4323
  await t.schema.alterTable("sessions").dropColumn("login_session_id").execute();
4277
4324
  }
4278
- const Hi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4325
+ const el = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4279
4326
  __proto__: null,
4280
- down: Gi,
4281
- up: Wi
4327
+ down: Zi,
4328
+ up: Xi
4282
4329
  }, Symbol.toStringTag, { value: "Module" }));
4283
- async function Xi(t) {
4330
+ async function tl(t) {
4284
4331
  await t.schema.createIndex("IDX_sessions_login_session_id").on("sessions").column("login_session_id").execute();
4285
4332
  }
4286
- async function Yi(t) {
4333
+ async function rl(t) {
4287
4334
  await t.schema.dropIndex("IDX_sessions_login_session_id").on("sessions").execute();
4288
4335
  }
4289
- const Zi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4336
+ const al = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4290
4337
  __proto__: null,
4291
- down: Yi,
4292
- up: Xi
4338
+ down: rl,
4339
+ up: tl
4293
4340
  }, Symbol.toStringTag, { value: "Module" }));
4294
- async function el(t) {
4341
+ async function nl(t) {
4295
4342
  await t.schema.alterTable("codes").addColumn("code_challenge", "varchar(128)").execute(), await t.schema.alterTable("codes").addColumn("code_challenge_method", "varchar(5)").execute();
4296
4343
  }
4297
- async function tl(t) {
4344
+ async function ol(t) {
4298
4345
  await t.schema.alterTable("codes").dropColumn("code_challenge").execute(), await t.schema.alterTable("codes").dropColumn("code_challenge_method").execute();
4299
4346
  }
4300
- const rl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4347
+ const sl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4301
4348
  __proto__: null,
4302
- down: tl,
4303
- up: el
4349
+ down: ol,
4350
+ up: nl
4304
4351
  }, Symbol.toStringTag, { value: "Module" }));
4305
- async function al(t) {
4352
+ async function il(t) {
4306
4353
  await t.schema.alterTable("codes").addColumn("redirect_uri", "varchar(1024)").execute();
4307
4354
  }
4308
- async function nl(t) {
4355
+ async function ll(t) {
4309
4356
  await t.schema.alterTable("codes").dropColumn("redirect_uri").execute();
4310
4357
  }
4311
- const ol = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4358
+ const cl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4312
4359
  __proto__: null,
4313
- down: nl,
4314
- up: al
4360
+ down: ll,
4361
+ up: il
4315
4362
  }, Symbol.toStringTag, { value: "Module" }));
4316
- async function sl(t) {
4363
+ async function dl(t) {
4317
4364
  await t.schema.alterTable("codes").addColumn("nonce", "varchar(1024)").execute(), await t.schema.alterTable("codes").addColumn("state", "varchar(2048)").execute();
4318
4365
  }
4319
- async function il(t) {
4366
+ async function ul(t) {
4320
4367
  await t.schema.alterTable("codes").dropColumn("nonce").execute(), await t.schema.alterTable("codes").dropColumn("state").execute();
4321
4368
  }
4322
- const ll = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4369
+ const ml = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4323
4370
  __proto__: null,
4324
- down: il,
4325
- up: sl
4371
+ down: ul,
4372
+ up: dl
4326
4373
  }, Symbol.toStringTag, { value: "Module" }));
4327
- async function cl(t) {
4374
+ async function _l(t) {
4328
4375
  await t.schema.createTable("themes").addColumn(
4329
4376
  "tenant_id",
4330
4377
  "varchar(255)",
@@ -4399,26 +4446,26 @@ async function cl(t) {
4399
4446
  (e) => e.notNull()
4400
4447
  ).addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("updated_at", "varchar(35)", (e) => e.notNull()).addPrimaryKeyConstraint("themes_pkey", ["tenant_id", "themeId"]).execute(), await t.schema.createIndex("themes_tenant_id_idx").on("themes").column("tenant_id").execute();
4401
4448
  }
4402
- async function dl(t) {
4449
+ async function hl(t) {
4403
4450
  await t.schema.dropTable("themes").execute();
4404
4451
  }
4405
- const ul = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4452
+ const fl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4406
4453
  __proto__: null,
4407
- down: dl,
4408
- up: cl
4454
+ down: hl,
4455
+ up: _l
4409
4456
  }, Symbol.toStringTag, { value: "Module" }));
4410
- async function ml(t) {
4457
+ async function pl(t) {
4411
4458
  await t.schema.createTable("resource_servers").addColumn("id", "varchar(21)", (e) => e.notNull()).addColumn("tenant_id", "varchar(191)", (e) => e.notNull()).addColumn("identifier", "varchar(191)", (e) => e.notNull()).addColumn("name", "varchar(255)", (e) => e.notNull()).addColumn("scopes", "varchar(4096)").addColumn("signing_alg", "varchar(64)").addColumn("signing_secret", "varchar(2048)").addColumn("token_lifetime", "integer").addColumn("token_lifetime_for_web", "integer").addColumn("skip_consent_for_verifiable_first_party_clients", "integer").addColumn("allow_offline_access", "integer").addColumn("verification_key", "varchar(4096)").addColumn("options", "varchar(4096)").addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("updated_at", "varchar(255)", (e) => e.notNull()).addPrimaryKeyConstraint("resource_servers_pk", ["tenant_id", "id"]).execute(), await t.schema.createIndex("resource_servers_tenant_identifier_uq").on("resource_servers").columns(["tenant_id", "identifier"]).unique().execute(), await t.schema.createTable("roles").addColumn("id", "varchar(21)", (e) => e.notNull()).addColumn("tenant_id", "varchar(191)", (e) => e.notNull()).addColumn("name", "varchar(50)", (e) => e.notNull()).addColumn("description", "varchar(255)").addColumn("created_at", "varchar(255)", (e) => e.notNull()).addColumn("updated_at", "varchar(255)", (e) => e.notNull()).addPrimaryKeyConstraint("roles_pk", ["tenant_id", "id"]).execute(), await t.schema.createIndex("roles_tenant_name_uq").on("roles").columns(["tenant_id", "name"]).unique().execute();
4412
4459
  }
4413
- async function _l(t) {
4460
+ async function gl(t) {
4414
4461
  await t.schema.dropTable("roles").execute(), await t.schema.dropTable("resource_servers").execute();
4415
4462
  }
4416
- const hl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4463
+ const wl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4417
4464
  __proto__: null,
4418
- down: _l,
4419
- up: ml
4465
+ down: gl,
4466
+ up: pl
4420
4467
  }, Symbol.toStringTag, { value: "Module" }));
4421
- async function fl(t) {
4468
+ async function yl(t) {
4422
4469
  await t.schema.createTable("role_permissions").addColumn("tenant_id", "varchar(191)", (e) => e.notNull()).addColumn("role_id", "varchar(21)", (e) => e.notNull()).addColumn(
4423
4470
  "resource_server_identifier",
4424
4471
  "varchar(191)",
@@ -4439,107 +4486,123 @@ async function fl(t) {
4439
4486
  "permission_name"
4440
4487
  ]).execute(), await t.schema.createIndex("user_permissions_user_fk").on("user_permissions").columns(["tenant_id", "user_id"]).execute(), await t.schema.createIndex("user_permissions_permission_fk").on("user_permissions").columns(["tenant_id", "resource_server_identifier", "permission_name"]).execute();
4441
4488
  }
4442
- async function pl(t) {
4489
+ async function vl(t) {
4443
4490
  await t.schema.dropTable("user_permissions").execute(), await t.schema.dropTable("role_permissions").execute();
4444
4491
  }
4445
- const gl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4492
+ const Nl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4493
+ __proto__: null,
4494
+ down: vl,
4495
+ up: yl
4496
+ }, Symbol.toStringTag, { value: "Module" }));
4497
+ async function Cl(t) {
4498
+ await t.schema.createTable("user_roles").addColumn("tenant_id", "varchar(191)", (e) => e.notNull()).addColumn("user_id", "varchar(191)", (e) => e.notNull()).addColumn("role_id", "varchar(21)", (e) => e.notNull()).addColumn("created_at", "varchar(255)", (e) => e.notNull()).addPrimaryKeyConstraint("user_roles_pk", [
4499
+ "tenant_id",
4500
+ "user_id",
4501
+ "role_id"
4502
+ ]).execute(), await t.schema.createIndex("user_roles_user_fk").on("user_roles").columns(["tenant_id", "user_id"]).execute(), await t.schema.createIndex("user_roles_role_fk").on("user_roles").columns(["tenant_id", "role_id"]).execute();
4503
+ }
4504
+ async function bl(t) {
4505
+ await t.schema.dropTable("user_roles").execute();
4506
+ }
4507
+ const xl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4446
4508
  __proto__: null,
4447
- down: pl,
4448
- up: fl
4509
+ down: bl,
4510
+ up: Cl
4449
4511
  }, Symbol.toStringTag, { value: "Module" })), Ee = {
4450
- m1_init: fa,
4451
- m2_magicLink: wa,
4452
- m3_updateAt: Na,
4453
- m4_logTable: xa,
4454
- m5_userProfile: Oa,
4455
- m6_sessions: Ia,
4456
- m7_passwords: ja,
4457
- m8_logsTableNewFields: Aa,
4458
- m9_passwordTableNewField: Ea,
4459
- n01_codesTable: Ka,
4460
- n11_universalLoginSession: Qa,
4461
- n12_userFields: Wa,
4462
- n13_userEmailIndex: Xa,
4463
- n14_profileDataField: en,
4464
- n15_userEmailIndex: an,
4465
- n16_userLocale: sn,
4466
- n17_signingKeys: dn,
4467
- n18_logsFields: _n,
4468
- n19_connectionsUserinfo: pn,
4469
- n20_missingFields: yn,
4470
- n21_sessionDeletedAt: Cn,
4471
- n22_dropLogsFields: Tn,
4472
- n23_dropUsersFields: kn,
4473
- n24_logsIndexes: Dn,
4474
- n25_logDescMaxLength: Fn,
4475
- n26_logsTableExtraFields: zn,
4476
- n27_usersTableNameIndex: Jn,
4477
- n28_usersEmailConstrain: Un,
4478
- n29_increaseOtpStateLength: qn,
4479
- n30_increaseTicketStateLength: Gn,
4480
- n31_branding: Yn,
4481
- n32_indexesAndNotNull: to,
4482
- n33_vendorIdInUniversalLoginSession: no,
4483
- n34_auth0ClientInUniversalLoginSession: io,
4484
- n35_increaseUniversalSessionStateLength: uo,
4485
- n36_authenticationCodes: ho,
4486
- n37_disableSignUps: go,
4487
- n38_otpIpAddress: vo,
4488
- n39_increaseUserAgentLength: bo,
4489
- n40_userId: So,
4490
- n41_hooks: $o,
4491
- n42_userIdIndexes: Po,
4492
- n43_userIdIndexes: Mo,
4493
- n44_codes: Lo,
4494
- n45_hookProperties: Ro,
4495
- n46_loginAuth0Client: Bo,
4496
- n47_loginAuth0Client: Vo,
4497
- n48_saml: Ho,
4498
- n49_removeFields: Zo,
4499
- n50_authParamsNonce: rs,
4500
- n51_connectionid: os,
4501
- n52_cert: ls,
4502
- n53_codes_primary_key: us,
4503
- n54_cleanup_tables: hs,
4504
- n55_logs_index: gs,
4505
- n56_application_fields: vs,
4506
- n57_prompt_settings: bs,
4507
- n58_connection_client_id: Ss,
4508
- n59_connection_options: $s,
4509
- n60_users_metadata: Ps,
4510
- n61_userLocales: Ms,
4511
- n62_prompt: Ls,
4512
- n63_connection_cleanup: Rs,
4513
- n64_act_as: Bs,
4514
- n65_code_verifier: Vs,
4515
- n66_email_providers: Hs,
4516
- n67_drop_tickets: Zs,
4517
- n68_login_useragents: ri,
4518
- n70_refresh_tokens: oi,
4519
- n71_session_new_fields: li,
4520
- n72_session_primary_key: ui,
4521
- n73_drop_sessions: hi,
4522
- n74_custom_domains: gi,
4523
- n75_organizations: vi,
4524
- n76_authorization_url_length: bi,
4525
- n77_drop_sessions: Si,
4526
- n78_login_sessions: $i,
4527
- n79_drop_sessions_2: Pi,
4528
- n80_recreate_custom_domains: Mi,
4529
- n81_phone: Li,
4530
- n82_forms: Ri,
4531
- n83_addFormsIdToHooks: Bi,
4532
- n84_login_completed: Vi,
4533
- n85_add_login_session_id_to_sessions: Hi,
4534
- n86_index_sessions_login_session_id: Zi,
4535
- n87_code_challenge: rl,
4536
- n88_add_redirect_uri_to_codes: ol,
4537
- n89_add_nonce_and_state_to_codes: ll,
4538
- n90_themes: ul,
4539
- n91_resource_servers_rules_permissions: hl,
4540
- n92_role_permissions: gl
4512
+ m1_init: ya,
4513
+ m2_magicLink: Ca,
4514
+ m3_updateAt: Ta,
4515
+ m4_logTable: ka,
4516
+ m5_userProfile: Da,
4517
+ m6_sessions: Fa,
4518
+ m7_passwords: za,
4519
+ m8_logsTableNewFields: Ja,
4520
+ m9_passwordTableNewField: Ua,
4521
+ n01_codesTable: qa,
4522
+ n11_universalLoginSession: Ga,
4523
+ n12_userFields: Xa,
4524
+ n13_userEmailIndex: tn,
4525
+ n14_profileDataField: nn,
4526
+ n15_userEmailIndex: ln,
4527
+ n16_userLocale: un,
4528
+ n17_signingKeys: hn,
4529
+ n18_logsFields: gn,
4530
+ n19_connectionsUserinfo: vn,
4531
+ n20_missingFields: bn,
4532
+ n21_sessionDeletedAt: Sn,
4533
+ n22_dropLogsFields: $n,
4534
+ n23_dropUsersFields: Pn,
4535
+ n24_logsIndexes: Mn,
4536
+ n25_logDescMaxLength: Ln,
4537
+ n26_logsTableExtraFields: Rn,
4538
+ n27_usersTableNameIndex: Bn,
4539
+ n28_usersEmailConstrain: Vn,
4540
+ n29_increaseOtpStateLength: Hn,
4541
+ n30_increaseTicketStateLength: Zn,
4542
+ n31_branding: ro,
4543
+ n32_indexesAndNotNull: oo,
4544
+ n33_vendorIdInUniversalLoginSession: lo,
4545
+ n34_auth0ClientInUniversalLoginSession: mo,
4546
+ n35_increaseUniversalSessionStateLength: fo,
4547
+ n36_authenticationCodes: wo,
4548
+ n37_disableSignUps: No,
4549
+ n38_otpIpAddress: xo,
4550
+ n39_increaseUserAgentLength: Oo,
4551
+ n40_userId: Io,
4552
+ n41_hooks: jo,
4553
+ n42_userIdIndexes: Ao,
4554
+ n43_userIdIndexes: Eo,
4555
+ n44_codes: Ko,
4556
+ n45_hookProperties: Qo,
4557
+ n46_loginAuth0Client: Wo,
4558
+ n47_loginAuth0Client: Yo,
4559
+ n48_saml: es,
4560
+ n49_removeFields: as,
4561
+ n50_authParamsNonce: ss,
4562
+ n51_connectionid: cs,
4563
+ n52_cert: ms,
4564
+ n53_codes_primary_key: fs,
4565
+ n54_cleanup_tables: ws,
4566
+ n55_logs_index: Ns,
4567
+ n56_application_fields: xs,
4568
+ n57_prompt_settings: Os,
4569
+ n58_connection_client_id: Is,
4570
+ n59_connection_options: js,
4571
+ n60_users_metadata: As,
4572
+ n61_userLocales: Es,
4573
+ n62_prompt: Ks,
4574
+ n63_connection_cleanup: Qs,
4575
+ n64_act_as: Ws,
4576
+ n65_code_verifier: Ys,
4577
+ n66_email_providers: ei,
4578
+ n67_drop_tickets: ai,
4579
+ n68_login_useragents: si,
4580
+ n70_refresh_tokens: ci,
4581
+ n71_session_new_fields: mi,
4582
+ n72_session_primary_key: fi,
4583
+ n73_drop_sessions: wi,
4584
+ n74_custom_domains: Ni,
4585
+ n75_organizations: xi,
4586
+ n76_authorization_url_length: Oi,
4587
+ n77_drop_sessions: Ii,
4588
+ n78_login_sessions: ji,
4589
+ n79_drop_sessions_2: Ai,
4590
+ n80_recreate_custom_domains: Ei,
4591
+ n81_phone: Ki,
4592
+ n82_forms: Qi,
4593
+ n83_addFormsIdToHooks: Wi,
4594
+ n84_login_completed: Yi,
4595
+ n85_add_login_session_id_to_sessions: el,
4596
+ n86_index_sessions_login_session_id: al,
4597
+ n87_code_challenge: sl,
4598
+ n88_add_redirect_uri_to_codes: cl,
4599
+ n89_add_nonce_and_state_to_codes: ml,
4600
+ n90_themes: fl,
4601
+ n91_resource_servers_rules_permissions: wl,
4602
+ n92_role_permissions: Nl,
4603
+ n93_add_permissions_to_roles: xl
4541
4604
  };
4542
- async function Cl(t, e = !1) {
4605
+ async function $l(t, e = !1) {
4543
4606
  e && console.log("migrating...");
4544
4607
  const r = new Le(Ee), a = new be({
4545
4608
  db: t,
@@ -4552,7 +4615,7 @@ async function Cl(t, e = !1) {
4552
4615
  }), o)
4553
4616
  throw console.error("failed to migrate"), console.error(o), o;
4554
4617
  }
4555
- async function bl(t) {
4618
+ async function Il(t) {
4556
4619
  console.log("migrating...");
4557
4620
  const e = new Le(Ee), r = new be({
4558
4621
  db: t,
@@ -4563,7 +4626,7 @@ async function bl(t) {
4563
4626
  }), a)
4564
4627
  throw console.error("failed to migrate"), console.error(a), a;
4565
4628
  }
4566
- function xl(t) {
4629
+ function Dl(t) {
4567
4630
  return {
4568
4631
  applications: jt(t),
4569
4632
  branding: er(t),
@@ -4572,7 +4635,7 @@ function xl(t) {
4572
4635
  codes: Ot(t),
4573
4636
  connections: Et(t),
4574
4637
  emailProviders: br(t),
4575
- customDomains: Xt(t),
4638
+ customDomains: Yt(t),
4576
4639
  forms: Ar(t),
4577
4640
  hooks: sr(t),
4578
4641
  keys: Bt(t),
@@ -4582,8 +4645,9 @@ function xl(t) {
4582
4645
  promptSettings: yr(t),
4583
4646
  refreshTokens: $r(t),
4584
4647
  resourceServers: Kr(t),
4585
- rolePermissions: Yr(t),
4648
+ rolePermissions: Xr(t),
4586
4649
  userPermissions: ra(t),
4650
+ userRoles: sa(t),
4587
4651
  roles: Wr(t),
4588
4652
  sessions: gt(t),
4589
4653
  tenants: st(t),
@@ -4592,7 +4656,7 @@ function xl(t) {
4592
4656
  };
4593
4657
  }
4594
4658
  export {
4595
- xl as default,
4596
- bl as migrateDown,
4597
- Cl as migrateToLatest
4659
+ Dl as default,
4660
+ Il as migrateDown,
4661
+ $l as migrateToLatest
4598
4662
  };