@camstack/system 1.2.458 → 1.2.460

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 (109) hide show
  1. package/dist/addon-runner.js +26 -11
  2. package/dist/addon-runner.mjs +26 -11
  3. package/dist/addon-utils.mjs +1 -1
  4. package/dist/{agent-https-DOELEug8.js → agent-https-Dnr_nIVx.js} +3 -723
  5. package/dist/{agent-https-CQA3W-3e.mjs → agent-https-Iw3RSQup.mjs} +4 -616
  6. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  7. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +4 -4
  8. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  9. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +5 -5
  10. package/dist/builtins/alerts/alerts.addon.js +5 -7
  11. package/dist/builtins/alerts/alerts.addon.mjs +5 -7
  12. package/dist/builtins/alerts/record-kinds.d.ts +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.js +242 -4
  16. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +243 -5
  17. package/dist/builtins/calendars/calendars.addon.js +2 -10
  18. package/dist/builtins/calendars/calendars.addon.mjs +2 -3
  19. package/dist/builtins/calendars/record-kinds.d.ts +1 -1
  20. package/dist/builtins/camera-grid/index.js +1 -1
  21. package/dist/builtins/camera-grid/index.mjs +1 -1
  22. package/dist/builtins/composer/composer.addon.js +2 -2
  23. package/dist/builtins/composer/composer.addon.mjs +2 -2
  24. package/dist/builtins/console-logging/index.js +1 -1
  25. package/dist/builtins/console-logging/index.mjs +1 -1
  26. package/dist/builtins/core-blocks/core-blocks.addon.js +4 -6
  27. package/dist/builtins/core-blocks/core-blocks.addon.mjs +4 -6
  28. package/dist/builtins/device-history/device-history.addon.js +1 -1
  29. package/dist/builtins/device-history/device-history.addon.mjs +1 -1
  30. package/dist/builtins/device-manager/device-manager.addon.js +2 -4
  31. package/dist/builtins/device-manager/device-manager.addon.mjs +2 -4
  32. package/dist/builtins/hub-forwarder/index.js +1 -1
  33. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  34. package/dist/builtins/keychain/index.js +41 -43
  35. package/dist/builtins/keychain/index.mjs +41 -43
  36. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  37. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  38. package/dist/builtins/local-auth/local-auth.addon.js +24 -40
  39. package/dist/builtins/local-auth/local-auth.addon.mjs +27 -43
  40. package/dist/builtins/local-network/local-network.addon.js +2 -2
  41. package/dist/builtins/local-network/local-network.addon.mjs +2 -2
  42. package/dist/builtins/loki-logging/index.js +1 -1
  43. package/dist/builtins/loki-logging/index.mjs +1 -1
  44. package/dist/builtins/native-metrics/native-metrics.addon.js +39 -4
  45. package/dist/builtins/native-metrics/native-metrics.addon.mjs +48 -13
  46. package/dist/builtins/native-metrics/node-metrics-history-recorder.d.ts +16 -2
  47. package/dist/builtins/platform-probe/coral-accelerators.d.ts +10 -1
  48. package/dist/builtins/platform-probe/index.js +7 -4
  49. package/dist/builtins/platform-probe/index.mjs +13 -10
  50. package/dist/builtins/platform-probe/platform-scorer.d.ts +4 -1
  51. package/dist/builtins/record-entries/index.js +1 -1
  52. package/dist/builtins/record-entries/index.mjs +1 -1
  53. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  54. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  55. package/dist/builtins/snapshot/index.js +1 -1
  56. package/dist/builtins/snapshot/index.mjs +1 -1
  57. package/dist/builtins/sqlite-storage/file-host-protocol.d.ts +0 -15
  58. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  59. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +20 -20
  60. package/dist/builtins/sqlite-storage/index.js +1 -1
  61. package/dist/builtins/sqlite-storage/index.mjs +1 -1
  62. package/dist/builtins/sqlite-storage/owned-sqlite-file.d.ts +0 -44
  63. package/dist/builtins/sqlite-storage/records/records-catalog.d.ts +0 -2
  64. package/dist/builtins/sqlite-storage/records/records-engine-types.d.ts +0 -21
  65. package/dist/builtins/sqlite-storage/records/records-engine.d.ts +3 -20
  66. package/dist/builtins/sqlite-storage/records/records-plan.d.ts +9 -4
  67. package/dist/builtins/sqlite-storage/records/records-provider.d.ts +4 -18
  68. package/dist/builtins/sqlite-storage/records/records-sql.d.ts +1 -1
  69. package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +0 -17
  70. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +21 -196
  71. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +21 -196
  72. package/dist/builtins/sqlite-storage/storage-admin-provider.d.ts +6 -14
  73. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts +2 -2
  74. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +7 -9
  75. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +7 -9
  76. package/dist/builtins/system-config/system-config.addon.js +667 -40
  77. package/dist/builtins/system-config/system-config.addon.mjs +737 -127
  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-BVguN7VV.mjs → composition-sources-DNRZWR1j.mjs} +1 -1
  81. package/dist/{composition-sources-DURQNDJ4.js → composition-sources-b0e_2I-D.js} +1 -1
  82. package/dist/{constants-Njka8Cv6.js → constants-6OeJiZgi.js} +1 -1
  83. package/dist/{constants-FGjnsE2x.mjs → constants-BnkOdj9Q.mjs} +1 -1
  84. package/dist/{coral-accelerators-DcnZvctM.mjs → coral-accelerators-Qhn5TOYZ.mjs} +18 -15
  85. package/dist/{coral-accelerators-Bi_c3Rft.js → coral-accelerators-oUXmmbc2.js} +13 -10
  86. package/dist/{custom-action-registry-stpC3Zy-.mjs → custom-action-registry-DStvrQKI.mjs} +37 -37
  87. package/dist/{device-ca-lEaAQ9Xi.mjs → device-ca-Bnkw8GyU.mjs} +1 -1
  88. package/dist/{device-ca-BrVK_5s3.js → device-ca-CPTDs--d.js} +1 -1
  89. package/dist/{dist-BZQjLPiz.js → dist-Bn-RNanh.js} +29 -130
  90. package/dist/{dist-B_GRPhnY.mjs → dist-Wy8cTxg6.mjs} +30 -113
  91. package/dist/file-host-worker.js +1 -1
  92. package/dist/file-host-worker.mjs +1 -1
  93. package/dist/{hub-mdns-ciao-Bg2HfTwP.mjs → hub-mdns-ciao-CJu0nhla.mjs} +2 -2
  94. package/dist/{hub-mdns-ciao-nce3TXs_.js → hub-mdns-ciao-CTBTlia4.js} +2 -2
  95. package/dist/index.d.ts +1 -0
  96. package/dist/index.js +56 -31
  97. package/dist/index.mjs +257 -233
  98. package/dist/kernel/deps/addon-deps-manager.d.ts +9 -0
  99. package/dist/{restore-archive-C7kLDI_0.mjs → restore-archive-CM23Pq9B.mjs} +177 -424
  100. package/dist/{restore-archive-FyfZ8YMC.js → restore-archive-DM1OBYq4.js} +89 -342
  101. package/dist/{wal-maintenance-Duejh7Lx.mjs → wal-maintenance-Bj_MmDkr.mjs} +0 -0
  102. package/dist/{wal-maintenance-DfSIOj24.js → wal-maintenance-CaJjuLHq.js} +0 -0
  103. package/package.json +1 -1
  104. package/dist/builtins/records/legacy-table-row-count.d.ts +0 -5
  105. package/dist/builtins/records/phase6-declare-gate.d.ts +0 -28
  106. package/dist/builtins/sqlite-storage/records/count-settings-array-legacy.d.ts +0 -5
  107. package/dist/builtins/sqlite-storage/records/count-settings-brokers-legacy.d.ts +0 -6
  108. package/dist/phase6-declare-gate-Dag1_WR2.js +0 -98
  109. package/dist/phase6-declare-gate-Lb-mrVvz.mjs +0 -93
