@camstack/server 1.2.897 → 1.2.899
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/dist/api/trpc/cap-router-runtime.js +1 -0
- package/dist/api/trpc/generated-cap-mounts.js +2 -1
- package/dist/api/trpc/generated-cap-routers.js +1894 -1870
- package/dist/core/addon/hub-addon-api.js +1 -0
- package/dist/core/moleculer/moleculer.service.js +1 -0
- package/package.json +11 -10
- package/system/dist/addon-runner.js +207 -13
- package/system/dist/addon-runner.mjs +207 -13
- 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 +14 -11
- package/system/dist/builtins/composer/composer.addon.mjs +11 -8
- 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 +170 -14
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +169 -13
- package/system/dist/builtins/core-blocks/migrations/automation-confirmed-view.d.ts +23 -0
- package/system/dist/builtins/core-blocks/migrations/index.d.ts +1 -0
- package/system/dist/builtins/core-blocks/migrations/pump-cycle-split.d.ts +1 -0
- package/system/dist/builtins/device-history/device-history.addon.js +10 -9
- package/system/dist/builtins/device-history/device-history.addon.mjs +10 -9
- package/system/dist/builtins/device-manager/command-holds-wiring.d.ts +22 -0
- package/system/dist/builtins/device-manager/command-holds.d.ts +77 -0
- package/system/dist/builtins/device-manager/device-manager.addon.d.ts +3 -0
- package/system/dist/builtins/device-manager/device-manager.addon.js +1078 -41
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +1062 -42
- package/system/dist/builtins/device-manager/device-state-mirror.d.ts +42 -9
- package/system/dist/builtins/device-manager/state-refresh-scheduler.d.ts +92 -0
- package/system/dist/builtins/device-manager/state-refresh-wiring.d.ts +23 -0
- package/system/dist/builtins/hub-forwarder/index.js +1 -1
- package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/system/dist/builtins/keychain/index.js +4 -4
- package/system/dist/builtins/keychain/index.mjs +4 -4
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
- package/system/dist/builtins/local-network/local-network.addon.js +3 -3
- package/system/dist/builtins/local-network/local-network.addon.mjs +3 -3
- 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/shared/device-state-changed.d.ts +8 -0
- 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-Bjgs__i9.mjs → capture-engine-BcD6iCZM.mjs} +37 -2
- package/system/dist/{capture-engine-D1rjl2dW.js → capture-engine-LHKTf-nM.js} +48 -1
- package/system/dist/{composition-sources-B727nlA0.mjs → composition-sources-C3ARJk2g.mjs} +2 -21
- package/system/dist/{composition-sources-CF2-u58e.js → composition-sources-DNUDbuXy.js} +1 -32
- package/system/dist/{constants-DaR1SUh7.js → constants-dL8fl9aI.js} +1 -1
- package/system/dist/{constants-BF309c_I.mjs → constants-er38mZOb.mjs} +1 -1
- package/system/dist/{device-ca-DT1hYtdW.mjs → device-ca-Ccz5olgH.mjs} +1 -1
- package/system/dist/{device-ca-BqcX5_f2.js → device-ca-KWa6uJRU.js} +1 -1
- package/system/dist/{dist-DorY_sjS.mjs → dist-DBanWvHF.mjs} +819 -54
- package/system/dist/{dist-BoEy9sm9.js → dist-DEAjZE_-.js} +848 -53
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-identity-CZ0nE3GK.mjs → hub-identity-CVv79TVO.mjs} +1 -1
- package/system/dist/{hub-identity-DH1rxUMD.js → hub-identity-Dy8ZSUuq.js} +1 -1
- package/system/dist/{hub-mdns-ciao-N0nL34fx.js → hub-mdns-ciao-C_XjO7YI.js} +2 -2
- package/system/dist/{hub-mdns-ciao-7HK57Vtx.mjs → hub-mdns-ciao-DtmIyWDL.mjs} +2 -2
- package/system/dist/index.js +96 -17
- package/system/dist/index.mjs +92 -19
- package/system/dist/kernel/cap-router-builder.d.ts +7 -0
- package/system/dist/kernel/command-follow-up.d.ts +33 -0
- package/system/dist/kernel/command-hold-overrides.d.ts +42 -0
- package/system/dist/kernel/command-observation.d.ts +3 -0
- package/system/dist/kernel/index.d.ts +3 -0
- package/system/dist/kernel/moleculer/child-cap-descriptors.d.ts +5 -0
- package/system/dist/kernel/moleculer/device-cap-proxy.d.ts +3 -1
- package/system/dist/kernel/state-refresh-policies.d.ts +53 -0
- package/system/dist/kernel/transport/child-cap-protocol.d.ts +11 -1
- package/system/dist/kernel/transport/local-child-registry.d.ts +14 -0
- package/system/dist/{legacy-integration-rows-door-CdAQlIvv.mjs → legacy-integration-rows-door-BL8T4lya.mjs} +1 -1
- package/system/dist/{legacy-integration-rows-door-BTfeULYt.js → legacy-integration-rows-door-DPInWtE6.js} +1 -1
- package/system/dist/{rename-composition-block-B1x-yK5U.js → rename-composition-block-BxzETYOf.js} +1 -1
- package/system/dist/{rename-composition-block-CIQjxBUa.mjs → rename-composition-block-Dgo-9-Ts.mjs} +1 -1
- package/system/dist/{restore-archive-Bj_gYmE9.mjs → restore-archive-BUtuNTe1.mjs} +82 -82
- package/system/dist/{restore-archive-B086o8pL.js → restore-archive-Zvx9sHZP.js} +1 -1
- package/system/dist/{wal-maintenance-MVIyxmu7.js → wal-maintenance-DS2IKwtK.js} +0 -0
- package/system/dist/{wal-maintenance-Dgfmi-Ao.mjs → wal-maintenance-cASt_sYy.mjs} +0 -0
- package/system/package.json +1 -1
|
@@ -25,6 +25,7 @@ function createHubAddonApi(options) {
|
|
|
25
25
|
(0, system_1.commandObserverLink)({
|
|
26
26
|
callerAddonId: options.callerAddonId,
|
|
27
27
|
sink: options.commandSink ?? ((obs) => (0, system_1.getCommandObserverRegistry)().observe(obs)),
|
|
28
|
+
followUp: (target, outcome) => (0, system_1.getCommandFollowUpRegistry)().run(target, outcome),
|
|
28
29
|
}),
|
|
29
30
|
(0, system_1.localProviderLink)(options.resolver, observerOpts),
|
|
30
31
|
...options.links,
|
|
@@ -500,6 +500,7 @@ class MoleculerService {
|
|
|
500
500
|
// A forked addon's device commands (D1022): the actor is the addon on the
|
|
501
501
|
// socket. The hub mirror's correlator listens on this registry.
|
|
502
502
|
commandObserver: (obs) => (0, system_1.getCommandObserverRegistry)().observe(obs),
|
|
503
|
+
commandFollowUp: (target, outcome) => (0, system_1.getCommandFollowUpRegistry)().run(target, outcome),
|
|
503
504
|
logger: {
|
|
504
505
|
info: (msg, meta) => logger.info(msg, meta !== null && meta !== undefined
|
|
505
506
|
? { meta: meta }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/server",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.899",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -66,8 +66,9 @@
|
|
|
66
66
|
],
|
|
67
67
|
"requires": {
|
|
68
68
|
"addons": {
|
|
69
|
-
"@camstack/addon-admin-ui": ">=1.2.
|
|
70
|
-
"@camstack/addon-
|
|
69
|
+
"@camstack/addon-admin-ui": ">=1.2.698",
|
|
70
|
+
"@camstack/addon-agent-ui": ">=1.2.408",
|
|
71
|
+
"@camstack/addon-provider-vesync": ">=0.2.167"
|
|
71
72
|
},
|
|
72
73
|
"wrapper": {
|
|
73
74
|
"desktop": ">=0.0.1",
|
|
@@ -76,19 +77,19 @@
|
|
|
76
77
|
}
|
|
77
78
|
},
|
|
78
79
|
"dependencies": {
|
|
79
|
-
"@camstack/addon-admin-ui": "1.2.
|
|
80
|
-
"@camstack/addon-agent-ui": "1.2.
|
|
80
|
+
"@camstack/addon-admin-ui": "1.2.698",
|
|
81
|
+
"@camstack/addon-agent-ui": "1.2.408",
|
|
81
82
|
"@camstack/addon-auth": "1.2.182",
|
|
82
83
|
"@camstack/addon-benchmark": "1.2.313",
|
|
83
84
|
"@camstack/addon-decoder-nodeav": "1.2.149",
|
|
84
85
|
"@camstack/addon-notifiers": "1.2.639",
|
|
85
|
-
"@camstack/addon-pipeline": "1.2.
|
|
86
|
-
"@camstack/addon-pipeline-orchestrator": "1.2.
|
|
87
|
-
"@camstack/addon-post-analysis": "1.2.
|
|
86
|
+
"@camstack/addon-pipeline": "1.2.661",
|
|
87
|
+
"@camstack/addon-pipeline-orchestrator": "1.2.701",
|
|
88
|
+
"@camstack/addon-post-analysis": "1.2.715",
|
|
88
89
|
"@camstack/develop": "0.1.54",
|
|
89
90
|
"@camstack/sdk": "1.2.159",
|
|
90
|
-
"@camstack/types": "1.2.
|
|
91
|
-
"@camstack/ui-library": "1.2.
|
|
91
|
+
"@camstack/types": "1.2.593",
|
|
92
|
+
"@camstack/ui-library": "1.2.469",
|
|
92
93
|
"@fastify/compress": "^9.0.0",
|
|
93
94
|
"@fastify/cookie": "^11.0.2",
|
|
94
95
|
"@fastify/cors": "^11.2.0",
|
|
@@ -5939,6 +5939,115 @@ function createChildrenBatchLoader(opts) {
|
|
|
5939
5939
|
} };
|
|
5940
5940
|
}
|
|
5941
5941
|
//#endregion
|
|
5942
|
+
//#region src/kernel/command-hold-overrides.ts
|
|
5943
|
+
/** The source key of an in-process registration. */
|
|
5944
|
+
var IN_PROCESS_HOLD_SOURCE = "in-process";
|
|
5945
|
+
function keyOf(deviceId, capName) {
|
|
5946
|
+
return `${deviceId}|${capName}`;
|
|
5947
|
+
}
|
|
5948
|
+
var CommandHoldOverrideRegistry = class {
|
|
5949
|
+
bySource = /* @__PURE__ */ new Map();
|
|
5950
|
+
/** Record (or replace) one device cap's options from `source`. */
|
|
5951
|
+
set(source, entry) {
|
|
5952
|
+
const perSource = this.bySource.get(source) ?? /* @__PURE__ */ new Map();
|
|
5953
|
+
perSource.set(keyOf(entry.deviceId, entry.capName), entry.commands);
|
|
5954
|
+
this.bySource.set(source, perSource);
|
|
5955
|
+
}
|
|
5956
|
+
/** Forget one device cap's options from `source`. */
|
|
5957
|
+
delete(source, deviceId, capName) {
|
|
5958
|
+
const perSource = this.bySource.get(source);
|
|
5959
|
+
if (perSource === void 0) return;
|
|
5960
|
+
perSource.delete(keyOf(deviceId, capName));
|
|
5961
|
+
if (perSource.size === 0) this.bySource.delete(source);
|
|
5962
|
+
}
|
|
5963
|
+
/** Replace everything `source` reported with `entries` (an empty list forgets the source). */
|
|
5964
|
+
replaceSource(source, entries) {
|
|
5965
|
+
if (entries.length === 0) {
|
|
5966
|
+
this.bySource.delete(source);
|
|
5967
|
+
return;
|
|
5968
|
+
}
|
|
5969
|
+
this.bySource.set(source, new Map(entries.map((e) => [keyOf(e.deviceId, e.capName), e.commands])));
|
|
5970
|
+
}
|
|
5971
|
+
/** The options for a device cap, from whichever source registered it; `undefined` = default. */
|
|
5972
|
+
get(deviceId, capName) {
|
|
5973
|
+
const key = keyOf(deviceId, capName);
|
|
5974
|
+
for (const perSource of this.bySource.values()) {
|
|
5975
|
+
const found = perSource.get(key);
|
|
5976
|
+
if (found !== void 0) return found;
|
|
5977
|
+
}
|
|
5978
|
+
}
|
|
5979
|
+
};
|
|
5980
|
+
var registry$1;
|
|
5981
|
+
/** The process-wide registry. */
|
|
5982
|
+
function getCommandHoldOverrideRegistry() {
|
|
5983
|
+
registry$1 ??= new CommandHoldOverrideRegistry();
|
|
5984
|
+
return registry$1;
|
|
5985
|
+
}
|
|
5986
|
+
/** The source key of an in-process registration. */
|
|
5987
|
+
var IN_PROCESS_REFRESH_SOURCE = "in-process";
|
|
5988
|
+
var StateRefreshPolicyRegistry = class {
|
|
5989
|
+
bySource = /* @__PURE__ */ new Map();
|
|
5990
|
+
listeners = /* @__PURE__ */ new Set();
|
|
5991
|
+
/** Record (or replace) one device's policy from `source`. */
|
|
5992
|
+
set(source, entry) {
|
|
5993
|
+
const perSource = new Map(this.bySource.get(source) ?? []);
|
|
5994
|
+
perSource.set(entry.deviceId, entry);
|
|
5995
|
+
this.bySource.set(source, perSource);
|
|
5996
|
+
this.changed();
|
|
5997
|
+
}
|
|
5998
|
+
/** Forget one device's policy from `source`. */
|
|
5999
|
+
delete(source, deviceId) {
|
|
6000
|
+
const perSource = this.bySource.get(source);
|
|
6001
|
+
if (perSource === void 0 || !perSource.has(deviceId)) return;
|
|
6002
|
+
const next = new Map(perSource);
|
|
6003
|
+
next.delete(deviceId);
|
|
6004
|
+
if (next.size === 0) this.bySource.delete(source);
|
|
6005
|
+
else this.bySource.set(source, next);
|
|
6006
|
+
this.changed();
|
|
6007
|
+
}
|
|
6008
|
+
/** Replace everything `source` reported with `entries` (an empty list forgets the source). */
|
|
6009
|
+
replaceSource(source, entries) {
|
|
6010
|
+
const had = this.bySource.has(source);
|
|
6011
|
+
if (entries.length === 0) {
|
|
6012
|
+
this.bySource.delete(source);
|
|
6013
|
+
if (had) this.changed();
|
|
6014
|
+
return;
|
|
6015
|
+
}
|
|
6016
|
+
this.bySource.set(source, new Map(entries.map((e) => [e.deviceId, e])));
|
|
6017
|
+
this.changed();
|
|
6018
|
+
}
|
|
6019
|
+
/** Every device's policy (a device registered by two sources keeps the first). */
|
|
6020
|
+
entries() {
|
|
6021
|
+
const seen = /* @__PURE__ */ new Map();
|
|
6022
|
+
for (const perSource of this.bySource.values()) for (const entry of perSource.values()) if (!seen.has(entry.deviceId)) seen.set(entry.deviceId, entry);
|
|
6023
|
+
return [...seen.values()];
|
|
6024
|
+
}
|
|
6025
|
+
/** One device's policy, or `undefined` when its provider did not migrate. */
|
|
6026
|
+
get(deviceId) {
|
|
6027
|
+
for (const perSource of this.bySource.values()) {
|
|
6028
|
+
const found = perSource.get(deviceId);
|
|
6029
|
+
if (found !== void 0) return found;
|
|
6030
|
+
}
|
|
6031
|
+
}
|
|
6032
|
+
subscribe(listener) {
|
|
6033
|
+
this.listeners.add(listener);
|
|
6034
|
+
return () => {
|
|
6035
|
+
this.listeners.delete(listener);
|
|
6036
|
+
};
|
|
6037
|
+
}
|
|
6038
|
+
changed() {
|
|
6039
|
+
for (const listener of this.listeners) try {
|
|
6040
|
+
listener();
|
|
6041
|
+
} catch {}
|
|
6042
|
+
}
|
|
6043
|
+
};
|
|
6044
|
+
var registry;
|
|
6045
|
+
/** The process-wide registry. */
|
|
6046
|
+
function getStateRefreshPolicyRegistry() {
|
|
6047
|
+
registry ??= new StateRefreshPolicyRegistry();
|
|
6048
|
+
return registry;
|
|
6049
|
+
}
|
|
6050
|
+
//#endregion
|
|
5942
6051
|
//#region src/kernel/moleculer/accessory-prune-gate.ts
|
|
5943
6052
|
function isSpecList(answer) {
|
|
5944
6053
|
return Array.isArray(answer);
|
|
@@ -6096,7 +6205,31 @@ var workerNativeCaps = /* @__PURE__ */ new Map();
|
|
|
6096
6205
|
* the pull-based discovery sweep.
|
|
6097
6206
|
*/
|
|
6098
6207
|
var workerNativeCapAddonIds = /* @__PURE__ */ new Map();
|
|
6208
|
+
/**
|
|
6209
|
+
* The command-hold options a provider stated at registration (D1061).
|
|
6210
|
+
* capName → deviceId → options. Carried on the child's cap descriptors so the
|
|
6211
|
+
* hub's hold reads them; absent = the core default.
|
|
6212
|
+
*/
|
|
6213
|
+
var workerNativeCapHolds = /* @__PURE__ */ new Map();
|
|
6214
|
+
/**
|
|
6215
|
+
* The state-refresh policy a provider stated on a device's
|
|
6216
|
+
* `device-state-refresh` registration (D1062). deviceId → policy. Carried on
|
|
6217
|
+
* the child's cap descriptors so the hub's scheduler reads it.
|
|
6218
|
+
*/
|
|
6219
|
+
var workerNativeCapRefresh = /* @__PURE__ */ new Map();
|
|
6220
|
+
/** The policy a registration states, read only on the refresh cap. */
|
|
6221
|
+
function stateRefreshOf(capName, options) {
|
|
6222
|
+
return capName === "device-state-refresh" ? options?.stateRefresh : void 0;
|
|
6223
|
+
}
|
|
6099
6224
|
var mountedNativeCapServices = /* @__PURE__ */ new Set();
|
|
6225
|
+
/** A provider's hold options as plain data, or `undefined` when it stated none. */
|
|
6226
|
+
function commandHoldsOf(options) {
|
|
6227
|
+
const commands = options?.commands;
|
|
6228
|
+
if (commands === void 0) return void 0;
|
|
6229
|
+
const out = {};
|
|
6230
|
+
for (const [method, option] of Object.entries(commands)) if (option !== void 0) out[method] = option;
|
|
6231
|
+
return Object.keys(out).length === 0 ? void 0 : out;
|
|
6232
|
+
}
|
|
6100
6233
|
/**
|
|
6101
6234
|
* Optional change listener fired whenever the worker native-cap set mutates
|
|
6102
6235
|
* (a `registerNativeCap` adds a (cap, device) pair, or a device is cleared).
|
|
@@ -6176,6 +6309,7 @@ function mountNativeCapService(broker, addonId, cap) {
|
|
|
6176
6309
|
function clearWorkerNativeCapsForDevice(deviceId) {
|
|
6177
6310
|
for (const perCap of workerNativeCaps.values()) perCap.delete(deviceId);
|
|
6178
6311
|
for (const perCap of workerNativeCapAddonIds.values()) perCap.delete(deviceId);
|
|
6312
|
+
workerNativeCapRefresh.delete(deviceId);
|
|
6179
6313
|
onWorkerNativeCapsChanged?.();
|
|
6180
6314
|
}
|
|
6181
6315
|
/**
|
|
@@ -6205,7 +6339,33 @@ function getWorkerNativeCapSnapshot() {
|
|
|
6205
6339
|
});
|
|
6206
6340
|
}
|
|
6207
6341
|
}
|
|
6208
|
-
return [...grouped.values()]
|
|
6342
|
+
return [...grouped.values()].map((entry) => {
|
|
6343
|
+
const withRefresh = withStateRefresh(entry);
|
|
6344
|
+
const holds = workerNativeCapHolds.get(entry.capName);
|
|
6345
|
+
if (holds === void 0) return withRefresh;
|
|
6346
|
+
const forEntry = /* @__PURE__ */ new Map();
|
|
6347
|
+
for (const deviceId of entry.deviceIds) {
|
|
6348
|
+
const options = holds.get(deviceId);
|
|
6349
|
+
if (options !== void 0) forEntry.set(deviceId, options);
|
|
6350
|
+
}
|
|
6351
|
+
return forEntry.size === 0 ? withRefresh : {
|
|
6352
|
+
...withRefresh,
|
|
6353
|
+
commandHolds: forEntry
|
|
6354
|
+
};
|
|
6355
|
+
});
|
|
6356
|
+
}
|
|
6357
|
+
/** A refresh-cap snapshot row with the policies its devices stated (D1062). */
|
|
6358
|
+
function withStateRefresh(entry) {
|
|
6359
|
+
if (entry.capName !== "device-state-refresh") return entry;
|
|
6360
|
+
const forEntry = /* @__PURE__ */ new Map();
|
|
6361
|
+
for (const deviceId of entry.deviceIds) {
|
|
6362
|
+
const policy = workerNativeCapRefresh.get(deviceId);
|
|
6363
|
+
if (policy !== void 0) forEntry.set(deviceId, policy);
|
|
6364
|
+
}
|
|
6365
|
+
return forEntry.size === 0 ? entry : {
|
|
6366
|
+
...entry,
|
|
6367
|
+
stateRefresh: forEntry
|
|
6368
|
+
};
|
|
6209
6369
|
}
|
|
6210
6370
|
function getWorkerNativeCapsForDevice(deviceId) {
|
|
6211
6371
|
const caps = [];
|
|
@@ -6363,7 +6523,9 @@ function createBrokerDeviceManagerApi(opts) {
|
|
|
6363
6523
|
get devices() {
|
|
6364
6524
|
return selfApi;
|
|
6365
6525
|
},
|
|
6366
|
-
registerNativeCap(cap, provider) {
|
|
6526
|
+
registerNativeCap(cap, provider, options) {
|
|
6527
|
+
const commandHolds = commandHoldsOf(options);
|
|
6528
|
+
const stateRefresh = stateRefreshOf(cap.name, options);
|
|
6367
6529
|
if (cap.runtimeState && runtimeStateRef) try {
|
|
6368
6530
|
runtimeStateRef.installCapSchema(cap.name, cap.runtimeState);
|
|
6369
6531
|
} catch (err) {
|
|
@@ -6396,8 +6558,21 @@ function createBrokerDeviceManagerApi(opts) {
|
|
|
6396
6558
|
readSlice: () => runtimeStateRef?.getCapState("switch"),
|
|
6397
6559
|
logger: opts.logger
|
|
6398
6560
|
});
|
|
6399
|
-
if (opts.capabilityRegistry)
|
|
6400
|
-
|
|
6561
|
+
if (opts.capabilityRegistry) {
|
|
6562
|
+
opts.capabilityRegistry.registerNativeProvider(cap.name, id, addonId, finalProvider);
|
|
6563
|
+
if (commandHolds !== void 0) getCommandHoldOverrideRegistry().set(IN_PROCESS_HOLD_SOURCE, {
|
|
6564
|
+
deviceId: id,
|
|
6565
|
+
capName: cap.name,
|
|
6566
|
+
commands: commandHolds
|
|
6567
|
+
});
|
|
6568
|
+
else getCommandHoldOverrideRegistry().delete(IN_PROCESS_HOLD_SOURCE, id, cap.name);
|
|
6569
|
+
if (stateRefresh !== void 0) getStateRefreshPolicyRegistry().set(IN_PROCESS_REFRESH_SOURCE, {
|
|
6570
|
+
deviceId: id,
|
|
6571
|
+
addonId,
|
|
6572
|
+
policy: stateRefresh
|
|
6573
|
+
});
|
|
6574
|
+
else if (cap.name === "device-state-refresh") getStateRefreshPolicyRegistry().delete(IN_PROCESS_REFRESH_SOURCE, id);
|
|
6575
|
+
} else if (opts.broker || opts.udsMode) {
|
|
6401
6576
|
let perCap = workerNativeCaps.get(cap.name);
|
|
6402
6577
|
if (!perCap) {
|
|
6403
6578
|
perCap = /* @__PURE__ */ new Map();
|
|
@@ -6410,6 +6585,13 @@ function createBrokerDeviceManagerApi(opts) {
|
|
|
6410
6585
|
workerNativeCapAddonIds.set(cap.name, perAddonId);
|
|
6411
6586
|
}
|
|
6412
6587
|
perAddonId.set(id, addonId);
|
|
6588
|
+
if (commandHolds !== void 0) {
|
|
6589
|
+
const perHolds = workerNativeCapHolds.get(cap.name) ?? /* @__PURE__ */ new Map();
|
|
6590
|
+
perHolds.set(id, commandHolds);
|
|
6591
|
+
workerNativeCapHolds.set(cap.name, perHolds);
|
|
6592
|
+
} else workerNativeCapHolds.get(cap.name)?.delete(id);
|
|
6593
|
+
if (stateRefresh !== void 0) workerNativeCapRefresh.set(id, stateRefresh);
|
|
6594
|
+
else if (cap.name === "device-state-refresh") workerNativeCapRefresh.delete(id);
|
|
6413
6595
|
if (opts.broker) mountNativeCapService(opts.broker, addonId, cap);
|
|
6414
6596
|
onWorkerNativeCapsChanged?.();
|
|
6415
6597
|
} else throw new Error(`DeviceContext.registerNativeCap('${cap.name}') called on '${stableId}' but none of capabilityRegistry / broker / udsMode was provided.`);
|
|
@@ -6463,10 +6645,15 @@ function createBrokerDeviceManagerApi(opts) {
|
|
|
6463
6645
|
},
|
|
6464
6646
|
meta: { capName }
|
|
6465
6647
|
});
|
|
6466
|
-
else if (opts.capabilityRegistry)
|
|
6467
|
-
|
|
6648
|
+
else if (opts.capabilityRegistry) {
|
|
6649
|
+
opts.capabilityRegistry.unregisterNativeProvider(capName, id);
|
|
6650
|
+
getCommandHoldOverrideRegistry().delete(IN_PROCESS_HOLD_SOURCE, id, capName);
|
|
6651
|
+
if (capName === "device-state-refresh") getStateRefreshPolicyRegistry().delete(IN_PROCESS_REFRESH_SOURCE, id);
|
|
6652
|
+
} else {
|
|
6468
6653
|
workerNativeCaps.get(capName)?.delete(id);
|
|
6469
6654
|
workerNativeCapAddonIds.get(capName)?.delete(id);
|
|
6655
|
+
workerNativeCapHolds.get(capName)?.delete(id);
|
|
6656
|
+
if (capName === "device-state-refresh") workerNativeCapRefresh.delete(id);
|
|
6470
6657
|
onWorkerNativeCapsChanged?.();
|
|
6471
6658
|
}
|
|
6472
6659
|
eventBus.emit({
|
|
@@ -6588,7 +6775,8 @@ function createBrokerDeviceManagerApi(opts) {
|
|
|
6588
6775
|
for (const child of children) await teardownLocal(child.id, runLifecycle);
|
|
6589
6776
|
const capsToUnregister = opts.capabilityRegistry ? [...opts.capabilityRegistry.getNativeCapsForDevice(deviceId)] : [...getWorkerNativeCapsForDevice(deviceId)];
|
|
6590
6777
|
opts.capabilityRegistry?.unregisterAllNativeForDevice(deviceId);
|
|
6591
|
-
if (
|
|
6778
|
+
if (opts.capabilityRegistry) getStateRefreshPolicyRegistry().delete(IN_PROCESS_REFRESH_SOURCE, deviceId);
|
|
6779
|
+
else clearWorkerNativeCapsForDevice(deviceId);
|
|
6592
6780
|
for (const capName of capsToUnregister) {
|
|
6593
6781
|
eventBus.emit({
|
|
6594
6782
|
id: (0, node_crypto.randomUUID)(),
|
|
@@ -11734,12 +11922,18 @@ function buildChildCapDescriptors(manifest, nativeCapSnapshot) {
|
|
|
11734
11922
|
});
|
|
11735
11923
|
}
|
|
11736
11924
|
}
|
|
11737
|
-
for (const { capName, addonId, deviceIds } of nativeCapSnapshot) for (const deviceId of deviceIds)
|
|
11738
|
-
|
|
11739
|
-
|
|
11740
|
-
|
|
11741
|
-
|
|
11742
|
-
|
|
11925
|
+
for (const { capName, addonId, deviceIds, commandHolds, stateRefresh } of nativeCapSnapshot) for (const deviceId of deviceIds) {
|
|
11926
|
+
const holds = commandHolds?.get(deviceId);
|
|
11927
|
+
const refresh = stateRefresh?.get(deviceId);
|
|
11928
|
+
descriptors.push({
|
|
11929
|
+
capName,
|
|
11930
|
+
mode: "collection",
|
|
11931
|
+
deviceId,
|
|
11932
|
+
addonId,
|
|
11933
|
+
...holds !== void 0 ? { commandHolds: holds } : {},
|
|
11934
|
+
...refresh !== void 0 ? { stateRefresh: refresh } : {}
|
|
11935
|
+
});
|
|
11936
|
+
}
|
|
11743
11937
|
return descriptors;
|
|
11744
11938
|
}
|
|
11745
11939
|
//#endregion
|
|
@@ -5884,6 +5884,115 @@ function createChildrenBatchLoader(opts) {
|
|
|
5884
5884
|
} };
|
|
5885
5885
|
}
|
|
5886
5886
|
//#endregion
|
|
5887
|
+
//#region src/kernel/command-hold-overrides.ts
|
|
5888
|
+
/** The source key of an in-process registration. */
|
|
5889
|
+
var IN_PROCESS_HOLD_SOURCE = "in-process";
|
|
5890
|
+
function keyOf(deviceId, capName) {
|
|
5891
|
+
return `${deviceId}|${capName}`;
|
|
5892
|
+
}
|
|
5893
|
+
var CommandHoldOverrideRegistry = class {
|
|
5894
|
+
bySource = /* @__PURE__ */ new Map();
|
|
5895
|
+
/** Record (or replace) one device cap's options from `source`. */
|
|
5896
|
+
set(source, entry) {
|
|
5897
|
+
const perSource = this.bySource.get(source) ?? /* @__PURE__ */ new Map();
|
|
5898
|
+
perSource.set(keyOf(entry.deviceId, entry.capName), entry.commands);
|
|
5899
|
+
this.bySource.set(source, perSource);
|
|
5900
|
+
}
|
|
5901
|
+
/** Forget one device cap's options from `source`. */
|
|
5902
|
+
delete(source, deviceId, capName) {
|
|
5903
|
+
const perSource = this.bySource.get(source);
|
|
5904
|
+
if (perSource === void 0) return;
|
|
5905
|
+
perSource.delete(keyOf(deviceId, capName));
|
|
5906
|
+
if (perSource.size === 0) this.bySource.delete(source);
|
|
5907
|
+
}
|
|
5908
|
+
/** Replace everything `source` reported with `entries` (an empty list forgets the source). */
|
|
5909
|
+
replaceSource(source, entries) {
|
|
5910
|
+
if (entries.length === 0) {
|
|
5911
|
+
this.bySource.delete(source);
|
|
5912
|
+
return;
|
|
5913
|
+
}
|
|
5914
|
+
this.bySource.set(source, new Map(entries.map((e) => [keyOf(e.deviceId, e.capName), e.commands])));
|
|
5915
|
+
}
|
|
5916
|
+
/** The options for a device cap, from whichever source registered it; `undefined` = default. */
|
|
5917
|
+
get(deviceId, capName) {
|
|
5918
|
+
const key = keyOf(deviceId, capName);
|
|
5919
|
+
for (const perSource of this.bySource.values()) {
|
|
5920
|
+
const found = perSource.get(key);
|
|
5921
|
+
if (found !== void 0) return found;
|
|
5922
|
+
}
|
|
5923
|
+
}
|
|
5924
|
+
};
|
|
5925
|
+
var registry$1;
|
|
5926
|
+
/** The process-wide registry. */
|
|
5927
|
+
function getCommandHoldOverrideRegistry() {
|
|
5928
|
+
registry$1 ??= new CommandHoldOverrideRegistry();
|
|
5929
|
+
return registry$1;
|
|
5930
|
+
}
|
|
5931
|
+
/** The source key of an in-process registration. */
|
|
5932
|
+
var IN_PROCESS_REFRESH_SOURCE = "in-process";
|
|
5933
|
+
var StateRefreshPolicyRegistry = class {
|
|
5934
|
+
bySource = /* @__PURE__ */ new Map();
|
|
5935
|
+
listeners = /* @__PURE__ */ new Set();
|
|
5936
|
+
/** Record (or replace) one device's policy from `source`. */
|
|
5937
|
+
set(source, entry) {
|
|
5938
|
+
const perSource = new Map(this.bySource.get(source) ?? []);
|
|
5939
|
+
perSource.set(entry.deviceId, entry);
|
|
5940
|
+
this.bySource.set(source, perSource);
|
|
5941
|
+
this.changed();
|
|
5942
|
+
}
|
|
5943
|
+
/** Forget one device's policy from `source`. */
|
|
5944
|
+
delete(source, deviceId) {
|
|
5945
|
+
const perSource = this.bySource.get(source);
|
|
5946
|
+
if (perSource === void 0 || !perSource.has(deviceId)) return;
|
|
5947
|
+
const next = new Map(perSource);
|
|
5948
|
+
next.delete(deviceId);
|
|
5949
|
+
if (next.size === 0) this.bySource.delete(source);
|
|
5950
|
+
else this.bySource.set(source, next);
|
|
5951
|
+
this.changed();
|
|
5952
|
+
}
|
|
5953
|
+
/** Replace everything `source` reported with `entries` (an empty list forgets the source). */
|
|
5954
|
+
replaceSource(source, entries) {
|
|
5955
|
+
const had = this.bySource.has(source);
|
|
5956
|
+
if (entries.length === 0) {
|
|
5957
|
+
this.bySource.delete(source);
|
|
5958
|
+
if (had) this.changed();
|
|
5959
|
+
return;
|
|
5960
|
+
}
|
|
5961
|
+
this.bySource.set(source, new Map(entries.map((e) => [e.deviceId, e])));
|
|
5962
|
+
this.changed();
|
|
5963
|
+
}
|
|
5964
|
+
/** Every device's policy (a device registered by two sources keeps the first). */
|
|
5965
|
+
entries() {
|
|
5966
|
+
const seen = /* @__PURE__ */ new Map();
|
|
5967
|
+
for (const perSource of this.bySource.values()) for (const entry of perSource.values()) if (!seen.has(entry.deviceId)) seen.set(entry.deviceId, entry);
|
|
5968
|
+
return [...seen.values()];
|
|
5969
|
+
}
|
|
5970
|
+
/** One device's policy, or `undefined` when its provider did not migrate. */
|
|
5971
|
+
get(deviceId) {
|
|
5972
|
+
for (const perSource of this.bySource.values()) {
|
|
5973
|
+
const found = perSource.get(deviceId);
|
|
5974
|
+
if (found !== void 0) return found;
|
|
5975
|
+
}
|
|
5976
|
+
}
|
|
5977
|
+
subscribe(listener) {
|
|
5978
|
+
this.listeners.add(listener);
|
|
5979
|
+
return () => {
|
|
5980
|
+
this.listeners.delete(listener);
|
|
5981
|
+
};
|
|
5982
|
+
}
|
|
5983
|
+
changed() {
|
|
5984
|
+
for (const listener of this.listeners) try {
|
|
5985
|
+
listener();
|
|
5986
|
+
} catch {}
|
|
5987
|
+
}
|
|
5988
|
+
};
|
|
5989
|
+
var registry;
|
|
5990
|
+
/** The process-wide registry. */
|
|
5991
|
+
function getStateRefreshPolicyRegistry() {
|
|
5992
|
+
registry ??= new StateRefreshPolicyRegistry();
|
|
5993
|
+
return registry;
|
|
5994
|
+
}
|
|
5995
|
+
//#endregion
|
|
5887
5996
|
//#region src/kernel/moleculer/accessory-prune-gate.ts
|
|
5888
5997
|
function isSpecList(answer) {
|
|
5889
5998
|
return Array.isArray(answer);
|
|
@@ -6041,7 +6150,31 @@ var workerNativeCaps = /* @__PURE__ */ new Map();
|
|
|
6041
6150
|
* the pull-based discovery sweep.
|
|
6042
6151
|
*/
|
|
6043
6152
|
var workerNativeCapAddonIds = /* @__PURE__ */ new Map();
|
|
6153
|
+
/**
|
|
6154
|
+
* The command-hold options a provider stated at registration (D1061).
|
|
6155
|
+
* capName → deviceId → options. Carried on the child's cap descriptors so the
|
|
6156
|
+
* hub's hold reads them; absent = the core default.
|
|
6157
|
+
*/
|
|
6158
|
+
var workerNativeCapHolds = /* @__PURE__ */ new Map();
|
|
6159
|
+
/**
|
|
6160
|
+
* The state-refresh policy a provider stated on a device's
|
|
6161
|
+
* `device-state-refresh` registration (D1062). deviceId → policy. Carried on
|
|
6162
|
+
* the child's cap descriptors so the hub's scheduler reads it.
|
|
6163
|
+
*/
|
|
6164
|
+
var workerNativeCapRefresh = /* @__PURE__ */ new Map();
|
|
6165
|
+
/** The policy a registration states, read only on the refresh cap. */
|
|
6166
|
+
function stateRefreshOf(capName, options) {
|
|
6167
|
+
return capName === "device-state-refresh" ? options?.stateRefresh : void 0;
|
|
6168
|
+
}
|
|
6044
6169
|
var mountedNativeCapServices = /* @__PURE__ */ new Set();
|
|
6170
|
+
/** A provider's hold options as plain data, or `undefined` when it stated none. */
|
|
6171
|
+
function commandHoldsOf(options) {
|
|
6172
|
+
const commands = options?.commands;
|
|
6173
|
+
if (commands === void 0) return void 0;
|
|
6174
|
+
const out = {};
|
|
6175
|
+
for (const [method, option] of Object.entries(commands)) if (option !== void 0) out[method] = option;
|
|
6176
|
+
return Object.keys(out).length === 0 ? void 0 : out;
|
|
6177
|
+
}
|
|
6045
6178
|
/**
|
|
6046
6179
|
* Optional change listener fired whenever the worker native-cap set mutates
|
|
6047
6180
|
* (a `registerNativeCap` adds a (cap, device) pair, or a device is cleared).
|
|
@@ -6121,6 +6254,7 @@ function mountNativeCapService(broker, addonId, cap) {
|
|
|
6121
6254
|
function clearWorkerNativeCapsForDevice(deviceId) {
|
|
6122
6255
|
for (const perCap of workerNativeCaps.values()) perCap.delete(deviceId);
|
|
6123
6256
|
for (const perCap of workerNativeCapAddonIds.values()) perCap.delete(deviceId);
|
|
6257
|
+
workerNativeCapRefresh.delete(deviceId);
|
|
6124
6258
|
onWorkerNativeCapsChanged?.();
|
|
6125
6259
|
}
|
|
6126
6260
|
/**
|
|
@@ -6150,7 +6284,33 @@ function getWorkerNativeCapSnapshot() {
|
|
|
6150
6284
|
});
|
|
6151
6285
|
}
|
|
6152
6286
|
}
|
|
6153
|
-
return [...grouped.values()]
|
|
6287
|
+
return [...grouped.values()].map((entry) => {
|
|
6288
|
+
const withRefresh = withStateRefresh(entry);
|
|
6289
|
+
const holds = workerNativeCapHolds.get(entry.capName);
|
|
6290
|
+
if (holds === void 0) return withRefresh;
|
|
6291
|
+
const forEntry = /* @__PURE__ */ new Map();
|
|
6292
|
+
for (const deviceId of entry.deviceIds) {
|
|
6293
|
+
const options = holds.get(deviceId);
|
|
6294
|
+
if (options !== void 0) forEntry.set(deviceId, options);
|
|
6295
|
+
}
|
|
6296
|
+
return forEntry.size === 0 ? withRefresh : {
|
|
6297
|
+
...withRefresh,
|
|
6298
|
+
commandHolds: forEntry
|
|
6299
|
+
};
|
|
6300
|
+
});
|
|
6301
|
+
}
|
|
6302
|
+
/** A refresh-cap snapshot row with the policies its devices stated (D1062). */
|
|
6303
|
+
function withStateRefresh(entry) {
|
|
6304
|
+
if (entry.capName !== "device-state-refresh") return entry;
|
|
6305
|
+
const forEntry = /* @__PURE__ */ new Map();
|
|
6306
|
+
for (const deviceId of entry.deviceIds) {
|
|
6307
|
+
const policy = workerNativeCapRefresh.get(deviceId);
|
|
6308
|
+
if (policy !== void 0) forEntry.set(deviceId, policy);
|
|
6309
|
+
}
|
|
6310
|
+
return forEntry.size === 0 ? entry : {
|
|
6311
|
+
...entry,
|
|
6312
|
+
stateRefresh: forEntry
|
|
6313
|
+
};
|
|
6154
6314
|
}
|
|
6155
6315
|
function getWorkerNativeCapsForDevice(deviceId) {
|
|
6156
6316
|
const caps = [];
|
|
@@ -6308,7 +6468,9 @@ function createBrokerDeviceManagerApi(opts) {
|
|
|
6308
6468
|
get devices() {
|
|
6309
6469
|
return selfApi;
|
|
6310
6470
|
},
|
|
6311
|
-
registerNativeCap(cap, provider) {
|
|
6471
|
+
registerNativeCap(cap, provider, options) {
|
|
6472
|
+
const commandHolds = commandHoldsOf(options);
|
|
6473
|
+
const stateRefresh = stateRefreshOf(cap.name, options);
|
|
6312
6474
|
if (cap.runtimeState && runtimeStateRef) try {
|
|
6313
6475
|
runtimeStateRef.installCapSchema(cap.name, cap.runtimeState);
|
|
6314
6476
|
} catch (err) {
|
|
@@ -6341,8 +6503,21 @@ function createBrokerDeviceManagerApi(opts) {
|
|
|
6341
6503
|
readSlice: () => runtimeStateRef?.getCapState("switch"),
|
|
6342
6504
|
logger: opts.logger
|
|
6343
6505
|
});
|
|
6344
|
-
if (opts.capabilityRegistry)
|
|
6345
|
-
|
|
6506
|
+
if (opts.capabilityRegistry) {
|
|
6507
|
+
opts.capabilityRegistry.registerNativeProvider(cap.name, id, addonId, finalProvider);
|
|
6508
|
+
if (commandHolds !== void 0) getCommandHoldOverrideRegistry().set(IN_PROCESS_HOLD_SOURCE, {
|
|
6509
|
+
deviceId: id,
|
|
6510
|
+
capName: cap.name,
|
|
6511
|
+
commands: commandHolds
|
|
6512
|
+
});
|
|
6513
|
+
else getCommandHoldOverrideRegistry().delete(IN_PROCESS_HOLD_SOURCE, id, cap.name);
|
|
6514
|
+
if (stateRefresh !== void 0) getStateRefreshPolicyRegistry().set(IN_PROCESS_REFRESH_SOURCE, {
|
|
6515
|
+
deviceId: id,
|
|
6516
|
+
addonId,
|
|
6517
|
+
policy: stateRefresh
|
|
6518
|
+
});
|
|
6519
|
+
else if (cap.name === "device-state-refresh") getStateRefreshPolicyRegistry().delete(IN_PROCESS_REFRESH_SOURCE, id);
|
|
6520
|
+
} else if (opts.broker || opts.udsMode) {
|
|
6346
6521
|
let perCap = workerNativeCaps.get(cap.name);
|
|
6347
6522
|
if (!perCap) {
|
|
6348
6523
|
perCap = /* @__PURE__ */ new Map();
|
|
@@ -6355,6 +6530,13 @@ function createBrokerDeviceManagerApi(opts) {
|
|
|
6355
6530
|
workerNativeCapAddonIds.set(cap.name, perAddonId);
|
|
6356
6531
|
}
|
|
6357
6532
|
perAddonId.set(id, addonId);
|
|
6533
|
+
if (commandHolds !== void 0) {
|
|
6534
|
+
const perHolds = workerNativeCapHolds.get(cap.name) ?? /* @__PURE__ */ new Map();
|
|
6535
|
+
perHolds.set(id, commandHolds);
|
|
6536
|
+
workerNativeCapHolds.set(cap.name, perHolds);
|
|
6537
|
+
} else workerNativeCapHolds.get(cap.name)?.delete(id);
|
|
6538
|
+
if (stateRefresh !== void 0) workerNativeCapRefresh.set(id, stateRefresh);
|
|
6539
|
+
else if (cap.name === "device-state-refresh") workerNativeCapRefresh.delete(id);
|
|
6358
6540
|
if (opts.broker) mountNativeCapService(opts.broker, addonId, cap);
|
|
6359
6541
|
onWorkerNativeCapsChanged?.();
|
|
6360
6542
|
} else throw new Error(`DeviceContext.registerNativeCap('${cap.name}') called on '${stableId}' but none of capabilityRegistry / broker / udsMode was provided.`);
|
|
@@ -6408,10 +6590,15 @@ function createBrokerDeviceManagerApi(opts) {
|
|
|
6408
6590
|
},
|
|
6409
6591
|
meta: { capName }
|
|
6410
6592
|
});
|
|
6411
|
-
else if (opts.capabilityRegistry)
|
|
6412
|
-
|
|
6593
|
+
else if (opts.capabilityRegistry) {
|
|
6594
|
+
opts.capabilityRegistry.unregisterNativeProvider(capName, id);
|
|
6595
|
+
getCommandHoldOverrideRegistry().delete(IN_PROCESS_HOLD_SOURCE, id, capName);
|
|
6596
|
+
if (capName === "device-state-refresh") getStateRefreshPolicyRegistry().delete(IN_PROCESS_REFRESH_SOURCE, id);
|
|
6597
|
+
} else {
|
|
6413
6598
|
workerNativeCaps.get(capName)?.delete(id);
|
|
6414
6599
|
workerNativeCapAddonIds.get(capName)?.delete(id);
|
|
6600
|
+
workerNativeCapHolds.get(capName)?.delete(id);
|
|
6601
|
+
if (capName === "device-state-refresh") workerNativeCapRefresh.delete(id);
|
|
6415
6602
|
onWorkerNativeCapsChanged?.();
|
|
6416
6603
|
}
|
|
6417
6604
|
eventBus.emit({
|
|
@@ -6533,7 +6720,8 @@ function createBrokerDeviceManagerApi(opts) {
|
|
|
6533
6720
|
for (const child of children) await teardownLocal(child.id, runLifecycle);
|
|
6534
6721
|
const capsToUnregister = opts.capabilityRegistry ? [...opts.capabilityRegistry.getNativeCapsForDevice(deviceId)] : [...getWorkerNativeCapsForDevice(deviceId)];
|
|
6535
6722
|
opts.capabilityRegistry?.unregisterAllNativeForDevice(deviceId);
|
|
6536
|
-
if (
|
|
6723
|
+
if (opts.capabilityRegistry) getStateRefreshPolicyRegistry().delete(IN_PROCESS_REFRESH_SOURCE, deviceId);
|
|
6724
|
+
else clearWorkerNativeCapsForDevice(deviceId);
|
|
6537
6725
|
for (const capName of capsToUnregister) {
|
|
6538
6726
|
eventBus.emit({
|
|
6539
6727
|
id: randomUUID(),
|
|
@@ -11679,12 +11867,18 @@ function buildChildCapDescriptors(manifest, nativeCapSnapshot) {
|
|
|
11679
11867
|
});
|
|
11680
11868
|
}
|
|
11681
11869
|
}
|
|
11682
|
-
for (const { capName, addonId, deviceIds } of nativeCapSnapshot) for (const deviceId of deviceIds)
|
|
11683
|
-
|
|
11684
|
-
|
|
11685
|
-
|
|
11686
|
-
|
|
11687
|
-
|
|
11870
|
+
for (const { capName, addonId, deviceIds, commandHolds, stateRefresh } of nativeCapSnapshot) for (const deviceId of deviceIds) {
|
|
11871
|
+
const holds = commandHolds?.get(deviceId);
|
|
11872
|
+
const refresh = stateRefresh?.get(deviceId);
|
|
11873
|
+
descriptors.push({
|
|
11874
|
+
capName,
|
|
11875
|
+
mode: "collection",
|
|
11876
|
+
deviceId,
|
|
11877
|
+
addonId,
|
|
11878
|
+
...holds !== void 0 ? { commandHolds: holds } : {},
|
|
11879
|
+
...refresh !== void 0 ? { stateRefresh: refresh } : {}
|
|
11880
|
+
});
|
|
11881
|
+
}
|
|
11688
11882
|
return descriptors;
|
|
11689
11883
|
}
|
|
11690
11884
|
//#endregion
|
|
@@ -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-DEAjZE_-.js");
|
|
7
7
|
const require_settle_sources = require("../../settle-sources-Bhsy57y-.js");
|
|
8
8
|
let node_crypto = require("node:crypto");
|
|
9
9
|
let node_fs = require("node:fs");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { In as addonPagesCapability, bu as EventCategory, vc as BaseAddon, vu as errMsg } from "../../dist-DBanWvHF.mjs";
|
|
2
2
|
import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
|
|
3
3
|
import { createHash, randomUUID } from "node:crypto";
|
|
4
4
|
import * as fs$1 from "node:fs";
|
|
@@ -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-DEAjZE_-.js");
|
|
7
7
|
const require_settle_sources = require("../../settle-sources-Bhsy57y-.js");
|
|
8
8
|
let node_crypto = require("node:crypto");
|
|
9
9
|
let node_fs = require("node:fs");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Rn as addonWidgetsCapability, bu as EventCategory, vc as BaseAddon, vu as errMsg } from "../../dist-DBanWvHF.mjs";
|
|
2
2
|
import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
|
|
3
3
|
import { createHash, randomUUID } from "node:crypto";
|
|
4
4
|
import * as fs$1 from "node:fs";
|