@fastybird/smart-panel-backend 1.1.0-alpha.1 → 1.1.0-alpha.10
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/app.module.js +7 -0
- package/dist/app.module.js.map +1 -1
- package/dist/common/filters/conflict-exception.filter.d.ts +6 -0
- package/dist/common/filters/conflict-exception.filter.js +59 -0
- package/dist/common/filters/conflict-exception.filter.js.map +1 -0
- package/dist/common/filters/global-error.filter.js +1 -4
- package/dist/common/filters/global-error.filter.js.map +1 -1
- package/dist/common/filters/global-filters.d.ts +3 -0
- package/dist/common/filters/global-filters.js +22 -0
- package/dist/common/filters/global-filters.js.map +1 -0
- package/dist/common/filters/unprocessable-entity-exception.filter.d.ts +1 -0
- package/dist/common/filters/unprocessable-entity-exception.filter.js +15 -3
- package/dist/common/filters/unprocessable-entity-exception.filter.js.map +1 -1
- package/dist/common/utils/transform.utils.js +3 -0
- package/dist/common/utils/transform.utils.js.map +1 -1
- package/dist/main.js +2 -7
- package/dist/main.js.map +1 -1
- package/dist/modules/devices/controllers/channels.properties.controller.js +16 -4
- package/dist/modules/devices/controllers/channels.properties.controller.js.map +1 -1
- package/dist/modules/devices/controllers/devices.channels.properties.controller.js +16 -4
- package/dist/modules/devices/controllers/devices.channels.properties.controller.js.map +1 -1
- package/dist/modules/devices/devices.module.js +12 -0
- package/dist/modules/devices/devices.module.js.map +1 -1
- package/dist/modules/devices/services/channels.properties.service.d.ts +27 -3
- package/dist/modules/devices/services/channels.properties.service.js +304 -28
- package/dist/modules/devices/services/channels.properties.service.js.map +1 -1
- package/dist/modules/devices/services/channels.service.js +42 -38
- package/dist/modules/devices/services/channels.service.js.map +1 -1
- package/dist/modules/devices/services/command-latency-trace-collector.service.d.ts +101 -0
- package/dist/modules/devices/services/command-latency-trace-collector.service.js +451 -0
- package/dist/modules/devices/services/command-latency-trace-collector.service.js.map +1 -0
- package/dist/modules/devices/services/device-structure-lock.service.d.ts +10 -2
- package/dist/modules/devices/services/device-structure-lock.service.js +86 -7
- package/dist/modules/devices/services/device-structure-lock.service.js.map +1 -1
- package/dist/modules/devices/services/devices.service.js +37 -33
- package/dist/modules/devices/services/devices.service.js.map +1 -1
- package/dist/modules/devices/services/module-reset.service.d.ts +3 -1
- package/dist/modules/devices/services/module-reset.service.js +21 -16
- package/dist/modules/devices/services/module-reset.service.js.map +1 -1
- package/dist/modules/devices/services/property-command-dispatch.service.d.ts +45 -0
- package/dist/modules/devices/services/property-command-dispatch.service.js +227 -0
- package/dist/modules/devices/services/property-command-dispatch.service.js.map +1 -0
- package/dist/modules/devices/services/property-command-window.service.d.ts +71 -0
- package/dist/modules/devices/services/property-command-window.service.js +204 -0
- package/dist/modules/devices/services/property-command-window.service.js.map +1 -0
- package/dist/modules/devices/services/property-command.service.d.ts +20 -3
- package/dist/modules/devices/services/property-command.service.js +56 -10
- package/dist/modules/devices/services/property-command.service.js.map +1 -1
- package/dist/modules/devices/services/property-state-coordinator.service.d.ts +4 -0
- package/dist/modules/devices/services/property-state-coordinator.service.js +35 -0
- package/dist/modules/devices/services/property-state-coordinator.service.js.map +1 -0
- package/dist/modules/devices/services/property-value.service.d.ts +1 -0
- package/dist/modules/devices/services/property-value.service.js +4 -0
- package/dist/modules/devices/services/property-value.service.js.map +1 -1
- package/dist/modules/platform/services/platform.service.d.ts +13 -4
- package/dist/modules/platform/services/platform.service.js +57 -35
- package/dist/modules/platform/services/platform.service.js.map +1 -1
- package/dist/modules/remote-access/dto/update-config.dto.js +5 -0
- package/dist/modules/remote-access/dto/update-config.dto.js.map +1 -1
- package/dist/modules/remote-access/validators/is-remote-access-url.validator.js +5 -2
- package/dist/modules/remote-access/validators/is-remote-access-url.validator.js.map +1 -1
- package/dist/modules/system/services/privileged-worker.service.d.ts +10 -0
- package/dist/modules/system/services/privileged-worker.service.js +137 -11
- package/dist/modules/system/services/privileged-worker.service.js.map +1 -1
- package/dist/modules/websocket/gateway/websocket.gateway.d.ts +4 -1
- package/dist/modules/websocket/gateway/websocket.gateway.js +28 -5
- package/dist/modules/websocket/gateway/websocket.gateway.js.map +1 -1
- package/dist/modules/websocket/services/command-acknowledgement-trace.service.d.ts +143 -0
- package/dist/modules/websocket/services/command-acknowledgement-trace.service.js +523 -0
- package/dist/modules/websocket/services/command-acknowledgement-trace.service.js.map +1 -0
- package/dist/modules/websocket/websocket.module.js +9 -1
- package/dist/modules/websocket/websocket.module.js.map +1 -1
- package/dist/plugins/devices-home-assistant/services/home-assistant.ws.service.js +2 -1
- package/dist/plugins/devices-home-assistant/services/home-assistant.ws.service.js.map +1 -1
- package/dist/plugins/devices-home-assistant/services/state-changed.event.service.js +2 -3
- package/dist/plugins/devices-home-assistant/services/state-changed.event.service.js.map +1 -1
- package/dist/plugins/devices-homekit/listeners/homekit-event.listener.js +6 -1
- package/dist/plugins/devices-homekit/listeners/homekit-event.listener.js.map +1 -1
- package/dist/plugins/devices-homekit/mappers/base.mapper.js +27 -4
- package/dist/plugins/devices-homekit/mappers/base.mapper.js.map +1 -1
- package/dist/plugins/devices-homekit/mappers/homekit-mapper.interface.d.ts +8 -0
- package/dist/plugins/devices-homekit/mappers/thermostat-coordinator.d.ts +7 -0
- package/dist/plugins/devices-homekit/mappers/thermostat-coordinator.js +84 -73
- package/dist/plugins/devices-homekit/mappers/thermostat-coordinator.js.map +1 -1
- package/dist/plugins/devices-shelly-ng/delegates/delegates-manager.service.d.ts +18 -1
- package/dist/plugins/devices-shelly-ng/delegates/delegates-manager.service.js +338 -119
- package/dist/plugins/devices-shelly-ng/delegates/delegates-manager.service.js.map +1 -1
- package/dist/plugins/devices-shelly-ng/delegates/shelly-device.delegate.d.ts +13 -1
- package/dist/plugins/devices-shelly-ng/delegates/shelly-device.delegate.js +109 -10
- package/dist/plugins/devices-shelly-ng/delegates/shelly-device.delegate.js.map +1 -1
- package/dist/plugins/devices-shelly-ng/devices-shelly-ng.constants.js +8 -11
- package/dist/plugins/devices-shelly-ng/devices-shelly-ng.constants.js.map +1 -1
- package/dist/plugins/devices-shelly-ng/mappings/mapping-loader.service.js +4 -0
- package/dist/plugins/devices-shelly-ng/mappings/mapping-loader.service.js.map +1 -1
- package/dist/plugins/devices-shelly-ng/services/device-manager.service.js +5 -0
- package/dist/plugins/devices-shelly-ng/services/device-manager.service.js.map +1 -1
- package/dist/plugins/devices-shelly-ng/services/shelly-ng.service.d.ts +9 -1
- package/dist/plugins/devices-shelly-ng/services/shelly-ng.service.js +59 -24
- package/dist/plugins/devices-shelly-ng/services/shelly-ng.service.js.map +1 -1
- package/dist/plugins/devices-shelly-ng/services/shelly-ws-server.service.d.ts +0 -1
- package/dist/plugins/devices-shelly-ng/services/shelly-ws-server.service.js +5 -12
- package/dist/plugins/devices-shelly-ng/services/shelly-ws-server.service.js.map +1 -1
- package/dist/plugins/devices-shelly-ng/utils/transform.utils.d.ts +2 -0
- package/dist/plugins/devices-shelly-ng/utils/transform.utils.js +14 -1
- package/dist/plugins/devices-shelly-ng/utils/transform.utils.js.map +1 -1
- package/dist/plugins/remote-access-cloudflare-tunnel/controllers/setup.controller.d.ts +17 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/controllers/setup.controller.js +147 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/controllers/setup.controller.js.map +1 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/controllers/status.controller.d.ts +15 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/controllers/status.controller.js +98 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/controllers/status.controller.js.map +1 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/dto/update-config.dto.d.ts +9 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/dto/update-config.dto.js +94 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/dto/update-config.dto.js.map +1 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/models/config.model.d.ts +9 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/models/config.model.js +92 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/models/config.model.js.map +1 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/models/install.model.d.ts +7 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/models/install.model.js +48 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/models/install.model.js.map +1 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/models/status.model.d.ts +42 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/models/status.model.js +352 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/models/status.model.js.map +1 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/remote-access-cloudflare-tunnel.constants.d.ts +24 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/remote-access-cloudflare-tunnel.constants.js +27 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/remote-access-cloudflare-tunnel.constants.js.map +1 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/remote-access-cloudflare-tunnel.exceptions.d.ts +8 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/remote-access-cloudflare-tunnel.exceptions.js +19 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/remote-access-cloudflare-tunnel.exceptions.js.map +1 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/remote-access-cloudflare-tunnel.openapi.d.ts +4 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/remote-access-cloudflare-tunnel.openapi.js +20 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/remote-access-cloudflare-tunnel.openapi.js.map +1 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/remote-access-cloudflare-tunnel.plugin.d.ts +21 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/remote-access-cloudflare-tunnel.plugin.js +135 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/remote-access-cloudflare-tunnel.plugin.js.map +1 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/scripts/cloudflared-setup.sh +185 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflare-tunnel-managed.service.d.ts +82 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflare-tunnel-managed.service.js +507 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflare-tunnel-managed.service.js.map +1 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflare-tunnel-provider.service.d.ts +10 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflare-tunnel-provider.service.js +37 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflare-tunnel-provider.service.js.map +1 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflare-tunnel-setup.service.d.ts +38 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflare-tunnel-setup.service.js +147 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflare-tunnel-setup.service.js.map +1 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflared-cli.service.d.ts +15 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflared-cli.service.js +67 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflared-cli.service.js.map +1 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflared-metrics.service.d.ts +8 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflared-metrics.service.js +46 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflared-metrics.service.js.map +1 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflared-process.service.d.ts +27 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflared-process.service.js +139 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflared-process.service.js.map +1 -0
- package/dist/plugins/remote-access-tailscale/controllers/setup.controller.d.ts +1 -0
- package/dist/plugins/remote-access-tailscale/controllers/setup.controller.js +26 -10
- package/dist/plugins/remote-access-tailscale/controllers/setup.controller.js.map +1 -1
- package/dist/plugins/remote-access-tailscale/controllers/status.controller.d.ts +6 -1
- package/dist/plugins/remote-access-tailscale/controllers/status.controller.js +28 -3
- package/dist/plugins/remote-access-tailscale/controllers/status.controller.js.map +1 -1
- package/dist/plugins/remote-access-tailscale/models/status.model.d.ts +19 -0
- package/dist/plugins/remote-access-tailscale/models/status.model.js +158 -1
- package/dist/plugins/remote-access-tailscale/models/status.model.js.map +1 -1
- package/dist/plugins/remote-access-tailscale/remote-access-tailscale.constants.d.ts +2 -0
- package/dist/plugins/remote-access-tailscale/remote-access-tailscale.constants.js +3 -1
- package/dist/plugins/remote-access-tailscale/remote-access-tailscale.constants.js.map +1 -1
- package/dist/plugins/remote-access-tailscale/remote-access-tailscale.exceptions.d.ts +13 -0
- package/dist/plugins/remote-access-tailscale/remote-access-tailscale.exceptions.js +27 -0
- package/dist/plugins/remote-access-tailscale/remote-access-tailscale.exceptions.js.map +1 -0
- package/dist/plugins/remote-access-tailscale/remote-access-tailscale.openapi.d.ts +2 -2
- package/dist/plugins/remote-access-tailscale/remote-access-tailscale.openapi.js +2 -0
- package/dist/plugins/remote-access-tailscale/remote-access-tailscale.openapi.js.map +1 -1
- package/dist/plugins/remote-access-tailscale/remote-access-tailscale.plugin.js +1 -1
- package/dist/plugins/remote-access-tailscale/scripts/tailscale-setup.sh +61 -0
- package/dist/plugins/remote-access-tailscale/services/tailscale-cli.service.d.ts +9 -0
- package/dist/plugins/remote-access-tailscale/services/tailscale-cli.service.js +12 -0
- package/dist/plugins/remote-access-tailscale/services/tailscale-cli.service.js.map +1 -1
- package/dist/plugins/remote-access-tailscale/services/tailscale-login.service.d.ts +1 -0
- package/dist/plugins/remote-access-tailscale/services/tailscale-login.service.js +27 -2
- package/dist/plugins/remote-access-tailscale/services/tailscale-login.service.js.map +1 -1
- package/dist/plugins/remote-access-tailscale/services/tailscale-node-managed.service.d.ts +30 -1
- package/dist/plugins/remote-access-tailscale/services/tailscale-node-managed.service.js +300 -30
- package/dist/plugins/remote-access-tailscale/services/tailscale-node-managed.service.js.map +1 -1
- package/dist/plugins/remote-access-tailscale/services/tailscale-serve.service.d.ts +8 -3
- package/dist/plugins/remote-access-tailscale/services/tailscale-serve.service.js +39 -12
- package/dist/plugins/remote-access-tailscale/services/tailscale-serve.service.js.map +1 -1
- package/dist/plugins/remote-access-tailscale/services/tailscale-setup.service.d.ts +14 -5
- package/dist/plugins/remote-access-tailscale/services/tailscale-setup.service.js +51 -16
- package/dist/plugins/remote-access-tailscale/services/tailscale-setup.service.js.map +1 -1
- package/dist/plugins/scenes-local/platforms/local-scene.platform.d.ts +3 -1
- package/dist/plugins/scenes-local/platforms/local-scene.platform.js +12 -7
- package/dist/plugins/scenes-local/platforms/local-scene.platform.js.map +1 -1
- package/dist/plugins/spaces-home-control/services/climate-intent.service.d.ts +3 -1
- package/dist/plugins/spaces-home-control/services/climate-intent.service.js +6 -3
- package/dist/plugins/spaces-home-control/services/climate-intent.service.js.map +1 -1
- package/dist/plugins/spaces-home-control/services/covers-intent.service.d.ts +3 -1
- package/dist/plugins/spaces-home-control/services/covers-intent.service.js +6 -3
- package/dist/plugins/spaces-home-control/services/covers-intent.service.js.map +1 -1
- package/dist/plugins/spaces-home-control/services/lighting-intent.service.d.ts +3 -1
- package/dist/plugins/spaces-home-control/services/lighting-intent.service.js +7 -4
- package/dist/plugins/spaces-home-control/services/lighting-intent.service.js.map +1 -1
- package/dist/plugins/spaces-home-control/services/space-media-activity.service.d.ts +3 -1
- package/dist/plugins/spaces-home-control/services/space-media-activity.service.js +11 -5
- package/dist/plugins/spaces-home-control/services/space-media-activity.service.js.map +1 -1
- package/dist/plugins/spaces-home-control/services/space-undo-history.service.d.ts +3 -1
- package/dist/plugins/spaces-home-control/services/space-undo-history.service.js +8 -5
- package/dist/plugins/spaces-home-control/services/space-undo-history.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -19,15 +19,30 @@ let TailscaleServeService = class TailscaleServeService {
|
|
|
19
19
|
this.cli = cli;
|
|
20
20
|
this.logger = (0, logger_1.createExtensionLogger)(remote_access_tailscale_constants_1.REMOTE_ACCESS_TAILSCALE_PLUGIN_NAME, 'TailscaleServeService');
|
|
21
21
|
}
|
|
22
|
-
async
|
|
23
|
-
const
|
|
24
|
-
const hasHttpsCap = Object.hasOwn(capMap, 'https');
|
|
25
|
-
const hasFunnelCap = Object.hasOwn(capMap, 'funnel');
|
|
26
|
-
const dnsName = this.stripTrailingDot(status.Self?.DNSName);
|
|
27
|
-
const desired = this.desiredState(config, hasHttpsCap, hasFunnelCap);
|
|
22
|
+
async read(config, port, status) {
|
|
23
|
+
const { hasHttpsCap, hasFunnelCap, dnsName } = this.readCaps(status);
|
|
28
24
|
const { serveActive, funnelActive } = dnsName
|
|
29
|
-
? await this.
|
|
25
|
+
? await this.readHandlerState(`${dnsName}:443`, `http://127.0.0.1:${port}`)
|
|
30
26
|
: { serveActive: false, funnelActive: false };
|
|
27
|
+
return this.buildResult(config, hasHttpsCap, hasFunnelCap, dnsName, serveActive, funnelActive, false);
|
|
28
|
+
}
|
|
29
|
+
async converge(config, port, status) {
|
|
30
|
+
const { hasHttpsCap, hasFunnelCap, dnsName } = this.readCaps(status);
|
|
31
|
+
const desired = this.desiredState(config, hasHttpsCap, hasFunnelCap);
|
|
32
|
+
const { serveActive, funnelActive, permissionDenied } = dnsName
|
|
33
|
+
? await this.convergeHandler(desired, port, `${dnsName}:443`, `http://127.0.0.1:${port}`)
|
|
34
|
+
: { serveActive: false, funnelActive: false, permissionDenied: false };
|
|
35
|
+
return this.buildResult(config, hasHttpsCap, hasFunnelCap, dnsName, serveActive, funnelActive, permissionDenied);
|
|
36
|
+
}
|
|
37
|
+
readCaps(status) {
|
|
38
|
+
const capMap = status.Self?.CapMap ?? {};
|
|
39
|
+
return {
|
|
40
|
+
hasHttpsCap: Object.hasOwn(capMap, 'https'),
|
|
41
|
+
hasFunnelCap: Object.hasOwn(capMap, 'funnel'),
|
|
42
|
+
dnsName: this.stripTrailingDot(status.Self?.DNSName),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
buildResult(config, hasHttpsCap, hasFunnelCap, dnsName, serveActive, funnelActive, permissionDenied) {
|
|
31
46
|
const endpoints = [];
|
|
32
47
|
const proxyAddresses = [];
|
|
33
48
|
if (serveActive && dnsName) {
|
|
@@ -61,7 +76,7 @@ let TailscaleServeService = class TailscaleServeService {
|
|
|
61
76
|
message: 'This node is publicly reachable through Tailscale Funnel. The Smart Panel login is the only gate — multi-factor authentication is not available.',
|
|
62
77
|
});
|
|
63
78
|
}
|
|
64
|
-
return { endpoints, proxyAddresses, advisories };
|
|
79
|
+
return { endpoints, proxyAddresses, advisories, permissionDenied };
|
|
65
80
|
}
|
|
66
81
|
desiredState(config, hasHttpsCap, hasFunnelCap) {
|
|
67
82
|
if (!config.serveHttps || !hasHttpsCap) {
|
|
@@ -75,9 +90,17 @@ let TailscaleServeService = class TailscaleServeService {
|
|
|
75
90
|
}
|
|
76
91
|
return funnelActive ? 'public' : 'private';
|
|
77
92
|
}
|
|
78
|
-
async
|
|
93
|
+
async readHandlerState(hostPort, targetUrl) {
|
|
94
|
+
const serveStatus = await this.readServeStatus();
|
|
95
|
+
return {
|
|
96
|
+
serveActive: this.isServeActive(serveStatus, hostPort, targetUrl),
|
|
97
|
+
funnelActive: this.isFunnelActive(serveStatus, hostPort),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
async convergeHandler(desired, port, hostPort, targetUrl) {
|
|
79
101
|
let serveStatus = await this.readServeStatus();
|
|
80
102
|
let current = this.currentState(this.isServeActive(serveStatus, hostPort, targetUrl), this.isFunnelActive(serveStatus, hostPort));
|
|
103
|
+
let permissionDenied = false;
|
|
81
104
|
if (current !== desired) {
|
|
82
105
|
try {
|
|
83
106
|
if (desired === 'off') {
|
|
@@ -93,14 +116,18 @@ let TailscaleServeService = class TailscaleServeService {
|
|
|
93
116
|
current = this.currentState(this.isServeActive(serveStatus, hostPort, targetUrl), this.isFunnelActive(serveStatus, hostPort));
|
|
94
117
|
}
|
|
95
118
|
catch (error) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
119
|
+
permissionDenied = error instanceof tailscale_cli_service_1.TailscaleCliError && error.kind === 'permission-denied';
|
|
120
|
+
if (!permissionDenied) {
|
|
121
|
+
this.logger.warn(`Failed to apply the Tailscale Serve/Funnel handler (wanted "${desired}")`, {
|
|
122
|
+
message: error instanceof Error ? error.message : String(error),
|
|
123
|
+
});
|
|
124
|
+
}
|
|
99
125
|
}
|
|
100
126
|
}
|
|
101
127
|
return {
|
|
102
128
|
serveActive: current !== 'off',
|
|
103
129
|
funnelActive: current === 'public',
|
|
130
|
+
permissionDenied,
|
|
104
131
|
};
|
|
105
132
|
}
|
|
106
133
|
async readServeStatus() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tailscale-serve.service.js","sourceRoot":"","sources":["../../../../src/plugins/remote-access-tailscale/services/tailscale-serve.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAE5C,mDAA+D;AAM/D,4FAA2F;AAE3F,
|
|
1
|
+
{"version":3,"file":"tailscale-serve.service.js","sourceRoot":"","sources":["../../../../src/plugins/remote-access-tailscale/services/tailscale-serve.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAE5C,mDAA+D;AAM/D,4FAA2F;AAE3F,mEAAwH;AA6DjH,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAGjC,YAA6B,GAAwB;QAAxB,QAAG,GAAH,GAAG,CAAqB;QAFpC,WAAM,GAAG,IAAA,8BAAqB,EAAC,uEAAmC,EAAE,uBAAuB,CAAC,CAAC;IAEtD,CAAC;IAOzD,KAAK,CAAC,IAAI,CACT,MAA8C,EAC9C,IAAY,EACZ,MAAuB;QAEvB,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAMrE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,OAAO;YAC5C,CAAC,CAAC,MA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
import { ConfigService as NestConfigService } from '@nestjs/config';
|
|
2
2
|
import { EventEmitter2 } from '@nestjs/event-emitter';
|
|
3
|
+
import { ConfigService } from '../../../modules/config/services/config.service';
|
|
4
|
+
import { ManagedServiceManagerService } from '../../../modules/extensions/services/managed-service-manager.service';
|
|
3
5
|
import { PlatformService } from '../../../modules/platform/services/platform.service';
|
|
4
6
|
import { PrivilegedJobStatus, PrivilegedWorkerService } from '../../../modules/system/services/privileged-worker.service';
|
|
7
|
+
import { TailscaleSetupUnavailableException } from '../remote-access-tailscale.exceptions';
|
|
5
8
|
import { TailscaleNodeManagedService } from './tailscale-node-managed.service';
|
|
9
|
+
export { TailscaleSetupUnavailableException };
|
|
6
10
|
export interface TailscaleSetupProgressEvent {
|
|
7
11
|
type: string;
|
|
8
12
|
job: string;
|
|
@@ -10,21 +14,26 @@ export interface TailscaleSetupProgressEvent {
|
|
|
10
14
|
state: PrivilegedJobStatus['state'];
|
|
11
15
|
message?: string;
|
|
12
16
|
}
|
|
13
|
-
export declare class TailscaleSetupUnavailableException extends Error {
|
|
14
|
-
constructor(message: string);
|
|
15
|
-
}
|
|
16
17
|
export declare class TailscaleSetupService {
|
|
17
18
|
private readonly privilegedWorker;
|
|
18
19
|
private readonly nestConfigService;
|
|
19
20
|
private readonly nodeManagedService;
|
|
20
21
|
private readonly eventEmitter;
|
|
21
22
|
private readonly platformService;
|
|
23
|
+
private readonly configService;
|
|
24
|
+
private readonly managedServiceManager;
|
|
22
25
|
private readonly logger;
|
|
23
|
-
|
|
26
|
+
private lastJob;
|
|
27
|
+
constructor(privilegedWorker: PrivilegedWorkerService, nestConfigService: NestConfigService, nodeManagedService: TailscaleNodeManagedService, eventEmitter: EventEmitter2, platformService: PlatformService, configService: ConfigService, managedServiceManager: ManagedServiceManagerService);
|
|
24
28
|
install(): Promise<{
|
|
25
29
|
id: string;
|
|
26
30
|
}>;
|
|
31
|
+
getLastJob(): {
|
|
32
|
+
id: string;
|
|
33
|
+
status: PrivilegedJobStatus;
|
|
34
|
+
} | null;
|
|
27
35
|
private watchJob;
|
|
28
|
-
private
|
|
36
|
+
private onSetupComplete;
|
|
37
|
+
private refreshNodeRequirements;
|
|
29
38
|
private ensureDir;
|
|
30
39
|
}
|
|
@@ -21,35 +21,39 @@ const config_1 = require("@nestjs/config");
|
|
|
21
21
|
const event_emitter_1 = require("@nestjs/event-emitter");
|
|
22
22
|
const logger_1 = require("../../../common/logger");
|
|
23
23
|
const config_utils_1 = require("../../../common/utils/config.utils");
|
|
24
|
+
const config_service_1 = require("../../../modules/config/services/config.service");
|
|
25
|
+
const managed_service_manager_service_1 = require("../../../modules/extensions/services/managed-service-manager.service");
|
|
24
26
|
const platform_service_1 = require("../../../modules/platform/services/platform.service");
|
|
25
27
|
const remote_access_constants_1 = require("../../../modules/remote-access/remote-access.constants");
|
|
26
28
|
const privileged_worker_service_1 = require("../../../modules/system/services/privileged-worker.service");
|
|
27
29
|
const remote_access_tailscale_constants_1 = require("../remote-access-tailscale.constants");
|
|
30
|
+
const remote_access_tailscale_exceptions_1 = require("../remote-access-tailscale.exceptions");
|
|
31
|
+
Object.defineProperty(exports, "TailscaleSetupUnavailableException", { enumerable: true, get: function () { return remote_access_tailscale_exceptions_1.TailscaleSetupUnavailableException; } });
|
|
28
32
|
const tailscale_node_managed_service_1 = require("./tailscale-node-managed.service");
|
|
29
|
-
class TailscaleSetupUnavailableException extends Error {
|
|
30
|
-
constructor(message) {
|
|
31
|
-
super(message);
|
|
32
|
-
this.name = 'TailscaleSetupUnavailableException';
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
exports.TailscaleSetupUnavailableException = TailscaleSetupUnavailableException;
|
|
36
33
|
let TailscaleSetupService = class TailscaleSetupService {
|
|
37
|
-
constructor(privilegedWorker, nestConfigService, nodeManagedService, eventEmitter, platformService) {
|
|
34
|
+
constructor(privilegedWorker, nestConfigService, nodeManagedService, eventEmitter, platformService, configService, managedServiceManager) {
|
|
38
35
|
this.privilegedWorker = privilegedWorker;
|
|
39
36
|
this.nestConfigService = nestConfigService;
|
|
40
37
|
this.nodeManagedService = nodeManagedService;
|
|
41
38
|
this.eventEmitter = eventEmitter;
|
|
42
39
|
this.platformService = platformService;
|
|
40
|
+
this.configService = configService;
|
|
41
|
+
this.managedServiceManager = managedServiceManager;
|
|
43
42
|
this.logger = (0, logger_1.createExtensionLogger)(remote_access_tailscale_constants_1.REMOTE_ACCESS_TAILSCALE_PLUGIN_NAME, 'TailscaleSetupService');
|
|
43
|
+
this.lastJob = null;
|
|
44
44
|
}
|
|
45
45
|
async install() {
|
|
46
46
|
const allowDev = (0, config_utils_1.getEnvValue)(this.nestConfigService, remote_access_tailscale_constants_1.REMOTE_ACCESS_TAILSCALE_ALLOW_DEV_ENV, false);
|
|
47
47
|
if (allowDev) {
|
|
48
|
-
throw new TailscaleSetupUnavailableException(`Tailscale setup is unavailable while ${remote_access_tailscale_constants_1.REMOTE_ACCESS_TAILSCALE_ALLOW_DEV_ENV} is set. Prepare tailscale manually on the development platform: install it, run tailscaled, and grant the current user as operator
|
|
48
|
+
throw new remote_access_tailscale_exceptions_1.TailscaleSetupUnavailableException(`Tailscale setup is unavailable while ${remote_access_tailscale_constants_1.REMOTE_ACCESS_TAILSCALE_ALLOW_DEV_ENV} is set. Prepare tailscale manually on the development platform: install it, run tailscaled, and grant the current user as operator.`, 'platform-unsupported');
|
|
49
49
|
}
|
|
50
|
-
const
|
|
51
|
-
if (!
|
|
52
|
-
|
|
50
|
+
const privilegedWorkerSupport = await this.platformService.getPrivilegedWorkerSupport();
|
|
51
|
+
if (!privilegedWorkerSupport.supported) {
|
|
52
|
+
if (!this.platformService.isPlatformCapableOfPrivilegedWorkers()) {
|
|
53
|
+
throw new remote_access_tailscale_exceptions_1.TailscaleSetupUnavailableException(`Tailscale setup requires a platform with privileged-worker support; the '${this.platformService.getPlatformType()}' platform does not have it.`, 'platform-unsupported');
|
|
54
|
+
}
|
|
55
|
+
const reason = privilegedWorkerSupport.reason ?? 'Privileged jobs are currently unavailable on this installation.';
|
|
56
|
+
throw new remote_access_tailscale_exceptions_1.TailscaleSetupUnavailableException(`${reason} Re-run \`sudo smart-panel-service install\`, or add the sudoers grant from the installation guide.`, 'privileged-worker-unavailable');
|
|
53
57
|
}
|
|
54
58
|
const dataDir = (0, config_utils_1.getEnvValue)(this.nestConfigService, 'FB_DATA_DIR', '/var/lib/smart-panel');
|
|
55
59
|
const remoteAccessDir = (0, path_1.join)(dataDir, remote_access_tailscale_constants_1.TAILSCALE_DATA_SUBDIR);
|
|
@@ -73,11 +77,21 @@ let TailscaleSetupService = class TailscaleSetupService {
|
|
|
73
77
|
statusFile,
|
|
74
78
|
});
|
|
75
79
|
this.logger.log(`Tailscale setup job spawned (job: ${id})`);
|
|
80
|
+
const initialStatus = this.privilegedWorker.getStatus(id) ?? {
|
|
81
|
+
id,
|
|
82
|
+
state: 'running',
|
|
83
|
+
updatedAt: new Date().toISOString(),
|
|
84
|
+
};
|
|
85
|
+
this.lastJob = { id, status: initialStatus };
|
|
76
86
|
this.watchJob(id);
|
|
77
87
|
return { id };
|
|
78
88
|
}
|
|
89
|
+
getLastJob() {
|
|
90
|
+
return this.lastJob;
|
|
91
|
+
}
|
|
79
92
|
watchJob(id) {
|
|
80
93
|
const unsubscribe = this.privilegedWorker.onStatus(id, (status) => {
|
|
94
|
+
this.lastJob = { id, status };
|
|
81
95
|
const event = {
|
|
82
96
|
type: remote_access_tailscale_constants_1.REMOTE_ACCESS_TAILSCALE_PLUGIN_NAME,
|
|
83
97
|
job: id,
|
|
@@ -91,7 +105,7 @@ let TailscaleSetupService = class TailscaleSetupService {
|
|
|
91
105
|
}
|
|
92
106
|
if (status.state === 'complete') {
|
|
93
107
|
this.logger.log(`Tailscale setup job completed (job: ${id})`);
|
|
94
|
-
void this.
|
|
108
|
+
void this.onSetupComplete();
|
|
95
109
|
}
|
|
96
110
|
else {
|
|
97
111
|
this.logger.error(`Tailscale setup job did not complete (job: ${id}, state: ${status.state})`, {
|
|
@@ -102,15 +116,34 @@ let TailscaleSetupService = class TailscaleSetupService {
|
|
|
102
116
|
unsubscribe();
|
|
103
117
|
});
|
|
104
118
|
}
|
|
105
|
-
async
|
|
119
|
+
async onSetupComplete() {
|
|
106
120
|
try {
|
|
107
|
-
await this.
|
|
121
|
+
await this.refreshNodeRequirements();
|
|
108
122
|
}
|
|
109
123
|
catch (error) {
|
|
110
124
|
this.logger.warn('Failed to refresh Tailscale requirements after setup', {
|
|
111
125
|
message: error instanceof Error ? error.message : String(error),
|
|
112
126
|
});
|
|
113
127
|
}
|
|
128
|
+
try {
|
|
129
|
+
const pluginConfig = this.configService.getPluginConfig(remote_access_tailscale_constants_1.REMOTE_ACCESS_TAILSCALE_PLUGIN_NAME);
|
|
130
|
+
if (pluginConfig.enabled) {
|
|
131
|
+
await this.managedServiceManager.restartService('plugin', remote_access_tailscale_constants_1.REMOTE_ACCESS_TAILSCALE_PLUGIN_NAME, 'node');
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
this.logger.warn('Failed to restart the Tailscale node service after setup', {
|
|
136
|
+
message: error instanceof Error ? error.message : String(error),
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
async refreshNodeRequirements() {
|
|
141
|
+
const nodeManagedService = this.nodeManagedService;
|
|
142
|
+
if (typeof nodeManagedService.refreshRequirements === 'function') {
|
|
143
|
+
await nodeManagedService.refreshRequirements('setup-complete');
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
await this.nodeManagedService.evaluateRequirements();
|
|
114
147
|
}
|
|
115
148
|
ensureDir(dir) {
|
|
116
149
|
if (!(0, fs_1.existsSync)(dir)) {
|
|
@@ -125,6 +158,8 @@ exports.TailscaleSetupService = TailscaleSetupService = __decorate([
|
|
|
125
158
|
config_1.ConfigService,
|
|
126
159
|
tailscale_node_managed_service_1.TailscaleNodeManagedService,
|
|
127
160
|
event_emitter_1.EventEmitter2,
|
|
128
|
-
platform_service_1.PlatformService
|
|
161
|
+
platform_service_1.PlatformService,
|
|
162
|
+
config_service_1.ConfigService,
|
|
163
|
+
managed_service_manager_service_1.ManagedServiceManagerService])
|
|
129
164
|
], TailscaleSetupService);
|
|
130
165
|
//# sourceMappingURL=tailscale-setup.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tailscale-setup.service.js","sourceRoot":"","sources":["../../../../src/plugins/remote-access-tailscale/services/tailscale-setup.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2BAA2C;AAC3C,4CAAoB;AACpB,+BAA4B;AAE5B,2CAA4C;AAC5C,2CAAoE;AACpE,yDAAsD;AAEtD,mDAA+D;AAC/D,qEAAiE;AACjE,0FAAsF;AACtF,oGAA4G;AAC5G,0GAGoE;
|
|
1
|
+
{"version":3,"file":"tailscale-setup.service.js","sourceRoot":"","sources":["../../../../src/plugins/remote-access-tailscale/services/tailscale-setup.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2BAA2C;AAC3C,4CAAoB;AACpB,+BAA4B;AAE5B,2CAA4C;AAC5C,2CAAoE;AACpE,yDAAsD;AAEtD,mDAA+D;AAC/D,qEAAiE;AACjE,oFAAgF;AAChF,0HAAoH;AACpH,0FAAsF;AACtF,oGAA4G;AAC5G,0GAGoE;AAEpE,4FAM8C;AAC9C,8FAA2F;AAOlF,mHAPA,uEAAkC,OAOA;AAL3C,qFAA+E;AAyBxE,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAQjC,YACkB,gBAAyC,EACzC,iBAAoC,EACpC,kBAA+C,EAC/C,YAA2B,EAC3B,eAAgC,EAChC,aAA4B,EAC5B,qBAAmD;QANnD,qBAAgB,GAAhB,gBAAgB,CAAyB;QACzC,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,uBAAkB,GAAlB,kBAAkB,CAA6B;QAC/C,iBAAY,GAAZ,YAAY,CAAe;QAC3B,oBAAe,GAAf,eAAe,CAAiB;QAChC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AfzD,qBAAqB,CA8MjC"}
|
|
@@ -3,6 +3,7 @@ import { ChannelsPropertiesService } from '../../../modules/devices/services/cha
|
|
|
3
3
|
import { ChannelsService } from '../../../modules/devices/services/channels.service';
|
|
4
4
|
import { DevicesService } from '../../../modules/devices/services/devices.service';
|
|
5
5
|
import { PlatformRegistryService } from '../../../modules/devices/services/platform.registry.service';
|
|
6
|
+
import { PropertyCommandDispatchService } from '../../../modules/devices/services/property-command-dispatch.service';
|
|
6
7
|
import { SceneActionEntity, SceneEntity } from '../../../modules/scenes/entities/scenes.entity';
|
|
7
8
|
import { ActionExecutionResultModel } from '../../../modules/scenes/models/scenes.model';
|
|
8
9
|
import { IScenePlatform } from '../../../modules/scenes/services/scene-executor.service';
|
|
@@ -19,9 +20,10 @@ export declare class LocalScenePlatform implements IScenePlatform {
|
|
|
19
20
|
private readonly channelsService;
|
|
20
21
|
private readonly channelsPropertiesService;
|
|
21
22
|
private readonly platformRegistryService;
|
|
23
|
+
private readonly propertyCommandDispatchService;
|
|
22
24
|
private readonly spacesService;
|
|
23
25
|
private readonly logger;
|
|
24
|
-
constructor(devicesService: DevicesService, channelsService: ChannelsService, channelsPropertiesService: ChannelsPropertiesService, platformRegistryService: PlatformRegistryService, spacesService: SpacesService);
|
|
26
|
+
constructor(devicesService: DevicesService, channelsService: ChannelsService, channelsPropertiesService: ChannelsPropertiesService, platformRegistryService: PlatformRegistryService, propertyCommandDispatchService: PropertyCommandDispatchService, spacesService: SpacesService);
|
|
25
27
|
getType(): string;
|
|
26
28
|
getCommandTtlMs(actions: readonly SceneActionEntity[]): Promise<number>;
|
|
27
29
|
validateSpace(spaceId: string): Promise<void>;
|
|
@@ -17,6 +17,7 @@ const channels_properties_service_1 = require("../../../modules/devices/services
|
|
|
17
17
|
const channels_service_1 = require("../../../modules/devices/services/channels.service");
|
|
18
18
|
const devices_service_1 = require("../../../modules/devices/services/devices.service");
|
|
19
19
|
const platform_registry_service_1 = require("../../../modules/devices/services/platform.registry.service");
|
|
20
|
+
const property_command_dispatch_service_1 = require("../../../modules/devices/services/property-command-dispatch.service");
|
|
20
21
|
const intents_constants_1 = require("../../../modules/intents/intents.constants");
|
|
21
22
|
const scenes_exceptions_1 = require("../../../modules/scenes/scenes.exceptions");
|
|
22
23
|
const spaces_service_1 = require("../../../modules/spaces/services/spaces.service");
|
|
@@ -26,11 +27,12 @@ function isLocalSceneAction(action) {
|
|
|
26
27
|
return action.type === scenes_local_constants_1.SCENES_LOCAL_TYPE && 'deviceId' in action && 'propertyId' in action && 'value' in action;
|
|
27
28
|
}
|
|
28
29
|
let LocalScenePlatform = class LocalScenePlatform {
|
|
29
|
-
constructor(devicesService, channelsService, channelsPropertiesService, platformRegistryService, spacesService) {
|
|
30
|
+
constructor(devicesService, channelsService, channelsPropertiesService, platformRegistryService, propertyCommandDispatchService, spacesService) {
|
|
30
31
|
this.devicesService = devicesService;
|
|
31
32
|
this.channelsService = channelsService;
|
|
32
33
|
this.channelsPropertiesService = channelsPropertiesService;
|
|
33
34
|
this.platformRegistryService = platformRegistryService;
|
|
35
|
+
this.propertyCommandDispatchService = propertyCommandDispatchService;
|
|
34
36
|
this.spacesService = spacesService;
|
|
35
37
|
this.logger = (0, logger_1.createExtensionLogger)(scenes_local_constants_1.SCENES_LOCAL_PLUGIN_NAME, 'LocalScenePlatform');
|
|
36
38
|
}
|
|
@@ -192,12 +194,14 @@ let LocalScenePlatform = class LocalScenePlatform {
|
|
|
192
194
|
});
|
|
193
195
|
continue;
|
|
194
196
|
}
|
|
195
|
-
const success = await
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
197
|
+
const { success } = await this.propertyCommandDispatchService.dispatchBatch([
|
|
198
|
+
{
|
|
199
|
+
device,
|
|
200
|
+
channel,
|
|
201
|
+
property,
|
|
202
|
+
value: action.value,
|
|
203
|
+
},
|
|
204
|
+
]);
|
|
201
205
|
results.push({
|
|
202
206
|
actionId: action.id,
|
|
203
207
|
success,
|
|
@@ -234,6 +238,7 @@ exports.LocalScenePlatform = LocalScenePlatform = __decorate([
|
|
|
234
238
|
channels_service_1.ChannelsService,
|
|
235
239
|
channels_properties_service_1.ChannelsPropertiesService,
|
|
236
240
|
platform_registry_service_1.PlatformRegistryService,
|
|
241
|
+
property_command_dispatch_service_1.PropertyCommandDispatchService,
|
|
237
242
|
spaces_service_1.SpacesService])
|
|
238
243
|
], LocalScenePlatform);
|
|
239
244
|
//# sourceMappingURL=local-scene.platform.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-scene.platform.js","sourceRoot":"","sources":["../../../../src/plugins/scenes-local/platforms/local-scene.platform.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAE5C,mDAA+D;AAC/D,kFAA4E;AAE5E,+GAA0G;AAC1G,yFAAqF;AACrF,uFAAmF;AACnF,2GAAsG;AACtG,kFAA+E;AAG/E,iFAGmD;AAEnD,oFAAgF;AAChF,+EAAqE;AAErE,sEAAwF;AAaxF,SAAS,kBAAkB,CAAC,MAAyB;IACpD,OAAO,MAAM,CAAC,IAAI,KAAK,0CAAiB,IAAI,UAAU,IAAI,MAAM,IAAI,YAAY,IAAI,MAAM,IAAI,OAAO,IAAI,MAAM,CAAC;AACjH,CAAC;AAGM,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAG9B,YACkB,cAA8B,EAC9B,eAAgC,EAChC,yBAAoD,EACpD,uBAAgD,EAChD,aAA4B;
|
|
1
|
+
{"version":3,"file":"local-scene.platform.js","sourceRoot":"","sources":["../../../../src/plugins/scenes-local/platforms/local-scene.platform.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAE5C,mDAA+D;AAC/D,kFAA4E;AAE5E,+GAA0G;AAC1G,yFAAqF;AACrF,uFAAmF;AACnF,2GAAsG;AACtG,2HAAqH;AACrH,kFAA+E;AAG/E,iFAGmD;AAEnD,oFAAgF;AAChF,+EAAqE;AAErE,sEAAwF;AAax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AAE;qCAKsB,gCAAc;QACb,kCAAe;QACL,uDAAyB;QAC3B,mDAAuB;QAChB,kEAA8B;QAC/C,8BAAa;GATlC,kBAAkB,CAuR9B"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EventEmitter2 } from '@nestjs/event-emitter';
|
|
2
2
|
import { PlatformRegistryService } from '../../../modules/devices/services/platform.registry.service';
|
|
3
|
+
import { PropertyCommandDispatchService } from '../../../modules/devices/services/property-command-dispatch.service';
|
|
3
4
|
import { IntentTimeseriesService } from '../../../modules/intents/services/intent-timeseries.service';
|
|
4
5
|
import { IntentsService } from '../../../modules/intents/services/intents.service';
|
|
5
6
|
import { SpacesService } from '../../../modules/spaces/services/spaces.service';
|
|
@@ -19,6 +20,7 @@ export interface ClimateIntentResult extends IntentExecutionResult {
|
|
|
19
20
|
export declare class ClimateIntentService extends SpaceIntentBaseService {
|
|
20
21
|
private readonly spacesService;
|
|
21
22
|
private readonly platformRegistryService;
|
|
23
|
+
private readonly propertyCommandDispatchService;
|
|
22
24
|
private readonly climateStateService;
|
|
23
25
|
private readonly contextSnapshotService;
|
|
24
26
|
private readonly undoHistoryService;
|
|
@@ -27,7 +29,7 @@ export declare class ClimateIntentService extends SpaceIntentBaseService {
|
|
|
27
29
|
private readonly intentSpecLoaderService;
|
|
28
30
|
private readonly intentsService;
|
|
29
31
|
private readonly logger;
|
|
30
|
-
constructor(spacesService: SpacesService, platformRegistryService: PlatformRegistryService, climateStateService: SpaceClimateStateService, contextSnapshotService: SpaceContextSnapshotService, undoHistoryService: SpaceUndoHistoryService, intentTimeseriesService: IntentTimeseriesService, eventEmitter: EventEmitter2, intentSpecLoaderService: IntentSpecLoaderService, intentsService: IntentsService);
|
|
32
|
+
constructor(spacesService: SpacesService, platformRegistryService: PlatformRegistryService, propertyCommandDispatchService: PropertyCommandDispatchService, climateStateService: SpaceClimateStateService, contextSnapshotService: SpaceContextSnapshotService, undoHistoryService: SpaceUndoHistoryService, intentTimeseriesService: IntentTimeseriesService, eventEmitter: EventEmitter2, intentSpecLoaderService: IntentSpecLoaderService, intentsService: IntentsService);
|
|
31
33
|
getClimateState(spaceId: string): Promise<ClimateState | null>;
|
|
32
34
|
executeClimateIntent(spaceId: string, intent: ClimateIntentDto): Promise<ClimateIntentResult | null>;
|
|
33
35
|
private filterOfflineClimateDevices;
|
|
@@ -15,6 +15,7 @@ const event_emitter_1 = require("@nestjs/event-emitter");
|
|
|
15
15
|
const extension_logger_service_1 = require("../../../common/logger/extension-logger.service");
|
|
16
16
|
const transform_utils_1 = require("../../../common/utils/transform.utils");
|
|
17
17
|
const platform_registry_service_1 = require("../../../modules/devices/services/platform.registry.service");
|
|
18
|
+
const property_command_dispatch_service_1 = require("../../../modules/devices/services/property-command-dispatch.service");
|
|
18
19
|
const intents_constants_1 = require("../../../modules/intents/intents.constants");
|
|
19
20
|
const intent_timeseries_service_1 = require("../../../modules/intents/services/intent-timeseries.service");
|
|
20
21
|
const intents_service_1 = require("../../../modules/intents/services/intents.service");
|
|
@@ -28,10 +29,11 @@ const space_context_snapshot_service_1 = require("./space-context-snapshot.servi
|
|
|
28
29
|
const space_intent_base_service_1 = require("./space-intent-base.service");
|
|
29
30
|
const space_undo_history_service_1 = require("./space-undo-history.service");
|
|
30
31
|
let ClimateIntentService = class ClimateIntentService extends space_intent_base_service_1.SpaceIntentBaseService {
|
|
31
|
-
constructor(spacesService, platformRegistryService, climateStateService, contextSnapshotService, undoHistoryService, intentTimeseriesService, eventEmitter, intentSpecLoaderService, intentsService) {
|
|
32
|
+
constructor(spacesService, platformRegistryService, propertyCommandDispatchService, climateStateService, contextSnapshotService, undoHistoryService, intentTimeseriesService, eventEmitter, intentSpecLoaderService, intentsService) {
|
|
32
33
|
super();
|
|
33
34
|
this.spacesService = spacesService;
|
|
34
35
|
this.platformRegistryService = platformRegistryService;
|
|
36
|
+
this.propertyCommandDispatchService = propertyCommandDispatchService;
|
|
35
37
|
this.climateStateService = climateStateService;
|
|
36
38
|
this.contextSnapshotService = contextSnapshotService;
|
|
37
39
|
this.undoHistoryService = undoHistoryService;
|
|
@@ -324,7 +326,7 @@ let ClimateIntentService = class ClimateIntentService extends space_intent_base_
|
|
|
324
326
|
return true;
|
|
325
327
|
}
|
|
326
328
|
try {
|
|
327
|
-
const success = await
|
|
329
|
+
const { success } = await this.propertyCommandDispatchService.dispatchBatch(commands);
|
|
328
330
|
if (!success) {
|
|
329
331
|
this.logger.error(`Mode command execution failed for device id=${device.device.id}`);
|
|
330
332
|
return false;
|
|
@@ -500,7 +502,7 @@ let ClimateIntentService = class ClimateIntentService extends space_intent_base_
|
|
|
500
502
|
this.logger.error(`Setpoint command preparation failed for device id=${device.device.id}`);
|
|
501
503
|
return { success: false, heatingSetpoint: null, coolingSetpoint: null };
|
|
502
504
|
}
|
|
503
|
-
const success = await
|
|
505
|
+
const { success } = await this.propertyCommandDispatchService.dispatchBatch(preparedCommands, { prepared: true });
|
|
504
506
|
if (!success) {
|
|
505
507
|
this.logger.error(`Setpoint command execution failed for device id=${device.device.id}`);
|
|
506
508
|
return { success: false, heatingSetpoint: null, coolingSetpoint: null };
|
|
@@ -710,6 +712,7 @@ exports.ClimateIntentService = ClimateIntentService = __decorate([
|
|
|
710
712
|
(0, common_1.Injectable)(),
|
|
711
713
|
__metadata("design:paramtypes", [spaces_service_1.SpacesService,
|
|
712
714
|
platform_registry_service_1.PlatformRegistryService,
|
|
715
|
+
property_command_dispatch_service_1.PropertyCommandDispatchService,
|
|
713
716
|
space_climate_state_service_1.SpaceClimateStateService,
|
|
714
717
|
space_context_snapshot_service_1.SpaceContextSnapshotService,
|
|
715
718
|
space_undo_history_service_1.SpaceUndoHistoryService,
|