@@ -1,10 +1,10 @@
1
- import { hn as filesystemBrowseCapability, kr as storageProviderCapability, ni as BaseAddon } from "../../dist-B_GRPhnY.mjs";
1
+ import { hn as filesystemBrowseCapability, kr as storageProviderCapability, ni as BaseAddon } from "../../dist-Wy8cTxg6.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";
5
5
  import { basename, dirname, isAbsolute, join, resolve, sep } from "node:path";
6
6
  import { homedir } from "node:os";
7
- import * as fs from "node:fs";
7
+ import * as fs$1 from "node:fs";
8
8
  //#region src/builtins/sqlite-storage/path-guard.ts
9
9
  /**
10
10
  * Guards for the filesystem-browse cap. Pure + synchronous so they are
@@ -169,16 +169,16 @@ var FilesystemStorageProvider = class FilesystemStorageProvider {
169
169
  error: "config.basePath must be a non-empty string"
170
170
  };
171
171
  try {
172
- const stat = await fs.promises.stat(basePath).catch(() => null);
172
+ const stat = await fs$1.promises.stat(basePath).catch(() => null);
173
173
  if (stat) {
174
174
  if (!stat.isDirectory()) return {
175
175
  ok: false,
176
176
  error: `Path "${basePath}" exists but is not a directory`
177
177
  };
178
- await fs.promises.access(basePath, fs.constants.W_OK);
178
+ await fs$1.promises.access(basePath, fs$1.constants.W_OK);
179
179
  return { ok: true };
180
180
  }
181
- await fs.promises.mkdir(basePath, { recursive: true });
181
+ await fs$1.promises.mkdir(basePath, { recursive: true });
182
182
  return { ok: true };
183
183
  } catch (err) {
184
184
  return {
@@ -192,12 +192,12 @@ var FilesystemStorageProvider = class FilesystemStorageProvider {
192
192
  }
193
193
  async write({ location, relativePath, data }) {
194
194
  const filePath = safeResolve(getBasePath(location), relativePath);
195
- await fs.promises.mkdir(path$1.dirname(filePath), { recursive: true });
196
- await fs.promises.writeFile(filePath, data);
195
+ await fs$1.promises.mkdir(path$1.dirname(filePath), { recursive: true });
196
+ await fs$1.promises.writeFile(filePath, data);
197
197
  }
198
198
  async read({ location, relativePath }) {
199
199
  const filePath = safeResolve(getBasePath(location), relativePath);
200
- const buf = await fs.promises.readFile(filePath);
200
+ const buf = await fs$1.promises.readFile(filePath);
201
201
  const out = new Uint8Array(new ArrayBuffer(buf.byteLength));
202
202
  out.set(buf);
203
203
  return out;
@@ -205,7 +205,7 @@ var FilesystemStorageProvider = class FilesystemStorageProvider {
205
205
  async exists({ location, relativePath }) {
206
206
  const filePath = safeResolve(getBasePath(location), relativePath);
207
207
  try {
208
- await fs.promises.access(filePath);
208
+ await fs$1.promises.access(filePath);
209
209
  return true;
210
210
  } catch {
211
211
  return false;
@@ -215,25 +215,25 @@ var FilesystemStorageProvider = class FilesystemStorageProvider {
215
215
  const base = getBasePath(location);
216
216
  const dir = prefix ? safeResolve(base, prefix) : path$1.resolve(base);
217
217
  try {
218
- return (await fs.promises.readdir(dir, { withFileTypes: true })).map((e) => prefix ? `${prefix}/${e.name}` : e.name);
218
+ return (await fs$1.promises.readdir(dir, { withFileTypes: true })).map((e) => prefix ? `${prefix}/${e.name}` : e.name);
219
219
  } catch {
220
220
  return [];
221
221
  }
222
222
  }
223
223
  async delete({ location, relativePath }) {
224
224
  const filePath = safeResolve(getBasePath(location), relativePath);
225
- await fs.promises.rm(filePath, { force: true });
225
+ await fs$1.promises.rm(filePath, { force: true });
226
226
  }
227
227
  async getAvailableSpace({ location }) {
228
228
  const base = path$1.resolve(getBasePath(location));
229
229
  try {
230
230
  let target = base;
231
- while (!fs.existsSync(target)) {
231
+ while (!fs$1.existsSync(target)) {
232
232
  const parent = path$1.dirname(target);
233
233
  if (!parent || parent === target) return null;
234
234
  target = parent;
235
235
  }
236
- const stats = await fs.promises.statfs(target);
236
+ const stats = await fs$1.promises.statfs(target);
237
237
  return stats.bavail * stats.bsize;
238
238
  } catch {
239
239
  return null;
@@ -242,9 +242,9 @@ var FilesystemStorageProvider = class FilesystemStorageProvider {
242
242
  async beginUpload({ location, relativePath }) {
243
243
  const target = safeResolve(getBasePath(location), relativePath);
244
244
  const partial = `${target}.partial`;
245
- await fs.promises.mkdir(path$1.dirname(target), { recursive: true });
246
- await fs.promises.unlink(partial).catch(() => {});
247
- const stream = fs.createWriteStream(partial);
245
+ await fs$1.promises.mkdir(path$1.dirname(target), { recursive: true });
246
+ await fs$1.promises.unlink(partial).catch(() => {});
247
+ const stream = fs$1.createWriteStream(partial);
248
248
  const uploadId = randomUUID();
249
249
  const session = {
250
250
  stream,
@@ -285,7 +285,7 @@ var FilesystemStorageProvider = class FilesystemStorageProvider {
285
285
  session.stream.end(() => resolve());
286
286
  session.stream.on("error", reject);
287
287
  });
288
- await fs.promises.rename(session.partial, session.target);
288
+ await fs$1.promises.rename(session.partial, session.target);
289
289
  clearTimeout(session.timer);
290
290
  this.uploads.delete(uploadId);
291
291
  }
@@ -295,14 +295,14 @@ var FilesystemStorageProvider = class FilesystemStorageProvider {
295
295
  try {
296
296
  session.stream.destroy();
297
297
  } catch {}
298
- await fs.promises.unlink(session.partial).catch(() => {});
298
+ await fs$1.promises.unlink(session.partial).catch(() => {});
299
299
  clearTimeout(session.timer);
300
300
  this.uploads.delete(uploadId);
301
301
  }
302
302
  async beginDownload({ location, relativePath }) {
303
303
  const target = safeResolve(getBasePath(location), relativePath);
304
- const stat = await fs.promises.stat(target);
305
- const fd = await fs.promises.open(target, "r");
304
+ const stat = await fs$1.promises.stat(target);
305
+ const fd = await fs$1.promises.open(target, "r");
306
306
  const downloadId = randomUUID();
307
307
  const session = {
308
308
  fd,
@@ -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-DfSIOj24.js");
7
+ const require_wal_maintenance = require("../../wal-maintenance-CaJjuLHq.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-Duejh7Lx.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";
3
3
  import { SqliteSettingsAddon } from "./sqlite-settings.addon.mjs";
4
4
  //#region src/builtins/sqlite-storage/config-store.ts
5
5
  var ConfigStore = class {
@@ -43,17 +43,6 @@ export interface OwnedSqliteFile {
43
43
  readonly bytes: number | null;
44
44
  readonly declaredThisBoot: boolean;
45
45
  }[]>;
46
- readLegacyCollection(input: {
47
- readonly collection: string;
48
- readonly cursor?: string | undefined;
49
- readonly limit?: number | undefined;
50
- }): Promise<{
51
- readonly rows: readonly {
52
- readonly id: string;
53
- readonly data: Record<string, unknown>;
54
- }[];
55
- readonly nextCursor: string | null;
56
- }>;
57
46
  dropRetiredTable(name: string): Promise<DroppedRetiredTable | null>;
58
47
  /** Which thread serves this file: 0 is the engine's main thread. */
