@camstack/server 1.2.789 → 1.2.790
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/CHANGELOG.md +8 -0
- package/dist/agent/agent-child-manifest.js +39 -0
- package/dist/agent/agent-hub-registration.js +11 -1
- package/dist/agent/forward-to-hub.js +43 -0
- package/dist/agent/main.js +31 -81
- package/dist/agent/stale-addon-gate.js +70 -34
- package/dist/api/trpc/generated-cap-mounts.js +1 -6
- package/dist/api/trpc/generated-cap-routers.js +1221 -1417
- package/dist/core/addon/addon-registry.service.js +25 -33
- package/dist/core/addon/boot-health-snapshot.js +0 -28
- package/dist/core/addon/{hub-spawn-gate.js → hub-addon-support.js} +12 -35
- package/dist/core/moleculer/moleculer.service.js +2 -13
- package/dist/core/moleculer/runner-hosted-on-node.js +23 -0
- package/dist/core/updates/required-addon-update.js +1 -1
- package/package.json +25 -9
- package/system/dist/{agent-https-jJDe-XNl.js → agent-https-BmXXKQAA.js} +1 -1
- package/system/dist/{agent-https-szf2FU49.mjs → agent-https-ByceQLwr.mjs} +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/system/dist/builtins/alerts/alerts.addon.d.ts +8 -0
- package/system/dist/builtins/alerts/alerts.addon.js +72 -1
- package/system/dist/builtins/alerts/alerts.addon.mjs +72 -1
- package/system/dist/builtins/autotrack/index.js +1 -1
- package/system/dist/builtins/autotrack/index.mjs +1 -1
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
- package/system/dist/builtins/calendars/calendars.addon.js +1 -1
- package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
- package/system/dist/builtins/camera-grid/index.js +1 -1
- package/system/dist/builtins/camera-grid/index.mjs +1 -1
- package/system/dist/builtins/composer/composer.addon.js +3 -3
- package/system/dist/builtins/composer/composer.addon.mjs +3 -3
- package/system/dist/builtins/console-logging/index.js +1 -1
- package/system/dist/builtins/console-logging/index.mjs +1 -1
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +11 -5
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +11 -5
- package/system/dist/builtins/device-history/device-history.addon.js +2 -2
- package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
- package/system/dist/builtins/device-manager/device-manager.addon.js +1 -1
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
- package/system/dist/builtins/hub-forwarder/index.js +1 -1
- package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/system/dist/builtins/keychain/index.js +4 -4
- package/system/dist/builtins/keychain/index.mjs +4 -4
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
- package/system/dist/builtins/local-network/local-network.addon.js +2 -2
- package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
- package/system/dist/builtins/loki-logging/index.js +1 -1
- package/system/dist/builtins/loki-logging/index.mjs +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/system/dist/builtins/platform-probe/index.js +1 -1
- package/system/dist/builtins/platform-probe/index.mjs +1 -1
- package/system/dist/builtins/record-entries/index.js +1 -1
- package/system/dist/builtins/record-entries/index.mjs +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/snapshot/index.js +1 -1
- package/system/dist/builtins/snapshot/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/index.js +1 -1
- package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
- package/system/dist/builtins/storage-orchestrator/access-guards.d.ts +1 -1
- package/system/dist/builtins/storage-orchestrator/custom-actions.d.ts +11 -0
- package/system/dist/builtins/storage-orchestrator/index.d.ts +1 -0
- package/system/dist/builtins/storage-orchestrator/index.js +2 -0
- package/system/dist/builtins/storage-orchestrator/index.mjs +2 -2
- package/system/dist/builtins/storage-orchestrator/location-instances.d.ts +72 -0
- package/system/dist/builtins/storage-orchestrator/location-repoint-move.d.ts +1 -1
- package/system/dist/builtins/storage-orchestrator/location-secret-refs.d.ts +26 -0
- package/system/dist/builtins/storage-orchestrator/location-store.d.ts +28 -2
- package/system/dist/builtins/storage-orchestrator/migrations/index.d.ts +9 -2
- package/system/dist/builtins/storage-orchestrator/migrations/legacy-location-secret-refs.d.ts +13 -0
- package/system/dist/builtins/storage-orchestrator/migrations/location-secret-ports.d.ts +15 -0
- package/system/dist/builtins/storage-orchestrator/migrations/location-secrets-to-record.d.ts +57 -0
- package/system/dist/builtins/storage-orchestrator/provider-discovery.d.ts +10 -13
- package/system/dist/builtins/storage-orchestrator/record-kinds.d.ts +6 -0
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts +39 -8
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +954 -131
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +954 -132
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.service.d.ts +8 -0
- package/system/dist/builtins/system-config/system-config.addon.js +3 -3
- package/system/dist/builtins/system-config/system-config.addon.mjs +284 -284
- package/system/dist/builtins/winston-logging/index.js +112 -3
- package/system/dist/builtins/winston-logging/index.mjs +112 -3
- package/system/dist/builtins/winston-logging/migrations/index.d.ts +8 -0
- package/system/dist/builtins/winston-logging/migrations/node-fields.d.ts +43 -0
- package/system/dist/builtins/winston-logging/winston-logging.addon.d.ts +10 -2
- package/system/dist/{capture-engine-DNHgjQot.js → capture-engine-BHj1fNYC.js} +1 -1
- package/system/dist/{capture-engine-BsKY_3xa.mjs → capture-engine-D9n4KDaN.mjs} +1 -1
- package/system/dist/{composition-sources-BgO0GQYW.js → composition-sources-BGgIuuvd.js} +1 -1
- package/system/dist/{composition-sources-BRdGsbVT.mjs → composition-sources-wI4qWTz2.mjs} +1 -1
- package/system/dist/{constants-CQeMrR4f.mjs → constants-DHqkxbYk.mjs} +1 -1
- package/system/dist/{constants-C3jGKQSQ.js → constants-DNdriMRD.js} +1 -1
- package/system/dist/{device-ca-D3y6wGmn.js → device-ca-C2RzT1VT.js} +1 -1
- package/system/dist/{device-ca-ByVi5eUC.mjs → device-ca-gr5eE3h5.mjs} +1 -1
- package/system/dist/{dist-BsQA6-0i.mjs → dist-BUoL5bbr.mjs} +116 -418
- package/system/dist/{dist-BRI-Mwx0.js → dist-DV0V3JiE.js} +133 -417
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-mdns-ciao-Ry_Jpljx.js → hub-mdns-ciao-Be5PGXW6.js} +2 -2
- package/system/dist/{hub-mdns-ciao-8dJTW2LI.mjs → hub-mdns-ciao-DoSb8dwB.mjs} +2 -2
- package/system/dist/index.js +151 -53
- package/system/dist/index.mjs +151 -55
- package/system/dist/kernel/addon-health-monitor.d.ts +0 -21
- package/system/dist/kernel/index.d.ts +2 -0
- package/system/dist/kernel/transport/runner-of-addon.d.ts +2 -0
- package/system/dist/kernel/unsupported-addon-tracker.d.ts +74 -0
- package/system/dist/{legacy-integration-rows-door-D5BdSNla.js → legacy-integration-rows-door-D5s8oM7e.js} +1 -1
- package/system/dist/{legacy-integration-rows-door-CjXTbmvH.mjs → legacy-integration-rows-door-DRC0xn6k.mjs} +1 -1
- package/system/dist/{restore-archive-vn4co_kf.mjs → restore-archive-DH3P9j-V.mjs} +82 -82
- package/system/dist/{restore-archive-GoWJMdHy.js → restore-archive-Dh4gfCRY.js} +1 -1
- package/system/dist/{wal-maintenance-CadfiGWy.mjs → wal-maintenance-BWfH3Lov.mjs} +0 -0
- package/system/dist/{wal-maintenance-sSlXJm4k.js → wal-maintenance-DgN_WD5T.js} +0 -0
- package/system/package.json +4 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Bo as BaseAddon, Ci as migrationsCapability, Ct as MIGRATION_API_V1_METHODS, F as DATABASE_SNAPSHOT_TIMEOUT_MS, I as DATA_STORE_DATABASES, Ii as orderMigrations, Ko as DeclarationRefusedError, Ln as catalogueIssues, Ms as customAction, N as DATABASE_SNAPSHOT_PARTIAL_SUFFIX, Na as storageAdminCapability, Oc as errMsg$1, Ot as MigrationMetaSchema, P as DATABASE_SNAPSHOT_SUFFIX, Ps as defineCustomActions, Tn as bareAddonId, Xo as InvalidRecordError, Zo as NoCallerError, _s as TransactRefusedError, ar as databaseSnapshotCapability, ea as recordsCapability, ha as resolveRunnerId, ir as dataStoreProviderCapability, kc as EventCategory, ks as collectSecretMarkerRefs, os as RUNTIME_DEFAULTS, rs as RECORD_SWEEP_INTERVAL_MS, sc as normalizeSecretOwner, to as vectorStoreCapability, us as RecordKindDeclarationSchema, ys as UnknownRecordKindError } from "../../dist-BUoL5bbr.mjs";
|
|
2
2
|
import { r as retiredKeyStoreOf, t as purgeRetiredSettingsKeys } from "../../retired-settings-keys-u6xQA6r7.mjs";
|
|
3
|
-
import { A as callRecords, D as RecordsEngine, E as databaseOfStore, M as controlTargetOf, O as callControl, T as trustResult, _ as rehydrateError, a as WalMaintenance, b as collectTransferables, c as vectorProviderOfOwnedFile, d as callMigrate, f as migrateTargetOf, g as DuplicatePlacementError, h as DatabaseBusyError, j as callVector, k as callData, l as SqliteSettingsBackend, m as CrossDatabaseTransactError, o as createVectorIndex, p as CollectionPlacementError, s as vectorProviderOf, u as HUB_MIGRATIONS, x as isFileHostMessage } from "../../wal-maintenance-
|
|
3
|
+
import { A as callRecords, D as RecordsEngine, E as databaseOfStore, M as controlTargetOf, O as callControl, T as trustResult, _ as rehydrateError, a as WalMaintenance, b as collectTransferables, c as vectorProviderOfOwnedFile, d as callMigrate, f as migrateTargetOf, g as DuplicatePlacementError, h as DatabaseBusyError, j as callVector, k as callData, l as SqliteSettingsBackend, m as CrossDatabaseTransactError, o as createVectorIndex, p as CollectionPlacementError, s as vectorProviderOf, u as HUB_MIGRATIONS, x as isFileHostMessage } from "../../wal-maintenance-BWfH3Lov.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
|
-
import { a as patchLegacyIntegrationRows, i as legacyIntegrationAddonId, n as clearLegacyIntegrationRows, o as readLegacyIntegrationRows, r as deleteLegacyIntegrationRowKeys } from "../../legacy-integration-rows-door-
|
|
6
|
+
import { a as patchLegacyIntegrationRows, i as legacyIntegrationAddonId, n as clearLegacyIntegrationRows, o as readLegacyIntegrationRows, r as deleteLegacyIntegrationRowKeys } from "../../legacy-integration-rows-door-DRC0xn6k.mjs";
|
|
7
7
|
import { createRequire } from "node:module";
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
import { randomUUID } from "node:crypto";
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* up an addon.
|
|
5
5
|
*
|
|
6
6
|
* They are the second and third locks of D296. The first is
|
|
7
|
-
*
|
|
7
|
+
* the create-time refusal, which stops the configuration from existing.
|
|
8
8
|
* These two hold for a row that predates the guard, for one written by a
|
|
9
9
|
* future code path, and for a provider that changes its own `nodeLocal`
|
|
10
10
|
* answer after a location was made.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type CustomActionsSpec } from "@camstack/types";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
/**
|
|
4
|
+
* The forced delete of a storage location (D49). `deleteInstance` keeps the occupancy refusal;
|
|
5
|
+
* this is the separate, explicit action for a location the check could not read (a removed disk,
|
|
6
|
+
* another node, a remote provider). The caller states it after a second confirmation.
|
|
7
|
+
*/
|
|
8
|
+
export declare const forceDeleteLocationInput: z.ZodType<{
|
|
9
|
+
id: string;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const storageOrchestratorActions: CustomActionsSpec;
|
|
@@ -5,3 +5,4 @@ export { StorageMigrationCoordinator } from "./storage-migration-coordinator.js"
|
|
|
5
5
|
export { StorageOrchestratorAddon, StorageOrchestratorAddon as default } from "./storage-orchestrator.addon.js";
|
|
6
6
|
export type { ListLocationsFilter, StorageProviderLookup } from "./storage-orchestrator.service.js";
|
|
7
7
|
export { StorageOrchestratorService } from "./storage-orchestrator.service.js";
|
|
8
|
+
export { storageOrchestratorActions, storageOrchestratorActions as customActions } from "./custom-actions.js";
|
|
@@ -8,4 +8,6 @@ exports.SqliteLocationStore = require_builtins_storage_orchestrator_storage_orch
|
|
|
8
8
|
exports.StorageMigrationCoordinator = require_builtins_storage_orchestrator_storage_orchestrator_addon.StorageMigrationCoordinator;
|
|
9
9
|
exports.StorageOrchestratorAddon = require_builtins_storage_orchestrator_storage_orchestrator_addon.StorageOrchestratorAddon;
|
|
10
10
|
exports.StorageOrchestratorService = require_builtins_storage_orchestrator_storage_orchestrator_addon.StorageOrchestratorService;
|
|
11
|
+
exports.customActions = require_builtins_storage_orchestrator_storage_orchestrator_addon.storageOrchestratorActions;
|
|
11
12
|
exports.default = require_builtins_storage_orchestrator_storage_orchestrator_addon.StorageOrchestratorAddon;
|
|
13
|
+
exports.storageOrchestratorActions = require_builtins_storage_orchestrator_storage_orchestrator_addon.storageOrchestratorActions;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { StorageOrchestratorAddon, c as SqliteLocationStore,
|
|
2
|
-
export { SqliteLocationStore, StorageMigrationCoordinator, StorageOrchestratorAddon, StorageOrchestratorAddon as default, StorageOrchestratorService };
|
|
1
|
+
import { StorageOrchestratorAddon, c as StorageMigrationCoordinator, l as SqliteLocationStore, n as storageOrchestratorActions, t as StorageOrchestratorService } from "./storage-orchestrator.addon.mjs";
|
|
2
|
+
export { SqliteLocationStore, StorageMigrationCoordinator, StorageOrchestratorAddon, StorageOrchestratorAddon as default, StorageOrchestratorService, storageOrchestratorActions as customActions, storageOrchestratorActions };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The storage locations as `integration-instances` (planning#440 step 6, D985, D986): one
|
|
3
|
+
* instance per location, one KIND per declared location type (`recordings`, `backups`, ...).
|
|
4
|
+
* The form is the provider select, the provider's own fields and the location's state; the
|
|
5
|
+
* credentials the provider declares go to the keychain bound to the location's record
|
|
6
|
+
* (`location-secret-refs.ts`, D879).
|
|
7
|
+
*
|
|
8
|
+
* A location keeps ONE typed state (`mode`, D385) and only `storage-location-mode.ts` reads it.
|
|
9
|
+
* The row switch maps to it: on is `active`; off is `readonly` (the write switch, D383), and a
|
|
10
|
+
* location that is already `drain` or `disabled` stays as it is. Delete keeps the occupancy
|
|
11
|
+
* refusal; the forced delete is NOT a flag here, it is the separate `forceDeleteLocation`
|
|
12
|
+
* action (D49: destructive, confirmed by a second read).
|
|
13
|
+
*
|
|
14
|
+
* The edit form is the provider's schema as it is. The create form offers every provider, so
|
|
15
|
+
* each provider's fields are namespaced `<providerId>.<key>` and shown for that provider; a
|
|
16
|
+
* `notEquals` / `notIn` condition on a select is rewritten to the options it leaves, because the
|
|
17
|
+
* selector of another provider is unset and an unset value would satisfy a negation.
|
|
18
|
+
*/
|
|
19
|
+
import { type ConfigSection, type IIntegrationInstancesProvider, type StorageLocation, type StorageLocationDeclaration } from "@camstack/types";
|
|
20
|
+
import type { StorageProviderListEntry } from "./provider-discovery.js";
|
|
21
|
+
export declare const STORAGE_INSTANCE_KIND = "storage-location";
|
|
22
|
+
export declare const STORAGE_FUNCTION_CAP = "storage";
|
|
23
|
+
/** The generic widget id the admin UI maps to its path browser. */
|
|
24
|
+
export declare const STORAGE_PATH_WIDGET = "storage/path-browser";
|
|
25
|
+
/** A probe of a remote provider waits this long; a hung host must not hang the form. */
|
|
26
|
+
export declare const LOCATION_TEST_TIMEOUT_MS = 2e4;
|
|
27
|
+
export type LocationSaveInput = Omit<StorageLocation, "createdAt" | "updatedAt">;
|
|
28
|
+
export interface LocationInstancesDeps {
|
|
29
|
+
readonly locations: () => readonly StorageLocation[];
|
|
30
|
+
readonly declarations: () => readonly StorageLocationDeclaration[];
|
|
31
|
+
readonly providers: () => Promise<readonly StorageProviderListEntry[]>;
|
|
32
|
+
/** The one save every door goes through; `clearSecrets` names the credentials to remove. */
|
|
33
|
+
readonly save: (input: LocationSaveInput, clearSecrets: readonly string[]) => Promise<StorageLocation>;
|
|
34
|
+
/** Delete with the occupancy refusal; `force` is never passed from this provider. */
|
|
35
|
+
readonly remove: (id: string) => Promise<void>;
|
|
36
|
+
/** Probe a config (markers allowed) against a provider; the addon resolves the markers. */
|
|
37
|
+
readonly probe: (providerId: string, config: Readonly<Record<string, unknown>>) => Promise<{
|
|
38
|
+
readonly ok: boolean;
|
|
39
|
+
readonly error?: string;
|
|
40
|
+
}>;
|
|
41
|
+
/** The config keys that are credentials; fails closed for an unregistered provider. */
|
|
42
|
+
readonly secretKeys: (providerId: string, config: Readonly<Record<string, unknown>>) => ReadonlySet<string>;
|
|
43
|
+
readonly testTimeoutMs?: number;
|
|
44
|
+
}
|
|
45
|
+
/** The sections a provider's `configSchema` carries; anything else is no form. */
|
|
46
|
+
export declare function providerSections(schema: unknown): readonly ConfigSection[];
|
|
47
|
+
export declare class StorageLocationInstances {
|
|
48
|
+
private readonly deps;
|
|
49
|
+
constructor(deps: LocationInstancesDeps);
|
|
50
|
+
private kinds;
|
|
51
|
+
private viewOf;
|
|
52
|
+
describe: IIntegrationInstancesProvider["describe"];
|
|
53
|
+
instanceFormSchema: IIntegrationInstancesProvider["instanceFormSchema"];
|
|
54
|
+
listInstances: IIntegrationInstancesProvider["listInstances"];
|
|
55
|
+
getInstance: IIntegrationInstancesProvider["getInstance"];
|
|
56
|
+
/**
|
|
57
|
+
* The config and credentials a form `values` object means for a provider: its own namespaced
|
|
58
|
+
* keys (create form) or plain keys (edit form), the framework numbers, nothing of another
|
|
59
|
+
* provider. `base` is the stored config; a credential kept stays as stored.
|
|
60
|
+
*/
|
|
61
|
+
private configFrom;
|
|
62
|
+
private mintId;
|
|
63
|
+
createInstance: IIntegrationInstancesProvider["createInstance"];
|
|
64
|
+
/** The whole location again, from the stored row, with `patch` on top (the save REPLACES). */
|
|
65
|
+
private rebuilt;
|
|
66
|
+
updateInstance: IIntegrationInstancesProvider["updateInstance"];
|
|
67
|
+
setInstanceEnabled: IIntegrationInstancesProvider["setInstanceEnabled"];
|
|
68
|
+
/** The occupancy refusal stays; the forced delete is the separate action. */
|
|
69
|
+
deleteInstance: IIntegrationInstancesProvider["deleteInstance"];
|
|
70
|
+
testInstance: NonNullable<IIntegrationInstancesProvider["testInstance"]>;
|
|
71
|
+
toProvider(): IIntegrationInstancesProvider;
|
|
72
|
+
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* A `multi` location moves the sanctioned way: register a second instance,
|
|
7
7
|
* drain the first, watch it empty (D386). A **singleton** cannot — the
|
|
8
|
-
* cardinality guard
|
|
8
|
+
* cardinality guard on location create refuses the second instance by
|
|
9
9
|
* declaration, so there is no destination to drain into. For those, editing
|
|
10
10
|
* the `basePath` IS the migration, and either it carries the data or the data
|
|
11
11
|
* is stranded.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a storage location's credentials live (planning#440 step 6, D879, D987).
|
|
3
|
+
*
|
|
4
|
+
* A credential is a keychain value bound to the location's OWN record: the body's `secrets` map
|
|
5
|
+
* (`secrets{password}`) is what the records door stores, so deleting the row deletes the value and
|
|
6
|
+
* one location's credential is never another's. Before this, the credential was filed under
|
|
7
|
+
* `row/storage_locations/<id>` and the row's `config` held the marker; those refs are the LEGACY
|
|
8
|
+
* ones the migration `storage-orchestrator/2026-11-07-location-secrets-to-record` moves.
|
|
9
|
+
*
|
|
10
|
+
* The in-memory location still carries a marker per credential in `config` (the orchestrator
|
|
11
|
+
* resolves it through `ctx.secrets` when a provider needs the value); the marker built here is the
|
|
12
|
+
* one the records door itself wrote, so both ends agree without a read.
|
|
13
|
+
*/
|
|
14
|
+
import { type SecretMarker } from "@camstack/types";
|
|
15
|
+
/** The addon id the records door and the keychain both file this owner's values under. */
|
|
16
|
+
export declare const STORAGE_RECORD_OWNER = "storage-orchestrator";
|
|
17
|
+
/** The record kind the locations live in (`record-kinds.ts`). */
|
|
18
|
+
export declare const LOCATIONS_RECORD_KIND = "locations";
|
|
19
|
+
/** The body field that holds the credentials, by config key. */
|
|
20
|
+
export declare const LOCATION_SECRETS_FIELD = "secrets";
|
|
21
|
+
/** The ref the records door files the credential `key` of location `id` under. */
|
|
22
|
+
export declare function locationSecretRef(id: string, key: string): string;
|
|
23
|
+
/** The marker the location carries in memory for a credential kept in its record. */
|
|
24
|
+
export declare function locationSecretMarker(id: string, key: string): SecretMarker;
|
|
25
|
+
/** Is `value` the marker of the credential `key` of location `id` kept in its own record? */
|
|
26
|
+
export declare function isOwnLocationMarker(id: string, key: string, value: unknown): boolean;
|
|
@@ -53,13 +53,33 @@ export interface ILocationStore {
|
|
|
53
53
|
*/
|
|
54
54
|
export declare const STORAGE_LOCATIONS_SECRET_SCOPE = "storage_locations";
|
|
55
55
|
/**
|
|
56
|
+
* Credentials a save carries, by config key, until the store writes the row: a value sets the
|
|
57
|
+
* credential, `null` removes it. The service persists without waiting (`upsert` is fire and
|
|
58
|
+
* forget), so the plaintext cannot ride on the location itself; it is staged here, one shot per
|
|
59
|
+
* location id, and `SqliteLocationStore.upsert` hands it to the records door with the row.
|
|
60
|
+
*/
|
|
61
|
+
export declare class LocationSecretStaging {
|
|
62
|
+
private readonly staged;
|
|
63
|
+
private readonly waiting;
|
|
64
|
+
private readonly settledBy;
|
|
65
|
+
stage(id: string, secrets: Readonly<Record<string, string | null>>): void;
|
|
66
|
+
/** The staged credentials of `id`, once; a save that was refused discards them instead. */
|
|
67
|
+
take(id: string): Readonly<Record<string, string | null>>;
|
|
68
|
+
/** The row of `id` is written (or the write failed): whoever waits for the credential may go on. */
|
|
69
|
+
written(id: string): void;
|
|
70
|
+
discard(id: string): void;
|
|
71
|
+
/** Resolves when the staged credentials of `id` are written; at once when none are staged. */
|
|
72
|
+
settled(id: string): Promise<void>;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
56
75
|
* `ILocationStore` on the storage-orchestrator's own record kinds (`locations`
|
|
57
76
|
* and `seed-markers`).
|
|
58
77
|
*/
|
|
59
78
|
export declare class SqliteLocationStore implements ILocationStore {
|
|
60
79
|
private readonly locationsKind;
|
|
61
80
|
private readonly seedMarkersKind;
|
|
62
|
-
|
|
81
|
+
readonly staging: LocationSecretStaging;
|
|
82
|
+
constructor(locationsKind: RecordKindHandle<StorageLocationBody>, seedMarkersKind: RecordKindHandle<StorageSeedMarkerBody>, staging?: LocationSecretStaging);
|
|
63
83
|
static seedMarkersOf(records: Pick<RecordsAccess, "kind">): RecordKindHandle<StorageSeedMarkerBody>;
|
|
64
84
|
loadSeededTypes(): Promise<readonly string[]>;
|
|
65
85
|
markTypeSeeded(type: string): Promise<void>;
|
|
@@ -69,5 +89,11 @@ export declare class SqliteLocationStore implements ILocationStore {
|
|
|
69
89
|
upsert(loc: StorageLocation): Promise<void>;
|
|
70
90
|
delete(id: string): Promise<void>;
|
|
71
91
|
}
|
|
72
|
-
|
|
92
|
+
/**
|
|
93
|
+
* The body a location is stored as. A credential the location keeps in its own record (the marker
|
|
94
|
+
* of `location-secret-refs.ts`) leaves `config` for `secrets`, where the records door keeps the
|
|
95
|
+
* value and the redaction token means "keep what is stored"; `staged` sets or removes one. Any
|
|
96
|
+
* other marker (a legacy ref the migration has not moved yet) stays in `config` untouched.
|
|
97
|
+
*/
|
|
98
|
+
export declare function locationToBody(loc: StorageLocation, staged?: Readonly<Record<string, string | null>>): StorageLocationBody;
|
|
73
99
|
export declare function bodyToPersistedLocation(id: string, body: StorageLocationBody): PersistedStorageLocation | null;
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import type { AddonMigration } from "@camstack/types";
|
|
2
|
+
import { type LocationSecretPorts } from "./location-secrets-to-record.js";
|
|
3
|
+
export type { LegacyLocationRow, LegacySecretRead, LocationSecretPorts, MovedLocationRow } from "./location-secrets-to-record.js";
|
|
2
4
|
export declare const STORAGE_ORCHESTRATOR_ID = "storage-orchestrator";
|
|
3
5
|
export declare const RESEED_PRUNED_DEFAULTS_ID = "storage-orchestrator/2026-11-04-reseed-pruned-defaults";
|
|
6
|
+
export declare const LOCATION_SECRETS_TO_RECORD_ID = "storage-orchestrator/2026-11-07-location-secrets-to-record";
|
|
4
7
|
/** What the repair may do: ask the service to re-create the defaults a prune removed. */
|
|
5
8
|
export interface ReseedPorts {
|
|
6
9
|
/** Re-seed every declared type whose seed marker survived the loss of all its rows; returns the types restored. */
|
|
7
10
|
reseed(): readonly string[];
|
|
8
11
|
}
|
|
9
|
-
/**
|
|
10
|
-
export
|
|
12
|
+
/** Every body of the catalogue reads through ONE port object, so the addon binds it once. */
|
|
13
|
+
export type StorageCataloguePorts = ReseedPorts & LocationSecretPorts;
|
|
14
|
+
export declare const RESEED_PRUNED_DEFAULTS_MIGRATION: AddonMigration<ReseedPorts>;
|
|
15
|
+
export declare const LOCATION_SECRETS_TO_RECORD_MIGRATION: AddonMigration<LocationSecretPorts>;
|
|
16
|
+
/** The `storage-orchestrator` catalogue (D987), declared whole every time and run by id. */
|
|
17
|
+
export declare const ADDON_MIGRATIONS: readonly AddonMigration<StorageCataloguePorts>[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The keychain refs a storage location's credentials were filed under BEFORE they moved into the
|
|
3
|
+
* location's own record (`row/storage_locations/<id>`). Only the migration
|
|
4
|
+
* `storage-orchestrator/2026-11-07-location-secrets-to-record` reads this shape.
|
|
5
|
+
*/
|
|
6
|
+
import { type SecretMarker } from "@camstack/types";
|
|
7
|
+
/** The ref a credential of `id` was filed under before the move to the record. */
|
|
8
|
+
export declare function legacyLocationSecretRef(id: string, key: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Is `value` a marker the migration has to move: a keychain marker of THIS location's legacy
|
|
11
|
+
* collection. Anything else (a record-bound marker, someone else's ref) is left alone.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isLegacyLocationMarker(id: string, value: unknown): value is SecretMarker;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ports of `location-secrets-to-record`, bound over the locations record kind and the
|
|
3
|
+
* addon's own keychain handle. Kept apart from the addon so the real-SQLite spec drives the
|
|
4
|
+
* very same code the boot runs.
|
|
5
|
+
*/
|
|
6
|
+
import type { RecordKindHandle, SecretsAccess } from "@camstack/types";
|
|
7
|
+
import type { StorageLocationBody } from "../record-kinds.js";
|
|
8
|
+
import type { LocationSecretPorts } from "./location-secrets-to-record.js";
|
|
9
|
+
export interface LocationSecretPortsDeps {
|
|
10
|
+
readonly locations: RecordKindHandle<StorageLocationBody>;
|
|
11
|
+
readonly secrets: SecretsAccess;
|
|
12
|
+
/** The running service re-reads the markers its locations carry. */
|
|
13
|
+
readonly refreshLocations: () => Promise<unknown>;
|
|
14
|
+
}
|
|
15
|
+
export declare function locationSecretPortsOver(deps: LocationSecretPortsDeps): LocationSecretPorts;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The credentials of a storage location move from `row/storage_locations/<id>` to the location's
|
|
3
|
+
* OWN record (planning#440 step 6, D879, D987). A location row kept its provider's credentials as
|
|
4
|
+
* keychain markers inside `config`, filed under a per-row collection of a table that no longer
|
|
5
|
+
* exists; they become the record's `secrets` map, which the records door keeps in the keychain
|
|
6
|
+
* bound to the row (a delete releases them, one row's value is never another's).
|
|
7
|
+
*
|
|
8
|
+
* Fails closed. Every legacy credential is RESOLVED before anything is written: a keychain that
|
|
9
|
+
* is locked, or a value that is gone, refuses the whole step and leaves every row as it was.
|
|
10
|
+
* A row is moved with ONE patch that sets `secrets` and removes the marker keys from `config`;
|
|
11
|
+
* nothing else of the row (its id, its mode, `minFreePercent`, `maxUsedGb`) is part of the patch.
|
|
12
|
+
* The moved credential is read back RESOLVED and must equal what was resolved; only then are the
|
|
13
|
+
* legacy keychain values released. A row with no legacy marker is not touched.
|
|
14
|
+
*
|
|
15
|
+
* The release is its own idempotent SWEEP, run before anything else: a hub that died between a
|
|
16
|
+
* row's patch and its release leaves a row with no legacy marker and a legacy value still in the
|
|
17
|
+
* keychain. For every row whose record carries credential K, a legacy value of K that still
|
|
18
|
+
* exists is released, once the record's own credential has been confirmed to resolve. Only when
|
|
19
|
+
* the sweep found nothing either does the step report `already-done`.
|
|
20
|
+
*/
|
|
21
|
+
import type { MigrationProcedureResult, SecretMarker } from "@camstack/types";
|
|
22
|
+
/** One location row's legacy credentials: config key to the marker that names the old ref. */
|
|
23
|
+
export interface LegacyLocationRow {
|
|
24
|
+
readonly id: string;
|
|
25
|
+
readonly legacy: Readonly<Record<string, SecretMarker>>;
|
|
26
|
+
/** The credential keys the record already carries (`secrets`), whatever their value. */
|
|
27
|
+
readonly recorded: readonly string[];
|
|
28
|
+
}
|
|
29
|
+
/** What the keychain said about one ref. */
|
|
30
|
+
export type LegacySecretRead = {
|
|
31
|
+
readonly kind: "value";
|
|
32
|
+
readonly value: string;
|
|
33
|
+
} | {
|
|
34
|
+
readonly kind: "unavailable" | "missing";
|
|
35
|
+
};
|
|
36
|
+
/** A row after the move, as the runtime reads it. */
|
|
37
|
+
export interface MovedLocationRow {
|
|
38
|
+
/** The credentials of the record, resolved. */
|
|
39
|
+
readonly secrets: Readonly<Record<string, string>>;
|
|
40
|
+
/** The keys left in `config`. */
|
|
41
|
+
readonly configKeys: readonly string[];
|
|
42
|
+
}
|
|
43
|
+
export interface LocationSecretPorts {
|
|
44
|
+
/** Every location row with the legacy markers of its config. A read that fails throws. */
|
|
45
|
+
readLegacy(): Promise<readonly LegacyLocationRow[]>;
|
|
46
|
+
/** The keychain's answer for each ref. */
|
|
47
|
+
resolveLegacy(refs: readonly string[]): Promise<ReadonlyMap<string, LegacySecretRead>>;
|
|
48
|
+
/** One patch: set `secrets` on the record and drop `keys` from its `config`. */
|
|
49
|
+
moveToRecord(id: string, secrets: Readonly<Record<string, string>>): Promise<void>;
|
|
50
|
+
/** The record after the move, credentials resolved; `null` when the row is gone. */
|
|
51
|
+
readMoved(id: string): Promise<MovedLocationRow | null>;
|
|
52
|
+
/** Remove legacy keychain values, after the move was read back. */
|
|
53
|
+
releaseLegacy(refs: readonly string[]): Promise<void>;
|
|
54
|
+
/** The running service re-reads the markers its locations carry. */
|
|
55
|
+
refreshLocations(): Promise<void>;
|
|
56
|
+
}
|
|
57
|
+
export declare function moveLocationSecretsToRecords(ports: LocationSecretPorts): Promise<MigrationProcedureResult>;
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Provider discovery — the pure
|
|
3
|
-
*
|
|
2
|
+
* Provider discovery — the pure collection behind the storage location instances' provider select
|
|
3
|
+
* and form.
|
|
4
4
|
*
|
|
5
|
-
* Walks every registered `storage-provider
|
|
6
|
-
*
|
|
7
|
-
* `
|
|
8
|
-
*
|
|
9
|
-
* individual providers are isolated via `onError` — a single misbehaving
|
|
10
|
-
* driver never denies the whole list.
|
|
5
|
+
* Walks every registered `storage-provider` and collects each one's `getProviderInfo()` blob (its
|
|
6
|
+
* config schema and the intrinsic disk-space policy fields `shouldSaveDiskSpace` +
|
|
7
|
+
* `minFreePercent`). Errors from individual providers are isolated via `onError` — a single
|
|
8
|
+
* misbehaving driver never denies the whole list.
|
|
11
9
|
*
|
|
12
|
-
* Extracted from the addon
|
|
13
|
-
* without booting a `BaseAddon`.
|
|
10
|
+
* Extracted from the addon so the collection is unit-testable without booting a `BaseAddon`.
|
|
14
11
|
*/
|
|
15
|
-
import type {
|
|
16
|
-
/** One
|
|
17
|
-
export type StorageProviderListEntry = Awaited<ReturnType<
|
|
12
|
+
import type { IStorageProviderImpl } from "@camstack/types";
|
|
13
|
+
/** One provider's `getProviderInfo()` answer. */
|
|
14
|
+
export type StorageProviderListEntry = Awaited<ReturnType<IStorageProviderImpl["getProviderInfo"]>>;
|
|
18
15
|
/**
|
|
19
16
|
* Callback invoked when a provider's `getProviderInfo()` throws. The array
|
|
20
17
|
* `index` is passed so the orchestrator can identify which provider failed —
|
|
@@ -15,6 +15,12 @@ export type StorageLocationBody = {
|
|
|
15
15
|
readonly enabled?: boolean;
|
|
16
16
|
readonly mode?: z.infer<typeof StorageLocationModeSchema>;
|
|
17
17
|
readonly isDefault?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* The provider's credentials by config key (`password`, `privateKey`, ...), kept in the keychain
|
|
20
|
+
* and bound to THIS row: the records door stores the value and deleting the row deletes it.
|
|
21
|
+
* A location read back puts each one into `config` as a marker (`location-secret-refs.ts`).
|
|
22
|
+
*/
|
|
23
|
+
readonly secrets?: Record<string, string>;
|
|
18
24
|
};
|
|
19
25
|
export declare const StorageLocationBodySchema: z.ZodType<StorageLocationBody>;
|
|
20
26
|
export type StorageSeedMarkerBody = {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AddonInitResult, StorageLocation } from "@camstack/types";
|
|
2
2
|
import { BaseAddon } from "@camstack/types";
|
|
3
|
+
import { storageOrchestratorActions } from "./custom-actions.js";
|
|
3
4
|
interface StorageOrchestratorConfig extends Record<string, unknown> {}
|
|
4
5
|
export declare class StorageOrchestratorAddon extends BaseAddon<StorageOrchestratorConfig> {
|
|
5
6
|
private locationsKind;
|
|
@@ -46,6 +47,8 @@ export declare class StorageOrchestratorAddon extends BaseAddon<StorageOrchestra
|
|
|
46
47
|
* is readable through a provider the orchestrator can otherwise use.
|
|
47
48
|
*/
|
|
48
49
|
private readonly secretKeysByProvider;
|
|
50
|
+
/** Credentials of a save on their way to the location's record (`LocationSecretStaging`). */
|
|
51
|
+
private readonly secretStaging;
|
|
49
52
|
/**
|
|
50
53
|
* Disposers run on `onShutdown` — currently the eventBus subscription
|
|
51
54
|
* for `capability:provider-registered` events used by the lazy seed
|
|
@@ -54,7 +57,9 @@ export declare class StorageOrchestratorAddon extends BaseAddon<StorageOrchestra
|
|
|
54
57
|
*/
|
|
55
58
|
private readonly seedSubscriptionDisposers;
|
|
56
59
|
constructor();
|
|
57
|
-
protected onInitialize(): Promise<
|
|
60
|
+
protected onInitialize(): Promise<AddonInitResult<typeof storageOrchestratorActions>>;
|
|
61
|
+
/** Delete a location; the occupancy refusal stands unless `force` was stated. */
|
|
62
|
+
private removeLocation;
|
|
58
63
|
/**
|
|
59
64
|
* The remote behind the data door on a node that owns no engine.
|
|
60
65
|
*
|
|
@@ -197,14 +202,26 @@ export declare class StorageOrchestratorAddon extends BaseAddon<StorageOrchestra
|
|
|
197
202
|
* ref; the provider then fails its own connection, by name.
|
|
198
203
|
*/
|
|
199
204
|
private withResolvedSecrets;
|
|
205
|
+
/** `config` with every keychain marker resolved; the same object when it holds none. */
|
|
206
|
+
private resolvedConfig;
|
|
200
207
|
/**
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
208
|
+
* Save one location the way every door does (the legacy `upsertLocation` and the instance
|
|
209
|
+
* provider): the sentinel travelling back in means "keep the stored secret", the provider's
|
|
210
|
+
* declared credentials are staged for the location's own record (D787, never the row's
|
|
211
|
+
* `config`), a SINGLETON that changes root carries its bytes, and the change is announced.
|
|
212
|
+
* Returns the saved location with its markers; the callers redact it.
|
|
206
213
|
*/
|
|
207
|
-
|
|
214
|
+
saveLocation(input: Omit<StorageLocation, "createdAt" | "updatedAt">, clearSecrets?: readonly string[]): Promise<StorageLocation>;
|
|
215
|
+
/** The record write of a save that staged a credential is awaited, bounded: a hung store must not hang the save. */
|
|
216
|
+
private persistedWithin;
|
|
217
|
+
/**
|
|
218
|
+
* Split the credentials of an incoming config from the rest (D787). A declared secret key with a
|
|
219
|
+
* new value is STAGED (the records door stores it with the row) and the location carries the
|
|
220
|
+
* marker of its own record; a key that is absent, empty or already a marker keeps what is stored;
|
|
221
|
+
* `clear` removes it. A provider that has not registered declares nothing: a new plaintext is
|
|
222
|
+
* never guessed at, it stays as sent until the provider is back and the location is saved.
|
|
223
|
+
*/
|
|
224
|
+
private prepareLocationSecrets;
|
|
208
225
|
private redacted;
|
|
209
226
|
/**
|
|
210
227
|
* Is this location backed by a provider that serves a genuine local
|
|
@@ -324,6 +341,20 @@ export declare class StorageOrchestratorAddon extends BaseAddon<StorageOrchestra
|
|
|
324
341
|
*/
|
|
325
342
|
private repairPrunedDefaults;
|
|
326
343
|
/**
|
|
344
|
+
* Every port of the catalogue, bound once. The reseed port only answers inside the seed pass
|
|
345
|
+
* (it needs the declarations); the credential ports need the hub's records and keychain, so
|
|
346
|
+
* a node without them runs neither step.
|
|
347
|
+
*/
|
|
348
|
+
private cataloguePorts;
|
|
349
|
+
private secretsMoveDone;
|
|
350
|
+
private secretsMoveRunning;
|
|
351
|
+
/**
|
|
352
|
+
* D987: move the credentials of every location from the per-row keychain refs into the
|
|
353
|
+
* location's own record. Runs once the persisted rows are loaded; a refusal (keychain locked,
|
|
354
|
+
* a value gone) leaves every row as it was and the next seed pass asks again.
|
|
355
|
+
*/
|
|
356
|
+
private moveLocationSecrets;
|
|
357
|
+
/**
|
|
327
358
|
* Alert when a declared type has nowhere to write. Runs after every seed pass
|
|
328
359
|
* and every change to the set of locations; a no-op until a pass has an
|
|
329
360
|
* answered state AND the kernel could list its declarers (D315).
|