@camstack/system 1.2.314 → 1.2.315
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/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/dist/builtins/alerts/alerts.addon.js +1 -1
- package/dist/builtins/alerts/alerts.addon.mjs +1 -1
- package/dist/builtins/autotrack/index.js +1 -1
- package/dist/builtins/autotrack/index.mjs +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
- package/dist/builtins/camera-grid/index.js +1 -1
- package/dist/builtins/camera-grid/index.mjs +1 -1
- package/dist/builtins/composer/composer-plan.d.ts +8 -1
- package/dist/builtins/composer/composer.addon.js +191 -29
- package/dist/builtins/composer/composer.addon.mjs +195 -33
- package/dist/builtins/composer/composer.d.ts +5 -1
- package/dist/builtins/composer/composition-runtime.d.ts +10 -1
- package/dist/builtins/composer/existing-target.d.ts +9 -0
- package/dist/builtins/composer/field-record.d.ts +12 -3
- package/dist/builtins/console-logging/index.js +1 -1
- package/dist/builtins/console-logging/index.mjs +1 -1
- package/dist/builtins/core-blocks/composition-sources.d.ts +3 -1
- package/dist/builtins/core-blocks/core-blocks.addon.js +3 -103
- package/dist/builtins/core-blocks/core-blocks.addon.mjs +2 -102
- package/dist/builtins/device-manager/device-manager.addon.js +2 -2
- package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
- package/dist/builtins/doorbell/binding-mirror.d.ts +1 -0
- package/dist/builtins/doorbell/doorbell-composition-migration.d.ts +59 -0
- package/dist/builtins/doorbell/virtual-doorbell.addon.d.ts +3 -0
- package/dist/builtins/doorbell/virtual-doorbell.addon.js +315 -8
- package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +315 -8
- package/dist/builtins/hub-forwarder/index.js +1 -1
- package/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/dist/builtins/local-auth/local-auth.addon.js +1 -1
- package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
- package/dist/builtins/local-network/local-network.addon.js +1 -1
- package/dist/builtins/local-network/local-network.addon.mjs +1 -1
- package/dist/builtins/loki-logging/index.js +1 -1
- package/dist/builtins/loki-logging/index.mjs +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/dist/builtins/platform-probe/index.js +1 -1
- package/dist/builtins/platform-probe/index.mjs +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/dist/builtins/snapshot/index.js +1 -1
- package/dist/builtins/snapshot/index.mjs +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +0 -0
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +0 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- package/dist/builtins/system-config/system-config.addon.js +1 -1
- package/dist/builtins/system-config/system-config.addon.mjs +1 -1
- package/dist/builtins/winston-logging/index.js +1 -1
- package/dist/builtins/winston-logging/index.mjs +1 -1
- package/dist/composition-sources-DYqQLRzF.js +122 -0
- package/dist/composition-sources-yonsRneP.mjs +111 -0
- package/dist/{dist-BtNkk3Qz.js → dist-DVKv5i-e.js} +611 -299
- package/dist/{dist-cH4t1ZEm.mjs → dist-MzYJVCLE.mjs} +582 -300
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{retired-settings-keys-DQYHfZ0S.mjs → retired-settings-keys-8yY2sTc-.mjs} +1 -1
- package/dist/{retired-settings-keys-B7imb-qH.js → retired-settings-keys-iY5I0nKM.js} +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
const require_dist = require("./dist-DVKv5i-e.js");
|
|
2
|
+
//#region src/builtins/core-blocks/composition-sources.ts
|
|
3
|
+
/**
|
|
4
|
+
* Describe what a composition reads and writes for SAVE-time validation
|
|
5
|
+
* (D659, D663): one `listAll` per owning addon, one `getBindings` per found
|
|
6
|
+
* device — shared by a device that is both a source and a target. A read that
|
|
7
|
+
* fails makes the device `unreadable`, and the save is REFUSED rather than
|
|
8
|
+
* stored unchecked. Refusing a save destroys nothing (D49).
|
|
9
|
+
*
|
|
10
|
+
* A SOURCE is described by the caps bound to it; an EXISTING TARGET by its row
|
|
11
|
+
* type and each bound cap with the addon serving it — what `planComposition`
|
|
12
|
+
* needs to tell a replace from an add (the composer reads it the same way, from
|
|
13
|
+
* the same two reads: the slim row and `getBindings`).
|
|
14
|
+
*
|
|
15
|
+
* Devices are keyed by `{addonId, stableId}` — never a numeric device id,
|
|
16
|
+
* which is this node's allocation and not the composition's identity.
|
|
17
|
+
*/
|
|
18
|
+
/** Blank binding owners are not native providers and must not turn ADD into REPLACE. */
|
|
19
|
+
function normalizedNativeOwner(owner) {
|
|
20
|
+
const trimmed = owner?.trim();
|
|
21
|
+
return trimmed ? trimmed : null;
|
|
22
|
+
}
|
|
23
|
+
async function listOwners(ports, refs) {
|
|
24
|
+
const addons = [...new Set(refs.map((r) => r.addonId))];
|
|
25
|
+
const listed = await Promise.all(addons.map(async (addonId) => {
|
|
26
|
+
try {
|
|
27
|
+
return [addonId, await ports.listByAddon(addonId)];
|
|
28
|
+
} catch (err) {
|
|
29
|
+
return [addonId, { error: require_dist.errMsg(err) }];
|
|
30
|
+
}
|
|
31
|
+
}));
|
|
32
|
+
return new Map(listed);
|
|
33
|
+
}
|
|
34
|
+
function rowOf(ref, listing) {
|
|
35
|
+
if (listing === void 0) return {
|
|
36
|
+
kind: "unreadable",
|
|
37
|
+
error: `\`${ref.addonId}\` was not listed`
|
|
38
|
+
};
|
|
39
|
+
if ("error" in listing) return {
|
|
40
|
+
kind: "unreadable",
|
|
41
|
+
error: listing.error
|
|
42
|
+
};
|
|
43
|
+
const row = listing.find((r) => r.stableId === ref.stableId);
|
|
44
|
+
return row === void 0 ? { kind: "absent" } : {
|
|
45
|
+
kind: "row",
|
|
46
|
+
row
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/** ONE `getBindings` per found device, whether it is read as a source, a target, or both. */
|
|
50
|
+
async function readBindings(ports, deviceIds) {
|
|
51
|
+
const read = await Promise.all([...new Set(deviceIds)].map(async (deviceId) => {
|
|
52
|
+
try {
|
|
53
|
+
return [deviceId, await ports.bindings(deviceId)];
|
|
54
|
+
} catch (err) {
|
|
55
|
+
return [deviceId, { error: require_dist.errMsg(err) }];
|
|
56
|
+
}
|
|
57
|
+
}));
|
|
58
|
+
return new Map(read);
|
|
59
|
+
}
|
|
60
|
+
function describeSource(lookup, bindings) {
|
|
61
|
+
if (lookup.kind !== "row") return lookup;
|
|
62
|
+
const bound = bindings.get(lookup.row.id);
|
|
63
|
+
if (bound === void 0) return {
|
|
64
|
+
kind: "unreadable",
|
|
65
|
+
error: "its bindings were not read"
|
|
66
|
+
};
|
|
67
|
+
if ("error" in bound) return {
|
|
68
|
+
kind: "unreadable",
|
|
69
|
+
error: bound.error
|
|
70
|
+
};
|
|
71
|
+
return {
|
|
72
|
+
kind: "found",
|
|
73
|
+
deviceId: lookup.row.id,
|
|
74
|
+
caps: new Set(bound.map((b) => b.capName))
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function describeTarget(lookup, bindings) {
|
|
78
|
+
if (lookup.kind !== "row") return lookup;
|
|
79
|
+
const { id, type } = lookup.row;
|
|
80
|
+
const bound = bindings.get(id);
|
|
81
|
+
if (bound === void 0) return {
|
|
82
|
+
kind: "unreadable",
|
|
83
|
+
error: "its bindings were not read"
|
|
84
|
+
};
|
|
85
|
+
if ("error" in bound) return {
|
|
86
|
+
kind: "unreadable",
|
|
87
|
+
error: bound.error
|
|
88
|
+
};
|
|
89
|
+
return {
|
|
90
|
+
kind: "found",
|
|
91
|
+
deviceId: id,
|
|
92
|
+
type,
|
|
93
|
+
nativeCaps: new Map(bound.flatMap((b) => {
|
|
94
|
+
const owner = normalizedNativeOwner(b.nativeAddonId);
|
|
95
|
+
return owner === null ? [] : [[b.capName, owner]];
|
|
96
|
+
}))
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
async function describeCompositionSources(ports, sources, targets = []) {
|
|
100
|
+
const owners = await listOwners(ports, [...sources, ...targets]);
|
|
101
|
+
const lookup = (ref) => [require_dist.compositionSourceKey(ref), rowOf(ref, owners.get(ref.addonId))];
|
|
102
|
+
const sourceRows = sources.map(lookup);
|
|
103
|
+
const targetRows = targets.map(lookup);
|
|
104
|
+
const bindings = await readBindings(ports, [...sourceRows, ...targetRows].flatMap(([, l]) => l.kind === "row" ? [l.row.id] : []));
|
|
105
|
+
return {
|
|
106
|
+
sources: new Map(sourceRows.map(([key, l]) => [key, describeSource(l, bindings)])),
|
|
107
|
+
targets: new Map(targetRows.map(([key, l]) => [key, describeTarget(l, bindings)]))
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
//#endregion
|
|
111
|
+
Object.defineProperty(exports, "describeCompositionSources", {
|
|
112
|
+
enumerable: true,
|
|
113
|
+
get: function() {
|
|
114
|
+
return describeCompositionSources;
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
Object.defineProperty(exports, "normalizedNativeOwner", {
|
|
118
|
+
enumerable: true,
|
|
119
|
+
get: function() {
|
|
120
|
+
return normalizedNativeOwner;
|
|
121
|
+
}
|
|
122
|
+
});
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { In as compositionSourceKey, Wn as errMsg } from "./dist-MzYJVCLE.mjs";
|
|
2
|
+
//#region src/builtins/core-blocks/composition-sources.ts
|
|
3
|
+
/**
|
|
4
|
+
* Describe what a composition reads and writes for SAVE-time validation
|
|
5
|
+
* (D659, D663): one `listAll` per owning addon, one `getBindings` per found
|
|
6
|
+
* device — shared by a device that is both a source and a target. A read that
|
|
7
|
+
* fails makes the device `unreadable`, and the save is REFUSED rather than
|
|
8
|
+
* stored unchecked. Refusing a save destroys nothing (D49).
|
|
9
|
+
*
|
|
10
|
+
* A SOURCE is described by the caps bound to it; an EXISTING TARGET by its row
|
|
11
|
+
* type and each bound cap with the addon serving it — what `planComposition`
|
|
12
|
+
* needs to tell a replace from an add (the composer reads it the same way, from
|
|
13
|
+
* the same two reads: the slim row and `getBindings`).
|
|
14
|
+
*
|
|
15
|
+
* Devices are keyed by `{addonId, stableId}` — never a numeric device id,
|
|
16
|
+
* which is this node's allocation and not the composition's identity.
|
|
17
|
+
*/
|
|
18
|
+
/** Blank binding owners are not native providers and must not turn ADD into REPLACE. */
|
|
19
|
+
function normalizedNativeOwner(owner) {
|
|
20
|
+
const trimmed = owner?.trim();
|
|
21
|
+
return trimmed ? trimmed : null;
|
|
22
|
+
}
|
|
23
|
+
async function listOwners(ports, refs) {
|
|
24
|
+
const addons = [...new Set(refs.map((r) => r.addonId))];
|
|
25
|
+
const listed = await Promise.all(addons.map(async (addonId) => {
|
|
26
|
+
try {
|
|
27
|
+
return [addonId, await ports.listByAddon(addonId)];
|
|
28
|
+
} catch (err) {
|
|
29
|
+
return [addonId, { error: errMsg(err) }];
|
|
30
|
+
}
|
|
31
|
+
}));
|
|
32
|
+
return new Map(listed);
|
|
33
|
+
}
|
|
34
|
+
function rowOf(ref, listing) {
|
|
35
|
+
if (listing === void 0) return {
|
|
36
|
+
kind: "unreadable",
|
|
37
|
+
error: `\`${ref.addonId}\` was not listed`
|
|
38
|
+
};
|
|
39
|
+
if ("error" in listing) return {
|
|
40
|
+
kind: "unreadable",
|
|
41
|
+
error: listing.error
|
|
42
|
+
};
|
|
43
|
+
const row = listing.find((r) => r.stableId === ref.stableId);
|
|
44
|
+
return row === void 0 ? { kind: "absent" } : {
|
|
45
|
+
kind: "row",
|
|
46
|
+
row
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/** ONE `getBindings` per found device, whether it is read as a source, a target, or both. */
|
|
50
|
+
async function readBindings(ports, deviceIds) {
|
|
51
|
+
const read = await Promise.all([...new Set(deviceIds)].map(async (deviceId) => {
|
|
52
|
+
try {
|
|
53
|
+
return [deviceId, await ports.bindings(deviceId)];
|
|
54
|
+
} catch (err) {
|
|
55
|
+
return [deviceId, { error: errMsg(err) }];
|
|
56
|
+
}
|
|
57
|
+
}));
|
|
58
|
+
return new Map(read);
|
|
59
|
+
}
|
|
60
|
+
function describeSource(lookup, bindings) {
|
|
61
|
+
if (lookup.kind !== "row") return lookup;
|
|
62
|
+
const bound = bindings.get(lookup.row.id);
|
|
63
|
+
if (bound === void 0) return {
|
|
64
|
+
kind: "unreadable",
|
|
65
|
+
error: "its bindings were not read"
|
|
66
|
+
};
|
|
67
|
+
if ("error" in bound) return {
|
|
68
|
+
kind: "unreadable",
|
|
69
|
+
error: bound.error
|
|
70
|
+
};
|
|
71
|
+
return {
|
|
72
|
+
kind: "found",
|
|
73
|
+
deviceId: lookup.row.id,
|
|
74
|
+
caps: new Set(bound.map((b) => b.capName))
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function describeTarget(lookup, bindings) {
|
|
78
|
+
if (lookup.kind !== "row") return lookup;
|
|
79
|
+
const { id, type } = lookup.row;
|
|
80
|
+
const bound = bindings.get(id);
|
|
81
|
+
if (bound === void 0) return {
|
|
82
|
+
kind: "unreadable",
|
|
83
|
+
error: "its bindings were not read"
|
|
84
|
+
};
|
|
85
|
+
if ("error" in bound) return {
|
|
86
|
+
kind: "unreadable",
|
|
87
|
+
error: bound.error
|
|
88
|
+
};
|
|
89
|
+
return {
|
|
90
|
+
kind: "found",
|
|
91
|
+
deviceId: id,
|
|
92
|
+
type,
|
|
93
|
+
nativeCaps: new Map(bound.flatMap((b) => {
|
|
94
|
+
const owner = normalizedNativeOwner(b.nativeAddonId);
|
|
95
|
+
return owner === null ? [] : [[b.capName, owner]];
|
|
96
|
+
}))
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
async function describeCompositionSources(ports, sources, targets = []) {
|
|
100
|
+
const owners = await listOwners(ports, [...sources, ...targets]);
|
|
101
|
+
const lookup = (ref) => [compositionSourceKey(ref), rowOf(ref, owners.get(ref.addonId))];
|
|
102
|
+
const sourceRows = sources.map(lookup);
|
|
103
|
+
const targetRows = targets.map(lookup);
|
|
104
|
+
const bindings = await readBindings(ports, [...sourceRows, ...targetRows].flatMap(([, l]) => l.kind === "row" ? [l.row.id] : []));
|
|
105
|
+
return {
|
|
106
|
+
sources: new Map(sourceRows.map(([key, l]) => [key, describeSource(l, bindings)])),
|
|
107
|
+
targets: new Map(targetRows.map(([key, l]) => [key, describeTarget(l, bindings)]))
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
//#endregion
|
|
111
|
+
export { normalizedNativeOwner as n, describeCompositionSources as t };
|