59
48
  servingThreadId(): Promise<number>;
@@ -117,17 +106,6 @@ declare abstract class OwnedFileBase implements OwnedSqliteFile {
117
106
  readonly bytes: number | null;
118
107
  readonly declaredThisBoot: boolean;
119
108
  }[]>;
120
- abstract readLegacyCollection(input: {
121
- readonly collection: string;
122
- readonly cursor?: string | undefined;
123
- readonly limit?: number | undefined;
124
- }): Promise<{
125
- readonly rows: readonly {
126
- readonly id: string;
127
- readonly data: Record<string, unknown>;
128
- }[];
129
- readonly nextCursor: string | null;
130
- }>;
131
109
  abstract dropRetiredTable(name: string): Promise<DroppedRetiredTable | null>;
132
110
  abstract servingThreadId(): Promise<number>;
133
111
  protected abstract stopConnection(): Promise<void>;
@@ -163,17 +141,6 @@ export declare class InlineOwnedFile extends OwnedFileBase {
163
141
  readonly bytes: number | null;
164
142
  readonly declaredThisBoot: boolean;
165
143
  }[]>;
166
- readLegacyCollection(input: {
167
- readonly collection: string;
168
- readonly cursor?: string | undefined;
169
- readonly limit?: number | undefined;
170
- }): Promise<{
171
- readonly rows: readonly {
172
- readonly id: string;
173
- readonly data: Record<string, unknown>;
174
- }[];
175
- readonly nextCursor: string | null;
176
- }>;
177
144
  dropRetiredTable(name: string): Promise<DroppedRetiredTable | null>;
