@authhero/kysely-adapter 10.104.0 → 10.105.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.
@@ -738,8 +738,22 @@ function eo(t) {
738
738
  revoked_at_ts: y,
739
739
  ...v
740
740
  } = n, x = Fe(
741
- { created_at_ts: l, updated_at_ts: u, expires_at_ts: _, idle_expires_at_ts: m, authenticated_at_ts: d, last_interaction_at_ts: f, used_at_ts: h, revoked_at_ts: y },
742
- ["created_at_ts", "updated_at_ts", "authenticated_at_ts", "last_interaction_at_ts"],
741
+ {
742
+ created_at_ts: l,
743
+ updated_at_ts: u,
744
+ expires_at_ts: _,
745
+ idle_expires_at_ts: m,
746
+ authenticated_at_ts: d,
747
+ last_interaction_at_ts: f,
748
+ used_at_ts: h,
749
+ revoked_at_ts: y
750
+ },
751
+ [
752
+ "created_at_ts",
753
+ "updated_at_ts",
754
+ "authenticated_at_ts",
755
+ "last_interaction_at_ts"
756
+ ],
743
757
  ["expires_at_ts", "idle_expires_at_ts", "used_at_ts", "revoked_at_ts"]
744
758
  );
745
759
  return {
@@ -793,7 +807,9 @@ function no(t) {
793
807
  device: n.device ? JSON.stringify(n.device) : void 0,
794
808
  clients: n.clients ? JSON.stringify(n.clients) : void 0
795
809
  };
796
- return n.expires_at !== void 0 && (r.expires_at_ts = P(n.expires_at)), n.idle_expires_at !== void 0 && (r.idle_expires_at_ts = P(n.idle_expires_at)), n.authenticated_at !== void 0 && (r.authenticated_at_ts = P(n.authenticated_at)), n.last_interaction_at !== void 0 && (r.last_interaction_at_ts = P(n.last_interaction_at)), n.used_at !== void 0 && (r.used_at_ts = P(n.used_at)), n.revoked_at !== void 0 && (r.revoked_at_ts = P(n.revoked_at)), n.user_id !== void 0 && (r.user_id = n.user_id), n.login_session_id !== void 0 && (r.login_session_id = n.login_session_id), !!(await t.updateTable("sessions").set(r).where("tenant_id", "=", e).where("sessions.id", "=", a).execute()).length;
810
+ return n.expires_at !== void 0 && (r.expires_at_ts = P(n.expires_at)), n.idle_expires_at !== void 0 && (r.idle_expires_at_ts = P(n.idle_expires_at)), n.authenticated_at !== void 0 && (r.authenticated_at_ts = P(n.authenticated_at)), n.last_interaction_at !== void 0 && (r.last_interaction_at_ts = P(
811
+ n.last_interaction_at
812
+ )), n.used_at !== void 0 && (r.used_at_ts = P(n.used_at)), n.revoked_at !== void 0 && (r.revoked_at_ts = P(n.revoked_at)), n.user_id !== void 0 && (r.user_id = n.user_id), n.login_session_id !== void 0 && (r.login_session_id = n.login_session_id), !!(await t.updateTable("sessions").set(r).where("tenant_id", "=", e).where("sessions.id", "=", a).execute()).length;
797
813
  };
798
814
  }
