@camstack/system 1.2.461 → 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 (104) hide show
  1. package/dist/addon-runner.js +21 -276
  2. package/dist/addon-runner.mjs +21 -276
  3. package/dist/{agent-https-Dnr_nIVx.js → agent-https-C6M6apPV.js} +1 -1
  4. package/dist/{agent-https-Iw3RSQup.mjs → agent-https-CC7jpktS.mjs} +1 -1
  5. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  6. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  7. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  8. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  9. package/dist/builtins/alerts/alerts.addon.js +1 -1
  10. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  11. package/dist/builtins/autotrack/index.js +1 -1
  12. package/dist/builtins/autotrack/index.mjs +1 -1
  13. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.d.ts +1 -3
  14. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +51 -502
  15. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +51 -502
  16. package/dist/builtins/backup-orchestrator/destination-policy.d.ts +5 -21
  17. package/dist/builtins/backup-orchestrator/record-kinds.d.ts +0 -2
  18. package/dist/builtins/backup-orchestrator/schedule-store.d.ts +5 -13
  19. package/dist/builtins/backup-orchestrator/seed-marker-store.d.ts +9 -19
  20. package/dist/builtins/calendars/calendars.addon.js +1 -1
  21. package/dist/builtins/calendars/calendars.addon.mjs +1 -1
  22. package/dist/builtins/camera-grid/index.js +1 -1
  23. package/dist/builtins/camera-grid/index.mjs +1 -1
  24. package/dist/builtins/cluster-agent/record-kinds.d.ts +0 -1
  25. package/dist/builtins/composer/composer.addon.js +2 -2
  26. package/dist/builtins/composer/composer.addon.mjs +2 -2
  27. package/dist/builtins/console-logging/index.js +1 -1
  28. package/dist/builtins/console-logging/index.mjs +1 -1
  29. package/dist/builtins/core-blocks/core-blocks.addon.js +2 -2
  30. package/dist/builtins/core-blocks/core-blocks.addon.mjs +2 -2
  31. package/dist/builtins/device-history/device-history.addon.js +1 -1
  32. package/dist/builtins/device-history/device-history.addon.mjs +1 -1
  33. package/dist/builtins/device-manager/device-manager.addon.js +2 -2
  34. package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
  35. package/dist/builtins/hub-forwarder/index.js +1 -1
  36. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  37. package/dist/builtins/keychain/index.js +3 -3
  38. package/dist/builtins/keychain/index.mjs +3 -3
  39. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  40. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  41. package/dist/builtins/local-auth/auth-schema.d.ts +2 -12
  42. package/dist/builtins/local-auth/local-auth.addon.js +52 -191
  43. package/dist/builtins/local-auth/local-auth.addon.mjs +52 -191
  44. package/dist/builtins/local-auth/oauth-session-manager.d.ts +13 -4
  45. package/dist/builtins/local-auth/record-kinds.d.ts +1 -1
  46. package/dist/builtins/local-network/local-network.addon.js +2 -2
  47. package/dist/builtins/local-network/local-network.addon.mjs +2 -2
  48. package/dist/builtins/loki-logging/index.js +1 -1
  49. package/dist/builtins/loki-logging/index.mjs +1 -1
  50. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  51. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  52. package/dist/builtins/platform-probe/index.js +1 -1
  53. package/dist/builtins/platform-probe/index.mjs +1 -1
  54. package/dist/builtins/record-entries/index.js +1 -1
  55. package/dist/builtins/record-entries/index.mjs +1 -1
  56. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  57. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  58. package/dist/builtins/snapshot/index.js +1 -1
  59. package/dist/builtins/snapshot/index.mjs +1 -1
  60. package/dist/builtins/sqlite-storage/file-host-protocol.d.ts +0 -9
  61. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  62. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  63. package/dist/builtins/sqlite-storage/index.js +1 -1
  64. package/dist/builtins/sqlite-storage/index.mjs +1 -1
  65. package/dist/builtins/sqlite-storage/owned-sqlite-file.d.ts +0 -8
  66. package/dist/builtins/sqlite-storage/records/records-sql.d.ts +0 -2
  67. package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +0 -28
  68. package/dist/builtins/sqlite-storage/sqlite-settings.addon.d.ts +1 -2
  69. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +6 -170
  70. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +6 -170
  71. package/dist/builtins/sqlite-storage/storage-admin-provider.d.ts +3 -17
  72. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  73. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  74. package/dist/builtins/system-config/system-config.addon.js +3 -3
  75. package/dist/builtins/system-config/system-config.addon.mjs +280 -280
  76. package/dist/builtins/winston-logging/index.js +1 -1
  77. package/dist/builtins/winston-logging/index.mjs +1 -1
  78. package/dist/{composition-sources-b0e_2I-D.js → composition-sources-BPnpB9XG.js} +1 -1
  79. package/dist/{composition-sources-DNRZWR1j.mjs → composition-sources-BlcYzFwY.mjs} +1 -1
  80. package/dist/{constants-6OeJiZgi.js → constants-7ZMxWr8Z.js} +1 -1
  81. package/dist/{constants-BnkOdj9Q.mjs → constants-CH5UXe_G.mjs} +1 -1
  82. package/dist/{device-ca-Bnkw8GyU.mjs → device-ca-BU_gnd-q.mjs} +1 -1
  83. package/dist/{device-ca-CPTDs--d.js → device-ca-CUEx7sti.js} +1 -1
  84. package/dist/{dist-Wy8cTxg6.mjs → dist-8tWIDoWp.mjs} +15 -55
  85. package/dist/{dist-Bn-RNanh.js → dist-Ct-4tTeX.js} +14 -66
  86. package/dist/file-host-worker.js +1 -1
  87. package/dist/file-host-worker.mjs +1 -1
  88. package/dist/{hub-mdns-ciao-CJu0nhla.mjs → hub-mdns-ciao-Cuy7LUdz.mjs} +2 -2
  89. package/dist/{hub-mdns-ciao-CTBTlia4.js → hub-mdns-ciao-DJ-Amqd7.js} +2 -2
  90. package/dist/index.d.ts +1 -1
  91. package/dist/index.js +88 -240
  92. package/dist/index.mjs +89 -236
  93. package/dist/kernel/index.d.ts +0 -1
  94. package/dist/kernel/moleculer/runner-addon-settings.d.ts +1 -6
  95. package/dist/kernel/moleculer/runner-device-settings.d.ts +2 -2
  96. package/dist/{restore-archive-CM23Pq9B.mjs → restore-archive-BDua3jO6.mjs} +78 -78
  97. package/dist/{restore-archive-DM1OBYq4.js → restore-archive-HwOA83v3.js} +1 -1
  98. package/dist/{retired-settings-keys-D_VwZiDt.js → retired-settings-keys-CGUqX-Oz.js} +0 -6
  99. package/dist/{retired-settings-keys-Bhwe4ymb.mjs → retired-settings-keys-C_Kjp-Bj.mjs} +1 -1
  100. package/dist/{wal-maintenance-Bj_MmDkr.mjs → wal-maintenance-BvzVehem.mjs} +0 -0
  101. package/dist/{wal-maintenance-CaJjuLHq.js → wal-maintenance-DBvuVU9s.js} +0 -0
  102. package/package.json +1 -1
  103. package/dist/builtins/sqlite-storage/retired-collections.d.ts +0 -146
  104. package/dist/kernel/legacy-blob-guard.d.ts +0 -63