178
145
  servingThreadId(): Promise<number>;
179
146
  protected stopMaintenance(): void;
@@ -196,17 +163,6 @@ export declare class WorkerOwnedFile extends OwnedFileBase {
196
163
  readonly bytes: number | null;
197
164
  readonly declaredThisBoot: boolean;
198
165
  }[]>;
199
- readLegacyCollection(input: {
200
- readonly collection: string;
201
- readonly cursor?: string | undefined;
202
- readonly limit?: number | undefined;
203
- }): Promise<{
204
- readonly rows: readonly {
205
- readonly id: string;
206
- readonly data: Record<string, unknown>;
207
- }[];
208
- readonly nextCursor: string | null;
209
- }>;
210
166
  dropRetiredTable(name: string): Promise<DroppedRetiredTable | null>;
211
167
  servingThreadId(): Promise<number>;
212
168
  protected stopMaintenance(): void;
@@ -9,8 +9,6 @@ export interface KindRow {
9
9
  readonly hash: string;
10
10
  readonly state: "declared" | "orphaned" | "dropped";
11
11
  readonly declaration: RecordKindDeclaration;
12
- /** When `adoptRecords` finished copying the legacy table into this kind; the boot guard reads it. */
13
- readonly adoptedAt: number | null;
14
12
  }
