@authhero/kysely-adapter 10.40.0 → 10.42.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.
@@ -118,20 +118,20 @@ function Ve(t) {
118
118
  }
119
119
  function S(t, e, a, r) {
120
120
  return a.split(/\s+/).map((o) => o.replace(/^([^:]+)=/g, "$1:")).map((o) => {
121
- let s = o.startsWith("-"), i = null, c = "", u = !1, _;
121
+ let s = o.startsWith("-"), i = null, d = "", u = !1, _;
122
122
  if (o.startsWith("-_exists_:"))
123
123
  i = o.substring(10), u = !0, s = !0;
124
124
  else if (o.startsWith("_exists_:"))
125
125
  i = o.substring(9), u = !0, s = !1;
126
126
  else if (o.includes(":")) {
127
- const d = s ? o.substring(1) : o, h = d.indexOf(":");
128
- i = d.substring(0, h), c = d.substring(h + 1), u = !1, c.startsWith(">=") ? (_ = ">=", c = c.substring(2)) : c.startsWith(">") ? (_ = ">", c = c.substring(1)) : c.startsWith("<=") ? (_ = "<=", c = c.substring(2)) : c.startsWith("<") ? (_ = "<", c = c.substring(1)) : _ = "=";
127
+ const c = s ? o.substring(1) : o, h = c.indexOf(":");
128
+ i = c.substring(0, h), d = c.substring(h + 1), u = !1, d.startsWith(">=") ? (_ = ">=", d = d.substring(2)) : d.startsWith(">") ? (_ = ">", d = d.substring(1)) : d.startsWith("<=") ? (_ = "<=", d = d.substring(2)) : d.startsWith("<") ? (_ = "<", d = d.substring(1)) : _ = "=";
129
129
  } else
130
- i = null, c = o, u = !1;
131
- return { key: i, value: c, isNegation: s, isExistsQuery: u, operator: _ };
132
- }).forEach(({ key: o, value: s, isNegation: i, isExistsQuery: c, operator: u }) => {
130
+ i = null, d = o, u = !1;
131
+ return { key: i, value: d, isNegation: s, isExistsQuery: u, operator: _ };
132
+ }).forEach(({ key: o, value: s, isNegation: i, isExistsQuery: d, operator: u }) => {
133
133
  if (o)
134
- if (c)
134
+ if (d)
135
135
  i ? e = e.where(o, "is", null) : e = e.where(o, "is not", null);
136
136
  else if (i)
137
137
  switch (u) {
@@ -155,8 +155,8 @@ function S(t, e, a, r) {
155
155
  else if (s) {
156
156
  const { ref: _ } = t.dynamic;
157
157
  e = e.where(
158
- (d) => d.or(
159
- r.map((h) => d(_(h), "like", `%${s}%`))
158
+ (c) => c.or(
159
+ r.map((h) => c(_(h), "like", `%${s}%`))
160
160
  )
161
161
  );
162
162
  }
@@ -168,12 +168,12 @@ function x(t) {
168
168
  function Ge(t) {
169
169
  return async (e, a = {}) => {
170
170
  const { page: r = 0, per_page: n = 50, include_totals: o = !1, sort: s, q: i } = a;
171
- let c = t.selectFrom("users").where("users.tenant_id", "=", e);
172
- if (i && (c = S(t, c, i, ["email", "name"])), s && s.sort_by) {
171
+ let d = t.selectFrom("users").where("users.tenant_id", "=", e);
172
+ if (i && (d = S(t, d, i, ["email", "name"])), s && s.sort_by) {
173
173
  const { ref: w } = t.dynamic;
174
- c = c.orderBy(w(s.sort_by), s.sort_order);
174
+ d = d.orderBy(w(s.sort_by), s.sort_order);
175
175
  }
176
- const _ = await c.offset(r * n).limit(n).selectAll().execute(), d = _.map((w) => w.user_id), h = d.length ? await t.selectFrom("users").selectAll().where("users.tenant_id", "=", e).where("users.linked_to", "in", d).execute() : [], f = _.map((w) => {
176
+ const _ = await d.offset(r * n).limit(n).selectAll().execute(), c = _.map((w) => w.user_id), h = c.length ? await t.selectFrom("users").selectAll().where("users.tenant_id", "=", e).where("users.linked_to", "in", c).execute() : [], f = _.map((w) => {
177
177
  const b = h.filter(
178
178
  (D) => D.linked_to === w.user_id
179
179
  );
@@ -201,7 +201,7 @@ function Ge(t) {
201
201
  limit: 0,
202
202
  length: 0
203
203
  };
204
- const { count: g } = await c.select((w) => w.fn.countAll().as("count")).executeTakeFirstOrThrow();
204
+ const { count: g } = await d.select((w) => w.fn.countAll().as("count")).executeTakeFirstOrThrow();
205
205
  return {
206
206
  users: f,
207
207
  start: r * n,
@@ -305,7 +305,7 @@ function rt(t) {
305
305
  return {
306
306
  tenants: _
307
307
  };
308
- const { count: d } = await a.select((f) => f.fn.countAll().as("count")).executeTakeFirstOrThrow(), h = x(d);
308
+ const { count: c } = await a.select((f) => f.fn.countAll().as("count")).executeTakeFirstOrThrow(), h = x(c);
309
309
  return {
310
310
  tenants: _,
311
311
  start: r * n,
@@ -382,35 +382,35 @@ function we(t) {
382
382
  _id: t.id
383
383
  };
384
384
  }
385
- function ct(t) {
385
+ function dt(t) {
386
386
  return async (e, a = {}) => {
387
387
  const { page: r = 0, per_page: n = 50, include_totals: o = !1, sort: s, q: i } = a;
388
- let c = t.selectFrom("logs").where("logs.tenant_id", "=", e);
389
- i && (c = S(t, c, i, ["user_id", "ip"]));
390
- let u = c;
388
+ let d = t.selectFrom("logs").where("logs.tenant_id", "=", e);
389
+ i && (d = S(t, d, i, ["user_id", "ip"]));
390
+ let u = d;
391
391
  if (s && s.sort_by) {
392
392
  const { ref: f } = t.dynamic;
393
393
  u = u.orderBy(f(s.sort_by), s.sort_order);
394
394
  }
395
395
  u = u.offset(r * n).limit(n);
396
- const d = (await u.selectAll().execute()).map(we);
396
+ const c = (await u.selectAll().execute()).map(we);
397
397
  if (!o)
398
398
  return {
399
- logs: d,
399
+ logs: c,
400
400
  start: 0,
401
401
  limit: 0,
402
402
  length: 0
403
403
  };
404
- const { count: h } = await c.select((f) => f.fn.countAll().as("count")).executeTakeFirstOrThrow();
404
+ const { count: h } = await d.select((f) => f.fn.countAll().as("count")).executeTakeFirstOrThrow();
405
405
  return {
406
- logs: d,
406
+ logs: c,
407
407
  start: r * n,
408
408
  limit: n,
409
409
  length: x(h)
410
410
  };
411
411
  };
412
412
  }
413
- function dt(t) {
413
+ function ct(t) {
414
414
  return async (e, a) => {
415
415
  const r = await t.selectFrom("logs").where("logs.tenant_id", "=", e).where("logs.id", "=", a).selectAll().executeTakeFirst();
416
416
  return r ? we(r) : null;
@@ -419,8 +419,8 @@ function dt(t) {
419
419
  function ut(t) {
420
420
  return {
421
421
  create: lt(t),
422
- list: ct(t),
423
- get: dt(t)
422
+ list: dt(t),
423
+ get: ct(t)
424
424
  };
425
425
  }
426
426
  function mt(t) {
@@ -470,29 +470,29 @@ function ft(t) {
470
470
  function pt(t) {
471
471
  return async (e, a = {}) => {
472
472
  const { page: r = 0, per_page: n = 50, include_totals: o = !1, sort: s, q: i } = a;
473
- let c = t.selectFrom("sessions").where("sessions.tenant_id", "=", e);
474
- i && (c = S(t, c, i, ["user_id", "session_id"]));
475
- let u = c;
473
+ let d = t.selectFrom("sessions").where("sessions.tenant_id", "=", e);
474
+ i && (d = S(t, d, i, ["user_id", "session_id"]));
475
+ let u = d;
476
476
  if (s && s.sort_by) {
477
477
  const { ref: g } = t.dynamic;
478
478
  u = u.orderBy(g(s.sort_by), s.sort_order);
479
479
  }
480
480
  u = u.offset(r * n).limit(n);
481
- const d = (await u.selectAll().execute()).map((g) => ({
481
+ const c = (await u.selectAll().execute()).map((g) => ({
482
482
  ...g,
483
483
  device: JSON.parse(g.device),
484
484
  clients: JSON.parse(g.clients)
485
485
  }));
486
486
  if (!o)
487
487
  return {
488
- sessions: d,
488
+ sessions: c,
489
489
  start: 0,
490
490
  limit: 0,
491
491
  length: 0
492
492
  };
493
- const { count: h } = await c.select((g) => g.fn.countAll().as("count")).executeTakeFirstOrThrow(), f = x(h);
493
+ const { count: h } = await d.select((g) => g.fn.countAll().as("count")).executeTakeFirstOrThrow(), f = x(h);
494
494
  return {
495
- sessions: d,
495
+ sessions: c,
496
496
  start: r * n,
497
497
  limit: n,
498
498
  length: f
@@ -559,12 +559,12 @@ function Ct(t) {
559
559
  limit: 0,
560
560
  length: 0
561
561
  };
562
- const { count: d } = await i.select((h) => h.fn.countAll().as("count")).executeTakeFirstOrThrow();
562
+ const { count: c } = await i.select((h) => h.fn.countAll().as("count")).executeTakeFirstOrThrow();
563
563
  return {
564
564
  codes: _,
565
565
  start: r * n,
566
566
  limit: n,
567
- length: x(d)
567
+ length: x(c)
568
568
  };
569
569
  };
570
570
  }
@@ -610,7 +610,7 @@ function kt(t) {
610
610
  updated_at: (/* @__PURE__ */ new Date()).toISOString(),
611
611
  ...a,
612
612
  disable_sign_ups: a.disable_sign_ups ?? !1
613
- }, n = JSON.stringify(a.allowed_origins), o = JSON.stringify(a.callbacks), s = JSON.stringify(a.web_origins), i = JSON.stringify(a.allowed_logout_urls), c = JSON.stringify(a.allowed_clients);
613
+ }, n = JSON.stringify(a.allowed_origins), o = JSON.stringify(a.callbacks), s = JSON.stringify(a.web_origins), i = JSON.stringify(a.allowed_logout_urls), d = JSON.stringify(a.allowed_clients);
614
614
  return await t.insertInto("applications").values({
615
615
  ...r,
616
616
  tenant_id: e,
@@ -620,7 +620,7 @@ function kt(t) {
620
620
  allowed_origins: n,
621
621
  web_origins: s,
622
622
  allowed_logout_urls: i,
623
- allowed_clients: c
623
+ allowed_clients: d
624
624
  }).execute(), r;
625
625
  };
626
626
  }
@@ -655,7 +655,7 @@ function It(t) {
655
655
  function Dt(t) {
656
656
  return async (e, a) => (await t.deleteFrom("applications").where("applications.tenant_id", "=", e).where("applications.id", "=", a).executeTakeFirst()).numDeletedRows > 0;
657
657
  }
658
- function Pt(t) {
658
+ function zt(t) {
659
659
  return async (e, a, r) => {
660
660
  const n = {
661
661
  ...r,
@@ -671,13 +671,13 @@ function Pt(t) {
671
671
  return await t.updateTable("applications").set(n).where("applications.id", "=", a).where("applications.tenant_id", "=", e).execute(), !0;
672
672
  };
673
673
  }
674
- function zt(t) {
674
+ function Pt(t) {
675
675
  return {
676
676
  create: kt(t),
677
677
  list: $t(t),
678
678
  get: It(t),
679
679
  remove: Dt(t),
680
- update: Pt(t)
680
+ update: zt(t)
681
681
  };
682
682
  }
683
683
  function jt(t) {
@@ -714,12 +714,12 @@ function Ft(t) {
714
714
  limit: 0,
715
715
  length: 0
716
716
  };
717
- const { count: d } = await i.select((h) => h.fn.countAll().as("count")).executeTakeFirstOrThrow();
717
+ const { count: c } = await i.select((h) => h.fn.countAll().as("count")).executeTakeFirstOrThrow();
718
718
  return {
719
719
  connections: _,
720
720
  start: r * n,
721
721
  limit: n,
722
- length: x(d)
722
+ length: x(c)
723
723
  };
724
724
  };
725
725
  }
@@ -735,7 +735,7 @@ function Mt(t) {
735
735
  }) : null;
736
736
  };
737
737
  }
738
- function Jt(t) {
738
+ function Et(t) {
739
739
  return async (e, a, r) => {
740
740
  const n = {
741
741
  ...r,
@@ -747,13 +747,13 @@ function Jt(t) {
747
747
  }).where("connections.id", "=", a).where("connections.tenant_id", "=", e).execute(), !0;
748
748
  };
749
749
  }
750
- function Et(t) {
750
+ function Jt(t) {
751
751
  return {
752
752
  create: jt(t),
753
753
  get: Mt(t),
754
754
  list: Ft(t),
755
755
  remove: At(t),
756
- update: Jt(t)
756
+ update: Et(t)
757
757
  };
758
758
  }
759
759
  function Lt(t) {
@@ -811,7 +811,7 @@ function Rt(t) {
811
811
  "thumbprint",
812
812
  "type"
813
813
  ]));
814
- let c = i.select((f) => f.fn.count("kid").as("count"));
814
+ let d = i.select((f) => f.fn.count("kid").as("count"));
815
815
  const u = a * r;
816
816
  i = i.limit(r).offset(u), o && (i = i.orderBy(o.sort_by, o.sort_order));
817
817
  const _ = await i.selectAll().execute();
@@ -822,7 +822,7 @@ function Rt(t) {
822
822
  limit: 0,
823
823
  length: 0
824
824
  };
825
- const d = await c.executeTakeFirst(), h = x((d == null ? void 0 : d.count) ?? 0);
825
+ const c = await d.executeTakeFirst(), h = x((c == null ? void 0 : c.count) ?? 0);
826
826
  return {
827
827
  signingKeys: _,
828
828
  start: u,
@@ -921,7 +921,7 @@ function Xt(t) {
921
921
  colors_page_background_type: o,
922
922
  colors_page_background_start: s,
923
923
  colors_page_background_end: i,
924
- colors_page_background_angle_dev: c,
924
+ colors_page_background_angle_dev: d,
925
925
  font_url: u,
926
926
  ..._
927
927
  } = a;
@@ -933,7 +933,7 @@ function Xt(t) {
933
933
  type: o,
934
934
  start: s,
935
935
  end: i,
936
- angle_deg: c
936
+ angle_deg: d
937
937
  }
938
938
  },
939
939
  font: u ? { url: u } : void 0
@@ -942,15 +942,15 @@ function Xt(t) {
942
942
  }
943
943
  function Zt(t) {
944
944
  return async (e, a) => {
945
- var s, i, c, u, _, d, h, f, g, w, b, D, F, P, V, le, ce, de;
945
+ var s, i, d, u, _, c, h, f, g, w, b, D, F, z, V, le, de, ce;
946
946
  const { colors: r, font: n, ...o } = a;
947
947
  try {
948
948
  await t.insertInto("branding").values({
949
949
  ...o,
950
950
  colors_primary: r == null ? void 0 : r.primary,
951
951
  colors_page_background_type: (i = (s = a.colors) == null ? void 0 : s.page_background) == null ? void 0 : i.type,
952
- colors_page_background_start: (u = (c = a.colors) == null ? void 0 : c.page_background) == null ? void 0 : u.start,
953
- colors_page_background_end: (d = (_ = a.colors) == null ? void 0 : _.page_background) == null ? void 0 : d.end,
952
+ colors_page_background_start: (u = (d = a.colors) == null ? void 0 : d.page_background) == null ? void 0 : u.start,
953
+ colors_page_background_end: (c = (_ = a.colors) == null ? void 0 : _.page_background) == null ? void 0 : c.end,
954
954
  colors_page_background_angle_dev: (f = (h = a.colors) == null ? void 0 : h.page_background) == null ? void 0 : f.angle_deg,
955
955
  font_url: (g = a.font) == null ? void 0 : g.url,
956
956
  tenant_id: e
@@ -961,9 +961,9 @@ function Zt(t) {
961
961
  colors_primary: r == null ? void 0 : r.primary,
962
962
  colors_page_background_type: (b = (w = a.colors) == null ? void 0 : w.page_background) == null ? void 0 : b.type,
963
963
  colors_page_background_start: (F = (D = a.colors) == null ? void 0 : D.page_background) == null ? void 0 : F.start,
964
- colors_page_background_end: (V = (P = a.colors) == null ? void 0 : P.page_background) == null ? void 0 : V.end,
965
- colors_page_background_angle_dev: (ce = (le = a.colors) == null ? void 0 : le.page_background) == null ? void 0 : ce.angle_deg,
966
- font_url: (de = a.font) == null ? void 0 : de.url
964
+ colors_page_background_end: (V = (z = a.colors) == null ? void 0 : z.page_background) == null ? void 0 : V.end,
965
+ colors_page_background_angle_dev: (de = (le = a.colors) == null ? void 0 : le.page_background) == null ? void 0 : de.angle_deg,
966
+ font_url: (ce = a.font) == null ? void 0 : ce.url
967
967
  }).where("tenant_id", "=", e).execute();
968
968
  }
969
969
  };
@@ -994,12 +994,12 @@ function ta(t) {
994
994
  limit: 0,
995
995
  length: 0
996
996
  };
997
- const { count: d } = await i.select((h) => h.fn.countAll().as("count")).executeTakeFirstOrThrow();
997
+ const { count: c } = await i.select((h) => h.fn.countAll().as("count")).executeTakeFirstOrThrow();
998
998
  return {
999
999
  hooks: _,
1000
1000
  start: r * n,
1001
1001
  limit: n,
1002
- length: x(d)
1002
+ length: x(c)
1003
1003
  };
1004
1004
  };
1005
1005
  }
@@ -1069,7 +1069,7 @@ function ia(t) {
1069
1069
  function la(t) {
1070
1070
  return async (e, a) => (await t.deleteFrom("themes").where("themes.tenant_id", "=", e).where("themes.themeId", "=", a).executeTakeFirst()).numDeletedRows > 0;
1071
1071
  }
1072
- function ca(t) {
1072
+ function da(t) {
1073
1073
  return async (e, a) => {
1074
1074
  const r = await t.selectFrom("themes").where("themes.tenant_id", "=", e).where("themes.themeId", "=", a).selectAll().executeTakeFirst();
1075
1075
  if (!r)
@@ -1095,7 +1095,7 @@ function ca(t) {
1095
1095
  );
1096
1096
  };
1097
1097
  }
1098
- function da(t) {
1098
+ function ca(t) {
1099
1099
  return async (e, a, r) => {
1100
1100
  const n = L({
1101
1101
  ...r,
@@ -1107,9 +1107,9 @@ function da(t) {
1107
1107
  function ua(t) {
1108
1108
  return {
1109
1109
  create: ia(t),
1110
- get: ca(t),
1110
+ get: da(t),
1111
1111
  remove: la(t),
1112
- update: da(t)
1112
+ update: ca(t)
1113
1113
  };
1114
1114
  }
1115
1115
  function ma(t) {
@@ -1295,15 +1295,15 @@ function Oa(t) {
1295
1295
  function ka(t) {
1296
1296
  return async (e, a = {}) => {
1297
1297
  const { page: r = 0, per_page: n = 50, include_totals: o = !1, sort: s, q: i } = a;
1298
- let c = t.selectFrom("refresh_tokens").where("refresh_tokens.tenant_id", "=", e);
1299
- i && (c = S(t, c, i, ["token", "session_id"]));
1300
- let u = c;
1298
+ let d = t.selectFrom("refresh_tokens").where("refresh_tokens.tenant_id", "=", e);
1299
+ i && (d = S(t, d, i, ["token", "session_id"]));
1300
+ let u = d;
1301
1301
  if (s && s.sort_by) {
1302
1302
  const { ref: g } = t.dynamic;
1303
1303
  u = u.orderBy(g(s.sort_by), s.sort_order);
1304
1304
  }
1305
1305
  u = u.offset(r * n).limit(n);
1306
- const d = (await u.selectAll().execute()).map((g) => ({
1306
+ const c = (await u.selectAll().execute()).map((g) => ({
1307
1307
  ...g,
1308
1308
  rotating: !!g.rotating,
1309
1309
  device: g.device ? JSON.parse(g.device) : {},
@@ -1311,14 +1311,14 @@ function ka(t) {
1311
1311
  }));
1312
1312
  if (!o)
1313
1313
  return {
1314
- refresh_tokens: d,
1314
+ refresh_tokens: c,
1315
1315
  start: 0,
1316
1316
  limit: 0,
1317
1317
  length: 0
1318
1318
  };
1319
- const { count: h } = await c.select((g) => g.fn.countAll().as("count")).executeTakeFirstOrThrow(), f = x(h);
1319
+ const { count: h } = await d.select((g) => g.fn.countAll().as("count")).executeTakeFirstOrThrow(), f = x(h);
1320
1320
  return {
1321
- refresh_tokens: d,
1321
+ refresh_tokens: c,
1322
1322
  start: r * n,
1323
1323
  limit: n,
1324
1324
  length: f
@@ -1382,7 +1382,7 @@ function Da(t) {
1382
1382
  }).execute(), Y.parse(r);
1383
1383
  };
1384
1384
  }
1385
- function Pa(t) {
1385
+ function za(t) {
1386
1386
  return async (e, a = {}) => {
1387
1387
  const { page: r = 0, per_page: n = 50, include_totals: o = !1, q: s } = a;
1388
1388
  let i = t.selectFrom("forms").where("tenant_id", "=", e);
@@ -1413,16 +1413,16 @@ function Pa(t) {
1413
1413
  limit: 0,
1414
1414
  length: 0
1415
1415
  };
1416
- const { count: d } = await i.select((h) => h.fn.countAll().as("count")).executeTakeFirstOrThrow();
1416
+ const { count: c } = await i.select((h) => h.fn.countAll().as("count")).executeTakeFirstOrThrow();
1417
1417
  return {
1418
1418
  forms: _,
1419
1419
  start: r * n,
1420
1420
  limit: n,
1421
- length: x(d)
1421
+ length: x(c)
1422
1422
  };
1423
1423
  };
1424
1424
  }
1425
- function za(t) {
1425
+ function Pa(t) {
1426
1426
  return async (e, a) => {
1427
1427
  const { numDeletedRows: r } = await t.deleteFrom("forms").where("id", "=", a).where("tenant_id", "=", e).executeTakeFirst();
1428
1428
  return r > 0;
@@ -1466,8 +1466,8 @@ function Aa(t) {
1466
1466
  return {
1467
1467
  create: Da(t),
1468
1468
  get: ja(t),
1469
- list: Pa(t),
1470
- remove: za(t),
1469
+ list: za(t),
1470
+ remove: Pa(t),
1471
1471
  update: Fa(t)
1472
1472
  };
1473
1473
  }
@@ -1481,15 +1481,15 @@ function Ma(t) {
1481
1481
  }, o = Qe.parse(n), {
1482
1482
  verificationKey: s,
1483
1483
  scopes: i,
1484
- options: c,
1484
+ options: d,
1485
1485
  skip_consent_for_verifiable_first_party_clients: u,
1486
1486
  allow_offline_access: _,
1487
- ...d
1487
+ ...c
1488
1488
  } = o, h = {
1489
- ...d,
1489
+ ...c,
1490
1490
  tenant_id: e,
1491
1491
  scopes: i ? JSON.stringify(i) : "[]",
1492
- options: c ? JSON.stringify(c) : "{}",
1492
+ options: d ? JSON.stringify(d) : "{}",
1493
1493
  skip_consent_for_verifiable_first_party_clients: u ? 1 : 0,
1494
1494
  allow_offline_access: _ ? 1 : 0,
1495
1495
  verification_key: s,
@@ -1499,7 +1499,7 @@ function Ma(t) {
1499
1499
  return await t.insertInto("resource_servers").values(h).execute(), y(o);
1500
1500
  };
1501
1501
  }
1502
- function Ja(t) {
1502
+ function Ea(t) {
1503
1503
  return async (e, a) => {
1504
1504
  const r = await t.selectFrom("resource_servers").selectAll().where("tenant_id", "=", e).where("id", "=", a).executeTakeFirst();
1505
1505
  if (!r) return null;
@@ -1507,30 +1507,30 @@ function Ja(t) {
1507
1507
  verification_key: o,
1508
1508
  scopes: s,
1509
1509
  options: i,
1510
- skip_consent_for_verifiable_first_party_clients: c,
1510
+ skip_consent_for_verifiable_first_party_clients: d,
1511
1511
  allow_offline_access: u,
1512
1512
  ..._
1513
- } = n, d = {
1513
+ } = n, c = {
1514
1514
  ..._,
1515
1515
  scopes: s ? JSON.parse(s) : [],
1516
1516
  options: i ? JSON.parse(i) : {},
1517
- skip_consent_for_verifiable_first_party_clients: !!c,
1517
+ skip_consent_for_verifiable_first_party_clients: !!d,
1518
1518
  allow_offline_access: !!u,
1519
1519
  // Convert verification_key back to verificationKey for API
1520
1520
  verificationKey: o
1521
1521
  };
1522
- return y(d);
1522
+ return y(c);
1523
1523
  };
1524
1524
  }
1525
- function Ea(t) {
1525
+ function Ja(t) {
1526
1526
  return async (e, a = {}) => {
1527
1527
  const { page: r = 0, per_page: n = 50, include_totals: o = !1, q: s } = a;
1528
1528
  let i = t.selectFrom("resource_servers").where("resource_servers.tenant_id", "=", e);
1529
1529
  if (s) {
1530
1530
  const h = s.trim(), f = h.split(/\s+/), g = f.length === 1 ? f[0] : void 0, w = g ? g.match(/^(-)?(name|identifier):(.*)$/) : null, b = w ? w[3] : "", D = /^(>=|>|<=|<)/.test(b || "");
1531
1531
  if (w && !D) {
1532
- const F = !!w[1], P = w[2] === "name" ? "resource_servers.name" : "resource_servers.identifier";
1533
- i = F ? i.where(P, "not like", `%${b}%`) : i.where(P, "like", `%${b}%`);
1532
+ const F = !!w[1], z = w[2] === "name" ? "resource_servers.name" : "resource_servers.identifier";
1533
+ i = F ? i.where(z, "not like", `%${b}%`) : i.where(z, "like", `%${b}%`);
1534
1534
  } else
1535
1535
  i = S(t, i, h, [
1536
1536
  "resource_servers.name",
@@ -1544,9 +1544,9 @@ function Ea(t) {
1544
1544
  options: b,
1545
1545
  skip_consent_for_verifiable_first_party_clients: D,
1546
1546
  allow_offline_access: F,
1547
- ...P
1547
+ ...z
1548
1548
  } = f, V = {
1549
- ...P,
1549
+ ...z,
1550
1550
  scopes: w ? JSON.parse(w) : [],
1551
1551
  options: b ? JSON.parse(b) : {},
1552
1552
  skip_consent_for_verifiable_first_party_clients: !!D,
@@ -1563,12 +1563,12 @@ function Ea(t) {
1563
1563
  limit: 0,
1564
1564
  length: 0
1565
1565
  };
1566
- const { count: d } = await i.select((h) => h.fn.countAll().as("count")).executeTakeFirstOrThrow();
1566
+ const { count: c } = await i.select((h) => h.fn.countAll().as("count")).executeTakeFirstOrThrow();
1567
1567
  return {
1568
1568
  resource_servers: _,
1569
1569
  start: r * n,
1570
1570
  limit: n,
1571
- length: x(d)
1571
+ length: x(c)
1572
1572
  };
1573
1573
  };
1574
1574
  }
@@ -1585,22 +1585,22 @@ function Ra(t) {
1585
1585
  scopes: o,
1586
1586
  options: s,
1587
1587
  skip_consent_for_verifiable_first_party_clients: i,
1588
- allow_offline_access: c,
1588
+ allow_offline_access: d,
1589
1589
  ...u
1590
1590
  } = r, _ = {
1591
1591
  ...u,
1592
1592
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
1593
1593
  };
1594
- n !== void 0 && (_.verification_key = n), o !== void 0 && (_.scopes = JSON.stringify(o)), s !== void 0 && (_.options = JSON.stringify(s)), i !== void 0 && (_.skip_consent_for_verifiable_first_party_clients = i ? 1 : 0), c !== void 0 && (_.allow_offline_access = c ? 1 : 0);
1595
- const d = await t.updateTable("resource_servers").set(_).where("tenant_id", "=", e).where("id", "=", a).executeTakeFirst();
1596
- return Number(d.numUpdatedRows) > 0;
1594
+ n !== void 0 && (_.verification_key = n), o !== void 0 && (_.scopes = JSON.stringify(o)), s !== void 0 && (_.options = JSON.stringify(s)), i !== void 0 && (_.skip_consent_for_verifiable_first_party_clients = i ? 1 : 0), d !== void 0 && (_.allow_offline_access = d ? 1 : 0);
1595
+ const c = await t.updateTable("resource_servers").set(_).where("tenant_id", "=", e).where("id", "=", a).executeTakeFirst();
1596
+ return Number(c.numUpdatedRows) > 0;
1597
1597
  };
1598
1598
  }
1599
1599
  function Ka(t) {
1600
1600
  return {
1601
1601
  create: Ma(t),
1602
- get: Ja(t),
1603
- list: Ea(t),
1602
+ get: Ea(t),
1603
+ list: Ja(t),
1604
1604
  remove: La(t),
1605
1605
  update: Ra(t)
1606
1606
  };
@@ -1635,17 +1635,17 @@ function Ba(t) {
1635
1635
  let r = t.selectFrom("roles").where("roles.tenant_id", "=", e);
1636
1636
  const { page: n = 0, per_page: o = 50, include_totals: s = !1 } = a;
1637
1637
  a.q && (r = S(t, r, a.q, ["name"]));
1638
- const c = await r.offset(n * o).limit(o).selectAll().execute();
1638
+ const d = await r.offset(n * o).limit(o).selectAll().execute();
1639
1639
  if (!s)
1640
1640
  return {
1641
- roles: c,
1641
+ roles: d,
1642
1642
  start: n * o,
1643
1643
  limit: o,
1644
- length: c.length
1644
+ length: d.length
1645
1645
  };
1646
1646
  const { count: u } = await r.select((_) => _.fn.countAll().as("count")).executeTakeFirstOrThrow();
1647
1647
  return {
1648
- roles: c,
1648
+ roles: d,
1649
1649
  start: n * o,
1650
1650
  limit: o,
1651
1651
  length: x(u)
@@ -1730,7 +1730,7 @@ function Ha(t) {
1730
1730
  const { page: n = 0, per_page: o = 50, include_totals: s = !1 } = r;
1731
1731
  let i = t.selectFrom("role_permissions").leftJoin(
1732
1732
  "resource_servers",
1733
- (d) => d.onRef(
1733
+ (c) => c.onRef(
1734
1734
  "role_permissions.tenant_id",
1735
1735
  "=",
1736
1736
  "resource_servers.tenant_id"
@@ -1746,17 +1746,17 @@ function Ha(t) {
1746
1746
  "role_permissions.created_at",
1747
1747
  "resource_servers.name as resource_server_name"
1748
1748
  ]).where("role_permissions.tenant_id", "=", e).where("role_permissions.role_id", "=", a);
1749
- const _ = (await i.offset(n * o).limit(o).execute()).map((d) => ({
1750
- role_id: d.role_id,
1751
- resource_server_identifier: d.resource_server_identifier,
1752
- resource_server_name: d.resource_server_name || d.resource_server_identifier,
1749
+ const _ = (await i.offset(n * o).limit(o).execute()).map((c) => ({
1750
+ role_id: c.role_id,
1751
+ resource_server_identifier: c.resource_server_identifier,
1752
+ resource_server_name: c.resource_server_name || c.resource_server_identifier,
1753
1753
  // Fallback to identifier if name is null
1754
- permission_name: d.permission_name,
1754
+ permission_name: c.permission_name,
1755
1755
  description: null,
1756
1756
  // No description available from role_permissions directly
1757
- created_at: d.created_at
1757
+ created_at: c.created_at
1758
1758
  }));
1759
- return s && await i.select((d) => d.fn.countAll().as("count")).executeTakeFirstOrThrow(), _;
1759
+ return s && await i.select((c) => c.fn.countAll().as("count")).executeTakeFirstOrThrow(), _;
1760
1760
  };
1761
1761
  }
1762
1762
  function Xa(t) {
@@ -1907,7 +1907,7 @@ function lr(t) {
1907
1907
  remove: (a, r, n, o) => e.remove(a, r, n, o)
1908
1908
  };
1909
1909
  }
1910
- function cr(t) {
1910
+ function dr(t) {
1911
1911
  return async (e, a) => {
1912
1912
  const r = {
1913
1913
  ...a,
@@ -1937,7 +1937,7 @@ function cr(t) {
1937
1937
  };
1938
1938
  };
1939
1939
  }
1940
- function dr(t) {
1940
+ function cr(t) {
1941
1941
  return async (e, a) => {
1942
1942
  const r = await t.selectFrom("organizations").selectAll().where("tenant_id", "=", e).where("id", "=", a).executeTakeFirst();
1943
1943
  return r ? y({
@@ -1978,8 +1978,8 @@ function mr(t) {
1978
1978
  }
1979
1979
  function _r(t) {
1980
1980
  return async (e, a, r) => {
1981
- const { branding: n, metadata: o, enabled_connections: s, token_quota: i, ...c } = r, u = {
1982
- ...c,
1981
+ const { branding: n, metadata: o, enabled_connections: s, token_quota: i, ...d } = r, u = {
1982
+ ...d,
1983
1983
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
1984
1984
  };
1985
1985
  return n !== void 0 && (u.branding = JSON.stringify(n)), o !== void 0 && (u.metadata = JSON.stringify(o)), s !== void 0 && (u.enabled_connections = JSON.stringify(s)), i !== void 0 && (u.token_quota = JSON.stringify(i)), (await t.updateTable("organizations").set(u).where("tenant_id", "=", e).where("id", "=", a).execute()).length > 0;
@@ -1987,8 +1987,8 @@ function _r(t) {
1987
1987
  }
1988
1988
  function hr(t) {
1989
1989
  return {
1990
- create: cr(t),
1991
- get: dr(t),
1990
+ create: dr(t),
1991
+ get: cr(t),
1992
1992
  list: ur(t),
1993
1993
  remove: mr(t),
1994
1994
  update: _r(t)
@@ -2034,33 +2034,33 @@ function gr(t) {
2034
2034
  let s = t.selectFrom("user_organizations").selectAll().where("tenant_id", "=", e);
2035
2035
  if (a != null && a.q) {
2036
2036
  if (a.q.startsWith("user_id:")) {
2037
- const d = a.q.replace("user_id:", "");
2038
- s = s.where("user_id", "=", d);
2037
+ const c = a.q.replace("user_id:", "");
2038
+ s = s.where("user_id", "=", c);
2039
2039
  } else if (a.q.startsWith("organization_id:")) {
2040
- const d = a.q.replace("organization_id:", "");
2041
- s = s.where("organization_id", "=", d);
2040
+ const c = a.q.replace("organization_id:", "");
2041
+ s = s.where("organization_id", "=", c);
2042
2042
  }
2043
2043
  }
2044
2044
  s = s.orderBy("created_at", "desc"), n > 0 && (s = s.limit(n).offset(o));
2045
2045
  const i = await s.execute();
2046
- let c = t.selectFrom("user_organizations").select(t.fn.count("id").as("count")).where("tenant_id", "=", e);
2046
+ let d = t.selectFrom("user_organizations").select(t.fn.count("id").as("count")).where("tenant_id", "=", e);
2047
2047
  if (a != null && a.q) {
2048
2048
  if (a.q.startsWith("user_id:")) {
2049
- const d = a.q.replace("user_id:", "");
2050
- c = c.where("user_id", "=", d);
2049
+ const c = a.q.replace("user_id:", "");
2050
+ d = d.where("user_id", "=", c);
2051
2051
  } else if (a.q.startsWith("organization_id:")) {
2052
- const d = a.q.replace("organization_id:", "");
2053
- c = c.where("organization_id", "=", d);
2052
+ const c = a.q.replace("organization_id:", "");
2053
+ d = d.where("organization_id", "=", c);
2054
2054
  }
2055
2055
  }
2056
- const u = await c.executeTakeFirst();
2056
+ const u = await d.executeTakeFirst();
2057
2057
  return {
2058
- userOrganizations: i.map((d) => ({
2059
- id: d.id,
2060
- user_id: d.user_id,
2061
- organization_id: d.organization_id,
2062
- created_at: d.created_at,
2063
- updated_at: d.updated_at
2058
+ userOrganizations: i.map((c) => ({
2059
+ id: c.id,
2060
+ user_id: c.user_id,
2061
+ organization_id: c.organization_id,
2062
+ created_at: c.created_at,
2063
+ updated_at: c.updated_at
2064
2064
  })),
2065
2065
  start: o,
2066
2066
  limit: n,
@@ -2088,24 +2088,24 @@ function wr(t) {
2088
2088
  "user_organizations.created_at as joined_at"
2089
2089
  ]).where("user_organizations.tenant_id", "=", e).where("user_organizations.user_id", "=", a);
2090
2090
  i = i.orderBy("user_organizations.created_at", "desc"), o > 0 && (i = i.limit(o).offset(s));
2091
- const c = await i.execute(), u = await t.selectFrom("user_organizations").innerJoin(
2091
+ const d = await i.execute(), u = await t.selectFrom("user_organizations").innerJoin(
2092
2092
  "organizations",
2093
2093
  "organizations.id",
2094
2094
  "user_organizations.organization_id"
2095
2095
  ).select(t.fn.count("user_organizations.id").as("count")).where("user_organizations.tenant_id", "=", e).where("user_organizations.user_id", "=", a).executeTakeFirst();
2096
2096
  return {
2097
- organizations: c.map((d) => ({
2098
- id: d.id,
2099
- name: d.name,
2100
- display_name: d.display_name,
2101
- branding: d.branding ? JSON.parse(d.branding) : void 0,
2102
- metadata: d.metadata ? JSON.parse(d.metadata) : {},
2103
- enabled_connections: d.enabled_connections ? JSON.parse(d.enabled_connections) : [],
2104
- token_quota: d.token_quota ? JSON.parse(d.token_quota) : void 0,
2105
- created_at: d.created_at,
2106
- updated_at: d.updated_at,
2097
+ organizations: d.map((c) => ({
2098
+ id: c.id,
2099
+ name: c.name,
2100
+ display_name: c.display_name,
2101
+ branding: c.branding ? JSON.parse(c.branding) : void 0,
2102
+ metadata: c.metadata ? JSON.parse(c.metadata) : {},
2103
+ enabled_connections: c.enabled_connections ? JSON.parse(c.enabled_connections) : [],
2104
+ token_quota: c.token_quota ? JSON.parse(c.token_quota) : void 0,
2105
+ created_at: c.created_at,
2106
+ updated_at: c.updated_at,
2107
2107
  // Add membership info
2108
- joined_at: d.joined_at
2108
+ joined_at: c.joined_at
2109
2109
  })),
2110
2110
  start: s,
2111
2111
  limit: o,
@@ -3051,15 +3051,15 @@ const Tr = C({
3051
3051
  UpdateQueryNode: !0,
3052
3052
  MergeQueryNode: !0
3053
3053
  });
3054
- var E, z, j, N, ye, ve, Ne, A, re, Ce;
3054
+ var J, P, j, N, ye, ve, Ne, A, re, Ce;
3055
3055
  class Sr extends xr {
3056
3056
  constructor(a) {
3057
3057
  super();
3058
3058
  O(this, N);
3059
- O(this, E);
3060
- O(this, z, /* @__PURE__ */ new Set());
3059
+ O(this, J);
3060
+ O(this, P, /* @__PURE__ */ new Set());
3061
3061
  O(this, j, /* @__PURE__ */ new Set());
3062
- K(this, E, a);
3062
+ K(this, J, a);
3063
3063
  }
3064
3064
  transformNodeImpl(a) {
3065
3065
  if (!p(this, N, ye).call(this, a))
@@ -3069,30 +3069,30 @@ class Sr extends xr {
3069
3069
  m(this, j).add(s);
3070
3070
  const n = p(this, N, ve).call(this, a);
3071
3071
  for (const s of n)
3072
- m(this, z).add(s);
3072
+ m(this, P).add(s);
3073
3073
  const o = super.transformNodeImpl(a);
3074
3074
  for (const s of n)
3075
- m(this, z).delete(s);
3075
+ m(this, P).delete(s);
3076
3076
  for (const s of r)
3077
3077
  m(this, j).delete(s);
3078
3078
  return o;
3079
3079
  }
3080
3080
  transformSchemableIdentifier(a) {
3081
3081
  const r = super.transformSchemableIdentifier(a);
3082
- return r.schema || !m(this, z).has(a.identifier.name) ? r : {
3082
+ return r.schema || !m(this, P).has(a.identifier.name) ? r : {
3083
3083
  ...r,
3084
- schema: G.create(m(this, E))
3084
+ schema: G.create(m(this, J))
3085
3085
  };
3086
3086
  }
3087
3087
  transformReferences(a) {
3088
3088
  const r = super.transformReferences(a);
3089
3089
  return r.table.table.schema ? r : {
3090
3090
  ...r,
3091
- table: Z.createWithSchema(m(this, E), r.table.table.identifier.name)
3091
+ table: Z.createWithSchema(m(this, J), r.table.table.identifier.name)
3092
3092
  };
3093
3093
  }
3094
3094
  }
3095
- E = new WeakMap(), z = new WeakMap(), j = new WeakMap(), N = new WeakSet(), ye = function(a) {
3095
+ J = new WeakMap(), P = new WeakMap(), j = new WeakMap(), N = new WeakSet(), ye = function(a) {
3096
3096
  return a.kind in Tr;
3097
3097
  }, ve = function(a) {
3098
3098
  const r = /* @__PURE__ */ new Set();
@@ -3111,7 +3111,7 @@ E = new WeakMap(), z = new WeakMap(), j = new WeakMap(), N = new WeakSet(), ye =
3111
3111
  n && p(this, N, re).call(this, n.table, r);
3112
3112
  }, re = function(a, r) {
3113
3113
  const n = a.identifier.name;
3114
- !m(this, z).has(n) && !m(this, j).has(n) && r.add(n);
3114
+ !m(this, P).has(n) && !m(this, j).has(n) && r.add(n);
3115
3115
  }, Ce = function(a, r) {
3116
3116
  for (const n of a.expressions) {
3117
3117
  const o = n.name.table.table.identifier.name;
@@ -3141,7 +3141,7 @@ class kr {
3141
3141
  }
3142
3142
  }
3143
3143
  const $r = "kysely_migration", fe = "kysely_migration_lock", Ir = !1, ee = "migration_lock", Dr = C({ __noMigrations__: !0 });
3144
- var v, l, U, k, $, M, xe, I, Te, Se, Oe, ke, $e, ne, J, oe, Ie, De, Pe, se, ze, je, Fe, Ae, Me, q;
3144
+ var v, l, U, k, $, M, xe, I, Te, Se, Oe, ke, $e, ne, E, oe, Ie, De, ze, se, Pe, je, Fe, Ae, Me, q;
3145
3145
  class be {
3146
3146
  constructor(e) {
3147
3147
  O(this, l);
@@ -3154,7 +3154,7 @@ class be {
3154
3154
  * The returned array is sorted by migration name.
3155
3155
  */
3156
3156
  async getMigrations() {
3157
- const e = await p(this, l, J).call(this, m(this, l, $)) ? await m(this, v).db.withPlugin(m(this, l, I)).selectFrom(m(this, l, $)).select(["name", "timestamp"]).execute() : [];
3157
+ const e = await p(this, l, E).call(this, m(this, l, $)) ? await m(this, v).db.withPlugin(m(this, l, I)).selectFrom(m(this, l, $)).select(["name", "timestamp"]).execute() : [];
3158
3158
  return (await p(this, l, se).call(this)).map(({ name: r, ...n }) => {
3159
3159
  const o = e.find((s) => s.name === r);
3160
3160
  return {
@@ -3316,19 +3316,19 @@ v = new WeakMap(), l = new WeakSet(), U = async function(e) {
3316
3316
  throw e;
3317
3317
  }
3318
3318
  }, Oe = async function() {
3319
- if (!await p(this, l, J).call(this, m(this, l, $)))
3319
+ if (!await p(this, l, E).call(this, m(this, l, $)))
3320
3320
  try {
3321
3321
  m(this, l, k) && await p(this, l, q).call(this, m(this, v).db.schema.createSchema(m(this, l, k))), await p(this, l, q).call(this, m(this, v).db.schema.withPlugin(m(this, l, I)).createTable(m(this, l, $)).addColumn("name", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("timestamp", "varchar(255)", (e) => e.notNull()));
3322
3322
  } catch (e) {
3323
- if (!await p(this, l, J).call(this, m(this, l, $)))
3323
+ if (!await p(this, l, E).call(this, m(this, l, $)))
3324
3324
  throw e;
3325
3325
  }
3326
3326
  }, ke = async function() {
3327
- if (!await p(this, l, J).call(this, m(this, l, M)))
3327
+ if (!await p(this, l, E).call(this, m(this, l, M)))
3328
3328
  try {
3329
3329
  await p(this, l, q).call(this, m(this, v).db.schema.withPlugin(m(this, l, I)).createTable(m(this, l, M)).addColumn("id", "varchar(255)", (e) => e.notNull().primaryKey()).addColumn("is_locked", "integer", (e) => e.notNull().defaultTo(0)));
3330
3330
  } catch (e) {
3331
- if (!await p(this, l, J).call(this, m(this, l, M)))
3331
+ if (!await p(this, l, E).call(this, m(this, l, M)))
3332
3332
  throw e;
3333
3333
  }
3334
3334
  }, $e = async function() {
@@ -3341,7 +3341,7 @@ v = new WeakMap(), l = new WeakSet(), U = async function(e) {
3341
3341
  }
3342
3342
  }, ne = async function() {
3343
3343
  return (await m(this, v).db.introspection.getSchemas()).some((a) => a.name === m(this, l, k));
3344
- }, J = async function(e) {
3344
+ }, E = async function(e) {
3345
3345
  const a = m(this, l, k);
3346
3346
  return (await m(this, v).db.introspection.getTables({
3347
3347
  withInternalKyselyTables: !0
@@ -3359,24 +3359,24 @@ v = new WeakMap(), l = new WeakSet(), U = async function(e) {
3359
3359
  const s = await p(this, l, De).call(this, o);
3360
3360
  if (s.migrations.length === 0)
3361
3361
  return { results: [] };
3362
- const { direction: i, step: c } = e(s);
3363
- return c <= 0 ? { results: [] } : i === "Down" ? await p(this, l, Ae).call(this, o, s, c) : i === "Up" ? await p(this, l, Me).call(this, o, s, c) : { results: [] };
3362
+ const { direction: i, step: d } = e(s);
3363
+ return d <= 0 ? { results: [] } : i === "Down" ? await p(this, l, Ae).call(this, o, s, d) : i === "Up" ? await p(this, l, Me).call(this, o, s, d) : { results: [] };
3364
3364
  } finally {
3365
3365
  await a.releaseMigrationLock(o, r);
3366
3366
  }
3367
3367
  };
3368
3368
  return a.supportsTransactionalDdl ? m(this, v).db.transaction().execute(n) : m(this, v).db.connection().execute(n);
3369
3369
  }, De = async function(e) {
3370
- const a = await p(this, l, se).call(this), r = await p(this, l, ze).call(this, e);
3370
+ const a = await p(this, l, se).call(this), r = await p(this, l, Pe).call(this, e);
3371
3371
  p(this, l, je).call(this, a, r), m(this, l, xe) || p(this, l, Fe).call(this, a, r);
3372
- const n = p(this, l, Pe).call(this, a, r);
3372
+ const n = p(this, l, ze).call(this, a, r);
3373
3373
  return C({
3374
3374
  migrations: a,
3375
3375
  executedMigrations: r,
3376
3376
  lastMigration: Cr(r),
3377
3377
  pendingMigrations: n
3378
3378
  });
3379
- }, Pe = function(e, a) {
3379
+ }, ze = function(e, a) {
3380
3380
  return e.filter((r) => !a.includes(r.name));
3381
3381
  }, se = async function() {
3382
3382
  const e = await m(this, v).provider.getMigrations();
@@ -3384,7 +3384,7 @@ v = new WeakMap(), l = new WeakSet(), U = async function(e) {
3384
3384
  ...e[a],
3385
3385
  name: a
3386
3386
  }));
3387
- }, ze = async function(e) {
3387
+ }, Pe = async function(e) {
3388
3388
  return (await e.withPlugin(m(this, l, I)).selectFrom(m(this, l, $)).select("name").orderBy(["timestamp", "name"]).execute()).map((r) => r.name);
3389
3389
  }, je = function(e, a) {
3390
3390
  for (const r of a)
@@ -3408,13 +3408,13 @@ v = new WeakMap(), l = new WeakSet(), U = async function(e) {
3408
3408
  direction: "Down",
3409
3409
  status: "Success"
3410
3410
  });
3411
- } catch (c) {
3411
+ } catch (d) {
3412
3412
  throw o[s] = {
3413
3413
  migrationName: i.name,
3414
3414
  direction: "Down",
3415
3415
  status: "Error"
3416
3416
  }, new te({
3417
- error: c,
3417
+ error: d,
3418
3418
  results: o
3419
3419
  });
3420
3420
  }
@@ -3437,13 +3437,13 @@ v = new WeakMap(), l = new WeakSet(), U = async function(e) {
3437
3437
  direction: "Up",
3438
3438
  status: "Success"
3439
3439
  };
3440
- } catch (c) {
3440
+ } catch (d) {
3441
3441
  throw o[s] = {
3442
3442
  migrationName: i.name,
3443
3443
  direction: "Up",
3444
3444
  status: "Error"
3445
3445
  }, new te({
3446
- error: c,
3446
+ error: d,
3447
3447
  results: o
3448
3448
  });
3449
3449
  }
@@ -3464,7 +3464,7 @@ class te extends Error {
3464
3464
  }
3465
3465
  }
3466
3466
  W = new WeakMap();
3467
- class Je {
3467
+ class Ee {
3468
3468
  constructor(e) {
3469
3469
  R(this, "migrations");
3470
3470
  this.migrations = e;
@@ -3473,7 +3473,7 @@ class Je {
3473
3473
  return this.migrations;
3474
3474
  }
3475
3475
  }
3476
- async function Pr(t) {
3476
+ async function zr(t) {
3477
3477
  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(
3478
3478
  "tenant_id",
3479
3479
  "varchar(255)",
@@ -3545,13 +3545,13 @@ async function Pr(t) {
3545
3545
  (e) => e.references("tenants.id").onDelete("cascade").notNull()
3546
3546
  ).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();
3547
3547
  }
3548
- async function zr(t) {
3548
+ async function Pr(t) {
3549
3549
  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();
3550
3550
  }
3551
3551
  const jr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3552
3552
  __proto__: null,
3553
- down: zr,
3554
- up: Pr
3553
+ down: Pr,
3554
+ up: zr
3555
3555
  }, Symbol.toStringTag, { value: "Module" }));
3556
3556
  async function Fr(t) {
3557
3557
  await t.schema.alterTable("tenants").addColumn("support_url", "varchar(255)").execute();
@@ -3564,14 +3564,14 @@ const Mr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3564
3564
  down: Ar,
3565
3565
  up: Fr
3566
3566
  }, Symbol.toStringTag, { value: "Module" }));
3567
- async function Jr(t) {
3568
- }
3569
3567
  async function Er(t) {
3570
3568
  }
3569
+ async function Jr(t) {
3570
+ }
3571
3571
  const Lr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3572
3572
  __proto__: null,
3573
- down: Er,
3574
- up: Jr
3573
+ down: Jr,
3574
+ up: Er
3575
3575
  }, Symbol.toStringTag, { value: "Module" }));
3576
3576
  async function Rr(t) {
3577
3577
  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(
@@ -3689,14 +3689,14 @@ const ln = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3689
3689
  down: sn,
3690
3690
  up: on
3691
3691
  }, Symbol.toStringTag, { value: "Module" }));
3692
- async function cn(t) {
3693
- }
3694
3692
  async function dn(t) {
3695
3693
  }
3694
+ async function cn(t) {
3695
+ }
3696
3696
  const un = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3697
3697
  __proto__: null,
3698
- down: dn,
3699
- up: cn
3698
+ down: cn,
3699
+ up: dn
3700
3700
  }, Symbol.toStringTag, { value: "Module" }));
3701
3701
  async function mn(t) {
3702
3702
  }
@@ -3778,19 +3778,19 @@ async function In(t) {
3778
3778
  }
3779
3779
  async function Dn(t) {
3780
3780
  }
3781
- const Pn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3781
+ const zn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3782
3782
  __proto__: null,
3783
3783
  down: Dn,
3784
3784
  up: In
3785
3785
  }, Symbol.toStringTag, { value: "Module" }));
3786
- async function zn(t) {
3786
+ async function Pn(t) {
3787
3787
  }
3788
3788
  async function jn(t) {
3789
3789
  }
3790
3790
  const Fn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3791
3791
  __proto__: null,
3792
3792
  down: jn,
3793
- up: zn
3793
+ up: Pn
3794
3794
  }, Symbol.toStringTag, { value: "Module" }));
3795
3795
  async function An(t) {
3796
3796
  await t.schema.alterTable("otps").addColumn("audience", "varchar(255)").execute();
@@ -3798,19 +3798,19 @@ async function An(t) {
3798
3798
  async function Mn(t) {
3799
3799
  await t.schema.alterTable("otps").dropColumn("audience").execute();
3800
3800
  }
3801
- const Jn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3801
+ const En = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3802
3802
  __proto__: null,
3803
3803
  down: Mn,
3804
3804
  up: An
3805
3805
  }, Symbol.toStringTag, { value: "Module" }));
3806
- async function En(t) {
3806
+ async function Jn(t) {
3807
3807
  }
3808
3808
  async function Ln(t) {
3809
3809
  }
3810
3810
  const Rn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3811
3811
  __proto__: null,
3812
3812
  down: Ln,
3813
- up: En
3813
+ up: Jn
3814
3814
  }, Symbol.toStringTag, { value: "Module" }));
3815
3815
  async function Kn(t) {
3816
3816
  await t.schema.alterTable("logs").dropColumn("category").execute();
@@ -3972,12 +3972,12 @@ async function Do(t) {
3972
3972
  (e) => e.references("applications.id").onDelete("cascade").notNull()
3973
3973
  ).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();
3974
3974
  }
3975
- async function Po(t) {
3975
+ async function zo(t) {
3976
3976
  await t.schema.dropTable("authentication_codes").execute();
3977
3977
  }
3978
- const zo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3978
+ const Po = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3979
3979
  __proto__: null,
3980
- down: Po,
3980
+ down: zo,
3981
3981
  up: Do
3982
3982
  }, Symbol.toStringTag, { value: "Module" }));
3983
3983
  async function jo(t) {
@@ -3992,12 +3992,12 @@ const Ao = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3992
3992
  async function Mo(t) {
3993
3993
  await t.schema.alterTable("otps").addColumn("ip", "varchar(64)").execute();
3994
3994
  }
3995
- async function Jo(t) {
3995
+ async function Eo(t) {
3996
3996
  await t.schema.alterTable("otps").dropColumn("ip").execute();
3997
3997
  }
3998
- const Eo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3998
+ const Jo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3999
3999
  __proto__: null,
4000
- down: Jo,
4000
+ down: Eo,
4001
4001
  up: Mo
4002
4002
  }, Symbol.toStringTag, { value: "Module" }));
4003
4003
  async function Lo(t) {
@@ -4103,12 +4103,12 @@ async function is(t) {
4103
4103
  async function ls(t) {
4104
4104
  await t.schema.alterTable("logins").dropColumn("auth0Client").execute();
4105
4105
  }
4106
- const cs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4106
+ const ds = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4107
4107
  __proto__: null,
4108
4108
  down: ls,
4109
4109
  up: is
4110
4110
  }, Symbol.toStringTag, { value: "Module" }));
4111
- async function ds(t) {
4111
+ async function cs(t) {
4112
4112
  await t.schema.alterTable("logins").dropColumn("authParams_state").execute(), await t.schema.alterTable("logins").addColumn("authParams_state", "varchar(8192)").execute();
4113
4113
  }
4114
4114
  async function us(t) {
@@ -4117,7 +4117,7 @@ async function us(t) {
4117
4117
  const ms = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4118
4118
  __proto__: null,
4119
4119
  down: us,
4120
- up: ds
4120
+ up: cs
4121
4121
  }, Symbol.toStringTag, { value: "Module" }));
4122
4122
  async function _s(t) {
4123
4123
  }
@@ -4203,7 +4203,7 @@ const Is = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4203
4203
  async function Ds(t) {
4204
4204
  await t.schema.dropTable("otps").execute(), await t.schema.dropTable("authentication_codes").execute();
4205
4205
  }
4206
- async function Ps(t) {
4206
+ async function zs(t) {
4207
4207
  await t.schema.alterTable("keys").addColumn("private_key", "varchar(2048)").addColumn("public_key", "varchar(2048)").execute(), await t.schema.createTable("otps").addColumn(
4208
4208
  "tenant_id",
4209
4209
  "varchar(255)",
@@ -4222,9 +4222,9 @@ async function Ps(t) {
4222
4222
  (e) => e.references("applications.id").onDelete("cascade").notNull()
4223
4223
  ).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();
4224
4224
  }
4225
- const zs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4225
+ const Ps = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4226
4226
  __proto__: null,
4227
- down: Ps,
4227
+ down: zs,
4228
4228
  up: Ds
4229
4229
  }, Symbol.toStringTag, { value: "Module" }));
4230
4230
  async function js(t) {
@@ -4240,11 +4240,11 @@ const As = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4240
4240
  }, Symbol.toStringTag, { value: "Module" }));
4241
4241
  async function Ms(t) {
4242
4242
  }
4243
- async function Js(t) {
4243
+ async function Es(t) {
4244
4244
  }
4245
- const Es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4245
+ const Js = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4246
4246
  __proto__: null,
4247
- down: Js,
4247
+ down: Es,
4248
4248
  up: Ms
4249
4249
  }, Symbol.toStringTag, { value: "Module" }));
4250
4250
  async function Ls(t) {
@@ -4338,12 +4338,12 @@ async function ii(t) {
4338
4338
  async function li(t) {
4339
4339
  await t.schema.alterTable("logins").dropColumn("authParam_act_as").execute();
4340
4340
  }
4341
- const ci = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4341
+ const di = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4342
4342
  __proto__: null,
4343
4343
  down: li,
4344
4344
  up: ii
4345
4345
  }, Symbol.toStringTag, { value: "Module" }));
4346
- async function di(t) {
4346
+ async function ci(t) {
4347
4347
  await t.schema.alterTable("codes").addColumn("code_verifier", "varchar(128)").execute();
4348
4348
  }
4349
4349
  async function ui(t) {
@@ -4352,7 +4352,7 @@ async function ui(t) {
4352
4352
  const mi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4353
4353
  __proto__: null,
4354
4354
  down: ui,
4355
- up: di
4355
+ up: ci
4356
4356
  }, Symbol.toStringTag, { value: "Module" }));
4357
4357
  async function _i(t) {
4358
4358
  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(
@@ -4478,12 +4478,12 @@ async function Di(t) {
4478
4478
  (e) => e.onDelete("cascade")
4479
4479
  ).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();
4480
4480
  }
4481
- async function Pi(t) {
4481
+ async function zi(t) {
4482
4482
  await t.schema.dropTable("sessions_2").execute(), await t.schema.dropTable("refresh_tokens_2").execute();
4483
4483
  }
4484
- const zi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4484
+ const Pi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4485
4485
  __proto__: null,
4486
- down: Pi,
4486
+ down: zi,
4487
4487
  up: Di
4488
4488
  }, Symbol.toStringTag, { value: "Module" }));
4489
4489
  async function ji(t) {
@@ -4511,12 +4511,12 @@ const Ai = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4511
4511
  }, Symbol.toStringTag, { value: "Module" }));
4512
4512
  async function Mi(t) {
4513
4513
  }
4514
- async function Ji(t) {
4514
+ async function Ei(t) {
4515
4515
  await t.schema.alterTable("logins").dropColumn("authParams_organization").dropColumn("authorization_url").execute();
4516
4516
  }
4517
- const Ei = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4517
+ const Ji = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4518
4518
  __proto__: null,
4519
- down: Ji,
4519
+ down: Ei,
4520
4520
  up: Mi
4521
4521
  }, Symbol.toStringTag, { value: "Module" }));
4522
4522
  async function Li(t) {
@@ -4629,12 +4629,12 @@ async function il(t) {
4629
4629
  async function ll(t) {
4630
4630
  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();
4631
4631
  }
4632
- const cl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4632
+ const dl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4633
4633
  __proto__: null,
4634
4634
  down: ll,
4635
4635
  up: il
4636
4636
  }, Symbol.toStringTag, { value: "Module" }));
4637
- async function dl(t) {
4637
+ async function cl(t) {
4638
4638
  await t.schema.alterTable("login_sessions").addColumn(
4639
4639
  "login_completed",
4640
4640
  "boolean",
@@ -4647,7 +4647,7 @@ async function ul(t) {
4647
4647
  const ml = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4648
4648
  __proto__: null,
4649
4649
  down: ul,
4650
- up: dl
4650
+ up: cl
4651
4651
  }, Symbol.toStringTag, { value: "Module" }));
4652
4652
  async function _l(t) {
4653
4653
  await t.schema.alterTable("sessions").addColumn(
@@ -4794,12 +4794,12 @@ const Il = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4794
4794
  async function Dl(t) {
4795
4795
  await t.schema.createTable("resource_servers").addColumn("id", "varchar(21)", (e) => e.notNull()).addColumn("tenant_id", "varchar(191)", (e) => e.notNull()).addColumn("identifier", "varchar(191)", (e) => e.notNull()).addColumn("name", "varchar(255)", (e) => e.notNull()).addColumn("scopes", "varchar(4096)").addColumn("signing_alg", "varchar(64)").addColumn("signing_secret", "varchar(2048)").addColumn("token_lifetime", "integer").addColumn("token_lifetime_for_web", "integer").addColumn("skip_consent_for_verifiable_first_party_clients", "integer").addColumn("allow_offline_access", "integer").addColumn("verification_key", "varchar(4096)").addColumn("options", "varchar(4096)").addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("updated_at", "varchar(35)", (e) => e.notNull()).addPrimaryKeyConstraint("resource_servers_pk", ["tenant_id", "id"]).execute(), await t.schema.createIndex("resource_servers_tenant_identifier_uq").on("resource_servers").columns(["tenant_id", "identifier"]).unique().execute(), await t.schema.createTable("roles").addColumn("id", "varchar(21)", (e) => e.notNull()).addColumn("tenant_id", "varchar(191)", (e) => e.notNull()).addColumn("name", "varchar(50)", (e) => e.notNull()).addColumn("description", "varchar(255)").addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("updated_at", "varchar(35)", (e) => e.notNull()).addPrimaryKeyConstraint("roles_pk", ["tenant_id", "id"]).execute(), await t.schema.createIndex("roles_tenant_name_uq").on("roles").columns(["tenant_id", "name"]).unique().execute();
4796
4796
  }
4797
- async function Pl(t) {
4797
+ async function zl(t) {
4798
4798
  await t.schema.dropTable("roles").execute(), await t.schema.dropTable("resource_servers").execute();
4799
4799
  }
4800
- const zl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4800
+ const Pl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4801
4801
  __proto__: null,
4802
- down: Pl,
4802
+ down: zl,
4803
4803
  up: Dl
4804
4804
  }, Symbol.toStringTag, { value: "Module" }));
4805
4805
  async function jl(t) {
@@ -4838,12 +4838,12 @@ async function Ml(t) {
4838
4838
  "role_id"
4839
4839
  ]).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();
4840
4840
  }
4841
- async function Jl(t) {
4841
+ async function El(t) {
4842
4842
  await t.schema.dropTable("user_roles").execute();
4843
4843
  }
4844
- const El = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4844
+ const Jl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4845
4845
  __proto__: null,
4846
- down: Jl,
4846
+ down: El,
4847
4847
  up: Ml
4848
4848
  }, Symbol.toStringTag, { value: "Module" }));
4849
4849
  async function Ll(t) {
@@ -4928,7 +4928,97 @@ const Hl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4928
4928
  __proto__: null,
4929
4929
  down: Yl,
4930
4930
  up: Gl
4931
- }, Symbol.toStringTag, { value: "Module" })), Ee = {
4931
+ }, Symbol.toStringTag, { value: "Module" }));
4932
+ async function Xl(t) {
4933
+ await t.schema.createTable("clients").addColumn("client_id", "varchar(191)", (e) => e.notNull()).addColumn(
4934
+ "tenant_id",
4935
+ "varchar(191)",
4936
+ (e) => e.references("tenants.id").onDelete("cascade").notNull()
4937
+ ).addColumn("name", "varchar(255)", (e) => e.notNull()).addColumn("description", "varchar(140)").addColumn("global", "integer", (e) => e.defaultTo(0).notNull()).addColumn("client_secret", "varchar(255)").addColumn("app_type", "varchar(64)", (e) => e.defaultTo("regular_web")).addColumn("logo_uri", "varchar(2083)").addColumn("is_first_party", "integer", (e) => e.defaultTo(0).notNull()).addColumn(
4938
+ "oidc_conformant",
4939
+ "integer",
4940
+ (e) => e.defaultTo(1).notNull()
4941
+ ).addColumn("callbacks", "text", (e) => e.defaultTo("[]").notNull()).addColumn(
4942
+ "allowed_origins",
4943
+ "text",
4944
+ (e) => e.defaultTo("[]").notNull()
4945
+ ).addColumn("web_origins", "text", (e) => e.defaultTo("[]").notNull()).addColumn("client_aliases", "text", (e) => e.defaultTo("[]").notNull()).addColumn(
4946
+ "allowed_clients",
4947
+ "text",
4948
+ (e) => e.defaultTo("[]").notNull()
4949
+ ).addColumn(
4950
+ "allowed_logout_urls",
4951
+ "text",
4952
+ (e) => e.defaultTo("[]").notNull()
4953
+ ).addColumn(
4954
+ "session_transfer",
4955
+ "text",
4956
+ (e) => e.defaultTo("{}").notNull()
4957
+ ).addColumn("oidc_logout", "text", (e) => e.defaultTo("{}").notNull()).addColumn("grant_types", "text", (e) => e.defaultTo("[]").notNull()).addColumn(
4958
+ "jwt_configuration",
4959
+ "text",
4960
+ (e) => e.defaultTo("{}").notNull()
4961
+ ).addColumn("signing_keys", "text", (e) => e.defaultTo("[]").notNull()).addColumn("encryption_key", "text", (e) => e.defaultTo("{}").notNull()).addColumn("sso", "integer", (e) => e.defaultTo(0).notNull()).addColumn("sso_disabled", "integer", (e) => e.defaultTo(1).notNull()).addColumn(
4962
+ "cross_origin_authentication",
4963
+ "integer",
4964
+ (e) => e.defaultTo(0).notNull()
4965
+ ).addColumn("cross_origin_loc", "varchar(2083)").addColumn(
4966
+ "custom_login_page_on",
4967
+ "integer",
4968
+ (e) => e.defaultTo(0).notNull()
4969
+ ).addColumn("custom_login_page", "text").addColumn("custom_login_page_preview", "text").addColumn("form_template", "text").addColumn("addons", "text", (e) => e.defaultTo("{}").notNull()).addColumn(
4970
+ "token_endpoint_auth_method",
4971
+ "varchar(64)",
4972
+ (e) => e.defaultTo("client_secret_basic")
4973
+ ).addColumn(
4974
+ "client_metadata",
4975
+ "text",
4976
+ (e) => e.defaultTo("{}").notNull()
4977
+ ).addColumn("mobile", "text", (e) => e.defaultTo("{}").notNull()).addColumn("initiate_login_uri", "varchar(2083)").addColumn(
4978
+ "native_social_login",
4979
+ "text",
4980
+ (e) => e.defaultTo("{}").notNull()
4981
+ ).addColumn("refresh_token", "text", (e) => e.defaultTo("{}").notNull()).addColumn(
4982
+ "default_organization",
4983
+ "text",
4984
+ (e) => e.defaultTo("{}").notNull()
4985
+ ).addColumn(
4986
+ "organization_usage",
4987
+ "varchar(32)",
4988
+ (e) => e.defaultTo("deny")
4989
+ ).addColumn(
4990
+ "organization_require_behavior",
4991
+ "varchar(32)",
4992
+ (e) => e.defaultTo("no_prompt")
4993
+ ).addColumn(
4994
+ "client_authentication_methods",
4995
+ "text",
4996
+ (e) => e.defaultTo("{}").notNull()
4997
+ ).addColumn(
4998
+ "require_pushed_authorization_requests",
4999
+ "integer",
5000
+ (e) => e.defaultTo(0).notNull()
5001
+ ).addColumn(
5002
+ "require_proof_of_possession",
5003
+ "integer",
5004
+ (e) => e.defaultTo(0).notNull()
5005
+ ).addColumn(
5006
+ "signed_request_object",
5007
+ "text",
5008
+ (e) => e.defaultTo("{}").notNull()
5009
+ ).addColumn("compliance_level", "varchar(64)").addColumn("par_request_expiry", "integer").addColumn("token_quota", "text", (e) => e.defaultTo("{}").notNull()).addColumn("created_at", "varchar(35)", (e) => e.notNull()).addColumn("updated_at", "varchar(35)", (e) => e.notNull()).addPrimaryKeyConstraint("clients_tenant_id_client_id", [
5010
+ "tenant_id",
5011
+ "client_id"
5012
+ ]).execute();
5013
+ }
5014
+ async function Zl(t) {
5015
+ await t.schema.dropTable("clients").execute();
5016
+ }
5017
+ const ed = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5018
+ __proto__: null,
5019
+ down: Zl,
5020
+ up: Xl
5021
+ }, Symbol.toStringTag, { value: "Module" })), Je = {
4932
5022
  m1_init: jr,
4933
5023
  m2_magicLink: Mr,
4934
5024
  m3_updateAt: Lr,
@@ -4946,9 +5036,9 @@ const Hl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4946
5036
  n15_userEmailIndex: bn,
4947
5037
  n16_userLocale: Sn,
4948
5038
  n17_signingKeys: $n,
4949
- n18_logsFields: Pn,
5039
+ n18_logsFields: zn,
4950
5040
  n19_connectionsUserinfo: Fn,
4951
- n20_missingFields: Jn,
5041
+ n20_missingFields: En,
4952
5042
  n21_sessionDeletedAt: Rn,
4953
5043
  n22_dropLogsFields: qn,
4954
5044
  n23_dropUsersFields: Wn,
@@ -4964,9 +5054,9 @@ const Hl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4964
5054
  n33_vendorIdInUniversalLoginSession: xo,
4965
5055
  n34_auth0ClientInUniversalLoginSession: Oo,
4966
5056
  n35_increaseUniversalSessionStateLength: Io,
4967
- n36_authenticationCodes: zo,
5057
+ n36_authenticationCodes: Po,
4968
5058
  n37_disableSignUps: Ao,
4969
- n38_otpIpAddress: Eo,
5059
+ n38_otpIpAddress: Jo,
4970
5060
  n39_increaseUserAgentLength: Ko,
4971
5061
  n40_userId: Bo,
4972
5062
  n41_hooks: Vo,
@@ -4974,7 +5064,7 @@ const Hl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4974
5064
  n43_userIdIndexes: es,
4975
5065
  n44_codes: rs,
4976
5066
  n45_hookProperties: ss,
4977
- n46_loginAuth0Client: cs,
5067
+ n46_loginAuth0Client: ds,
4978
5068
  n47_loginAuth0Client: ms,
4979
5069
  n48_saml: fs,
4980
5070
  n49_removeFields: ws,
@@ -4982,9 +5072,9 @@ const Hl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4982
5072
  n51_connectionid: xs,
4983
5073
  n52_cert: Os,
4984
5074
  n53_codes_primary_key: Is,
4985
- n54_cleanup_tables: zs,
5075
+ n54_cleanup_tables: Ps,
4986
5076
  n55_logs_index: As,
4987
- n56_application_fields: Es,
5077
+ n56_application_fields: Js,
4988
5078
  n57_prompt_settings: Ks,
4989
5079
  n58_connection_client_id: Bs,
4990
5080
  n59_connection_options: Vs,
@@ -4992,7 +5082,7 @@ const Hl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4992
5082
  n61_userLocales: ei,
4993
5083
  n62_prompt: ri,
4994
5084
  n63_connection_cleanup: si,
4995
- n64_act_as: ci,
5085
+ n64_act_as: di,
4996
5086
  n65_code_verifier: mi,
4997
5087
  n66_email_providers: fi,
4998
5088
  n67_drop_tickets: wi,
@@ -5000,9 +5090,9 @@ const Hl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5000
5090
  n70_refresh_tokens: xi,
5001
5091
  n71_session_new_fields: Oi,
5002
5092
  n72_session_primary_key: Ii,
5003
- n73_drop_sessions: zi,
5093
+ n73_drop_sessions: Pi,
5004
5094
  n74_custom_domains: Ai,
5005
- n75_organizations: Ei,
5095
+ n75_organizations: Ji,
5006
5096
  n76_authorization_url_length: Ki,
5007
5097
  n77_drop_sessions: Bi,
5008
5098
  n78_login_sessions: Vi,
@@ -5010,7 +5100,7 @@ const Hl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5010
5100
  n80_recreate_custom_domains: el,
5011
5101
  n81_phone: rl,
5012
5102
  n82_forms: sl,
5013
- n83_addFormsIdToHooks: cl,
5103
+ n83_addFormsIdToHooks: dl,
5014
5104
  n84_login_completed: ml,
5015
5105
  n85_add_login_session_id_to_sessions: fl,
5016
5106
  n86_index_sessions_login_session_id: wl,
@@ -5018,17 +5108,18 @@ const Hl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5018
5108
  n88_add_redirect_uri_to_codes: xl,
5019
5109
  n89_add_nonce_and_state_to_codes: Ol,
5020
5110
  n90_themes: Il,
5021
- n91_resource_servers_rules_permissions: zl,
5111
+ n91_resource_servers_rules_permissions: Pl,
5022
5112
  n92_role_permissions: Al,
5023
- n93_add_permissions_to_roles: El,
5113
+ n93_add_permissions_to_roles: Jl,
5024
5114
  n94_keys_connection_and_extend_columns: Kl,
5025
5115
  n95_create_organizations_table: Bl,
5026
5116
  n96_create_user_organizations_table: Vl,
5027
- n97_add_organization_to_user_permissions_and_roles: Hl
5117
+ n97_add_organization_to_user_permissions_and_roles: Hl,
5118
+ n98_clients: ed
5028
5119
  };
5029
- async function ac(t, e = !1) {
5120
+ async function od(t, e = !1) {
5030
5121
  e && console.log("migrating...");
5031
- const a = new Je(Ee), r = new be({
5122
+ const a = new Ee(Je), r = new be({
5032
5123
  db: t,
5033
5124
  provider: a
5034
5125
  }), { error: n, results: o } = await r.migrateToLatest();
@@ -5039,9 +5130,9 @@ async function ac(t, e = !1) {
5039
5130
  }), n)
5040
5131
  throw console.error("failed to migrate"), console.error(n), n;
5041
5132
  }
5042
- async function rc(t) {
5133
+ async function sd(t) {
5043
5134
  console.log("migrating...");
5044
- const e = new Je(Ee), a = new be({
5135
+ const e = new Ee(Je), a = new be({
5045
5136
  db: t,
5046
5137
  provider: e
5047
5138
  }), { error: r, results: n } = await a.migrateDown();
@@ -5050,14 +5141,31 @@ async function rc(t) {
5050
5141
  }), r)
5051
5142
  throw console.error("failed to migrate"), console.error(r), r;
5052
5143
  }
5053
- function nc(t) {
5144
+ function id(t) {
5054
5145
  return {
5055
- applications: zt(t),
5146
+ applications: Pt(t),
5056
5147
  branding: ea(t),
5057
5148
  cleanup: Ia(t),
5058
- clients: Lt(t),
5149
+ clients: {
5150
+ create: async () => {
5151
+ throw new Error("Not implemented");
5152
+ },
5153
+ get: async () => {
5154
+ throw new Error("Not implemented");
5155
+ },
5156
+ list: async () => {
5157
+ throw new Error("Not implemented");
5158
+ },
5159
+ remove: async () => {
5160
+ throw new Error("Not implemented");
5161
+ },
5162
+ update: async () => {
5163
+ throw new Error("Not implemented");
5164
+ }
5165
+ },
5166
+ legacyClients: Lt(t),
5059
5167
  codes: Ot(t),
5060
- connections: Et(t),
5168
+ connections: Jt(t),
5061
5169
  emailProviders: ba(t),
5062
5170
  customDomains: Ht(t),
5063
5171
  forms: Aa(t),
@@ -5082,7 +5190,7 @@ function nc(t) {
5082
5190
  };
5083
5191
  }
5084
5192
  export {
5085
- nc as default,
5086
- rc as migrateDown,
5087
- ac as migrateToLatest
5193
+ id as default,
5194
+ sd as migrateDown,
5195
+ od as migrateToLatest
5088
5196
  };