@camstack/server 1.2.775 → 1.2.777
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 +12 -0
- package/package.json +25 -19
- package/system/dist/addon-runner.js +17 -4
- package/system/dist/addon-runner.mjs +17 -4
- package/system/dist/{agent-https-DN3SiDdO.js → agent-https-C-2D-rYT.js} +1 -1
- package/system/dist/{agent-https-D7XFlCS4.mjs → agent-https-D_Z85XhL.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 +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.d.ts +0 -1
- package/system/dist/builtins/local-network/local-network.addon.js +2 -5
- package/system/dist/builtins/local-network/local-network.addon.mjs +2 -5
- 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/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 +284 -284
- 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-GMG1X2TN.mjs → capture-engine-BCqPm9NB.mjs} +1 -1
- package/system/dist/{capture-engine-b-6U50tb.js → capture-engine-DGz8I9Fu.js} +1 -1
- package/system/dist/{composition-sources-B4d51O_D.js → composition-sources-DXOxgQ6x.js} +1 -1
- package/system/dist/{composition-sources-Cn00-OEM.mjs → composition-sources-g4w0mZIc.mjs} +1 -1
- package/system/dist/{constants-nF0GL2ol.mjs → constants-BRDAnLvw.mjs} +1 -1
- package/system/dist/{constants-CQ6aJD-7.js → constants-KG-fxfH-.js} +1 -1
- package/system/dist/{device-ca-DDPuTmrn.js → device-ca-BkzwREI_.js} +1 -1
- package/system/dist/{device-ca-BO_1Fnqk.mjs → device-ca-DOEtvJY1.mjs} +1 -1
- package/system/dist/{dist-C-reEuab.mjs → dist-0VV_LcEh.mjs} +18 -4
- package/system/dist/{dist-DyI9u0b7.js → dist-BIfwvkuF.js} +18 -4
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-mdns-ciao-BnTtLjAw.js → hub-mdns-ciao-Cq40ulKW.js} +2 -2
- package/system/dist/{hub-mdns-ciao-vybj30s5.mjs → hub-mdns-ciao-DvMaX3C7.mjs} +2 -2
- package/system/dist/index.js +25 -12
- package/system/dist/index.mjs +25 -12
- package/system/dist/kernel/moleculer/device-cap-proxy.d.ts +7 -1
- package/system/dist/{legacy-integration-rows-door-uTtKNkuI.js → legacy-integration-rows-door-CFU1l1w2.js} +1 -1
- package/system/dist/{legacy-integration-rows-door-5eYHOgk7.mjs → legacy-integration-rows-door-Ddvaas_7.mjs} +1 -1
- package/system/dist/{restore-archive-BYOloNIq.js → restore-archive-CvMg1XkQ.js} +1 -1
- package/system/dist/{restore-archive-DYn0lsQl.mjs → restore-archive-DrC0c1xL.mjs} +82 -82
- package/system/dist/{wal-maintenance-CfBfW_kE.js → wal-maintenance-CQFck3Zg.js} +0 -0
- package/system/dist/{wal-maintenance-D2ztRFn-.mjs → wal-maintenance-CT3h6u6l.mjs} +0 -0
- package/system/package.json +1 -1
|
@@ -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-BIfwvkuF.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 { To as BaseAddon, ri as logDestinationCapability } from "../../dist-
|
|
1
|
+
import { To as BaseAddon, ri as logDestinationCapability } from "../../dist-0VV_LcEh.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 { Es as historyItemFieldPath, Po as HISTORY_DEFAULT_MIN_INTERVAL_MS, uc as DeviceType } from "./dist-
|
|
1
|
+
import { Es as historyItemFieldPath, Po as HISTORY_DEFAULT_MIN_INTERVAL_MS, uc as DeviceType } from "./dist-0VV_LcEh.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-BIfwvkuF.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 { dc as errMsg, so as compositionSourceKey } from "./dist-
|
|
1
|
+
import { dc as errMsg, so as compositionSourceKey } from "./dist-0VV_LcEh.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-BIfwvkuF.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, us as buildSecretRef } from "./dist-
|
|
1
|
+
import { H as DEVICE_SAN_CREDENTIAL_PREFIX, U as DEVICE_SAN_USER_PREFIX, us as buildSecretRef } from "./dist-0VV_LcEh.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
|
|
@@ -11334,12 +11334,22 @@ var RecordIntegrationInstances = class {
|
|
|
11334
11334
|
...this.hooks.description,
|
|
11335
11335
|
mintsId: true
|
|
11336
11336
|
};
|
|
11337
|
-
|
|
11337
|
+
/**
|
|
11338
|
+
* The record an id names. A caller holding the `integrations` registry id (the Integrations
|
|
11339
|
+
* page) reaches a kind whose body links to it through `integrationId`; an id that is itself a
|
|
11340
|
+
* record id answers as it is. An id that names nothing comes back unchanged.
|
|
11341
|
+
*/
|
|
11342
|
+
async resolveRecordId(id) {
|
|
11343
|
+
if (await this.handle.get(id) !== null) return id;
|
|
11344
|
+
const linked = (await this.handle.query({ limit: INSTANCES_LIST_MAX })).records.find((record) => record.data["integrationId"] === id);
|
|
11345
|
+
return linked === void 0 ? id : linked.id;
|
|
11346
|
+
}
|
|
11347
|
+
instanceFormSchema = async ({ id }) => this.hooks.formSchema(id === null ? null : await this.resolveRecordId(id));
|
|
11338
11348
|
listInstances = async () => {
|
|
11339
11349
|
return (await this.handle.query({ limit: INSTANCES_LIST_MAX })).records.map((record) => this.viewOf(record));
|
|
11340
11350
|
};
|
|
11341
11351
|
getInstance = async ({ id }) => {
|
|
11342
|
-
const record = await this.handle.get(id);
|
|
11352
|
+
const record = await this.handle.get(await this.resolveRecordId(id));
|
|
11343
11353
|
return record === null ? null : this.viewOf(record);
|
|
11344
11354
|
};
|
|
11345
11355
|
/** Insert ONE row (`ifRev: 0`: an existing id is refused, never overwritten). */
|
|
@@ -11356,7 +11366,8 @@ var RecordIntegrationInstances = class {
|
|
|
11356
11366
|
await this.hooks.onChanged?.(minted, "created");
|
|
11357
11367
|
return { id: minted };
|
|
11358
11368
|
};
|
|
11359
|
-
updateInstance = async ({ id, name, values }) => {
|
|
11369
|
+
updateInstance = async ({ id: askedId, name, values }) => {
|
|
11370
|
+
const id = await this.resolveRecordId(askedId);
|
|
11360
11371
|
const patch = {};
|
|
11361
11372
|
for (const [key, value] of Object.entries(values)) {
|
|
11362
11373
|
if (value === void 0) continue;
|
|
@@ -11391,7 +11402,10 @@ var RecordIntegrationInstances = class {
|
|
|
11391
11402
|
status: "unsupported",
|
|
11392
11403
|
error: "This integration declares no connection test"
|
|
11393
11404
|
};
|
|
11394
|
-
return this.hooks.test(input
|
|
11405
|
+
return this.hooks.test(input.id === null ? input : {
|
|
11406
|
+
...input,
|
|
11407
|
+
id: await this.resolveRecordId(input.id)
|
|
11408
|
+
});
|
|
11395
11409
|
};
|
|
11396
11410
|
/** The flat provider object to hand to `registerProvider`. */
|
|
11397
11411
|
toProvider() {
|
|
@@ -11334,12 +11334,22 @@ var RecordIntegrationInstances = class {
|
|
|
11334
11334
|
...this.hooks.description,
|
|
11335
11335
|
mintsId: true
|
|
11336
11336
|
};
|
|
11337
|
-
|
|
11337
|
+
/**
|
|
11338
|
+
* The record an id names. A caller holding the `integrations` registry id (the Integrations
|
|
11339
|
+
* page) reaches a kind whose body links to it through `integrationId`; an id that is itself a
|
|
11340
|
+
* record id answers as it is. An id that names nothing comes back unchanged.
|
|
11341
|
+
*/
|
|
11342
|
+
async resolveRecordId(id) {
|
|
11343
|
+
if (await this.handle.get(id) !== null) return id;
|
|
11344
|
+
const linked = (await this.handle.query({ limit: INSTANCES_LIST_MAX })).records.find((record) => record.data["integrationId"] === id);
|
|
11345
|
+
return linked === void 0 ? id : linked.id;
|
|
11346
|
+
}
|
|
11347
|
+
instanceFormSchema = async ({ id }) => this.hooks.formSchema(id === null ? null : await this.resolveRecordId(id));
|
|
11338
11348
|
listInstances = async () => {
|
|
11339
11349
|
return (await this.handle.query({ limit: INSTANCES_LIST_MAX })).records.map((record) => this.viewOf(record));
|
|
11340
11350
|
};
|
|
11341
11351
|
getInstance = async ({ id }) => {
|
|
11342
|
-
const record = await this.handle.get(id);
|
|
11352
|
+
const record = await this.handle.get(await this.resolveRecordId(id));
|
|
11343
11353
|
return record === null ? null : this.viewOf(record);
|
|
11344
11354
|
};
|
|
11345
11355
|
/** Insert ONE row (`ifRev: 0`: an existing id is refused, never overwritten). */
|
|
@@ -11356,7 +11366,8 @@ var RecordIntegrationInstances = class {
|
|
|
11356
11366
|
await this.hooks.onChanged?.(minted, "created");
|
|
11357
11367
|
return { id: minted };
|
|
11358
11368
|
};
|
|
11359
|
-
updateInstance = async ({ id, name, values }) => {
|
|
11369
|
+
updateInstance = async ({ id: askedId, name, values }) => {
|
|
11370
|
+
const id = await this.resolveRecordId(askedId);
|
|
11360
11371
|
const patch = {};
|
|
11361
11372
|
for (const [key, value] of Object.entries(values)) {
|
|
11362
11373
|
if (value === void 0) continue;
|
|
@@ -11391,7 +11402,10 @@ var RecordIntegrationInstances = class {
|
|
|
11391
11402
|
status: "unsupported",
|
|
11392
11403
|
error: "This integration declares no connection test"
|
|
11393
11404
|
};
|
|
11394
|
-
return this.hooks.test(input
|
|
11405
|
+
return this.hooks.test(input.id === null ? input : {
|
|
11406
|
+
...input,
|
|
11407
|
+
id: await this.resolveRecordId(input.id)
|
|
11408
|
+
});
|
|
11395
11409
|
};
|
|
11396
11410
|
/** The flat provider object to hand to `registerProvider`. */
|
|
11397
11411
|
toProvider() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require("./chunk-Cek0wNdY.js");
|
|
2
|
-
const require_wal_maintenance = require("./wal-maintenance-
|
|
2
|
+
const require_wal_maintenance = require("./wal-maintenance-CQFck3Zg.js");
|
|
3
3
|
let node_worker_threads = require("node:worker_threads");
|
|
4
4
|
//#region src/builtins/sqlite-storage/file-host-worker.ts
|
|
5
5
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as callRecords, C as isFileHostWorkerData, D as RecordsEngine, M as controlTargetOf, O as callControl, S as isFileHostRequest, a as WalMaintenance, b as collectTransferables, d as callMigrate, f as migrateTargetOf, j as callVector, k as callData, l as SqliteSettingsBackend, o as createVectorIndex, s as vectorProviderOf, u as HUB_MIGRATIONS, v as serializeError, w as trustInput } from "./wal-maintenance-
|
|
1
|
+
import { A as callRecords, C as isFileHostWorkerData, D as RecordsEngine, M as controlTargetOf, O as callControl, S as isFileHostRequest, a as WalMaintenance, b as collectTransferables, d as callMigrate, f as migrateTargetOf, j as callVector, k as callData, l as SqliteSettingsBackend, o as createVectorIndex, s as vectorProviderOf, u as HUB_MIGRATIONS, v as serializeError, w as trustInput } from "./wal-maintenance-CT3h6u6l.mjs";
|
|
2
2
|
import { parentPort, threadId, workerData } from "node:worker_threads";
|
|
3
3
|
//#region src/builtins/sqlite-storage/file-host-worker.ts
|
|
4
4
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-Cek0wNdY.js");
|
|
2
|
-
const require_dist = require("./dist-
|
|
2
|
+
const require_dist = require("./dist-BIfwvkuF.js");
|
|
3
3
|
const require_x509_es = require("./x509.es-WtnRNyYS.js");
|
|
4
|
-
const require_agent_https = require("./agent-https-
|
|
4
|
+
const require_agent_https = require("./agent-https-C-2D-rYT.js");
|
|
5
5
|
let node_crypto = require("node:crypto");
|
|
6
6
|
let _camstack_types_node = require("@camstack/types/node");
|
|
7
7
|
let node_fs_promises = require("node:fs/promises");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { o as __toESM } from "./chunk-CNf5ZN-e.mjs";
|
|
2
|
-
import { oc as userError } from "./dist-
|
|
2
|
+
import { oc as userError } from "./dist-0VV_LcEh.mjs";
|
|
3
3
|
import { f as X509Certificate$1 } from "./x509.es-BRiJgOvu.mjs";
|
|
4
|
-
import { D as reasonRequiresNewCa, E as evaluateExistingCert, F as readNameConstraints, N as permitsIdentity, _ as issueLeaf, b as collectCertIdentity, g as generateCa, j as isConstrainedCa, v as loadCa, y as localCaCommonName } from "./agent-https-
|
|
4
|
+
import { D as reasonRequiresNewCa, E as evaluateExistingCert, F as readNameConstraints, N as permitsIdentity, _ as issueLeaf, b as collectCertIdentity, g as generateCa, j as isConstrainedCa, v as loadCa, y as localCaCommonName } from "./agent-https-D_Z85XhL.mjs";
|
|
5
5
|
import { X509Certificate, createPrivateKey } from "node:crypto";
|
|
6
6
|
import { writeOwnerOnlyFileSync } from "@camstack/types/node";
|
|
7
7
|
import { mkdir, writeFile } from "node:fs/promises";
|
package/system/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("./chunk-Cek0wNdY.js");
|
|
3
|
-
const require_dist = require("./dist-
|
|
4
|
-
const require_device_ca = require("./device-ca-
|
|
3
|
+
const require_dist = require("./dist-BIfwvkuF.js");
|
|
4
|
+
const require_device_ca = require("./device-ca-BkzwREI_.js");
|
|
5
5
|
const require_read_all_rows$1 = require("./read-all-rows-CVoO1ONM.js");
|
|
6
6
|
const require_builtins_alerts_alerts_addon = require("./builtins/alerts/alerts.addon.js");
|
|
7
7
|
require("./builtins/alerts/index.js");
|
|
@@ -26,22 +26,22 @@ const require_builtins_loki_logging_index = require("./builtins/loki-logging/ind
|
|
|
26
26
|
const require_builtins_native_metrics_native_metrics_addon = require("./builtins/native-metrics/native-metrics.addon.js");
|
|
27
27
|
const require_builtins_device_history_device_history_addon = require("./builtins/device-history/device-history.addon.js");
|
|
28
28
|
const require_builtins_sqlite_storage_filesystem_storage_addon = require("./builtins/sqlite-storage/filesystem-storage.addon.js");
|
|
29
|
-
const require_wal_maintenance = require("./wal-maintenance-
|
|
30
|
-
const require_legacy_integration_rows_door = require("./legacy-integration-rows-door-
|
|
29
|
+
const require_wal_maintenance = require("./wal-maintenance-CQFck3Zg.js");
|
|
30
|
+
const require_legacy_integration_rows_door = require("./legacy-integration-rows-door-CFU1l1w2.js");
|
|
31
31
|
const require_builtins_sqlite_storage_sqlite_settings_addon = require("./builtins/sqlite-storage/sqlite-settings.addon.js");
|
|
32
32
|
const require_builtins_sqlite_storage_index = require("./builtins/sqlite-storage/index.js");
|
|
33
33
|
const require_builtins_storage_orchestrator_storage_orchestrator_addon = require("./builtins/storage-orchestrator/storage-orchestrator.addon.js");
|
|
34
34
|
require("./builtins/storage-orchestrator/index.js");
|
|
35
|
-
const require_agent_https = require("./agent-https-
|
|
36
|
-
const require_constants = require("./constants-
|
|
35
|
+
const require_agent_https = require("./agent-https-C-2D-rYT.js");
|
|
36
|
+
const require_constants = require("./constants-KG-fxfH-.js");
|
|
37
37
|
const require_builtins_system_config_system_config_addon = require("./builtins/system-config/system-config.addon.js");
|
|
38
38
|
require("./builtins/system-config/index.js");
|
|
39
39
|
const require_builtins_winston_logging_index = require("./builtins/winston-logging/index.js");
|
|
40
40
|
const require_custom_action_registry = require("./custom-action-registry-JuMHGKEc.js");
|
|
41
|
-
const require_hub_mdns_ciao = require("./hub-mdns-ciao-
|
|
41
|
+
const require_hub_mdns_ciao = require("./hub-mdns-ciao-Cq40ulKW.js");
|
|
42
42
|
const require_platform_key_source = require("./platform-key-source-Di7HrlGR.js");
|
|
43
43
|
const require_resource_monitor = require("./resource-monitor-mio9dSCT.js");
|
|
44
|
-
const require_restore_archive = require("./restore-archive-
|
|
44
|
+
const require_restore_archive = require("./restore-archive-CvMg1XkQ.js");
|
|
45
45
|
const require_coral_accelerators = require("./coral-accelerators-BSVsBVzt.js");
|
|
46
46
|
let zod = require("zod");
|
|
47
47
|
let node_crypto = require("node:crypto");
|
|
@@ -16272,7 +16272,13 @@ function buildNativeCapProxy(broker, addonId, capName, deviceId) {
|
|
|
16272
16272
|
function deviceHasStreamSources(device) {
|
|
16273
16273
|
return typeof Reflect.get(device, "getStreamSources") === "function";
|
|
16274
16274
|
}
|
|
16275
|
-
|
|
16275
|
+
/**
|
|
16276
|
+
* `afterRemove` is the worker's local teardown (registry entry, native caps,
|
|
16277
|
+
* children). The hub's `remove` reaches a forked worker ONLY through this
|
|
16278
|
+
* provider, so the lifecycle call alone would leave a zombie instance in the
|
|
16279
|
+
* worker (timers running, still listed as adopted). It is idempotent.
|
|
16280
|
+
*/
|
|
16281
|
+
function buildDeviceOpsProvider(device, afterRemove) {
|
|
16276
16282
|
const assertMatch = (incoming) => {
|
|
16277
16283
|
if (incoming !== device.id) throw new Error(`device-ops: deviceId mismatch — expected '${device.id}', got '${incoming}'`);
|
|
16278
16284
|
};
|
|
@@ -16300,6 +16306,7 @@ function buildDeviceOpsProvider(device) {
|
|
|
16300
16306
|
removeDevice: async (input) => {
|
|
16301
16307
|
assertMatch(input.deviceId);
|
|
16302
16308
|
await device.removeDevice();
|
|
16309
|
+
await afterRemove?.(device.id);
|
|
16303
16310
|
},
|
|
16304
16311
|
getSettingsSchema: async (input) => {
|
|
16305
16312
|
assertMatch(input.deviceId);
|
|
@@ -16530,6 +16537,10 @@ function createBrokerDeviceManagerApi(opts) {
|
|
|
16530
16537
|
}
|
|
16531
16538
|
};
|
|
16532
16539
|
};
|
|
16540
|
+
/** The integration a spawned child inherits: its parent's persisted one, if any. */
|
|
16541
|
+
const resolveParentIntegrationId = async (parentId) => {
|
|
16542
|
+
return (await callDeviceManager(api, "loadMeta", { deviceId: parentId }).catch(() => null))?.integrationId ?? void 0;
|
|
16543
|
+
};
|
|
16533
16544
|
/**
|
|
16534
16545
|
* Spawn one accessory child device declared by a parent's
|
|
16535
16546
|
* `getAccessoryChildren()`. Mirrors the standard `create()` flow
|
|
@@ -16547,13 +16558,15 @@ function createBrokerDeviceManagerApi(opts) {
|
|
|
16547
16558
|
const empty = {};
|
|
16548
16559
|
const existingMeta = await callDeviceManager(api, "loadMeta", { deviceId: id }).catch(() => null);
|
|
16549
16560
|
const isFirstSpawn = !existingMeta || existingMeta.name === childStableId;
|
|
16561
|
+
const linkDeviceId = spec.meta.linkDeviceId ?? parent.id;
|
|
16562
|
+
const integrationId = spec.meta.integrationId ?? await resolveParentIntegrationId(parent.id);
|
|
16550
16563
|
await callDeviceManager(api, "applyInitialMeta", {
|
|
16551
16564
|
deviceId: id,
|
|
16552
|
-
linkDeviceId
|
|
16565
|
+
linkDeviceId,
|
|
16553
16566
|
...isFirstSpawn && spec.meta.name !== void 0 ? { name: spec.meta.name } : {},
|
|
16554
16567
|
...isFirstSpawn && spec.meta.location !== void 0 ? { location: spec.meta.location } : {},
|
|
16555
16568
|
...spec.meta.type !== void 0 ? { type: spec.meta.type } : {},
|
|
16556
|
-
...
|
|
16569
|
+
...integrationId !== void 0 ? { integrationId } : {},
|
|
16557
16570
|
...spec.meta.role !== void 0 ? { role: spec.meta.role } : {}
|
|
16558
16571
|
}).catch((err) => {
|
|
16559
16572
|
opts.logger.warn("spawnAccessoryChild: applyInitialMeta pre-seed failed", {
|
|
@@ -16814,7 +16827,7 @@ function createBrokerDeviceManagerApi(opts) {
|
|
|
16814
16827
|
},
|
|
16815
16828
|
register: async (device) => {
|
|
16816
16829
|
registry.register(addonId, device);
|
|
16817
|
-
buildContext(device.stableId, device.id, device.parentDeviceId).registerNativeCap(_camstack_types_addon.deviceOpsCapability, buildDeviceOpsProvider(device));
|
|
16830
|
+
buildContext(device.stableId, device.id, device.parentDeviceId).registerNativeCap(_camstack_types_addon.deviceOpsCapability, buildDeviceOpsProvider(device, (id) => teardownLocal(id, false)));
|
|
16818
16831
|
try {
|
|
16819
16832
|
await callDeviceManager(api, "registerDevice", {
|
|
16820
16833
|
addonId,
|
package/system/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as __require } from "./chunk-CNf5ZN-e.mjs";
|
|
2
|
-
import { $i as resolveMethodAuth, Ao as DEVICE_STATUS_METHOD, Ci as objectInputDeclaresRequiredDeviceId, Cs as expandCapMethods, Da as supportedRuntimes, Do as CALLER_STAMPED_CAPABILITIES$1, E as CatalogFileSchema, Go as RUNTIME_DEFAULTS, Gr as isVoidInput, Gs as parseJsonObject, Ii as procedureAuthKey, Js as readinessKey, Ko as ReadinessRegistry, Kr as kebabToCamel$1, Ks as parseJsonUnknown, Lr as isArrayOutputSchema, Nr as interpolate, Oo as DATAPLANE_SECRET_HEADER$1, Qs as scopeKey, Rr as isCollectionArrayMethod, Si as objectInputDeclaresAddonId, Ts as getDebugInterest, Ur as isObjectInput, Xs as resolveCapMount, Zr as lifecycleJobSchema, a as AGENT_MDNS_TXT_KEYS, ai as looseSchema, as as asJsonObject$1, bs as defineRecordKinds, bt as METHOD_ACCESS_MAP, ca as scopesAllowAddon, dc as errMsg$1, fc as EventCategory$1, hs as createEvent$1, i as AGENT_MDNS_SERVICE_TYPE, ii as logLevelAtMost, ko as DEVICE_SETTINGS_CONTRIBUTION_METHODS, ks as isDebugChannelName, la as scopesAllowDeviceCap, ln as addonSettingsCapability, o as ALL_CAPABILITY_DEFINITIONS, oc as userError, os as asNumber, ps as collectSecretMarkerRefs, qo as ReadinessTimeoutError, sc as withoutCallerStamp, ss as asString$1, vn as bareAddonId, vt as LOG_LEVEL_RANK, xs as emitDownForOwnedCaps, y as CATALOG_LANGS, ya as splitTranslationRef, yr as extractNestedAddonId } from "./dist-
|
|
3
|
-
import { d as JWT_SIGNING_KEY_REF, f as JwtSigningKeyUnavailableError, g as processJwtSigningKey, i as generateDeviceCa, l as verifyDeviceLeaf, m as getProcessJwtSigningKeyState, n as DEVICE_CA_KEY_REF, o as issueDeviceLeaf, p as SYSTEM_SECRET_OWNER, s as loadDeviceCa, u as verifyDeviceSignature, v as staticJwtSigningKey } from "./device-ca-
|
|
2
|
+
import { $i as resolveMethodAuth, Ao as DEVICE_STATUS_METHOD, Ci as objectInputDeclaresRequiredDeviceId, Cs as expandCapMethods, Da as supportedRuntimes, Do as CALLER_STAMPED_CAPABILITIES$1, E as CatalogFileSchema, Go as RUNTIME_DEFAULTS, Gr as isVoidInput, Gs as parseJsonObject, Ii as procedureAuthKey, Js as readinessKey, Ko as ReadinessRegistry, Kr as kebabToCamel$1, Ks as parseJsonUnknown, Lr as isArrayOutputSchema, Nr as interpolate, Oo as DATAPLANE_SECRET_HEADER$1, Qs as scopeKey, Rr as isCollectionArrayMethod, Si as objectInputDeclaresAddonId, Ts as getDebugInterest, Ur as isObjectInput, Xs as resolveCapMount, Zr as lifecycleJobSchema, a as AGENT_MDNS_TXT_KEYS, ai as looseSchema, as as asJsonObject$1, bs as defineRecordKinds, bt as METHOD_ACCESS_MAP, ca as scopesAllowAddon, dc as errMsg$1, fc as EventCategory$1, hs as createEvent$1, i as AGENT_MDNS_SERVICE_TYPE, ii as logLevelAtMost, ko as DEVICE_SETTINGS_CONTRIBUTION_METHODS, ks as isDebugChannelName, la as scopesAllowDeviceCap, ln as addonSettingsCapability, o as ALL_CAPABILITY_DEFINITIONS, oc as userError, os as asNumber, ps as collectSecretMarkerRefs, qo as ReadinessTimeoutError, sc as withoutCallerStamp, ss as asString$1, vn as bareAddonId, vt as LOG_LEVEL_RANK, xs as emitDownForOwnedCaps, y as CATALOG_LANGS, ya as splitTranslationRef, yr as extractNestedAddonId } from "./dist-0VV_LcEh.mjs";
|
|
3
|
+
import { d as JWT_SIGNING_KEY_REF, f as JwtSigningKeyUnavailableError, g as processJwtSigningKey, i as generateDeviceCa, l as verifyDeviceLeaf, m as getProcessJwtSigningKeyState, n as DEVICE_CA_KEY_REF, o as issueDeviceLeaf, p as SYSTEM_SECRET_OWNER, s as loadDeviceCa, u as verifyDeviceSignature, v as staticJwtSigningKey } from "./device-ca-DOEtvJY1.mjs";
|
|
4
4
|
import { t as require_read_all_rows } from "./read-all-rows-TaPqdWNF.mjs";
|
|
5
5
|
import { AlertCenterAddon } from "./builtins/alerts/alerts.addon.mjs";
|
|
6
6
|
import "./builtins/alerts/index.mjs";
|
|
@@ -25,22 +25,22 @@ import { LokiDestination, LokiLoggingAddon } from "./builtins/loki-logging/index
|
|
|
25
25
|
import NativeMetricsAddon, { a as NativeMetricsProvider, i as parseProcStatusRss, n as nodeProcReader, r as parseProcStat } from "./builtins/native-metrics/native-metrics.addon.mjs";
|
|
26
26
|
import { DeviceHistoryAddon } from "./builtins/device-history/device-history.addon.mjs";
|
|
27
27
|
import { FilesystemStorageAddon, t as FilesystemStorageProvider } from "./builtins/sqlite-storage/filesystem-storage.addon.mjs";
|
|
28
|
-
import { D as RecordsEngine, l as SqliteSettingsBackend } from "./wal-maintenance-
|
|
29
|
-
import { n as clearLegacyIntegrationRows, o as readLegacyIntegrationRows } from "./legacy-integration-rows-door-
|
|
28
|
+
import { D as RecordsEngine, l as SqliteSettingsBackend } from "./wal-maintenance-CT3h6u6l.mjs";
|
|
29
|
+
import { n as clearLegacyIntegrationRows, o as readLegacyIntegrationRows } from "./legacy-integration-rows-door-Ddvaas_7.mjs";
|
|
30
30
|
import { SqliteSettingsAddon } from "./builtins/sqlite-storage/sqlite-settings.addon.mjs";
|
|
31
31
|
import { ConfigStore, DeviceStore } from "./builtins/sqlite-storage/index.mjs";
|
|
32
32
|
import { StorageOrchestratorAddon, a as stripForwardedCaller, i as createHubCapForwardService, l as STORAGE_DRAIN_STATE_LEGACY, n as HUB_CAP_FWD_ACTION, o as buildStorageLocationRegistry, r as HUB_CAP_FWD_SERVICE, t as StorageOrchestratorService, u as storageOrchestratorRecordKinds } from "./builtins/storage-orchestrator/storage-orchestrator.addon.mjs";
|
|
33
33
|
import "./builtins/storage-orchestrator/index.mjs";
|
|
34
|
-
import { A as buildNameConstraintSet, B as setProcessAgentHttpsNames, C as LEAF_RENEWAL_WINDOW_DAYS, E as evaluateExistingCert, F as readNameConstraints, I as AGENT_HTTPS_NAMES_COLLECTION, L as AGENT_HTTPS_NAMES_COLUMNS, M as isLocalOnlyHostname, N as permitsIdentity, O as PERMITTED_DNS_SUFFIXES, P as permitsName, R as AgentHttpsNames, S as CA_VALIDITY_DAYS, T as SERVER_AUTH_OID, a as collectAgentNames, b as collectCertIdentity, c as installAgentHttps, d as issueAgentHttpsLeaf, f as loadAgentHttps, h as CA_COMMON_NAME, i as certificateNames, j as isConstrainedCa, k as PERMITTED_IP_RANGES, l as isContainerBridgeAddress, m as pinnedHttpsCaFingerprint, n as acceptAgentSans, o as createAgentHttpsRequest, p as pemDigest, r as agentHttpsPaths, s as describeHttpsLeaf, t as AgentHttpsInstallError, u as isPrivateAddress, w as MAX_LEAF_VALIDITY_DAYS, x as systemHostFacts, y as localCaCommonName, z as getProcessAgentHttpsNames } from "./agent-https-
|
|
35
|
-
import { a as MESH_CA_KEY_REF, i as MESH_CA_FIELD, n as DEFAULT_HUB_TLS_TCP_PORT, o as MESH_CA_SETTINGS_KEY } from "./constants-
|
|
34
|
+
import { A as buildNameConstraintSet, B as setProcessAgentHttpsNames, C as LEAF_RENEWAL_WINDOW_DAYS, E as evaluateExistingCert, F as readNameConstraints, I as AGENT_HTTPS_NAMES_COLLECTION, L as AGENT_HTTPS_NAMES_COLUMNS, M as isLocalOnlyHostname, N as permitsIdentity, O as PERMITTED_DNS_SUFFIXES, P as permitsName, R as AgentHttpsNames, S as CA_VALIDITY_DAYS, T as SERVER_AUTH_OID, a as collectAgentNames, b as collectCertIdentity, c as installAgentHttps, d as issueAgentHttpsLeaf, f as loadAgentHttps, h as CA_COMMON_NAME, i as certificateNames, j as isConstrainedCa, k as PERMITTED_IP_RANGES, l as isContainerBridgeAddress, m as pinnedHttpsCaFingerprint, n as acceptAgentSans, o as createAgentHttpsRequest, p as pemDigest, r as agentHttpsPaths, s as describeHttpsLeaf, t as AgentHttpsInstallError, u as isPrivateAddress, w as MAX_LEAF_VALIDITY_DAYS, x as systemHostFacts, y as localCaCommonName, z as getProcessAgentHttpsNames } from "./agent-https-D_Z85XhL.mjs";
|
|
35
|
+
import { a as MESH_CA_KEY_REF, i as MESH_CA_FIELD, n as DEFAULT_HUB_TLS_TCP_PORT, o as MESH_CA_SETTINGS_KEY } from "./constants-BRDAnLvw.mjs";
|
|
36
36
|
import { $ as caFingerprintCompact, A as getProcessNodeMeshTransport, B as MESH_NODE_CERTIFICATES_COLLECTION, C as MESH_TLS_PORT_HELLO_FIELD, Ct as readOriginSetting, D as setProcessMeshTlsEnabler, Dt as readCidrSetting, E as ServiceBroker, Et as parseCidrList, F as renewMeshCertificate, G as getProcessMeshCertificateRegistry, H as MeshCertificateRegistry, I as revokeMeshCertificate, J as processMeshCrl, K as setProcessMeshCertificateRegistry, L as getProcessMeshTlsListenerState, M as isProcessVerifiedMeshPeer, N as onProcessNodeRegistered, O as dropProcessPeer, P as setProcessMeshPeerTransportLookup, Q as caFingerprint, R as openMeshTlsWhenRevocationsLoaded, S as verifyMembershipAnswer, St as parseOriginList, SystemConfigAddon, T as Errors, Tt as normalizeIp, U as RENEWAL_ABANDONED, V as MESH_NODE_CERTIFICATES_COLUMNS, W as describeMeshLeaf, X as getProcessMeshCaState, Y as MeshCaKeeper, Z as requireProcessMeshCa, _ as signPairingProof, _t as verifyAgentUiUnlockTicket, a as hubHostFromMeshAddress, at as issueMeshLeafForNode, b as MembershipResponder, bt as isInsecureOrigin, c as PAIRING_MAX_SESSIONS, ct as AGENT_DASHBOARD_ORIGINS_FIELD, d as PAIRING_PROTOCOL, dt as AGENT_UI_UNLOCK_USE, et as createMeshCsrPem, f as PAIRING_TTL_MS, ft as AGENT_UI_UNLOCK_VERSION, g as keyFingerprintShort, gt as parseAgentDashboardOrigins, h as describeCsr, ht as mintAgentUiUnlockTicket, i as AgentPairing, it as isValidAgentNodeId, j as getProcessPeerLeaf, k as emitProcessNodeRegistered, l as PAIRING_PATHS, lt as AGENT_UI_UNLOCK_TTL_MS, m as computePairingSas, mt as isAllowedAgentDashboardReturnTo, n as HubPairing, nt as generateMeshCa, o as PAIRING_CODE_DIGITS, ot as issueMeshLeafFromCsr, p as computePairingCommitment, pt as UnlockTicketJtiStore, q as MeshCrl, r as PairingHttpError, rt as generateMeshKeyPair, s as PAIRING_MAX_CODE_ATTEMPTS, st as loadMeshCa, tt as exportMeshPrivateKeyPem, u as PAIRING_PIN_DIGITS, ut as AGENT_UI_UNLOCK_TYP, v as verifyPairingProof, vt as InvalidCorsOriginError, w as TlsTcpTransporter, wt as createCidrMatcher, x as signMembershipProof, xt as normalizeOrigin, y as MEMBERSHIP_PATHS, yt as OPAQUE_ORIGIN, z as setProcessMeshTlsListenerState } from "./builtins/system-config/system-config.addon.mjs";
|
|
37
37
|
import "./builtins/system-config/index.mjs";
|
|
38
38
|
import { WinstonDestination, WinstonLoggingAddon } from "./builtins/winston-logging/index.mjs";
|
|
39
39
|
import { C as isModelDownloaded, E as setHuggingFaceReachabilityObserver, T as revisionWeightUrl, _ as downloadFile, a as startEventLoopStallMonitor, b as fetchJson, c as createAuthenticatedFileServer, d as resolveFilePath, f as ModelDownloadService, g as deleteModelFromDisk, h as collectModelFiles, i as attributeStall, l as parseRangeHeader, m as adoptModelRevisions, n as STALL_REPORT_MS, o as createFileDataPlaneHandler, r as STALL_TICK_MS, s as contentTypeFor, t as CustomActionRegistry, u as parseTokenizedUrl, v as downloadModel, w as resolveFormatRevision, x as getModelFilePath, y as ensureModel } from "./custom-action-registry-oHl1xltx.mjs";
|
|
40
|
-
import { A as retirePreviousLocalCa, C as checkUploadedCa, D as loadTlsCert, E as ensureTlsCert, F as closeLanHttp, I as readLanHttpState, L as registerLanHttpHandler, M as allFamiliesListenHost, N as applyLanHttp, O as reissueTlsLeaf, P as bindPendingLanHttp, S as chainsToPublicRoot, T as caReplacementMarkerFile, _ as readTlsMode, a as storeUploadedCertificate, b as writeTlsEnabled, c as leafFingerprintOf, d as servedHttpsLeafFingerprint, f as prepareBootTls, g as readTlsEnabled, h as readTlsAccessStatus, i as revertToGeneratedCertificate, j as DEFAULT_LAN_HTTP_PORT, k as replaceUnconstrainedLocalCa, l as registerHttpsListener, m as readExtraSans, n as applyCertificateToListener, o as useStoredUploadedCertificate, p as UPLOADED_CA_FILE, r as regenerateCertificate, s as clearHttpsListener, t as createCiaoPublisher, u as reloadHttpsListener, v as splitPemCertificates, w as validateUploadedTls, x as writeTlsMode, y as writeExtraSans } from "./hub-mdns-ciao-
|
|
40
|
+
import { A as retirePreviousLocalCa, C as checkUploadedCa, D as loadTlsCert, E as ensureTlsCert, F as closeLanHttp, I as readLanHttpState, L as registerLanHttpHandler, M as allFamiliesListenHost, N as applyLanHttp, O as reissueTlsLeaf, P as bindPendingLanHttp, S as chainsToPublicRoot, T as caReplacementMarkerFile, _ as readTlsMode, a as storeUploadedCertificate, b as writeTlsEnabled, c as leafFingerprintOf, d as servedHttpsLeafFingerprint, f as prepareBootTls, g as readTlsEnabled, h as readTlsAccessStatus, i as revertToGeneratedCertificate, j as DEFAULT_LAN_HTTP_PORT, k as replaceUnconstrainedLocalCa, l as registerHttpsListener, m as readExtraSans, n as applyCertificateToListener, o as useStoredUploadedCertificate, p as UPLOADED_CA_FILE, r as regenerateCertificate, s as clearHttpsListener, t as createCiaoPublisher, u as reloadHttpsListener, v as splitPemCertificates, w as validateUploadedTls, x as writeTlsMode, y as writeExtraSans } from "./hub-mdns-ciao-DvMaX3C7.mjs";
|
|
41
41
|
import { n as getPlatformKeychainKey, r as setPlatformKeychainKey, t as clearPlatformKeychainKey } from "./platform-key-source-BWlq0jjn.mjs";
|
|
42
42
|
import { n as getSinglePidStats, t as getPidStats } from "./resource-monitor-Di9daRwI.mjs";
|
|
43
|
-
import { _ as backupRecordStoresOf, c as BackupDecryptError, f as generateBackupKeyPair, g as backupOrchestratorRecordKinds, h as readBackupEncryptionHeader, l as BackupKeyFormatError, r as prepareRestoreArchive, s as SystemBackupService, t as BackupKeyRequiredError, u as BackupKeyMismatchError } from "./restore-archive-
|
|
43
|
+
import { _ as backupRecordStoresOf, c as BackupDecryptError, f as generateBackupKeyPair, g as backupOrchestratorRecordKinds, h as readBackupEncryptionHeader, l as BackupKeyFormatError, r as prepareRestoreArchive, s as SystemBackupService, t as BackupKeyRequiredError, u as BackupKeyMismatchError } from "./restore-archive-DrC0c1xL.mjs";
|
|
44
44
|
import { r as nodeCoralFs, t as classifyCoralAccelerator } from "./coral-accelerators-DBlgWB8k.mjs";
|
|
45
45
|
import { z } from "zod";
|
|
46
46
|
import * as crypto$1 from "node:crypto";
|
|
@@ -16268,7 +16268,13 @@ function buildNativeCapProxy(broker, addonId, capName, deviceId) {
|
|
|
16268
16268
|
function deviceHasStreamSources(device) {
|
|
16269
16269
|
return typeof Reflect.get(device, "getStreamSources") === "function";
|
|
16270
16270
|
}
|
|
16271
|
-
|
|
16271
|
+
/**
|
|
16272
|
+
* `afterRemove` is the worker's local teardown (registry entry, native caps,
|
|
16273
|
+
* children). The hub's `remove` reaches a forked worker ONLY through this
|
|
16274
|
+
* provider, so the lifecycle call alone would leave a zombie instance in the
|
|
16275
|
+
* worker (timers running, still listed as adopted). It is idempotent.
|
|
16276
|
+
*/
|
|
16277
|
+
function buildDeviceOpsProvider(device, afterRemove) {
|
|
16272
16278
|
const assertMatch = (incoming) => {
|
|
16273
16279
|
if (incoming !== device.id) throw new Error(`device-ops: deviceId mismatch — expected '${device.id}', got '${incoming}'`);
|
|
16274
16280
|
};
|
|
@@ -16296,6 +16302,7 @@ function buildDeviceOpsProvider(device) {
|
|
|
16296
16302
|
removeDevice: async (input) => {
|
|
16297
16303
|
assertMatch(input.deviceId);
|
|
16298
16304
|
await device.removeDevice();
|
|
16305
|
+
await afterRemove?.(device.id);
|
|
16299
16306
|
},
|
|
16300
16307
|
getSettingsSchema: async (input) => {
|
|
16301
16308
|
assertMatch(input.deviceId);
|
|
@@ -16526,6 +16533,10 @@ function createBrokerDeviceManagerApi(opts) {
|
|
|
16526
16533
|
}
|
|
16527
16534
|
};
|
|
16528
16535
|
};
|
|
16536
|
+
/** The integration a spawned child inherits: its parent's persisted one, if any. */
|
|
16537
|
+
const resolveParentIntegrationId = async (parentId) => {
|
|
16538
|
+
return (await callDeviceManager(api, "loadMeta", { deviceId: parentId }).catch(() => null))?.integrationId ?? void 0;
|
|
16539
|
+
};
|
|
16529
16540
|
/**
|
|
16530
16541
|
* Spawn one accessory child device declared by a parent's
|
|
16531
16542
|
* `getAccessoryChildren()`. Mirrors the standard `create()` flow
|
|
@@ -16543,13 +16554,15 @@ function createBrokerDeviceManagerApi(opts) {
|
|
|
16543
16554
|
const empty = {};
|
|
16544
16555
|
const existingMeta = await callDeviceManager(api, "loadMeta", { deviceId: id }).catch(() => null);
|
|
16545
16556
|
const isFirstSpawn = !existingMeta || existingMeta.name === childStableId;
|
|
16557
|
+
const linkDeviceId = spec.meta.linkDeviceId ?? parent.id;
|
|
16558
|
+
const integrationId = spec.meta.integrationId ?? await resolveParentIntegrationId(parent.id);
|
|
16546
16559
|
await callDeviceManager(api, "applyInitialMeta", {
|
|
16547
16560
|
deviceId: id,
|
|
16548
|
-
linkDeviceId
|
|
16561
|
+
linkDeviceId,
|
|
16549
16562
|
...isFirstSpawn && spec.meta.name !== void 0 ? { name: spec.meta.name } : {},
|
|
16550
16563
|
...isFirstSpawn && spec.meta.location !== void 0 ? { location: spec.meta.location } : {},
|
|
16551
16564
|
...spec.meta.type !== void 0 ? { type: spec.meta.type } : {},
|
|
16552
|
-
...
|
|
16565
|
+
...integrationId !== void 0 ? { integrationId } : {},
|
|
16553
16566
|
...spec.meta.role !== void 0 ? { role: spec.meta.role } : {}
|
|
16554
16567
|
}).catch((err) => {
|
|
16555
16568
|
opts.logger.warn("spawnAccessoryChild: applyInitialMeta pre-seed failed", {
|
|
@@ -16810,7 +16823,7 @@ function createBrokerDeviceManagerApi(opts) {
|
|
|
16810
16823
|
},
|
|
16811
16824
|
register: async (device) => {
|
|
16812
16825
|
registry.register(addonId, device);
|
|
16813
|
-
buildContext(device.stableId, device.id, device.parentDeviceId).registerNativeCap(deviceOpsCapability, buildDeviceOpsProvider(device));
|
|
16826
|
+
buildContext(device.stableId, device.id, device.parentDeviceId).registerNativeCap(deviceOpsCapability, buildDeviceOpsProvider(device, (id) => teardownLocal(id, false)));
|
|
16814
16827
|
try {
|
|
16815
16828
|
await callDeviceManager(api, "registerDevice", {
|
|
16816
16829
|
addonId,
|
|
@@ -66,5 +66,11 @@ export declare function getWorkerNativeCapProvider(capName: string, deviceId: nu
|
|
|
66
66
|
* worker `broker.createService` and the hub's Moleculer registry INFO packet.
|
|
67
67
|
*/
|
|
68
68
|
export declare function buildNativeCapProxy(broker: ServiceBroker, addonId: string, capName: string, deviceId: number): Record<string, (input: unknown) => Promise<unknown>>;
|
|
69
|
-
|
|
69
|
+
/**
|
|
70
|
+
* `afterRemove` is the worker's local teardown (registry entry, native caps,
|
|
71
|
+
* children). The hub's `remove` reaches a forked worker ONLY through this
|
|
72
|
+
* provider, so the lifecycle call alone would leave a zombie instance in the
|
|
73
|
+
* worker (timers running, still listed as adopted). It is idempotent.
|
|
74
|
+
*/
|
|
75
|
+
export declare function buildDeviceOpsProvider(device: IDevice, afterRemove?: (deviceId: number) => Promise<void>): InferProvider<typeof deviceOpsCapability>;
|
|
70
76
|
export declare function createBrokerDeviceManagerApi(opts: WorkerDeviceManagerOptions): DeviceManagerApi;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ps as collectSecretMarkerRefs } from "./dist-
|
|
1
|
+
import { ps as collectSecretMarkerRefs } from "./dist-0VV_LcEh.mjs";
|
|
2
2
|
//#region src/builtins/sqlite-storage/migrations/legacy-integration-rows-door.ts
|
|
3
3
|
/**
|
|
4
4
|
* Migration-only door for the leftover integration rows (planning#416).
|