@camstack/system 1.2.443 → 1.2.445
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/assets/record-entries/icon.svg +8 -0
- package/dist/addon-runner.js +81 -42
- package/dist/addon-runner.mjs +82 -43
- package/dist/{agent-https-DlpTMDqA.js → agent-https-CiOW0-sj.js} +810 -12
- package/dist/{agent-https-U0d4uvn2.mjs → agent-https-D4Q8iFNd.mjs} +697 -13
- package/dist/auth/admin-token-manager.d.ts +9 -3
- package/dist/auth/api-key-manager.d.ts +9 -3
- package/dist/auth/auth-audit-log.d.ts +9 -3
- package/dist/auth/device-credential-manager.d.ts +5 -1
- package/dist/auth/external-identity-manager.d.ts +8 -21
- package/dist/auth/login-session-manager.d.ts +11 -3
- package/dist/auth/scoped-token-manager.d.ts +8 -52
- package/dist/auth/totp-manager.d.ts +11 -3
- package/dist/auth/user-manager.d.ts +10 -17
- 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/alert-store.d.ts +32 -0
- package/dist/builtins/alerts/alerts.addon.d.ts +19 -4
- package/dist/builtins/alerts/alerts.addon.js +331 -159
- package/dist/builtins/alerts/alerts.addon.mjs +330 -159
- package/dist/builtins/alerts/record-kinds.d.ts +15 -0
- 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 -0
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +134 -193
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +134 -193
- package/dist/builtins/backup-orchestrator/destination-policy.d.ts +4 -2
- package/dist/builtins/backup-orchestrator/encryption-key-store.d.ts +4 -2
- package/dist/builtins/backup-orchestrator/record-kinds.d.ts +58 -0
- package/dist/builtins/backup-orchestrator/schedule-store.d.ts +4 -2
- package/dist/builtins/backup-orchestrator/seed-marker-store.d.ts +4 -2
- package/dist/builtins/calendars/calendar-prefs-store.d.ts +13 -5
- package/dist/builtins/calendars/calendars.addon.d.ts +2 -2
- package/dist/builtins/calendars/calendars.addon.js +67 -64
- package/dist/builtins/calendars/calendars.addon.mjs +59 -64
- package/dist/builtins/calendars/record-kinds.d.ts +18 -0
- 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 +36 -0
- 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/block-settings-store.d.ts +8 -4
- package/dist/builtins/core-blocks/core-block-store.d.ts +8 -16
- package/dist/builtins/core-blocks/core-blocks.addon.js +85 -112
- package/dist/builtins/core-blocks/core-blocks.addon.mjs +86 -113
- package/dist/builtins/core-blocks/index.mjs +1 -1
- package/dist/builtins/core-blocks/record-kinds.d.ts +26 -0
- package/dist/builtins/device-manager/device-manager.addon.js +111 -187
- package/dist/builtins/device-manager/device-manager.addon.mjs +110 -187
- package/dist/builtins/device-manager/device-tombstone-store.d.ts +9 -48
- package/dist/builtins/device-manager/record-kinds.d.ts +14 -0
- package/dist/builtins/hub-forwarder/index.js +1 -1
- package/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/dist/builtins/keychain/index.js +152 -22
- package/dist/builtins/keychain/index.mjs +152 -22
- package/dist/builtins/keychain/keychain-service.d.ts +3 -2
- package/dist/builtins/keychain/keychain-store.d.ts +13 -2
- package/dist/builtins/keychain/record-kinds.d.ts +16 -0
- 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 +3 -1
- package/dist/builtins/local-auth/local-auth.addon.js +2903 -2123
- package/dist/builtins/local-auth/local-auth.addon.mjs +2904 -2124
- package/dist/builtins/local-auth/oauth-session-manager.d.ts +8 -48
- package/dist/builtins/local-auth/record-kinds.d.ts +141 -0
- 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/entries-service.d.ts +42 -0
- package/dist/builtins/record-entries/index.d.ts +1 -0
- package/dist/builtins/record-entries/index.js +142 -0
- package/dist/builtins/record-entries/index.mjs +136 -0
- package/dist/builtins/record-entries/record-entries.addon.d.ts +13 -0
- package/dist/builtins/records/legacy-table-row-count.d.ts +5 -0
- package/dist/builtins/records/phase6-declare-gate.d.ts +28 -0
- package/dist/builtins/records-isolated.d.ts +10 -0
- 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-client.d.ts +2 -0
- package/dist/builtins/sqlite-storage/file-host-handlers.d.ts +4 -0
- package/dist/builtins/sqlite-storage/file-host-protocol.d.ts +7 -1
- 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/integration-record-kinds.d.ts +30 -0
- package/dist/builtins/sqlite-storage/integration-registry.d.ts +10 -16
- package/dist/builtins/sqlite-storage/owned-sqlite-file.d.ts +7 -0
- package/dist/builtins/sqlite-storage/placement-router.d.ts +5 -0
- package/dist/builtins/sqlite-storage/records/count-settings-array-legacy.d.ts +5 -0
- package/dist/builtins/sqlite-storage/records/count-settings-brokers-legacy.d.ts +6 -0
- package/dist/builtins/sqlite-storage/records/records-catalog.d.ts +29 -0
- package/dist/builtins/sqlite-storage/records/records-engine-types.d.ts +51 -0
- package/dist/builtins/sqlite-storage/records/records-engine.d.ts +94 -0
- package/dist/builtins/sqlite-storage/records/records-explain.d.ts +18 -0
- package/dist/builtins/sqlite-storage/records/records-plan.d.ts +90 -0
- package/dist/builtins/sqlite-storage/records/records-probe.d.ts +33 -0
- package/dist/builtins/sqlite-storage/records/records-provider.d.ts +63 -0
- package/dist/builtins/sqlite-storage/records/records-rows.d.ts +46 -0
- package/dist/builtins/sqlite-storage/records/records-sql.d.ts +41 -0
- package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +17 -10
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.d.ts +8 -0
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +446 -5
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +446 -5
- package/dist/builtins/sqlite-storage/storage-admin-provider.d.ts +15 -1
- package/dist/builtins/storage-orchestrator/drain-state-store.d.ts +5 -2
- package/dist/builtins/storage-orchestrator/location-store.d.ts +7 -2
- package/dist/builtins/storage-orchestrator/record-kinds.d.ts +38 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts +2 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +196 -5
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +195 -6
- package/dist/builtins/system-config/record-kinds.d.ts +32 -0
- package/dist/builtins/system-config/system-config.addon.js +53 -618
- package/dist/builtins/system-config/system-config.addon.mjs +29 -577
- package/dist/builtins/winston-logging/index.js +1 -1
- package/dist/builtins/winston-logging/index.mjs +1 -1
- package/dist/{composition-sources-C8tUG2uL.mjs → composition-sources-BMt5cFYb.mjs} +1 -1
- package/dist/{composition-sources-BUXX1e8j.js → composition-sources-D3fi9Xns.js} +1 -1
- package/dist/{constants-CGwVaAV3.mjs → constants-BMHCxRzb.mjs} +1 -1
- package/dist/{constants-DWmm7_of.js → constants-Br879Axi.js} +1 -1
- package/dist/{device-ca-DGayRmC0.js → device-ca-CnJ_va7i.js} +1 -1
- package/dist/{device-ca-DBfiJ_SB.mjs → device-ca-T8osSMos.mjs} +1 -1
- package/dist/{dist-Bxt_S-9a.mjs → dist-BNunRyXT.mjs} +1133 -93
- package/dist/{dist-D9qT3jHr.js → dist-DgOG8flk.js} +1354 -92
- package/dist/file-host-worker.js +11 -1
- package/dist/file-host-worker.mjs +11 -1
- package/dist/{hub-mdns-ciao-B-wk9nzx.js → hub-mdns-ciao-BIkTHq-n.js} +2 -2
- package/dist/{hub-mdns-ciao-DpPcQDg-.mjs → hub-mdns-ciao-D16oRQ9K.mjs} +2 -2
- package/dist/index.d.ts +7 -0
- package/dist/index.js +3111 -2806
- package/dist/index.mjs +3083 -2795
- package/dist/kernel/index.d.ts +2 -0
- package/dist/kernel/moleculer/event-bus.d.ts +3 -1
- package/dist/kernel/moleculer/mesh-mtls/mesh-certificate-registry.d.ts +5 -1
- package/dist/kernel/moleculer/records-api-transport.d.ts +9 -0
- package/dist/kernel/moleculer/remote-logger.d.ts +2 -2
- package/dist/kernel/settings-view-types.d.ts +0 -7
- package/dist/kernel/transport/cap-route-resolver.d.ts +9 -38
- package/dist/phase6-declare-gate-Ci1-8uUn.js +98 -0
- package/dist/phase6-declare-gate-tkKOEitw.mjs +93 -0
- package/dist/read-all-rows-CVoO1ONM.js +29 -0
- package/dist/read-all-rows-TaPqdWNF.mjs +25 -0
- package/dist/records/read-all-rows.d.ts +6 -0
- package/dist/{restore-archive-9CGgeBzD.mjs → restore-archive-DR9MtO7J.mjs} +339 -9
- package/dist/{restore-archive-BMNXwWWD.js → restore-archive-DjJnCgap.js} +353 -5
- package/dist/tls/agent-https-names.d.ts +9 -13
- package/dist/{wal-maintenance-cRHR4rUY.js → wal-maintenance-CODGqhKY.js} +0 -0
- package/dist/{wal-maintenance-sIB32ONp.mjs → wal-maintenance-CfvgtQ7C.mjs} +0 -0
- package/package.json +22 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `records` capability of the engine (D881): resolves WHO is calling and
|
|
3
|
+
* WHICH file a kind lives in, then hands the call to that file's records engine.
|
|
4
|
+
*
|
|
5
|
+
* - **Owner** = the transport-stamped `callerAddonId` (as device-history's
|
|
6
|
+
* `not-owner` and the keychain). It is never a field of any input; a call with
|
|
7
|
+
* no stamp is refused `records/no-caller`.
|
|
8
|
+
* - **Placement**: a kind's file is its declaration's `database`. The map is
|
|
9
|
+
* rebuilt from each open file's own `_record_kinds` at boot and updated on
|
|
10
|
+
* declaration. A kind declared for another file than the one it lives in is
|
|
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.
|
|
15
|
+
*/
|
|
16
|
+
import { type IRecordsProvider, type IScopedLogger, type IStorageAdminProvider, type StorageKind } from "@camstack/types";
|
|
17
|
+
import type { PlacementRouter } from "../placement-router.js";
|
|
18
|
+
/** The caller the transport stamped, or a refusal. */
|
|
19
|
+
export declare function recordsCallerOf(input: unknown): string;
|
|
20
|
+
type AdminRecords = Pick<IStorageAdminProvider, "listKinds" | "readRecords" | "adoptRecords"> & {
|
|
21
|
+
isAdoptedLegacyTable(collection: string): Promise<boolean>;
|
|
22
|
+
};
|
|
23
|
+
export declare class RecordsProvider implements IRecordsProvider, AdminRecords {
|
|
24
|
+
private readonly router;
|
|
25
|
+
private readonly logger;
|
|
26
|
+
private readonly placement;
|
|
27
|
+
constructor(router: PlacementRouter, logger: IScopedLogger);
|
|
28
|
+
/** Rebuild the placement map from every open file's catalog. Call once, after the files are open. */
|
|
29
|
+
init(): Promise<void>;
|
|
30
|
+
private fileOf;
|
|
31
|
+
declareKinds(input: Parameters<IRecordsProvider["declareKinds"]>[0]): ReturnType<IRecordsProvider["declareKinds"]>;
|
|
32
|
+
/** The boot guard: empty kind + a legacy table that still has rows = adoption pending. */
|
|
33
|
+
private withAdoption;
|
|
34
|
+
get(input: Parameters<IRecordsProvider["get"]>[0]): ReturnType<IRecordsProvider["get"]>;
|
|
35
|
+
getMany(input: Parameters<IRecordsProvider["getMany"]>[0]): ReturnType<IRecordsProvider["getMany"]>;
|
|
36
|
+
secretRefs(input: Parameters<IRecordsProvider["secretRefs"]>[0]): ReturnType<IRecordsProvider["secretRefs"]>;
|
|
37
|
+
put(input: Parameters<IRecordsProvider["put"]>[0]): ReturnType<IRecordsProvider["put"]>;
|
|
38
|
+
putMany(input: Parameters<IRecordsProvider["putMany"]>[0]): ReturnType<IRecordsProvider["putMany"]>;
|
|
39
|
+
patch(input: Parameters<IRecordsProvider["patch"]>[0]): ReturnType<IRecordsProvider["patch"]>;
|
|
40
|
+
delete(input: Parameters<IRecordsProvider["delete"]>[0]): ReturnType<IRecordsProvider["delete"]>;
|
|
41
|
+
deleteMany(input: Parameters<IRecordsProvider["deleteMany"]>[0]): ReturnType<IRecordsProvider["deleteMany"]>;
|
|
42
|
+
query(input: Parameters<IRecordsProvider["query"]>[0]): ReturnType<IRecordsProvider["query"]>;
|
|
43
|
+
count(input: Parameters<IRecordsProvider["count"]>[0]): ReturnType<IRecordsProvider["count"]>;
|
|
44
|
+
histogram(input: Parameters<IRecordsProvider["histogram"]>[0]): ReturnType<IRecordsProvider["histogram"]>;
|
|
45
|
+
aggregate(input: Parameters<IRecordsProvider["aggregate"]>[0]): ReturnType<IRecordsProvider["aggregate"]>;
|
|
46
|
+
deleteWhere(input: Parameters<IRecordsProvider["deleteWhere"]>[0]): ReturnType<IRecordsProvider["deleteWhere"]>;
|
|
47
|
+
allocateId(input: Parameters<IRecordsProvider["allocateId"]>[0]): ReturnType<IRecordsProvider["allocateId"]>;
|
|
48
|
+
/** The D865 hook body: every file that holds kinds of this owner. */
|
|
49
|
+
deleteDevice(input: Parameters<IRecordsProvider["deleteDevice"]>[0]): ReturnType<IRecordsProvider["deleteDevice"]>;
|
|
50
|
+
listKinds(input: {
|
|
51
|
+
readonly owner?: string | undefined;
|
|
52
|
+
readonly counts?: boolean | undefined;
|
|
53
|
+
}): Promise<{
|
|
54
|
+
kinds: StorageKind[];
|
|
55
|
+
}>;
|
|
56
|
+
readRecords(input: Parameters<IStorageAdminProvider["readRecords"]>[0]): ReturnType<IStorageAdminProvider["readRecords"]>;
|
|
57
|
+
/** True when a declared kind lists `collection` as `adoptsFrom` and adoption finished. */
|
|
58
|
+
isAdoptedLegacyTable(collection: string): Promise<boolean>;
|
|
59
|
+
adoptRecords(input: Parameters<IStorageAdminProvider["adoptRecords"]>[0]): ReturnType<IStorageAdminProvider["adoptRecords"]>;
|
|
60
|
+
/** Housekeeping: delete rows past `expires_at` in every file that hosts kinds. */
|
|
61
|
+
sweepExpired(): Promise<number>;
|
|
62
|
+
}
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Row-level helpers of the records engine (D881): validating a write against
|
|
3
|
+
* its kind, enforcing the secret-field rules, and shaping what a read returns.
|
|
4
|
+
* Pure - no database here.
|
|
5
|
+
*/
|
|
6
|
+
import { type RecordInput, type RecordKindDeclaration, type RecordView } from "@camstack/types";
|
|
7
|
+
/** A row as `SELECT` returns it (the `data` column is `json(data)`). */
|
|
8
|
+
export interface StoredRow {
|
|
9
|
+
readonly rid: number;
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly deviceId: number | null;
|
|
12
|
+
readonly at: number | null;
|
|
13
|
+
readonly expiresAt: number | null;
|
|
14
|
+
readonly rev: number;
|
|
15
|
+
readonly updatedAt: number;
|
|
16
|
+
readonly data: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function parseBody(text: string): Record<string, unknown>;
|
|
19
|
+
/** What a write is allowed to say about a row, after the kind's rules. */
|
|
20
|
+
export interface WriteHeader {
|
|
21
|
+
readonly id: string;
|
|
22
|
+
readonly deviceId: number | null;
|
|
23
|
+
readonly at: number | null;
|
|
24
|
+
readonly expiresAt: number | null;
|
|
25
|
+
}
|
|
26
|
+
export declare function validateHeader(kind: string, decl: RecordKindDeclaration, rec: Pick<RecordInput, "id" | "deviceId" | "at" | "expiresAt">, nowMs: number): WriteHeader;
|
|
27
|
+
/** Serialize the body and enforce `maxDataBytes`; `onTooLarge` is called (rate-limited) before throwing. */
|
|
28
|
+
export declare function serializeBody(kind: string, decl: RecordKindDeclaration, id: string, body: Record<string, unknown>, onTooLarge: (kind: string, bytes: number) => void, nowMs: number): string;
|
|
29
|
+
/** Markers found in a stored body, by concrete path. */
|
|
30
|
+
export declare function markersOf(decl: RecordKindDeclaration, body: unknown): ReadonlyMap<string, string>;
|
|
31
|
+
/** Show a stored body: every set secret field becomes the redaction token. */
|
|
32
|
+
export declare function redactBody(decl: RecordKindDeclaration, body: Record<string, unknown>): Record<string, unknown>;
|
|
33
|
+
/**
|
|
34
|
+
* The secret rule of a write (D878, once, in the store): a secret field may
|
|
35
|
+
* hold ONLY a keychain marker bound to this row's own ref. The redaction token
|
|
36
|
+
* keeps the stored marker (or leaves the field absent when nothing is stored);
|
|
37
|
+
* `null` removes; a plain string is refused - plaintext is never stored.
|
|
38
|
+
*
|
|
39
|
+
* `stored` is the row's current body (null for a new row). Returns the body to
|
|
40
|
+
* write and the refs the write RELEASES (markers that were stored and are gone).
|
|
41
|
+
*/
|
|
42
|
+
export declare function enforceSecrets(owner: string, kind: string, decl: RecordKindDeclaration, id: string, body: Record<string, unknown>, stored: Record<string, unknown> | null, mode: "put" | "patch"): {
|
|
43
|
+
readonly body: Record<string, unknown>;
|
|
44
|
+
readonly releasedRefs: readonly string[];
|
|
45
|
+
};
|
|
46
|
+
export declare function toView(row: StoredRow, decl: RecordKindDeclaration): RecordView;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @durable class=ledger owner=records
|
|
3
|
+
* write="every ctx.records write of an owning addon: one row per record of any declared kind, keyed (kind_id, id)"
|
|
4
|
+
* retention="per kind, declared with the kind: an engine ttl, a row bound, the owner's own sweep, or none - the reason is shown in System -> Data"
|
|
5
|
+
*/
|
|
6
|
+
export declare const RECORDS_TABLE = "records";
|
|
7
|
+
/**
|
|
8
|
+
* @durable class=config owner=records
|
|
9
|
+
* write="an owner declares its kinds when its addon boots (declareKinds): one row per (owner, kind)"
|
|
10
|
+
* retention="none - a kind row is never removed by this release; a kind no installed package declares is only marked orphaned"
|
|
11
|
+
*/
|
|
12
|
+
export declare const RECORD_KINDS_TABLE = "_record_kinds";
|
|
13
|
+
/**
|
|
14
|
+
* @durable class=config owner=records
|
|
15
|
+
* write="allocateId on a kind: one counter row per kind"
|
|
16
|
+
* retention="none - the counter must never go back, so it is never pruned"
|
|
17
|
+
*/
|
|
18
|
+
export declare const RECORD_SEQUENCES_TABLE = "_record_sequences";
|
|
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";
|
|
21
|
+
/** The tables the records engine owns: never droppable through `dropCollection`. */
|
|
22
|
+
export declare const RECORDS_ENGINE_TABLES: readonly string[];
|
|
23
|
+
/** The built-in indexes. */
|
|
24
|
+
export declare const INDEX_KIND_DEVICE_AT = "records_kind_device_at";
|
|
25
|
+
export declare const INDEX_KIND_AT = "records_kind_at";
|
|
26
|
+
export declare const INDEX_EXPIRES = "records_expires";
|
|
27
|
+
/**
|
|
28
|
+
* The expression of a record field: `json_extract("data", '$.a.b')`. THE one
|
|
29
|
+
* renderer. Throws on a path outside the safe charset (it lands in DDL).
|
|
30
|
+
*/
|
|
31
|
+
export declare function recordFieldExpr(field: string): string;
|
|
32
|
+
/** `kind_id = 17` as text; the argument must be a safe integer from the catalog. */
|
|
33
|
+
export declare function kindClause(kindId: number): string;
|
|
34
|
+
/** The physical name of a declared index. */
|
|
35
|
+
export declare function indexName(kindId: number, name: string): string;
|
|
36
|
+
/** The exact DDL of one declared index. Compared character for character when it already exists. */
|
|
37
|
+
export declare function indexDdl(kindId: number, index: {
|
|
38
|
+
readonly name: string;
|
|
39
|
+
readonly fields: readonly string[];
|
|
40
|
+
readonly unique?: boolean | undefined;
|
|
41
|
+
}): string;
|
|
@@ -403,14 +403,6 @@ export declare class SqliteSettingsBackend implements ISettingsBackend {
|
|
|
403
403
|
getAllAddon(addonId: string): Record<string, unknown>;
|
|
404
404
|
/** Bulk-set all settings for an addon */
|
|
405
405
|
setAllAddon(addonId: string, config: Record<string, unknown>): void;
|
|
406
|
-
/** Get all settings for a provider */
|
|
407
|
-
getAllProvider(providerId: string): Record<string, unknown>;
|
|
408
|
-
/** Set a provider setting */
|
|
409
|
-
setProvider(providerId: string, key: string, value: unknown): void;
|
|
410
|
-
/** Get all settings for a device */
|
|
411
|
-
getAllDevice(deviceId: string): Record<string, unknown>;
|
|
412
|
-
/** Set a device setting */
|
|
413
|
-
setDevice(deviceId: string, key: string, value: unknown): void;
|
|
414
406
|
/**
|
|
415
407
|
* The device's whole cap-slice map. `{}` — never null — when the device has never persisted a slice,
|
|
416
408
|
* because every caller treats the result as a cap map to iterate.
|
|
@@ -445,6 +437,23 @@ export declare class SqliteSettingsBackend implements ISettingsBackend {
|
|
|
445
437
|
bytes: number | null;
|
|
446
438
|
declaredThisBoot: boolean;
|
|
447
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
|
+
};
|
|
448
457
|
/**
|
|
449
458
|
* Drop one table nobody owns (D870 migration, one-shot). Refuses a canonical
|
|
450
459
|
* or engine table, one a running addon declared since boot, a table that is
|
|
@@ -556,8 +565,6 @@ export declare class SqliteSettingsBackend implements ISettingsBackend {
|
|
|
556
565
|
* function refuses degrades in speed and never in correctness.
|
|
557
566
|
*/
|
|
558
567
|
private prefixWhere;
|
|
559
|
-
private getAllScoped;
|
|
560
|
-
private setScopedKey;
|
|
561
568
|
private scopedName;
|
|
562
569
|
/**
|
|
563
570
|
* Project a declared collection onto what {@link compileFilter} needs. A
|
|
@@ -32,6 +32,8 @@ import type { SqliteVecVectorIndex } from "./vector-index-vec.js";
|
|
|
32
32
|
export declare class SqliteSettingsAddon extends BaseAddon {
|
|
33
33
|
private settingsFile;
|
|
34
34
|
private router;
|
|
35
|
+
private sweepTimer;
|
|
36
|
+
private sweepStart;
|
|
35
37
|
constructor();
|
|
36
38
|
/**
|
|
37
39
|
* The engine behind `settings-store` cannot read that door during
|
|
@@ -50,6 +52,12 @@ export declare class SqliteSettingsAddon extends BaseAddon {
|
|
|
50
52
|
* open file).
|
|
51
53
|
*/
|
|
52
54
|
private purgeBeforeServing;
|
|
55
|
+
/**
|
|
56
|
+
* The engine's TTL sweep (D881): every 10 minutes, off the boot path (the
|
|
57
|
+
* first run a minute after boot), batched and yielding. A failed pass is
|
|
58
|
+
* warned about and the next one retries; it never blocks anything.
|
|
59
|
+
*/
|
|
60
|
+
private startRecordsSweep;
|
|
53
61
|
protected onShutdown(): Promise<void>;
|
|
54
62
|
getBackend(): SqliteSettingsBackend | null;
|
|
55
63
|
/** The placement router; null before `onInitialize`. */
|