@@ -1,9 +1,9 @@
1
1
  import { i as __require, o as __toESM, t as __commonJSMin } from "../../chunk-CNf5ZN-e.mjs";
2
- import { $ as PreferenceDeviceIdSchema, Ca as userError, D as DEVICE_ENROLLMENT_TTL_MS, En as isCredentialTokenPayload, Et as authProviderCapability, Gi as defineRecordKinds, Mt as buildDeviceSignatureMessage, Nr as userManagementCapability, Q as PREFERENCES_MAX_VALUE_BYTES, _n as formatDeviceRevoker, a as ApiKeyRecordSchema, b as CredentialTokenClaimsSchema, dt as SsoBridgeClaimsSchema, en as deviceCredentialsCapability, et as PreferenceNamespaceSchema, g as CREDENTIAL_TOKEN_AUDIENCE, gt as TokenScopeSchema, ia as makeSecretMarker, jt as buildDeviceEnrollmentLink, k as DEVICE_NONCE_TTL_MS, lt as ScopedTokenSchema, ni as BaseAddon, ta as isSecretMarker, tt as PreferenceValueSchema, vt as UserRecordSchema } from "../../dist-Wy8cTxg6.mjs";
2
+ import { $ as PreferenceDeviceIdSchema, $i as isSecretMarker, At as buildDeviceSignatureMessage, D as DEVICE_ENROLLMENT_TTL_MS, Q as PREFERENCES_MAX_VALUE_BYTES, Qt as deviceCredentialsCapability, Ui as defineRecordKinds, a as ApiKeyRecordSchema, b as CredentialTokenClaimsSchema, ei as BaseAddon, et as PreferenceNamespaceSchema, g as CREDENTIAL_TOKEN_AUDIENCE, gt as UserRecordSchema, hn as formatDeviceRevoker, jr as userManagementCapability, k as DEVICE_NONCE_TTL_MS, kt as buildDeviceEnrollmentLink, lt as SsoBridgeClaimsSchema, mt as TokenScopeSchema, na as makeSecretMarker, st as ScopedTokenSchema, tt as PreferenceValueSchema, wn as isCredentialTokenPayload, wt as authProviderCapability, xa as userError } from "../../dist-8tWIDoWp.mjs";
3
3
  import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
4
4
  import { t as require_safe_buffer } from "../../safe-buffer-B1OjL1I9.mjs";
5
5
  import { t as require_ms } from "../../ms-CgH2OFlD.mjs";
6
- import { _ as setProcessJwtSigningKey, a as importDevicePublicKey, c as rebuildDeviceCaCertificate, d as JWT_SIGNING_KEY_REF, g as processJwtSigningKey, h as loadJwtSigningKey, i as generateDeviceCa, l as verifyDeviceLeaf, m as getProcessJwtSigningKeyState, n as DEVICE_CA_KEY_REF, o as issueDeviceLeaf, r as DEVICE_CA_SETTINGS_SECTION, s as loadDeviceCa, t as DEVICE_CA_FIELD, u as verifyDeviceSignature } from "../../device-ca-Bnkw8GyU.mjs";
6
+ import { _ as setProcessJwtSigningKey, a as importDevicePublicKey, c as rebuildDeviceCaCertificate, d as JWT_SIGNING_KEY_REF, g as processJwtSigningKey, h as loadJwtSigningKey, i as generateDeviceCa, l as verifyDeviceLeaf, m as getProcessJwtSigningKeyState, n as DEVICE_CA_KEY_REF, o as issueDeviceLeaf, r as DEVICE_CA_SETTINGS_SECTION, s as loadDeviceCa, t as DEVICE_CA_FIELD, u as verifyDeviceSignature } from "../../device-ca-BU_gnd-q.mjs";
7
7
  import { z } from "zod";
