@camstack/system 1.2.461 → 1.2.463
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.
- package/dist/addon-runner.js +21 -276
- package/dist/addon-runner.mjs +21 -276
- package/dist/{agent-https-Iw3RSQup.mjs → agent-https-B9gbXoJI.mjs} +1 -1
- package/dist/{agent-https-Dnr_nIVx.js → agent-https-DhFIbEwN.js} +1 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/dist/builtins/alerts/alerts.addon.js +1 -1
- package/dist/builtins/alerts/alerts.addon.mjs +1 -1
- package/dist/builtins/autotrack/index.js +1 -1
- package/dist/builtins/autotrack/index.mjs +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.d.ts +1 -3
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +51 -502
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +51 -502
- package/dist/builtins/backup-orchestrator/destination-policy.d.ts +5 -21
- package/dist/builtins/backup-orchestrator/record-kinds.d.ts +0 -2
- package/dist/builtins/backup-orchestrator/schedule-store.d.ts +5 -13
- package/dist/builtins/backup-orchestrator/seed-marker-store.d.ts +9 -19
- package/dist/builtins/calendars/calendars.addon.js +1 -1
- package/dist/builtins/calendars/calendars.addon.mjs +1 -1
- package/dist/builtins/camera-grid/index.js +1 -1
- package/dist/builtins/camera-grid/index.mjs +1 -1
- package/dist/builtins/cluster-agent/record-kinds.d.ts +0 -1
- package/dist/builtins/composer/composer.addon.js +2 -2
- package/dist/builtins/composer/composer.addon.mjs +2 -2
- package/dist/builtins/console-logging/index.js +1 -1
- package/dist/builtins/console-logging/index.mjs +1 -1
- package/dist/builtins/core-blocks/core-blocks.addon.js +2 -2
- package/dist/builtins/core-blocks/core-blocks.addon.mjs +2 -2
- package/dist/builtins/device-history/device-history.addon.js +1 -1
- package/dist/builtins/device-history/device-history.addon.mjs +1 -1
- package/dist/builtins/device-manager/device-manager.addon.js +2 -2
- package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
- package/dist/builtins/hub-forwarder/index.js +1 -1
- package/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/dist/builtins/keychain/index.js +3 -3
- package/dist/builtins/keychain/index.mjs +3 -3
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/dist/builtins/local-auth/auth-schema.d.ts +2 -12
- package/dist/builtins/local-auth/local-auth.addon.js +52 -191
- package/dist/builtins/local-auth/local-auth.addon.mjs +52 -191
- package/dist/builtins/local-auth/oauth-session-manager.d.ts +13 -4
- package/dist/builtins/local-auth/record-kinds.d.ts +1 -1
- package/dist/builtins/local-network/local-network.addon.js +2 -2
- package/dist/builtins/local-network/local-network.addon.mjs +2 -2
- package/dist/builtins/loki-logging/index.js +1 -1
- package/dist/builtins/loki-logging/index.mjs +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/dist/builtins/platform-probe/index.js +1 -1
- package/dist/builtins/platform-probe/index.mjs +1 -1
- package/dist/builtins/record-entries/index.js +1 -1
- package/dist/builtins/record-entries/index.mjs +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/dist/builtins/snapshot/index.js +1 -1
- package/dist/builtins/snapshot/index.mjs +1 -1
- package/dist/builtins/sqlite-storage/file-host-protocol.d.ts +0 -9
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/dist/builtins/sqlite-storage/index.js +1 -1
- package/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/dist/builtins/sqlite-storage/owned-sqlite-file.d.ts +0 -8
- package/dist/builtins/sqlite-storage/records/records-sql.d.ts +0 -2
- package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +0 -28
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.d.ts +1 -2
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +6 -170
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +6 -170
- package/dist/builtins/sqlite-storage/storage-admin-provider.d.ts +3 -17
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- package/dist/builtins/system-config/system-config.addon.js +3 -3
- package/dist/builtins/system-config/system-config.addon.mjs +3 -3
- package/dist/builtins/winston-logging/index.js +1 -1
- package/dist/builtins/winston-logging/index.mjs +1 -1
- package/dist/{composition-sources-DNRZWR1j.mjs → composition-sources-CGtooHSL.mjs} +1 -1
- package/dist/{composition-sources-b0e_2I-D.js → composition-sources-oXvmbMHX.js} +1 -1
- package/dist/{constants-6OeJiZgi.js → constants-5mrGZxwS.js} +1 -1
- package/dist/{constants-BnkOdj9Q.mjs → constants-CdutnpL9.mjs} +1 -1
- package/dist/{device-ca-CPTDs--d.js → device-ca-B3xUzps7.js} +1 -1
- package/dist/{device-ca-Bnkw8GyU.mjs → device-ca-DZHKlZlD.mjs} +1 -1
- package/dist/{dist-Wy8cTxg6.mjs → dist-C2OBCa-A.mjs} +40 -80
- package/dist/{dist-Bn-RNanh.js → dist-D9aw_d0G.js} +39 -91
- package/dist/file-host-worker.js +1 -1
- package/dist/file-host-worker.mjs +1 -1
- package/dist/{hub-mdns-ciao-CJu0nhla.mjs → hub-mdns-ciao-Bm09NrMS.mjs} +2 -2
- package/dist/{hub-mdns-ciao-CTBTlia4.js → hub-mdns-ciao-CFlhVKK6.js} +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +88 -240
- package/dist/index.mjs +89 -236
- package/dist/kernel/index.d.ts +0 -1
- package/dist/kernel/moleculer/runner-addon-settings.d.ts +1 -6
- package/dist/kernel/moleculer/runner-device-settings.d.ts +2 -2
- package/dist/{restore-archive-DM1OBYq4.js → restore-archive-6zkRREHO.js} +1 -1
- package/dist/{restore-archive-CM23Pq9B.mjs → restore-archive-CSOR_tyN.mjs} +1 -1
- package/dist/{retired-settings-keys-D_VwZiDt.js → retired-settings-keys-CGUqX-Oz.js} +0 -6
- package/dist/{retired-settings-keys-Bhwe4ymb.mjs → retired-settings-keys-C_Kjp-Bj.mjs} +1 -1
- package/dist/{wal-maintenance-Bj_MmDkr.mjs → wal-maintenance-Dg6IzSgz.mjs} +0 -0
- package/dist/{wal-maintenance-CaJjuLHq.js → wal-maintenance-jXcOxm2T.js} +0 -0
- package/package.json +1 -1
- package/dist/builtins/sqlite-storage/retired-collections.d.ts +0 -146
- package/dist/kernel/legacy-blob-guard.d.ts +0 -63
|
@@ -19,10 +19,6 @@ import type { DataStoreInput, DataStoreOp, DataStoreOutput, OwnedSqliteFileSpec,
|
|
|
19
19
|
import { SqliteSettingsBackend } from "./sqlite-settings-backend.js";
|
|
20
20
|
import type { SqliteVecVectorIndex } from "./vector-index-vec.js";
|
|
21
21
|
export type { OwnedSqliteFileSpec } from "./file-host-protocol.js";
|
|
22
|
-
/** A table a retired-collection purge dropped, and the rows that went with it. */
|
|
23
|
-
export interface DroppedRetiredTable {
|
|
24
|
-
readonly rows: number;
|
|
25
|
-
}
|
|
26
22
|
export interface OwnedSqliteFile {
|
|
27
23
|
readonly databaseId: DataStoreDatabase;
|
|
28
24
|
readonly livePath: string;
|
|
@@ -43,7 +39,6 @@ export interface OwnedSqliteFile {
|
|
|
43
39
|
readonly bytes: number | null;
|
|
44
40
|
readonly declaredThisBoot: boolean;
|
|
45
41
|
}[]>;
|
|
46
|
-
dropRetiredTable(name: string): Promise<DroppedRetiredTable | null>;
|
|
47
42
|
/** Which thread serves this file: 0 is the engine's main thread. */
|
|
48
43
|
servingThreadId(): Promise<number>;
|
|
49
44
|
/** The owner's verified copy of this file (D693). */
|
|
@@ -106,7 +101,6 @@ declare abstract class OwnedFileBase implements OwnedSqliteFile {
|
|
|
106
101
|
readonly bytes: number | null;
|
|
107
102
|
readonly declaredThisBoot: boolean;
|
|
108
103
|
}[]>;
|
|
109
|
-
abstract dropRetiredTable(name: string): Promise<DroppedRetiredTable | null>;
|
|
110
104
|
abstract servingThreadId(): Promise<number>;
|
|
111
105
|
protected abstract stopConnection(): Promise<void>;
|
|
112
106
|
protected abstract stopMaintenance(): void;
|
|
@@ -141,7 +135,6 @@ export declare class InlineOwnedFile extends OwnedFileBase {
|
|
|
141
135
|
readonly bytes: number | null;
|
|
142
136
|
readonly declaredThisBoot: boolean;
|
|
143
137
|
}[]>;
|
|
144
|
-
dropRetiredTable(name: string): Promise<DroppedRetiredTable | null>;
|
|
145
138
|
servingThreadId(): Promise<number>;
|
|
146
139
|
protected stopMaintenance(): void;
|
|
147
140
|
protected stopConnection(): Promise<void>;
|
|
@@ -163,7 +156,6 @@ export declare class WorkerOwnedFile extends OwnedFileBase {
|
|
|
163
156
|
readonly bytes: number | null;
|
|
164
157
|
readonly declaredThisBoot: boolean;
|
|
165
158
|
}[]>;
|
|
166
|
-
dropRetiredTable(name: string): Promise<DroppedRetiredTable | null>;
|
|
167
159
|
servingThreadId(): Promise<number>;
|
|
168
160
|
protected stopMaintenance(): void;
|
|
169
161
|
protected stopConnection(): Promise<void>;
|
|
@@ -18,8 +18,6 @@ export declare const RECORD_KINDS_TABLE = "_record_kinds";
|
|
|
18
18
|
export declare const RECORD_SEQUENCES_TABLE = "_record_sequences";
|
|
19
19
|
/** The statements that create the shared tables. Idempotent. */
|
|
20
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
|
-
/** The tables the records engine owns: never droppable through `dropCollection`. */
|
|
22
|
-
export declare const RECORDS_ENGINE_TABLES: readonly string[];
|
|
23
21
|
/** The built-in indexes. */
|
|
24
22
|
export declare const INDEX_KIND_DEVICE_AT = "records_kind_device_at";
|
|
25
23
|
export declare const INDEX_KIND_AT = "records_kind_at";
|
|
@@ -91,11 +91,6 @@ interface SettingsUpdateWhereInput {
|
|
|
91
91
|
interface SettingsUpdateWhereResult {
|
|
92
92
|
readonly updated: number;
|
|
93
93
|
}
|
|
94
|
-
/** What {@link SqliteSettingsBackend.dropRetiredTable} destroyed. */
|
|
95
|
-
export interface DroppedTable {
|
|
96
|
-
/** Rows the table held at the moment it was dropped. */
|
|
97
|
-
readonly rows: number;
|
|
98
|
-
}
|
|
99
94
|
/**
|
|
100
95
|
* The addon that owns a scoped row, lifted out of the filter that names it.
|
|
101
96
|
*
|
|
@@ -438,12 +433,6 @@ export declare class SqliteSettingsBackend implements ISettingsBackend {
|
|
|
438
433
|
declaredThisBoot: boolean;
|
|
439
434
|
}[];
|
|
440
435
|
/**
|
|
441
|
-
* Drop one table nobody owns (D870 migration, one-shot). Refuses a canonical
|
|
442
|
-
* or engine table, one a running addon declared since boot, a table that is
|
|
443
|
-
* not there, and a row count other than the one the caller stated.
|
|
444
|
-
*/
|
|
445
|
-
dropTable(name: string, expectRows: number): number;
|
|
446
|
-
/**
|
|
447
436
|
* The tables this file's own `_collection_declarations` names — the
|
|
448
437
|
* placement authority (D851). Read from DISK, not from memory, so a table
|
|
449
438
|
* created and declared by an earlier life of the process still counts.
|
|
@@ -584,23 +573,6 @@ export declare class SqliteSettingsBackend implements ISettingsBackend {
|
|
|
584
573
|
/** Serialise per-column values for SQL binding: objects → JSON, booleans → 0/1. */
|
|
585
574
|
private serializeColumnValue;
|
|
586
575
|
private ensureTable;
|
|
587
|
-
/**
|
|
588
|
-
* Drop a table nothing declares any more, reporting what went with it.
|
|
589
|
-
*
|
|
590
|
-
* The DDL lives here because the engine owns the handle AND the two memos
|
|
591
|
-
* that outlive a table: `structuredTables` (schema fingerprint) and
|
|
592
|
-
* `declaredCollections` (the column set `compileFilter` resolves against).
|
|
593
|
-
* Dropping behind their backs would leave a ghost — a later declaration of
|
|
594
|
-
* the same name would be memoised as "already materialised" against a table
|
|
595
|
-
* that no longer exists.
|
|
596
|
-
*
|
|
597
|
-
* WHICH tables are retired, and the logging, are policy: they live in
|
|
598
|
-
* `retired-collections.ts`. This method knows only how to drop one.
|
|
599
|
-
*
|
|
600
|
-
* Answers `null` when the table is not there — the steady state after the
|
|
601
|
-
* first boot that ran the purge, and the case on a fresh install.
|
|
602
|
-
*/
|
|
603
|
-
dropRetiredTable(table: string): DroppedTable | null;
|
|
604
576
|
/** Returns SQLite's `lastInsertRowid` — the only place an auto-assigned key
|
|
605
577
|
* is knowable (D473). */
|
|
606
578
|
private tableInsert;
|
|
@@ -46,8 +46,7 @@ export declare class SqliteSettingsAddon extends BaseAddon {
|
|
|
46
46
|
protected onInitialize(): Promise<ProviderRegistration[]>;
|
|
47
47
|
/**
|
|
48
48
|
* Housekeeping that must happen BEFORE anything can read a file: the
|
|
49
|
-
* retired-key purge (settings only)
|
|
50
|
-
* open file).
|
|
49
|
+
* retired-key purge (settings file only).
|
|
51
50
|
*/
|
|
52
51
|
private purgeBeforeServing;
|
|
53
52
|
/**
|
|
@@ -3,9 +3,9 @@ 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-
|
|
7
|
-
const require_retired_settings_keys = require("../../retired-settings-keys-
|
|
8
|
-
const require_wal_maintenance = require("../../wal-maintenance-
|
|
6
|
+
const require_dist = require("../../dist-D9aw_d0G.js");
|
|
7
|
+
const require_retired_settings_keys = require("../../retired-settings-keys-CGUqX-Oz.js");
|
|
8
|
+
const require_wal_maintenance = require("../../wal-maintenance-jXcOxm2T.js");
|
|
9
9
|
const require_sqlite_snapshot_protocol = require("../../sqlite-snapshot-protocol-B9OndqZv.js");
|
|
10
10
|
const require_wal_checkpoint_policy = require("../../wal-checkpoint-policy-d2z2qPqx.js");
|
|
11
11
|
let node_fs_promises = require("node:fs/promises");
|
|
@@ -937,9 +937,6 @@ var InlineOwnedFile = class extends OwnedFileBase {
|
|
|
937
937
|
listPhysicalTables(ownerPrefix) {
|
|
938
938
|
return Promise.resolve(require_wal_maintenance.callControl(require_wal_maintenance.controlTargetOf(this.backend, 0), "listPhysicalTables", { ownerPrefix }));
|
|
939
939
|
}
|
|
940
|
-
async dropRetiredTable(name) {
|
|
941
|
-
return require_wal_maintenance.callControl(require_wal_maintenance.controlTargetOf(this.backend, 0), "dropRetiredTable", { name });
|
|
942
|
-
}
|
|
943
940
|
async servingThreadId() {
|
|
944
941
|
return 0;
|
|
945
942
|
}
|
|
@@ -994,9 +991,6 @@ var WorkerOwnedFile = class extends OwnedFileBase {
|
|
|
994
991
|
listPhysicalTables(ownerPrefix) {
|
|
995
992
|
return this.client.control("listPhysicalTables", { ownerPrefix });
|
|
996
993
|
}
|
|
997
|
-
dropRetiredTable(name) {
|
|
998
|
-
return this.client.control("dropRetiredTable", { name });
|
|
999
|
-
}
|
|
1000
994
|
servingThreadId() {
|
|
1001
995
|
return this.client.control("threadId", {});
|
|
1002
996
|
}
|
|
@@ -1504,25 +1498,14 @@ var RecordsProvider = class {
|
|
|
1504
1498
|
};
|
|
1505
1499
|
//#endregion
|
|
1506
1500
|
//#region src/builtins/sqlite-storage/storage-admin-provider.ts
|
|
1507
|
-
/**
|
|
1508
|
-
* The `storage-admin` provider of the SQLite engine (D870): the operator's
|
|
1509
|
-
* maintenance reach into the settings database - list its tables and record
|
|
1510
|
-
* kinds, read a kind for diagnosis, drop a table that nothing owns any more.
|
|
1511
|
-
* Every call is logged with its table and counts.
|
|
1512
|
-
*
|
|
1513
|
-
* `dropCollection` is a one-shot of the D870 migration: remove it, and the
|
|
1514
|
-
* capability's method, once the last hub ran `migrate-device-store.ts --drop`.
|
|
1515
|
-
*/
|
|
1516
1501
|
var StorageAdminProvider = class {
|
|
1517
1502
|
backend;
|
|
1518
1503
|
logger;
|
|
1519
|
-
installedOwners;
|
|
1520
1504
|
records;
|
|
1521
1505
|
peerFiles;
|
|
1522
|
-
constructor(backend, logger,
|
|
1506
|
+
constructor(backend, logger, records, peerFiles = async () => []) {
|
|
1523
1507
|
this.backend = backend;
|
|
1524
1508
|
this.logger = logger;
|
|
1525
|
-
this.installedOwners = installedOwners;
|
|
1526
1509
|
this.records = records;
|
|
1527
1510
|
this.peerFiles = peerFiles;
|
|
1528
1511
|
}
|
|
@@ -1532,19 +1515,6 @@ var StorageAdminProvider = class {
|
|
|
1532
1515
|
readRecords(input) {
|
|
1533
1516
|
return this.records.readRecords(input);
|
|
1534
1517
|
}
|
|
1535
|
-
/** May this table be dropped AT ALL? Throws with the reason when not. */
|
|
1536
|
-
async assertDroppable(collection) {
|
|
1537
|
-
const colon = collection.indexOf(":");
|
|
1538
|
-
const base = colon > 0 ? collection.slice(colon + 1) : "";
|
|
1539
|
-
if (colon > 0 && require_dist.STORAGE_ADMIN_SCOPED_BASES.includes(base)) return;
|
|
1540
|
-
if (require_dist.STORAGE_ADMIN_MOVED_COLLECTIONS.includes(collection)) return;
|
|
1541
|
-
if (colon <= 0) throw new Error(`drop refused: "${collection}" is not a scoped table`);
|
|
1542
|
-
const installed = await this.installedOwners().catch((err) => {
|
|
1543
|
-
throw new Error(`drop refused: the installed addons could not be read (${err instanceof Error ? err.message : String(err)})`);
|
|
1544
|
-
});
|
|
1545
|
-
const owner = collection.slice(0, colon);
|
|
1546
|
-
if (installed.has(owner)) throw new Error(`drop refused: "${collection}" belongs to the installed addon "${owner}"`);
|
|
1547
|
-
}
|
|
1548
1518
|
async listTables(input) {
|
|
1549
1519
|
const tables = [...this.backend.listTables(input.ownerPrefix)];
|
|
1550
1520
|
for (const file of await this.peerFiles()) tables.push(...await file.listPhysicalTables(input.ownerPrefix));
|
|
@@ -1555,140 +1525,8 @@ var StorageAdminProvider = class {
|
|
|
1555
1525
|
} });
|
|
1556
1526
|
return { tables };
|
|
1557
1527
|
}
|
|
1558
|
-
async dropCollection(input) {
|
|
1559
|
-
try {
|
|
1560
|
-
await this.assertDroppable(input.collection);
|
|
1561
|
-
const rows = this.backend.dropTable(input.collection, input.expectRows);
|
|
1562
|
-
this.logger.warn("storage-admin: DROPPED a table", { meta: {
|
|
1563
|
-
collection: input.collection,
|
|
1564
|
-
rows
|
|
1565
|
-
} });
|
|
1566
|
-
return {
|
|
1567
|
-
dropped: true,
|
|
1568
|
-
rows
|
|
1569
|
-
};
|
|
1570
|
-
} catch (err) {
|
|
1571
|
-
this.logger.warn("storage-admin: drop refused", { meta: {
|
|
1572
|
-
collection: input.collection,
|
|
1573
|
-
expectRows: input.expectRows,
|
|
1574
|
-
error: err instanceof Error ? err.message : String(err)
|
|
1575
|
-
} });
|
|
1576
|
-
throw err;
|
|
1577
|
-
}
|
|
1578
|
-
}
|
|
1579
1528
|
};
|
|
1580
1529
|
//#endregion
|
|
1581
|
-
//#region src/builtins/sqlite-storage/retired-collections.ts
|
|
1582
|
-
/**
|
|
1583
|
-
* The dead tables.
|
|
1584
|
-
*
|
|
1585
|
-
* `devices` / `device_settings_kv` — the device half of the
|
|
1586
|
-
* integration-registry ([D183](../../../../../docs/decisions/adr-0183.md)).
|
|
1587
|
-
* The registry's INTEGRATION half is live (`integrations`,
|
|
1588
|
-
* `integration_settings`); its device half never had a production caller and
|
|
1589
|
-
* never had a row. The fleet lives in `device-manager:devices`, under numeric
|
|
1590
|
-
* ids, while these tables key on `dev_NNNN` — the two id-spaces could not be
|
|
1591
|
-
* reconciled even if something had wanted to.
|
|
1592
|
-
*
|
|
1593
|
-
* `pipeline-analytics:track-groups` / `:track-group-members` — the co-moving
|
|
1594
|
-
* GROUP entity. It shipped on 2026-08-24 and was kill-switched the same day
|
|
1595
|
-
* (duplicate sealed rows made Library → Gruppi unusable); the operator decided
|
|
1596
|
-
* on 2026-09-01 to delete it rather than re-open it. The clusterer, the live
|
|
1597
|
-
* buffer, the sealer, the query, the two cap methods and the two custom
|
|
1598
|
-
* actions are gone, so nothing declares these tables any more. The group-owned
|
|
1599
|
-
* MEDIA rows are NOT here — they live in the shared `pipeline-analytics:media`
|
|
1600
|
-
* and are collected by the orphan audit through `RETIRED_OWNER_KINDS`.
|
|
1601
|
-
*
|
|
1602
|
-
* `pipeline-analytics:summaries` / `:summary-members` — the session SUMMARY,
|
|
1603
|
-
* the entity that grouped tracks by proximity at birth (D489) and split them
|
|
1604
|
-
* when they walked apart (D490). Its production path was switched off on
|
|
1605
|
-
* 2026-09-16 and the operator decided on 2026-09-29 to delete it (D680): the
|
|
1606
|
-
* sealer, the store, the group shot, the three cap methods and the digest's
|
|
1607
|
-
* `groups` reading are gone, so nothing declares these tables. The group
|
|
1608
|
-
* shots were `summary`-owned rows in `pipeline-analytics:media` and go the
|
|
1609
|
-
* same way as the group entity's — through `RETIRED_OWNER_KINDS`.
|
|
1610
|
-
*/
|
|
1611
|
-
var RETIRED_COLLECTIONS = [
|
|
1612
|
-
{
|
|
1613
|
-
collection: "devices",
|
|
1614
|
-
owner: "integration-registry",
|
|
1615
|
-
reason: "the device half of the integration-registry is deleted; the fleet is `device-manager:devices` and always was (0 rows here against 974 live devices)"
|
|
1616
|
-
},
|
|
1617
|
-
{
|
|
1618
|
-
collection: "device_settings_kv",
|
|
1619
|
-
owner: "integration-registry",
|
|
1620
|
-
reason: "per-device settings of a device table that never had a row; the live per-camera store is the device-manager row plus `addon-device-settings`"
|
|
1621
|
-
},
|
|
1622
|
-
{
|
|
1623
|
-
collection: "pipeline-analytics:track-groups",
|
|
1624
|
-
owner: "pipeline-analytics",
|
|
1625
|
-
reason: "the co-moving group entity is deleted (operator decision 2026-09-01, after the 2026-08-24 kill switch); nothing declares, writes or reads it"
|
|
1626
|
-
},
|
|
1627
|
-
{
|
|
1628
|
-
collection: "pipeline-analytics:track-group-members",
|
|
1629
|
-
owner: "pipeline-analytics",
|
|
1630
|
-
reason: "membership rows of the deleted group entity; the track cascade that used to carry them away no longer has a group leg"
|
|
1631
|
-
},
|
|
1632
|
-
{
|
|
1633
|
-
collection: "pipeline-analytics:summaries",
|
|
1634
|
-
owner: "pipeline-analytics",
|
|
1635
|
-
reason: "the session summary (proximity track grouping, D489/D490) is deleted (operator decision 2026-09-29, D680, after the 2026-09-16 switch-off); nothing declares, writes or reads it"
|
|
1636
|
-
},
|
|
1637
|
-
{
|
|
1638
|
-
collection: "pipeline-analytics:summary-members",
|
|
1639
|
-
owner: "pipeline-analytics",
|
|
1640
|
-
reason: "membership rows of the deleted session summary; the track cascade no longer has a summary leg (D680)"
|
|
1641
|
-
}
|
|
1642
|
-
];
|
|
1643
|
-
/**
|
|
1644
|
-
* The same adapter over an {@link OwnedSqliteFile} — the purge runs against
|
|
1645
|
-
* EVERY open database file (D851), and a file served by a worker answers the
|
|
1646
|
-
* drop through its thread.
|
|
1647
|
-
*/
|
|
1648
|
-
function retiredCollectionStoreOfFile(file) {
|
|
1649
|
-
return { async drop(collection) {
|
|
1650
|
-
return file.dropRetiredTable(collection);
|
|
1651
|
-
} };
|
|
1652
|
-
}
|
|
1653
|
-
/**
|
|
1654
|
-
* Drop every retired table that is still present. Returns one entry per table
|
|
1655
|
-
* actually dropped — empty when the schema is already clean, which is the
|
|
1656
|
-
* steady state after the first boot that ran it.
|
|
1657
|
-
*/
|
|
1658
|
-
async function purgeRetiredCollections(store, logger, specs = RETIRED_COLLECTIONS) {
|
|
1659
|
-
const results = [];
|
|
1660
|
-
for (const spec of specs) {
|
|
1661
|
-
let dropped;
|
|
1662
|
-
try {
|
|
1663
|
-
dropped = await store.drop(spec.collection);
|
|
1664
|
-
} catch (err) {
|
|
1665
|
-
logger.warn("retired collection — drop failed, table left in place", { meta: {
|
|
1666
|
-
addon: spec.owner,
|
|
1667
|
-
collection: spec.collection,
|
|
1668
|
-
error: err instanceof Error ? err.message : String(err)
|
|
1669
|
-
} });
|
|
1670
|
-
continue;
|
|
1671
|
-
}
|
|
1672
|
-
if (dropped === null) continue;
|
|
1673
|
-
const result = {
|
|
1674
|
-
collection: spec.collection,
|
|
1675
|
-
owner: spec.owner,
|
|
1676
|
-
rows: dropped.rows
|
|
1677
|
-
};
|
|
1678
|
-
results.push(result);
|
|
1679
|
-
const line = "dropped a retired collection";
|
|
1680
|
-
if (dropped.rows > 0) logger.warn(`${line} — it still held rows`, { meta: {
|
|
1681
|
-
...result,
|
|
1682
|
-
reason: spec.reason
|
|
1683
|
-
} });
|
|
1684
|
-
else logger.info(line, { meta: {
|
|
1685
|
-
...result,
|
|
1686
|
-
reason: spec.reason
|
|
1687
|
-
} });
|
|
1688
|
-
}
|
|
1689
|
-
return results;
|
|
1690
|
-
}
|
|
1691
|
-
//#endregion
|
|
1692
1530
|
//#region src/builtins/sqlite-storage/sqlite-settings.addon.ts
|
|
1693
1531
|
/** The file name of each database inside the addon's private directory. */
|
|
1694
1532
|
var DATABASE_FILE_NAMES = {
|
|
@@ -1803,14 +1641,13 @@ var SqliteSettingsAddon = class extends require_dist.BaseAddon {
|
|
|
1803
1641
|
},
|
|
1804
1642
|
{
|
|
1805
1643
|
capability: require_dist.storageAdminCapability,
|
|
1806
|
-
provider: new StorageAdminProvider(settings.backend, this.ctx.logger.child("StorageAdmin"),
|
|
1644
|
+
provider: new StorageAdminProvider(settings.backend, this.ctx.logger.child("StorageAdmin"), records, async () => router.openFiles().filter((file) => file.databaseId !== "settings"))
|
|
1807
1645
|
}
|
|
1808
1646
|
];
|
|
1809
1647
|
}
|
|
1810
1648
|
/**
|
|
1811
1649
|
* Housekeeping that must happen BEFORE anything can read a file: the
|
|
1812
|
-
* retired-key purge (settings only)
|
|
1813
|
-
* open file).
|
|
1650
|
+
* retired-key purge (settings file only).
|
|
1814
1651
|
*/
|
|
1815
1652
|
async purgeBeforeServing(file) {
|
|
1816
1653
|
if (file instanceof InlineOwnedFile && file.databaseId === "settings") try {
|
|
@@ -1818,7 +1655,6 @@ var SqliteSettingsAddon = class extends require_dist.BaseAddon {
|
|
|
1818
1655
|
} catch (err) {
|
|
1819
1656
|
this.ctx.logger.warn("Retired-key purge failed", { meta: { error: require_dist.errMsg(err) } });
|
|
1820
1657
|
}
|
|
1821
|
-
await purgeRetiredCollections(retiredCollectionStoreOfFile(file), this.ctx.logger.child("RetiredCollections").withTags({ database: file.databaseId }));
|
|
1822
1658
|
}
|
|
1823
1659
|
/**
|
|
1824
1660
|
* The engine's TTL sweep (D881): every 10 minutes, off the boot path (the
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { C as RecordsEngine, D as callVector, E as callRecords, O as controlTargetOf, S as trustResult, T as callData, _ as collectTransferables, a as WalMaintenance, c as vectorProviderOfOwnedFile, d as CrossDatabaseTransactError, f as DatabaseBusyError, l as SqliteSettingsBackend, m as rehydrateError, o as createVectorIndex, p as DuplicatePlacementError, s as vectorProviderOf, u as CollectionPlacementError, v as isFileHostMessage, w as callControl } from "../../wal-maintenance-
|
|
1
|
+
import { $r as errMsg, C as DATABASE_SNAPSHOT_TIMEOUT_MS, Cr as storageAdminCapability, Et as bareAddonId, Gt as dataStoreProviderCapability, Ir as vectorStoreCapability, Kt as databaseSnapshotCapability, S as DATABASE_SNAPSHOT_SUFFIX, Si as RecordKindDeclarationSchema, di as NoCallerError, ei as BaseAddon, gi as RECORD_SWEEP_INTERVAL_MS, ki as UnknownRecordKindError, oa as normalizeSecretOwner, oi as DeclarationRefusedError, rr as recordsCapability, w as DATA_STORE_DATABASES, x as DATABASE_SNAPSHOT_PARTIAL_SUFFIX, yi as RUNTIME_DEFAULTS } from "../../dist-C2OBCa-A.mjs";
|
|
2
|
+
import { r as retiredKeyStoreOf, t as purgeRetiredSettingsKeys } from "../../retired-settings-keys-C_Kjp-Bj.mjs";
|
|
3
|
+
import { C as RecordsEngine, D as callVector, E as callRecords, O as controlTargetOf, S as trustResult, T as callData, _ as collectTransferables, a as WalMaintenance, c as vectorProviderOfOwnedFile, d as CrossDatabaseTransactError, f as DatabaseBusyError, l as SqliteSettingsBackend, m as rehydrateError, o as createVectorIndex, p as DuplicatePlacementError, s as vectorProviderOf, u as CollectionPlacementError, v as isFileHostMessage, w as callControl } from "../../wal-maintenance-Dg6IzSgz.mjs";
|
|
4
4
|
import { r as isSnapshotWorkerMessage } from "../../sqlite-snapshot-protocol-2QaTouWV.mjs";
|
|
5
5
|
import { a as isWorkerMessage, t as WAL_CHECKPOINT_LARGE_PASS_FRAMES } from "../../wal-checkpoint-policy-BahrTtyD.mjs";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
@@ -931,9 +931,6 @@ var InlineOwnedFile = class extends OwnedFileBase {
|
|
|
931
931
|
listPhysicalTables(ownerPrefix) {
|
|
932
932
|
return Promise.resolve(callControl(controlTargetOf(this.backend, 0), "listPhysicalTables", { ownerPrefix }));
|
|
933
933
|
}
|
|
934
|
-
async dropRetiredTable(name) {
|
|
935
|
-
return callControl(controlTargetOf(this.backend, 0), "dropRetiredTable", { name });
|
|
936
|
-
}
|
|
937
934
|
async servingThreadId() {
|
|
938
935
|
return 0;
|
|
939
936
|
}
|
|
@@ -988,9 +985,6 @@ var WorkerOwnedFile = class extends OwnedFileBase {
|
|
|
988
985
|
listPhysicalTables(ownerPrefix) {
|
|
989
986
|
return this.client.control("listPhysicalTables", { ownerPrefix });
|
|
990
987
|
}
|
|
991
|
-
dropRetiredTable(name) {
|
|
992
|
-
return this.client.control("dropRetiredTable", { name });
|
|
993
|
-
}
|
|
994
988
|
servingThreadId() {
|
|
995
989
|
return this.client.control("threadId", {});
|
|
996
990
|
}
|
|
@@ -1498,25 +1492,14 @@ var RecordsProvider = class {
|
|
|
1498
1492
|
};
|
|
1499
1493
|
//#endregion
|
|
1500
1494
|
//#region src/builtins/sqlite-storage/storage-admin-provider.ts
|
|
1501
|
-
/**
|
|
1502
|
-
* The `storage-admin` provider of the SQLite engine (D870): the operator's
|
|
1503
|
-
* maintenance reach into the settings database - list its tables and record
|
|
1504
|
-
* kinds, read a kind for diagnosis, drop a table that nothing owns any more.
|
|
1505
|
-
* Every call is logged with its table and counts.
|
|
1506
|
-
*
|
|
1507
|
-
* `dropCollection` is a one-shot of the D870 migration: remove it, and the
|
|
1508
|
-
* capability's method, once the last hub ran `migrate-device-store.ts --drop`.
|
|
1509
|
-
*/
|
|
1510
1495
|
var StorageAdminProvider = class {
|
|
1511
1496
|
backend;
|
|
1512
1497
|
logger;
|
|
1513
|
-
installedOwners;
|
|
1514
1498
|
records;
|
|
1515
1499
|
peerFiles;
|
|
1516
|
-
constructor(backend, logger,
|
|
1500
|
+
constructor(backend, logger, records, peerFiles = async () => []) {
|
|
1517
1501
|
this.backend = backend;
|
|
1518
1502
|
this.logger = logger;
|
|
1519
|
-
this.installedOwners = installedOwners;
|
|
1520
1503
|
this.records = records;
|
|
1521
1504
|
this.peerFiles = peerFiles;
|
|
1522
1505
|
}
|
|
@@ -1526,19 +1509,6 @@ var StorageAdminProvider = class {
|
|
|
1526
1509
|
readRecords(input) {
|
|
1527
1510
|
return this.records.readRecords(input);
|
|
1528
1511
|
}
|
|
1529
|
-
/** May this table be dropped AT ALL? Throws with the reason when not. */
|
|
1530
|
-
async assertDroppable(collection) {
|
|
1531
|
-
const colon = collection.indexOf(":");
|
|
1532
|
-
const base = colon > 0 ? collection.slice(colon + 1) : "";
|
|
1533
|
-
if (colon > 0 && STORAGE_ADMIN_SCOPED_BASES.includes(base)) return;
|
|
1534
|
-
if (STORAGE_ADMIN_MOVED_COLLECTIONS.includes(collection)) return;
|
|
1535
|
-
if (colon <= 0) throw new Error(`drop refused: "${collection}" is not a scoped table`);
|
|
1536
|
-
const installed = await this.installedOwners().catch((err) => {
|
|
1537
|
-
throw new Error(`drop refused: the installed addons could not be read (${err instanceof Error ? err.message : String(err)})`);
|
|
1538
|
-
});
|
|
1539
|
-
const owner = collection.slice(0, colon);
|
|
1540
|
-
if (installed.has(owner)) throw new Error(`drop refused: "${collection}" belongs to the installed addon "${owner}"`);
|
|
1541
|
-
}
|
|
1542
1512
|
async listTables(input) {
|
|
1543
1513
|
const tables = [...this.backend.listTables(input.ownerPrefix)];
|
|
1544
1514
|
for (const file of await this.peerFiles()) tables.push(...await file.listPhysicalTables(input.ownerPrefix));
|
|
@@ -1549,140 +1519,8 @@ var StorageAdminProvider = class {
|
|
|
1549
1519
|
} });
|
|
1550
1520
|
return { tables };
|
|
1551
1521
|
}
|
|
1552
|
-
async dropCollection(input) {
|
|
1553
|
-
try {
|
|
1554
|
-
await this.assertDroppable(input.collection);
|
|
1555
|
-
const rows = this.backend.dropTable(input.collection, input.expectRows);
|
|
1556
|
-
this.logger.warn("storage-admin: DROPPED a table", { meta: {
|
|
1557
|
-
collection: input.collection,
|
|
1558
|
-
rows
|
|
1559
|
-
} });
|
|
1560
|
-
return {
|
|
1561
|
-
dropped: true,
|
|
1562
|
-
rows
|
|
1563
|
-
};
|
|
1564
|
-
} catch (err) {
|
|
1565
|
-
this.logger.warn("storage-admin: drop refused", { meta: {
|
|
1566
|
-
collection: input.collection,
|
|
1567
|
-
expectRows: input.expectRows,
|
|
1568
|
-
error: err instanceof Error ? err.message : String(err)
|
|
1569
|
-
} });
|
|
1570
|
-
throw err;
|
|
1571
|
-
}
|
|
1572
|
-
}
|
|
1573
1522
|
};
|
|
1574
1523
|
//#endregion
|
|
1575
|
-
//#region src/builtins/sqlite-storage/retired-collections.ts
|
|
1576
|
-
/**
|
|
1577
|
-
* The dead tables.
|
|
1578
|
-
*
|
|
1579
|
-
* `devices` / `device_settings_kv` — the device half of the
|
|
1580
|
-
* integration-registry ([D183](../../../../../docs/decisions/adr-0183.md)).
|
|
1581
|
-
* The registry's INTEGRATION half is live (`integrations`,
|
|
1582
|
-
* `integration_settings`); its device half never had a production caller and
|
|
1583
|
-
* never had a row. The fleet lives in `device-manager:devices`, under numeric
|
|
1584
|
-
* ids, while these tables key on `dev_NNNN` — the two id-spaces could not be
|
|
1585
|
-
* reconciled even if something had wanted to.
|
|
1586
|
-
*
|
|
1587
|
-
* `pipeline-analytics:track-groups` / `:track-group-members` — the co-moving
|
|
1588
|
-
* GROUP entity. It shipped on 2026-08-24 and was kill-switched the same day
|
|
1589
|
-
* (duplicate sealed rows made Library → Gruppi unusable); the operator decided
|
|
1590
|
-
* on 2026-09-01 to delete it rather than re-open it. The clusterer, the live
|
|
1591
|
-
* buffer, the sealer, the query, the two cap methods and the two custom
|
|
1592
|
-
* actions are gone, so nothing declares these tables any more. The group-owned
|
|
1593
|
-
* MEDIA rows are NOT here — they live in the shared `pipeline-analytics:media`
|
|
1594
|
-
* and are collected by the orphan audit through `RETIRED_OWNER_KINDS`.
|
|
1595
|
-
*
|
|
1596
|
-
* `pipeline-analytics:summaries` / `:summary-members` — the session SUMMARY,
|
|
1597
|
-
* the entity that grouped tracks by proximity at birth (D489) and split them
|
|
1598
|
-
* when they walked apart (D490). Its production path was switched off on
|
|
1599
|
-
* 2026-09-16 and the operator decided on 2026-09-29 to delete it (D680): the
|
|
1600
|
-
* sealer, the store, the group shot, the three cap methods and the digest's
|
|
1601
|
-
* `groups` reading are gone, so nothing declares these tables. The group
|
|
1602
|
-
* shots were `summary`-owned rows in `pipeline-analytics:media` and go the
|
|
1603
|
-
* same way as the group entity's — through `RETIRED_OWNER_KINDS`.
|
|
1604
|
-
*/
|
|
1605
|
-
var RETIRED_COLLECTIONS = [
|
|
1606
|
-
{
|
|
1607
|
-
collection: "devices",
|
|
1608
|
-
owner: "integration-registry",
|
|
1609
|
-
reason: "the device half of the integration-registry is deleted; the fleet is `device-manager:devices` and always was (0 rows here against 974 live devices)"
|
|
1610
|
-
},
|
|
1611
|
-
{
|
|
1612
|
-
collection: "device_settings_kv",
|
|
1613
|
-
owner: "integration-registry",
|
|
1614
|
-
reason: "per-device settings of a device table that never had a row; the live per-camera store is the device-manager row plus `addon-device-settings`"
|
|
1615
|
-
},
|
|
1616
|
-
{
|
|
1617
|
-
collection: "pipeline-analytics:track-groups",
|
|
1618
|
-
owner: "pipeline-analytics",
|
|
1619
|
-
reason: "the co-moving group entity is deleted (operator decision 2026-09-01, after the 2026-08-24 kill switch); nothing declares, writes or reads it"
|
|
1620
|
-
},
|
|
1621
|
-
{
|
|
1622
|
-
collection: "pipeline-analytics:track-group-members",
|
|
1623
|
-
owner: "pipeline-analytics",
|
|
1624
|
-
reason: "membership rows of the deleted group entity; the track cascade that used to carry them away no longer has a group leg"
|
|
1625
|
-
},
|
|
1626
|
-
{
|
|
1627
|
-
collection: "pipeline-analytics:summaries",
|
|
1628
|
-
owner: "pipeline-analytics",
|
|
1629
|
-
reason: "the session summary (proximity track grouping, D489/D490) is deleted (operator decision 2026-09-29, D680, after the 2026-09-16 switch-off); nothing declares, writes or reads it"
|
|
1630
|
-
},
|
|
1631
|
-
{
|
|
1632
|
-
collection: "pipeline-analytics:summary-members",
|
|
1633
|
-
owner: "pipeline-analytics",
|
|
1634
|
-
reason: "membership rows of the deleted session summary; the track cascade no longer has a summary leg (D680)"
|
|
1635
|
-
}
|
|
1636
|
-
];
|
|
1637
|
-
/**
|
|
1638
|
-
* The same adapter over an {@link OwnedSqliteFile} — the purge runs against
|
|
1639
|
-
* EVERY open database file (D851), and a file served by a worker answers the
|
|
1640
|
-
* drop through its thread.
|
|
1641
|
-
*/
|
|
1642
|
-
function retiredCollectionStoreOfFile(file) {
|
|
1643
|
-
return { async drop(collection) {
|
|
1644
|
-
return file.dropRetiredTable(collection);
|
|
1645
|
-
} };
|
|
1646
|
-
}
|
|
1647
|
-
/**
|
|
1648
|
-
* Drop every retired table that is still present. Returns one entry per table
|
|
1649
|
-
* actually dropped — empty when the schema is already clean, which is the
|
|
1650
|
-
* steady state after the first boot that ran it.
|
|
1651
|
-
*/
|
|
1652
|
-
async function purgeRetiredCollections(store, logger, specs = RETIRED_COLLECTIONS) {
|
|
1653
|
-
const results = [];
|
|
1654
|
-
for (const spec of specs) {
|
|
1655
|
-
let dropped;
|
|
1656
|
-
try {
|
|
1657
|
-
dropped = await store.drop(spec.collection);
|
|
1658
|
-
} catch (err) {
|
|
1659
|
-
logger.warn("retired collection — drop failed, table left in place", { meta: {
|
|
1660
|
-
addon: spec.owner,
|
|
1661
|
-
collection: spec.collection,
|
|
1662
|
-
error: err instanceof Error ? err.message : String(err)
|
|
1663
|
-
} });
|
|
1664
|
-
continue;
|
|
1665
|
-
}
|
|
1666
|
-
if (dropped === null) continue;
|
|
1667
|
-
const result = {
|
|
1668
|
-
collection: spec.collection,
|
|
1669
|
-
owner: spec.owner,
|
|
1670
|
-
rows: dropped.rows
|
|
1671
|
-
};
|
|
1672
|
-
results.push(result);
|
|
1673
|
-
const line = "dropped a retired collection";
|
|
1674
|
-
if (dropped.rows > 0) logger.warn(`${line} — it still held rows`, { meta: {
|
|
1675
|
-
...result,
|
|
1676
|
-
reason: spec.reason
|
|
1677
|
-
} });
|
|
1678
|
-
else logger.info(line, { meta: {
|
|
1679
|
-
...result,
|
|
1680
|
-
reason: spec.reason
|
|
1681
|
-
} });
|
|
1682
|
-
}
|
|
1683
|
-
return results;
|
|
1684
|
-
}
|
|
1685
|
-
//#endregion
|
|
1686
1524
|
//#region src/builtins/sqlite-storage/sqlite-settings.addon.ts
|
|
1687
1525
|
/** The file name of each database inside the addon's private directory. */
|
|
1688
1526
|
var DATABASE_FILE_NAMES = {
|
|
@@ -1797,14 +1635,13 @@ var SqliteSettingsAddon = class extends BaseAddon {
|
|
|
1797
1635
|
},
|
|
1798
1636
|
{
|
|
1799
1637
|
capability: storageAdminCapability,
|
|
1800
|
-
provider: new StorageAdminProvider(settings.backend, this.ctx.logger.child("StorageAdmin"),
|
|
1638
|
+
provider: new StorageAdminProvider(settings.backend, this.ctx.logger.child("StorageAdmin"), records, async () => router.openFiles().filter((file) => file.databaseId !== "settings"))
|
|
1801
1639
|
}
|
|
1802
1640
|
];
|
|
1803
1641
|
}
|
|
1804
1642
|
/**
|
|
1805
1643
|
* Housekeeping that must happen BEFORE anything can read a file: the
|
|
1806
|
-
* retired-key purge (settings only)
|
|
1807
|
-
* open file).
|
|
1644
|
+
* retired-key purge (settings file only).
|
|
1808
1645
|
*/
|
|
1809
1646
|
async purgeBeforeServing(file) {
|
|
1810
1647
|
if (file instanceof InlineOwnedFile && file.databaseId === "settings") try {
|
|
@@ -1812,7 +1649,6 @@ var SqliteSettingsAddon = class extends BaseAddon {
|
|
|
1812
1649
|
} catch (err) {
|
|
1813
1650
|
this.ctx.logger.warn("Retired-key purge failed", { meta: { error: errMsg(err) } });
|
|
1814
1651
|
}
|
|
1815
|
-
await purgeRetiredCollections(retiredCollectionStoreOfFile(file), this.ctx.logger.child("RetiredCollections").withTags({ database: file.databaseId }));
|
|
1816
1652
|
}
|
|
1817
1653
|
/**
|
|
1818
1654
|
* The engine's TTL sweep (D881): every 10 minutes, off the boot path (the
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `storage-admin` provider of the SQLite engine (D870): the operator's
|
|
3
3
|
* maintenance reach into the settings database - list its tables and record
|
|
4
|
-
* kinds, read a kind for diagnosis
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* `dropCollection` is a one-shot of the D870 migration: remove it, and the
|
|
8
|
-
* capability's method, once the last hub ran `migrate-device-store.ts --drop`.
|
|
4
|
+
* kinds, read a kind for diagnosis. It never drops a table: a table the code
|
|
5
|
+
* no longer creates is dropped by hand, offline, on the operator hubs (D901).
|
|
9
6
|
*/
|
|
10
7
|
import { type IScopedLogger, type IStorageAdminProvider, type StorageTable } from "@camstack/types";
|
|
11
8
|
import type { RecordsProvider } from "./records/records-provider.js";
|
|
@@ -14,27 +11,16 @@ import type { SqliteSettingsBackend } from "./sqlite-settings-backend.js";
|
|
|
14
11
|
export declare class StorageAdminProvider implements IStorageAdminProvider {
|
|
15
12
|
private readonly backend;
|
|
16
13
|
private readonly logger;
|
|
17
|
-
/** The addon ids installed on this hub; a throw means "cannot tell" and refuses the drop. */
|
|
18
|
-
private readonly installedOwners;
|
|
19
14
|
/** The records provider the System -> Data methods delegate to (D881). */
|
|
20
15
|
private readonly records;
|
|
21
16
|
/** Non-settings files (`events.db`, `history.db`) whose tables `listTables` lists too. */
|
|
22
17
|
private readonly peerFiles;
|
|
23
|
-
constructor(backend: SqliteSettingsBackend, logger: IScopedLogger,
|
|
18
|
+
constructor(backend: SqliteSettingsBackend, logger: IScopedLogger, records: Pick<RecordsProvider, "listKinds" | "readRecords">, peerFiles?: () => Promise<readonly OwnedSqliteFile[]>);
|
|
24
19
|
listKinds(input: Parameters<IStorageAdminProvider["listKinds"]>[0]): ReturnType<IStorageAdminProvider["listKinds"]>;
|
|
25
20
|
readRecords(input: Parameters<IStorageAdminProvider["readRecords"]>[0]): ReturnType<IStorageAdminProvider["readRecords"]>;
|
|
26
|
-
/** May this table be dropped AT ALL? Throws with the reason when not. */
|
|
27
|
-
private assertDroppable;
|
|
28
21
|
listTables(input: {
|
|
29
22
|
ownerPrefix?: string | undefined;
|
|
30
23
|
}): Promise<{
|
|
31
24
|
tables: StorageTable[];
|
|
32
25
|
}>;
|
|
33
|
-
dropCollection(input: {
|
|
34
|
-
collection: string;
|
|
35
|
-
expectRows: number;
|
|
36
|
-
}): Promise<{
|
|
37
|
-
dropped: true;
|
|
38
|
-
rows: number;
|
|
39
|
-
}>;
|
|
40
26
|
}
|
|
@@ -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-
|
|
6
|
+
const require_dist = require("../../dist-D9aw_d0G.js");
|
|
7
7
|
const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
|
|
8
8
|
let zod = require("zod");
|
|
9
9
|
let node_crypto = require("node:crypto");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $i as isSecretMarker, Bn as mayReadLocation, Ca as EventCategory, En as isLocationEnabled, Ii as collectSecretConfigKeys, Lr as withLocationMode, Nn as legacyModeOf, Tr as storageMigrationCapability, Ui as defineRecordKinds, Vn as mayWriteToLocation, Wn as modeMayWrite, _i as REDACTED_SECRET, _n as gbToBytes, aa as normalizeNodeId, ba as transformSecretWrite, dr as resolveLocationMode, dt as StorageLocationModeSchema, ei as BaseAddon, ft as StorageLocationTypeSchema, ha as secretTreeFromPaths, ln as evictionPolicyOfLocation, pa as resolveSecretMarkers, pt as StorageMigrationJobSchema, q as LegacyStorageLocationDefaultSchema, sa as parseJsonObject, ut as StorageCleanupJobSchema, vr as settingsStoreCapability, wr as storageCapability } from "../../dist-C2OBCa-A.mjs";
|
|
2
2
|
import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|