@camstack/system 1.2.449 → 1.2.451
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/builtins/sqlite-storage/file-host-protocol.d.ts +28 -0
- 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 +73 -0
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +40 -7
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +40 -7
- package/dist/builtins/sqlite-storage/storage-admin-provider.d.ts +4 -1
- package/dist/file-host-worker.js +1 -1
- package/dist/file-host-worker.mjs +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{wal-maintenance-mwCBe3Vr.js → wal-maintenance-6SrioJOn.js} +0 -0
- package/dist/{wal-maintenance-BineOch3.mjs → wal-maintenance-_tiSo8gz.mjs} +0 -0
- package/package.json +1 -1
|
@@ -54,6 +54,34 @@ export interface ControlOps {
|
|
|
54
54
|
readonly input: Record<string, never>;
|
|
55
55
|
readonly output: number;
|
|
56
56
|
};
|
|
57
|
+
/** Every physical table in the file (storage-admin / records adopt). */
|
|
58
|
+
readonly listPhysicalTables: {
|
|
59
|
+
readonly input: {
|
|
60
|
+
readonly ownerPrefix?: string | undefined;
|
|
61
|
+
};
|
|
62
|
+
readonly output: readonly {
|
|
63
|
+
readonly name: string;
|
|
64
|
+
readonly owner: string | null;
|
|
65
|
+
readonly rows: number;
|
|
66
|
+
readonly bytes: number | null;
|
|
67
|
+
readonly declaredThisBoot: boolean;
|
|
68
|
+
}[];
|
|
69
|
+
};
|
|
70
|
+
/** Paginated `(id, data)` read of a legacy table in this file. */
|
|
71
|
+
readonly readLegacyCollection: {
|
|
72
|
+
readonly input: {
|
|
73
|
+
readonly collection: string;
|
|
74
|
+
readonly cursor?: string | undefined;
|
|
75
|
+
readonly limit?: number | undefined;
|
|
76
|
+
};
|
|
77
|
+
readonly output: {
|
|
78
|
+
readonly rows: readonly {
|
|
79
|
+
readonly id: string;
|
|
80
|
+
readonly data: Record<string, unknown>;
|
|
81
|
+
}[];
|
|
82
|
+
readonly nextCursor: string | null;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
57
85
|
}
|
|
58
86
|
export type ControlOp = keyof ControlOps;
|
|
59
87
|
/** At most this many calls in flight per worker; beyond it a call is refused, never queued. */
|
|
@@ -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-
|
|
7
|
+
const require_wal_maintenance = require("../../wal-maintenance-6SrioJOn.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-
|
|
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-_tiSo8gz.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 {
|
|
@@ -35,6 +35,25 @@ export interface OwnedSqliteFile {
|
|
|
35
35
|
declaredCollections(): ReadonlySet<string>;
|
|
36
36
|
/** Does a table of this name exist in this file (declared or not)? */
|
|
37
37
|
hasTable(name: string): Promise<boolean>;
|
|
38
|
+
/** Physical tables for storage-admin (read-only; may include undeclared legacy). */
|
|
39
|
+
listPhysicalTables(ownerPrefix?: string | undefined): Promise<readonly {
|
|
40
|
+
readonly name: string;
|
|
41
|
+
readonly owner: string | null;
|
|
42
|
+
readonly rows: number;
|
|
43
|
+
readonly bytes: number | null;
|
|
44
|
+
readonly declaredThisBoot: boolean;
|
|
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
|
+
}>;
|
|
38
57
|
dropRetiredTable(name: string): Promise<DroppedRetiredTable | null>;
|
|
39
58
|
/** Which thread serves this file: 0 is the engine's main thread. */
|
|
40
59
|
servingThreadId(): Promise<number>;
|
|
@@ -91,6 +110,24 @@ declare abstract class OwnedFileBase implements OwnedSqliteFile {
|
|
|
91
110
|
abstract records<K extends RecordsOp>(op: K, input: RecordsInput<K>): Promise<RecordsOutput<K>>;
|
|
92
111
|
abstract declaredCollections(): ReadonlySet<string>;
|
|
93
112
|
abstract hasTable(name: string): Promise<boolean>;
|
|
113
|
+
abstract listPhysicalTables(ownerPrefix?: string | undefined): Promise<readonly {
|
|
114
|
+
readonly name: string;
|
|
115
|
+
readonly owner: string | null;
|
|
116
|
+
readonly rows: number;
|
|
117
|
+
readonly bytes: number | null;
|
|
118
|
+
readonly declaredThisBoot: boolean;
|
|
119
|
+
}[]>;
|
|
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
|
+
}>;
|
|
94
131
|
abstract dropRetiredTable(name: string): Promise<DroppedRetiredTable | null>;
|
|
95
132
|
abstract servingThreadId(): Promise<number>;
|
|
96
133
|
protected abstract stopConnection(): Promise<void>;
|
|
@@ -119,6 +156,24 @@ export declare class InlineOwnedFile extends OwnedFileBase {
|
|
|
119
156
|
vector<K extends VectorOp>(op: K, input: VectorInput<K>): Promise<VectorOutput<K>>;
|
|
120
157
|
declaredCollections(): ReadonlySet<string>;
|
|
121
158
|
hasTable(name: string): Promise<boolean>;
|
|
159
|
+
listPhysicalTables(ownerPrefix?: string | undefined): Promise<readonly {
|
|
160
|
+
readonly name: string;
|
|
161
|
+
readonly owner: string | null;
|
|
162
|
+
readonly rows: number;
|
|
163
|
+
readonly bytes: number | null;
|
|
164
|
+
readonly declaredThisBoot: boolean;
|
|
165
|
+
}[]>;
|
|
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
|
+
}>;
|
|
122
177
|
dropRetiredTable(name: string): Promise<DroppedRetiredTable | null>;
|
|
123
178
|
servingThreadId(): Promise<number>;
|
|
124
179
|
protected stopMaintenance(): void;
|
|
@@ -134,6 +189,24 @@ export declare class WorkerOwnedFile extends OwnedFileBase {
|
|
|
134
189
|
records<K extends RecordsOp>(op: K, input: RecordsInput<K>): Promise<RecordsOutput<K>>;
|
|
135
190
|
declaredCollections(): ReadonlySet<string>;
|
|
136
191
|
hasTable(name: string): Promise<boolean>;
|
|
192
|
+
listPhysicalTables(ownerPrefix?: string | undefined): Promise<readonly {
|
|
193
|
+
readonly name: string;
|
|
194
|
+
readonly owner: string | null;
|
|
195
|
+
readonly rows: number;
|
|
196
|
+
readonly bytes: number | null;
|
|
197
|
+
readonly declaredThisBoot: boolean;
|
|
198
|
+
}[]>;
|
|
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
|
+
}>;
|
|
137
210
|
dropRetiredTable(name: string): Promise<DroppedRetiredTable | null>;
|
|
138
211
|
servingThreadId(): Promise<number>;
|
|
139
212
|
protected stopMaintenance(): void;
|
|
@@ -5,7 +5,7 @@ Object.defineProperties(exports, {
|
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
6
|
const require_dist = require("../../dist-Ct88catN.js");
|
|
7
7
|
const require_retired_settings_keys = require("../../retired-settings-keys-D_VwZiDt.js");
|
|
8
|
-
const require_wal_maintenance = require("../../wal-maintenance-
|
|
8
|
+
const require_wal_maintenance = require("../../wal-maintenance-6SrioJOn.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");
|
|
@@ -934,6 +934,12 @@ var InlineOwnedFile = class extends OwnedFileBase {
|
|
|
934
934
|
async hasTable(name) {
|
|
935
935
|
return require_wal_maintenance.callControl(require_wal_maintenance.controlTargetOf(this.backend, 0), "hasTable", { name });
|
|
936
936
|
}
|
|
937
|
+
listPhysicalTables(ownerPrefix) {
|
|
938
|
+
return Promise.resolve(require_wal_maintenance.callControl(require_wal_maintenance.controlTargetOf(this.backend, 0), "listPhysicalTables", { ownerPrefix }));
|
|
939
|
+
}
|
|
940
|
+
readLegacyCollection(input) {
|
|
941
|
+
return Promise.resolve(require_wal_maintenance.callControl(require_wal_maintenance.controlTargetOf(this.backend, 0), "readLegacyCollection", input));
|
|
942
|
+
}
|
|
937
943
|
async dropRetiredTable(name) {
|
|
938
944
|
return require_wal_maintenance.callControl(require_wal_maintenance.controlTargetOf(this.backend, 0), "dropRetiredTable", { name });
|
|
939
945
|
}
|
|
@@ -988,6 +994,12 @@ var WorkerOwnedFile = class extends OwnedFileBase {
|
|
|
988
994
|
hasTable(name) {
|
|
989
995
|
return this.client.control("hasTable", { name });
|
|
990
996
|
}
|
|
997
|
+
listPhysicalTables(ownerPrefix) {
|
|
998
|
+
return this.client.control("listPhysicalTables", { ownerPrefix });
|
|
999
|
+
}
|
|
1000
|
+
readLegacyCollection(input) {
|
|
1001
|
+
return this.client.control("readLegacyCollection", input);
|
|
1002
|
+
}
|
|
991
1003
|
dropRetiredTable(name) {
|
|
992
1004
|
return this.client.control("dropRetiredTable", { name });
|
|
993
1005
|
}
|
|
@@ -1608,11 +1620,13 @@ var StorageAdminProvider = class {
|
|
|
1608
1620
|
logger;
|
|
1609
1621
|
installedOwners;
|
|
1610
1622
|
records;
|
|
1611
|
-
|
|
1623
|
+
peerFiles;
|
|
1624
|
+
constructor(backend, logger, installedOwners, records, peerFiles = async () => []) {
|
|
1612
1625
|
this.backend = backend;
|
|
1613
1626
|
this.logger = logger;
|
|
1614
1627
|
this.installedOwners = installedOwners;
|
|
1615
1628
|
this.records = records;
|
|
1629
|
+
this.peerFiles = peerFiles;
|
|
1616
1630
|
}
|
|
1617
1631
|
listKinds(input) {
|
|
1618
1632
|
return this.records.listKinds(input);
|
|
@@ -1626,8 +1640,25 @@ var StorageAdminProvider = class {
|
|
|
1626
1640
|
isAdoptedLegacyTable(input) {
|
|
1627
1641
|
return this.records.isAdoptedLegacyTable(input.collection).then((adopted) => ({ adopted }));
|
|
1628
1642
|
}
|
|
1629
|
-
readLegacyCollection(input) {
|
|
1630
|
-
|
|
1643
|
+
async readLegacyCollection(input) {
|
|
1644
|
+
if (this.backend.hasTable(input.collection)) {
|
|
1645
|
+
const page = this.backend.readLegacyCollection(input);
|
|
1646
|
+
return {
|
|
1647
|
+
rows: [...page.rows],
|
|
1648
|
+
nextCursor: page.nextCursor
|
|
1649
|
+
};
|
|
1650
|
+
}
|
|
1651
|
+
for (const file of await this.peerFiles()) if (await file.hasTable(input.collection)) {
|
|
1652
|
+
const page = await file.readLegacyCollection(input);
|
|
1653
|
+
return {
|
|
1654
|
+
rows: [...page.rows],
|
|
1655
|
+
nextCursor: page.nextCursor
|
|
1656
|
+
};
|
|
1657
|
+
}
|
|
1658
|
+
return {
|
|
1659
|
+
rows: [],
|
|
1660
|
+
nextCursor: null
|
|
1661
|
+
};
|
|
1631
1662
|
}
|
|
1632
1663
|
/** May this table be dropped AT ALL? Throws with the reason when not. */
|
|
1633
1664
|
async assertDroppable(collection) {
|
|
@@ -1643,12 +1674,14 @@ var StorageAdminProvider = class {
|
|
|
1643
1674
|
if (installed.has(owner) && !await this.records.isAdoptedLegacyTable(collection)) throw new Error(`drop refused: "${collection}" belongs to the installed addon "${owner}"`);
|
|
1644
1675
|
}
|
|
1645
1676
|
async listTables(input) {
|
|
1646
|
-
const tables = this.backend.listTables(input.ownerPrefix);
|
|
1677
|
+
const tables = [...this.backend.listTables(input.ownerPrefix)];
|
|
1678
|
+
for (const file of await this.peerFiles()) tables.push(...await file.listPhysicalTables(input.ownerPrefix));
|
|
1679
|
+
tables.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
1647
1680
|
this.logger.info("storage-admin: listed tables", { meta: {
|
|
1648
1681
|
tables: tables.length,
|
|
1649
1682
|
ownerPrefix: input.ownerPrefix ?? null
|
|
1650
1683
|
} });
|
|
1651
|
-
return { tables
|
|
1684
|
+
return { tables };
|
|
1652
1685
|
}
|
|
1653
1686
|
async dropCollection(input) {
|
|
1654
1687
|
try {
|
|
@@ -1899,7 +1932,7 @@ var SqliteSettingsAddon = class extends require_dist.BaseAddon {
|
|
|
1899
1932
|
},
|
|
1900
1933
|
{
|
|
1901
1934
|
capability: require_dist.storageAdminCapability,
|
|
1902
|
-
provider: new StorageAdminProvider(settings.backend, this.ctx.logger.child("StorageAdmin"), async () => new Set((await this.ctx.api.addons.list.query()).map((addon) => addon.manifest.id)), records)
|
|
1935
|
+
provider: new StorageAdminProvider(settings.backend, this.ctx.logger.child("StorageAdmin"), async () => new Set((await this.ctx.api.addons.list.query()).map((addon) => addon.manifest.id)), records, async () => router.openFiles().filter((file) => file.databaseId !== "settings"))
|
|
1903
1936
|
}
|
|
1904
1937
|
];
|
|
1905
1938
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { $ as STORAGE_ADMIN_SCOPED_BASES, $i as parseSettingsArrayAdoptsFrom, $r as NoCallerError, Gn as recordsCapability, Hr as BaseAddon, It as dataStoreProviderCapability, Jr as DeclarationRefusedError, Lt as databaseSnapshotCapability, Q as STORAGE_ADMIN_MOVED_COLLECTIONS, S as DATA_STORE_DATABASES, Vr as errMsg, Yi as normalizeSecretOwner, _i as UnknownRecordKindError, _t as bareAddonId, b as DATABASE_SNAPSHOT_SUFFIX, dr as storageAdminCapability, ea as parseSettingsBrokersAdoptsFrom, ii as RECORD_SWEEP_INTERVAL_MS, si as RUNTIME_DEFAULTS, ui as RecordKindDeclarationSchema, wr as vectorStoreCapability, x as DATABASE_SNAPSHOT_TIMEOUT_MS, y as DATABASE_SNAPSHOT_PARTIAL_SUFFIX } from "../../dist-DV2ll9Hi.mjs";
|
|
2
2
|
import { i as retiredKeyStoreOf, n as purgeRetiredSettingsKeys } from "../../retired-settings-keys-Bhwe4ymb.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-
|
|
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-_tiSo8gz.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";
|
|
@@ -928,6 +928,12 @@ var InlineOwnedFile = class extends OwnedFileBase {
|
|
|
928
928
|
async hasTable(name) {
|
|
929
929
|
return callControl(controlTargetOf(this.backend, 0), "hasTable", { name });
|
|
930
930
|
}
|
|
931
|
+
listPhysicalTables(ownerPrefix) {
|
|
932
|
+
return Promise.resolve(callControl(controlTargetOf(this.backend, 0), "listPhysicalTables", { ownerPrefix }));
|
|
933
|
+
}
|
|
934
|
+
readLegacyCollection(input) {
|
|
935
|
+
return Promise.resolve(callControl(controlTargetOf(this.backend, 0), "readLegacyCollection", input));
|
|
936
|
+
}
|
|
931
937
|
async dropRetiredTable(name) {
|
|
932
938
|
return callControl(controlTargetOf(this.backend, 0), "dropRetiredTable", { name });
|
|
933
939
|
}
|
|
@@ -982,6 +988,12 @@ var WorkerOwnedFile = class extends OwnedFileBase {
|
|
|
982
988
|
hasTable(name) {
|
|
983
989
|
return this.client.control("hasTable", { name });
|
|
984
990
|
}
|
|
991
|
+
listPhysicalTables(ownerPrefix) {
|
|
992
|
+
return this.client.control("listPhysicalTables", { ownerPrefix });
|
|
993
|
+
}
|
|
994
|
+
readLegacyCollection(input) {
|
|
995
|
+
return this.client.control("readLegacyCollection", input);
|
|
996
|
+
}
|
|
985
997
|
dropRetiredTable(name) {
|
|
986
998
|
return this.client.control("dropRetiredTable", { name });
|
|
987
999
|
}
|
|
@@ -1602,11 +1614,13 @@ var StorageAdminProvider = class {
|
|
|
1602
1614
|
logger;
|
|
1603
1615
|
installedOwners;
|
|
1604
1616
|
records;
|
|
1605
|
-
|
|
1617
|
+
peerFiles;
|
|
1618
|
+
constructor(backend, logger, installedOwners, records, peerFiles = async () => []) {
|
|
1606
1619
|
this.backend = backend;
|
|
1607
1620
|
this.logger = logger;
|
|
1608
1621
|
this.installedOwners = installedOwners;
|
|
1609
1622
|
this.records = records;
|
|
1623
|
+
this.peerFiles = peerFiles;
|
|
1610
1624
|
}
|
|
1611
1625
|
listKinds(input) {
|
|
1612
1626
|
return this.records.listKinds(input);
|
|
@@ -1620,8 +1634,25 @@ var StorageAdminProvider = class {
|
|
|
1620
1634
|
isAdoptedLegacyTable(input) {
|
|
1621
1635
|
return this.records.isAdoptedLegacyTable(input.collection).then((adopted) => ({ adopted }));
|
|
1622
1636
|
}
|
|
1623
|
-
readLegacyCollection(input) {
|
|
1624
|
-
|
|
1637
|
+
async readLegacyCollection(input) {
|
|
1638
|
+
if (this.backend.hasTable(input.collection)) {
|
|
1639
|
+
const page = this.backend.readLegacyCollection(input);
|
|
1640
|
+
return {
|
|
1641
|
+
rows: [...page.rows],
|
|
1642
|
+
nextCursor: page.nextCursor
|
|
1643
|
+
};
|
|
1644
|
+
}
|
|
1645
|
+
for (const file of await this.peerFiles()) if (await file.hasTable(input.collection)) {
|
|
1646
|
+
const page = await file.readLegacyCollection(input);
|
|
1647
|
+
return {
|
|
1648
|
+
rows: [...page.rows],
|
|
1649
|
+
nextCursor: page.nextCursor
|
|
1650
|
+
};
|
|
1651
|
+
}
|
|
1652
|
+
return {
|
|
1653
|
+
rows: [],
|
|
1654
|
+
nextCursor: null
|
|
1655
|
+
};
|
|
1625
1656
|
}
|
|
1626
1657
|
/** May this table be dropped AT ALL? Throws with the reason when not. */
|
|
1627
1658
|
async assertDroppable(collection) {
|
|
@@ -1637,12 +1668,14 @@ var StorageAdminProvider = class {
|
|
|
1637
1668
|
if (installed.has(owner) && !await this.records.isAdoptedLegacyTable(collection)) throw new Error(`drop refused: "${collection}" belongs to the installed addon "${owner}"`);
|
|
1638
1669
|
}
|
|
1639
1670
|
async listTables(input) {
|
|
1640
|
-
const tables = this.backend.listTables(input.ownerPrefix);
|
|
1671
|
+
const tables = [...this.backend.listTables(input.ownerPrefix)];
|
|
1672
|
+
for (const file of await this.peerFiles()) tables.push(...await file.listPhysicalTables(input.ownerPrefix));
|
|
1673
|
+
tables.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
1641
1674
|
this.logger.info("storage-admin: listed tables", { meta: {
|
|
1642
1675
|
tables: tables.length,
|
|
1643
1676
|
ownerPrefix: input.ownerPrefix ?? null
|
|
1644
1677
|
} });
|
|
1645
|
-
return { tables
|
|
1678
|
+
return { tables };
|
|
1646
1679
|
}
|
|
1647
1680
|
async dropCollection(input) {
|
|
1648
1681
|
try {
|
|
@@ -1893,7 +1926,7 @@ var SqliteSettingsAddon = class extends BaseAddon {
|
|
|
1893
1926
|
},
|
|
1894
1927
|
{
|
|
1895
1928
|
capability: storageAdminCapability,
|
|
1896
|
-
provider: new StorageAdminProvider(settings.backend, this.ctx.logger.child("StorageAdmin"), async () => new Set((await this.ctx.api.addons.list.query()).map((addon) => addon.manifest.id)), records)
|
|
1929
|
+
provider: new StorageAdminProvider(settings.backend, this.ctx.logger.child("StorageAdmin"), async () => new Set((await this.ctx.api.addons.list.query()).map((addon) => addon.manifest.id)), records, async () => router.openFiles().filter((file) => file.databaseId !== "settings"))
|
|
1897
1930
|
}
|
|
1898
1931
|
];
|
|
1899
1932
|
}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { type IScopedLogger, type IStorageAdminProvider, type StorageTable } from "@camstack/types";
|
|
10
10
|
import type { RecordsProvider } from "./records/records-provider.js";
|
|
11
|
+
import type { OwnedSqliteFile } from "./owned-sqlite-file.js";
|
|
11
12
|
import type { SqliteSettingsBackend } from "./sqlite-settings-backend.js";
|
|
12
13
|
export declare class StorageAdminProvider implements IStorageAdminProvider {
|
|
13
14
|
private readonly backend;
|
|
@@ -16,7 +17,9 @@ export declare class StorageAdminProvider implements IStorageAdminProvider {
|
|
|
16
17
|
private readonly installedOwners;
|
|
17
18
|
/** The records provider the System -> Data and migration methods delegate to (D881). */
|
|
18
19
|
private readonly records;
|
|
19
|
-
|
|
20
|
+
/** Non-settings files (`events.db`, `history.db`) for legacy table listing and reads. */
|
|
21
|
+
private readonly peerFiles;
|
|
22
|
+
constructor(backend: SqliteSettingsBackend, logger: IScopedLogger, installedOwners: () => Promise<ReadonlySet<string>>, records: Pick<RecordsProvider, "listKinds" | "readRecords" | "adoptRecords" | "isAdoptedLegacyTable">, peerFiles?: () => Promise<readonly OwnedSqliteFile[]>);
|
|
20
23
|
listKinds(input: Parameters<IStorageAdminProvider["listKinds"]>[0]): ReturnType<IStorageAdminProvider["listKinds"]>;
|
|
21
24
|
readRecords(input: Parameters<IStorageAdminProvider["readRecords"]>[0]): ReturnType<IStorageAdminProvider["readRecords"]>;
|
|
22
25
|
adoptRecords(input: Parameters<IStorageAdminProvider["adoptRecords"]>[0]): ReturnType<IStorageAdminProvider["adoptRecords"]>;
|
package/dist/file-host-worker.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require("./chunk-Cek0wNdY.js");
|
|
2
|
-
const require_wal_maintenance = require("./wal-maintenance-
|
|
2
|
+
const require_wal_maintenance = require("./wal-maintenance-6SrioJOn.js");
|
|
3
3
|
let node_worker_threads = require("node:worker_threads");
|
|
4
4
|
//#region src/builtins/sqlite-storage/file-host-worker.ts
|
|
5
5
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as RecordsEngine, D as callVector, E as callRecords, O as controlTargetOf, T as callData, _ as collectTransferables, a as WalMaintenance, b as isFileHostWorkerData, h as serializeError, l as SqliteSettingsBackend, o as createVectorIndex, s as vectorProviderOf, w as callControl, x as trustInput, y as isFileHostRequest } from "./wal-maintenance-
|
|
1
|
+
import { C as RecordsEngine, D as callVector, E as callRecords, O as controlTargetOf, T as callData, _ as collectTransferables, a as WalMaintenance, b as isFileHostWorkerData, h as serializeError, l as SqliteSettingsBackend, o as createVectorIndex, s as vectorProviderOf, w as callControl, x as trustInput, y as isFileHostRequest } from "./wal-maintenance-_tiSo8gz.mjs";
|
|
2
2
|
import { parentPort, threadId, workerData } from "node:worker_threads";
|
|
3
3
|
//#region src/builtins/sqlite-storage/file-host-worker.ts
|
|
4
4
|
/**
|
package/dist/index.js
CHANGED
|
@@ -27,7 +27,7 @@ const require_builtins_loki_logging_index = require("./builtins/loki-logging/ind
|
|
|
27
27
|
const require_builtins_native_metrics_native_metrics_addon = require("./builtins/native-metrics/native-metrics.addon.js");
|
|
28
28
|
const require_builtins_device_history_device_history_addon = require("./builtins/device-history/device-history.addon.js");
|
|
29
29
|
const require_builtins_sqlite_storage_filesystem_storage_addon = require("./builtins/sqlite-storage/filesystem-storage.addon.js");
|
|
30
|
-
const require_wal_maintenance = require("./wal-maintenance-
|
|
30
|
+
const require_wal_maintenance = require("./wal-maintenance-6SrioJOn.js");
|
|
31
31
|
const require_builtins_sqlite_storage_sqlite_settings_addon = require("./builtins/sqlite-storage/sqlite-settings.addon.js");
|
|
32
32
|
const require_builtins_sqlite_storage_index = require("./builtins/sqlite-storage/index.js");
|
|
33
33
|
const require_builtins_storage_orchestrator_storage_orchestrator_addon = require("./builtins/storage-orchestrator/storage-orchestrator.addon.js");
|
package/dist/index.mjs
CHANGED
|
@@ -26,7 +26,7 @@ import { LokiDestination, LokiLoggingAddon } from "./builtins/loki-logging/index
|
|
|
26
26
|
import NativeMetricsAddon, { a as NativeMetricsProvider, n as nodeProcReader, r as parseProcStat } from "./builtins/native-metrics/native-metrics.addon.mjs";
|
|
27
27
|
import { DeviceHistoryAddon } from "./builtins/device-history/device-history.addon.mjs";
|
|
28
28
|
import { FilesystemStorageAddon, t as FilesystemStorageProvider } from "./builtins/sqlite-storage/filesystem-storage.addon.mjs";
|
|
29
|
-
import { l as SqliteSettingsBackend } from "./wal-maintenance-
|
|
29
|
+
import { l as SqliteSettingsBackend } from "./wal-maintenance-_tiSo8gz.mjs";
|
|
30
30
|
import { SqliteSettingsAddon } from "./builtins/sqlite-storage/sqlite-settings.addon.mjs";
|
|
31
31
|
import { ConfigStore, DeviceStore } from "./builtins/sqlite-storage/index.mjs";
|
|
32
32
|
import { StorageOrchestratorAddon, a as stripForwardedCaller, i as createHubCapForwardService, l as STORAGE_DRAIN_STATE_LEGACY, n as HUB_CAP_FWD_ACTION, o as buildStorageLocationRegistry, r as HUB_CAP_FWD_SERVICE, t as StorageOrchestratorService, u as storageOrchestratorRecordKinds } from "./builtins/storage-orchestrator/storage-orchestrator.addon.mjs";
|
|
Binary file
|
|
Binary file
|