@camstack/system 1.1.34 → 1.1.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/addon-runner.js +87 -35
- package/dist/addon-runner.mjs +87 -35
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +6 -6
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +6 -6
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/dist/builtins/alerts/alerts.addon.js +12 -12
- package/dist/builtins/alerts/alerts.addon.mjs +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +5 -5
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
- package/dist/builtins/console-logging/index.js +3 -3
- package/dist/builtins/console-logging/index.mjs +1 -1
- package/dist/builtins/device-manager/device-manager.addon.js +69 -69
- package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
- package/dist/builtins/hub-forwarder/index.js +3 -3
- package/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/dist/builtins/local-auth/local-auth.addon.js +7 -7
- package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
- package/dist/builtins/local-network/local-network.addon.js +7 -7
- package/dist/builtins/local-network/local-network.addon.mjs +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.js +5 -5
- package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/dist/builtins/platform-probe/index.js +13 -13
- package/dist/builtins/platform-probe/index.mjs +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +4 -4
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/dist/builtins/snapshot/index.js +13 -13
- package/dist/builtins/snapshot/index.mjs +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +4 -4
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +9 -9
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +1 -1
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +5 -5
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- package/dist/builtins/system-config/system-config.addon.js +5 -5
- package/dist/builtins/system-config/system-config.addon.mjs +1 -1
- package/dist/builtins/winston-logging/index.js +3 -3
- package/dist/builtins/winston-logging/index.mjs +1 -1
- package/dist/dist-C7oOY4iL.mjs +24559 -0
- package/dist/dist-COIhbSao.js +25032 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +92 -115
- package/dist/index.mjs +52 -52
- package/dist/kernel/moleculer/child-cap-descriptors.d.ts +34 -0
- package/dist/kernel/moleculer/child-cap-dispatch.d.ts +10 -2
- package/dist/kernel/transport/child-cap-protocol.d.ts +20 -0
- package/dist/{manifest-python-deps-u-AQBQY6.mjs → manifest-python-deps-BYIV8-rc.mjs} +31 -29
- package/dist/{manifest-python-deps-CAnO1wPx.js → manifest-python-deps-CZFqI4wp.js} +7 -5
- package/package.json +1 -1
|
@@ -3,8 +3,8 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
+
const require_dist = require("../../dist-COIhbSao.js");
|
|
6
7
|
const require_formatter = require("../../formatter-DqAKDlvN.js");
|
|
7
|
-
let _camstack_types = require("@camstack/types");
|
|
8
8
|
//#region src/builtins/console-logging/console-destination.ts
|
|
9
9
|
var LEVEL_RANK = {
|
|
10
10
|
debug: 0,
|
|
@@ -42,7 +42,7 @@ var ConsoleDestination = class {
|
|
|
42
42
|
* LogManager keeps working as long as at least one destination is
|
|
43
43
|
* registered.
|
|
44
44
|
*/
|
|
45
|
-
var ConsoleLoggingAddon = class extends
|
|
45
|
+
var ConsoleLoggingAddon = class extends require_dist.BaseAddon {
|
|
46
46
|
destination = null;
|
|
47
47
|
constructor() {
|
|
48
48
|
super({ level: "info" });
|
|
@@ -52,7 +52,7 @@ var ConsoleLoggingAddon = class extends _camstack_types.BaseAddon {
|
|
|
52
52
|
await this.destination.initialize({ level: this.config.level });
|
|
53
53
|
this.ctx.logger.info("Console logging initialized");
|
|
54
54
|
return [{
|
|
55
|
-
capability:
|
|
55
|
+
capability: require_dist.logDestinationCapability,
|
|
56
56
|
provider: this.destination
|
|
57
57
|
}];
|
|
58
58
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { P as logDestinationCapability, et as BaseAddon } from "../../dist-C7oOY4iL.mjs";
|
|
1
2
|
import { t as formatLogLine } from "../../formatter-B7qW8bPJ.mjs";
|
|
2
|
-
import { BaseAddon, logDestinationCapability } from "@camstack/types";
|
|
3
3
|
//#region src/builtins/console-logging/console-destination.ts
|
|
4
4
|
var LEVEL_RANK = {
|
|
5
5
|
debug: 0,
|
|
@@ -3,10 +3,10 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
+
const require_dist = require("../../dist-COIhbSao.js");
|
|
6
7
|
let _camstack_types_node = require("@camstack/types/node");
|
|
7
|
-
let _camstack_types = require("@camstack/types");
|
|
8
|
-
let node_crypto = require("node:crypto");
|
|
9
8
|
let zod = require("zod");
|
|
9
|
+
let node_crypto = require("node:crypto");
|
|
10
10
|
//#region src/builtins/device-manager/day-night-config-schema.ts
|
|
11
11
|
var MODE_LABELS = {
|
|
12
12
|
auto: "Auto",
|
|
@@ -328,10 +328,10 @@ var DAY_NIGHT_BUILDER_ID = "day-night";
|
|
|
328
328
|
var IMAGE_SETTINGS_BUILDER_ID = "image-settings";
|
|
329
329
|
var STREAM_PARAMS_REDUCER = {
|
|
330
330
|
kind: "profile",
|
|
331
|
-
buildSchema: (options, status) =>
|
|
331
|
+
buildSchema: (options, status) => require_dist.buildStreamParamsConfigSchema(options, status ?? null),
|
|
332
332
|
applyPatch: async (patch, setProfile) => {
|
|
333
|
-
for (const meta of
|
|
334
|
-
const profilePatch =
|
|
333
|
+
for (const meta of require_dist.STREAM_PROFILE_META) {
|
|
334
|
+
const profilePatch = require_dist.parseStreamParamsFormPatch(patch, meta.prefix);
|
|
335
335
|
if (profilePatch) await setProfile(meta.profile, profilePatch);
|
|
336
336
|
}
|
|
337
337
|
}
|
|
@@ -504,7 +504,7 @@ function mergeAggregates(parts) {
|
|
|
504
504
|
for (const s of sections) {
|
|
505
505
|
const tabId = s.tab ?? "general";
|
|
506
506
|
if (tabDecls.has(tabId)) continue;
|
|
507
|
-
const known =
|
|
507
|
+
const known = require_dist.WELL_KNOWN_TAB_MAP[tabId];
|
|
508
508
|
if (known) tabDecls.set(tabId, {
|
|
509
509
|
id: known.id,
|
|
510
510
|
label: known.label,
|
|
@@ -579,7 +579,7 @@ function isRecord$1(x) {
|
|
|
579
579
|
function isCameraDevice(device) {
|
|
580
580
|
return "getStreamSources" in device && typeof device.getStreamSources === "function";
|
|
581
581
|
}
|
|
582
|
-
var DEVICE_FEATURE_VALUES = new Set(Object.values(
|
|
582
|
+
var DEVICE_FEATURE_VALUES = new Set(Object.values(require_dist.DeviceFeature));
|
|
583
583
|
/**
|
|
584
584
|
* Validate persisted feature strings against the `DeviceFeature` enum
|
|
585
585
|
* — workers serialise the live `device.features` array (so every entry
|
|
@@ -621,7 +621,7 @@ function buildSourceInfoFromConfig(persistedConfig, stableId, addonId) {
|
|
|
621
621
|
...uniqueId !== void 0 ? { uniqueId } : {}
|
|
622
622
|
};
|
|
623
623
|
}
|
|
624
|
-
var DEVICE_ROLE_VALUES = new Set(Object.values(
|
|
624
|
+
var DEVICE_ROLE_VALUES = new Set(Object.values(require_dist.DeviceRole));
|
|
625
625
|
/** Type guard: a string is a known `DeviceRole` enum member. */
|
|
626
626
|
function isDeviceRole(value) {
|
|
627
627
|
return DEVICE_ROLE_VALUES.has(value);
|
|
@@ -705,7 +705,7 @@ function resolveDeviceById(registry, deviceId) {
|
|
|
705
705
|
*/
|
|
706
706
|
function wireRemoteNativeCapSync(ctx, remoteNativeCaps) {
|
|
707
707
|
const localNodeId = ctx.kernel.localNodeId ?? "hub";
|
|
708
|
-
ctx.eventBus.subscribe({ category:
|
|
708
|
+
ctx.eventBus.subscribe({ category: require_dist.EventCategory.DeviceBindingsChanged }, (event) => {
|
|
709
709
|
const { deviceId, capName, reason, addonId, nodeId } = event.data;
|
|
710
710
|
if (nodeId === localNodeId) return;
|
|
711
711
|
if (reason === "native-registered") {
|
|
@@ -953,7 +953,7 @@ async function getDeviceAggregate(deps, deviceId, kind) {
|
|
|
953
953
|
const seenCaps = new Set(bindingEntries.map((e) => e.capName));
|
|
954
954
|
const results = await Promise.all(bindingEntries.map(async (entry) => {
|
|
955
955
|
const def = registry.getDefinition(entry.capName);
|
|
956
|
-
if (
|
|
956
|
+
if (require_dist.isDeviceConfigCap(def)) return deriveDeviceConfigContribution(deps, registry, def, entry, deviceId, kind);
|
|
957
957
|
if (!def?.exposesDeviceSettings) return null;
|
|
958
958
|
const provider = registry.getProviderByAddon(entry.capName, entry.providerAddonId);
|
|
959
959
|
if (!provider) return null;
|
|
@@ -1241,7 +1241,7 @@ function resolveNativeDeviceOwner(deps, deviceId) {
|
|
|
1241
1241
|
* `cap-status-types.ts`.
|
|
1242
1242
|
*/
|
|
1243
1243
|
async function getDeviceStatusAggregate(deps, input) {
|
|
1244
|
-
const capNames = input.caps ??
|
|
1244
|
+
const capNames = input.caps ?? require_dist.CAP_NAMES_WITH_STATUS;
|
|
1245
1245
|
const registry = deps.capabilityRegistry;
|
|
1246
1246
|
const out = {};
|
|
1247
1247
|
if (!registry) {
|
|
@@ -1283,7 +1283,7 @@ async function getDeviceStatusAggregate(deps, input) {
|
|
|
1283
1283
|
tags: { deviceId: input.deviceId },
|
|
1284
1284
|
meta: {
|
|
1285
1285
|
capName,
|
|
1286
|
-
error:
|
|
1286
|
+
error: require_dist.errMsg(err)
|
|
1287
1287
|
}
|
|
1288
1288
|
});
|
|
1289
1289
|
out[capName] = null;
|
|
@@ -1316,7 +1316,7 @@ async function resolveDriverConfigSchema(deps, deviceId, hubLocal) {
|
|
|
1316
1316
|
const RETRY_DELAY_MS = 750;
|
|
1317
1317
|
let lastErr;
|
|
1318
1318
|
for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
|
|
1319
|
-
if (attempt > 0) await
|
|
1319
|
+
if (attempt > 0) await require_dist.sleep(RETRY_DELAY_MS);
|
|
1320
1320
|
try {
|
|
1321
1321
|
const schema = await ops.getSettingsSchema({ deviceId });
|
|
1322
1322
|
if (!schema) return { status: "none" };
|
|
@@ -1333,12 +1333,12 @@ async function resolveDriverConfigSchema(deps, deviceId, hubLocal) {
|
|
|
1333
1333
|
meta: {
|
|
1334
1334
|
attempt: attempt + 1,
|
|
1335
1335
|
maxRetries: MAX_RETRIES,
|
|
1336
|
-
error:
|
|
1336
|
+
error: require_dist.errMsg(err)
|
|
1337
1337
|
}
|
|
1338
1338
|
});
|
|
1339
1339
|
}
|
|
1340
1340
|
}
|
|
1341
|
-
const msg =
|
|
1341
|
+
const msg = require_dist.errMsg(lastErr);
|
|
1342
1342
|
deps.ctx.logger.warn("cross-process getSettingsSchema failed after retries — driver settings temporarily unavailable", {
|
|
1343
1343
|
tags: { deviceId },
|
|
1344
1344
|
meta: { error: msg }
|
|
@@ -1391,7 +1391,7 @@ async function updateDeviceField(deps, input) {
|
|
|
1391
1391
|
const registry = deps.capabilityRegistry;
|
|
1392
1392
|
if (!registry) throw new Error("[device-manager] updateDeviceField requires capability registry — unavailable on this node");
|
|
1393
1393
|
const def = registry.getDefinition(input.writerCapName);
|
|
1394
|
-
if (
|
|
1394
|
+
if (require_dist.isDeviceConfigCap(def)) {
|
|
1395
1395
|
if (def.deviceConfig.ui.kind === "widget") return { success: true };
|
|
1396
1396
|
const dcProvider = registry.getProviderForDevice(input.writerCapName, input.deviceId);
|
|
1397
1397
|
if (!dcProvider) throw new Error(`[device-manager] no provider for device-config cap "${input.writerCapName}" on device ${input.deviceId}`);
|
|
@@ -1510,7 +1510,7 @@ async function applyGroupPatch(deps, deviceId, group) {
|
|
|
1510
1510
|
const registry = deps.capabilityRegistry;
|
|
1511
1511
|
if (!registry) throw new Error("[device-manager] capability registry unavailable");
|
|
1512
1512
|
const def = registry.getDefinition(group.writerCapName);
|
|
1513
|
-
if (
|
|
1513
|
+
if (require_dist.isDeviceConfigCap(def)) {
|
|
1514
1514
|
if (def.deviceConfig.ui.kind === "widget") return;
|
|
1515
1515
|
const dcProvider = registry.getProviderForDevice(group.writerCapName, deviceId);
|
|
1516
1516
|
if (!dcProvider) throw new Error(`[device-manager] no provider for device-config cap "${group.writerCapName}" on device ${deviceId}`);
|
|
@@ -1555,7 +1555,7 @@ async function setWrapperActive(deps, input) {
|
|
|
1555
1555
|
type: "addon",
|
|
1556
1556
|
id: deps.ctx.id
|
|
1557
1557
|
},
|
|
1558
|
-
category:
|
|
1558
|
+
category: require_dist.EventCategory.DeviceBindingsChanged,
|
|
1559
1559
|
data: {
|
|
1560
1560
|
deviceId: input.deviceId,
|
|
1561
1561
|
capName: input.capName,
|
|
@@ -1578,7 +1578,7 @@ function wireableEntryForDef(capName, def) {
|
|
|
1578
1578
|
const schema = status?.schema;
|
|
1579
1579
|
if (!schema) return null;
|
|
1580
1580
|
const itemArray = status.itemArray;
|
|
1581
|
-
const fields = [...
|
|
1581
|
+
const fields = [...require_dist.enumerateSchemaFields(schema), ...itemArray ? require_dist.enumerateItemArrayFields(itemArray) : []].map((f) => ({
|
|
1582
1582
|
path: f.path,
|
|
1583
1583
|
kind: f.kind,
|
|
1584
1584
|
...f.enumValues !== void 0 ? { enumValues: [...f.enumValues] } : {},
|
|
@@ -1625,7 +1625,7 @@ async function getWireableFields(deps, input) {
|
|
|
1625
1625
|
}
|
|
1626
1626
|
if (input.includeSynthesizable === true) {
|
|
1627
1627
|
const deviceType = ((await deps.ctx.settings.readAddonStore()).deviceMeta ?? {})[String(deviceId)]?.type;
|
|
1628
|
-
if (deviceType !== void 0) for (const def of
|
|
1628
|
+
if (deviceType !== void 0) for (const def of require_dist.ALL_CAPABILITY_DEFINITIONS) {
|
|
1629
1629
|
if (seen.has(def.name)) continue;
|
|
1630
1630
|
if (def.scope !== "device" || def.kind === "wrapper") continue;
|
|
1631
1631
|
if (def.status?.empty === void 0) continue;
|
|
@@ -1914,7 +1914,7 @@ async function stampIntegrationId(metaStore, settings, ctx, deviceId, integratio
|
|
|
1914
1914
|
type: "device",
|
|
1915
1915
|
id: deviceId
|
|
1916
1916
|
},
|
|
1917
|
-
category:
|
|
1917
|
+
category: require_dist.EventCategory.DeviceMetaChanged,
|
|
1918
1918
|
data: {
|
|
1919
1919
|
deviceId,
|
|
1920
1920
|
field: "integrationId",
|
|
@@ -2005,7 +2005,7 @@ async function registerDevice(pctx, input) {
|
|
|
2005
2005
|
type: "device",
|
|
2006
2006
|
id
|
|
2007
2007
|
},
|
|
2008
|
-
category:
|
|
2008
|
+
category: require_dist.EventCategory.DeviceRegistered,
|
|
2009
2009
|
data: {
|
|
2010
2010
|
deviceId: id,
|
|
2011
2011
|
name: name.length > 0 ? name : stableId,
|
|
@@ -2020,7 +2020,7 @@ async function registerDevice(pctx, input) {
|
|
|
2020
2020
|
type: "device",
|
|
2021
2021
|
id
|
|
2022
2022
|
},
|
|
2023
|
-
category:
|
|
2023
|
+
category: require_dist.EventCategory.DeviceMetaChanged,
|
|
2024
2024
|
data: {
|
|
2025
2025
|
deviceId: id,
|
|
2026
2026
|
name: name.length > 0 ? name : stableId,
|
|
@@ -2036,7 +2036,7 @@ async function registerDevice(pctx, input) {
|
|
|
2036
2036
|
type: "device",
|
|
2037
2037
|
id
|
|
2038
2038
|
},
|
|
2039
|
-
category:
|
|
2039
|
+
category: require_dist.EventCategory.DeviceProvisioned,
|
|
2040
2040
|
data: {
|
|
2041
2041
|
deviceId: id,
|
|
2042
2042
|
fingerprint: exportFingerprint,
|
|
@@ -2096,7 +2096,7 @@ async function removeDevice(pctx, input) {
|
|
|
2096
2096
|
type: "device",
|
|
2097
2097
|
id: deviceId
|
|
2098
2098
|
},
|
|
2099
|
-
category:
|
|
2099
|
+
category: require_dist.EventCategory.DeviceUnregistered,
|
|
2100
2100
|
data: {
|
|
2101
2101
|
deviceId,
|
|
2102
2102
|
providerId: addonId,
|
|
@@ -2196,7 +2196,7 @@ async function setName(pctx, input) {
|
|
|
2196
2196
|
type: "device",
|
|
2197
2197
|
id: deviceId
|
|
2198
2198
|
},
|
|
2199
|
-
category:
|
|
2199
|
+
category: require_dist.EventCategory.DeviceMetaChanged,
|
|
2200
2200
|
data: {
|
|
2201
2201
|
deviceId,
|
|
2202
2202
|
field: "name",
|
|
@@ -2210,7 +2210,7 @@ async function setName(pctx, input) {
|
|
|
2210
2210
|
type: "device",
|
|
2211
2211
|
id: child.id
|
|
2212
2212
|
},
|
|
2213
|
-
category:
|
|
2213
|
+
category: require_dist.EventCategory.DeviceMetaChanged,
|
|
2214
2214
|
data: {
|
|
2215
2215
|
deviceId: child.id,
|
|
2216
2216
|
field: "name",
|
|
@@ -2247,7 +2247,7 @@ async function setLocation(pctx, input) {
|
|
|
2247
2247
|
type: "device",
|
|
2248
2248
|
id: deviceId
|
|
2249
2249
|
},
|
|
2250
|
-
category:
|
|
2250
|
+
category: require_dist.EventCategory.DeviceMetaChanged,
|
|
2251
2251
|
data: {
|
|
2252
2252
|
deviceId,
|
|
2253
2253
|
field: "location",
|
|
@@ -2285,7 +2285,7 @@ async function setType(pctx, input) {
|
|
|
2285
2285
|
type: "device",
|
|
2286
2286
|
id: deviceId
|
|
2287
2287
|
},
|
|
2288
|
-
category:
|
|
2288
|
+
category: require_dist.EventCategory.DeviceMetaChanged,
|
|
2289
2289
|
data: {
|
|
2290
2290
|
deviceId,
|
|
2291
2291
|
field: "type",
|
|
@@ -2331,7 +2331,7 @@ async function setLinkDeviceId(pctx, input) {
|
|
|
2331
2331
|
type: "device",
|
|
2332
2332
|
id: deviceId
|
|
2333
2333
|
},
|
|
2334
|
-
category:
|
|
2334
|
+
category: require_dist.EventCategory.DeviceMetaChanged,
|
|
2335
2335
|
data: {
|
|
2336
2336
|
deviceId,
|
|
2337
2337
|
field: "linkDeviceId",
|
|
@@ -2369,7 +2369,7 @@ async function setPrimaryChildEntityId(pctx, input) {
|
|
|
2369
2369
|
type: "device",
|
|
2370
2370
|
id: deviceId
|
|
2371
2371
|
},
|
|
2372
|
-
category:
|
|
2372
|
+
category: require_dist.EventCategory.DeviceMetaChanged,
|
|
2373
2373
|
data: {
|
|
2374
2374
|
deviceId,
|
|
2375
2375
|
field: "primaryChildEntityId",
|
|
@@ -2406,7 +2406,7 @@ async function setChildLayout(pctx, input) {
|
|
|
2406
2406
|
type: "device",
|
|
2407
2407
|
id: deviceId
|
|
2408
2408
|
},
|
|
2409
|
-
category:
|
|
2409
|
+
category: require_dist.EventCategory.DeviceMetaChanged,
|
|
2410
2410
|
data: {
|
|
2411
2411
|
deviceId,
|
|
2412
2412
|
field: "childLayout",
|
|
@@ -2427,7 +2427,7 @@ async function setDeviceLinks(pctx, input) {
|
|
|
2427
2427
|
if (cycle) throw new Error(`[device-manager] setDeviceLinks: cross-device link cycle: ${cycle.join(" → ")}`);
|
|
2428
2428
|
for (const link of deviceLinks) {
|
|
2429
2429
|
if (link.source.kind !== "expression") continue;
|
|
2430
|
-
const err =
|
|
2430
|
+
const err = require_dist.validateExpressionSource(link.source);
|
|
2431
2431
|
if (err) throw new Error(`[device-manager] setDeviceLinks: invalid expression on link '${link.id}': ${err}`);
|
|
2432
2432
|
}
|
|
2433
2433
|
await pctx.metaStore.withMetaWriteLock(async () => {
|
|
@@ -2454,7 +2454,7 @@ async function setDeviceLinks(pctx, input) {
|
|
|
2454
2454
|
type: "device",
|
|
2455
2455
|
id: deviceId
|
|
2456
2456
|
},
|
|
2457
|
-
category:
|
|
2457
|
+
category: require_dist.EventCategory.DeviceMetaChanged,
|
|
2458
2458
|
data: {
|
|
2459
2459
|
deviceId,
|
|
2460
2460
|
field: "deviceLinks",
|
|
@@ -2491,7 +2491,7 @@ async function setRole(pctx, input) {
|
|
|
2491
2491
|
type: "device",
|
|
2492
2492
|
id: deviceId
|
|
2493
2493
|
},
|
|
2494
|
-
category:
|
|
2494
|
+
category: require_dist.EventCategory.DeviceMetaChanged,
|
|
2495
2495
|
data: {
|
|
2496
2496
|
deviceId,
|
|
2497
2497
|
field: "role",
|
|
@@ -2509,10 +2509,10 @@ async function setRole(pctx, input) {
|
|
|
2509
2509
|
function normalizeDisplayOverride(display) {
|
|
2510
2510
|
return {
|
|
2511
2511
|
...display,
|
|
2512
|
-
...display.unit !== void 0 ? { unit:
|
|
2512
|
+
...display.unit !== void 0 ? { unit: require_dist.normalizeUnit(display.unit) ?? display.unit } : {},
|
|
2513
2513
|
...display.perCap !== void 0 ? { perCap: Object.fromEntries(Object.entries(display.perCap).map(([cap, refine]) => [cap, refine.unit !== void 0 ? {
|
|
2514
2514
|
...refine,
|
|
2515
|
-
unit:
|
|
2515
|
+
unit: require_dist.normalizeUnit(refine.unit) ?? refine.unit
|
|
2516
2516
|
} : refine])) } : {}
|
|
2517
2517
|
};
|
|
2518
2518
|
}
|
|
@@ -2548,7 +2548,7 @@ async function setDisplay(pctx, input) {
|
|
|
2548
2548
|
type: "device",
|
|
2549
2549
|
id: deviceId
|
|
2550
2550
|
},
|
|
2551
|
-
category:
|
|
2551
|
+
category: require_dist.EventCategory.DeviceMetaChanged,
|
|
2552
2552
|
data: {
|
|
2553
2553
|
deviceId,
|
|
2554
2554
|
field: "display",
|
|
@@ -2573,7 +2573,7 @@ async function getRoleDisplayDefaults(pctx, _input) {
|
|
|
2573
2573
|
async function setRoleDisplayDefaults(pctx, input) {
|
|
2574
2574
|
const normalized = Object.fromEntries(Object.entries(input.defaults).map(([role, def]) => [role, def.unit !== void 0 ? {
|
|
2575
2575
|
...def,
|
|
2576
|
-
unit:
|
|
2576
|
+
unit: require_dist.normalizeUnit(def.unit) ?? def.unit
|
|
2577
2577
|
} : def]));
|
|
2578
2578
|
await pctx.settings.writeAddonStore({ roleDisplayDefaults: normalized });
|
|
2579
2579
|
}
|
|
@@ -2623,7 +2623,7 @@ async function applyInitialMeta(pctx, input) {
|
|
|
2623
2623
|
type: "device",
|
|
2624
2624
|
id: deviceId
|
|
2625
2625
|
},
|
|
2626
|
-
category:
|
|
2626
|
+
category: require_dist.EventCategory.DeviceMetaChanged,
|
|
2627
2627
|
data: {
|
|
2628
2628
|
deviceId,
|
|
2629
2629
|
field,
|
|
@@ -2682,7 +2682,7 @@ async function setMetadata(pctx, input) {
|
|
|
2682
2682
|
type: "device",
|
|
2683
2683
|
id: deviceId
|
|
2684
2684
|
},
|
|
2685
|
-
category:
|
|
2685
|
+
category: require_dist.EventCategory.DeviceMetaChanged,
|
|
2686
2686
|
data: {
|
|
2687
2687
|
deviceId,
|
|
2688
2688
|
field: "metadata",
|
|
@@ -2719,7 +2719,7 @@ async function setDisabled(pctx, input) {
|
|
|
2719
2719
|
type: "device",
|
|
2720
2720
|
id: deviceId
|
|
2721
2721
|
},
|
|
2722
|
-
category:
|
|
2722
|
+
category: require_dist.EventCategory.DeviceMetaChanged,
|
|
2723
2723
|
data: {
|
|
2724
2724
|
deviceId,
|
|
2725
2725
|
field: "disabled",
|
|
@@ -2808,7 +2808,7 @@ async function removeLocation(pctx, input) {
|
|
|
2808
2808
|
type: "device",
|
|
2809
2809
|
id: deviceId
|
|
2810
2810
|
},
|
|
2811
|
-
category:
|
|
2811
|
+
category: require_dist.EventCategory.DeviceMetaChanged,
|
|
2812
2812
|
data: {
|
|
2813
2813
|
deviceId,
|
|
2814
2814
|
field: "location",
|
|
@@ -3129,7 +3129,7 @@ async function listAll(pctx, input) {
|
|
|
3129
3129
|
online: pctx.host.resolveDeviceOnline(m.id, pctx.registry !== null),
|
|
3130
3130
|
probed: pctx.host.resolveDeviceProbed(m.id),
|
|
3131
3131
|
features: persistedFeatures(m?.features),
|
|
3132
|
-
isCamera: persistedType ===
|
|
3132
|
+
isCamera: persistedType === require_dist.DeviceType.Camera,
|
|
3133
3133
|
config: persistedConfig ?? {},
|
|
3134
3134
|
metadata,
|
|
3135
3135
|
...m?.integrationId !== void 0 ? { integrationId: m.integrationId } : {},
|
|
@@ -3357,7 +3357,7 @@ async function remove(pctx, input) {
|
|
|
3357
3357
|
deviceId: id,
|
|
3358
3358
|
deviceName: persistedMeta.name
|
|
3359
3359
|
},
|
|
3360
|
-
meta: { error:
|
|
3360
|
+
meta: { error: require_dist.errMsg(err) }
|
|
3361
3361
|
});
|
|
3362
3362
|
}
|
|
3363
3363
|
await pctx.provider.removeDevice({ deviceId: id });
|
|
@@ -3471,7 +3471,7 @@ async function adoptDevice(pctx, input) {
|
|
|
3471
3471
|
deviceId: summary.id,
|
|
3472
3472
|
integrationId: input.integrationId
|
|
3473
3473
|
},
|
|
3474
|
-
meta: { error:
|
|
3474
|
+
meta: { error: require_dist.errMsg(err) }
|
|
3475
3475
|
});
|
|
3476
3476
|
}
|
|
3477
3477
|
return summary;
|
|
@@ -3496,7 +3496,7 @@ async function createDevice(pctx, input) {
|
|
|
3496
3496
|
deviceId: summary.id,
|
|
3497
3497
|
integrationId: input.integrationId
|
|
3498
3498
|
},
|
|
3499
|
-
meta: { error:
|
|
3499
|
+
meta: { error: require_dist.errMsg(err) }
|
|
3500
3500
|
});
|
|
3501
3501
|
}
|
|
3502
3502
|
return summary;
|
|
@@ -3568,7 +3568,7 @@ async function testField(pctx, input) {
|
|
|
3568
3568
|
error: void 0
|
|
3569
3569
|
};
|
|
3570
3570
|
return dp.testCreationField({
|
|
3571
|
-
type:
|
|
3571
|
+
type: require_dist.DeviceType.Camera,
|
|
3572
3572
|
key: input.key,
|
|
3573
3573
|
value: input.value
|
|
3574
3574
|
});
|
|
@@ -3591,7 +3591,7 @@ function isRecord(x) {
|
|
|
3591
3591
|
function resolveLinkValue(link, readField) {
|
|
3592
3592
|
const src = link.source;
|
|
3593
3593
|
if (src.kind === "expression") return void 0;
|
|
3594
|
-
return
|
|
3594
|
+
return require_dist.applyTransform(src.kind === "literal" ? src.value : readField(src.cap, src.fieldPath), link.transform);
|
|
3595
3595
|
}
|
|
3596
3596
|
/**
|
|
3597
3597
|
* Sync-channel expression resolution: bindings read from the mirror via
|
|
@@ -3616,10 +3616,10 @@ function resolveExpressionLinkValue(rl, readField, now) {
|
|
|
3616
3616
|
bindingValues[name] = null;
|
|
3617
3617
|
continue;
|
|
3618
3618
|
}
|
|
3619
|
-
bindingValues[name] =
|
|
3619
|
+
bindingValues[name] = require_dist.toExpressionValue(readField(bId, b.cap, b.fieldPath)) ?? null;
|
|
3620
3620
|
}
|
|
3621
|
-
const result =
|
|
3622
|
-
return result.ok ?
|
|
3621
|
+
const result = require_dist.evaluateLinkExpression(src.expr, bindingValues, now);
|
|
3622
|
+
return result.ok ? require_dist.applyTransform(result.value, rl.link.transform) : void 0;
|
|
3623
3623
|
}
|
|
3624
3624
|
/** Narrow Zod v4's structural `$ZodType` (returned by `.unwrap()`) back to the
|
|
3625
3625
|
* concrete classic `z.ZodType`. Every runtime schema is a `z.ZodType`, so this
|
|
@@ -3663,7 +3663,7 @@ function fillNullableDefaults(schema, value) {
|
|
|
3663
3663
|
* was applied. Pure + immutable (base array/items are never mutated).
|
|
3664
3664
|
*/
|
|
3665
3665
|
function upsertItemArrayLinks(draft, grouped, itemArray) {
|
|
3666
|
-
const arrRaw =
|
|
3666
|
+
const arrRaw = require_dist.getByPath(draft, itemArray.path);
|
|
3667
3667
|
const arr = Array.isArray(arrRaw) ? [...arrRaw] : [];
|
|
3668
3668
|
let touched = false;
|
|
3669
3669
|
for (const [itemKey, group] of grouped) {
|
|
@@ -3677,7 +3677,7 @@ function upsertItemArrayLinks(draft, grouped, itemArray) {
|
|
|
3677
3677
|
let itemTouched = false;
|
|
3678
3678
|
for (const { link, sourceValue } of group) {
|
|
3679
3679
|
if (sourceValue === void 0) continue;
|
|
3680
|
-
item =
|
|
3680
|
+
item = require_dist.setByPath(item, link.target.fieldPath, sourceValue);
|
|
3681
3681
|
itemTouched = true;
|
|
3682
3682
|
}
|
|
3683
3683
|
if (!itemTouched) continue;
|
|
@@ -3694,7 +3694,7 @@ function upsertItemArrayLinks(draft, grouped, itemArray) {
|
|
|
3694
3694
|
touched: false
|
|
3695
3695
|
};
|
|
3696
3696
|
return {
|
|
3697
|
-
draft:
|
|
3697
|
+
draft: require_dist.setByPath(draft, itemArray.path, arr),
|
|
3698
3698
|
touched: true
|
|
3699
3699
|
};
|
|
3700
3700
|
}
|
|
@@ -3726,7 +3726,7 @@ function mergeLinkedStatus(base, resolved, statusSchema, itemArray) {
|
|
|
3726
3726
|
continue;
|
|
3727
3727
|
}
|
|
3728
3728
|
if (entry.sourceValue === void 0) continue;
|
|
3729
|
-
draft =
|
|
3729
|
+
draft = require_dist.setByPath(draft, entry.link.target.fieldPath, entry.sourceValue);
|
|
3730
3730
|
touched = true;
|
|
3731
3731
|
}
|
|
3732
3732
|
if (itemArray && grouped.size > 0) {
|
|
@@ -3897,9 +3897,9 @@ var DeviceStateMirror = class DeviceStateMirror {
|
|
|
3897
3897
|
* regress a device to offline merely because its mirror is empty.
|
|
3898
3898
|
*/
|
|
3899
3899
|
resolveDeviceOnline(deviceId, fallbackOnline) {
|
|
3900
|
-
const raw = this.stateMirror.get(deviceId)?.get(
|
|
3900
|
+
const raw = this.stateMirror.get(deviceId)?.get(require_dist.deviceStatusCapability.name);
|
|
3901
3901
|
if (!raw) return fallbackOnline;
|
|
3902
|
-
const parsed =
|
|
3902
|
+
const parsed = require_dist.DeviceStatusSchema.safeParse(raw);
|
|
3903
3903
|
if (!parsed.success) return fallbackOnline;
|
|
3904
3904
|
return parsed.data.online;
|
|
3905
3905
|
}
|
|
@@ -3943,7 +3943,7 @@ var DeviceStateMirror = class DeviceStateMirror {
|
|
|
3943
3943
|
const now = Date.now();
|
|
3944
3944
|
const resolved = links.map((rl) => ({
|
|
3945
3945
|
link: rl.link,
|
|
3946
|
-
sourceValue: rl.link.source.kind === "expression" ? resolveExpressionLinkValue(rl, (srcDeviceId, srcCap, fieldPath) =>
|
|
3946
|
+
sourceValue: rl.link.source.kind === "expression" ? resolveExpressionLinkValue(rl, (srcDeviceId, srcCap, fieldPath) => require_dist.getByPath(this.stateMirror.get(srcDeviceId)?.get(srcCap), fieldPath), now) : resolveLinkValue(rl.link, (srcCap, fieldPath) => require_dist.getByPath(this.stateMirror.get(rl.sourceDeviceId)?.get(srcCap), fieldPath))
|
|
3947
3947
|
}));
|
|
3948
3948
|
const capStatus = this.linkHost.capabilityRegistry?.getDefinition(cap)?.status;
|
|
3949
3949
|
const schema = capStatus?.schema;
|
|
@@ -3998,7 +3998,7 @@ var DeviceStateMirror = class DeviceStateMirror {
|
|
|
3998
3998
|
type: "device",
|
|
3999
3999
|
id: deviceId
|
|
4000
4000
|
},
|
|
4001
|
-
category:
|
|
4001
|
+
category: require_dist.EventCategory.DeviceStateChanged,
|
|
4002
4002
|
data: {
|
|
4003
4003
|
deviceId,
|
|
4004
4004
|
capName,
|
|
@@ -4173,7 +4173,7 @@ async function resolveLinkedStatusInner(pctx, input) {
|
|
|
4173
4173
|
if (src.kind === "literal") {
|
|
4174
4174
|
resolved.push({
|
|
4175
4175
|
link,
|
|
4176
|
-
sourceValue:
|
|
4176
|
+
sourceValue: require_dist.applyTransform(src.value, link.transform)
|
|
4177
4177
|
});
|
|
4178
4178
|
continue;
|
|
4179
4179
|
}
|
|
@@ -4189,12 +4189,12 @@ async function resolveLinkedStatusInner(pctx, input) {
|
|
|
4189
4189
|
bindingValues[name] = null;
|
|
4190
4190
|
continue;
|
|
4191
4191
|
}
|
|
4192
|
-
bindingValues[name] =
|
|
4192
|
+
bindingValues[name] = require_dist.toExpressionValue(require_dist.getByPath((await readSourceStatus(bId, b.cap)).status, b.fieldPath)) ?? null;
|
|
4193
4193
|
}
|
|
4194
|
-
const result =
|
|
4194
|
+
const result = require_dist.evaluateLinkExpression(src.expr, bindingValues, now);
|
|
4195
4195
|
if (result.ok) resolved.push({
|
|
4196
4196
|
link,
|
|
4197
|
-
sourceValue:
|
|
4197
|
+
sourceValue: require_dist.applyTransform(result.value, link.transform)
|
|
4198
4198
|
});
|
|
4199
4199
|
else pctx.host.ctx.logger.warn("resolveLinkedStatus: expression skipped", {
|
|
4200
4200
|
tags: {
|
|
@@ -4212,10 +4212,10 @@ async function resolveLinkedStatusInner(pctx, input) {
|
|
|
4212
4212
|
if (srcId === null) continue;
|
|
4213
4213
|
const read = await readSourceStatus(srcId, src.cap);
|
|
4214
4214
|
if (!read.ok) continue;
|
|
4215
|
-
const raw =
|
|
4215
|
+
const raw = require_dist.getByPath(read.status, src.fieldPath);
|
|
4216
4216
|
resolved.push({
|
|
4217
4217
|
link,
|
|
4218
|
-
sourceValue:
|
|
4218
|
+
sourceValue: require_dist.applyTransform(raw, link.transform)
|
|
4219
4219
|
});
|
|
4220
4220
|
}
|
|
4221
4221
|
if (resolved.length === 0) return null;
|
|
@@ -4227,7 +4227,7 @@ async function resolveLinkedStatusInner(pctx, input) {
|
|
|
4227
4227
|
}
|
|
4228
4228
|
//#endregion
|
|
4229
4229
|
//#region src/builtins/device-manager/device-manager.addon.ts
|
|
4230
|
-
var DeviceManagerAddon = class extends
|
|
4230
|
+
var DeviceManagerAddon = class extends require_dist.BaseAddon {
|
|
4231
4231
|
constructor() {
|
|
4232
4232
|
super({});
|
|
4233
4233
|
}
|
|
@@ -4676,10 +4676,10 @@ var DeviceManagerAddon = class extends _camstack_types.BaseAddon {
|
|
|
4676
4676
|
this.ctx.logger.info("device-event-propagator started");
|
|
4677
4677
|
}
|
|
4678
4678
|
return [{
|
|
4679
|
-
capability:
|
|
4679
|
+
capability: require_dist.deviceManagerCapability,
|
|
4680
4680
|
provider
|
|
4681
4681
|
}, {
|
|
4682
|
-
capability:
|
|
4682
|
+
capability: require_dist.deviceStateCapability,
|
|
4683
4683
|
provider: {
|
|
4684
4684
|
getSnapshot: async (input) => {
|
|
4685
4685
|
return stateMirror.snapshotForDeviceOverlayed(input.deviceId);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { $ as errMsg, C as enumerateItemArrayFields, D as getByPath, Q as validateExpressionSource, R as normalizeUnit, S as deviceStatusCapability, T as evaluateLinkExpression, Tt as sleep, W as setByPath, X as toExpressionValue, a as DeviceStatusSchema, at as DeviceRole, b as deviceManagerCapability, c as STREAM_PROFILE_META, et as BaseAddon, g as applyTransform, i as CAP_NAMES_WITH_STATUS, it as DeviceFeature, ot as DeviceType, st as EventCategory, t as ALL_CAPABILITY_DEFINITIONS, ut as WELL_KNOWN_TAB_MAP, w as enumerateSchemaFields, x as deviceStateCapability, y as buildStreamParamsConfigSchema, yt as isDeviceConfigCap, z as parseStreamParamsFormPatch } from "../../dist-C7oOY4iL.mjs";
|
|
1
2
|
import { canonicalDeviceFingerprint } from "@camstack/types/node";
|
|
2
|
-
import { ALL_CAPABILITY_DEFINITIONS, BaseAddon, CAP_NAMES_WITH_STATUS, DeviceFeature, DeviceRole, DeviceStatusSchema, DeviceType, EventCategory, STREAM_PROFILE_META, WELL_KNOWN_TAB_MAP, applyTransform, buildStreamParamsConfigSchema, deviceManagerCapability, deviceStateCapability, deviceStatusCapability, enumerateItemArrayFields, enumerateSchemaFields, errMsg, evaluateLinkExpression, getByPath, isDeviceConfigCap, normalizeUnit, parseStreamParamsFormPatch, setByPath, sleep, toExpressionValue, validateExpressionSource } from "@camstack/types";
|
|
3
|
-
import { randomUUID } from "node:crypto";
|
|
4
3
|
import { z } from "zod";
|
|
4
|
+
import { randomUUID } from "node:crypto";
|
|
5
5
|
//#region src/builtins/device-manager/day-night-config-schema.ts
|
|
6
6
|
var MODE_LABELS = {
|
|
7
7
|
auto: "Auto",
|
|
@@ -3,8 +3,8 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
+
const require_dist = require("../../dist-COIhbSao.js");
|
|
6
7
|
const require_formatter = require("../../formatter-DqAKDlvN.js");
|
|
7
|
-
let _camstack_types = require("@camstack/types");
|
|
8
8
|
//#region src/builtins/hub-forwarder/hub-forwarder-destination.ts
|
|
9
9
|
var DEFAULT_OUTBOUND_BUFFER_SIZE = 500;
|
|
10
10
|
/**
|
|
@@ -120,7 +120,7 @@ var HubForwarderDestination = class {
|
|
|
120
120
|
* reachable. The broker is read from `ctx.kernel.cluster?.broker`; outbound
|
|
121
121
|
* log replay on hub-connect is handled internally by the destination.
|
|
122
122
|
*/
|
|
123
|
-
var HubForwarderAddon = class extends
|
|
123
|
+
var HubForwarderAddon = class extends require_dist.BaseAddon {
|
|
124
124
|
destination = null;
|
|
125
125
|
constructor() {
|
|
126
126
|
super({});
|
|
@@ -134,7 +134,7 @@ var HubForwarderAddon = class extends _camstack_types.BaseAddon {
|
|
|
134
134
|
else this.ctx.logger.warn("cluster.broker not available — hub forwarding disabled, console only");
|
|
135
135
|
this.ctx.logger.info("Hub forwarder log destination registered");
|
|
136
136
|
return [{
|
|
137
|
-
capability:
|
|
137
|
+
capability: require_dist.logDestinationCapability,
|
|
138
138
|
provider: this.destination
|
|
139
139
|
}];
|
|
140
140
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { P as logDestinationCapability, et as BaseAddon } from "../../dist-C7oOY4iL.mjs";
|
|
1
2
|
import { t as formatLogLine } from "../../formatter-B7qW8bPJ.mjs";
|
|
2
|
-
import { BaseAddon, logDestinationCapability } from "@camstack/types";
|
|
3
3
|
//#region src/builtins/hub-forwarder/hub-forwarder-destination.ts
|
|
4
4
|
var DEFAULT_OUTBOUND_BUFFER_SIZE = 500;
|
|
5
5
|
/**
|