@camstack/server 1.2.778 → 1.2.780
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 +21 -0
- package/dist/agent/main.js +5 -1
- package/dist/agent/stale-addon-gate.js +52 -15
- package/dist/api/addon-upload.js +41 -0
- package/dist/api/core/cap-providers.js +19 -29
- package/dist/api/core/integration-role.js +15 -2
- package/dist/api/tarball-manifest.js +10 -1
- package/dist/api/trpc/generated-cap-mounts.js +1 -9
- package/dist/api/trpc/generated-cap-routers.js +9 -88
- package/dist/core/addon/addon-package.service.js +24 -8
- package/dist/core/addon/addon-registry.service.js +61 -10
- package/dist/core/addon/hub-spawn-gate.js +92 -0
- package/dist/core/addon/integration-instances-provider.js +22 -0
- package/dist/core/agent/agent-registry.service.js +6 -2
- package/dist/core/agent/delivery-requirements.js +22 -6
- package/dist/core/updates/required-addon-update.js +188 -0
- package/dist/launcher.js +4 -0
- package/dist/manual-boot.js +27 -0
- package/dist/server-root/index.js +74 -3
- package/package.json +33 -11
- package/system/dist/addon-runner.js +179 -4
- package/system/dist/addon-runner.mjs +180 -5
- package/system/dist/{agent-https-DnEHxqTM.js → agent-https-A9wsxVGn.js} +1 -1
- package/system/dist/{agent-https-DjiLJBkD.mjs → agent-https-DuxDC67S.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.js +1 -1
- package/system/dist/builtins/alerts/alerts.addon.mjs +1 -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 +3 -3
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +3 -3
- 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 +6 -3
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +6 -3
- 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/migrations/installed-runner-resolver.d.ts +7 -0
- package/system/dist/builtins/sqlite-storage/migrations/migrations-provider.d.ts +10 -3
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +38 -9
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +38 -9
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/system-config/system-config.addon.js +3 -3
- package/system/dist/builtins/system-config/system-config.addon.mjs +3 -3
- package/system/dist/builtins/winston-logging/index.js +1 -1
- package/system/dist/builtins/winston-logging/index.mjs +1 -1
- package/system/dist/{capture-engine-dY1enbrF.mjs → capture-engine-CEChNpAD.mjs} +1 -1
- package/system/dist/{capture-engine-DW3Tts4M.js → capture-engine-D6mXfLFQ.js} +1 -1
- package/system/dist/{composition-sources-Ckz1nky_.mjs → composition-sources-6XYW86Kw.mjs} +1 -1
- package/system/dist/{composition-sources-Y_vIrdLy.js → composition-sources-cVWKVph4.js} +1 -1
- package/system/dist/{constants-Bbu5TQF_.js → constants-B5Yg02ii.js} +1 -1
- package/system/dist/{constants-9sQvihXt.mjs → constants-DqwDEYfb.mjs} +1 -1
- package/system/dist/{device-ca-CbuTkPXx.js → device-ca-BVz14dRd.js} +1 -1
- package/system/dist/{device-ca-2dQqY2z0.mjs → device-ca-oY4Xqd7s.mjs} +1 -1
- package/system/dist/{dist-D3StiAs2.js → dist-B4wrqheM.js} +850 -635
- package/system/dist/{dist-CV4RPML4.mjs → dist-BX8nZeXV.mjs} +821 -636
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-mdns-ciao-BlxgXzRs.mjs → hub-mdns-ciao-BDPMfOgq.mjs} +2 -2
- package/system/dist/{hub-mdns-ciao-BJaeVvId.js → hub-mdns-ciao-CiMMA0rT.js} +2 -2
- package/system/dist/index.js +418 -16
- package/system/dist/index.mjs +413 -18
- package/system/dist/kernel/addon-installer.d.ts +44 -1
- package/system/dist/kernel/held-installs.d.ts +21 -0
- package/system/dist/kernel/index.d.ts +6 -0
- package/system/dist/kernel/moleculer/migration-api-facade.d.ts +73 -0
- package/system/dist/kernel/requires-registry.d.ts +31 -0
- package/system/dist/kernel/transport/acting-addon.d.ts +1 -1
- package/system/dist/{legacy-integration-rows-door-CUeUZHro.mjs → legacy-integration-rows-door-DDA3YOxL.mjs} +1 -1
- package/system/dist/{legacy-integration-rows-door-BqtcbHNX.js → legacy-integration-rows-door-YuWqHZW4.js} +1 -1
- package/system/dist/migrations/hub/__fixtures__/seed.d.ts +23 -0
- package/system/dist/{restore-archive-C4r-C6Hj.mjs → restore-archive-BrtpgNCt.mjs} +1 -1
- package/system/dist/{restore-archive-DM-QSOiY.js → restore-archive-Cn9OShm4.js} +1 -1
- package/system/dist/{wal-maintenance-1dP8IFlA.js → wal-maintenance-BTzu3s-6.js} +0 -0
- package/system/dist/{wal-maintenance-sPn0MLRB.mjs → wal-maintenance-jgyV9NbL.mjs} +0 -0
- package/system/package.json +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* The `migrations` provider (D987): a thin face over the {@link MigrationEngine}.
|
|
3
3
|
* The engine is the authority; this only shapes its answers to the cap.
|
|
4
4
|
*/
|
|
5
|
-
import type
|
|
5
|
+
import { type DataStoreDatabase, type IMigrationsProvider, type MigrationDryRunResult, type MigrationLedgerEntry, type MigrationMeta, type MigrationOwnerResult, type MigrationOwnerStep, type MigrationPendingEntry, type MigrationStatus } from "@camstack/types";
|
|
6
6
|
import type { MigrationEngine } from "./migration-engine.js";
|
|
7
7
|
import type { MigrationDatabase } from "./migration-types.js";
|
|
8
8
|
/**
|
|
@@ -12,6 +12,8 @@ import type { MigrationDatabase } from "./migration-types.js";
|
|
|
12
12
|
export interface LegacyIntegrationRowsDoor {
|
|
13
13
|
readonly database: () => MigrationDatabase | null;
|
|
14
14
|
readonly runnerIdOf: (owner: string) => string;
|
|
15
|
+
/** Whether two addons are declared by one installed package (one trust unit). */
|
|
16
|
+
readonly areSiblings?: (a: string, b: string) => boolean;
|
|
15
17
|
}
|
|
16
18
|
export declare class MigrationsProvider implements IMigrationsProvider {
|
|
17
19
|
private readonly engine;
|
|
@@ -19,8 +21,9 @@ export declare class MigrationsProvider implements IMigrationsProvider {
|
|
|
19
21
|
constructor(engine: MigrationEngine, legacyRows?: LegacyIntegrationRowsDoor | null);
|
|
20
22
|
private settingsDatabase;
|
|
21
23
|
/**
|
|
22
|
-
* The integration's own addon,
|
|
23
|
-
*
|
|
24
|
+
* The integration's own addon, the runner that hosts it, or an addon of the
|
|
25
|
+
* same package (a sibling is one trust unit, whether or not it shares a runner).
|
|
26
|
+
* An integration that is already gone has nothing to refuse.
|
|
24
27
|
*/
|
|
25
28
|
private assertLegacyCaller;
|
|
26
29
|
listLedger(): Promise<{
|
|
@@ -50,6 +53,10 @@ export declare class MigrationsProvider implements IMigrationsProvider {
|
|
|
50
53
|
bootId: string;
|
|
51
54
|
snapshot: "none" | "written" | "refused";
|
|
52
55
|
steps: MigrationOwnerStep[];
|
|
56
|
+
migrationApi: {
|
|
57
|
+
version: number;
|
|
58
|
+
methods: string[];
|
|
59
|
+
};
|
|
53
60
|
}>;
|
|
54
61
|
startMigration(input: {
|
|
55
62
|
id: string;
|
|
@@ -3,12 +3,12 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-B4wrqheM.js");
|
|
7
7
|
const require_retired_settings_keys = require("../../retired-settings-keys-C8nOOr5H.js");
|
|
8
|
-
const require_wal_maintenance = require("../../wal-maintenance-
|
|
8
|
+
const require_wal_maintenance = require("../../wal-maintenance-BTzu3s-6.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
|
-
const require_legacy_integration_rows_door = require("../../legacy-integration-rows-door-
|
|
11
|
+
const require_legacy_integration_rows_door = require("../../legacy-integration-rows-door-YuWqHZW4.js");
|
|
12
12
|
let zod = require("zod");
|
|
13
13
|
let node_crypto = require("node:crypto");
|
|
14
14
|
let node_fs_promises = require("node:fs/promises");
|
|
@@ -1174,6 +1174,22 @@ function declarationsIn(dir) {
|
|
|
1174
1174
|
return [];
|
|
1175
1175
|
}
|
|
1176
1176
|
}
|
|
1177
|
+
/**
|
|
1178
|
+
* Whether two addons are declared by the same installed package. Sibling addons
|
|
1179
|
+
* of one package are one trust unit: they ship together, are versioned together
|
|
1180
|
+
* and one reads the rows the other's package wrote. An addon that is not
|
|
1181
|
+
* installed (a builtin, a stranger) is a sibling of nobody.
|
|
1182
|
+
*/
|
|
1183
|
+
function installedSiblingResolver(addonsDir) {
|
|
1184
|
+
return (a, b) => {
|
|
1185
|
+
if (a === b) return true;
|
|
1186
|
+
for (const dir of packageDirs(addonsDir)) {
|
|
1187
|
+
const ids = declarationsIn(dir).map((entry) => entry.id);
|
|
1188
|
+
if (ids.includes(a) && ids.includes(b)) return true;
|
|
1189
|
+
}
|
|
1190
|
+
return false;
|
|
1191
|
+
};
|
|
1192
|
+
}
|
|
1177
1193
|
function installedRunnerResolver(addonsDir) {
|
|
1178
1194
|
return (addonId) => {
|
|
1179
1195
|
for (const dir of packageDirs(addonsDir)) for (const { id, decl } of declarationsIn(dir)) if (id === addonId) return require_dist.resolveRunnerId(decl, addonId);
|
|
@@ -1899,6 +1915,10 @@ async function scheduleMigrationRestore(dataRoot, request) {
|
|
|
1899
1915
|
//#endregion
|
|
1900
1916
|
//#region src/builtins/sqlite-storage/migrations/migrations-provider.ts
|
|
1901
1917
|
/**
|
|
1918
|
+
* The `migrations` provider (D987): a thin face over the {@link MigrationEngine}.
|
|
1919
|
+
* The engine is the authority; this only shapes its answers to the cap.
|
|
1920
|
+
*/
|
|
1921
|
+
/**
|
|
1902
1922
|
* The addon the transport stamped on the call (`callerAddonId`, never in an input
|
|
1903
1923
|
* schema, stripped from an HTTP/WS request); `null` for an unstamped call.
|
|
1904
1924
|
*/
|
|
@@ -1919,15 +1939,17 @@ var MigrationsProvider = class {
|
|
|
1919
1939
|
return db;
|
|
1920
1940
|
}
|
|
1921
1941
|
/**
|
|
1922
|
-
* The integration's own addon,
|
|
1923
|
-
*
|
|
1942
|
+
* The integration's own addon, the runner that hosts it, or an addon of the
|
|
1943
|
+
* same package (a sibling is one trust unit, whether or not it shares a runner).
|
|
1944
|
+
* An integration that is already gone has nothing to refuse.
|
|
1924
1945
|
*/
|
|
1925
1946
|
assertLegacyCaller(integrationId, caller) {
|
|
1926
1947
|
const db = this.settingsDatabase();
|
|
1927
1948
|
const owner = require_legacy_integration_rows_door.legacyIntegrationAddonId(db, integrationId);
|
|
1928
1949
|
if (owner === null) return db;
|
|
1929
1950
|
const runner = this.legacyRows?.runnerIdOf(owner) ?? owner;
|
|
1930
|
-
|
|
1951
|
+
const sibling = caller !== null && (this.legacyRows?.areSiblings?.(owner, caller) ?? false);
|
|
1952
|
+
if (caller === null || caller !== owner && caller !== runner && !sibling) throw new Error(`legacy integration rows of "${integrationId}" are migration-only — caller "${caller ?? ""}" is not "${owner}"`);
|
|
1931
1953
|
return db;
|
|
1932
1954
|
}
|
|
1933
1955
|
async listLedger() {
|
|
@@ -1948,7 +1970,11 @@ var MigrationsProvider = class {
|
|
|
1948
1970
|
declareOwner(input) {
|
|
1949
1971
|
return this.engine.declareOwner(input.owner, input.metas, callerOf(input)).then((out) => ({
|
|
1950
1972
|
...out,
|
|
1951
|
-
steps: [...out.steps]
|
|
1973
|
+
steps: [...out.steps],
|
|
1974
|
+
migrationApi: {
|
|
1975
|
+
version: 1,
|
|
1976
|
+
methods: Object.keys(require_dist.MIGRATION_API_V1_METHODS)
|
|
1977
|
+
}
|
|
1952
1978
|
}));
|
|
1953
1979
|
}
|
|
1954
1980
|
startMigration(input) {
|
|
@@ -2868,7 +2894,9 @@ var SqliteSettingsAddon = class extends require_dist.BaseAddon {
|
|
|
2868
2894
|
dbPath: settingsPath
|
|
2869
2895
|
} });
|
|
2870
2896
|
this.ctx.logger.info("DB file status", { meta: { dbExists } });
|
|
2871
|
-
const
|
|
2897
|
+
const installedAddonsDir = node_path.default.join(this.ctx.nodeDataDir ?? node_path.default.resolve(dir, "..", ".."), "addons");
|
|
2898
|
+
const runnerIdOf = runnerResolverFor(this.ctx.kernel?.runnerIdForAddon, installedAddonsDir);
|
|
2899
|
+
const areSiblings = installedSiblingResolver(installedAddonsDir);
|
|
2872
2900
|
const engine = new MigrationEngine({
|
|
2873
2901
|
logger: this.ctx.logger.child("Migrations"),
|
|
2874
2902
|
catalogue: require_wal_maintenance.HUB_MIGRATIONS,
|
|
@@ -2946,7 +2974,8 @@ var SqliteSettingsAddon = class extends require_dist.BaseAddon {
|
|
|
2946
2974
|
capability: require_dist.migrationsCapability,
|
|
2947
2975
|
provider: new MigrationsProvider(engine, {
|
|
2948
2976
|
database: () => settings.backend.getDatabase(),
|
|
2949
|
-
runnerIdOf
|
|
2977
|
+
runnerIdOf,
|
|
2978
|
+
areSiblings
|
|
2950
2979
|
})
|
|
2951
2980
|
}
|
|
2952
2981
|
],
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $n as databaseSnapshotCapability, $o as RecordKindDeclarationSchema, Ao as BaseAddon, Bo as InvalidRecordError, Cs as defineCustomActions, Et as MigrationMetaSchema, Ga as vectorStoreCapability, Gi as recordsCapability, Io as DeclarationRefusedError, M as DATABASE_SNAPSHOT_SUFFIX, Mn as catalogueIssues, N as DATABASE_SNAPSHOT_TIMEOUT_MS, P as DATA_STORE_DATABASES, Qn as dataStoreProviderCapability, Vo as NoCallerError, Xo as RUNTIME_DEFAULTS, Ys as normalizeSecretOwner, _c as EventCategory, _i as migrationsCapability, bn as bareAddonId, cs as UnknownRecordKindError, gc as errMsg$1, j as DATABASE_SNAPSHOT_PARTIAL_SUFFIX, ki as orderMigrations, oa as resolveRunnerId, os as TransactRefusedError, qo as RECORD_SWEEP_INTERVAL_MS, vs as collectSecretMarkerRefs, wa as storageAdminCapability, xs as customAction, xt as MIGRATION_API_V1_METHODS } from "../../dist-BX8nZeXV.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-jgyV9NbL.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-DDA3YOxL.mjs";
|
|
7
7
|
import { createRequire } from "node:module";
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
import { randomUUID } from "node:crypto";
|
|
@@ -1168,6 +1168,22 @@ function declarationsIn(dir) {
|
|
|
1168
1168
|
return [];
|
|
1169
1169
|
}
|
|
1170
1170
|
}
|
|
1171
|
+
/**
|
|
1172
|
+
* Whether two addons are declared by the same installed package. Sibling addons
|
|
1173
|
+
* of one package are one trust unit: they ship together, are versioned together
|
|
1174
|
+
* and one reads the rows the other's package wrote. An addon that is not
|
|
1175
|
+
* installed (a builtin, a stranger) is a sibling of nobody.
|
|
1176
|
+
*/
|
|
1177
|
+
function installedSiblingResolver(addonsDir) {
|
|
1178
|
+
return (a, b) => {
|
|
1179
|
+
if (a === b) return true;
|
|
1180
|
+
for (const dir of packageDirs(addonsDir)) {
|
|
1181
|
+
const ids = declarationsIn(dir).map((entry) => entry.id);
|
|
1182
|
+
if (ids.includes(a) && ids.includes(b)) return true;
|
|
1183
|
+
}
|
|
1184
|
+
return false;
|
|
1185
|
+
};
|
|
1186
|
+
}
|
|
1171
1187
|
function installedRunnerResolver(addonsDir) {
|
|
1172
1188
|
return (addonId) => {
|
|
1173
1189
|
for (const dir of packageDirs(addonsDir)) for (const { id, decl } of declarationsIn(dir)) if (id === addonId) return resolveRunnerId(decl, addonId);
|
|
@@ -1892,6 +1908,10 @@ async function scheduleMigrationRestore(dataRoot, request) {
|
|
|
1892
1908
|
//#endregion
|
|
1893
1909
|
//#region src/builtins/sqlite-storage/migrations/migrations-provider.ts
|
|
1894
1910
|
/**
|
|
1911
|
+
* The `migrations` provider (D987): a thin face over the {@link MigrationEngine}.
|
|
1912
|
+
* The engine is the authority; this only shapes its answers to the cap.
|
|
1913
|
+
*/
|
|
1914
|
+
/**
|
|
1895
1915
|
* The addon the transport stamped on the call (`callerAddonId`, never in an input
|
|
1896
1916
|
* schema, stripped from an HTTP/WS request); `null` for an unstamped call.
|
|
1897
1917
|
*/
|
|
@@ -1912,15 +1932,17 @@ var MigrationsProvider = class {
|
|
|
1912
1932
|
return db;
|
|
1913
1933
|
}
|
|
1914
1934
|
/**
|
|
1915
|
-
* The integration's own addon,
|
|
1916
|
-
*
|
|
1935
|
+
* The integration's own addon, the runner that hosts it, or an addon of the
|
|
1936
|
+
* same package (a sibling is one trust unit, whether or not it shares a runner).
|
|
1937
|
+
* An integration that is already gone has nothing to refuse.
|
|
1917
1938
|
*/
|
|
1918
1939
|
assertLegacyCaller(integrationId, caller) {
|
|
1919
1940
|
const db = this.settingsDatabase();
|
|
1920
1941
|
const owner = legacyIntegrationAddonId(db, integrationId);
|
|
1921
1942
|
if (owner === null) return db;
|
|
1922
1943
|
const runner = this.legacyRows?.runnerIdOf(owner) ?? owner;
|
|
1923
|
-
|
|
1944
|
+
const sibling = caller !== null && (this.legacyRows?.areSiblings?.(owner, caller) ?? false);
|
|
1945
|
+
if (caller === null || caller !== owner && caller !== runner && !sibling) throw new Error(`legacy integration rows of "${integrationId}" are migration-only — caller "${caller ?? ""}" is not "${owner}"`);
|
|
1924
1946
|
return db;
|
|
1925
1947
|
}
|
|
1926
1948
|
async listLedger() {
|
|
@@ -1941,7 +1963,11 @@ var MigrationsProvider = class {
|
|
|
1941
1963
|
declareOwner(input) {
|
|
1942
1964
|
return this.engine.declareOwner(input.owner, input.metas, callerOf(input)).then((out) => ({
|
|
1943
1965
|
...out,
|
|
1944
|
-
steps: [...out.steps]
|
|
1966
|
+
steps: [...out.steps],
|
|
1967
|
+
migrationApi: {
|
|
1968
|
+
version: 1,
|
|
1969
|
+
methods: Object.keys(MIGRATION_API_V1_METHODS)
|
|
1970
|
+
}
|
|
1945
1971
|
}));
|
|
1946
1972
|
}
|
|
1947
1973
|
startMigration(input) {
|
|
@@ -2861,7 +2887,9 @@ var SqliteSettingsAddon = class extends BaseAddon {
|
|
|
2861
2887
|
dbPath: settingsPath
|
|
2862
2888
|
} });
|
|
2863
2889
|
this.ctx.logger.info("DB file status", { meta: { dbExists } });
|
|
2864
|
-
const
|
|
2890
|
+
const installedAddonsDir = path.join(this.ctx.nodeDataDir ?? path.resolve(dir, "..", ".."), "addons");
|
|
2891
|
+
const runnerIdOf = runnerResolverFor(this.ctx.kernel?.runnerIdForAddon, installedAddonsDir);
|
|
2892
|
+
const areSiblings = installedSiblingResolver(installedAddonsDir);
|
|
2865
2893
|
const engine = new MigrationEngine({
|
|
2866
2894
|
logger: this.ctx.logger.child("Migrations"),
|
|
2867
2895
|
catalogue: HUB_MIGRATIONS,
|
|
@@ -2939,7 +2967,8 @@ var SqliteSettingsAddon = class extends BaseAddon {
|
|
|
2939
2967
|
capability: migrationsCapability,
|
|
2940
2968
|
provider: new MigrationsProvider(engine, {
|
|
2941
2969
|
database: () => settings.backend.getDatabase(),
|
|
2942
|
-
runnerIdOf
|
|
2970
|
+
runnerIdOf,
|
|
2971
|
+
areSiblings
|
|
2943
2972
|
})
|
|
2944
2973
|
}
|
|
2945
2974
|
],
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-B4wrqheM.js");
|
|
7
7
|
const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
|
|
8
8
|
let zod = require("zod");
|
|
9
9
|
let node_crypto = require("node:crypto");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $
|
|
1
|
+
import { $t as StorageLocationTypeSchema, Ao as BaseAddon, Ea as storageMigrationCapability, Ja as withLocationMode, Jo as REDACTED_SECRET, Js as normalizeNodeId, Kr as isLocationEnabled, Mr as gbToBytes, Qt as StorageLocationModeSchema, Ss as defineAddonMigrations, Ta as storageCapability, Ts as defineRecordKinds, Vs as isSecretMarker, Xs as parseJsonObject, Zt as StorageCleanupJobSchema, _c as EventCategory, br as evictionPolicyOfLocation, di as mayWriteToLocation, ei as legacyModeOf, en as StorageMigrationJobSchema, gs as collectSecretConfigKeys, ha as settingsStoreCapability, ic as secretTreeFromPaths, na as resolveLocationMode, nc as resolveSecretMarkers, uc as transformSecretWrite, ui as mayReadLocation, vi as modeMayWrite, yt as LegacyStorageLocationDefaultSchema } from "../../dist-BX8nZeXV.mjs";
|
|
2
2
|
import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
@@ -3,11 +3,11 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-B4wrqheM.js");
|
|
7
7
|
const require_safe_buffer$1 = require("../../safe-buffer-D3aoa-7X.js");
|
|
8
8
|
const require_x509_es = require("../../x509.es-WtnRNyYS.js");
|
|
9
|
-
const require_agent_https = require("../../agent-https-
|
|
10
|
-
const require_constants$8 = require("../../constants-
|
|
9
|
+
const require_agent_https = require("../../agent-https-A9wsxVGn.js");
|
|
10
|
+
const require_constants$8 = require("../../constants-B5Yg02ii.js");
|
|
11
11
|
const require_src$1 = require("../../src-CnAqG6EF.js");
|
|
12
12
|
let zod = require("zod");
|
|
13
13
|
let node_crypto = require("node:crypto");
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM, r as __exportAll, t as __commonJSMin } from "../../chunk-CNf5ZN-e.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { Ao as BaseAddon, Cs as defineCustomActions, Ns as hydrateSchema, Yt as ServerNameSchema, gc as errMsg, xs as customAction, ya as shortHostname } from "../../dist-BX8nZeXV.mjs";
|
|
3
3
|
import { t as require_safe_buffer } from "../../safe-buffer-B1OjL1I9.mjs";
|
|
4
4
|
import { C as backdatedNotBefore, S as withUtcTimeEncoding, a as KeyUsageFlags, c as Pkcs10CertificateRequest, d as SubjectKeyIdentifierExtension, f as X509Certificate$1, l as Pkcs10CertificateRequestGenerator, m as cryptoProvider, n as BasicConstraintsExtension, o as KeyUsagesExtension, p as X509CertificateGenerator, r as ExtendedKeyUsageExtension, s as PemConverter, t as AuthorityKeyIdentifierExtension } from "../../x509.es-BRiJgOvu.mjs";
|
|
5
|
-
import { B as setProcessAgentHttpsNames, I as AGENT_HTTPS_NAMES_COLLECTION, L as AGENT_HTTPS_NAMES_COLUMNS, M as isLocalOnlyHostname, R as AgentHttpsNames, V as systemConfigRecordKinds, u as isPrivateAddress, z as getProcessAgentHttpsNames } from "../../agent-https-
|
|
6
|
-
import { a as MESH_CA_KEY_REF, c as SERVER_AUTH_OID, i as MESH_CA_FIELD, n as DEFAULT_HUB_TLS_TCP_PORT, o as MESH_CA_SETTINGS_KEY, r as MESH_CA_COMMON_NAME, s as MESH_CA_VALIDITY_DAYS, t as CLIENT_AUTH_OID } from "../../constants-
|
|
5
|
+
import { B as setProcessAgentHttpsNames, I as AGENT_HTTPS_NAMES_COLLECTION, L as AGENT_HTTPS_NAMES_COLUMNS, M as isLocalOnlyHostname, R as AgentHttpsNames, V as systemConfigRecordKinds, u as isPrivateAddress, z as getProcessAgentHttpsNames } from "../../agent-https-DuxDC67S.mjs";
|
|
6
|
+
import { a as MESH_CA_KEY_REF, c as SERVER_AUTH_OID, i as MESH_CA_FIELD, n as DEFAULT_HUB_TLS_TCP_PORT, o as MESH_CA_SETTINGS_KEY, r as MESH_CA_COMMON_NAME, s as MESH_CA_VALIDITY_DAYS, t as CLIENT_AUTH_OID } from "../../constants-DqwDEYfb.mjs";
|
|
7
7
|
import { t as require_src } from "../../src-hG4grMU4.mjs";
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
import { X509Certificate, createHash, createPrivateKey, randomBytes, randomInt, sign, timingSafeEqual, verify, webcrypto } from "node:crypto";
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-B4wrqheM.js");
|
|
7
7
|
const require_formatter = require("../../formatter-xbxeV4GD.js");
|
|
8
8
|
const require_log_file_read_protocol = require("../../log-file-read-protocol-D0WcLbIV.js");
|
|
9
9
|
let node_path = require("node:path");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ao as BaseAddon, si as logDestinationCapability } from "../../dist-BX8nZeXV.mjs";
|
|
2
2
|
import { t as formatLogLine } from "../../formatter-DkYZ4LXp.mjs";
|
|
3
3
|
import { a as LogFileIndexStore, i as serveRead, n as isFromReader, t as CancelBook } from "../../log-file-read-protocol-B7M3X3bT.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { hc as DeviceType, js as historyItemFieldPath, zo as HISTORY_DEFAULT_MIN_INTERVAL_MS } from "./dist-BX8nZeXV.mjs";
|
|
2
2
|
//#region src/builtins/device-history/store/series-registry.ts
|
|
3
3
|
function subjectIdOf(subject) {
|
|
4
4
|
return subject.kind === "device" ? `d:${subject.deviceId}` : `n:${subject.nodeId}`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_dist = require("./dist-
|
|
1
|
+
const require_dist = require("./dist-B4wrqheM.js");
|
|
2
2
|
//#region src/builtins/device-history/store/series-registry.ts
|
|
3
3
|
function subjectIdOf(subject) {
|
|
4
4
|
return subject.kind === "device" ? `d:${subject.deviceId}` : `n:${subject.nodeId}`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { fo as compositionSourceKey, gc as errMsg } from "./dist-BX8nZeXV.mjs";
|
|
2
2
|
//#region src/builtins/shared/device-state-changed.ts
|
|
3
3
|
/** Structural narrowing helper for untrusted bus payloads. */
|
|
4
4
|
function isRecord(value) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** `secret://system/global/meshCaKey` — EC P-256 PKCS#8 PEM of the hub mesh CA. */
|
|
2
|
-
var MESH_CA_KEY_REF = require("./dist-
|
|
2
|
+
var MESH_CA_KEY_REF = require("./dist-B4wrqheM.js").buildSecretRef({
|
|
3
3
|
owner: "system",
|
|
4
4
|
scope: { kind: "global" },
|
|
5
5
|
fieldPath: "meshCaKey"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as DEVICE_SAN_CREDENTIAL_PREFIX, U as DEVICE_SAN_USER_PREFIX,
|
|
1
|
+
import { H as DEVICE_SAN_CREDENTIAL_PREFIX, U as DEVICE_SAN_USER_PREFIX, hs as buildSecretRef } from "./dist-BX8nZeXV.mjs";
|
|
2
2
|
import { C as backdatedNotBefore, S as withUtcTimeEncoding, a as KeyUsageFlags, d as SubjectKeyIdentifierExtension, f as X509Certificate$1, m as cryptoProvider, n as BasicConstraintsExtension, o as KeyUsagesExtension, p as X509CertificateGenerator, r as ExtendedKeyUsageExtension, s as PemConverter, t as AuthorityKeyIdentifierExtension, u as SubjectAlternativeNameExtension } from "./x509.es-BRiJgOvu.mjs";
|
|
3
3
|
import { X509Certificate, createPublicKey, randomBytes, verify, webcrypto } from "node:crypto";
|
|
4
4
|
//#region src/auth/jwt-signing-key.ts
|