799
815
  function ro(t) {
@@ -822,8 +838,22 @@ function ro(t) {
822
838
  revoked_at_ts: mr,
823
839
  ...hr
824
840
  } = y, fr = Fe(
825
- { created_at_ts: J, updated_at_ts: R, expires_at_ts: Q, idle_expires_at_ts: te, authenticated_at_ts: Y, last_interaction_at_ts: be, used_at_ts: Ma, revoked_at_ts: mr },
826
- ["created_at_ts", "updated_at_ts", "authenticated_at_ts", "last_interaction_at_ts"],
841
+ {
842
+ created_at_ts: J,
843
+ updated_at_ts: R,
844
+ expires_at_ts: Q,
845
+ idle_expires_at_ts: te,
846
+ authenticated_at_ts: Y,
847
+ last_interaction_at_ts: be,
848
+ used_at_ts: Ma,
849
+ revoked_at_ts: mr
850
+ },
851
+ [
852
+ "created_at_ts",
853
+ "updated_at_ts",
854
+ "authenticated_at_ts",
855
+ "last_interaction_at_ts"
856
+ ],
827
857
  ["expires_at_ts", "idle_expires_at_ts", "used_at_ts", "revoked_at_ts"]
828
858
  );
829
859
  return {
@@ -1144,9 +1174,7 @@ function Ao(t) {
1144
1174
  client_authentication_methods: JSON.stringify(
1145
1175
  a.client_authentication_methods || {}
1146
1176
  ),
1147
- signed_request_object: JSON.stringify(
1148
- a.signed_request_object || {}
1149
- ),
1177
+ signed_request_object: JSON.stringify(a.signed_request_object || {}),
1150
1178
  token_quota: JSON.stringify(a.token_quota || {})
1151
1179
  }), await t.insertInto("clients").values(r).execute(), n;
1152
1180
  };
