@authhero/drizzle 0.35.0 → 0.37.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.
@@ -148,7 +148,7 @@ class Ti {
148
148
  }
149
149
  }
150
150
  m(Ti, Mt, "ColumnBuilder");
151
- const Ie = Symbol.for("drizzle:Name"), Tt = Symbol.for("drizzle:isPgEnum");
151
+ const ze = Symbol.for("drizzle:Name"), Tt = Symbol.for("drizzle:isPgEnum");
152
152
  function Nr(n) {
153
153
  return !!n && typeof n == "function" && Tt in n && n[Tt] === !0;
154
154
  }
@@ -176,7 +176,7 @@ const vr = {
176
176
  }
177
177
  }, Ae = Symbol.for("drizzle:ViewBaseConfig"), Ze = Symbol.for("drizzle:Schema"), qt = Symbol.for("drizzle:Columns"), Lt = Symbol.for("drizzle:ExtraConfigColumns"), et = Symbol.for("drizzle:OriginalName"), tt = Symbol.for("drizzle:BaseName"), Re = Symbol.for("drizzle:IsAlias"), Et = Symbol.for("drizzle:ExtraConfigBuilder"), Sr = Symbol.for("drizzle:IsDrizzleTable");
178
178
  var Rt, Wt, Ht, Gt, Yt, Xt, Zt, en, tn, nn;
179
- nn = v, tn = Ie, en = et, Zt = Ze, Xt = qt, Yt = Lt, Gt = tt, Ht = Re, Wt = Sr, Rt = Et;
179
+ nn = v, tn = ze, en = et, Zt = Ze, Xt = qt, Yt = Lt, Gt = tt, Ht = Re, Wt = Sr, Rt = Et;
180
180
  class j {
181
181
  constructor(i, e, t) {
182
182
  /**
@@ -206,12 +206,12 @@ class j {
206
206
  m(this, Wt, !0);
207
207
  /** @internal */
208
208
  m(this, Rt);
209
- this[Ie] = this[et] = i, this[Ze] = e, this[tt] = t;
209
+ this[ze] = this[et] = i, this[Ze] = e, this[tt] = t;
210
210
  }
211
211
  }
212
212
  m(j, nn, "Table"), /** @internal */
