@camstack/system 1.2.460 → 1.2.462

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.
Files changed (108) hide show
  1. package/dist/addon-runner.js +21 -276
  2. package/dist/addon-runner.mjs +21 -276
  3. package/dist/addon-utils.js +1 -1
  4. package/dist/addon-utils.mjs +1 -1
  5. package/dist/{agent-https-Dnr_nIVx.js → agent-https-C6M6apPV.js} +1 -1
  6. package/dist/{agent-https-Iw3RSQup.mjs → agent-https-CC7jpktS.mjs} +1 -1
  7. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  8. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  9. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  10. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  11. package/dist/builtins/alerts/alerts.addon.js +1 -1
  12. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  13. package/dist/builtins/autotrack/index.js +1 -1
  14. package/dist/builtins/autotrack/index.mjs +1 -1
  15. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.d.ts +1 -3
  16. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +51 -502
  17. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +51 -502
  18. package/dist/builtins/backup-orchestrator/destination-policy.d.ts +5 -21
  19. package/dist/builtins/backup-orchestrator/record-kinds.d.ts +0 -2
  20. package/dist/builtins/backup-orchestrator/schedule-store.d.ts +5 -13
  21. package/dist/builtins/backup-orchestrator/seed-marker-store.d.ts +9 -19
  22. package/dist/builtins/calendars/calendars.addon.js +1 -1
  23. package/dist/builtins/calendars/calendars.addon.mjs +1 -1
  24. package/dist/builtins/camera-grid/index.js +1 -1
  25. package/dist/builtins/camera-grid/index.mjs +1 -1
  26. package/dist/builtins/cluster-agent/record-kinds.d.ts +0 -1
  27. package/dist/builtins/composer/composer.addon.js +2 -2
  28. package/dist/builtins/composer/composer.addon.mjs +2 -2
  29. package/dist/builtins/console-logging/index.js +1 -1
  30. package/dist/builtins/console-logging/index.mjs +1 -1
  31. package/dist/builtins/core-blocks/core-blocks.addon.js +2 -2
  32. package/dist/builtins/core-blocks/core-blocks.addon.mjs +2 -2
  33. package/dist/builtins/device-history/device-history.addon.js +1 -1
  34. package/dist/builtins/device-history/device-history.addon.mjs +1 -1
  35. package/dist/builtins/device-manager/device-manager.addon.js +2 -2
  36. package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
  37. package/dist/builtins/hub-forwarder/index.js +1 -1
  38. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  39. package/dist/builtins/keychain/index.js +3 -3
  40. package/dist/builtins/keychain/index.mjs +3 -3
  41. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  42. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  43. package/dist/builtins/local-auth/auth-schema.d.ts +2 -12
  44. package/dist/builtins/local-auth/local-auth.addon.js +52 -191
  45. package/dist/builtins/local-auth/local-auth.addon.mjs +52 -191
  46. package/dist/builtins/local-auth/oauth-session-manager.d.ts +13 -4
  47. package/dist/builtins/local-auth/record-kinds.d.ts +1 -1
  48. package/dist/builtins/local-network/local-network.addon.js +2 -2
  49. package/dist/builtins/local-network/local-network.addon.mjs +2 -2
  50. package/dist/builtins/loki-logging/index.js +1 -1
  51. package/dist/builtins/loki-logging/index.mjs +1 -1
  52. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  53. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  54. package/dist/builtins/platform-probe/index.js +1 -1
  55. package/dist/builtins/platform-probe/index.mjs +1 -1
  56. package/dist/builtins/record-entries/index.js +1 -1
  57. package/dist/builtins/record-entries/index.mjs +1 -1
  58. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  59. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  60. package/dist/builtins/snapshot/index.js +1 -1
  61. package/dist/builtins/snapshot/index.mjs +1 -1
  62. package/dist/builtins/sqlite-storage/file-host-protocol.d.ts +0 -9
  63. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  64. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  65. package/dist/builtins/sqlite-storage/index.js +1 -1
  66. package/dist/builtins/sqlite-storage/index.mjs +1 -1
  67. package/dist/builtins/sqlite-storage/owned-sqlite-file.d.ts +0 -8
  68. package/dist/builtins/sqlite-storage/records/records-sql.d.ts +0 -2
  69. package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +0 -28
  70. package/dist/builtins/sqlite-storage/sqlite-settings.addon.d.ts +1 -2
  71. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +6 -170
  72. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +6 -170
  73. package/dist/builtins/sqlite-storage/storage-admin-provider.d.ts +3 -17
  74. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  75. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  76. package/dist/builtins/system-config/system-config.addon.js +3 -3
  77. package/dist/builtins/system-config/system-config.addon.mjs +280 -280
  78. package/dist/builtins/winston-logging/index.js +1 -1
  79. package/dist/builtins/winston-logging/index.mjs +1 -1
  80. package/dist/{composition-sources-b0e_2I-D.js → composition-sources-BPnpB9XG.js} +1 -1
  81. package/dist/{composition-sources-DNRZWR1j.mjs → composition-sources-BlcYzFwY.mjs} +1 -1
  82. package/dist/{constants-6OeJiZgi.js → constants-7ZMxWr8Z.js} +1 -1
  83. package/dist/{constants-BnkOdj9Q.mjs → constants-CH5UXe_G.mjs} +1 -1
  84. package/dist/{custom-action-registry-DStvrQKI.mjs → custom-action-registry-DZSCLBuT.mjs} +2 -0
  85. package/dist/{custom-action-registry-COyb49zm.js → custom-action-registry-MRyes5j0.js} +2 -0
  86. package/dist/{device-ca-Bnkw8GyU.mjs → device-ca-BU_gnd-q.mjs} +1 -1
  87. package/dist/{device-ca-CPTDs--d.js → device-ca-CUEx7sti.js} +1 -1
  88. package/dist/{dist-Wy8cTxg6.mjs → dist-8tWIDoWp.mjs} +15 -55
  89. package/dist/{dist-Bn-RNanh.js → dist-Ct-4tTeX.js} +14 -66
  90. package/dist/file-host-worker.js +1 -1
  91. package/dist/file-host-worker.mjs +1 -1
  92. package/dist/{hub-mdns-ciao-CJu0nhla.mjs → hub-mdns-ciao-Cuy7LUdz.mjs} +2 -2
  93. package/dist/{hub-mdns-ciao-CTBTlia4.js → hub-mdns-ciao-DJ-Amqd7.js} +2 -2
  94. package/dist/index.d.ts +1 -1
  95. package/dist/index.js +89 -241
  96. package/dist/index.mjs +90 -237
  97. package/dist/kernel/index.d.ts +0 -1
  98. package/dist/kernel/moleculer/runner-addon-settings.d.ts +1 -6
  99. package/dist/kernel/moleculer/runner-device-settings.d.ts +2 -2
  100. package/dist/{restore-archive-CM23Pq9B.mjs → restore-archive-BDua3jO6.mjs} +78 -78
  101. package/dist/{restore-archive-DM1OBYq4.js → restore-archive-HwOA83v3.js} +1 -1
  102. package/dist/{retired-settings-keys-D_VwZiDt.js → retired-settings-keys-CGUqX-Oz.js} +0 -6
  103. package/dist/{retired-settings-keys-Bhwe4ymb.mjs → retired-settings-keys-C_Kjp-Bj.mjs} +1 -1
  104. package/dist/{wal-maintenance-Bj_MmDkr.mjs → wal-maintenance-BvzVehem.mjs} +0 -0
  105. package/dist/{wal-maintenance-CaJjuLHq.js → wal-maintenance-DBvuVU9s.js} +0 -0
  106. package/package.json +1 -1
  107. package/dist/builtins/sqlite-storage/retired-collections.d.ts +0 -146
  108. package/dist/kernel/legacy-blob-guard.d.ts +0 -63
