@camstack/system 1.2.80 → 1.2.81
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/device-manager/device-bindings-store.d.ts +21 -0
- package/dist/builtins/device-manager/device-manager.addon.js +22 -1
- package/dist/builtins/device-manager/device-manager.addon.mjs +22 -1
- package/dist/builtins/snapshot/index.js +570 -503
- package/dist/builtins/snapshot/index.mjs +571 -504
- package/dist/builtins/snapshot/snapshot-coalescing.d.ts +6 -1
- package/dist/builtins/snapshot/snapshot.addon.d.ts +29 -0
- package/package.json +1 -1
|
@@ -82,6 +82,27 @@ export declare function resolveRemoteNativeCapFromRegistry(deps: BindingsDeps, c
|
|
|
82
82
|
* filtering" — an absent row must never be the reason a device loses bindings.
|
|
83
83
|
*/
|
|
84
84
|
export declare function resolveDeviceType(deps: BindingsDeps, rawStore: AddonStore, deviceId: number): string | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* Whether the device-manager's own stores still know a device id.
|
|
87
|
+
*
|
|
88
|
+
* `'unknown'` is NOT `'absent'` — it means the question could not be answered
|
|
89
|
+
* and the caller must behave exactly as it did before asking.
|
|
90
|
+
*/
|
|
91
|
+
export type DevicePresence = 'present' | 'absent' | 'unknown';
|
|
92
|
+
/**
|
|
93
|
+
* Is this device still part of the fleet?
|
|
94
|
+
*
|
|
95
|
+
* The device-manager's own stores are the authority in-process — no RPC. Two
|
|
96
|
+
* sources, in the same order `resolveDeviceType` uses them: the live registry
|
|
97
|
+
* first (a device constructed but not yet persisted is present), then the
|
|
98
|
+
* PERSISTED meta, which is the index `getBindings` already reads and is present
|
|
99
|
+
* wherever this provider runs.
|
|
100
|
+
*
|
|
101
|
+
* `'absent'` is only ever returned against a NON-EMPTY meta store. An empty one
|
|
102
|
+
* means device restore has not run, not that the fleet was deleted (D49) — the
|
|
103
|
+
* same reason `getAllBindings` warns instead of reporting zero devices.
|
|
104
|
+
*/
|
|
105
|
+
export declare function resolveDevicePresence(deps: BindingsDeps, rawStore: AddonStore, deviceId: number): DevicePresence;
|
|
85
106
|
/**
|
|
86
107
|
* Does a capability apply to a device of type `deviceType`?
|
|
87
108
|
*
|
|
@@ -1836,6 +1836,25 @@ function resolveDeviceType(deps, rawStore, deviceId) {
|
|
|
1836
1836
|
return typeof live === "string" && live.length > 0 ? live : void 0;
|
|
1837
1837
|
}
|
|
1838
1838
|
/**
|
|
1839
|
+
* Is this device still part of the fleet?
|
|
1840
|
+
*
|
|
1841
|
+
* The device-manager's own stores are the authority in-process — no RPC. Two
|
|
1842
|
+
* sources, in the same order `resolveDeviceType` uses them: the live registry
|
|
1843
|
+
* first (a device constructed but not yet persisted is present), then the
|
|
1844
|
+
* PERSISTED meta, which is the index `getBindings` already reads and is present
|
|
1845
|
+
* wherever this provider runs.
|
|
1846
|
+
*
|
|
1847
|
+
* `'absent'` is only ever returned against a NON-EMPTY meta store. An empty one
|
|
1848
|
+
* means device restore has not run, not that the fleet was deleted (D49) — the
|
|
1849
|
+
* same reason `getAllBindings` warns instead of reporting zero devices.
|
|
1850
|
+
*/
|
|
1851
|
+
function resolveDevicePresence(deps, rawStore, deviceId) {
|
|
1852
|
+
if (deps.ctx.kernel?.deviceRegistry?.getById(deviceId)) return "present";
|
|
1853
|
+
const meta = rawStore.deviceMeta;
|
|
1854
|
+
if (meta && Object.keys(meta).length > 0) return meta[String(deviceId)] === void 0 ? "absent" : "present";
|
|
1855
|
+
return "unknown";
|
|
1856
|
+
}
|
|
1857
|
+
/**
|
|
1839
1858
|
* Does a capability apply to a device of type `deviceType`?
|
|
1840
1859
|
*
|
|
1841
1860
|
* The cap's `deviceTypes` is the ONLY declaration consulted (D4: behavioural
|
|
@@ -1858,6 +1877,7 @@ async function getBindings(deps, input) {
|
|
|
1858
1877
|
const rawStore = await deps.ctx.settings.readAddonStore();
|
|
1859
1878
|
const perDevice = (rawStore.deviceBindings ?? {})[storeKey] ?? {};
|
|
1860
1879
|
const deviceType = resolveDeviceType(deps, rawStore, input.deviceId);
|
|
1880
|
+
const presence = resolveDevicePresence(deps, rawStore, input.deviceId);
|
|
1861
1881
|
const entries = [];
|
|
1862
1882
|
const seenCaps = /* @__PURE__ */ new Set();
|
|
1863
1883
|
const resolveRemote = (capName) => deps.remoteNativeCaps.get(input.deviceId)?.get(capName) ?? resolveRemoteNativeCapFromRegistry(deps, capName, input.deviceId);
|
|
@@ -1879,7 +1899,8 @@ async function getBindings(deps, input) {
|
|
|
1879
1899
|
});
|
|
1880
1900
|
seenCaps.add(capName);
|
|
1881
1901
|
}
|
|
1882
|
-
if (deps.
|
|
1902
|
+
if (presence === "absent") deps.ctx.logger.debug("bindings requested for absent device — returning none", { tags: { deviceId: input.deviceId } });
|
|
1903
|
+
else if (deps.capabilityRegistry) {
|
|
1883
1904
|
const skippedForType = [];
|
|
1884
1905
|
for (const capName of deps.capabilityRegistry.getCapsWithDefaultWrapper()) {
|
|
1885
1906
|
if (seenCaps.has(capName)) continue;
|
|
@@ -1831,6 +1831,25 @@ function resolveDeviceType(deps, rawStore, deviceId) {
|
|
|
1831
1831
|
return typeof live === "string" && live.length > 0 ? live : void 0;
|
|
1832
1832
|
}
|
|
1833
1833
|
/**
|
|
1834
|
+
* Is this device still part of the fleet?
|
|
1835
|
+
*
|
|
1836
|
+
* The device-manager's own stores are the authority in-process — no RPC. Two
|
|
1837
|
+
* sources, in the same order `resolveDeviceType` uses them: the live registry
|
|
1838
|
+
* first (a device constructed but not yet persisted is present), then the
|
|
1839
|
+
* PERSISTED meta, which is the index `getBindings` already reads and is present
|
|
1840
|
+
* wherever this provider runs.
|
|
1841
|
+
*
|
|
1842
|
+
* `'absent'` is only ever returned against a NON-EMPTY meta store. An empty one
|
|
1843
|
+
* means device restore has not run, not that the fleet was deleted (D49) — the
|
|
1844
|
+
* same reason `getAllBindings` warns instead of reporting zero devices.
|
|
1845
|
+
*/
|
|
1846
|
+
function resolveDevicePresence(deps, rawStore, deviceId) {
|
|
1847
|
+
if (deps.ctx.kernel?.deviceRegistry?.getById(deviceId)) return "present";
|
|
1848
|
+
const meta = rawStore.deviceMeta;
|
|
1849
|
+
if (meta && Object.keys(meta).length > 0) return meta[String(deviceId)] === void 0 ? "absent" : "present";
|
|
1850
|
+
return "unknown";
|
|
1851
|
+
}
|
|
1852
|
+
/**
|
|
1834
1853
|
* Does a capability apply to a device of type `deviceType`?
|
|
1835
1854
|
*
|
|
1836
1855
|
* The cap's `deviceTypes` is the ONLY declaration consulted (D4: behavioural
|
|
@@ -1853,6 +1872,7 @@ async function getBindings(deps, input) {
|
|
|
1853
1872
|
const rawStore = await deps.ctx.settings.readAddonStore();
|
|
1854
1873
|
const perDevice = (rawStore.deviceBindings ?? {})[storeKey] ?? {};
|
|
1855
1874
|
const deviceType = resolveDeviceType(deps, rawStore, input.deviceId);
|
|
1875
|
+
const presence = resolveDevicePresence(deps, rawStore, input.deviceId);
|
|
1856
1876
|
const entries = [];
|
|
1857
1877
|
const seenCaps = /* @__PURE__ */ new Set();
|
|
1858
1878
|
const resolveRemote = (capName) => deps.remoteNativeCaps.get(input.deviceId)?.get(capName) ?? resolveRemoteNativeCapFromRegistry(deps, capName, input.deviceId);
|
|
@@ -1874,7 +1894,8 @@ async function getBindings(deps, input) {
|
|
|
1874
1894
|
});
|
|
1875
1895
|
seenCaps.add(capName);
|
|
1876
1896
|
}
|
|
1877
|
-
if (deps.
|
|
1897
|
+
if (presence === "absent") deps.ctx.logger.debug("bindings requested for absent device — returning none", { tags: { deviceId: input.deviceId } });
|
|
1898
|
+
else if (deps.capabilityRegistry) {
|
|
1878
1899
|
const skippedForType = [];
|
|
1879
1900
|
for (const capName of deps.capabilityRegistry.getCapsWithDefaultWrapper()) {
|
|
1880
1901
|
if (seenCaps.has(capName)) continue;
|