213
213
  m(j, "Symbol", {
214
- Name: Ie,
214
+ Name: ze,
215
215
  Schema: Ze,
216
216
  OriginalName: et,
217
217
  Columns: qt,
@@ -575,7 +575,7 @@ function ye(n) {
575
575
  function Ve(n) {
576
576
  return N`${n} is not null`;
577
577
  }
578
- function ze(n, i) {
578
+ function Ie(n, i) {
579
579
  return N`${n} like ${i}`;
580
580
  }
581
581
  function H(n) {
@@ -639,17 +639,17 @@ class $i {
639
639
  }
640
640
  getName() {
641
641
  const { name: i, columns: e, foreignColumns: t } = this.reference(), r = e.map((_) => _.name), o = t.map((_) => _.name), l = [
642
- this.table[Ie],
642
+ this.table[ze],
643
643
  ...r,
644
- t[0].table[Ie],
644
+ t[0].table[ze],
645
645
  ...o
646
646
  ];
647
647
  return i ?? `${l.join("_")}_fk`;
648
648
  }
649
649
  }
650
650
  m($i, gn, "SQLiteForeignKey");
651
- function zr(n, i) {
652
- return `${n[Ie]}_${i.join("_")}_unique`;
651
+ function Ir(n, i) {
652
+ return `${n[ze]}_${i.join("_")}_unique`;
653
653
  }
654
654
  var fn, mn;
655
655
  class ce extends (mn = Ti, fn = v, mn) {
@@ -685,7 +685,7 @@ m(ce, fn, "SQLiteColumnBuilder");
685
685
  var hn, pn;
686
686
  class ge extends (pn = Qe, hn = v, pn) {
687
687
  constructor(i, e) {
688
- e.uniqueName || (e.uniqueName = zr(i, [e.name])), super(i, e), this.table = i;
688
+ e.uniqueName || (e.uniqueName = Ir(i, [e.name])), super(i, e), this.table = i;
689
689
  }
690
690
  }
691
691
  m(ge, hn, "SQLiteColumn");
@@ -759,8 +759,8 @@ class Fi extends (kn = ce, On = v, kn) {
759
759
  }
760
760
  }
761
761
  m(Fi, On, "SQLiteBlobBufferBuilder");
762
- var zn, In;
763
- class Ui extends (In = ge, zn = v, In) {
762
+ var In, zn;
763
+ class Ui extends (zn = ge, In = v, zn) {
764
764
  mapFromDriverValue(i) {
765
765
  return Buffer.isBuffer(i) ? i : Buffer.from(i);
766
766
  }
@@ -768,8 +768,8 @@ class Ui extends (In = ge, zn = v, In) {
768
768
  return "blob";
769
769
  }
770
770
  }
771
- m(Ui, zn, "SQLiteBlobBuffer");
772
- function Ir(n, i) {
771
+ m(Ui, In, "SQLiteBlobBuffer");
772
+ function zr(n, i) {
773
773
  const { name: e, config: t } = Je(n, i);
774
774
  return (t == null ? void 0 : t.mode) === "json" ? new Qi(e) : (t == null ? void 0 : t.mode) === "bigint" ? new Bi(e) : new Fi(e);
775
775
  }
@@ -1084,7 +1084,7 @@ function s(n, i = {}) {
1084
1084
  }
1085
1085
  function Er() {
1086
1086
  return {
1087
- blob: Ir,
1087
+ blob: zr,
1088
1088
  customType: Tr,
1089
1089
  integer: p,
1090
1090
  numeric: qr,
@@ -1175,8 +1175,8 @@ function Te(n) {
1175
1175
  function se(...n) {
1176
1176
  return n[0].columns ? new yt(n[0].columns, n[0].name) : new yt(n);
1177
1177
  }
1178
- var zi;
1179
- zi = v;
1178
+ var Ii;
1179
+ Ii = v;
1180
1180
  class yt {
1181
1181
  constructor(i, e) {
1182
1182
  /** @internal */
@@ -1190,9 +1190,9 @@ class yt {
1190
1190
  return new dr(i, this.columns, this.name);
1191
1191
  }
1192
1192
  }
1193
- m(yt, zi, "SQLitePrimaryKeyBuilder");
1194
- var Ii;
1195
- Ii = v;
1193
+ m(yt, Ii, "SQLitePrimaryKeyBuilder");
1194
+ var zi;
1195
+ zi = v;
1196
1196
  class dr {
1197
1197
  constructor(i, e, t) {
1198
1198
  m(this, "columns");
@@ -1203,7 +1203,7 @@ class dr {
1203
1203
  return this.name ?? `${this.table[Be.Symbol.Name]}_${this.columns.map((i) => i.name).join("_")}_pk`;
1204
1204
  }
1205
1205
  }
1206
- m(dr, Ii, "SQLitePrimaryKey");
1206
+ m(dr, zi, "SQLitePrimaryKey");
1207
1207
  const D = O("tenants", {
1208
1208
  id: s("id", { length: 191 }).primaryKey(),
1209
1209
  name: s("name", { length: 255 }),
@@ -1525,7 +1525,7 @@ const D = O("tenants", {
1525
1525
  created_at: s("created_at", { length: 35 }).notNull(),
1526
1526
  expires_at: s("expires_at", { length: 35 }).notNull(),
1527
1527
  used_at: s("used_at", { length: 35 })
1528
- }), z = O(
1528
+ }), I = O(
1529
1529
  "clients",
1530
1530
  {
1531
1531
  client_id: s("client_id", { length: 191 }).notNull(),
@@ -2229,7 +2229,7 @@ const D = O("tenants", {
2229
2229
  authenticationMethods: F,
2230
2230
  branding: Le,
2231
2231
  clientGrants: G,
2232
- clients: z,
2232
+ clients: I,
2233
2233
  codes: B,
2234
2234
  connections: U,
2235
2235
  customDomains: re,
@@ -2263,19 +2263,19 @@ const D = O("tenants", {
2263
2263
  userRoles: ue,
2264
2264
  users: k
2265
2265
  }, Symbol.toStringTag, { value: "Module" }));
2266
- function I(n) {
2266
+ function z(n) {
2267
2267
  if (n == null || typeof n != "object")
2268
2268
  return n;
2269
2269
  if (Array.isArray(n))
2270
2270
  return n.map(
2271
- (e) => e !== null && typeof e == "object" ? I(e) : e
2271
+ (e) => e !== null && typeof e == "object" ? z(e) : e
2272
2272
  );
2273
2273
  const i = { ...n };
2274
2274
  for (const e in i) {
2275
2275
  const t = i[e];
2276
2276
  t === null ? delete i[e] : t !== null && typeof t == "object" && (Array.isArray(t) ? i[e] = t.map(
2277
- (r) => r !== null && typeof r == "object" ? I(r) : r
2278
- ) : i[e] = I(t));
2277
+ (r) => r !== null && typeof r == "object" ? z(r) : r
2278
+ ) : i[e] = z(t));
2279
2279
  }
2280
2280
  return i;
2281
2281
  }
@@ -2349,7 +2349,7 @@ function Ur(n) {
2349
2349
  font_url: c,
2350
2350
  ...u
2351
2351
  } = e;
2352
- return I({
2352
+ return z({
2353
2353
  ...u,
2354
2354
  colors: {
2355
2355
  primary: r,
@@ -2501,7 +2501,7 @@ function pe(n, i, e) {
2501
2501
  } else if (u) {
2502
2502
  const A = (u.includes("|") ? [...e, "user_id"] : e).map((R) => {
2503
2503
  const W = n[R];
2504
- return W ? R === "user_id" ? a(W, u) : ze(W, `%${u}%`) : null;
2504
+ return W ? R === "user_id" ? a(W, u) : Ie(W, `%${u}%`) : null;
2505
2505
  }).filter(Boolean);
2506
2506
  A.length > 0 && d.push(de(...A));
2507
2507
  }
@@ -2519,7 +2519,7 @@ const kt = [
2519
2519
  "custom_login_page_on",
2520
2520
  "require_pushed_authorization_requests",
2521
2521
  "require_proof_of_possession"
2522
- ], zt = [
2522
+ ], It = [
2523
2523
  "callbacks",
2524
2524
  "allowed_origins",
2525
2525
  "web_origins",
@@ -2528,7 +2528,7 @@ const kt = [
2528
2528
  "allowed_logout_urls",
2529
2529
  "grant_types",
2530
2530
  "signing_keys"
2531
- ], It = [
2531
+ ], zt = [
2532
2532
  "session_transfer",
2533
2533
  "oidc_logout",
2534
2534
  "jwt_configuration",
@@ -2547,11 +2547,11 @@ function Ue(n) {
2547
2547
  const { tenant_id: i, connections: e, ...t } = n, r = { ...t };
2548
2548
  for (const o of kt)
2549
2549
  r[o] = !!t[o];
2550
- for (const o of zt)
2551
- r[o] = b(t[o], []);
2552
2550
  for (const o of It)
2551
+ r[o] = b(t[o], []);
2552
+ for (const o of zt)
2553
2553
  r[o] = b(t[o], {});
2554
- return r.connections = b(e, []), I(r);
2554
+ return r.connections = b(e, []), z(r);
2555
2555
  }
2556
2556
  function At(n) {
2557
2557
  const i = { ...n };
@@ -2560,9 +2560,9 @@ function At(n) {
2560
2560
  kt,
2561
2561
  i
2562
2562
  );
2563
- for (const e of zt)
2564
- n[e] !== void 0 && (i[e] = JSON.stringify(n[e] || []));
2565
2563
  for (const e of It)
2564
+ n[e] !== void 0 && (i[e] = JSON.stringify(n[e] || []));
2565
+ for (const e of zt)
2566
2566
  n[e] !== void 0 && (i[e] = JSON.stringify(n[e] || {}));
2567
2567
  return n.connections !== void 0 && (i.connections = JSON.stringify(n.connections || [])), cr(i);
2568
2568
  }
@@ -2594,14 +2594,14 @@ function Kr(n) {
2594
2594
  for (const d of kt)
2595
2595
  r[d] = e[d] ?? !1;
2596
2596
  r.oidc_conformant = e.oidc_conformant ?? !0, r.auth0_conformant = e.auth0_conformant ?? !0, r.sso_disabled = e.sso_disabled ?? !1;
2597
- for (const d of zt)
2598
- r[d] = e[d] || [];
2599
2597
  for (const d of It)
2598
+ r[d] = e[d] || [];
2599
+ for (const d of zt)
2600
2600
  r[d] = e[d] || {};
2601
2601
  r.connections = e.connections || [];
2602
2602
  const o = At(r);
2603
2603
  try {
2604
- await n.insert(z).values({ ...o, tenant_id: i });
2604
+ await n.insert(I).values({ ...o, tenant_id: i });
2605
2605
  } catch (d) {
2606
2606
  throw (l = d == null ? void 0 : d.message) != null && l.includes("UNIQUE constraint failed") || (_ = d == null ? void 0 : d.message) != null && _.includes("duplicate key") ? new be(409, {
2607
2607
  message: "Client already exists"
@@ -2610,16 +2610,16 @@ function Kr(n) {
2610
2610
  return Ue({ ...o, tenant_id: i });
2611
2611
  },
2612
2612
  async get(i, e) {
2613
- const t = await n.select().from(z).where(
2613
+ const t = await n.select().from(I).where(
2614
2614
  g(
2615
- a(z.tenant_id, i),
2616
- a(z.client_id, e)
2615
+ a(I.tenant_id, i),
2616
+ a(I.client_id, e)
2617
2617
  )
2618
2618
  ).get();
2619
2619
  return t ? Ue(t) : null;
2620
2620
  },
2621
2621
  async getByClientId(i) {
2622
- const e = await n.select().from(z).where(a(z.client_id, i)).get();
2622
+ const e = await n.select().from(I).where(a(I.client_id, i)).get();
2623
2623
  return e ? {
2624
2624
  ...Ue(e),
2625
2625
  tenant_id: e.tenant_id
@@ -2630,10 +2630,10 @@ function Kr(n) {
2630
2630
  ...t,
2631
2631
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
2632
2632
  });
2633
- return delete r.client_id, delete r.tenant_id, await n.update(z).set(r).where(
2633
+ return delete r.client_id, delete r.tenant_id, await n.update(I).set(r).where(
2634
2634
  g(
2635
- a(z.tenant_id, i),
2636
- a(z.client_id, e)
2635
+ a(I.tenant_id, i),
2636
+ a(I.client_id, e)
2637
2637
  )
2638
2638
  ), !0;
2639
2639
  },
@@ -2645,13 +2645,13 @@ function Kr(n) {
2645
2645
  sort: l,
2646
2646
  q: _
2647
2647
  } = e || {};
2648
- let d = n.select().from(z).where(a(z.tenant_id, i)).$dynamic();
2648
+ let d = n.select().from(I).where(a(I.tenant_id, i)).$dynamic();
2649
2649
  if (_) {
2650
- const f = pe(z, _, ["name", "client_id"]);
2651
- f && (d = d.where(g(a(z.tenant_id, i), f)));
2650
+ const f = pe(I, _, ["name", "client_id"]);
2651
+ f && (d = d.where(g(a(I.tenant_id, i), f)));
2652
2652
  }
2653
2653
  if (l != null && l.sort_by) {
2654
- const f = z[l.sort_by];
2654
+ const f = I[l.sort_by];
2655
2655
  f && (d = d.orderBy(
2656
2656
  l.sort_order === "desc" ? M(f) : H(f)
2657
2657
  ));
@@ -2659,7 +2659,7 @@ function Kr(n) {
2659
2659
  const u = (await d.offset(t * r).limit(r)).map(Ue);
2660
2660
  if (!o)
2661
2661
  return { clients: u };
2662
- const [h] = await n.select({ count: V() }).from(z).where(a(z.tenant_id, i));
2662
+ const [h] = await n.select({ count: V() }).from(I).where(a(I.tenant_id, i));
2663
2663
  return {
2664
2664
  clients: u,
2665
2665
  start: t * r,
@@ -2668,10 +2668,10 @@ function Kr(n) {
2668
2668
  };
2669
2669
  },
2670
2670
  async remove(i, e) {
2671
- return (await n.delete(z).where(
2671
+ return (await n.delete(I).where(
2672
2672
  g(
2673
- a(z.tenant_id, i),
2674
- a(z.client_id, e)
2673
+ a(I.tenant_id, i),
2674
+ a(I.client_id, e)
2675
2675
  )
2676
2676
  ).returning()).length > 0;
2677
2677
  }
@@ -2679,7 +2679,7 @@ function Kr(n) {
2679
2679
  }
2680
2680
  function jr(n) {
2681
2681
  const { tenant_id: i, is_system: e, options: t, metadata: r, ...o } = n;
2682
- return I({
2682
+ return z({
2683
2683
  ...o,
2684
2684
  options: b(t, {}),
2685
2685
  metadata: b(r),
@@ -2689,10 +2689,10 @@ function jr(n) {
2689
2689
  function Mr(n) {
2690
2690
  return {
2691
2691
  async listByClient(i, e) {
2692
- const t = await n.select({ connections: z.connections }).from(z).where(
2692
+ const t = await n.select({ connections: I.connections }).from(I).where(
2693
2693
  g(
2694
- a(z.tenant_id, i),
2695
- a(z.client_id, e)
2694
+ a(I.tenant_id, i),
2695
+ a(I.client_id, e)
2696
2696
  )
2697
2697
  ).get();
2698
2698
  if (!t) return [];
@@ -2707,25 +2707,25 @@ function Mr(n) {
2707
2707
  return r.map((_) => l.find((d) => d.id === _)).filter(Boolean);
2708
2708
  },
2709
2709
  async updateByClient(i, e, t) {
2710
- return (await n.update(z).set({ connections: JSON.stringify([...new Set(t)]) }).where(
2710
+ return (await n.update(I).set({ connections: JSON.stringify([...new Set(t)]) }).where(
2711
2711
  g(
2712
- a(z.tenant_id, i),
2713
- a(z.client_id, e)
2712
+ a(I.tenant_id, i),
2713
+ a(I.client_id, e)
2714
2714
  )
2715
2715
  ).returning()).length > 0;
2716
2716
  },
2717
2717
  async listByConnection(i, e) {
2718
2718
  return (await n.select({
2719
- client_id: z.client_id,
2720
- connections: z.connections
2721
- }).from(z).where(a(z.tenant_id, i)).all()).filter((r) => (b(r.connections, []) || []).includes(e)).map((r) => r.client_id);
2719
+ client_id: I.client_id,
2720
+ connections: I.connections
2721
+ }).from(I).where(a(I.tenant_id, i)).all()).filter((r) => (b(r.connections, []) || []).includes(e)).map((r) => r.client_id);
2722
2722
  },
2723
2723
  async addClientToConnection(i, e, t) {
2724
2724
  var _;
2725
- if (!await n.select({ client_id: z.client_id }).from(z).where(
2725
+ if (!await n.select({ client_id: I.client_id }).from(I).where(
2726
2726
  g(
2727
- a(z.tenant_id, i),
2728
- a(z.client_id, t)
2727
+ a(I.tenant_id, i),
2728
+ a(I.client_id, t)
2729
2729
  )
2730
2730
  ).get()) return !1;
2731
2731
  const o = await n.run(
@@ -2755,13 +2755,28 @@ function Mr(n) {
2755
2755
  };
2756
2756
  }
2757
2757
  let Vr = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", Rr = (n) => crypto.getRandomValues(new Uint8Array(n)), Wr = (n, i, e) => {
2758
- let t = (2 << Math.log2(n.length - 1)) - 1, r = -~(1.6 * t * i / n.length);
2758
+ let t = 256 - 256 % n.length;
2759
+ if (t === 256) {
2760
+ let o = n.length - 1;
2761
+ return (l = i) => {
2762
+ if (!l) return "";
2763
+ let _ = "";
2764
+ for (; ; ) {
2765
+ let d = e(l), c = l;
2766
+ for (; c--; )
2767
+ if (_ += n[d[c] & o], _.length >= l) return _;
2768
+ }
2769
+ };
2770
+ }
2771
+ let r = Math.ceil(1.6 * 256 * i / t);
2759
2772
  return (o = i) => {
2773
+ if (!o) return "";
2760
2774
  let l = "";
2761
2775
  for (; ; ) {
2762
- let _ = e(r), d = r | 0;
2776
+ let _ = e(r), d = r;
2763
2777
  for (; d--; )
2764
- if (l += n[_[d] & t] || "", l.length >= o) return l;
2778
+ if (_[d] < t && (l += n[_[d] % n.length], l.length >= o))
2779
+ return l;
2765
2780
  }
2766
2781
  };
2767
2782
  }, Hr = (n, i = 21) => Wr(n, i | 0, Rr), ae = (n = 21) => {
@@ -2779,7 +2794,7 @@ function nt(n) {
2779
2794
  is_system: o,
2780
2795
  ...l
2781
2796
  } = n;
2782
- return I({
2797
+ return z({
2783
2798
  ...l,
2784
2799
  scope: b(e, []),
2785
2800
  authorization_details_types: b(
@@ -2870,7 +2885,7 @@ function Gr(n) {
2870
2885
  }
2871
2886
  function it(n) {
2872
2887
  const { tenant_id: i, ...e } = n;
2873
- return I(e);
2888
+ return z(e);
2874
2889
  }
2875
2890
  function Yr(n) {
2876
2891
  return {
@@ -2943,7 +2958,7 @@ function Xr() {
2943
2958
  }
2944
2959
  function rt(n) {
2945
2960
  const { tenant_id: i, is_system: e, options: t, metadata: r, ...o } = n;
2946
- return I({
2961
+ return z({
2947
2962
  ...o,
2948
2963
  options: b(t, {}),
2949
2964
  metadata: b(r),
@@ -3036,7 +3051,7 @@ function Zr(n) {
3036
3051
  }
3037
3052
  function Ke(n) {
3038
3053
  const { tenant_id: i, domain_metadata: e, ...t } = n;
3039
- return I({
3054
+ return z({
3040
3055
  ...t,
3041
3056
  primary: !!t.primary,
3042
3057
  domain_metadata: b(e)
@@ -3173,7 +3188,7 @@ function ns(n) {
3173
3188
  const e = await n.select().from(ve).where(a(ve.tenant_id, i)).get();
3174
3189
  if (!e) return null;
3175
3190
  const { tenant_id: t, ...r } = e;
3176
- return I({
3191
+ return z({
3177
3192
  ...r,
3178
3193
  enabled: !!r.enabled,
3179
3194
  credentials: b(r.credentials, {}),
@@ -3214,7 +3229,7 @@ function is(n) {
3214
3229
  const t = await n.select().from(ie).where(g(a(ie.tenant_id, i), a(ie.id, e))).get();
3215
3230
  if (!t) return null;
3216
3231
  const { tenant_id: r, actions: o, ...l } = t;
3217
- return I({
3232
+ return z({
3218
3233
  ...l,
3219
3234
  actions: b(o, [])
3220
3235
  });
@@ -3241,7 +3256,7 @@ function is(n) {
3241
3256
  }
3242
3257
  const c = (await _.offset(t * r).limit(r)).map((h) => {
3243
3258
  const { tenant_id: f, actions: y, ...w } = h;
3244
- return I({
3259
+ return z({
3245
3260
  ...w,
3246
3261
  actions: b(y, [])
3247
3262
  });
@@ -3293,7 +3308,7 @@ function rs(n) {
3293
3308
  const { tenant_id: r, ...o } = t, l = { ...o };
3294
3309
  for (const _ of je)
3295
3310
  l[_] = b(o[_]);
3296
- return I(l);
3311
+ return z(l);
3297
3312
  },
3298
3313
  async update(i, e, t) {
3299
3314
  const r = {
@@ -3321,7 +3336,7 @@ function rs(n) {
3321
3336
  const { tenant_id: f, ...y } = h, w = { ...y };
3322
3337
  for (const A of je)
3323
3338
  w[A] = b(y[A]);
3324
- return I(w);
3339
+ return z(w);
3325
3340
  });
3326
3341
  if (!o)
3327
3342
  return { forms: c };
@@ -3426,7 +3441,7 @@ function st(n) {
3426
3441
  "created_at_ts",
3427
3442
  "updated_at_ts"
3428
3443
  ]);
3429
- return I({
3444
+ return z({
3430
3445
  ...r,
3431
3446
  enabled: !!r.enabled,
3432
3447
  synchronous: !!r.synchronous,
@@ -3513,7 +3528,7 @@ function ot(n) {
3513
3528
  const { tenant_id: i, send_invitation_email: e, ...t } = n, r = { ...t };
3514
3529
  for (const o of Nt)
3515
3530
  r[o] = b(t[o], o === "roles" ? [] : {});
3516
- return r.send_invitation_email = !!e, I(r);
3531
+ return r.send_invitation_email = !!e, z(r);
3517
3532
  }
3518
3533
  function ds(n) {
3519
3534
  return {
@@ -3607,7 +3622,7 @@ function cs(n) {
3607
3622
  }
3608
3623
  const c = (await _.offset(e * t).limit(t)).map((h) => {
3609
3624
  const { created_at: f, ...y } = h;
3610
- return I(y);
3625
+ return z(y);
3611
3626
  });
3612
3627
  if (!r)
3613
3628
  return { signingKeys: c };
@@ -3647,7 +3662,7 @@ function $t(n) {
3647
3662
  { created_at_ts: e, updated_at_ts: t, expires_at_ts: r },
3648
3663
  ["created_at_ts", "updated_at_ts", "expires_at_ts"]
3649
3664
  ), d = gr(l, ["authParams"]);
3650
- return I({
3665
+ return z({
3651
3666
  ...d,
3652
3667
  ..._,
3653
3668
  state_data: b(o)
@@ -3734,14 +3749,14 @@ function lt(n) {
3734
3749
  details: b(r),
3735
3750
  scope: h ? h.split(",") : void 0
3736
3751
  };
3737
- return o && (y.location_info = I({
3752
+ return o && (y.location_info = z({
3738
3753
  country_code: o,
3739
3754
  city_name: l,
3740
3755
  latitude: _,
3741
3756
  longitude: d,
3742
3757
  time_zone: c,
3743
3758
  continent_code: u
3744
- })), I(y);
3759
+ })), z(y);
3745
3760
  }
3746
3761
  function ms(n) {
3747
3762
  return {
@@ -3835,7 +3850,7 @@ function Me(n) {
3835
3850
  transports: l,
3836
3851
  ..._
3837
3852
  } = n;
3838
- return I({
3853
+ return z({
3839
3854
  ..._,
3840
3855
  confirmed: !!o,
3841
3856
  credential_backed_up: r != null ? !!r : void 0,
@@ -3932,7 +3947,7 @@ function ut(n) {
3932
3947
  token_quota: o,
3933
3948
  ...l
3934
3949
  } = n;
3935
- return I({
3950
+ return z({
3936
3951
  ...l,
3937
3952
  branding: b(e, {}),
3938
3953
  metadata: b(t, {}),
@@ -3997,8 +4012,8 @@ function ws(n) {
3997
4012
  let d = n.select().from(q).where(a(q.tenant_id, i)).$dynamic();
3998
4013
  if (_ && (d = d.where(
3999
4014
  de(
4000
- ze(q.name, `%${_}%`),
4001
- ze(q.display_name, `%${_}%`)
4015
+ Ie(q.name, `%${_}%`),
4016
+ Ie(q.display_name, `%${_}%`)
4002
4017
  )
4003
4018
  )), l != null && l.sort_by) {
4004
4019
  const y = q[l.sort_by];
@@ -4012,8 +4027,8 @@ function ws(n) {
4012
4027
  const h = [a(q.tenant_id, i)];
4013
4028
  _ && h.push(
4014
4029
  de(
4015
- ze(q.name, `%${_}%`),
4016
- ze(q.display_name, `%${_}%`)
4030
+ Ie(q.name, `%${_}%`),
4031
+ Ie(q.display_name, `%${_}%`)
4017
4032
  )
4018
4033
  );
4019
4034
  const [f] = await n.select({ count: V() }).from(q).where(g(...h));
@@ -4149,7 +4164,7 @@ function ct(n) {
4149
4164
  ["created_at_ts"],
4150
4165
  ["expires_at_ts", "idle_expires_at_ts", "last_exchanged_at_ts"]
4151
4166
  );
4152
- return I({
4167
+ return z({
4153
4168
  ...c,
4154
4169
  ...u,
4155
4170
  rotating: !!d,
@@ -4266,7 +4281,7 @@ function gt(n) {
4266
4281
  _.scopes = b(t, []), _.options = b(r, {}), _.metadata = b(o), e !== void 0 && (_.verificationKey = e);
4267
4282
  for (const d of bt)
4268
4283
  l[d] !== void 0 && l[d] !== null && (_[d] = !!l[d]);
4269
- return I(_);
4284
+ return z(_);
4270
4285
  }
4271
4286
  function xs(n) {
4272
4287
  return {
@@ -4331,7 +4346,7 @@ function xs(n) {
4331
4346
  const [, R, W] = A, ke = R == null ? void 0 : R.startsWith("-"), qe = ke ? R == null ? void 0 : R.substring(1) : R;
4332
4347
  if (qe && Bt.has(qe) && !ke) {
4333
4348
  const pr = L[qe];
4334
- u.push(ze(pr, `%${W}%`));
4349
+ u.push(Ie(pr, `%${W}%`));
4335
4350
  }
4336
4351
  }
4337
4352
  }
@@ -4490,7 +4505,7 @@ function Os(n) {
4490
4505
  }
4491
4506
  function ft(n) {
4492
4507
  const { tenant_id: i, is_system: e, metadata: t, ...r } = n;
4493
- return I({
4508
+ return z({
4494
4509
  ...r,
4495
4510
  is_system: e ? !0 : void 0,
4496
4511
  metadata: b(t)
@@ -4552,7 +4567,7 @@ function ks(n) {
4552
4567
  }
4553
4568
  };
4554
4569
  }
4555
- const zs = ["created_at_ts", "updated_at_ts"], Is = [
4570
+ const Is = ["created_at_ts", "updated_at_ts"], zs = [
4556
4571
  "expires_at_ts",
4557
4572
  "idle_expires_at_ts",
4558
4573
  "authenticated_at_ts",
@@ -4585,10 +4600,10 @@ function mt(n) {
4585
4600
  used_at_ts: d,
4586
4601
  revoked_at_ts: c
4587
4602
  },
4588
- [...zs],
4589
- [...Is]
4603
+ [...Is],
4604
+ [...zs]
4590
4605
  );
4591
- return I({
4606
+ return z({
4592
4607
  ...f,
4593
4608
  ...y,
4594
4609
  device: b(u, {}),
@@ -4687,7 +4702,7 @@ function Pt(n) {
4687
4702
  typeof i[e] == "string" && (i[e] = b(i[e]));
4688
4703
  for (const e of hr)
4689
4704
  i[e] !== void 0 && i[e] !== null && (i[e] = i[e] === 1);
4690
- return I(i);
4705
+ return z(i);
4691
4706
  }
4692
4707
  function Qt(n) {
4693
4708
  const i = { ...n };
@@ -4775,7 +4790,7 @@ const Ls = [
4775
4790
  ];
4776
4791
  function Jt(n) {
4777
4792
  const { tenant_id: i, ...e } = n, t = gr(e, Ls);
4778
- return t.borders && (t.borders.show_widget_shadow = !!t.borders.show_widget_shadow), t.fonts && (t.fonts.links_bold = !!t.fonts.links_bold, t.fonts.subtitle_bold = !!t.fonts.subtitle_bold, t.fonts.title_bold = !!t.fonts.title_bold), I(t);
4793
+ return t.borders && (t.borders.show_widget_shadow = !!t.borders.show_widget_shadow), t.fonts && (t.fonts.links_bold = !!t.fonts.links_bold, t.fonts.subtitle_bold = !!t.fonts.subtitle_bold, t.fonts.title_bold = !!t.fonts.title_bold), z(t);
4779
4794
  }
4780
4795
  function Es(n) {
4781
4796
  return {
@@ -4860,7 +4875,7 @@ function ht(n, i = []) {
4860
4875
  profileData: u,
4861
4876
  ...h
4862
4877
  } = n, f = Ft(n, !0), y = i.map((w) => Ft(w, !1));
4863
- return I({
4878
+ return z({
4864
4879
  ...h,
4865
4880
  email: n.email || "",
4866
4881
  email_verified: !!l,
@@ -5104,7 +5119,7 @@ function $s(n) {
5104
5119
  ).get();
5105
5120
  if (!c) return null;
5106
5121
  const { tenant_id: u, is_system: h, metadata: f, ...y } = c;
5107
- return I({
5122
+ return z({
5108
5123
  ...y,
5109
5124
  is_system: h ? !0 : void 0,
5110
5125
  metadata: b(f)
@@ -5220,7 +5235,7 @@ function Bs(n) {
5220
5235
  token_quota: W,
5221
5236
  ...ke
5222
5237
  } = f;
5223
- return I({
5238
+ return z({
5224
5239
  ...ke,
5225
5240
  branding: b(w, {}),
5226
5241
  metadata: b(A, {}),
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "type": "git",
12
12
  "url": "https://github.com/markusahlstrand/authhero"
13
13
  },
14
- "version": "0.35.0",
14
+ "version": "0.37.0",
15
15
  "files": [
16
16
  "dist",
17
17
  "src/schema",
@@ -34,7 +34,7 @@
34
34
  "dependencies": {
35
35
  "drizzle-orm": "^0.44.2",
36
36
  "nanoid": "^5.0.8",
37
- "@authhero/adapter-interfaces": "1.2.0"
37
+ "@authhero/adapter-interfaces": "1.4.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@hono/zod-openapi": "^0.19.2",