@@ -3,11 +3,11 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-Bn-RNanh.js");
6
+ const require_dist = require("../../dist-Ct-4tTeX.js");
7
7
  const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
8
8
  const require_safe_buffer$1 = require("../../safe-buffer-D3aoa-7X.js");
9
9
  const require_ms$1 = require("../../ms-LB3giGoU.js");
10
- const require_device_ca = require("../../device-ca-CPTDs--d.js");
10
+ const require_device_ca = require("../../device-ca-CUEx7sti.js");
11
11
  let zod = require("zod");
12
12
  let node_crypto = require("node:crypto");
13
13
  node_crypto = require_chunk.__toESM(node_crypto);
@@ -7224,16 +7224,6 @@ var API_KEYS_COLLECTION = "api_keys";
7224
7224
  */
7225
7225
  var SCOPED_TOKENS_COLLECTION = "scoped_tokens";
7226
7226
  /**
7227
- * @durable class=ledger owner=local-auth
7228
- * write="one row per redeemed OAuth code — every completed account link through
7229
- * `oauthExchangeCode`; `touch` rewrites `lastUsedAt` on each refresh"
7230
- * retention="ONLY revoked rows are pruned: the daily sweep deletes sessions
7231
- * revoked more than OAUTH_REVOKED_RETENTION_MS (30 d) ago. An ACTIVE session
7232
- * has `revokedAt` NULL, never expires and is never swept — the table grows one
7233
- * row per login until an operator revokes the link."
7234
- */
7235
- var OAUTH_SESSIONS_COLLECTION = "oauth_sessions";
7236
- /**
7237
7227
  * TOTP enrollment table — split off from `users` to avoid the
7238
7228
  * destructive drop-+-recreate migration `ensureTable` performs when a
7239
7229
  * new column is added to a typed schema (see `sqlite-settings-backend.ts`).
@@ -7465,47 +7455,6 @@ var SCOPED_TOKENS_COLUMNS = [
7465
7455
  notNull: true
7466
7456
  }
7467
7457
  ];
7468
- var OAUTH_SESSIONS_COLUMNS = [
7469
- {
7470
- name: "id",
7471
- type: "TEXT",
7472
- primaryKey: true,
7473
- notNull: true
7474
- },
7475
- {
7476
- name: "userId",
7477
- type: "TEXT",
7478
- notNull: true
7479
- },
7480
- {
7481
- name: "username",
7482
- type: "TEXT",
7483
- notNull: true
7484
- },
7485
- {
7486
- name: "integrationId",
7487
- type: "TEXT",
7488
- notNull: true
7489
- },
7490
- {
7491
- name: "scopes",
7492
- type: "JSON"
7493
- },
7494
- {
7495
- name: "createdAt",
7496
- type: "INTEGER",
7497
- notNull: true
7498
- },
7499
- {
7500
- name: "lastUsedAt",
7501
- type: "INTEGER",
7502
- notNull: true
7503
- },
7504
- {
7505
- name: "revokedAt",
7506
- type: "INTEGER"
7507
- }
7508
- ];
7509
7458
  /**
7510
7459
  * Declare every auth collection with the typed schema. Called by
7511
7460
  * `LocalAuthAddon.onInitialize` before constructing the per-collection
@@ -7546,14 +7495,6 @@ async function declareAuthSchema(store, options) {
7546
7495
  columns: ["userId"]
7547
7496
  }]
7548
7497
  });
7549
- if (!skip.has("oauth_sessions")) await store.declareCollection.mutate({
7550
- collection: OAUTH_SESSIONS_COLLECTION,
7551
- columns: OAUTH_SESSIONS_COLUMNS,
7552
- indexes: [{
7553
- name: "idx_oauth_sessions_user_id",
7554
- columns: ["userId"]
7555
- }]
7556
- });
7557
7498
  if (!skip.has("login_sessions")) await store.declareCollection.mutate({
7558
7499
  collection: LOGIN_SESSIONS_COLLECTION,
7559
7500
  columns: LOGIN_SESSIONS_COLUMNS,
@@ -7597,7 +7538,7 @@ async function declareAuthSchema(store, options) {
7597
7538
  * Record kinds owned by `local-auth` (records plan phase 6 / §2.8).
7598
7539
  *
7599
7540
  * Operator-only legacy drop: auth tables are NEVER removed by the orphan job —
7600
- * use `storageAdmin.dropCollection` with `expectRows` after verify (see
7541
+ * the operator drops a legacy table by hand, offline (D902; see
7601
7542
  * `docs/design/records-phase-6-auth-migration.md`).
7602
7543
  *
7603
7544
  * Before hub restart: mint and test an admin token (`auth.mintToken` with `'*'`); snapshot every kind.
@@ -7768,16 +7709,19 @@ var _localAuthRecordKinds = require_dist.defineRecordKinds({
7768
7709
  "oauth-sessions": {
7769
7710
  schema: OauthSessionBodySchema,
7770
7711
  class: "ledger",
7771
- writeTrigger: "OAuth code exchange; refresh touches lastUsedAt",
7712
+ writeTrigger: "OAuth code exchange; refresh touches lastUsedAt; revoke stamps revokedAt",
7772
7713
  device: "none",
7773
7714
  at: "none",
7774
7715
  indexes: [{
7775
7716
  name: "user",
7776
7717
  fields: ["userId"]
7718
+ }, {
7719
+ name: "revoked",
7720
+ fields: ["revokedAt"]
7777
7721
  }],
7778
7722
  retention: {
7779
7723
  owner: "local-auth",
7780
- reason: "daily reap deletes revoked sessions older than 30 days; active rows never expire"
7724
+ reason: "daily reap deletes sessions revoked more than 30 days ago; an active session has no lifetime, so no engine TTL"
7781
7725
  }
7782
7726
  },
7783
7727
  "user-totp": {
@@ -7858,7 +7802,6 @@ var LOCAL_AUTH_RECORDS_LEGACY_COLLECTIONS = [
7858
7802
  ADMIN_TOKENS_COLLECTION,
7859
7803
  LOGIN_SESSIONS_COLLECTION,
7860
7804
  LOGIN_SESSION_CUTOFFS_COLLECTION,
7861
- OAUTH_SESSIONS_COLLECTION,
7862
7805
  USER_TOTP_COLLECTION,
7863
7806
  USER_EXTERNAL_IDENTITIES_COLLECTION,
7864
7807
  DEVICE_CREDENTIALS_COLLECTION,
@@ -8063,7 +8006,7 @@ function num(data, key) {
8063
8006
  const value = data[key];
8064
8007
  return typeof value === "number" && Number.isFinite(value) ? value : null;
8065
8008
  }
8066
- function parseSession$1(data) {
8009
+ function parseSession(data) {
8067
8010
  const id = str(data, "id");
8068
8011
  const userId = str(data, "userId");
8069
8012
  const createdAt = num(data, "createdAt");
@@ -8126,7 +8069,7 @@ var LoginSessionManager = class {
8126
8069
  if (sessionsKind !== null) {
8127
8070
  const rows = await (0, import_read_all_rows.readAllRows)(sessionsKind);
8128
8071
  for (const row of rows) {
8129
- const record = parseSession$1({
8072
+ const record = parseSession({
8130
8073
  id: row.id,
8131
8074
  ...row.data
8132
8075
  });
@@ -8138,7 +8081,7 @@ var LoginSessionManager = class {
8138
8081
  }
8139
8082
  const rows = await this.store.query.query({ collection: LOGIN_SESSIONS_COLLECTION });
8140
8083
  for (const row of rows) {
8141
- const record = parseSession$1(row.data);
8084
+ const record = parseSession(row.data);
8142
8085
  if (record !== null) this.remember(record);
8143
8086
  }
8144
8087
  const cutoffs = await this.store.query.query({ collection: LOGIN_SESSION_CUTOFFS_COLLECTION });
@@ -12045,33 +11988,6 @@ function createOauthGrants(ssoBridge, sessionManager) {
12045
11988
  }
12046
11989
  //#endregion
12047
11990
  //#region src/builtins/local-auth/oauth-session-manager.ts
12048
- function parseSession(data) {
12049
- const id = data["id"];
12050
- const userId = data["userId"];
12051
- const username = data["username"];
12052
- const integrationId = data["integrationId"];
12053
- const scopes = data["scopes"];
12054
- const createdAt = data["createdAt"];
12055
- const lastUsedAt = data["lastUsedAt"];
12056
- const revokedAt = data["revokedAt"];
12057
- if (typeof id !== "string") throw new Error("oauth_sessions row: missing id");
12058
- if (typeof userId !== "string") throw new Error("oauth_sessions row: missing userId");
12059
- if (typeof username !== "string") throw new Error("oauth_sessions row: missing username");
12060
- if (typeof integrationId !== "string") throw new Error("oauth_sessions row: missing integrationId");
12061
- if (!Array.isArray(scopes)) throw new Error("oauth_sessions row: scopes must be an array");
12062
- if (typeof createdAt !== "number") throw new Error("oauth_sessions row: missing createdAt");
12063
- if (typeof lastUsedAt !== "number") throw new Error("oauth_sessions row: missing lastUsedAt");
12064
- return {
12065
- id,
12066
- userId,
12067
- username,
12068
- integrationId,
12069
- scopes,
12070
- createdAt,
12071
- lastUsedAt,
12072
- revokedAt: typeof revokedAt === "number" ? revokedAt : null
12073
- };
12074
- }
12075
11991
  function sessionToBody(session) {
12076
11992
  return {
12077
11993
  userId: session.userId,
@@ -12084,22 +12000,34 @@ function sessionToBody(session) {
12084
12000
  };
12085
12001
  }
12086
12002
  function rowToSession(id, body) {
12087
- return parseSession({
12003
+ return {
12088
12004
  id,
12089
- ...body
12090
- });
12005
+ userId: body.userId,
12006
+ username: body.username,
12007
+ integrationId: body.integrationId,
12008
+ scopes: body.scopes,
12009
+ createdAt: body.createdAt,
12010
+ lastUsedAt: body.lastUsedAt,
12011
+ revokedAt: typeof body.revokedAt === "number" ? body.revokedAt : null
12012
+ };
12091
12013
  }
12014
+ /**
12015
+ * The OAuth account links (one row per redeemed code), kept in local-auth's
12016
+ * `oauth-sessions` records kind (D881, D902). There is no table: the
12017
+ * `oauth_sessions` collection and its settings-store path are gone.
12018
+ */
12092
12019
  var OauthSessionManager = class {
12093
12020
  kind;
12094
- store;
12095
12021
  constructor(deps) {
12096
- if ("oauthSessionsKind" in deps) {
12097
- this.kind = deps.oauthSessionsKind;
12098
- this.store = deps.legacyStore ?? null;
12099
- } else {
12100
- this.kind = null;
12101
- this.store = deps;
12102
- }
12022
+ this.kind = deps.oauthSessionsKind;
12023
+ }
12024
+ async write(session) {
12025
+ const parsed = localAuthRecordKinds["oauth-sessions"].schema.safeParse(sessionToBody(session));
12026
+ if (!parsed.success) throw new Error(parsed.error.message);
12027
+ await this.kind.put({
12028
+ id: session.id,
12029
+ data: parsed.data
12030
+ });
12103
12031
  }
12104
12032
  async create(input) {
12105
12033
  const now = Date.now();
@@ -12113,117 +12041,53 @@ var OauthSessionManager = class {
12113
12041
  lastUsedAt: now,
12114
12042
  revokedAt: null
12115
12043
  };
12116
- const kind = this.kind;
12117
- if (kind !== null) {
12118
- const parsed = localAuthRecordKinds["oauth-sessions"].schema.safeParse(sessionToBody(session));
12119
- if (!parsed.success) throw new Error(parsed.error.message);
12120
- await kind.put({
12121
- id: session.id,
12122
- data: parsed.data
12123
- });
12124
- return session;
12125
- }
12126
- await this.store.insert.mutate({
12127
- collection: OAUTH_SESSIONS_COLLECTION,
12128
- record: {
12129
- id: session.id,
12130
- data: { ...session }
12131
- }
12132
- });
12044
+ await this.write(session);
12133
12045
  return session;
12134
12046
  }
12135
12047
  async list() {
12136
- const kind = this.kind;
12137
- if (kind !== null) return (await (0, import_read_all_rows.readAllRows)(kind)).map((row) => rowToSession(row.id, row.data));
12138
- return (await this.store.query.query({
12139
- collection: OAUTH_SESSIONS_COLLECTION,
12140
- filter: {}
12141
- })).map((r) => parseSession(r.data));
12048
+ return (await (0, import_read_all_rows.readAllRows)(this.kind)).map((row) => rowToSession(row.id, row.data));
12142
12049
  }
12143
12050
  async getById(id) {
12144
- const kind = this.kind;
12145
- if (kind !== null) {
12146
- const row = await kind.get(id);
12147
- return row === null ? null : rowToSession(row.id, row.data);
12148
- }
12149
- const results = await this.store.query.query({
12150
- collection: OAUTH_SESSIONS_COLLECTION,
12151
- filter: { where: { id } }
12152
- });
12153
- if (results.length === 0) return null;
12154
- return parseSession(results[0].data);
12051
+ const row = await this.kind.get(id);
12052
+ return row === null ? null : rowToSession(row.id, row.data);
12155
12053
  }
12156
12054
  async markRevoked(id) {
12157
12055
  const existing = await this.getById(id);
12158
12056
  if (existing === null) return false;
12159
12057
  if (existing.revokedAt !== null) return true;
12160
- const updated = {
12058
+ await this.write({
12161
12059
  ...existing,
12162
12060
  revokedAt: Date.now()
12163
- };
12164
- const kind = this.kind;
12165
- if (kind !== null) {
12166
- const parsed = localAuthRecordKinds["oauth-sessions"].schema.safeParse(sessionToBody(updated));
12167
- if (!parsed.success) throw new Error(parsed.error.message);
12168
- await kind.put({
12169
- id,
12170
- data: parsed.data
12171
- });
12172
- return true;
12173
- }
12174
- await this.store.update.mutate({
12175
- collection: OAUTH_SESSIONS_COLLECTION,
12176
- id,
12177
- data: { ...updated }
12178
12061
  });
12179
12062
  return true;
12180
12063
  }
12181
12064
  async remove(id) {
12182
12065
  if (await this.getById(id) === null) return false;
12183
- const kind = this.kind;
12184
- if (kind !== null) {
12185
- await kind.delete(id);
12186
- return true;
12187
- }
12188
- await this.store.delete.mutate({
12189
- collection: OAUTH_SESSIONS_COLLECTION,
12190
- key: id
12191
- });
12066
+ await this.kind.delete(id);
12192
12067
  return true;
12193
12068
  }
12069
+ /**
12070
+ * Delete the sessions revoked at or before `horizonMs`. An active session
12071
+ * (`revokedAt` null) is never matched: it has no lifetime of its own, which
12072
+ * is why this is the owner's sweep and not an engine TTL.
12073
+ */
12194
12074
  async reapRevoked(horizonMs) {
12195
- const kind = this.kind;
12196
- if (kind !== null) return kind.deleteWhere({ where: { revokedAt: {
12075
+ return this.kind.deleteWhere({ where: { revokedAt: {
12197
12076
  gte: 1,
12198
12077
  lte: horizonMs
12199
12078
  } } });
12200
- const { deleted } = await this.store.deleteWhere.mutate({
12201
- collection: OAUTH_SESSIONS_COLLECTION,
12202
- filter: { whereBetween: { revokedAt: [1, horizonMs] } }
12203
- });
12204
- return deleted;
12205
12079
  }
12206
12080
  async touch(id) {
12207
12081
  const existing = await this.getById(id);
12208
12082
  if (existing === null) return;
12209
- const updated = {
12083
+ const parsed = localAuthRecordKinds["oauth-sessions"].schema.safeParse(sessionToBody({
12210
12084
  ...existing,
12211
12085
  lastUsedAt: Date.now()
12212
- };
12213
- const kind = this.kind;
12214
- if (kind !== null) {
12215
- const parsed = localAuthRecordKinds["oauth-sessions"].schema.safeParse(sessionToBody(updated));
12216
- if (!parsed.success) return;
12217
- await kind.put({
12218
- id,
12219
- data: parsed.data
12220
- });
12221
- return;
12222
- }
12223
- await this.store.update.mutate({
12224
- collection: OAUTH_SESSIONS_COLLECTION,
12086
+ }));
12087
+ if (!parsed.success) return;
12088
+ await this.kind.put({
12225
12089
  id,
12226
- data: { ...updated }
12090
+ data: parsed.data
12227
12091
  });
12228
12092
  }
12229
12093
  };
@@ -12308,10 +12172,7 @@ var LocalAuthAddon = class extends require_dist.BaseAddon {
12308
12172
  apiKeysKind: authStores.apiKeys,
12309
12173
  legacyStore: store
12310
12174
  });
12311
- this.oauthSessionManager = new OauthSessionManager({
12312
- oauthSessionsKind: authStores.oauthSessions,
12313
- legacyStore: store
12314
- });
12175
+ this.oauthSessionManager = new OauthSessionManager({ oauthSessionsKind: authStores.oauthSessions });
12315
12176
  this.totpManager = new TotpManager({
12316
12177
  userTotpKind: authStores.userTotp,
12317
12178
  legacyStore: store