@@ -1397,7 +1425,9 @@ function Wo(t) {
1397
1425
  const r = await t.selectFrom("clients").where("clients.tenant_id", "=", e).where("clients.client_id", "=", n).select("connections").executeTakeFirst();
1398
1426
  if (!r)
1399
1427
  return !1;
1400
- const o = JSON.parse(r.connections || "[]"), s = o.filter((l) => l !== a);
1428
+ const o = JSON.parse(r.connections || "[]"), s = o.filter(
1429
+ (l) => l !== a
1430
+ );
1401
1431
  return s.length !== o.length ? (await t.updateTable("clients").set({
1402
1432
  connections: JSON.stringify(s),
1403
1433
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
@@ -1621,7 +1651,10 @@ function as(t) {
1621
1651
  return async (e) => (await t.selectFrom("custom_domains").where("custom_domains.tenant_id", "=", e).selectAll().execute()).map((n) => ({
1622
1652
  ...n,
1623
1653
  primary: n.primary === 1,
1624
- domain_metadata: Re(n.domain_metadata, void 0)
1654
+ domain_metadata: Re(
1655
+ n.domain_metadata,
1656
+ void 0
1657
+ )
1625
1658
  }));
1626
1659
  }
1627
1660
  function ns(t) {
@@ -1633,8 +1666,14 @@ function rs(t) {
1633
1666
  return n ? {
1634
1667
  ...n,
1635
1668
  primary: n.primary === 1,
1636
- domain_metadata: Re(n.domain_metadata, void 0),
1637
- verification: Re(n.verification, void 0)
1669
+ domain_metadata: Re(
1670
+ n.domain_metadata,
1671
+ void 0
1672
+ ),
1673
+ verification: Re(
1674
+ n.verification,
1675
+ void 0
1676
+ )
1638
1677
  } : null;
1639
1678
  };
1640
1679
  }
@@ -1660,7 +1699,10 @@ function ss(t) {
1660
1699
  return a ? {
1661
1700
  ...a,
1662
1701
  primary: a.primary === 1,
1663
- domain_metadata: Re(a.domain_metadata, void 0)
1702
+ domain_metadata: Re(
1703
+ a.domain_metadata,
1704
+ void 0
1705
+ )
1664
1706
  } : null;
1665
1707
  };
1666
1708
  }
@@ -1789,10 +1831,10 @@ function fs(t) {
1789
1831
  created_at_ts: x,
1790
1832
  updated_at_ts: O,
1791
1833
  ...J
1792
- } = f, R = Fe(
1793
- { created_at_ts: x, updated_at_ts: O },
1794
- ["created_at_ts", "updated_at_ts"]
1795
- );
1834
+ } = f, R = Fe({ created_at_ts: x, updated_at_ts: O }, [
1835
+ "created_at_ts",
1836
+ "updated_at_ts"
1837
+ ]);
1796
1838
  return b({
1797
1839
  ...J,
1798
1840
  ...R,
@@ -1821,10 +1863,15 @@ function ps(t) {
1821
1863
  const n = await t.selectFrom("hooks").where("hooks.tenant_id", "=", e).where("hooks.hook_id", "=", a).selectAll().executeTakeFirst();
1822
1864
  if (!n)
1823
1865
  return null;
1824
- const { tenant_id: r, created_at_ts: o, updated_at_ts: s, ...l } = n, u = Fe(
1825
- { created_at_ts: o, updated_at_ts: s },
1826
- ["created_at_ts", "updated_at_ts"]
1827
- );
1866
+ const {
1867
+ tenant_id: r,
1868
+ created_at_ts: o,
1869
+ updated_at_ts: s,
1870
+ ...l
1871
+ } = n, u = Fe({ created_at_ts: o, updated_at_ts: s }, [
1872
+ "created_at_ts",
1873
+ "updated_at_ts"
1874
+ ]);
1828
1875
  return b({
1829
1876
  ...l,
1830
1877
  ...u,
@@ -2172,7 +2219,12 @@ function Qs(t) {
2172
2219
  last_exchanged_at_ts: u,
2173
2220
  ..._
2174
2221
  } = n, m = Fe(
2175
- { created_at_ts: o, expires_at_ts: s, idle_expires_at_ts: l, last_exchanged_at_ts: u },
2222
+ {
2223
+ created_at_ts: o,
2224
+ expires_at_ts: s,
2225
+ idle_expires_at_ts: l,
2226
+ last_exchanged_at_ts: u
2227
+ },
2176
2228
  ["created_at_ts"],
2177
2229
  ["expires_at_ts", "idle_expires_at_ts", "last_exchanged_at_ts"]
2178
2230
  );
@@ -2260,7 +2312,12 @@ function Ys(t) {
2260
2312
  last_exchanged_at_ts: R,
2261
2313
  ...Q
2262
2314
  } = y, te = Fe(
2263
- { created_at_ts: x, expires_at_ts: O, idle_expires_at_ts: J, last_exchanged_at_ts: R },
2315
+ {
2316
+ created_at_ts: x,
2317
+ expires_at_ts: O,
2318
+ idle_expires_at_ts: J,
2319
+ last_exchanged_at_ts: R
2320
+ },
2264
2321
  ["created_at_ts"],
2265
2322
  ["expires_at_ts", "idle_expires_at_ts", "last_exchanged_at_ts"]
2266
2323
  );
@@ -2315,7 +2372,11 @@ function ei(t) {
2315
2372
  "tenant_id",
2316
2373
  "=",
2317
2374
  a
2318
- )), n && (h = h.where("user_id", "=", n));
2375
+ )), n && (h = h.where(
2376
+ "user_id",
2377
+ "=",
2378
+ n
2379
+ ));
2319
2380
  const y = await h.limit(s).execute(), v = Number(((l = y[0]) == null ? void 0 : l.numDeletedRows) ?? 0);
2320
2381
  if (m += v, v < s) break;
2321
2382
  }
@@ -2338,7 +2399,11 @@ function ei(t) {
2338
2399
  "tenant_id",
2339
2400
  "=",
2340
2401
  a
2341
- )), n && (h = h.where("user_id", "=", n));
2402
+ )), n && (h = h.where(
2403
+ "user_id",
2404
+ "=",
2405
+ n
2406
+ ));
2342
2407
  const y = await h.limit(s).execute(), v = Number(((_ = y[0]) == null ? void 0 : _.numDeletedRows) ?? 0);
2343
2408
  if (f += v, v < s) break;
2344
2409
  }