8
8
  import * as crypto$1 from "node:crypto";
9
9
  import { X509Certificate, createHash, randomUUID, timingSafeEqual } from "node:crypto";
@@ -7214,16 +7214,6 @@ var API_KEYS_COLLECTION = "api_keys";
7214
7214
  */
7215
7215
  var SCOPED_TOKENS_COLLECTION = "scoped_tokens";
7216
7216
  /**
7217
- * @durable class=ledger owner=local-auth
7218
- * write="one row per redeemed OAuth code — every completed account link through
7219
- * `oauthExchangeCode`; `touch` rewrites `lastUsedAt` on each refresh"
7220
- * retention="ONLY revoked rows are pruned: the daily sweep deletes sessions
7221
- * revoked more than OAUTH_REVOKED_RETENTION_MS (30 d) ago. An ACTIVE session
7222
- * has `revokedAt` NULL, never expires and is never swept — the table grows one
7223
- * row per login until an operator revokes the link."
7224
- */
7225
- var OAUTH_SESSIONS_COLLECTION = "oauth_sessions";
7226
- /**
7227
7217
  * TOTP enrollment table — split off from `users` to avoid the
7228
7218
  * destructive drop-+-recreate migration `ensureTable` performs when a
7229
7219
  * new column is added to a typed schema (see `sqlite-settings-backend.ts`).
@@ -7455,47 +7445,6 @@ var SCOPED_TOKENS_COLUMNS = [
7455
7445
  notNull: true
7456
7446
  }
7457
7447
  ];
7458
- var OAUTH_SESSIONS_COLUMNS = [
7459
- {
7460
- name: "id",
7461
- type: "TEXT",
7462
- primaryKey: true,
7463
- notNull: true
7464
- },
7465
- {
7466
- name: "userId",
7467
- type: "TEXT",
7468
- notNull: true
7469
- },
7470
- {
7471
- name: "username",
7472
- type: "TEXT",
7473
- notNull: true
7474
- },
7475
- {
7476
- name: "integrationId",
7477
- type: "TEXT",
7478
- notNull: true
7479
- },
7480
- {
7481
- name: "scopes",
7482
- type: "JSON"
7483
- },
7484
- {
7485
- name: "createdAt",
7486
- type: "INTEGER",
7487
- notNull: true
7488
- },
7489
- {
7490
- name: "lastUsedAt",
7491
- type: "INTEGER",
7492
- notNull: true
7493
- },
7494
- {
7495
- name: "revokedAt",
7496
- type: "INTEGER"
7497
- }
7498
- ];
7499
7448
  /**
7500
7449
  * Declare every auth collection with the typed schema. Called by
7501
7450
  * `LocalAuthAddon.onInitialize` before constructing the per-collection
@@ -7536,14 +7485,6 @@ async function declareAuthSchema(store, options) {
7536
7485
  columns: ["userId"]
7537
7486
  }]
7538
7487
  });
7539
- if (!skip.has("oauth_sessions")) await store.declareCollection.mutate({
7540
- collection: OAUTH_SESSIONS_COLLECTION,
7541
- columns: OAUTH_SESSIONS_COLUMNS,
7542
- indexes: [{
7543
- name: "idx_oauth_sessions_user_id",
7544
- columns: ["userId"]
7545
- }]
7546
- });
7547
7488
  if (!skip.has("login_sessions")) await store.declareCollection.mutate({
7548
7489
  collection: LOGIN_SESSIONS_COLLECTION,
7549
7490
  columns: LOGIN_SESSIONS_COLUMNS,
@@ -7587,7 +7528,7 @@ async function declareAuthSchema(store, options) {
7587
7528
  * Record kinds owned by `local-auth` (records plan phase 6 / §2.8).
7588
7529
  *
7589
7530
  * Operator-only legacy drop: auth tables are NEVER removed by the orphan job —
7590
- * use `storageAdmin.dropCollection` with `expectRows` after verify (see
7531
+ * the operator drops a legacy table by hand, offline (D902; see
7591
7532
  * `docs/design/records-phase-6-auth-migration.md`).
7592
7533
  *
7593
7534
  * Before hub restart: mint and test an admin token (`auth.mintToken` with `'*'`); snapshot every kind.
@@ -7758,16 +7699,19 @@ var _localAuthRecordKinds = defineRecordKinds({
7758
7699
  "oauth-sessions": {
7759
7700
  schema: OauthSessionBodySchema,
7760
7701
  class: "ledger",
7761
- writeTrigger: "OAuth code exchange; refresh touches lastUsedAt",
7702
+ writeTrigger: "OAuth code exchange; refresh touches lastUsedAt; revoke stamps revokedAt",
7762
7703
  device: "none",
7763
7704
  at: "none",
7764
7705
  indexes: [{
7765
7706
  name: "user",
7766
7707
  fields: ["userId"]
7708
+ }, {
7709
+ name: "revoked",
7710
+ fields: ["revokedAt"]
7767
7711
  }],
7768
7712
  retention: {
7769
7713
  owner: "local-auth",
7770
- reason: "daily reap deletes revoked sessions older than 30 days; active rows never expire"
7714
+ reason: "daily reap deletes sessions revoked more than 30 days ago; an active session has no lifetime, so no engine TTL"
7771
7715
  }
7772
7716
  },
7773
7717
  "user-totp": {
@@ -7848,7 +7792,6 @@ var LOCAL_AUTH_RECORDS_LEGACY_COLLECTIONS = [
7848
7792
  ADMIN_TOKENS_COLLECTION,
7849
7793
  LOGIN_SESSIONS_COLLECTION,
7850
7794
  LOGIN_SESSION_CUTOFFS_COLLECTION,
7851
- OAUTH_SESSIONS_COLLECTION,
7852
7795
  USER_TOTP_COLLECTION,
7853
7796
  USER_EXTERNAL_IDENTITIES_COLLECTION,
7854
7797
  DEVICE_CREDENTIALS_COLLECTION,
@@ -8053,7 +7996,7 @@ function num(data, key) {
8053
7996
  const value = data[key];
8054
7997
  return typeof value === "number" && Number.isFinite(value) ? value : null;
8055
7998
  }
8056
- function parseSession$1(data) {
7999
+ function parseSession(data) {
8057
8000
  const id = str(data, "id");
8058
8001
  const userId = str(data, "userId");
8059
8002
  const createdAt = num(data, "createdAt");
@@ -8116,7 +8059,7 @@ var LoginSessionManager = class {
8116
8059
  if (sessionsKind !== null) {
8117
8060
  const rows = await (0, import_read_all_rows.readAllRows)(sessionsKind);
8118
8061
  for (const row of rows) {
8119
- const record = parseSession$1({
8062
+ const record = parseSession({
8120
8063
  id: row.id,
8121
8064
  ...row.data
8122
8065
  });
@@ -8128,7 +8071,7 @@ var LoginSessionManager = class {
8128
8071
  }
8129
8072
  const rows = await this.store.query.query({ collection: LOGIN_SESSIONS_COLLECTION });
8130
8073
  for (const row of rows) {
8131
- const record = parseSession$1(row.data);
8074
+ const record = parseSession(row.data);
8132
8075
  if (record !== null) this.remember(record);
8133
8076
  }
8134
8077
  const cutoffs = await this.store.query.query({ collection: LOGIN_SESSION_CUTOFFS_COLLECTION });
@@ -12034,33 +11977,6 @@ function createOauthGrants(ssoBridge, sessionManager) {
12034
11977
  }
12035
11978
  //#endregion
12036
11979
  //#region src/builtins/local-auth/oauth-session-manager.ts
12037
- function parseSession(data) {
12038
- const id = data["id"];
12039
- const userId = data["userId"];
12040
- const username = data["username"];
12041
- const integrationId = data["integrationId"];
12042
- const scopes = data["scopes"];
12043
- const createdAt = data["createdAt"];
12044
- const lastUsedAt = data["lastUsedAt"];
12045
- const revokedAt = data["revokedAt"];
12046
- if (typeof id !== "string") throw new Error("oauth_sessions row: missing id");
12047
- if (typeof userId !== "string") throw new Error("oauth_sessions row: missing userId");
12048
- if (typeof username !== "string") throw new Error("oauth_sessions row: missing username");
12049
- if (typeof integrationId !== "string") throw new Error("oauth_sessions row: missing integrationId");
12050
- if (!Array.isArray(scopes)) throw new Error("oauth_sessions row: scopes must be an array");
12051
- if (typeof createdAt !== "number") throw new Error("oauth_sessions row: missing createdAt");
12052
- if (typeof lastUsedAt !== "number") throw new Error("oauth_sessions row: missing lastUsedAt");
12053
- return {
12054
- id,
12055
- userId,
12056
- username,
12057
- integrationId,
12058
- scopes,
12059
- createdAt,
12060
- lastUsedAt,
12061
- revokedAt: typeof revokedAt === "number" ? revokedAt : null
12062
- };
12063
- }
12064
11980
  function sessionToBody(session) {
12065
11981
  return {
12066
11982
  userId: session.userId,
@@ -12073,22 +11989,34 @@ function sessionToBody(session) {
12073
11989
  };
12074
11990
  }
12075
11991
  function rowToSession(id, body) {
12076
- return parseSession({
11992
+ return {
12077
11993
  id,
12078
- ...body
12079
- });
11994
+ userId: body.userId,
11995
+ username: body.username,
11996
+ integrationId: body.integrationId,
11997
+ scopes: body.scopes,
11998
+ createdAt: body.createdAt,
11999
+ lastUsedAt: body.lastUsedAt,
12000
+ revokedAt: typeof body.revokedAt === "number" ? body.revokedAt : null
12001
+ };
12080
12002
  }
12003
+ /**
12004
+ * The OAuth account links (one row per redeemed code), kept in local-auth's
12005
+ * `oauth-sessions` records kind (D881, D902). There is no table: the
12006
+ * `oauth_sessions` collection and its settings-store path are gone.
12007
+ */
12081
12008
  var OauthSessionManager = class {
12082
12009
  kind;
12083
- store;
12084
12010
  constructor(deps) {
12085
- if ("oauthSessionsKind" in deps) {
12086
- this.kind = deps.oauthSessionsKind;
12087
- this.store = deps.legacyStore ?? null;
12088
- } else {
12089
- this.kind = null;
12090
- this.store = deps;
12091
- }
12011
+ this.kind = deps.oauthSessionsKind;
12012
+ }
12013
+ async write(session) {
12014
+ const parsed = localAuthRecordKinds["oauth-sessions"].schema.safeParse(sessionToBody(session));
12015
+ if (!parsed.success) throw new Error(parsed.error.message);
12016
+ await this.kind.put({
12017
+ id: session.id,
12018
+ data: parsed.data
12019
+ });
12092
12020
  }
12093
12021
  async create(input) {
12094
12022
  const now = Date.now();
@@ -12102,117 +12030,53 @@ var OauthSessionManager = class {
12102
12030
  lastUsedAt: now,
12103
12031
  revokedAt: null
12104
12032
  };
12105
- const kind = this.kind;
12106
- if (kind !== null) {
12107
- const parsed = localAuthRecordKinds["oauth-sessions"].schema.safeParse(sessionToBody(session));
12108
- if (!parsed.success) throw new Error(parsed.error.message);
12109
- await kind.put({
12110
- id: session.id,
12111
- data: parsed.data
12112
- });
12113
- return session;
12114
- }
12115
- await this.store.insert.mutate({
12116
- collection: OAUTH_SESSIONS_COLLECTION,
12117
- record: {
12118
- id: session.id,
12119
- data: { ...session }
12120
- }
12121
- });
12033
+ await this.write(session);
12122
12034
  return session;
12123
12035
  }
12124
12036
  async list() {
12125
- const kind = this.kind;
12126
- if (kind !== null) return (await (0, import_read_all_rows.readAllRows)(kind)).map((row) => rowToSession(row.id, row.data));
12127
- return (await this.store.query.query({
12128
- collection: OAUTH_SESSIONS_COLLECTION,
12129
- filter: {}
12130
- })).map((r) => parseSession(r.data));
12037
+ return (await (0, import_read_all_rows.readAllRows)(this.kind)).map((row) => rowToSession(row.id, row.data));
12131
12038
  }
12132
12039
  async getById(id) {
12133
- const kind = this.kind;
12134
- if (kind !== null) {
12135
- const row = await kind.get(id);
12136
- return row === null ? null : rowToSession(row.id, row.data);
12137
- }
12138
- const results = await this.store.query.query({
12139
- collection: OAUTH_SESSIONS_COLLECTION,
12140
- filter: { where: { id } }
12141
- });
12142
- if (results.length === 0) return null;
12143
- return parseSession(results[0].data);
12040
+ const row = await this.kind.get(id);
12041
+ return row === null ? null : rowToSession(row.id, row.data);
12144
12042
  }
12145
12043
  async markRevoked(id) {
12146
12044
  const existing = await this.getById(id);
12147
12045
  if (existing === null) return false;
12148
12046
  if (existing.revokedAt !== null) return true;
12149
- const updated = {
12047
+ await this.write({
12150
12048
  ...existing,
12151
12049
  revokedAt: Date.now()
12152
- };
12153
- const kind = this.kind;
12154
- if (kind !== null) {
12155
- const parsed = localAuthRecordKinds["oauth-sessions"].schema.safeParse(sessionToBody(updated));
12156
- if (!parsed.success) throw new Error(parsed.error.message);
12157
- await kind.put({
12158
- id,
12159
- data: parsed.data
12160
- });
12161
- return true;
12162
- }
12163
- await this.store.update.mutate({
12164
- collection: OAUTH_SESSIONS_COLLECTION,
12165
- id,
12166
- data: { ...updated }
12167
12050
  });
12168
12051
  return true;
12169
12052
  }
12170
12053
  async remove(id) {
12171
12054
  if (await this.getById(id) === null) return false;
12172
- const kind = this.kind;
12173
- if (kind !== null) {
12174
- await kind.delete(id);
12175
- return true;
12176
- }
12177
- await this.store.delete.mutate({
12178
- collection: OAUTH_SESSIONS_COLLECTION,
12179
- key: id
12180
- });
12055
+ await this.kind.delete(id);
12181
12056
  return true;
12182
12057
  }
12058
+ /**
12059
+ * Delete the sessions revoked at or before `horizonMs`. An active session
12060
+ * (`revokedAt` null) is never matched: it has no lifetime of its own, which
12061
+ * is why this is the owner's sweep and not an engine TTL.
12062
+ */
12183
12063
  async reapRevoked(horizonMs) {
12184
- const kind = this.kind;
12185
- if (kind !== null) return kind.deleteWhere({ where: { revokedAt: {
12064
+ return this.kind.deleteWhere({ where: { revokedAt: {
12186
12065
  gte: 1,
12187
12066
  lte: horizonMs
12188
12067
  } } });
12189
- const { deleted } = await this.store.deleteWhere.mutate({
12190
- collection: OAUTH_SESSIONS_COLLECTION,
12191
- filter: { whereBetween: { revokedAt: [1, horizonMs] } }
12192
- });
12193
- return deleted;
12194
12068
  }
12195
12069
  async touch(id) {
12196
12070
  const existing = await this.getById(id);
12197
12071
  if (existing === null) return;
12198
- const updated = {
12072
+ const parsed = localAuthRecordKinds["oauth-sessions"].schema.safeParse(sessionToBody({
12199
12073
  ...existing,
12200
12074
  lastUsedAt: Date.now()
12201
- };
12202
- const kind = this.kind;
12203
- if (kind !== null) {
12204
- const parsed = localAuthRecordKinds["oauth-sessions"].schema.safeParse(sessionToBody(updated));
12205
- if (!parsed.success) return;
12206
- await kind.put({
12207
- id,
12208
- data: parsed.data
12209
- });
12210
- return;
12211
- }
12212
- await this.store.update.mutate({
12213
- collection: OAUTH_SESSIONS_COLLECTION,
12075
+ }));
12076
+ if (!parsed.success) return;
12077
+ await this.kind.put({
12214
12078
  id,
12215
- data: { ...updated }
12079
+ data: parsed.data
12216
12080
  });
12217
12081
  }
12218
12082
  };
@@ -12297,10 +12161,7 @@ var LocalAuthAddon = class extends BaseAddon {
12297
12161
  apiKeysKind: authStores.apiKeys,
12298
12162
  legacyStore: store
12299
12163
  });
12300
- this.oauthSessionManager = new OauthSessionManager({
12301
- oauthSessionsKind: authStores.oauthSessions,
12302
- legacyStore: store
12303
- });
12164
+ this.oauthSessionManager = new OauthSessionManager({ oauthSessionsKind: authStores.oauthSessions });
12304
12165
  this.totpManager = new TotpManager({
12305
12166
  userTotpKind: authStores.userTotp,
12306
12167
  legacyStore: store
@@ -1,4 +1,4 @@
1
- import type { RecordKindHandle, SettingsStoreClient, TokenScope } from "@camstack/types";
1
+ import type { RecordKindHandle, TokenScope } from "@camstack/types";
2
2
  import type { OauthSessionBody } from "./record-kinds.js";
3
3
  export interface OauthSession {
4
4
  readonly id: string;
@@ -18,17 +18,26 @@ interface CreateInput {
18
18
  }
19
19
  export interface OauthSessionRecordsDeps {
20
20
  readonly oauthSessionsKind: RecordKindHandle<OauthSessionBody>;
21
- readonly legacyStore?: SettingsStoreClient;
22
21
  }
22
+ /**
23
+ * The OAuth account links (one row per redeemed code), kept in local-auth's
24
+ * `oauth-sessions` records kind (D881, D902). There is no table: the
25
+ * `oauth_sessions` collection and its settings-store path are gone.
26
+ */
23
27
  export declare class OauthSessionManager {
24
28
  private readonly kind;
25
- private readonly store;
26
- constructor(deps: SettingsStoreClient | OauthSessionRecordsDeps);
29
+ constructor(deps: OauthSessionRecordsDeps);
30
+ private write;
27
31
  create(input: CreateInput): Promise<OauthSession>;
28
32
  list(): Promise<OauthSession[]>;
29
33
  getById(id: string): Promise<OauthSession | null>;
30
34
  markRevoked(id: string): Promise<boolean>;
31
35
  remove(id: string): Promise<boolean>;
36
+ /**
37
+ * Delete the sessions revoked at or before `horizonMs`. An active session
38
+ * (`revokedAt` null) is never matched: it has no lifetime of its own, which
39
+ * is why this is the owner's sweep and not an engine TTL.
40
+ */
32
41
  reapRevoked(horizonMs: number): Promise<number>;
33
42
  touch(id: string): Promise<void>;
34
43
  }
@@ -2,7 +2,7 @@
2
2
  * Record kinds owned by `local-auth` (records plan phase 6 / §2.8).
3
3
  *
4
4
  * Operator-only legacy drop: auth tables are NEVER removed by the orphan job —
5
- * use `storageAdmin.dropCollection` with `expectRows` after verify (see
5
+ * the operator drops a legacy table by hand, offline (D902; see
6
6
  * `docs/design/records-phase-6-auth-migration.md`).
7
7
  *
8
8
  * Before hub restart: mint and test an admin token (`auth.mintToken` with `'*'`); snapshot every kind.
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("../../chunk-Cek0wNdY.js");
3
- const require_dist = require("../../dist-Bn-RNanh.js");
4
- const require_hub_mdns_ciao = require("../../hub-mdns-ciao-CTBTlia4.js");
3
+ const require_dist = require("../../dist-Ct-4tTeX.js");
4
+ const require_hub_mdns_ciao = require("../../hub-mdns-ciao-DJ-Amqd7.js");
5
5
  let zod = require("zod");
6
6
  let node_net = require("node:net");
7
7
  let node_os = require("node:os");
@@ -1,5 +1,5 @@
1
- import { $n as pickAppLinkHub, Cn as isAppLinkBase, Dn as isDefaultAppConnectionEndpoint, Fr as validateCustomAddress, H as HUB_MDNS_TXT_KEYS, Ln as localNetworkCapability, Lt as checkRoleAddress, Ta as EventCategory, V as HUB_MDNS_SERVICE_TYPE, Z as NetworkTunnelStartedDataSchema, cr as resolveAppConnections, fr as resolveHubAddressRoles, hr as resolveNotificationTapAddress, l as CAMSTACK_APP_LINK_ORIGIN, ni as BaseAddon, ti as errMsg, xr as shortHostname } from "../../dist-Wy8cTxg6.mjs";
2
- import { P as readLanHttpState, a as storeUploadedCertificate, d as servedHttpsLeafFingerprint, g as readTlsMode, h as readTlsAccessStatus, i as revertToGeneratedCertificate, j as applyLanHttp, k as DEFAULT_LAN_HTTP_PORT, m as readExtraSans, n as applyCertificateToListener, o as useStoredUploadedCertificate, r as regenerateCertificate, t as createCiaoPublisher, v as writeExtraSans, w as ensureTlsCert } from "../../hub-mdns-ciao-CJu0nhla.mjs";
1
+ import { $r as errMsg, Ca as EventCategory, Fn as localNetworkCapability, Ft as checkRoleAddress, H as HUB_MDNS_TXT_KEYS, Nr as validateCustomAddress, Tn as isDefaultAppConnectionEndpoint, V as HUB_MDNS_SERVICE_TYPE, Z as NetworkTunnelStartedDataSchema, Zn as pickAppLinkHub, ei as BaseAddon, l as CAMSTACK_APP_LINK_ORIGIN, or as resolveAppConnections, pr as resolveNotificationTapAddress, ur as resolveHubAddressRoles, xn as isAppLinkBase, yr as shortHostname } from "../../dist-8tWIDoWp.mjs";
2
+ import { P as readLanHttpState, a as storeUploadedCertificate, d as servedHttpsLeafFingerprint, g as readTlsMode, h as readTlsAccessStatus, i as revertToGeneratedCertificate, j as applyLanHttp, k as DEFAULT_LAN_HTTP_PORT, m as readExtraSans, n as applyCertificateToListener, o as useStoredUploadedCertificate, r as regenerateCertificate, t as createCiaoPublisher, v as writeExtraSans, w as ensureTlsCert } from "../../hub-mdns-ciao-Cuy7LUdz.mjs";
3
3
  import { z } from "zod";
4
4
  import { isIP } from "node:net";
5
5
  import * as os$1 from "node:os";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  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_log_read_filter = require("../../log-read-filter-Bi066jwU.js");
8
8
  let zod = require("zod");
9
9
  //#region src/builtins/loki-logging/loki-payload.ts
@@ -1,4 +1,4 @@
1
- import { ni as BaseAddon, zn as logDestinationCapability } from "../../dist-Wy8cTxg6.mjs";
1
+ import { Ln as logDestinationCapability, ei as BaseAddon } from "../../dist-8tWIDoWp.mjs";
2
2
  import { n as compileLogFilter, o as lineMatches } from "../../log-read-filter-D7Ev3zm-.mjs";
3
3
  import { z } from "zod";
4
4
  //#region src/builtins/loki-logging/loki-payload.ts
@@ -3,7 +3,7 @@ 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
  let node_fs_promises = require("node:fs/promises");
8
8
  let node_util = require("node:util");
9
9
  let node_os = require("node:os");
@@ -1,4 +1,4 @@
1
- import { Gn as metricsProviderCapability, Hi as createEvent, Ta as EventCategory, _t as UNATTRIBUTED_BUCKET_KEY, gn as foldSnapshotByFunction, lr as resolveBucketMs, ni as BaseAddon, or as reducePoints, rt as ROOT_BUCKET_KEY, ti as errMsg } from "../../dist-Wy8cTxg6.mjs";
1
+ import { $r as errMsg, Bi as createEvent, Ca as EventCategory, Un as metricsProviderCapability, ei as BaseAddon, ht as UNATTRIBUTED_BUCKET_KEY, ir as reducePoints, mn as foldSnapshotByFunction, rt as ROOT_BUCKET_KEY, sr as resolveBucketMs } from "../../dist-8tWIDoWp.mjs";
2
2
  import { access, readFile, readdir } from "node:fs/promises";
3
3
  import { promisify } from "node:util";
4
4
  import * as os$1 from "node:os";
@@ -3,7 +3,7 @@ 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_coral_accelerators = require("../../coral-accelerators-oUXmmbc2.js");
8
8
  let node_util = require("node:util");
9
9
  let node_os = require("node:os");
@@ -1,5 +1,5 @@
1
1
  import { o as __toESM, r as __exportAll } from "../../chunk-CNf5ZN-e.mjs";
2
- import { Ta as EventCategory, ni as BaseAddon, qi as emitReadiness, sn as enumerateInferenceDevices, ti as errMsg, tr as platformProbeCapability, yr as scoreRuntimes } from "../../dist-Wy8cTxg6.mjs";
2
+ import { $n as platformProbeCapability, $r as errMsg, Ca as EventCategory, Gi as emitReadiness, _r as scoreRuntimes, an as enumerateInferenceDevices, ei as BaseAddon } from "../../dist-8tWIDoWp.mjs";
3
3
  import { n as nodeCoralFs, t as classifyCoralAccelerator } from "../../coral-accelerators-Qhn5TOYZ.mjs";
4
4
  import { promisify } from "node:util";
5
5
  import * as os$1 from "node:os";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-Bn-RNanh.js");
6
+ const require_dist = require("../../dist-Ct-4tTeX.js");
7
7
  let zod = require("zod");
8
8
  let node_crypto = require("node:crypto");
9
9
  //#region src/builtins/record-entries/entries-service.ts
@@ -1,4 +1,4 @@
1
- import { aa as mapSecretLeaves, fi as InvalidRecordError, ir as recordEntriesCapability, ji as UnknownRecordKindError, ni as BaseAddon, pa as recordSecretRef } from "../../dist-Wy8cTxg6.mjs";
1
+ import { da as recordSecretRef, ei as BaseAddon, ki as UnknownRecordKindError, nr as recordEntriesCapability, ra as mapSecretLeaves, ui as InvalidRecordError } from "../../dist-8tWIDoWp.mjs";
2
2
  import { z } from "zod";
3
3
  import { randomUUID } from "node:crypto";
4
4
  //#region src/builtins/record-entries/entries-service.ts
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-Bn-RNanh.js");
6
+ const require_dist = require("../../dist-Ct-4tTeX.js");
7
7
  //#region src/builtins/remote-access-orchestrator/enabled-providers-reconcile.ts
8
8
  /**
9
9
  * Reconcile the durable `enabledProviders` set against authoritative
@@ -1,4 +1,4 @@
1
- import { Ta as EventCategory, ni as BaseAddon } from "../../dist-Wy8cTxg6.mjs";
1
+ import { Ca as EventCategory, ei as BaseAddon } from "../../dist-8tWIDoWp.mjs";
2
2
  //#region src/builtins/remote-access-orchestrator/enabled-providers-reconcile.ts
3
3
  /**
4
4
  * Reconcile the durable `enabledProviders` set against authoritative
@@ -3,7 +3,7 @@ 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_snapshot_courtesy = require("../../snapshot-courtesy-D_C5-nC0.js");
8
8
  let zod = require("zod");
9
9
  let node_crypto = require("node:crypto");
@@ -1,4 +1,4 @@
1
- import { Cr as snapshotCapability, Ot as bareAddonId, Qr as DeviceFeature, Qt as deriveBatteryPresence, Ta as EventCategory, Wn as memoizePinnedFfmpeg, ei as DeviceType, jr as streamQualityLabel, kt as batteryCapability, ni as BaseAddon, oa as nodePin, s as BatteryStatusSchema, ti as errMsg } from "../../dist-Wy8cTxg6.mjs";
1
+ import { $r as errMsg, Ca as EventCategory, Dt as batteryCapability, Et as bareAddonId, Hn as memoizePinnedFfmpeg, Qr as DeviceType, Xr as DeviceFeature, Xt as deriveBatteryPresence, ei as BaseAddon, ia as nodePin, kr as streamQualityLabel, s as BatteryStatusSchema, xr as snapshotCapability } from "../../dist-8tWIDoWp.mjs";
2
2
  import { i as renderCourtesyOverlayJpeg, n as courtesyCacheKey, r as renderCourtesyJpeg } from "../../snapshot-courtesy-CyFs1M3I.mjs";
3
3
  import { z } from "zod";
4
4
  import { randomUUID } from "node:crypto";
@@ -40,15 +40,6 @@ export interface ControlOps {
40
40
  };
41
41
  readonly output: boolean;
42
42
  };
43
- /** Drop a retired table, reporting the rows that went with it (`null`: not there). */
44
- readonly dropRetiredTable: {
45
- readonly input: {
46
- readonly name: string;
47
- };
48
- readonly output: {
49
- readonly rows: number;
50
- } | null;
51
- };
52
43
  /** Which thread serves this file. */
53
44
  readonly threadId: {
54
45
  readonly input: Record<string, never>;
@@ -3,7 +3,7 @@ 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
  let node_crypto = require("node:crypto");
8
8
  let node_fs_promises = require("node:fs/promises");
9
9
  let node_path = require("node:path");
@@ -1,4 +1,4 @@
1
- import { hn as filesystemBrowseCapability, kr as storageProviderCapability, ni as BaseAddon } from "../../dist-Wy8cTxg6.mjs";
1
+ import { Dr as storageProviderCapability, ei as BaseAddon, pn as filesystemBrowseCapability } from "../../dist-8tWIDoWp.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { mkdir, readdir, realpath, statfs } from "node:fs/promises";
4
4
  import * as path$1 from "node:path";
@@ -4,7 +4,7 @@ Object.defineProperties(exports, {
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
6
  const require_builtins_sqlite_storage_filesystem_storage_addon = require("./filesystem-storage.addon.js");
7
- const require_wal_maintenance = require("../../wal-maintenance-CaJjuLHq.js");
7
+ const require_wal_maintenance = require("../../wal-maintenance-DBvuVU9s.js");
8
8
  const require_builtins_sqlite_storage_sqlite_settings_addon = require("./sqlite-settings.addon.js");
9
9
  //#region src/builtins/sqlite-storage/config-store.ts
10
10
  var ConfigStore = class {
@@ -1,5 +1,5 @@
1
1
  import { FilesystemStorageAddon, t as FilesystemStorageProvider } from "./filesystem-storage.addon.mjs";
2
- import { A as SQLITE_MMAP_CEILING_BYTES, B as SQLITE_SLOW_CALL_MS, F as sqlitePageCacheKibFor, H as sqliteEngineStorm, I as SQLITE_ENGINE_STORM_WALL_SHARE, L as SQLITE_PROFILE_REPORT_FLOOR_MS, M as SQLITE_PAGE_CACHE_CEILING_KIB, N as SQLITE_PAGE_CACHE_FLOOR_KIB, P as sqliteMmapSizeFor, R as SQLITE_PROFILE_REPORT_INTERVAL_MS, V as SqliteOpProfiler, a as WalMaintenance, i as WAL_MAINTENANCE_INTERVAL_MS, j as SQLITE_MMAP_FLOOR_BYTES, k as SQLITE_JOURNAL_SIZE_LIMIT_BYTES, l as SqliteSettingsBackend, n as WAL_HIGH_WATER_BYTES, r as WAL_IDLE_QUIET_MS, t as WAL_CHECKPOINT_BUSY_TIMEOUT_MS, z as SQLITE_PROFILE_TOP_N } from "../../wal-maintenance-Bj_MmDkr.mjs";
2
+ import { A as SQLITE_MMAP_CEILING_BYTES, B as SQLITE_SLOW_CALL_MS, F as sqlitePageCacheKibFor, H as sqliteEngineStorm, I as SQLITE_ENGINE_STORM_WALL_SHARE, L as SQLITE_PROFILE_REPORT_FLOOR_MS, M as SQLITE_PAGE_CACHE_CEILING_KIB, N as SQLITE_PAGE_CACHE_FLOOR_KIB, P as sqliteMmapSizeFor, R as SQLITE_PROFILE_REPORT_INTERVAL_MS, V as SqliteOpProfiler, a as WalMaintenance, i as WAL_MAINTENANCE_INTERVAL_MS, j as SQLITE_MMAP_FLOOR_BYTES, k as SQLITE_JOURNAL_SIZE_LIMIT_BYTES, l as SqliteSettingsBackend, n as WAL_HIGH_WATER_BYTES, r as WAL_IDLE_QUIET_MS, t as WAL_CHECKPOINT_BUSY_TIMEOUT_MS, z as SQLITE_PROFILE_TOP_N } from "../../wal-maintenance-BvzVehem.mjs";
3
3
  import { SqliteSettingsAddon } from "./sqlite-settings.addon.mjs";
4
4
  //#region src/builtins/sqlite-storage/config-store.ts
5
5
  var ConfigStore = class {