15
13
  /** The hash a declaration is known by; two spellings of the same declaration agree. */
16
14
  export declare function declarationHash(decl: RecordKindDeclaration): string;
@@ -22,27 +22,6 @@ export interface RecordsEngineOps extends OwnedOps {
22
22
  }): Promise<{
23
23
  readonly deleted: number;
24
24
  }>;
25
- /** Rows of a legacy table in THIS file; `null` when the table is not there. */
26
- legacyRowCount(input: {
27
- readonly table: string;
28
- }): Promise<number | null>;
29
- /** Has `adoptRecords` finished copying the legacy table into this kind? (the boot guard) */
30
- adoptionState(input: {
31
- readonly owner: string;
32
- readonly kind: string;
33
- }): Promise<{
34
- readonly adoptedAt: number | null;
35
- }>;
36
- /** Record that the copy is complete. Idempotent. */
37
- markAdopted(input: {
38
- readonly owner: string;
39
- readonly kind: string;
40
- }): Promise<void>;
41
- /** Undo a false `complete` when the legacy table still holds rows. */
42
- revokeAdopted(input: {
43
- readonly owner: string;
44
- readonly kind: string;
45
- }): Promise<void>;
46
25
  }
47
26
  export type RecordsOp = keyof RecordsEngineOps;
48
27
  export type RecordsInput<K extends RecordsOp> = Parameters<RecordsEngineOps[K]>[0];