@@ -7715,9 +7780,7 @@ function Cl(t) {
7715
7780
  d.fn.sum(
7716
7781
  d.case().when("type", "in", dn).then(1).else(0).end()
7717
7782
  ).as("logins"),
7718
- d.fn.sum(
7719
- d.case().when("type", "=", "ss").then(1).else(0).end()
7720
- ).as("signups"),
7783
+ d.fn.sum(d.case().when("type", "=", "ss").then(1).else(0).end()).as("signups"),
7721
7784
  d.fn.sum(
7722
7785
  d.case().when("type", "in", Nl).then(1).else(0).end()
7723
7786
  ).as("leaked_passwords"),
@@ -7734,9 +7797,7 @@ function Cl(t) {
7734
7797
  },
7735
7798
  async getActiveUsers(e) {
7736
7799
  const a = /* @__PURE__ */ new Date();
7737
- return a.setDate(a.getDate() - 30), (await t.selectFrom("logs").where("tenant_id", "=", e).where("date", ">=", a.toISOString()).where("type", "in", dn).where("user_id", "is not", null).select(
7738
- (r) => r.fn.count("user_id").distinct().as("count")
7739
- ).executeTakeFirstOrThrow()).count || 0;
7800
+ return a.setDate(a.getDate() - 30), (await t.selectFrom("logs").where("tenant_id", "=", e).where("date", ">=", a.toISOString()).where("type", "in", dn).where("user_id", "is not", null).select((r) => r.fn.count("user_id").distinct().as("count")).executeTakeFirstOrThrow()).count || 0;
7740
7801
  }
7741
7802
  };
7742
7803
  }
@@ -10270,7 +10331,9 @@ async function hn(t, e, a) {
10270
10331
  async function Fp(t) {
10271
10332
  var o, s, l, u, _;
10272
10333
  const e = await ur(t);
10273
- console.log("Running preflight integrity check on hooks timestamp columns...");
10334
+ console.log(
10335
+ "Running preflight integrity check on hooks timestamp columns..."
10336
+ );
10274
10337
  const { rows: a } = await w`SELECT
10275
10338
  SUM(CASE WHEN created_at_ts IS NULL THEN 1 ELSE 0 END) AS null_created,
10276
10339
  SUM(CASE WHEN updated_at_ts IS NULL THEN 1 ELSE 0 END) AS null_updated
@@ -10280,9 +10343,7 @@ async function Fp(t) {
10280
10343
  `Preflight check failed: ${n} row(s) with NULL created_at_ts, ${r} row(s) with NULL updated_at_ts. All timestamp data must be migrated to _ts columns before dropping legacy columns.`
10281
10344
  );
10282
10345
  if (console.log(" Preflight check passed — all _ts columns are populated."), e === "mysql") {
10283
- console.log(
10284
- "Running preflight length check on columns being narrowed..."
10285
- );
10346
+ console.log("Running preflight length check on columns being narrowed...");
10286
10347
  const { rows: m } = await w`SELECT
10287
10348
  SUM(CASE WHEN CHAR_LENGTH(hook_id) > 21 THEN 1 ELSE 0 END) AS long_hook_id,
10288
10349
  SUM(CASE WHEN CHAR_LENGTH(form_id) > 128 THEN 1 ELSE 0 END) AS long_form_id,
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "type": "git",
12
12
  "url": "https://github.com/markusahlstrand/authhero"
13
13
  },
14
- "version": "10.104.0",
14
+ "version": "10.105.0",
15
15
  "files": [
16
16
  "dist"
17
17
  ],
@@ -43,7 +43,7 @@
43
43
  "kysely": "^0.27.4",
44
44
  "nanoid": "^5.0.8",
45
45
  "ulid": "^2.3.0",
46
- "@authhero/adapter-interfaces": "0.141.0"
46
+ "@authhero/adapter-interfaces": "0.142.0"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "@hono/zod-openapi": "^0.19.2",