@fastybird/smart-panel-backend 1.1.0-alpha.2 → 1.1.0-alpha.20
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 +8 -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/dataSource.js +1 -0
- package/dist/dataSource.js.map +1 -1
- package/dist/main.js +2 -7
- package/dist/main.js.map +1 -1
- package/dist/migrations/1000000000026-AddHardwareInputCategories.d.ts +7 -0
- package/dist/migrations/1000000000026-AddHardwareInputCategories.js +364 -0
- package/dist/migrations/1000000000026-AddHardwareInputCategories.js.map +1 -0
- package/dist/modules/devices/controllers/channels.controller.d.ts +5 -1
- package/dist/modules/devices/controllers/channels.controller.js +34 -2
- package/dist/modules/devices/controllers/channels.controller.js.map +1 -1
- package/dist/modules/devices/controllers/channels.properties.controller.js +21 -4
- package/dist/modules/devices/controllers/channels.properties.controller.js.map +1 -1
- package/dist/modules/devices/controllers/devices.channels.controller.d.ts +5 -1
- package/dist/modules/devices/controllers/devices.channels.controller.js +38 -2
- package/dist/modules/devices/controllers/devices.channels.controller.js.map +1 -1
- package/dist/modules/devices/controllers/devices.channels.properties.controller.js +21 -4
- package/dist/modules/devices/controllers/devices.channels.properties.controller.js.map +1 -1
- package/dist/modules/devices/devices.constants.d.ts +6 -0
- package/dist/modules/devices/devices.constants.js +6 -0
- package/dist/modules/devices/devices.constants.js.map +1 -1
- package/dist/modules/devices/devices.module.js +18 -0
- package/dist/modules/devices/devices.module.js.map +1 -1
- package/dist/modules/devices/devices.openapi.d.ts +3 -1
- package/dist/modules/devices/devices.openapi.js +7 -0
- package/dist/modules/devices/devices.openapi.js.map +1 -1
- package/dist/modules/devices/dto/channel-input-occurrence.dto.d.ts +10 -0
- package/dist/modules/devices/dto/channel-input-occurrence.dto.js +99 -0
- package/dist/modules/devices/dto/channel-input-occurrence.dto.js.map +1 -0
- package/dist/modules/devices/models/channel-input-capabilities.model.d.ts +20 -0
- package/dist/modules/devices/models/channel-input-capabilities.model.js +111 -0
- package/dist/modules/devices/models/channel-input-capabilities.model.js.map +1 -0
- package/dist/modules/devices/models/channel-input-occurrence.model.d.ts +22 -0
- package/dist/modules/devices/models/channel-input-occurrence.model.js +154 -0
- package/dist/modules/devices/models/channel-input-occurrence.model.js.map +1 -0
- package/dist/modules/devices/services/channel-input-deduplication.service.d.ts +17 -0
- package/dist/modules/devices/services/channel-input-deduplication.service.js +88 -0
- package/dist/modules/devices/services/channel-input-deduplication.service.js.map +1 -0
- package/dist/modules/devices/services/channel-input-occurrences.service.d.ts +21 -0
- package/dist/modules/devices/services/channel-input-occurrences.service.js +163 -0
- package/dist/modules/devices/services/channel-input-occurrences.service.js.map +1 -0
- 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/devices/utils/schema.utils.js +1 -1
- package/dist/modules/devices/utils/schema.utils.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/scripts/update-worker.sh +668 -59
- 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/system/services/update-executor.service.d.ts +20 -2
- package/dist/modules/system/services/update-executor.service.js +256 -25
- package/dist/modules/system/services/update-executor.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/devices-home-assistant.openapi.d.ts +2 -2
- package/dist/plugins/devices-home-assistant/devices-home-assistant.plugin.d.ts +6 -1
- package/dist/plugins/devices-home-assistant/devices-home-assistant.plugin.js +16 -1
- package/dist/plugins/devices-home-assistant/devices-home-assistant.plugin.js.map +1 -1
- package/dist/plugins/devices-home-assistant/dto/mapping-preview.dto.d.ts +1 -0
- package/dist/plugins/devices-home-assistant/dto/mapping-preview.dto.js +11 -0
- package/dist/plugins/devices-home-assistant/dto/mapping-preview.dto.js.map +1 -1
- package/dist/plugins/devices-home-assistant/mappers/button.entity.mapper.service.d.ts +19 -0
- package/dist/plugins/devices-home-assistant/mappers/button.entity.mapper.service.js +51 -0
- package/dist/plugins/devices-home-assistant/mappers/button.entity.mapper.service.js.map +1 -0
- package/dist/plugins/devices-home-assistant/mappings/definitions/entity-mappings.yaml +56 -7
- package/dist/plugins/devices-home-assistant/models/mapping-preview.model.d.ts +1 -0
- package/dist/plugins/devices-home-assistant/models/mapping-preview.model.js +11 -0
- package/dist/plugins/devices-home-assistant/models/mapping-preview.model.js.map +1 -1
- package/dist/plugins/devices-home-assistant/services/device-adoption.service.js +17 -0
- package/dist/plugins/devices-home-assistant/services/device-adoption.service.js.map +1 -1
- package/dist/plugins/devices-home-assistant/services/home-assistant-raw-event.service.d.ts +27 -0
- package/dist/plugins/devices-home-assistant/services/home-assistant-raw-event.service.js +271 -0
- package/dist/plugins/devices-home-assistant/services/home-assistant-raw-event.service.js.map +1 -0
- package/dist/plugins/devices-home-assistant/services/home-assistant.ws.service.d.ts +2 -2
- package/dist/plugins/devices-home-assistant/services/home-assistant.ws.service.js +33 -14
- package/dist/plugins/devices-home-assistant/services/home-assistant.ws.service.js.map +1 -1
- package/dist/plugins/devices-home-assistant/services/mapping-preview.service.js +24 -4
- package/dist/plugins/devices-home-assistant/services/mapping-preview.service.js.map +1 -1
- package/dist/plugins/devices-home-assistant/services/state-changed.event.service.d.ts +4 -1
- package/dist/plugins/devices-home-assistant/services/state-changed.event.service.js +84 -5
- package/dist/plugins/devices-home-assistant/services/state-changed.event.service.js.map +1 -1
- package/dist/plugins/devices-home-assistant/services/wizard.service.js +1 -0
- package/dist/plugins/devices-home-assistant/services/wizard.service.js.map +1 -1
- package/dist/plugins/devices-home-assistant/utils/ha-event.utils.d.ts +2 -0
- package/dist/plugins/devices-home-assistant/utils/ha-event.utils.js +50 -0
- package/dist/plugins/devices-home-assistant/utils/ha-event.utils.js.map +1 -0
- package/dist/plugins/devices-homekit/listeners/homekit-event.listener.d.ts +2 -0
- package/dist/plugins/devices-homekit/listeners/homekit-event.listener.js +28 -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/button.mapper.d.ts +15 -0
- package/dist/plugins/devices-homekit/mappers/button.mapper.js +143 -0
- package/dist/plugins/devices-homekit/mappers/button.mapper.js.map +1 -0
- package/dist/plugins/devices-homekit/mappers/homekit-mapper.interface.d.ts +16 -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-homekit/services/homekit-mapper-registry.service.d.ts +5 -1
- package/dist/plugins/devices-homekit/services/homekit-mapper-registry.service.js +42 -0
- package/dist/plugins/devices-homekit/services/homekit-mapper-registry.service.js.map +1 -1
- package/dist/plugins/devices-homey/mappings/definitions/channels.yaml +50 -0
- package/dist/plugins/devices-homey/mappings/definitions/devices.yaml +18 -0
- package/dist/plugins/devices-homey/mappings/definitions/properties.yaml +55 -0
- package/dist/plugins/devices-homey/mappings/device-support.js +10 -0
- package/dist/plugins/devices-homey/mappings/device-support.js.map +1 -1
- package/dist/plugins/devices-homey/mappings/mapping-loader.service.d.ts +1 -0
- package/dist/plugins/devices-homey/mappings/mapping-loader.service.js +66 -8
- package/dist/plugins/devices-homey/mappings/mapping-loader.service.js.map +1 -1
- package/dist/plugins/devices-homey/models/inventory.model.d.ts +2 -1
- package/dist/plugins/devices-homey/models/inventory.model.js +1 -0
- package/dist/plugins/devices-homey/models/inventory.model.js.map +1 -1
- package/dist/plugins/devices-homey/models/mapping-preview.model.d.ts +1 -0
- package/dist/plugins/devices-homey/models/mapping-preview.model.js +1 -0
- package/dist/plugins/devices-homey/models/mapping-preview.model.js.map +1 -1
- package/dist/plugins/devices-homey/services/homey-mapping-preview.service.js +7 -0
- package/dist/plugins/devices-homey/services/homey-mapping-preview.service.js.map +1 -1
- package/dist/plugins/devices-homey/services/homey-synchronizer.service.d.ts +3 -1
- package/dist/plugins/devices-homey/services/homey-synchronizer.service.js +37 -6
- package/dist/plugins/devices-homey/services/homey-synchronizer.service.js.map +1 -1
- package/dist/plugins/devices-reterminal/services/reterminal-button.service.d.ts +7 -3
- package/dist/plugins/devices-reterminal/services/reterminal-button.service.js +63 -17
- package/dist/plugins/devices-reterminal/services/reterminal-button.service.js.map +1 -1
- package/dist/plugins/devices-shelly-ng/delegates/delegates-manager.service.d.ts +38 -3
- package/dist/plugins/devices-shelly-ng/delegates/delegates-manager.service.js +840 -134
- 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 +15 -1
- package/dist/plugins/devices-shelly-ng/delegates/shelly-device.delegate.js +117 -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 +11 -13
- package/dist/plugins/devices-shelly-ng/devices-shelly-ng.constants.js.map +1 -1
- package/dist/plugins/devices-shelly-ng/devices-shelly-ng.plugin.js +2 -0
- package/dist/plugins/devices-shelly-ng/devices-shelly-ng.plugin.js.map +1 -1
- package/dist/plugins/devices-shelly-ng/mappings/definitions/inputs.yaml +80 -0
- package/dist/plugins/devices-shelly-ng/mappings/mapping-loader.service.js +11 -1
- package/dist/plugins/devices-shelly-ng/mappings/mapping-loader.service.js.map +1 -1
- package/dist/plugins/devices-shelly-ng/mappings/mapping.types.d.ts +6 -3
- package/dist/plugins/devices-shelly-ng/mappings/schema/mapping-schema.json +5 -0
- package/dist/plugins/devices-shelly-ng/services/device-manager.service.js +130 -7
- package/dist/plugins/devices-shelly-ng/services/device-manager.service.js.map +1 -1
- package/dist/plugins/devices-shelly-ng/services/poll-placement-diagnostics.service.d.ts +48 -0
- package/dist/plugins/devices-shelly-ng/services/poll-placement-diagnostics.service.js +457 -0
- package/dist/plugins/devices-shelly-ng/services/poll-placement-diagnostics.service.js.map +1 -0
- package/dist/plugins/devices-shelly-ng/services/shelly-ng.service.d.ts +12 -2
- package/dist/plugins/devices-shelly-ng/services/shelly-ng.service.js +86 -28
- package/dist/plugins/devices-shelly-ng/services/shelly-ng.service.js.map +1 -1
- package/dist/plugins/devices-shelly-ng/services/shelly-rpc-client.service.js +3 -0
- package/dist/plugins/devices-shelly-ng/services/shelly-rpc-client.service.js.map +1 -1
- package/dist/plugins/devices-shelly-ng/services/shelly-ws-server.service.d.ts +1 -1
- package/dist/plugins/devices-shelly-ng/services/shelly-ws-server.service.js +18 -13
- 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/devices-shelly-v1/devices-shelly-v1.constants.d.ts +2 -0
- package/dist/plugins/devices-shelly-v1/devices-shelly-v1.constants.js +66 -4
- package/dist/plugins/devices-shelly-v1/devices-shelly-v1.constants.js.map +1 -1
- package/dist/plugins/devices-shelly-v1/devices-shelly-v1.plugin.js +2 -0
- package/dist/plugins/devices-shelly-v1/devices-shelly-v1.plugin.js.map +1 -1
- package/dist/plugins/devices-shelly-v1/platforms/shelly-v1.device.platform.js +7 -0
- package/dist/plugins/devices-shelly-v1/platforms/shelly-v1.device.platform.js.map +1 -1
- package/dist/plugins/devices-shelly-v1/services/device-mapper.service.d.ts +3 -1
- package/dist/plugins/devices-shelly-v1/services/device-mapper.service.js +20 -2
- package/dist/plugins/devices-shelly-v1/services/device-mapper.service.js.map +1 -1
- package/dist/plugins/devices-shelly-v1/services/shelly-v1-input-tracker.service.d.ts +16 -0
- package/dist/plugins/devices-shelly-v1/services/shelly-v1-input-tracker.service.js +107 -0
- package/dist/plugins/devices-shelly-v1/services/shelly-v1-input-tracker.service.js.map +1 -0
- package/dist/plugins/devices-shelly-v1/services/shelly-v1.service.d.ts +7 -1
- package/dist/plugins/devices-shelly-v1/services/shelly-v1.service.js +98 -3
- package/dist/plugins/devices-shelly-v1/services/shelly-v1.service.js.map +1 -1
- package/dist/plugins/devices-third-party/controllers/third-party-inputs.controller.d.ts +17 -0
- package/dist/plugins/devices-third-party/controllers/third-party-inputs.controller.js +205 -0
- package/dist/plugins/devices-third-party/controllers/third-party-inputs.controller.js.map +1 -0
- package/dist/plugins/devices-third-party/devices-third-party.openapi.d.ts +1 -1
- package/dist/plugins/devices-third-party/devices-third-party.plugin.js +2 -1
- package/dist/plugins/devices-third-party/devices-third-party.plugin.js.map +1 -1
- package/dist/plugins/devices-third-party/dto/report-input-occurrence-response.dto.d.ts +5 -0
- package/dist/plugins/devices-third-party/dto/report-input-occurrence-response.dto.js +50 -0
- package/dist/plugins/devices-third-party/dto/report-input-occurrence-response.dto.js.map +1 -0
- package/dist/plugins/devices-third-party/dto/report-input-occurrence.dto.d.ts +8 -0
- package/dist/plugins/devices-third-party/dto/report-input-occurrence.dto.js +81 -0
- package/dist/plugins/devices-third-party/dto/report-input-occurrence.dto.js.map +1 -0
- package/dist/plugins/devices-third-party/platforms/third-party-device.platform.js +19 -4
- package/dist/plugins/devices-third-party/platforms/third-party-device.platform.js.map +1 -1
- package/dist/plugins/devices-virtual/listeners/virtual-projection.listener.d.ts +2 -0
- package/dist/plugins/devices-virtual/listeners/virtual-projection.listener.js +57 -0
- package/dist/plugins/devices-virtual/listeners/virtual-projection.listener.js.map +1 -1
- package/dist/plugins/devices-zigbee2mqtt/devices-zigbee2mqtt.constants.d.ts +3 -0
- package/dist/plugins/devices-zigbee2mqtt/devices-zigbee2mqtt.constants.js +41 -5
- package/dist/plugins/devices-zigbee2mqtt/devices-zigbee2mqtt.constants.js.map +1 -1
- package/dist/plugins/devices-zigbee2mqtt/interfaces/zigbee2mqtt.interface.d.ts +7 -1
- package/dist/plugins/devices-zigbee2mqtt/mappings/config-driven.converter.js +16 -15
- package/dist/plugins/devices-zigbee2mqtt/mappings/config-driven.converter.js.map +1 -1
- package/dist/plugins/devices-zigbee2mqtt/mappings/definitions/remotes.yaml +505 -74
- package/dist/plugins/devices-zigbee2mqtt/mappings/schema/mapping-schema.json +3 -3
- package/dist/plugins/devices-zigbee2mqtt/mappings/transformers/transformer.types.d.ts +1 -1
- package/dist/plugins/devices-zigbee2mqtt/services/base-client-adapter.d.ts +8 -2
- package/dist/plugins/devices-zigbee2mqtt/services/base-client-adapter.js +6 -5
- package/dist/plugins/devices-zigbee2mqtt/services/base-client-adapter.js.map +1 -1
- package/dist/plugins/devices-zigbee2mqtt/services/device-adoption.service.js +18 -11
- package/dist/plugins/devices-zigbee2mqtt/services/device-adoption.service.js.map +1 -1
- package/dist/plugins/devices-zigbee2mqtt/services/device-mapper.service.d.ts +9 -3
- package/dist/plugins/devices-zigbee2mqtt/services/device-mapper.service.js +166 -3
- package/dist/plugins/devices-zigbee2mqtt/services/device-mapper.service.js.map +1 -1
- package/dist/plugins/devices-zigbee2mqtt/services/mqtt-client-adapter.service.js +5 -2
- package/dist/plugins/devices-zigbee2mqtt/services/mqtt-client-adapter.service.js.map +1 -1
- package/dist/plugins/devices-zigbee2mqtt/services/zigbee2mqtt.service.d.ts +1 -0
- package/dist/plugins/devices-zigbee2mqtt/services/zigbee2mqtt.service.js +44 -4
- package/dist/plugins/devices-zigbee2mqtt/services/zigbee2mqtt.service.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 +3 -0
- package/dist/plugins/remote-access-tailscale/remote-access-tailscale.constants.js +4 -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 +31 -1
- package/dist/plugins/remote-access-tailscale/services/tailscale-node-managed.service.js +316 -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/simulator/controllers/simulator.controller.d.ts +8 -2
- package/dist/plugins/simulator/controllers/simulator.controller.js +102 -2
- package/dist/plugins/simulator/controllers/simulator.controller.js.map +1 -1
- package/dist/plugins/simulator/dto/simulate-occurrence.dto.d.ts +12 -0
- package/dist/plugins/simulator/dto/simulate-occurrence.dto.js +122 -0
- package/dist/plugins/simulator/dto/simulate-occurrence.dto.js.map +1 -0
- package/dist/plugins/simulator/models/simulator-response.model.d.ts +12 -0
- package/dist/plugins/simulator/models/simulator-response.model.js +84 -1
- package/dist/plugins/simulator/models/simulator-response.model.js.map +1 -1
- package/dist/plugins/simulator/scenarios/definitions/small-apartment.yaml +78 -0
- package/dist/plugins/simulator/services/scenario-executor.service.js +3 -1
- package/dist/plugins/simulator/services/scenario-executor.service.js.map +1 -1
- package/dist/plugins/simulator/services/simulation.service.js +10 -1
- package/dist/plugins/simulator/services/simulation.service.js.map +1 -1
- package/dist/plugins/simulator/simulator.openapi.d.ts +3 -2
- package/dist/plugins/simulator/simulator.openapi.js +5 -0
- package/dist/plugins/simulator/simulator.openapi.js.map +1 -1
- package/dist/plugins/simulator/simulators/device-simulator.interface.d.ts +2 -0
- package/dist/plugins/simulator/simulators/device-simulator.interface.js +83 -0
- package/dist/plugins/simulator/simulators/device-simulator.interface.js.map +1 -1
- package/dist/plugins/simulator/simulators/index.d.ts +1 -0
- package/dist/plugins/simulator/simulators/index.js +1 -0
- package/dist/plugins/simulator/simulators/index.js.map +1 -1
- package/dist/plugins/simulator/simulators/input-controller.simulator.d.ts +10 -0
- package/dist/plugins/simulator/simulators/input-controller.simulator.js +57 -0
- package/dist/plugins/simulator/simulators/input-controller.simulator.js.map +1 -0
- package/dist/plugins/simulator/simulators/lighting.simulator.js +1 -0
- package/dist/plugins/simulator/simulators/lighting.simulator.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/spec/channels.d.ts +51 -1
- package/dist/spec/channels.js +64 -1
- package/dist/spec/channels.js.map +1 -1
- package/dist/spec/devices.d.ts +155 -2
- package/dist/spec/devices.js +161 -2
- package/dist/spec/devices.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,OAA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 +1,12 @@
|
|
|
1
1
|
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,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B,8BAAa;QACL,8DAA4B;GAfzD,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,+EA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B;IAD9B,IAAA,mBAAU,GAAE;qCAKsB,gCAAc;QACb,kCAAe;QACL,uDAAyB;QAC3B,mDAAuB;QAChB,kEAA8B;QAC/C,8BAAa;GATlC,kBAAkB,CAuR9B"}
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
import { ConnectionState } from '../../../modules/devices/devices.constants';
|
|
2
2
|
import { DeviceResponseModel } from '../../../modules/devices/models/devices-response.model';
|
|
3
|
+
import { ChannelInputOccurrencesService } from '../../../modules/devices/services/channel-input-occurrences.service';
|
|
3
4
|
import { ChannelsPropertiesService } from '../../../modules/devices/services/channels.properties.service';
|
|
5
|
+
import { ChannelsService } from '../../../modules/devices/services/channels.service';
|
|
4
6
|
import { DeviceConnectivityService } from '../../../modules/devices/services/device-connectivity.service';
|
|
5
7
|
import { DevicesService } from '../../../modules/devices/services/devices.service';
|
|
6
8
|
import { ReqGenerateDeviceDto } from '../dto/generate-device.dto';
|
|
9
|
+
import { ReqSimulateOccurrenceDto } from '../dto/simulate-occurrence.dto';
|
|
7
10
|
import { ReqSimulateValueDto } from '../dto/simulate-value.dto';
|
|
8
|
-
import { ConnectionStateResponseModel, DeviceCategoriesResponseModel, SimulatedValueResponseModel } from '../models/simulator-response.model';
|
|
11
|
+
import { ConnectionStateResponseModel, DeviceCategoriesResponseModel, SimulatedOccurrenceResponseModel, SimulatedValueResponseModel } from '../models/simulator-response.model';
|
|
9
12
|
import { DeviceGeneratorService } from '../services/device-generator.service';
|
|
10
13
|
export declare class SimulatorController {
|
|
11
14
|
private readonly devicesService;
|
|
15
|
+
private readonly channelsService;
|
|
12
16
|
private readonly channelsPropertiesService;
|
|
13
17
|
private readonly deviceConnectivityService;
|
|
14
18
|
private readonly deviceGeneratorService;
|
|
19
|
+
private readonly channelInputOccurrencesService;
|
|
15
20
|
private readonly logger;
|
|
16
|
-
constructor(devicesService: DevicesService, channelsPropertiesService: ChannelsPropertiesService, deviceConnectivityService: DeviceConnectivityService, deviceGeneratorService: DeviceGeneratorService);
|
|
21
|
+
constructor(devicesService: DevicesService, channelsService: ChannelsService, channelsPropertiesService: ChannelsPropertiesService, deviceConnectivityService: DeviceConnectivityService, deviceGeneratorService: DeviceGeneratorService, channelInputOccurrencesService: ChannelInputOccurrencesService);
|
|
17
22
|
getCategories(): DeviceCategoriesResponseModel;
|
|
18
23
|
generateDevice(body: ReqGenerateDeviceDto): Promise<DeviceResponseModel>;
|
|
19
24
|
simulateValue(deviceId: string, body: ReqSimulateValueDto): Promise<SimulatedValueResponseModel>;
|
|
@@ -22,6 +27,7 @@ export declare class SimulatorController {
|
|
|
22
27
|
state?: ConnectionState;
|
|
23
28
|
};
|
|
24
29
|
}): Promise<ConnectionStateResponseModel>;
|
|
30
|
+
simulateOccurrence(deviceId: string, body: ReqSimulateOccurrenceDto): Promise<SimulatedOccurrenceResponseModel>;
|
|
25
31
|
simulateAllValues(deviceId: string): Promise<DeviceResponseModel>;
|
|
26
32
|
private formatCategoryName;
|
|
27
33
|
}
|
|
@@ -20,22 +20,27 @@ const transform_utils_1 = require("../../../common/utils/transform.utils");
|
|
|
20
20
|
const devices_constants_1 = require("../../../modules/devices/devices.constants");
|
|
21
21
|
const devices_exceptions_1 = require("../../../modules/devices/devices.exceptions");
|
|
22
22
|
const devices_response_model_1 = require("../../../modules/devices/models/devices-response.model");
|
|
23
|
+
const channel_input_occurrences_service_1 = require("../../../modules/devices/services/channel-input-occurrences.service");
|
|
23
24
|
const channels_properties_service_1 = require("../../../modules/devices/services/channels.properties.service");
|
|
25
|
+
const channels_service_1 = require("../../../modules/devices/services/channels.service");
|
|
24
26
|
const device_connectivity_service_1 = require("../../../modules/devices/services/device-connectivity.service");
|
|
25
27
|
const devices_service_1 = require("../../../modules/devices/services/devices.service");
|
|
26
28
|
const schema_utils_1 = require("../../../modules/devices/utils/schema.utils");
|
|
27
29
|
const api_documentation_decorator_1 = require("../../../modules/swagger/decorators/api-documentation.decorator");
|
|
28
30
|
const generate_device_dto_1 = require("../dto/generate-device.dto");
|
|
31
|
+
const simulate_occurrence_dto_1 = require("../dto/simulate-occurrence.dto");
|
|
29
32
|
const simulate_value_dto_1 = require("../dto/simulate-value.dto");
|
|
30
33
|
const simulator_response_model_1 = require("../models/simulator-response.model");
|
|
31
34
|
const device_generator_service_1 = require("../services/device-generator.service");
|
|
32
35
|
const simulator_constants_1 = require("../simulator.constants");
|
|
33
36
|
let SimulatorController = class SimulatorController {
|
|
34
|
-
constructor(devicesService, channelsPropertiesService, deviceConnectivityService, deviceGeneratorService) {
|
|
37
|
+
constructor(devicesService, channelsService, channelsPropertiesService, deviceConnectivityService, deviceGeneratorService, channelInputOccurrencesService) {
|
|
35
38
|
this.devicesService = devicesService;
|
|
39
|
+
this.channelsService = channelsService;
|
|
36
40
|
this.channelsPropertiesService = channelsPropertiesService;
|
|
37
41
|
this.deviceConnectivityService = deviceConnectivityService;
|
|
38
42
|
this.deviceGeneratorService = deviceGeneratorService;
|
|
43
|
+
this.channelInputOccurrencesService = channelInputOccurrencesService;
|
|
39
44
|
this.logger = (0, extension_logger_service_1.createExtensionLogger)(simulator_constants_1.SIMULATOR_PLUGIN_NAME, 'SimulatorController');
|
|
40
45
|
}
|
|
41
46
|
getCategories() {
|
|
@@ -136,6 +141,70 @@ let SimulatorController = class SimulatorController {
|
|
|
136
141
|
};
|
|
137
142
|
return (0, transform_utils_1.toInstance)(simulator_response_model_1.ConnectionStateResponseModel, { data: result }, { excludeExtraneousValues: true });
|
|
138
143
|
}
|
|
144
|
+
async simulateOccurrence(deviceId, body) {
|
|
145
|
+
const dto = body.data;
|
|
146
|
+
this.logger.debug(`Simulating input occurrence for device=${deviceId}, channel=${dto.channel_id}, event=${dto.event}`);
|
|
147
|
+
const device = await this.devicesService.findOne(deviceId, simulator_constants_1.SIMULATOR_TYPE);
|
|
148
|
+
if (!device) {
|
|
149
|
+
throw new devices_exceptions_1.DevicesNotFoundException(`Simulator device ${deviceId} not found`);
|
|
150
|
+
}
|
|
151
|
+
const channel = await this.channelsService.findOne(dto.channel_id);
|
|
152
|
+
if (!channel) {
|
|
153
|
+
throw new devices_exceptions_1.DevicesNotFoundException(`Channel ${dto.channel_id} not found`);
|
|
154
|
+
}
|
|
155
|
+
const channelDeviceId = typeof channel.device === 'string' ? channel.device : channel.device?.id;
|
|
156
|
+
if (channelDeviceId !== deviceId) {
|
|
157
|
+
throw new devices_exceptions_1.DevicesNotFoundException(`Channel ${dto.channel_id} does not belong to device ${deviceId}`);
|
|
158
|
+
}
|
|
159
|
+
let propertyId = dto.property_id;
|
|
160
|
+
if (!propertyId) {
|
|
161
|
+
const channelProps = await this.channelsPropertiesService.findAll(channel.id);
|
|
162
|
+
const eventProp = channelProps.find((p) => p.category === devices_constants_1.PropertyCategory.EVENT || p.permissions.includes(devices_constants_1.PermissionType.EVENT_ONLY));
|
|
163
|
+
if (!eventProp) {
|
|
164
|
+
throw new common_1.BadRequestException(`No event property found on channel ${dto.channel_id}`);
|
|
165
|
+
}
|
|
166
|
+
propertyId = eventProp.id;
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
const property = await this.channelsPropertiesService.findOne(propertyId);
|
|
170
|
+
if (!property) {
|
|
171
|
+
throw new devices_exceptions_1.DevicesNotFoundException(`Property ${propertyId} not found`);
|
|
172
|
+
}
|
|
173
|
+
const propChannelId = typeof property.channel === 'string' ? property.channel : property.channel?.id;
|
|
174
|
+
if (propChannelId !== dto.channel_id) {
|
|
175
|
+
throw new common_1.BadRequestException(`Property ${propertyId} does not belong to channel ${dto.channel_id}`);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
let payload;
|
|
179
|
+
try {
|
|
180
|
+
payload = await this.channelInputOccurrencesService.publishOccurrence({
|
|
181
|
+
deviceId,
|
|
182
|
+
channelId: dto.channel_id,
|
|
183
|
+
propertyId,
|
|
184
|
+
event: dto.event,
|
|
185
|
+
sourceTimestamp: dto.source_timestamp,
|
|
186
|
+
sourceOccurrenceId: dto.source_occurrence_id,
|
|
187
|
+
nativeEventType: dto.native_event_type,
|
|
188
|
+
data: dto.data,
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
if (error instanceof devices_exceptions_1.DevicesValidationException) {
|
|
193
|
+
throw new common_1.UnprocessableEntityException(error.message);
|
|
194
|
+
}
|
|
195
|
+
throw error;
|
|
196
|
+
}
|
|
197
|
+
const result = {
|
|
198
|
+
occurrence_id: payload?.id ?? null,
|
|
199
|
+
channel_id: dto.channel_id,
|
|
200
|
+
property_id: propertyId,
|
|
201
|
+
event: dto.event,
|
|
202
|
+
timestamp: payload?.timestamp ?? new Date().toISOString(),
|
|
203
|
+
dropped: payload === null,
|
|
204
|
+
success: true,
|
|
205
|
+
};
|
|
206
|
+
return (0, transform_utils_1.toInstance)(simulator_response_model_1.SimulatedOccurrenceResponseModel, { data: result }, { excludeExtraneousValues: true });
|
|
207
|
+
}
|
|
139
208
|
async simulateAllValues(deviceId) {
|
|
140
209
|
this.logger.debug(`Simulating all values for device=${deviceId}`);
|
|
141
210
|
const device = await this.devicesService.findOne(deviceId, simulator_constants_1.SIMULATOR_TYPE);
|
|
@@ -145,6 +214,9 @@ let SimulatorController = class SimulatorController {
|
|
|
145
214
|
for (const channel of device.channels) {
|
|
146
215
|
const allProperties = (0, schema_utils_1.getAllProperties)(channel.category);
|
|
147
216
|
for (const property of channel.properties) {
|
|
217
|
+
if (property.permissions.includes(devices_constants_1.PermissionType.EVENT_ONLY)) {
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
148
220
|
const propMeta = allProperties.find((p) => p.category === property.category);
|
|
149
221
|
if (propMeta) {
|
|
150
222
|
const value = this.deviceGeneratorService.generateRandomValue(propMeta);
|
|
@@ -271,6 +343,32 @@ __decorate([
|
|
|
271
343
|
__metadata("design:paramtypes", [String, Object]),
|
|
272
344
|
__metadata("design:returntype", Promise)
|
|
273
345
|
], SimulatorController.prototype, "simulateConnectionState", null);
|
|
346
|
+
__decorate([
|
|
347
|
+
(0, swagger_1.ApiOperation)({
|
|
348
|
+
summary: 'Simulate a hardware input occurrence',
|
|
349
|
+
description: 'Emits a deterministic hardware input occurrence (e.g. button press, double press, long press, down, up) through the DevicesModule occurrence delivery pipeline.',
|
|
350
|
+
operationId: 'simulate-simulator-plugin-occurrence',
|
|
351
|
+
}),
|
|
352
|
+
(0, swagger_1.ApiParam)({
|
|
353
|
+
name: 'deviceId',
|
|
354
|
+
description: 'Device UUID',
|
|
355
|
+
type: 'string',
|
|
356
|
+
format: 'uuid',
|
|
357
|
+
}),
|
|
358
|
+
(0, swagger_1.ApiBody)({
|
|
359
|
+
type: simulate_occurrence_dto_1.ReqSimulateOccurrenceDto,
|
|
360
|
+
description: 'Input occurrence simulation parameters',
|
|
361
|
+
}),
|
|
362
|
+
(0, api_documentation_decorator_1.ApiSuccessResponse)(simulator_response_model_1.SimulatedOccurrenceResponseModel, 'Occurrence simulation result'),
|
|
363
|
+
(0, api_documentation_decorator_1.ApiNotFoundResponse)('Device, channel, or property not found'),
|
|
364
|
+
(0, api_documentation_decorator_1.ApiBadRequestResponse)('Invalid simulation parameters or device is not a simulator device'),
|
|
365
|
+
(0, common_1.Post)(':deviceId/simulate-occurrence'),
|
|
366
|
+
__param(0, (0, common_1.Param)('deviceId', common_1.ParseUUIDPipe)),
|
|
367
|
+
__param(1, (0, common_1.Body)()),
|
|
368
|
+
__metadata("design:type", Function),
|
|
369
|
+
__metadata("design:paramtypes", [String, simulate_occurrence_dto_1.ReqSimulateOccurrenceDto]),
|
|
370
|
+
__metadata("design:returntype", Promise)
|
|
371
|
+
], SimulatorController.prototype, "simulateOccurrence", null);
|
|
274
372
|
__decorate([
|
|
275
373
|
(0, swagger_1.ApiOperation)({
|
|
276
374
|
summary: 'Simulate random values for all properties',
|
|
@@ -296,8 +394,10 @@ exports.SimulatorController = SimulatorController = __decorate([
|
|
|
296
394
|
(0, swagger_1.ApiTags)(simulator_constants_1.SIMULATOR_PLUGIN_API_TAG_NAME),
|
|
297
395
|
(0, common_1.Controller)('simulator'),
|
|
298
396
|
__metadata("design:paramtypes", [devices_service_1.DevicesService,
|
|
397
|
+
channels_service_1.ChannelsService,
|
|
299
398
|
channels_properties_service_1.ChannelsPropertiesService,
|
|
300
399
|
device_connectivity_service_1.DeviceConnectivityService,
|
|
301
|
-
device_generator_service_1.DeviceGeneratorService
|
|
400
|
+
device_generator_service_1.DeviceGeneratorService,
|
|
401
|
+
channel_input_occurrences_service_1.ChannelInputOccurrencesService])
|
|
302
402
|
], SimulatorController);
|
|
303
403
|
//# sourceMappingURL=simulator.controller.js.map
|