@camstack/server 1.2.785 → 1.2.787
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 +13 -0
- package/dist/api/core/cap-providers.js +106 -103
- package/dist/api/trpc/generated-cap-mounts.js +1 -10
- package/dist/api/trpc/generated-cap-routers.js +2289 -2375
- package/dist/core/addon/addon-registry.service.js +17 -13
- package/dist/core/addon/instances-of-cap.js +35 -0
- package/package.json +32 -13
- package/system/dist/addon-runner.js +11 -2
- package/system/dist/addon-runner.mjs +12 -3
- package/system/dist/addon-utils.mjs +1 -1
- package/system/dist/{agent-https-B7lqIrF1.js → agent-https--lvZp4PX.js} +1 -1
- package/system/dist/{agent-https-CACfLh65.mjs → agent-https-pSCzmbQd.mjs} +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +4 -4
- 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 +5 -5
- package/system/dist/builtins/alerts/alerts.addon.js +1 -1
- package/system/dist/builtins/alerts/alerts.addon.mjs +3 -3
- 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 +5 -5
- 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/composed-device.d.ts +16 -0
- package/system/dist/builtins/composer/composer.addon.js +62 -13
- package/system/dist/builtins/composer/composer.addon.mjs +62 -13
- 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/actions-service.d.ts +16 -0
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +235 -37
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +235 -37
- package/system/dist/builtins/core-blocks/migrations/fountain-drink-drop.d.ts +21 -0
- package/system/dist/builtins/core-blocks/migrations/index.d.ts +1 -0
- package/system/dist/builtins/device-history/device-history.addon.js +2 -2
- package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
- package/system/dist/builtins/device-manager/device-manager.addon.js +1 -1
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
- package/system/dist/builtins/hub-forwarder/index.js +1 -1
- package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/system/dist/builtins/keychain/index.js +4 -4
- package/system/dist/builtins/keychain/index.mjs +4 -4
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +5 -5
- package/system/dist/builtins/local-network/local-network.addon.js +2 -2
- package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
- package/system/dist/builtins/loki-logging/index.js +2 -2
- package/system/dist/builtins/loki-logging/index.mjs +2 -2
- package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +10 -10
- package/system/dist/builtins/platform-probe/index.js +1 -1
- package/system/dist/builtins/platform-probe/index.mjs +10 -10
- package/system/dist/builtins/record-entries/index.js +1 -1
- package/system/dist/builtins/record-entries/index.mjs +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/snapshot/index.js +1 -1
- package/system/dist/builtins/snapshot/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +20 -20
- 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/integration-record-kinds.d.ts +0 -1
- package/system/dist/builtins/sqlite-storage/integration-registry.d.ts +2 -4
- package/system/dist/builtins/sqlite-storage/migrations/migration-types.d.ts +6 -1
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +7 -4
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +7 -4
- package/system/dist/builtins/storage-orchestrator/drain-state-store.d.ts +4 -8
- package/system/dist/builtins/storage-orchestrator/location-store.d.ts +9 -26
- package/system/dist/builtins/storage-orchestrator/record-kinds.d.ts +0 -1
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +35 -407
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +36 -407
- package/system/dist/builtins/system-config/system-config.addon.js +3 -3
- package/system/dist/builtins/system-config/system-config.addon.mjs +285 -285
- 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-n5mJUHzf.js → capture-engine-CTFHb-UX.js} +1 -1
- package/system/dist/{capture-engine-Dw82x5UW.mjs → capture-engine-N1-UaQr0.mjs} +1 -1
- package/system/dist/{composition-sources-D-bbLadz.mjs → composition-sources-Qe3MRI1x.mjs} +1 -1
- package/system/dist/{composition-sources-Cdow6PNn.js → composition-sources-Yjz-b6-8.js} +1 -1
- package/system/dist/{constants-Dmc-T4Zw.js → constants-7gannWcO.js} +1 -1
- package/system/dist/{constants-C6UsfDdP.mjs → constants-lWMAnwmj.mjs} +1 -1
- package/system/dist/{coral-accelerators-DBlgWB8k.mjs → coral-accelerators-BW3OcrLD.mjs} +6 -6
- package/system/dist/{custom-action-registry-B9zFBNVa.mjs → custom-action-registry-N7flBDwT.mjs} +37 -37
- package/system/dist/{device-ca-OQqtK7Yy.mjs → device-ca-8lpRo9Ss.mjs} +1 -1
- package/system/dist/{device-ca-v8lGdWVk.js → device-ca-HGx3Pwb6.js} +1 -1
- package/system/dist/{dist-CRWinpyX.mjs → dist-DgZrPBbX.mjs} +1865 -1818
- package/system/dist/{dist-1X5ccoX2.js → dist-j7uy5oG9.js} +1876 -1775
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-mdns-ciao-BQqm5eSM.mjs → hub-mdns-ciao-BM3peDu1.mjs} +2 -2
- package/system/dist/{hub-mdns-ciao-hBZgojNT.js → hub-mdns-ciao-BUKHJL6N.js} +2 -2
- package/system/dist/index.d.ts +2 -2
- package/system/dist/index.js +51 -222
- package/system/dist/index.mjs +265 -434
- package/system/dist/kernel/moleculer/migration-api-facade.d.ts +2 -0
- package/system/dist/kernel/transport/local-child-client.d.ts +9 -0
- package/system/dist/{legacy-integration-rows-door-BUjw8YoW.js → legacy-integration-rows-door-D51X6Fdr.js} +1 -1
- package/system/dist/{legacy-integration-rows-door-B7bwfRev.mjs → legacy-integration-rows-door-DIm4Q3Jj.mjs} +1 -1
- package/system/dist/migrations/hub/2026-11-06-drop-legacy-integrations-and-storage-locations.d.ts +12 -0
- package/system/dist/{restore-archive-D9vM-Kzb.js → restore-archive-8jRnSzmw.js} +1 -1
- package/system/dist/{restore-archive-TST7tvBk.mjs → restore-archive-D-Wmp8OK.mjs} +150 -150
- package/system/dist/{wal-maintenance-C7dJSaPS.mjs → wal-maintenance-CBnqPn4u.mjs} +0 -0
- package/system/dist/{wal-maintenance-wfVwXxO4.js → wal-maintenance-D0FMnpba.js} +0 -0
- package/system/package.json +1 -1
|
@@ -394,6 +394,8 @@ class AddonRegistryService {
|
|
|
394
394
|
activeStorageProvider = null;
|
|
395
395
|
activeSettingsBackend = null;
|
|
396
396
|
integrationRegistry = null;
|
|
397
|
+
/** Why the integration registry is unset (records wiring failed or the records cap is absent). */
|
|
398
|
+
integrationRegistryUnavailable = null;
|
|
397
399
|
clusterNodeHistoryStore = null;
|
|
398
400
|
nodeTombstoneStore = null;
|
|
399
401
|
clusterAgentRecords = null;
|
|
@@ -1407,13 +1409,18 @@ class AddonRegistryService {
|
|
|
1407
1409
|
setCredentialTokenService(service) {
|
|
1408
1410
|
this.credentialTokenService = service;
|
|
1409
1411
|
}
|
|
1410
|
-
async wireHubMainOrphanRecords(
|
|
1412
|
+
async wireHubMainOrphanRecords() {
|
|
1411
1413
|
const recordsCap = this.capabilityRegistry.getSingleton('records');
|
|
1412
|
-
if (recordsCap === null || recordsCap === undefined)
|
|
1414
|
+
if (recordsCap === null || recordsCap === undefined) {
|
|
1415
|
+
this.integrationRegistryUnavailable = 'the records capability has no provider';
|
|
1416
|
+
this.logger.error('IntegrationRegistry not wired: the records capability has no provider', {
|
|
1417
|
+
meta: { reason: this.integrationRegistryUnavailable },
|
|
1418
|
+
});
|
|
1413
1419
|
return;
|
|
1420
|
+
}
|
|
1414
1421
|
const integrationRecords = this.recordsForOwner('integration-registry', this.secretsForOwner('integration-registry'));
|
|
1415
1422
|
await integrationRecords.declare(system_1.integrationRegistryRecordKinds);
|
|
1416
|
-
this.integrationRegistry = new system_1.IntegrationRegistry(
|
|
1423
|
+
this.integrationRegistry = new system_1.IntegrationRegistry(system_1.IntegrationRegistry.recordStoresOf(integrationRecords));
|
|
1417
1424
|
await this.integrationRegistry.initialize();
|
|
1418
1425
|
this.logger.info('IntegrationRegistry initialized (records)', { meta: { phase: 'v2' } });
|
|
1419
1426
|
const clusterRecords = this.recordsForOwner('cluster-agent', this.secretsForOwner('cluster-agent'));
|
|
@@ -1444,6 +1451,10 @@ class AddonRegistryService {
|
|
|
1444
1451
|
* (where the addon is not currently installed). Orphaned data stays in DB
|
|
1445
1452
|
* and reconnects automatically when the addon is reinstalled.
|
|
1446
1453
|
*/
|
|
1454
|
+
/** Why {@link getIntegrationRegistry} answers null, or null when it has not failed. */
|
|
1455
|
+
getIntegrationRegistryUnavailableReason() {
|
|
1456
|
+
return this.integrationRegistryUnavailable;
|
|
1457
|
+
}
|
|
1447
1458
|
getIntegrationRegistry() {
|
|
1448
1459
|
if (!this.integrationRegistry)
|
|
1449
1460
|
return null;
|
|
@@ -2720,16 +2731,9 @@ class AddonRegistryService {
|
|
|
2720
2731
|
registry: this.capabilityRegistry,
|
|
2721
2732
|
logger: this.logger,
|
|
2722
2733
|
}, store);
|
|
2723
|
-
void this.wireHubMainOrphanRecords(
|
|
2724
|
-
this.
|
|
2725
|
-
|
|
2726
|
-
});
|
|
2727
|
-
this.integrationRegistry = new system_1.IntegrationRegistry(store);
|
|
2728
|
-
void this.integrationRegistry.initialize().then(() => {
|
|
2729
|
-
this.logger.info('IntegrationRegistry initialized (legacy)', {
|
|
2730
|
-
meta: { phase: 'v2' },
|
|
2731
|
-
});
|
|
2732
|
-
});
|
|
2734
|
+
void this.wireHubMainOrphanRecords().catch((err) => {
|
|
2735
|
+
this.integrationRegistryUnavailable = `records wiring failed: ${(0, types_2.errMsg)(err)}`;
|
|
2736
|
+
this.logger.error('hub-main records wiring failed — the integration registry stays unset', { meta: { error: (0, types_2.errMsg)(err) } });
|
|
2733
2737
|
});
|
|
2734
2738
|
this.loadCollectionPreferences();
|
|
2735
2739
|
// DeviceStore/ConfigStore are owned by the `device-persistence`
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.instanceSourceOver = instanceSourceOver;
|
|
4
|
+
exports.resolveInstancesOfCap = resolveInstancesOfCap;
|
|
5
|
+
/**
|
|
6
|
+
* The hub's resolver of the instances of a function cap (D1013 rule 5). It binds the registry to the
|
|
7
|
+
* one rule in `@camstack/types` (`instancesOfCap`): every holder of `integration-instances` that also
|
|
8
|
+
* provides the cap describes its kinds, and the instances of a kind of that cap are the answer. A
|
|
9
|
+
* holder that cannot answer is reported, never skipped (D315, D49).
|
|
10
|
+
*/
|
|
11
|
+
const types_1 = require("@camstack/types");
|
|
12
|
+
const instance_links_service_js_1 = require("./instance-links.service.js");
|
|
13
|
+
function holderNamed(registry, addonId) {
|
|
14
|
+
const holder = (0, instance_links_service_js_1.holdersOf)(registry).find((candidate) => candidate.addonId === addonId);
|
|
15
|
+
if (holder === undefined)
|
|
16
|
+
throw new Error(`${addonId} no longer holds integration-instances`);
|
|
17
|
+
return holder;
|
|
18
|
+
}
|
|
19
|
+
/** The source over the hub registry. */
|
|
20
|
+
function instanceSourceOver(registry) {
|
|
21
|
+
return {
|
|
22
|
+
holders: async (cap) => {
|
|
23
|
+
const providers = new Set(registry.getCollectionEntries(cap).map(([addonId]) => addonId));
|
|
24
|
+
return (0, instance_links_service_js_1.holdersOf)(registry)
|
|
25
|
+
.map((holder) => holder.addonId)
|
|
26
|
+
.filter((addonId) => providers.has(addonId));
|
|
27
|
+
},
|
|
28
|
+
describe: (addonId) => holderNamed(registry, addonId).provider.describe(),
|
|
29
|
+
listInstances: (addonId) => holderNamed(registry, addonId).provider.listInstances(),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/** The instances of `cap` across every provider, optionally of one kind. */
|
|
33
|
+
function resolveInstancesOfCap(registry, cap, filter = {}) {
|
|
34
|
+
return (0, types_1.instancesOfCap)(instanceSourceOver(registry), cap, filter);
|
|
35
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/server",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.787",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -66,10 +66,29 @@
|
|
|
66
66
|
],
|
|
67
67
|
"requires": {
|
|
68
68
|
"addons": {
|
|
69
|
-
"@camstack/addon-admin-ui": ">=1.2.
|
|
70
|
-
"@camstack/addon-agent-ui": ">=1.2.
|
|
71
|
-
"@camstack/addon-
|
|
72
|
-
"@camstack/addon-
|
|
69
|
+
"@camstack/addon-admin-ui": ">=1.2.600",
|
|
70
|
+
"@camstack/addon-agent-ui": ">=1.2.335",
|
|
71
|
+
"@camstack/addon-ai": ">=0.4.178",
|
|
72
|
+
"@camstack/addon-google-services": ">=0.2.41",
|
|
73
|
+
"@camstack/addon-import-alexa": ">=0.2.193",
|
|
74
|
+
"@camstack/addon-mqtt-broker": ">=1.2.154",
|
|
75
|
+
"@camstack/addon-notifiers": ">=1.2.631",
|
|
76
|
+
"@camstack/addon-pipeline": ">=1.2.643",
|
|
77
|
+
"@camstack/addon-post-analysis": ">=1.2.675",
|
|
78
|
+
"@camstack/addon-provider-bosch": ">=0.1.41",
|
|
79
|
+
"@camstack/addon-provider-dreame": ">=0.2.168",
|
|
80
|
+
"@camstack/addon-provider-dreo": ">=0.2.160",
|
|
81
|
+
"@camstack/addon-provider-homeassistant": ">=1.2.668",
|
|
82
|
+
"@camstack/addon-provider-homematic": ">=1.2.185",
|
|
83
|
+
"@camstack/addon-provider-petkit": ">=0.2.163",
|
|
84
|
+
"@camstack/addon-provider-rademacher": ">=0.2.162",
|
|
85
|
+
"@camstack/addon-provider-rtsp": ">=1.2.154",
|
|
86
|
+
"@camstack/addon-provider-tuya": ">=0.2.154",
|
|
87
|
+
"@camstack/addon-provider-velux": ">=0.2.162",
|
|
88
|
+
"@camstack/addon-provider-wyze": ">=0.2.167",
|
|
89
|
+
"@camstack/addon-tailscale": ">=1.2.151",
|
|
90
|
+
"@camstack/addon-training": ">=0.1.132",
|
|
91
|
+
"@camstack/addon-waste-collections": ">=0.1.34"
|
|
73
92
|
},
|
|
74
93
|
"wrapper": {
|
|
75
94
|
"desktop": ">=0.0.1",
|
|
@@ -78,19 +97,19 @@
|
|
|
78
97
|
}
|
|
79
98
|
},
|
|
80
99
|
"dependencies": {
|
|
81
|
-
"@camstack/addon-admin-ui": "1.2.
|
|
82
|
-
"@camstack/addon-agent-ui": "1.2.
|
|
100
|
+
"@camstack/addon-admin-ui": "1.2.600",
|
|
101
|
+
"@camstack/addon-agent-ui": "1.2.335",
|
|
83
102
|
"@camstack/addon-auth": "1.2.176",
|
|
84
103
|
"@camstack/addon-benchmark": "1.2.311",
|
|
85
104
|
"@camstack/addon-decoder-nodeav": "1.2.146",
|
|
86
|
-
"@camstack/addon-notifiers": "1.2.
|
|
87
|
-
"@camstack/addon-pipeline": "1.2.
|
|
105
|
+
"@camstack/addon-notifiers": "1.2.631",
|
|
106
|
+
"@camstack/addon-pipeline": "1.2.643",
|
|
88
107
|
"@camstack/addon-pipeline-orchestrator": "1.2.663",
|
|
89
|
-
"@camstack/addon-post-analysis": "1.2.
|
|
90
|
-
"@camstack/develop": "0.1.
|
|
108
|
+
"@camstack/addon-post-analysis": "1.2.675",
|
|
109
|
+
"@camstack/develop": "0.1.47",
|
|
91
110
|
"@camstack/sdk": "1.2.155",
|
|
92
|
-
"@camstack/types": "1.2.
|
|
93
|
-
"@camstack/ui-library": "1.2.
|
|
111
|
+
"@camstack/types": "1.2.513",
|
|
112
|
+
"@camstack/ui-library": "1.2.393",
|
|
94
113
|
"@fastify/compress": "^9.0.0",
|
|
95
114
|
"@fastify/cookie": "^11.0.2",
|
|
96
115
|
"@fastify/cors": "^11.2.0",
|
|
@@ -5237,7 +5237,10 @@ var LocalChildClient = class {
|
|
|
5237
5237
|
...Object.keys(hints).length > 0 ? { hints } : {},
|
|
5238
5238
|
...routing
|
|
5239
5239
|
};
|
|
5240
|
-
const reply = await this.channel.request(msg, {
|
|
5240
|
+
const reply = await this.channel.request(msg, {
|
|
5241
|
+
payload: packPayload(input.args),
|
|
5242
|
+
...this.outboundBound(input)
|
|
5243
|
+
});
|
|
5241
5244
|
return reply instanceof PayloadReply ? unpackPayload(reply.payload) : reply;
|
|
5242
5245
|
}
|
|
5243
5246
|
const msg = {
|
|
@@ -5247,7 +5250,12 @@ var LocalChildClient = class {
|
|
|
5247
5250
|
args: input.args,
|
|
5248
5251
|
...routing
|
|
5249
5252
|
};
|
|
5250
|
-
return this.channel.request(msg);
|
|
5253
|
+
return this.channel.request(msg, this.outboundBound(input));
|
|
5254
|
+
}
|
|
5255
|
+
/** The method's declared `timeoutMs`, as per-request options (none ⇒ the channel default). */
|
|
5256
|
+
outboundBound(input) {
|
|
5257
|
+
const declared = (this.options.capTimeoutMs ?? ((capName, method) => _camstack_types_addon.CAP_METHOD_TIMEOUTS_MS[capName]?.[method]))(input.capName, input.method);
|
|
5258
|
+
return typeof declared === "number" ? { timeoutMs: declared } : {};
|
|
5251
5259
|
}
|
|
5252
5260
|
/** Disconnect from the parent. Safe to call before `start()` (no-op) and idempotent. */
|
|
5253
5261
|
async close() {
|
|
@@ -5612,6 +5620,7 @@ function toIntegration(row) {
|
|
|
5612
5620
|
addonId: row.addonId,
|
|
5613
5621
|
name: row.name,
|
|
5614
5622
|
info: { ...row.info },
|
|
5623
|
+
...row.enabled === void 0 ? {} : { enabled: row.enabled },
|
|
5615
5624
|
...row.originStableId === void 0 ? {} : { originStableId: row.originStableId }
|
|
5616
5625
|
};
|
|
5617
5626
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { register } from "node:module";
|
|
2
|
-
import { BOOT_RECOVERY_BACKOFF_MS, CALLER_STAMPED_CAPABILITIES, COLLECTION_ARRAY_METHODS, DATAPLANE_SECRET_HEADER, DEVICE_CHILDREN_BATCH_MAX, DeviceType, DisposerChain, ErrorI18nPayloadSchema, EventCategory, MIGRATION_API_VERSION, PEER_BYTES_CHUNK_BYTES, PEER_BYTES_MAX_OUTSTANDING, PEER_BYTES_STALL_MS, PEER_BYTES_TICKET_TTL_MS, ReadinessRegistry, ReadinessTimeoutError, addonSliceHandleApi, asJsonObject, asString, collectZodSecretPaths, createDebugEmitter, createDeviceProxy, createEventBusSliceSource, createRecordsAccess, createSecretsAccess, describeCustomActions, deviceOpsCapability, emitReadiness, errMsg, expandCapMethods, findMigrationsBlocked, isCollectionArrayMethodName, isProviderOptionalMethodName, maskUrlCredentials, nodeIdOfScopedKey, normalizeAddonInitResult, readErrorI18n, readNodePin, resolveDeviceSettings, resolveSecretViewsIn, scopeKey, scrubKnownSecrets, withCapInputDefaults } from "@camstack/types/addon";
|
|
2
|
+
import { BOOT_RECOVERY_BACKOFF_MS, CALLER_STAMPED_CAPABILITIES, CAP_METHOD_TIMEOUTS_MS, COLLECTION_ARRAY_METHODS, DATAPLANE_SECRET_HEADER, DEVICE_CHILDREN_BATCH_MAX, DeviceType, DisposerChain, ErrorI18nPayloadSchema, EventCategory, MIGRATION_API_VERSION, PEER_BYTES_CHUNK_BYTES, PEER_BYTES_MAX_OUTSTANDING, PEER_BYTES_STALL_MS, PEER_BYTES_TICKET_TTL_MS, ReadinessRegistry, ReadinessTimeoutError, addonSliceHandleApi, asJsonObject, asString, collectZodSecretPaths, createDebugEmitter, createDeviceProxy, createEventBusSliceSource, createRecordsAccess, createSecretsAccess, describeCustomActions, deviceOpsCapability, emitReadiness, errMsg, expandCapMethods, findMigrationsBlocked, isCollectionArrayMethodName, isProviderOptionalMethodName, maskUrlCredentials, nodeIdOfScopedKey, normalizeAddonInitResult, readErrorI18n, readNodePin, resolveDeviceSettings, resolveSecretViewsIn, scopeKey, scrubKnownSecrets, withCapInputDefaults } from "@camstack/types/addon";
|
|
3
3
|
import * as fs$1 from "node:fs";
|
|
4
4
|
import fs, { createReadStream, createWriteStream, existsSync, readFileSync, readdirSync } from "node:fs";
|
|
5
5
|
import * as path from "node:path";
|
|
@@ -5182,7 +5182,10 @@ var LocalChildClient = class {
|
|
|
5182
5182
|
...Object.keys(hints).length > 0 ? { hints } : {},
|
|
5183
5183
|
...routing
|
|
5184
5184
|
};
|
|
5185
|
-
const reply = await this.channel.request(msg, {
|
|
5185
|
+
const reply = await this.channel.request(msg, {
|
|
5186
|
+
payload: packPayload(input.args),
|
|
5187
|
+
...this.outboundBound(input)
|
|
5188
|
+
});
|
|
5186
5189
|
return reply instanceof PayloadReply ? unpackPayload(reply.payload) : reply;
|
|
5187
5190
|
}
|
|
5188
5191
|
const msg = {
|
|
@@ -5192,7 +5195,12 @@ var LocalChildClient = class {
|
|
|
5192
5195
|
args: input.args,
|
|
5193
5196
|
...routing
|
|
5194
5197
|
};
|
|
5195
|
-
return this.channel.request(msg);
|
|
5198
|
+
return this.channel.request(msg, this.outboundBound(input));
|
|
5199
|
+
}
|
|
5200
|
+
/** The method's declared `timeoutMs`, as per-request options (none ⇒ the channel default). */
|
|
5201
|
+
outboundBound(input) {
|
|
5202
|
+
const declared = (this.options.capTimeoutMs ?? ((capName, method) => CAP_METHOD_TIMEOUTS_MS[capName]?.[method]))(input.capName, input.method);
|
|
5203
|
+
return typeof declared === "number" ? { timeoutMs: declared } : {};
|
|
5196
5204
|
}
|
|
5197
5205
|
/** Disconnect from the parent. Safe to call before `start()` (no-op) and idempotent. */
|
|
5198
5206
|
async close() {
|
|
@@ -5557,6 +5565,7 @@ function toIntegration(row) {
|
|
|
5557
5565
|
addonId: row.addonId,
|
|
5558
5566
|
name: row.name,
|
|
5559
5567
|
info: { ...row.info },
|
|
5568
|
+
...row.enabled === void 0 ? {} : { enabled: row.enabled },
|
|
5560
5569
|
...row.originStableId === void 0 ? {} : { originStableId: row.originStableId }
|
|
5561
5570
|
};
|
|
5562
5571
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { C as isModelDownloaded, S as isModelDownloadHttpError, _ as downloadFile, a as startEventLoopStallMonitor, f as ModelDownloadService, g as deleteModelFromDisk, h as collectModelFiles, i as attributeStall, l as parseRangeHeader, m as adoptModelRevisions, n as STALL_REPORT_MS, o as createFileDataPlaneHandler, p as ModelDownloadHttpError, r as STALL_TICK_MS, s as contentTypeFor, t as CustomActionRegistry, w as resolveFormatRevision, x as getModelFilePath, y as ensureModel } from "./custom-action-registry-
|
|
1
|
+
import { C as isModelDownloaded, S as isModelDownloadHttpError, _ as downloadFile, a as startEventLoopStallMonitor, f as ModelDownloadService, g as deleteModelFromDisk, h as collectModelFiles, i as attributeStall, l as parseRangeHeader, m as adoptModelRevisions, n as STALL_REPORT_MS, o as createFileDataPlaneHandler, p as ModelDownloadHttpError, r as STALL_TICK_MS, s as contentTypeFor, t as CustomActionRegistry, w as resolveFormatRevision, x as getModelFilePath, y as ensureModel } from "./custom-action-registry-N7flBDwT.mjs";
|
|
2
2
|
import { i as renderCourtesyOverlayJpeg, n as courtesyCacheKey, r as renderCourtesyJpeg, t as COURTESY_DEFAULT_WIDTH } from "./snapshot-courtesy-CyFs1M3I.mjs";
|
|
3
3
|
export { COURTESY_DEFAULT_WIDTH, CustomActionRegistry, ModelDownloadHttpError, ModelDownloadService, STALL_REPORT_MS, STALL_TICK_MS, adoptModelRevisions, attributeStall, collectModelFiles, contentTypeFor, courtesyCacheKey, createFileDataPlaneHandler, deleteModelFromDisk, downloadFile, ensureModel, getModelFilePath, isModelDownloadHttpError, isModelDownloaded, parseRangeHeader, renderCourtesyJpeg, renderCourtesyOverlayJpeg, resolveFormatRevision, startEventLoopStallMonitor };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-Cek0wNdY.js");
|
|
2
|
-
const require_dist = require("./dist-
|
|
2
|
+
const require_dist = require("./dist-j7uy5oG9.js");
|
|
3
3
|
const require_x509_es = require("./x509.es-WtnRNyYS.js");
|
|
4
4
|
let zod = require("zod");
|
|
5
5
|
let node_crypto = require("node:crypto");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ns as defineRecordKinds } from "./dist-DgZrPBbX.mjs";
|
|
2
2
|
import { C as backdatedNotBefore, S as withUtcTimeEncoding, _ as NameConstraints, a as KeyUsageFlags, c as Pkcs10CertificateRequest, d as SubjectKeyIdentifierExtension, f as X509Certificate$1, g as GeneralSubtrees, h as GeneralSubtree, i as Extension, l as Pkcs10CertificateRequestGenerator, m as cryptoProvider, n as BasicConstraintsExtension, o as KeyUsagesExtension, p as X509CertificateGenerator, r as ExtendedKeyUsageExtension, s as PemConverter, t as AuthorityKeyIdentifierExtension, u as SubjectAlternativeNameExtension, v as GeneralName, x as AsnConvert } from "./x509.es-BRiJgOvu.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { X509Certificate, createHash, createPrivateKey, randomBytes, webcrypto } from "node:crypto";
|
|
@@ -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-j7uy5oG9.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,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ec as EventCategory, Lo as BaseAddon, Tc as errMsg, mn as addonPagesCapability } from "../../dist-DgZrPBbX.mjs";
|
|
2
2
|
import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
|
|
3
3
|
import { createHash, randomUUID } from "node:crypto";
|
|
4
|
-
import * as fs
|
|
4
|
+
import * as fs from "node:fs";
|
|
5
5
|
import * as path$1 from "node:path";
|
|
6
6
|
//#region src/builtins/addon-pages-aggregator/dedupe-pages.ts
|
|
7
7
|
/** Stable identity for an addon page, independent of which node reported it. */
|
|
@@ -211,11 +211,11 @@ var AddonPagesAggregatorAddon = class extends BaseAddon {
|
|
|
211
211
|
const bundlePath = this.resolveBundlePath(addonId, bundle);
|
|
212
212
|
if (bundlePath === null) return `/api/addon-pages/${addonId}/${bundle}?v=${Math.floor(Date.now())}`;
|
|
213
213
|
try {
|
|
214
|
-
const stat = fs
|
|
214
|
+
const stat = fs.statSync(bundlePath);
|
|
215
215
|
const cacheKey = `${bundlePath}:${stat.size}:${stat.mtimeMs}`;
|
|
216
216
|
let v = this.bundleHashCache.get(cacheKey);
|
|
217
217
|
if (v === void 0) {
|
|
218
|
-
v = createHash("sha1").update(fs
|
|
218
|
+
v = createHash("sha1").update(fs.readFileSync(bundlePath)).digest("hex").slice(0, 12);
|
|
219
219
|
this.bundleHashCache.set(cacheKey, v);
|
|
220
220
|
}
|
|
221
221
|
return `/api/addon-pages/${addonId}/${bundle}?v=${v}`;
|
|
@@ -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-j7uy5oG9.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,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ec as EventCategory, Lo as BaseAddon, Tc as errMsg, gn as addonWidgetsCapability } from "../../dist-DgZrPBbX.mjs";
|
|
2
2
|
import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
|
|
3
3
|
import { createHash, randomUUID } from "node:crypto";
|
|
4
|
-
import * as fs
|
|
4
|
+
import * as fs from "node:fs";
|
|
5
5
|
import * as path$1 from "node:path";
|
|
6
6
|
//#region src/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.ts
|
|
7
7
|
/**
|
|
@@ -204,9 +204,9 @@ var AddonWidgetsAggregatorAddon = class extends BaseAddon {
|
|
|
204
204
|
if (entryPath === null) return String(Math.floor(Date.now()));
|
|
205
205
|
try {
|
|
206
206
|
const dir = path$1.dirname(entryPath);
|
|
207
|
-
const files = fs
|
|
207
|
+
const files = fs.readdirSync(dir).filter((f) => fs.statSync(path$1.join(dir, f)).isFile()).sort();
|
|
208
208
|
const cacheKey = `${dir}#${files.map((f) => {
|
|
209
|
-
const s = fs
|
|
209
|
+
const s = fs.statSync(path$1.join(dir, f));
|
|
210
210
|
return `${f}:${s.size}:${s.mtimeMs}`;
|
|
211
211
|
}).join("|")}`;
|
|
212
212
|
const cached = this.bundleHashCache.get(cacheKey);
|
|
@@ -214,7 +214,7 @@ var AddonWidgetsAggregatorAddon = class extends BaseAddon {
|
|
|
214
214
|
const hash = createHash("sha1");
|
|
215
215
|
for (const f of files) {
|
|
216
216
|
hash.update(f);
|
|
217
|
-
hash.update(fs
|
|
217
|
+
hash.update(fs.readFileSync(path$1.join(dir, f)));
|
|
218
218
|
}
|
|
219
219
|
const digest = hash.digest("hex").slice(0, 12);
|
|
220
220
|
this.bundleHashCache.set(cacheKey, digest);
|
|
@@ -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-j7uy5oG9.js");
|
|
7
7
|
const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
|
|
8
8
|
let node_fs = require("node:fs");
|
|
9
9
|
node_fs = require_chunk.__toESM(node_fs);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ec as EventCategory$1, Lo as BaseAddon, Ns as defineRecordKinds, Os as createEvent$1, Tc as errMsg$1, Ur as isAlertEpisodeOpen, Wr as isAlertEpisodeSeverity, _n as alertEpisodeId, f as AlertSchema, vn as alertEpisodePayload, w as CORE_BLOCK_ADDON_PREFIX, yn as alertsCapability } from "../../dist-DgZrPBbX.mjs";
|
|
2
2
|
import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
|
|
3
|
-
import * as fs
|
|
3
|
+
import * as fs from "node:fs";
|
|
4
4
|
import * as path$1 from "node:path";
|
|
5
5
|
import { maskUrlCredentials, scrubKnownSecrets } from "@camstack/types/addon";
|
|
6
6
|
//#region src/builtins/alerts/alert-episode-policy.ts
|
|
@@ -242,7 +242,7 @@ function lastCauseAfterChunk(previous, chunk) {
|
|
|
242
242
|
function readRunnerDisplayName(addonDirs, runnerId) {
|
|
243
243
|
const names = [];
|
|
244
244
|
for (const dir of addonDirs) try {
|
|
245
|
-
const raw = JSON.parse(fs
|
|
245
|
+
const raw = JSON.parse(fs.readFileSync(path$1.join(dir, "package.json"), "utf-8"));
|
|
246
246
|
const camstack = typeof raw === "object" && raw !== null ? Reflect.get(raw, "camstack") : null;
|
|
247
247
|
const addons = typeof camstack === "object" && camstack !== null ? Reflect.get(camstack, "addons") : null;
|
|
248
248
|
if (!Array.isArray(addons)) continue;
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-j7uy5oG9.js");
|
|
7
7
|
//#region src/builtins/autotrack/autotrack-config.ts
|
|
8
8
|
var DEFAULT_AUTOTRACK_LOOP_CONFIG = {
|
|
9
9
|
deadZoneFraction: .5,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ec as EventCategory, Lo as BaseAddon, Tc as errMsg, Ws as isEvent, Xi as ptzAutotrackCapability, rt as FIRST_LEVEL_MACRO_CLASSES, wn as bareAddonId } from "../../dist-DgZrPBbX.mjs";
|
|
2
2
|
//#region src/builtins/autotrack/autotrack-config.ts
|
|
3
3
|
var DEFAULT_AUTOTRACK_LOOP_CONFIG = {
|
|
4
4
|
deadZoneFraction: .5,
|
|
@@ -3,9 +3,9 @@ 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-j7uy5oG9.js");
|
|
7
7
|
const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
|
|
8
|
-
const require_restore_archive = require("../../restore-archive-
|
|
8
|
+
const require_restore_archive = require("../../restore-archive-8jRnSzmw.js");
|
|
9
9
|
let node_crypto = require("node:crypto");
|
|
10
10
|
let node_fs = require("node:fs");
|
|
11
11
|
node_fs = require_chunk.__toESM(node_fs);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Cn as backupCapability, Ec as EventCategory, Lo as BaseAddon, Pa as storageOccupancyCapability, _c as toNodeId, gi as mayWriteToLocation, nc as nodePin } from "../../dist-DgZrPBbX.mjs";
|
|
2
2
|
import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
|
|
3
|
-
import { _ as backupRecordStoresOf, a as BackupSnapshotRefusedError, d as ENCRYPTED_BACKUP_SUFFIX, f as generateBackupKeyPair, g as backupOrchestratorRecordKinds, i as BackupCancelledError, l as BackupKeyFormatError, m as parseBackupSecretKey, n as precheckRestoreKey, o as DEFAULT_BACKUP_DATABASES, p as parseBackupPublicKey, r as prepareRestoreArchive, s as SystemBackupService } from "../../restore-archive-
|
|
3
|
+
import { _ as backupRecordStoresOf, a as BackupSnapshotRefusedError, d as ENCRYPTED_BACKUP_SUFFIX, f as generateBackupKeyPair, g as backupOrchestratorRecordKinds, i as BackupCancelledError, l as BackupKeyFormatError, m as parseBackupSecretKey, n as precheckRestoreKey, o as DEFAULT_BACKUP_DATABASES, p as parseBackupPublicKey, r as prepareRestoreArchive, s as SystemBackupService } from "../../restore-archive-D-Wmp8OK.mjs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
|
-
import * as fs
|
|
5
|
+
import * as fs from "node:fs";
|
|
6
6
|
import * as path$1 from "node:path";
|
|
7
7
|
import * as fsp from "node:fs/promises";
|
|
8
8
|
//#region src/builtins/backup-orchestrator/backup-databases.ts
|
|
@@ -1018,7 +1018,7 @@ async function downloadArchiveToCache(input) {
|
|
|
1018
1018
|
location: input.locationId,
|
|
1019
1019
|
relativePath: input.filename
|
|
1020
1020
|
});
|
|
1021
|
-
const writeStream = fs
|
|
1021
|
+
const writeStream = fs.createWriteStream(input.cachePath);
|
|
1022
1022
|
let offset = 0;
|
|
1023
1023
|
try {
|
|
1024
1024
|
while (offset < sizeBytes) {
|
|
@@ -2502,7 +2502,7 @@ var BackupOrchestratorAddon = class extends BaseAddon {
|
|
|
2502
2502
|
});
|
|
2503
2503
|
try {
|
|
2504
2504
|
let offset = 0;
|
|
2505
|
-
const stream = fs
|
|
2505
|
+
const stream = fs.createReadStream(input.cachePath, { highWaterMark: UPLOAD_CHUNK_BYTES });
|
|
2506
2506
|
for await (const rawChunk of stream) {
|
|
2507
2507
|
if (input.signal?.aborted) {
|
|
2508
2508
|
stream.destroy();
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-j7uy5oG9.js");
|
|
7
7
|
const require_settle_sources = require("../../settle-sources-Bhsy57y-.js");
|
|
8
8
|
let zod = require("zod");
|
|
9
9
|
//#region src/builtins/calendars/calendar-color.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { E as CalendarPreferencesSchema, Lo as BaseAddon, Mn as calendarsCapability, Ns as defineRecordKinds } from "../../dist-DgZrPBbX.mjs";
|
|
2
2
|
import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/builtins/calendars/calendar-color.ts
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-j7uy5oG9.js");
|
|
7
7
|
let zod = require("zod");
|
|
8
8
|
let _camstack_types_node = require("@camstack/types/node");
|
|
9
9
|
let node_fs = require("node:fs");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ec as EventCategory, Ia as streamCatalogCapability, J as DeclaredDevices, Lo as BaseAddon, Nn as cameraGridLayoutCapability, Os as createEvent, Sc as DeviceFeature, Tc as errMsg, Tt as MOTION_CLOSE_AFTER_MS, Vs as hydrateSchema, ar as declarationOwnerNodeId, fo as buildFfmpegArgs, h as BaseDevice, ka as snapshotCapability, wc as DeviceType, wi as motionCapability, wn as bareAddonId, yi as memoizePinnedFfmpeg, z as DERIVED_CAMERA_SILENCED_CAP_NAMES } from "../../dist-DgZrPBbX.mjs";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { FfmpegProcess } from "@camstack/types/node";
|
|
4
4
|
import { promises } from "node:fs";
|
|
@@ -11,6 +11,10 @@ export interface ComposedDeviceHandle extends ComposedWriteTarget {
|
|
|
11
11
|
export declare class ComposedDevice extends BaseDevice<typeof COMPOSED_DEVICE_CONFIG_SCHEMA> implements ComposedDeviceHandle {
|
|
12
12
|
private sharedFeatures;
|
|
13
13
|
private extraCaps;
|
|
14
|
+
/** Whether this device's tank is also a `water` consumable (derived, never bound). */
|
|
15
|
+
private readonly derivesWater;
|
|
16
|
+
/** The `consumables` items the composition last wrote — the derived water item is added to these. */
|
|
17
|
+
private composedItems;
|
|
14
18
|
get features(): readonly DeviceFeature[];
|
|
15
19
|
constructor(ctx: DeviceContext, type: DeviceType, caps: readonly CapabilityDefinition[]);
|
|
16
20
|
/**
|
|
@@ -39,6 +43,18 @@ export declare class ComposedDevice extends BaseDevice<typeof COMPOSED_DEVICE_CO
|
|
|
39
43
|
private dispatch;
|
|
40
44
|
seed(capName: string, slice: SlicePatch): WriteOutcome;
|
|
41
45
|
patch(capName: string, patch: SlicePatch): WriteOutcome;
|
|
46
|
+
private writeSlice;
|
|
47
|
+
private writeCap;
|
|
48
|
+
/**
|
|
49
|
+
* The ONE place a fountain's tank becomes a consumable: the composition's own
|
|
50
|
+
* `consumables` items plus a `water` item derived from the `pet-fountain` slice
|
|
51
|
+
* (`petFountainWaterItem`). A composition that names its own `water` item keeps it.
|
|
52
|
+
*/
|
|
53
|
+
private withWater;
|
|
54
|
+
private fountainTank;
|
|
55
|
+
private itemsWithWater;
|
|
56
|
+
/** The fountain slice moved: re-publish the consumables with the new water item. */
|
|
57
|
+
private refreshWater;
|
|
42
58
|
setAvailable(available: boolean): void;
|
|
43
59
|
/** The chart unit of a statistic or a meter is the source reading's quantity (D944). */
|
|
44
60
|
adoptQuantity(quantity: ReadingQuantity): Promise<void>;
|
|
@@ -3,9 +3,9 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
7
|
-
const require_composition_sources = require("../../composition-sources-
|
|
8
|
-
const require_capture_engine = require("../../capture-engine-
|
|
6
|
+
const require_dist = require("../../dist-j7uy5oG9.js");
|
|
7
|
+
const require_composition_sources = require("../../composition-sources-Yjz-b6-8.js");
|
|
8
|
+
const require_capture_engine = require("../../capture-engine-CTFHb-UX.js");
|
|
9
9
|
const require_retention = require("../../retention-BNONb5X_.js");
|
|
10
10
|
let zod = require("zod");
|
|
11
11
|
//#region src/builtins/composer/actuator-invoke.ts
|
|
@@ -127,6 +127,12 @@ var GROUP_COMMAND_TYPES = new Set([
|
|
|
127
127
|
function present(args) {
|
|
128
128
|
return Object.fromEntries(Object.entries(args).filter(([, value]) => value !== void 0));
|
|
129
129
|
}
|
|
130
|
+
/** What the derived water item reads from the `pet-fountain` slice, and the clock it is stamped with. */
|
|
131
|
+
var TANK_READING = require_dist.PetFountainStatusSchema.pick({
|
|
132
|
+
waterLevel: true,
|
|
133
|
+
empty: true,
|
|
134
|
+
lastFetchedAt: true
|
|
135
|
+
});
|
|
130
136
|
var COMPOSED_DEVICE_CONFIG_SCHEMA = zod.z.object({});
|
|
131
137
|
/** What a command carries: the caller's input without `deviceId` (the composed device is the dispatch key). */
|
|
132
138
|
function commandInput(input) {
|
|
@@ -154,11 +160,16 @@ function sliceBoolean(slice, field) {
|
|
|
154
160
|
var ComposedDevice = class extends require_dist.BaseDevice {
|
|
155
161
|
sharedFeatures = [];
|
|
156
162
|
extraCaps = /* @__PURE__ */ new Set();
|
|
163
|
+
/** Whether this device's tank is also a `water` consumable (derived, never bound). */
|
|
164
|
+
derivesWater;
|
|
165
|
+
/** The `consumables` items the composition last wrote — the derived water item is added to these. */
|
|
166
|
+
composedItems = [];
|
|
157
167
|
get features() {
|
|
158
168
|
return this.sharedFeatures;
|
|
159
169
|
}
|
|
160
170
|
constructor(ctx, type, caps) {
|
|
161
171
|
super(ctx, COMPOSED_DEVICE_CONFIG_SCHEMA, { type });
|
|
172
|
+
this.derivesWater = type === require_dist.DeviceType.PetFountain;
|
|
162
173
|
for (const cap of caps) {
|
|
163
174
|
if (cap.name === require_dist.motionCapability.name) {
|
|
164
175
|
const read = () => this.runtimeState.getCapState(require_dist.motionCapability.name);
|
|
@@ -174,6 +185,7 @@ var ComposedDevice = class extends require_dist.BaseDevice {
|
|
|
174
185
|
ctx.registerNativeCap(cap, this.commandProvider(cap));
|
|
175
186
|
}
|
|
176
187
|
if (GROUP_COMMAND_TYPES.has(type)) ctx.registerNativeCap(require_dist.groupCommandsCapability, {});
|
|
188
|
+
if (this.derivesWater && !caps.some((cap) => cap.name === require_dist.consumablesCapability.name)) ctx.registerNativeCap(require_dist.consumablesCapability, { reset: (input) => this.dispatch("consumables", "reset", commandInput(input)) });
|
|
177
189
|
this.markOnline(false);
|
|
178
190
|
}
|
|
179
191
|
/**
|
|
@@ -340,19 +352,20 @@ var ComposedDevice = class extends require_dist.BaseDevice {
|
|
|
340
352
|
});
|
|
341
353
|
}
|
|
342
354
|
seed(capName, slice) {
|
|
343
|
-
|
|
344
|
-
this.runtimeState.setCapState(capName, { ...slice });
|
|
345
|
-
return { ok: true };
|
|
346
|
-
} catch (err) {
|
|
347
|
-
return {
|
|
348
|
-
ok: false,
|
|
349
|
-
error: require_dist.errMsg(err)
|
|
350
|
-
};
|
|
351
|
-
}
|
|
355
|
+
return this.writeSlice("seed", capName, slice);
|
|
352
356
|
}
|
|
353
357
|
patch(capName, patch) {
|
|
358
|
+
return this.writeSlice("patch", capName, patch);
|
|
359
|
+
}
|
|
360
|
+
writeSlice(op, capName, slice) {
|
|
361
|
+
const own = this.writeCap(op, capName, this.derivesWater ? this.withWater(capName, slice) : slice);
|
|
362
|
+
if (!own.ok || !this.derivesWater || capName !== require_dist.petFountainCapability.name) return own;
|
|
363
|
+
return this.refreshWater();
|
|
364
|
+
}
|
|
365
|
+
writeCap(op, capName, slice) {
|
|
354
366
|
try {
|
|
355
|
-
this.runtimeState.
|
|
367
|
+
if (op === "seed") this.runtimeState.setCapState(capName, { ...slice });
|
|
368
|
+
else this.runtimeState.patchCapState(capName, { ...slice });
|
|
356
369
|
return { ok: true };
|
|
357
370
|
} catch (err) {
|
|
358
371
|
return {
|
|
@@ -361,6 +374,42 @@ var ComposedDevice = class extends require_dist.BaseDevice {
|
|
|
361
374
|
};
|
|
362
375
|
}
|
|
363
376
|
}
|
|
377
|
+
/**
|
|
378
|
+
* The ONE place a fountain's tank becomes a consumable: the composition's own
|
|
379
|
+
* `consumables` items plus a `water` item derived from the `pet-fountain` slice
|
|
380
|
+
* (`petFountainWaterItem`). A composition that names its own `water` item keeps it.
|
|
381
|
+
*/
|
|
382
|
+
withWater(capName, slice) {
|
|
383
|
+
if (capName !== require_dist.consumablesCapability.name) return slice;
|
|
384
|
+
const parsed = require_dist.ConsumableItemSchema.array().safeParse(slice["items"]);
|
|
385
|
+
if (parsed.success) this.composedItems = parsed.data;
|
|
386
|
+
return {
|
|
387
|
+
...slice,
|
|
388
|
+
items: this.itemsWithWater()
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
fountainTank() {
|
|
392
|
+
const tank = TANK_READING.safeParse(this.runtimeState.getCapState(require_dist.petFountainCapability.name));
|
|
393
|
+
return tank.success ? tank.data : null;
|
|
394
|
+
}
|
|
395
|
+
itemsWithWater() {
|
|
396
|
+
const tank = this.fountainTank();
|
|
397
|
+
if (tank === null || this.composedItems.some((item) => item.key === "water")) return this.composedItems;
|
|
398
|
+
return [...this.composedItems, require_dist.petFountainWaterItem(tank)];
|
|
399
|
+
}
|
|
400
|
+
/** The fountain slice moved: re-publish the consumables with the new water item. */
|
|
401
|
+
refreshWater() {
|
|
402
|
+
const tank = this.fountainTank();
|
|
403
|
+
if (tank === null) return { ok: true };
|
|
404
|
+
const known = this.runtimeState.getCapState(require_dist.consumablesCapability.name);
|
|
405
|
+
const items = this.itemsWithWater();
|
|
406
|
+
if (known !== void 0 && JSON.stringify(known["items"]) === JSON.stringify(items)) return { ok: true };
|
|
407
|
+
return this.writeCap(known === void 0 ? "seed" : "patch", require_dist.consumablesCapability.name, {
|
|
408
|
+
items,
|
|
409
|
+
lastChangedAt: tank.lastFetchedAt,
|
|
410
|
+
lastFetchedAt: tank.lastFetchedAt
|
|
411
|
+
});
|
|
412
|
+
}
|
|
364
413
|
setAvailable(available) {
|
|
365
414
|
this.markOnline(available);
|
|
366
415
|
}
|