@fastybird/smart-panel-backend 1.1.0-alpha.3 → 1.1.0-alpha.30
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/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 +20 -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 +31 -3
- package/dist/modules/devices/services/channels.properties.service.js +346 -51
- 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 +206 -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-metadata.service.d.ts +31 -0
- package/dist/modules/devices/services/property-metadata.service.js +160 -0
- package/dist/modules/devices/services/property-metadata.service.js.map +1 -0
- 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-lock.service.d.ts +3 -1
- package/dist/modules/devices/services/property-value-lock.service.js +13 -2
- package/dist/modules/devices/services/property-value-lock.service.js.map +1 -1
- 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/platforms/raspberry.platform.js +5 -10
- package/dist/modules/platform/platforms/raspberry.platform.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 +1168 -61
- package/dist/modules/system/services/privileged-worker.service.d.ts +13 -0
- package/dist/modules/system/services/privileged-worker.service.js +192 -31
- package/dist/modules/system/services/privileged-worker.service.js.map +1 -1
- package/dist/modules/system/services/system.service.d.ts +2 -0
- package/dist/modules/system/services/system.service.js +22 -1
- package/dist/modules/system/services/system.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 +272 -26
- 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 +4 -1
- package/dist/plugins/devices-homekit/listeners/homekit-event.listener.js +39 -4
- package/dist/plugins/devices-homekit/listeners/homekit-event.listener.js.map +1 -1
- package/dist/plugins/devices-homekit/mappers/base.mapper.js +30 -6
- 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/characteristic-write.d.ts +2 -0
- package/dist/plugins/devices-homekit/mappers/characteristic-write.js +17 -0
- package/dist/plugins/devices-homekit/mappers/characteristic-write.js.map +1 -0
- package/dist/plugins/devices-homekit/mappers/homekit-mapper.interface.d.ts +17 -1
- package/dist/plugins/devices-homekit/mappers/thermostat-coordinator.d.ts +7 -0
- package/dist/plugins/devices-homekit/mappers/thermostat-coordinator.js +96 -84
- 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 +36 -3
- package/dist/plugins/devices-shelly-ng/delegates/delegates-manager.service.js +707 -42
- 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 +11 -1
- package/dist/plugins/devices-shelly-ng/delegates/shelly-device.delegate.js +100 -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 +9 -11
- 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 +7 -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 +153 -8
- 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 +51 -0
- package/dist/plugins/devices-shelly-ng/services/poll-placement-diagnostics.service.js +549 -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 +14 -2
- package/dist/plugins/devices-shelly-ng/services/shelly-ng.service.js +134 -35
- 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 -0
- package/dist/plugins/devices-shelly-ng/services/shelly-ws-server.service.js +14 -4
- package/dist/plugins/devices-shelly-ng/services/shelly-ws-server.service.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 +3 -3
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { type FileHandle } from 'node:fs/promises';
|
|
2
|
+
import { Socket } from 'socket.io';
|
|
3
|
+
import { OnModuleDestroy, OnModuleInit } from '@nestjs/common';
|
|
4
|
+
export interface CommandAcknowledgementTraceConfig {
|
|
5
|
+
readonly schemaVersion: 1;
|
|
6
|
+
readonly runId: string;
|
|
7
|
+
readonly target: {
|
|
8
|
+
readonly deviceId: string;
|
|
9
|
+
readonly channelId: string;
|
|
10
|
+
readonly propertyId: string;
|
|
11
|
+
};
|
|
12
|
+
readonly requests: readonly [
|
|
13
|
+
{
|
|
14
|
+
readonly phase: 'trial';
|
|
15
|
+
readonly requestId: string;
|
|
16
|
+
readonly value: boolean;
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
readonly phase: 'restoration';
|
|
20
|
+
readonly requestId: string;
|
|
21
|
+
readonly value: boolean;
|
|
22
|
+
}
|
|
23
|
+
];
|
|
24
|
+
readonly exportPath: string;
|
|
25
|
+
readonly captureDurationMs?: number;
|
|
26
|
+
readonly maxRecords?: number;
|
|
27
|
+
}
|
|
28
|
+
export declare const COMMAND_ACKNOWLEDGEMENT_TRACE_OPTIONS: unique symbol;
|
|
29
|
+
type TraceState = 'armed' | 'recording' | 'closed' | 'invalid';
|
|
30
|
+
type TracePhase = 'trial' | 'restoration';
|
|
31
|
+
type TraceStage = 'socket-receipt' | 'gateway-entry' | 'handler-start' | 'handler-settled' | 'handler-skipped' | 'gateway-return' | 'gateway-throw' | 'ack-invoked' | 'ack-returned' | 'ack-threw' | 'socket-close';
|
|
32
|
+
interface TraceRecord {
|
|
33
|
+
readonly sequence: number;
|
|
34
|
+
readonly monotonicMs: number;
|
|
35
|
+
readonly stage: TraceStage;
|
|
36
|
+
readonly phase: TracePhase;
|
|
37
|
+
readonly requestId: string;
|
|
38
|
+
readonly metadata?: Record<string, boolean | number | string>;
|
|
39
|
+
}
|
|
40
|
+
interface CommandAcknowledgementTraceSnapshot {
|
|
41
|
+
readonly schemaVersion: 1;
|
|
42
|
+
readonly snapshotSequence: number;
|
|
43
|
+
readonly snapshotMonotonicMs: number;
|
|
44
|
+
readonly configFingerprint: string;
|
|
45
|
+
readonly process: {
|
|
46
|
+
readonly id: number;
|
|
47
|
+
readonly instanceId: string;
|
|
48
|
+
readonly runtimeSourceHash: string;
|
|
49
|
+
};
|
|
50
|
+
readonly runId: string;
|
|
51
|
+
readonly target: {
|
|
52
|
+
readonly deviceId: string;
|
|
53
|
+
readonly channelId: string;
|
|
54
|
+
readonly propertyId: string;
|
|
55
|
+
};
|
|
56
|
+
readonly state: TraceState;
|
|
57
|
+
readonly cutoffReason: string | null;
|
|
58
|
+
readonly socketTraceId: string | null;
|
|
59
|
+
readonly requests: readonly {
|
|
60
|
+
readonly phase: TracePhase;
|
|
61
|
+
readonly requestId: string;
|
|
62
|
+
readonly value: boolean;
|
|
63
|
+
readonly status: 'not-observed' | 'received';
|
|
64
|
+
readonly acknowledgementCalls: number;
|
|
65
|
+
}[];
|
|
66
|
+
readonly records: readonly TraceRecord[];
|
|
67
|
+
}
|
|
68
|
+
interface CommandAcknowledgementTraceFileSystem {
|
|
69
|
+
lstat(path: string): Promise<unknown>;
|
|
70
|
+
open(path: string, flags: 'r' | 'wx', mode?: number): Promise<FileHandle>;
|
|
71
|
+
link(existingPath: string, newPath: string): Promise<void>;
|
|
72
|
+
rename(oldPath: string, newPath: string): Promise<void>;
|
|
73
|
+
rm(path: string, options: {
|
|
74
|
+
force: boolean;
|
|
75
|
+
}): Promise<void>;
|
|
76
|
+
}
|
|
77
|
+
export declare class CommandAcknowledgementSnapshotWriter {
|
|
78
|
+
private readonly destination;
|
|
79
|
+
private readonly onFailure;
|
|
80
|
+
private readonly fileSystem;
|
|
81
|
+
private writing;
|
|
82
|
+
private pending;
|
|
83
|
+
private ownedDestination;
|
|
84
|
+
private readonly idleWaiters;
|
|
85
|
+
constructor(destination: string, onFailure: () => void, fileSystem?: CommandAcknowledgementTraceFileSystem);
|
|
86
|
+
queue(snapshot: CommandAcknowledgementTraceSnapshot): void;
|
|
87
|
+
waitForIdle(): Promise<void>;
|
|
88
|
+
private drain;
|
|
89
|
+
private write;
|
|
90
|
+
private assertDestinationIsAbsent;
|
|
91
|
+
private syncParentDirectory;
|
|
92
|
+
}
|
|
93
|
+
export declare class CommandAcknowledgementTraceService implements OnModuleInit, OnModuleDestroy {
|
|
94
|
+
private readonly config;
|
|
95
|
+
private readonly runtimeSourceHash;
|
|
96
|
+
private readonly configFingerprint;
|
|
97
|
+
private readonly processInstanceId;
|
|
98
|
+
private readonly requests;
|
|
99
|
+
private readonly attachedSockets;
|
|
100
|
+
private readonly disconnectListeners;
|
|
101
|
+
private readonly writer;
|
|
102
|
+
private socketContext;
|
|
103
|
+
private state;
|
|
104
|
+
private cutoffReason;
|
|
105
|
+
private records;
|
|
106
|
+
private nextSequence;
|
|
107
|
+
private nextSnapshotSequence;
|
|
108
|
+
private timer;
|
|
109
|
+
private exportFailed;
|
|
110
|
+
constructor(options?: CommandAcknowledgementTraceConfig | null);
|
|
111
|
+
static getSourceHash(): string;
|
|
112
|
+
onModuleInit(): void;
|
|
113
|
+
onModuleDestroy(): void;
|
|
114
|
+
isEnabled(): boolean;
|
|
115
|
+
waitForExports(): Promise<void>;
|
|
116
|
+
attachSocket(socket: Socket): void;
|
|
117
|
+
recordGatewayEntry(socket: Socket, message: unknown): void;
|
|
118
|
+
recordHandlerStart(socket: Socket, message: unknown, handlerName: string): void;
|
|
119
|
+
recordHandlerSettled(socket: Socket, message: unknown, handlerName: string, outcome: 'resolved' | 'null' | 'rejected'): void;
|
|
120
|
+
recordHandlerSkipped(socket: Socket, message: unknown, handlerName: string): void;
|
|
121
|
+
recordGatewayReturn(socket: Socket, message: unknown, status: 'ok' | 'error'): void;
|
|
122
|
+
recordGatewayThrow(socket: Socket, message: unknown): void;
|
|
123
|
+
recordSocketClose(socket: Socket, reason: string): void;
|
|
124
|
+
getSnapshot(): CommandAcknowledgementTraceSnapshot | null;
|
|
125
|
+
private observeSocketPacket;
|
|
126
|
+
private wrapAcknowledgement;
|
|
127
|
+
private static createAcknowledgementWrapper;
|
|
128
|
+
private recordForGateway;
|
|
129
|
+
private findRequestFromGatewayMessage;
|
|
130
|
+
private findRequest;
|
|
131
|
+
private matchesTarget;
|
|
132
|
+
private bindSocket;
|
|
133
|
+
private isCurrentSocket;
|
|
134
|
+
private removeObservedSocketListener;
|
|
135
|
+
private startTimer;
|
|
136
|
+
private close;
|
|
137
|
+
private invalidate;
|
|
138
|
+
private record;
|
|
139
|
+
private scheduleSnapshot;
|
|
140
|
+
private createSnapshot;
|
|
141
|
+
private handleExportFailure;
|
|
142
|
+
}
|
|
143
|
+
export {};
|
|
@@ -0,0 +1,523 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var CommandAcknowledgementTraceService_1;
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.CommandAcknowledgementTraceService = exports.CommandAcknowledgementSnapshotWriter = exports.COMMAND_ACKNOWLEDGEMENT_TRACE_OPTIONS = void 0;
|
|
17
|
+
const node_crypto_1 = require("node:crypto");
|
|
18
|
+
const node_fs_1 = require("node:fs");
|
|
19
|
+
const promises_1 = require("node:fs/promises");
|
|
20
|
+
const node_path_1 = require("node:path");
|
|
21
|
+
const node_perf_hooks_1 = require("node:perf_hooks");
|
|
22
|
+
const common_1 = require("@nestjs/common");
|
|
23
|
+
const COMMAND_EVENT = 'command';
|
|
24
|
+
const PROPERTY_SET_EVENT = 'DevicesModule.ChannelProperty.Set';
|
|
25
|
+
const MAX_CONFIGURATION_BYTES = 8 * 1024;
|
|
26
|
+
const MAX_CAPTURE_DURATION_MS = 30_000;
|
|
27
|
+
const MAX_RECORDS = 256;
|
|
28
|
+
const MAX_SNAPSHOT_BYTES = 256 * 1024;
|
|
29
|
+
const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
30
|
+
exports.COMMAND_ACKNOWLEDGEMENT_TRACE_OPTIONS = Symbol('COMMAND_ACKNOWLEDGEMENT_TRACE_OPTIONS');
|
|
31
|
+
const commandAcknowledgementTraceFileSystem = { lstat: promises_1.lstat, link: promises_1.link, open: promises_1.open, rename: promises_1.rename, rm: promises_1.rm };
|
|
32
|
+
class CommandAcknowledgementSnapshotWriter {
|
|
33
|
+
constructor(destination, onFailure, fileSystem = commandAcknowledgementTraceFileSystem) {
|
|
34
|
+
this.destination = destination;
|
|
35
|
+
this.onFailure = onFailure;
|
|
36
|
+
this.fileSystem = fileSystem;
|
|
37
|
+
this.writing = false;
|
|
38
|
+
this.pending = null;
|
|
39
|
+
this.ownedDestination = false;
|
|
40
|
+
this.idleWaiters = new Set();
|
|
41
|
+
}
|
|
42
|
+
queue(snapshot) {
|
|
43
|
+
this.pending = snapshot;
|
|
44
|
+
if (!this.writing) {
|
|
45
|
+
void this.drain();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async waitForIdle() {
|
|
49
|
+
if (!this.writing && this.pending === null) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
await new Promise((resolve) => this.idleWaiters.add(resolve));
|
|
53
|
+
}
|
|
54
|
+
async drain() {
|
|
55
|
+
this.writing = true;
|
|
56
|
+
try {
|
|
57
|
+
while (this.pending !== null) {
|
|
58
|
+
const snapshot = this.pending;
|
|
59
|
+
this.pending = null;
|
|
60
|
+
try {
|
|
61
|
+
await this.write(snapshot);
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
this.pending = null;
|
|
65
|
+
this.onFailure();
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
finally {
|
|
71
|
+
this.writing = false;
|
|
72
|
+
for (const resolve of this.idleWaiters) {
|
|
73
|
+
resolve();
|
|
74
|
+
}
|
|
75
|
+
this.idleWaiters.clear();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
async write(snapshot) {
|
|
79
|
+
if (!this.ownedDestination) {
|
|
80
|
+
await this.assertDestinationIsAbsent();
|
|
81
|
+
}
|
|
82
|
+
const temporaryPath = (0, node_path_1.join)((0, node_path_1.dirname)(this.destination), `.${(0, node_path_1.basename)(this.destination)}.${(0, node_crypto_1.randomUUID)()}.tmp`);
|
|
83
|
+
try {
|
|
84
|
+
const file = await this.fileSystem.open(temporaryPath, 'wx', 0o600);
|
|
85
|
+
try {
|
|
86
|
+
await file.writeFile(`${JSON.stringify(snapshot)}\n`, 'utf8');
|
|
87
|
+
await file.chmod(0o600);
|
|
88
|
+
await file.sync();
|
|
89
|
+
}
|
|
90
|
+
finally {
|
|
91
|
+
await file.close();
|
|
92
|
+
}
|
|
93
|
+
if (this.ownedDestination) {
|
|
94
|
+
await this.fileSystem.rename(temporaryPath, this.destination);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
await this.fileSystem.link(temporaryPath, this.destination);
|
|
98
|
+
}
|
|
99
|
+
this.ownedDestination = true;
|
|
100
|
+
await this.syncParentDirectory();
|
|
101
|
+
}
|
|
102
|
+
finally {
|
|
103
|
+
await this.fileSystem.rm(temporaryPath, { force: true }).catch(() => undefined);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
async assertDestinationIsAbsent() {
|
|
107
|
+
try {
|
|
108
|
+
await this.fileSystem.lstat(this.destination);
|
|
109
|
+
throw new Error('The acknowledgement trace destination already exists.');
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
if (error.code !== 'ENOENT') {
|
|
113
|
+
throw error;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
async syncParentDirectory() {
|
|
118
|
+
const directory = await this.fileSystem.open((0, node_path_1.dirname)(this.destination), 'r');
|
|
119
|
+
try {
|
|
120
|
+
await directory.sync();
|
|
121
|
+
}
|
|
122
|
+
finally {
|
|
123
|
+
await directory.close();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
exports.CommandAcknowledgementSnapshotWriter = CommandAcknowledgementSnapshotWriter;
|
|
128
|
+
let CommandAcknowledgementTraceService = CommandAcknowledgementTraceService_1 = class CommandAcknowledgementTraceService {
|
|
129
|
+
constructor(options) {
|
|
130
|
+
this.runtimeSourceHash = CommandAcknowledgementTraceService_1.getSourceHash();
|
|
131
|
+
this.processInstanceId = (0, node_crypto_1.randomUUID)();
|
|
132
|
+
this.requests = new Map();
|
|
133
|
+
this.attachedSockets = new WeakSet();
|
|
134
|
+
this.disconnectListeners = new WeakMap();
|
|
135
|
+
this.socketContext = null;
|
|
136
|
+
this.state = 'armed';
|
|
137
|
+
this.cutoffReason = null;
|
|
138
|
+
this.records = [];
|
|
139
|
+
this.nextSequence = 1;
|
|
140
|
+
this.nextSnapshotSequence = 1;
|
|
141
|
+
this.timer = null;
|
|
142
|
+
this.exportFailed = false;
|
|
143
|
+
this.config = normalizeConfig(options ?? parseEnvironmentConfig());
|
|
144
|
+
this.configFingerprint = this.config === null ? null : fingerprintConfig(this.config);
|
|
145
|
+
this.writer =
|
|
146
|
+
this.config === null
|
|
147
|
+
? null
|
|
148
|
+
: new CommandAcknowledgementSnapshotWriter(this.config.exportPath, () => this.handleExportFailure());
|
|
149
|
+
for (const request of this.config?.requests ?? []) {
|
|
150
|
+
this.requests.set(request.requestId, { ...request, seen: false, ackCalls: 0 });
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
static getSourceHash() {
|
|
154
|
+
try {
|
|
155
|
+
return (0, node_crypto_1.createHash)('sha256').update((0, node_fs_1.readFileSync)(__filename, 'utf8')).digest('hex');
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
return (0, node_crypto_1.createHash)('sha256').update(CommandAcknowledgementTraceService_1.toString()).digest('hex');
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
onModuleInit() {
|
|
162
|
+
this.scheduleSnapshot();
|
|
163
|
+
}
|
|
164
|
+
onModuleDestroy() {
|
|
165
|
+
if (!this.isEnabled()) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
if (this.state !== 'invalid') {
|
|
169
|
+
this.close('backend-shutdown');
|
|
170
|
+
}
|
|
171
|
+
this.removeObservedSocketListener();
|
|
172
|
+
}
|
|
173
|
+
isEnabled() {
|
|
174
|
+
return this.config !== null;
|
|
175
|
+
}
|
|
176
|
+
async waitForExports() {
|
|
177
|
+
await this.writer?.waitForIdle();
|
|
178
|
+
}
|
|
179
|
+
attachSocket(socket) {
|
|
180
|
+
if (!this.isEnabled() || this.attachedSockets.has(socket)) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
this.attachedSockets.add(socket);
|
|
184
|
+
if (typeof socket.use === 'function') {
|
|
185
|
+
socket.use((packet, next) => {
|
|
186
|
+
try {
|
|
187
|
+
this.observeSocketPacket(socket, packet);
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
}
|
|
191
|
+
next();
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
if (typeof socket.on === 'function') {
|
|
195
|
+
const disconnectListener = (reason) => {
|
|
196
|
+
this.recordSocketClose(socket, toBoundedReason(reason));
|
|
197
|
+
};
|
|
198
|
+
socket.on('disconnect', disconnectListener);
|
|
199
|
+
this.disconnectListeners.set(socket, disconnectListener);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
recordGatewayEntry(socket, message) {
|
|
203
|
+
this.recordForGateway(socket, message, 'gateway-entry');
|
|
204
|
+
}
|
|
205
|
+
recordHandlerStart(socket, message, handlerName) {
|
|
206
|
+
this.recordForGateway(socket, message, 'handler-start', { handler: boundedHandlerName(handlerName) });
|
|
207
|
+
}
|
|
208
|
+
recordHandlerSettled(socket, message, handlerName, outcome) {
|
|
209
|
+
this.recordForGateway(socket, message, 'handler-settled', { handler: boundedHandlerName(handlerName), outcome });
|
|
210
|
+
}
|
|
211
|
+
recordHandlerSkipped(socket, message, handlerName) {
|
|
212
|
+
this.recordForGateway(socket, message, 'handler-skipped', {
|
|
213
|
+
handler: boundedHandlerName(handlerName),
|
|
214
|
+
reason: 'authorization',
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
recordGatewayReturn(socket, message, status) {
|
|
218
|
+
this.recordForGateway(socket, message, 'gateway-return', { status });
|
|
219
|
+
}
|
|
220
|
+
recordGatewayThrow(socket, message) {
|
|
221
|
+
this.recordForGateway(socket, message, 'gateway-throw');
|
|
222
|
+
}
|
|
223
|
+
recordSocketClose(socket, reason) {
|
|
224
|
+
if (!this.isCurrentSocket(socket) || this.state === 'invalid') {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
for (const request of this.requests.values()) {
|
|
228
|
+
if (request.seen) {
|
|
229
|
+
this.record(request, 'socket-close', { reason });
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
this.close('socket-closed');
|
|
233
|
+
this.removeObservedSocketListener();
|
|
234
|
+
}
|
|
235
|
+
getSnapshot() {
|
|
236
|
+
return this.config === null ? null : this.createSnapshot();
|
|
237
|
+
}
|
|
238
|
+
observeSocketPacket(socket, packet) {
|
|
239
|
+
if (this.state === 'closed' || this.state === 'invalid') {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
if (packet[0] !== COMMAND_EVENT || !isPlainObject(packet[1])) {
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
const message = packet[1];
|
|
246
|
+
if (!isPlainObject(message.payload)) {
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
const request = this.findRequest(message.payload.request_id);
|
|
250
|
+
if (request === null) {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
if (message.event !== PROPERTY_SET_EVENT || !this.matchesTarget(request, message.payload)) {
|
|
254
|
+
this.invalidate('scope-mismatch');
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
if (!this.bindSocket(socket)) {
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
if (request.seen) {
|
|
261
|
+
this.invalidate('duplicate-request');
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
request.seen = true;
|
|
265
|
+
this.record(request, 'socket-receipt');
|
|
266
|
+
this.startTimer();
|
|
267
|
+
const acknowledgement = packet.at(-1);
|
|
268
|
+
if (isAcknowledgementFunction(acknowledgement)) {
|
|
269
|
+
packet[packet.length - 1] = this.wrapAcknowledgement(request, acknowledgement);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
wrapAcknowledgement(request, acknowledgement) {
|
|
273
|
+
return CommandAcknowledgementTraceService_1.createAcknowledgementWrapper(this, request, acknowledgement);
|
|
274
|
+
}
|
|
275
|
+
static createAcknowledgementWrapper(trace, request, acknowledgement) {
|
|
276
|
+
return function acknowledgementTraceWrapper(...args) {
|
|
277
|
+
request.ackCalls++;
|
|
278
|
+
trace.record(request, 'ack-invoked', { callCount: request.ackCalls });
|
|
279
|
+
try {
|
|
280
|
+
const result = acknowledgement.call(this, ...args);
|
|
281
|
+
trace.record(request, 'ack-returned', { callCount: request.ackCalls });
|
|
282
|
+
return result;
|
|
283
|
+
}
|
|
284
|
+
catch (error) {
|
|
285
|
+
trace.record(request, 'ack-threw', { callCount: request.ackCalls });
|
|
286
|
+
throw error;
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
recordForGateway(socket, message, stage, metadata) {
|
|
291
|
+
if (this.state === 'invalid' || !this.isCurrentSocket(socket) || !isPlainObject(message)) {
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
const request = this.findRequestFromGatewayMessage(message);
|
|
295
|
+
if (request !== null && request.seen) {
|
|
296
|
+
this.record(request, stage, metadata);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
findRequestFromGatewayMessage(message) {
|
|
300
|
+
if (message.event !== PROPERTY_SET_EVENT || !isPlainObject(message.payload)) {
|
|
301
|
+
return null;
|
|
302
|
+
}
|
|
303
|
+
const request = this.findRequest(message.payload.request_id);
|
|
304
|
+
return request !== null && this.matchesTarget(request, message.payload) ? request : null;
|
|
305
|
+
}
|
|
306
|
+
findRequest(value) {
|
|
307
|
+
return typeof value === 'string' ? (this.requests.get(value) ?? null) : null;
|
|
308
|
+
}
|
|
309
|
+
matchesTarget(request, payload) {
|
|
310
|
+
if (this.config === null || !isPlainObject(payload)) {
|
|
311
|
+
return false;
|
|
312
|
+
}
|
|
313
|
+
const properties = payload.properties;
|
|
314
|
+
if (!Array.isArray(properties) || properties.length !== 1 || !isPlainObject(properties[0])) {
|
|
315
|
+
return false;
|
|
316
|
+
}
|
|
317
|
+
const property = properties[0];
|
|
318
|
+
return (property.device === this.config.target.deviceId &&
|
|
319
|
+
property.channel === this.config.target.channelId &&
|
|
320
|
+
property.property === this.config.target.propertyId &&
|
|
321
|
+
property.value === request.value);
|
|
322
|
+
}
|
|
323
|
+
bindSocket(socket) {
|
|
324
|
+
if (this.socketContext === null) {
|
|
325
|
+
const disconnectListener = this.disconnectListeners.get(socket);
|
|
326
|
+
if (disconnectListener === undefined) {
|
|
327
|
+
this.invalidate('socket-listener-unavailable');
|
|
328
|
+
return false;
|
|
329
|
+
}
|
|
330
|
+
this.socketContext = { socket, socketTraceId: (0, node_crypto_1.randomUUID)(), disconnectListener };
|
|
331
|
+
return true;
|
|
332
|
+
}
|
|
333
|
+
if (this.socketContext.socket !== socket) {
|
|
334
|
+
this.invalidate('socket-mismatch');
|
|
335
|
+
return false;
|
|
336
|
+
}
|
|
337
|
+
return true;
|
|
338
|
+
}
|
|
339
|
+
isCurrentSocket(socket) {
|
|
340
|
+
return this.socketContext?.socket === socket;
|
|
341
|
+
}
|
|
342
|
+
removeObservedSocketListener() {
|
|
343
|
+
if (this.socketContext === null || typeof this.socketContext.socket.off !== 'function') {
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
this.socketContext.socket.off('disconnect', this.socketContext.disconnectListener);
|
|
347
|
+
}
|
|
348
|
+
startTimer() {
|
|
349
|
+
if (this.timer !== null || this.config === null) {
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
this.timer = setTimeout(() => this.close('capture-duration-elapsed'), this.config.captureDurationMs);
|
|
353
|
+
this.timer.unref();
|
|
354
|
+
}
|
|
355
|
+
close(reason) {
|
|
356
|
+
if (this.state === 'invalid' || this.state === 'closed') {
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
this.state = 'closed';
|
|
360
|
+
this.cutoffReason = reason;
|
|
361
|
+
if (this.timer !== null) {
|
|
362
|
+
clearTimeout(this.timer);
|
|
363
|
+
this.timer = null;
|
|
364
|
+
}
|
|
365
|
+
this.scheduleSnapshot();
|
|
366
|
+
}
|
|
367
|
+
invalidate(reason) {
|
|
368
|
+
if (this.state === 'invalid') {
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
this.state = 'invalid';
|
|
372
|
+
this.cutoffReason = reason;
|
|
373
|
+
if (this.timer !== null) {
|
|
374
|
+
clearTimeout(this.timer);
|
|
375
|
+
this.timer = null;
|
|
376
|
+
}
|
|
377
|
+
this.scheduleSnapshot();
|
|
378
|
+
}
|
|
379
|
+
record(request, stage, metadata) {
|
|
380
|
+
if (this.state === 'closed' || this.state === 'invalid' || this.config === null) {
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
if (this.records.length >= this.config.maxRecords) {
|
|
384
|
+
this.invalidate('record-limit-exceeded');
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
this.state = 'recording';
|
|
388
|
+
this.records.push(Object.freeze({
|
|
389
|
+
sequence: this.nextSequence++,
|
|
390
|
+
monotonicMs: node_perf_hooks_1.performance.now(),
|
|
391
|
+
stage,
|
|
392
|
+
phase: request.phase,
|
|
393
|
+
requestId: request.requestId,
|
|
394
|
+
metadata: metadata === undefined ? undefined : Object.freeze({ ...metadata }),
|
|
395
|
+
}));
|
|
396
|
+
this.scheduleSnapshot();
|
|
397
|
+
}
|
|
398
|
+
scheduleSnapshot() {
|
|
399
|
+
if (this.config === null || this.writer === null || this.exportFailed) {
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
const snapshot = this.createSnapshot();
|
|
403
|
+
if (Buffer.byteLength(JSON.stringify(snapshot), 'utf8') > MAX_SNAPSHOT_BYTES) {
|
|
404
|
+
this.records = [];
|
|
405
|
+
this.invalidate('snapshot-size-exceeded');
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
this.writer.queue(snapshot);
|
|
409
|
+
}
|
|
410
|
+
createSnapshot() {
|
|
411
|
+
if (this.config === null || this.configFingerprint === null) {
|
|
412
|
+
throw new Error('Acknowledgement tracing is disabled.');
|
|
413
|
+
}
|
|
414
|
+
return Object.freeze({
|
|
415
|
+
schemaVersion: 1,
|
|
416
|
+
snapshotSequence: this.nextSnapshotSequence++,
|
|
417
|
+
snapshotMonotonicMs: node_perf_hooks_1.performance.now(),
|
|
418
|
+
configFingerprint: this.configFingerprint,
|
|
419
|
+
process: Object.freeze({
|
|
420
|
+
id: process.pid,
|
|
421
|
+
instanceId: this.processInstanceId,
|
|
422
|
+
runtimeSourceHash: this.runtimeSourceHash,
|
|
423
|
+
}),
|
|
424
|
+
runId: this.config.runId,
|
|
425
|
+
target: Object.freeze({ ...this.config.target }),
|
|
426
|
+
state: this.state,
|
|
427
|
+
cutoffReason: this.cutoffReason,
|
|
428
|
+
socketTraceId: this.socketContext?.socketTraceId ?? null,
|
|
429
|
+
requests: Object.freeze([...this.requests.values()].map((request) => Object.freeze({
|
|
430
|
+
phase: request.phase,
|
|
431
|
+
requestId: request.requestId,
|
|
432
|
+
value: request.value,
|
|
433
|
+
status: request.seen ? 'received' : 'not-observed',
|
|
434
|
+
acknowledgementCalls: request.ackCalls,
|
|
435
|
+
}))),
|
|
436
|
+
records: Object.freeze([...this.records]),
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
handleExportFailure() {
|
|
440
|
+
if (this.exportFailed) {
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
this.exportFailed = true;
|
|
444
|
+
this.invalidate('export-failed');
|
|
445
|
+
}
|
|
446
|
+
};
|
|
447
|
+
exports.CommandAcknowledgementTraceService = CommandAcknowledgementTraceService;
|
|
448
|
+
exports.CommandAcknowledgementTraceService = CommandAcknowledgementTraceService = CommandAcknowledgementTraceService_1 = __decorate([
|
|
449
|
+
(0, common_1.Injectable)(),
|
|
450
|
+
__param(0, (0, common_1.Optional)()),
|
|
451
|
+
__param(0, (0, common_1.Inject)(exports.COMMAND_ACKNOWLEDGEMENT_TRACE_OPTIONS)),
|
|
452
|
+
__metadata("design:paramtypes", [Object])
|
|
453
|
+
], CommandAcknowledgementTraceService);
|
|
454
|
+
function parseEnvironmentConfig() {
|
|
455
|
+
const raw = process.env.FB_COMMAND_ACK_TRACE;
|
|
456
|
+
if (!raw || Buffer.byteLength(raw, 'utf8') > MAX_CONFIGURATION_BYTES) {
|
|
457
|
+
return null;
|
|
458
|
+
}
|
|
459
|
+
try {
|
|
460
|
+
return JSON.parse(raw);
|
|
461
|
+
}
|
|
462
|
+
catch {
|
|
463
|
+
return null;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
function normalizeConfig(config) {
|
|
467
|
+
if (config === null ||
|
|
468
|
+
!isPlainObject(config) ||
|
|
469
|
+
config.schemaVersion !== 1 ||
|
|
470
|
+
!isUuid(config.runId) ||
|
|
471
|
+
!isUuid(config.target?.deviceId) ||
|
|
472
|
+
!isUuid(config.target?.channelId) ||
|
|
473
|
+
!isUuid(config.target?.propertyId) ||
|
|
474
|
+
typeof config.exportPath !== 'string' ||
|
|
475
|
+
!(0, node_path_1.isAbsolute)(config.exportPath) ||
|
|
476
|
+
!Array.isArray(config.requests) ||
|
|
477
|
+
config.requests.length !== 2) {
|
|
478
|
+
return null;
|
|
479
|
+
}
|
|
480
|
+
const [first, second] = config.requests;
|
|
481
|
+
if (!isPlainObject(first) ||
|
|
482
|
+
!isPlainObject(second) ||
|
|
483
|
+
first.phase !== 'trial' ||
|
|
484
|
+
second.phase !== 'restoration' ||
|
|
485
|
+
!isUuid(first.requestId) ||
|
|
486
|
+
!isUuid(second.requestId) ||
|
|
487
|
+
first.requestId === second.requestId ||
|
|
488
|
+
typeof first.value !== 'boolean' ||
|
|
489
|
+
typeof second.value !== 'boolean' ||
|
|
490
|
+
first.value === second.value) {
|
|
491
|
+
return null;
|
|
492
|
+
}
|
|
493
|
+
const captureDurationMs = config.captureDurationMs ?? MAX_CAPTURE_DURATION_MS;
|
|
494
|
+
const maxRecords = config.maxRecords ?? MAX_RECORDS;
|
|
495
|
+
if (!Number.isInteger(captureDurationMs) ||
|
|
496
|
+
captureDurationMs <= 0 ||
|
|
497
|
+
captureDurationMs > MAX_CAPTURE_DURATION_MS ||
|
|
498
|
+
!Number.isInteger(maxRecords) ||
|
|
499
|
+
maxRecords <= 0 ||
|
|
500
|
+
maxRecords > MAX_RECORDS) {
|
|
501
|
+
return null;
|
|
502
|
+
}
|
|
503
|
+
return Object.freeze({ ...config, captureDurationMs, maxRecords });
|
|
504
|
+
}
|
|
505
|
+
function isUuid(value) {
|
|
506
|
+
return typeof value === 'string' && UUID_PATTERN.test(value);
|
|
507
|
+
}
|
|
508
|
+
function isPlainObject(value) {
|
|
509
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
510
|
+
}
|
|
511
|
+
function isAcknowledgementFunction(value) {
|
|
512
|
+
return typeof value === 'function';
|
|
513
|
+
}
|
|
514
|
+
function fingerprintConfig(config) {
|
|
515
|
+
return (0, node_crypto_1.createHash)('sha256').update(JSON.stringify(config)).digest('hex');
|
|
516
|
+
}
|
|
517
|
+
function boundedHandlerName(handlerName) {
|
|
518
|
+
return handlerName.slice(0, 160);
|
|
519
|
+
}
|
|
520
|
+
function toBoundedReason(reason) {
|
|
521
|
+
return typeof reason === 'string' && reason.length > 0 ? reason.slice(0, 160) : 'unknown';
|
|
522
|
+
}
|
|
523
|
+
//# sourceMappingURL=command-acknowledgement-trace.service.js.map
|