@@ -29,8 +29,8 @@ export declare class RecordsEngine implements RecordsEngineOps {
29
29
  constructor(db: Database.Database, options: RecordsEngineOptions);
30
30
  /**
31
31
  * Boot correction: every kind that ever allocated an id has its counter raised
32
- * above the highest numeric id it holds. Adopted legacy rows (or any caller
33
- * chosen numeric id) kept ids far above a counter that started at 1, and the
32
+ * above the highest numeric id it holds. Rows the records migration copied
33
+ * (or any caller chosen numeric id) kept ids far above a counter that started at 1, and the
34
34
  * upsert would have overwritten another device's row on the first collision.
35
35
  * Runs on the engine's own connection, over the (kind_id, id) unique index.
36
36
  */
@@ -38,7 +38,7 @@ export declare class RecordsEngine implements RecordsEngineOps {
38
38
  /** Ids handed out by allocateId and not yet written: their first write is insert-only. */
39
39
  private readonly pendingAllocated;
40
40
  private static readonly PENDING_ALLOCATED_MAX;
41
- /** Raise a kind's counter above the numeric ids of a caller-supplied batch (adoption). */
41
+ /** Raise a kind's counter above the numeric ids of a caller-supplied batch. */
42
42
  private raiseSequenceFor;
43
43
  private schemaReady;
44
44
  private kindOf;
@@ -87,21 +87,4 @@ export declare class RecordsEngine implements RecordsEngineOps {
87
87
  private countRows;
88
88
  /** The declarations this file holds, for the router's placement map and the entries service. */
89
89
  declarations(): readonly KindRow[];
90
- legacyRowCount(input: {
91
- readonly table: string;
92
- }): Promise<number | null>;
93
- adoptionState(input: {
94
- readonly owner: string;
95
- readonly kind: string;
96
- }): Promise<{
97
- readonly adoptedAt: number | null;
98
- }>;
99
- markAdopted(input: {
100
- readonly owner: string;
101
- readonly kind: string;
102
- }): Promise<void>;
103
- revokeAdopted(input: {
104
- readonly owner: string;
105
- readonly kind: string;
106
- }): Promise<void>;
107
90
  }
@@ -23,14 +23,19 @@ export interface WherePlan {
23
23
  /** The index fields after the equality prefix: the order a `where` query returns in. */
24
24
  readonly orderFields: readonly string[];
25
25
  }
26
+ /** How `planWhere` may serve a filter. */
27
+ export interface WhereOptions {
28
+ readonly allowIn: boolean;
29
+ /** Fields the statement reads beyond the filter: an aggregate's value and group columns. */
30
+ readonly extraFields?: readonly string[];
31
+ /** The field the statement groups by: an index it leads is preferred. */
32
+ readonly groupBy?: string | undefined;
33
+ }
26
34
  /**
27
35
  * Find the declared index that serves `where` (plus any `extraFields` the
28
36
  * statement reads: an aggregate's value and group columns), or throw.
29
37
  */
30
- export declare function planWhere(kind: string, decl: RecordKindDeclaration, where: RecordWhere | undefined, opts: {
31
- readonly allowIn: boolean;
32
- readonly extraFields?: readonly string[];
33
- }): WherePlan | null;
38
+ export declare function planWhere(kind: string, decl: RecordKindDeclaration, where: RecordWhere | undefined, opts: WhereOptions): WherePlan | null;
34
39
  /** The built-in filters shared by every statement. */
35
40
  export interface WindowFilter {
36
41
  readonly deviceId?: number | undefined;
@@ -9,17 +9,15 @@
9
9
  * rebuilt from each open file's own `_record_kinds` at boot and updated on
10
10
  * declaration. A kind declared for another file than the one it lives in is
11
11
  * refused (the engine never moves data, D853).
12
- * - **The boot guard**: after a declaration, a kind with `adoptsFrom` that is
13
- * EMPTY while its legacy table still holds rows is reported `adoptionPending`;
14
- * `ctx.records.declare` turns that into a refusal to start.
12
+ * - **No adoption** (D900): the records migration is closed. A declaration
13
+ * reads no legacy table, and a retired `adoptsFrom` an older addon still
14
+ * sends is dropped before the catalog stores the declaration.
15
15
  */
16
16
  import { type IRecordsProvider, type IScopedLogger, type IStorageAdminProvider, type StorageKind } from "@camstack/types";
17
17
  import type { PlacementRouter } from "../placement-router.js";
18
18
  /** The caller the transport stamped, or a refusal. */
19
19
  export declare function recordsCallerOf(input: unknown): string;
20
- type AdminRecords = Pick<IStorageAdminProvider, "listKinds" | "readRecords" | "adoptRecords"> & {
21
- isAdoptedLegacyTable(collection: string): Promise<boolean>;
22
- };
20
+ type AdminRecords = Pick<IStorageAdminProvider, "listKinds" | "readRecords">;
23
21
  export declare class RecordsProvider implements IRecordsProvider, AdminRecords {
24
22
  private readonly router;
25
23
  private readonly logger;
@@ -30,20 +28,11 @@ export declare class RecordsProvider implements IRecordsProvider, AdminRecords {
30
28
  private fileOf;
31
29
  declareKinds(input: Parameters<IRecordsProvider["declareKinds"]>[0]): ReturnType<IRecordsProvider["declareKinds"]>;
32
30
  /**
33
- * Rows of a legacy table in EVERY open records-capable file. A legacy table lives
34
- * in one file, but which one is the layout's business: the phase-3 NC ledgers moved
35
- * to `events.db` with the P5 split, and a guard that asked `camstack.db` alone
36
- * answered "no legacy rows" for 522 outbox rows (2026-10-20 audit).
37
- */
38
- private legacyRowsAnywhere;
39
- /**
40
31
  * `transactFamily` (plan risk 8): kinds that must agree through one `transact` sit
41
32
  * in ONE file. A family split across files is refused whole, whether the split is
42
33
  * inside this declaration or against a kind of the same owner declared before.
43
34
  */
44
35
  private assertFamiliesInOneFile;
45
- /** The boot guard: empty kind + a legacy table that still has rows = adoption pending. */
46
- private withAdoption;
47
36
  get(input: Parameters<IRecordsProvider["get"]>[0]): ReturnType<IRecordsProvider["get"]>;
48
37
  getMany(input: Parameters<IRecordsProvider["getMany"]>[0]): ReturnType<IRecordsProvider["getMany"]>;
49
38
  secretRefs(input: Parameters<IRecordsProvider["secretRefs"]>[0]): ReturnType<IRecordsProvider["secretRefs"]>;
@@ -67,9 +56,6 @@ export declare class RecordsProvider implements IRecordsProvider, AdminRecords {
67
56
  kinds: StorageKind[];
68
57
  }>;
69
58
  readRecords(input: Parameters<IStorageAdminProvider["readRecords"]>[0]): ReturnType<IStorageAdminProvider["readRecords"]>;
70
- /** True when a declared kind lists `collection` as `adoptsFrom` and adoption finished. */
71
- isAdoptedLegacyTable(collection: string): Promise<boolean>;
72
- adoptRecords(input: Parameters<IStorageAdminProvider["adoptRecords"]>[0]): ReturnType<IStorageAdminProvider["adoptRecords"]>;
73
59
  /** Housekeeping: delete rows past `expires_at` in every file that hosts kinds. */
74
60
  sweepExpired(): Promise<number>;
75
61
  }
@@ -17,7 +17,7 @@ export declare const RECORD_KINDS_TABLE = "_record_kinds";
17
17
  */
18
18
  export declare const RECORD_SEQUENCES_TABLE = "_record_sequences";
19
19
  /** The statements that create the shared tables. Idempotent. */
20
- export declare const RECORDS_SCHEMA_SQL = "\nCREATE TABLE IF NOT EXISTS records (\n rid INTEGER PRIMARY KEY,\n kind_id INTEGER NOT NULL,\n id TEXT NOT NULL,\n device_id INTEGER,\n at INTEGER,\n expires_at INTEGER,\n rev INTEGER NOT NULL DEFAULT 1,\n updated_at INTEGER NOT NULL,\n data BLOB NOT NULL,\n UNIQUE (kind_id, id)\n);\nCREATE INDEX IF NOT EXISTS records_kind_device_at ON records(kind_id, device_id, at);\nCREATE INDEX IF NOT EXISTS records_kind_at ON records(kind_id, at);\nCREATE INDEX IF NOT EXISTS records_expires ON records(expires_at) WHERE expires_at IS NOT NULL;\nCREATE TABLE IF NOT EXISTS _record_kinds (\n kind_id INTEGER PRIMARY KEY AUTOINCREMENT,\n owner TEXT NOT NULL,\n kind TEXT NOT NULL,\n database TEXT NOT NULL,\n manifest_hash TEXT NOT NULL,\n declaration TEXT NOT NULL,\n state TEXT NOT NULL,\n orphaned_at INTEGER,\n adopted_at INTEGER,\n UNIQUE (owner, kind)\n);\nCREATE TABLE IF NOT EXISTS _record_sequences (\n kind_id INTEGER PRIMARY KEY,\n next INTEGER NOT NULL\n);\n";
20
+ export declare const RECORDS_SCHEMA_SQL = "\nCREATE TABLE IF NOT EXISTS records (\n rid INTEGER PRIMARY KEY,\n kind_id INTEGER NOT NULL,\n id TEXT NOT NULL,\n device_id INTEGER,\n at INTEGER,\n expires_at INTEGER,\n rev INTEGER NOT NULL DEFAULT 1,\n updated_at INTEGER NOT NULL,\n data BLOB NOT NULL,\n UNIQUE (kind_id, id)\n);\nCREATE INDEX IF NOT EXISTS records_kind_device_at ON records(kind_id, device_id, at);\nCREATE INDEX IF NOT EXISTS records_kind_at ON records(kind_id, at);\nCREATE INDEX IF NOT EXISTS records_expires ON records(expires_at) WHERE expires_at IS NOT NULL;\nCREATE TABLE IF NOT EXISTS _record_kinds (\n kind_id INTEGER PRIMARY KEY AUTOINCREMENT,\n owner TEXT NOT NULL,\n kind TEXT NOT NULL,\n database TEXT NOT NULL,\n manifest_hash TEXT NOT NULL,\n declaration TEXT NOT NULL,\n state TEXT NOT NULL,\n orphaned_at INTEGER,\n -- RETIRED (D900): the records-migration boot guard's flag. Nothing reads it;\n -- the column stays so an older build can still open a file this one created.\n adopted_at INTEGER,\n UNIQUE (owner, kind)\n);\nCREATE TABLE IF NOT EXISTS _record_sequences (\n kind_id INTEGER PRIMARY KEY,\n next INTEGER NOT NULL\n);\n";
21
21
  /** The tables the records engine owns: never droppable through `dropCollection`. */
22
22
  export declare const RECORDS_ENGINE_TABLES: readonly string[];
23
23
  /** The built-in indexes. */
@@ -437,23 +437,6 @@ export declare class SqliteSettingsBackend implements ISettingsBackend {
437
437
  bytes: number | null;
438
438
  declaredThisBoot: boolean;
439
439
  }[];
440
- /** Storage-admin only: adopted legacy may still be in `declaredThisBoot` from vestigial declares. */
441
- forgetDeclaredThisBoot(name: string): void;
442
- /**
443
- * Paginated `(id, data)` read of a physical table. Does not consult
444
- * `declareCollection` — for migration scripts only.
445
- */
446
- readLegacyCollection(input: {
447
- readonly collection: string;
448
- readonly cursor?: string | undefined;
449
- readonly limit?: number | undefined;
450
- }): {
451
- rows: {
452
- id: string;
453
- data: Record<string, unknown>;
454
- }[];
455
- nextCursor: string | null;
456
- };
457
440
  /**
458
441
  * Drop one table nobody owns (D870 migration, one-shot). Refuses a canonical
459
442
  * or engine table, one a running addon declared since boot, a table that is