matter-all-in-one-addon 2.3.1 → 2.3.13
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/README.md +16 -8
- package/dist/camera/ai/camera-ai-detector.d.ts +0 -2
- package/dist/camera/ai/camera-ai-detector.js +52 -57
- package/dist/camera/ai/camera-ai-detector.js.map +1 -1
- package/dist/camera/browser-preview.d.ts +9 -0
- package/dist/camera/browser-preview.js +135 -0
- package/dist/camera/browser-preview.js.map +1 -0
- package/dist/camera/camera-source-resolver.js +5 -3
- package/dist/camera/camera-source-resolver.js.map +1 -1
- package/dist/camera/camera-types.d.ts +0 -2
- package/dist/camera/cameraui/cameraui-client.js +91 -30
- package/dist/camera/cameraui/cameraui-client.js.map +1 -1
- package/dist/camera/cameraui/cameraui-homekit-bridge.js +13 -4
- package/dist/camera/cameraui/cameraui-homekit-bridge.js.map +1 -1
- package/dist/camera/cameraui/cameraui-storage.js.map +1 -1
- package/dist/camera/cameraui/cameraui-types.d.ts +6 -2
- package/dist/camera/cameraui/ha-camera-entity.js +5 -2
- package/dist/camera/cameraui/ha-camera-entity.js.map +1 -1
- package/dist/camera/homekit/ffmpeg-helper.js +17 -35
- package/dist/camera/homekit/ffmpeg-helper.js.map +1 -1
- package/dist/camera/homekit/hevc/fmp4-hevc.js +3 -1
- package/dist/camera/homekit/hevc/fmp4-hevc.js.map +1 -1
- package/dist/camera/homekit/hevc/hevc-recording.d.ts +0 -2
- package/dist/camera/homekit/hevc/hevc-recording.js +28 -63
- package/dist/camera/homekit/hevc/hevc-recording.js.map +1 -1
- package/dist/camera/homekit/hevc/multi-tier-rtp.d.ts +1 -15
- package/dist/camera/homekit/hevc/multi-tier-rtp.js +70 -228
- package/dist/camera/homekit/hevc/multi-tier-rtp.js.map +1 -1
- package/dist/camera/homekit/hevc/sframe-rtp.d.ts +0 -2
- package/dist/camera/homekit/hevc/sframe-rtp.js +0 -25
- package/dist/camera/homekit/hevc/sframe-rtp.js.map +1 -1
- package/dist/camera/homekit/hevc/sframe.d.ts +1 -11
- package/dist/camera/homekit/hevc/sframe.js +18 -133
- package/dist/camera/homekit/hevc/sframe.js.map +1 -1
- package/dist/camera/homekit/hevc/types.js +81 -9
- package/dist/camera/homekit/hevc/types.js.map +1 -1
- package/dist/camera/homekit/hevc/webrtc-session.d.ts +3 -17
- package/dist/camera/homekit/hevc/webrtc-session.js +55 -229
- package/dist/camera/homekit/hevc/webrtc-session.js.map +1 -1
- package/dist/camera/homekit/homekit-camera-recording.delegate.d.ts +0 -1
- package/dist/camera/homekit/homekit-camera-recording.delegate.js +115 -43
- package/dist/camera/homekit/homekit-camera-recording.delegate.js.map +1 -1
- package/dist/camera/homekit/homekit-camera-stream.delegate.d.ts +4 -7
- package/dist/camera/homekit/homekit-camera-stream.delegate.js +388 -201
- package/dist/camera/homekit/homekit-camera-stream.delegate.js.map +1 -1
- package/dist/camera/homekit/homekit-camera.accessory.d.ts +7 -34
- package/dist/camera/homekit/homekit-camera.accessory.js +207 -169
- package/dist/camera/homekit/homekit-camera.accessory.js.map +1 -1
- package/dist/camera/homekit/live-view-telemetry.d.ts +0 -4
- package/dist/camera/homekit/live-view-telemetry.js.map +1 -1
- package/dist/camera/homekit/tuya-hap-talkback.d.ts +41 -0
- package/dist/camera/homekit/tuya-hap-talkback.js +326 -0
- package/dist/camera/homekit/tuya-hap-talkback.js.map +1 -0
- package/dist/camera/matter/camera-endpoint.builder.js +9 -7
- package/dist/camera/matter/camera-endpoint.builder.js.map +1 -1
- package/dist/camera/matter/camera-session-manager.d.ts +1 -0
- package/dist/camera/matter/camera-session-manager.js +2 -0
- package/dist/camera/matter/camera-session-manager.js.map +1 -1
- package/dist/camera/matter/camera-webrtc-adapter.js +32 -15
- package/dist/camera/matter/camera-webrtc-adapter.js.map +1 -1
- package/dist/camera/motion/ffmpeg-motion-detector.js +28 -14
- package/dist/camera/motion/ffmpeg-motion-detector.js.map +1 -1
- package/dist/camera/nest/nest-camera-adapter.js +9 -5
- package/dist/camera/nest/nest-camera-adapter.js.map +1 -1
- package/dist/camera/ptz/ptz-capabilities.js +3 -1
- package/dist/camera/ptz/ptz-capabilities.js.map +1 -1
- package/dist/camera/ptz/ptz-legacy-discovery.js.map +1 -1
- package/dist/camera/ptz/ptz-mqtt-publisher.js +50 -12
- package/dist/camera/ptz/ptz-mqtt-publisher.js.map +1 -1
- package/dist/camera/ptz/ptz-zones-manager.js +6 -1
- package/dist/camera/ptz/ptz-zones-manager.js.map +1 -1
- package/dist/camera/scrypted/scrypted-camera-card.js +3 -1
- package/dist/camera/scrypted/scrypted-camera-card.js.map +1 -1
- package/dist/camera/scrypted/scrypted-camera-discovery-adapter.js +7 -5
- package/dist/camera/scrypted/scrypted-camera-discovery-adapter.js.map +1 -1
- package/dist/camera/scrypted/scrypted-client-discovery-adapter.js.map +1 -1
- package/dist/camera/scrypted/scrypted-client.js +6 -5
- package/dist/camera/scrypted/scrypted-client.js.map +1 -1
- package/dist/camera/scrypted/scrypted-discovery-provider.js.map +1 -1
- package/dist/camera/scrypted/scrypted-homekit-bridge.js +6 -4
- package/dist/camera/scrypted/scrypted-homekit-bridge.js.map +1 -1
- package/dist/camera/scrypted/scrypted-reconnect-manager.js.map +1 -1
- package/dist/camera/scrypted/scrypted-runtime-facade.js +2 -2
- package/dist/camera/scrypted/scrypted-runtime-facade.js.map +1 -1
- package/dist/camera/scrypted/scrypted-runtime-ingest.js +3 -1
- package/dist/camera/scrypted/scrypted-runtime-ingest.js.map +1 -1
- package/dist/camera/scrypted/scrypted-storage.js +12 -6
- package/dist/camera/scrypted/scrypted-storage.js.map +1 -1
- package/dist/camera/scrypted/scrypted-stream-validator.js +25 -7
- package/dist/camera/scrypted/scrypted-stream-validator.js.map +1 -1
- package/dist/camera/tuya-webrtc-session.d.ts +53 -0
- package/dist/camera/tuya-webrtc-session.js +261 -0
- package/dist/camera/tuya-webrtc-session.js.map +1 -0
- package/dist/converters/sensor.converter.js +4 -1
- package/dist/converters/sensor.converter.js.map +1 -1
- package/dist/device-profiles.js +3 -1
- package/dist/device-profiles.js.map +1 -1
- package/dist/entities/air_quality.entity.js +3 -1
- package/dist/entities/air_quality.entity.js.map +1 -1
- package/dist/entities/base.entity.js +45 -17
- package/dist/entities/base.entity.js.map +1 -1
- package/dist/entities/camera.entity.d.ts +1 -0
- package/dist/entities/camera.entity.js +24 -2
- package/dist/entities/camera.entity.js.map +1 -1
- package/dist/entities/composite-device.entity.js +37 -13
- package/dist/entities/composite-device.entity.js.map +1 -1
- package/dist/entities/energy_tariff.entity.js.map +1 -1
- package/dist/entities/pet_feeder.entity.d.ts +1 -0
- package/dist/entities/pet_feeder.entity.js +12 -0
- package/dist/entities/pet_feeder.entity.js.map +1 -1
- package/dist/entities/vacuum.entity.js +16 -5
- package/dist/entities/vacuum.entity.js.map +1 -1
- package/dist/frontend/assets/index-1k-iTL-m.js +26 -0
- package/dist/frontend/assets/{index-NrzHqycm.css → index-CJdlkpIy.css} +1 -1
- package/dist/frontend/index.html +2 -2
- package/dist/hap/hap-generic-accessory.d.ts +4 -0
- package/dist/hap/hap-generic-accessory.js +512 -122
- package/dist/hap/hap-generic-accessory.js.map +1 -1
- package/dist/homeAssistant.d.ts +1 -0
- package/dist/homeAssistant.js +23 -5
- package/dist/homeAssistant.js.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/mqtt/mqtt-client.js.map +1 -1
- package/dist/mqtt/mqtt.entity.js +41 -17
- package/dist/mqtt/mqtt.entity.js.map +1 -1
- package/dist/platform.d.ts +1 -0
- package/dist/platform.js +83 -13
- package/dist/platform.js.map +1 -1
- package/dist/utils/atomic-json-store.js +5 -1
- package/dist/utils/atomic-json-store.js.map +1 -1
- package/dist/utils/ha-state.js +3 -1
- package/dist/utils/ha-state.js.map +1 -1
- package/dist/utils/light-color.js +3 -5
- package/dist/utils/light-color.js.map +1 -1
- package/dist/utils/matter-command-response.js.map +1 -1
- package/dist/utils/matter-firmware.js +1 -2
- package/dist/utils/matter-firmware.js.map +1 -1
- package/dist/utils/matter-protocol.d.ts +1 -0
- package/dist/utils/matter-protocol.js +30 -0
- package/dist/utils/matter-protocol.js.map +1 -0
- package/package.json +27 -19
- package/dist/camera/camera-entity-control.d.ts +0 -12
- package/dist/camera/camera-entity-control.js +0 -24
- package/dist/camera/camera-entity-control.js.map +0 -1
- package/dist/camera/homekit/hevc/bootstrap.d.ts +0 -9
- package/dist/camera/homekit/hevc/bootstrap.js +0 -47
- package/dist/camera/homekit/hevc/bootstrap.js.map +0 -1
- package/dist/camera/homekit/hevc/recording-output.d.ts +0 -2
- package/dist/camera/homekit/hevc/recording-output.js +0 -33
- package/dist/camera/homekit/hevc/recording-output.js.map +0 -1
- package/dist/camera/homekit/media-policy.d.ts +0 -25
- package/dist/camera/homekit/media-policy.js +0 -102
- package/dist/camera/homekit/media-policy.js.map +0 -1
- package/dist/camera/homekit/route-address.d.ts +0 -2
- package/dist/camera/homekit/route-address.js +0 -27
- package/dist/camera/homekit/route-address.js.map +0 -1
- package/dist/camera/homekit/rtp-relay.d.ts +0 -21
- package/dist/camera/homekit/rtp-relay.js +0 -112
- package/dist/camera/homekit/rtp-relay.js.map +0 -1
- package/dist/camera/homekit/startup-timing.d.ts +0 -8
- package/dist/camera/homekit/startup-timing.js +0 -14
- package/dist/camera/homekit/startup-timing.js.map +0 -1
- package/dist/camera/source-adapter.d.ts +0 -132
- package/dist/camera/source-adapter.js +0 -282
- package/dist/camera/source-adapter.js.map +0 -1
- package/dist/frontend/assets/index-Bka3TVAQ.js +0 -21
- package/vendor/hap-nodejs/LICENSE +0 -176
- package/vendor/hap-nodejs/MIAO.md +0 -5
- package/vendor/hap-nodejs/PATCH.md +0 -37
- package/vendor/hap-nodejs/README.md +0 -86
- package/vendor/hap-nodejs/dist/accessories/AirConditioner_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/AirConditioner_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/AirConditioner_accessory.js +0 -128
- package/vendor/hap-nodejs/dist/accessories/AirConditioner_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/AppleTVRemote_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/AppleTVRemote_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/AppleTVRemote_accessory.js +0 -159
- package/vendor/hap-nodejs/dist/accessories/AppleTVRemote_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Camera_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/Camera_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Camera_accessory.js +0 -545
- package/vendor/hap-nodejs/dist/accessories/Camera_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Fan_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/Fan_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Fan_accessory.js +0 -74
- package/vendor/hap-nodejs/dist/accessories/Fan_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/GarageDoorOpener_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/GarageDoorOpener_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/GarageDoorOpener_accessory.js +0 -78
- package/vendor/hap-nodejs/dist/accessories/GarageDoorOpener_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Light-AdaptiveLighting_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/Light-AdaptiveLighting_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Light-AdaptiveLighting_accessory.js +0 -106
- package/vendor/hap-nodejs/dist/accessories/Light-AdaptiveLighting_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Light_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/Light_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Light_accessory.js +0 -145
- package/vendor/hap-nodejs/dist/accessories/Light_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Lock_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/Lock_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Lock_accessory.js +0 -76
- package/vendor/hap-nodejs/dist/accessories/Lock_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/MotionSensor_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/MotionSensor_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/MotionSensor_accessory.js +0 -45
- package/vendor/hap-nodejs/dist/accessories/MotionSensor_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Outlet_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/Outlet_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Outlet_accessory.js +0 -79
- package/vendor/hap-nodejs/dist/accessories/Outlet_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/SmartSpeaker_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/SmartSpeaker_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/SmartSpeaker_accessory.js +0 -44
- package/vendor/hap-nodejs/dist/accessories/SmartSpeaker_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Sprinkler_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/Sprinkler_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Sprinkler_accessory.js +0 -128
- package/vendor/hap-nodejs/dist/accessories/Sprinkler_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/TV_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/TV_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/TV_accessory.js +0 -101
- package/vendor/hap-nodejs/dist/accessories/TV_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/TemperatureSensor_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/TemperatureSensor_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/TemperatureSensor_accessory.js +0 -44
- package/vendor/hap-nodejs/dist/accessories/TemperatureSensor_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Wi-FiRouter_accessory.d.ts +0 -3
- package/vendor/hap-nodejs/dist/accessories/Wi-FiRouter_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Wi-FiRouter_accessory.js +0 -17
- package/vendor/hap-nodejs/dist/accessories/Wi-FiRouter_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Wi-FiSatellite_accessory.d.ts +0 -3
- package/vendor/hap-nodejs/dist/accessories/Wi-FiSatellite_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Wi-FiSatellite_accessory.js +0 -19
- package/vendor/hap-nodejs/dist/accessories/Wi-FiSatellite_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/gstreamer-audioProducer.d.ts +0 -25
- package/vendor/hap-nodejs/dist/accessories/gstreamer-audioProducer.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/gstreamer-audioProducer.js +0 -145
- package/vendor/hap-nodejs/dist/accessories/gstreamer-audioProducer.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/types.d.ts +0 -78
- package/vendor/hap-nodejs/dist/accessories/types.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/types.js +0 -88
- package/vendor/hap-nodejs/dist/accessories/types.js.map +0 -1
- package/vendor/hap-nodejs/dist/index.d.ts +0 -50
- package/vendor/hap-nodejs/dist/index.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/index.js +0 -54
- package/vendor/hap-nodejs/dist/index.js.map +0 -1
- package/vendor/hap-nodejs/dist/internal-types.d.ts +0 -76
- package/vendor/hap-nodejs/dist/internal-types.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/internal-types.js +0 -80
- package/vendor/hap-nodejs/dist/internal-types.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/Accessory.d.ts +0 -521
- package/vendor/hap-nodejs/dist/lib/Accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/Accessory.js +0 -1762
- package/vendor/hap-nodejs/dist/lib/Accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/Advertiser.d.ts +0 -190
- package/vendor/hap-nodejs/dist/lib/Advertiser.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/Advertiser.js +0 -592
- package/vendor/hap-nodejs/dist/lib/Advertiser.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/Bridge.d.ts +0 -12
- package/vendor/hap-nodejs/dist/lib/Bridge.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/Bridge.js +0 -19
- package/vendor/hap-nodejs/dist/lib/Bridge.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/Characteristic.d.ts +0 -1768
- package/vendor/hap-nodejs/dist/lib/Characteristic.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/Characteristic.js +0 -2532
- package/vendor/hap-nodejs/dist/lib/Characteristic.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/HAPServer.d.ts +0 -299
- package/vendor/hap-nodejs/dist/lib/HAPServer.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/HAPServer.js +0 -968
- package/vendor/hap-nodejs/dist/lib/HAPServer.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/Service.d.ts +0 -598
- package/vendor/hap-nodejs/dist/lib/Service.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/Service.js +0 -797
- package/vendor/hap-nodejs/dist/lib/Service.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/CMAFIngest.d.ts +0 -102
- package/vendor/hap-nodejs/dist/lib/camera/CMAFIngest.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/CMAFIngest.js +0 -317
- package/vendor/hap-nodejs/dist/lib/camera/CMAFIngest.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/HDSSnapshotTransport.d.ts +0 -38
- package/vendor/hap-nodejs/dist/lib/camera/HDSSnapshotTransport.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/HDSSnapshotTransport.js +0 -174
- package/vendor/hap-nodejs/dist/lib/camera/HDSSnapshotTransport.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/RTPProxy.d.ts +0 -59
- package/vendor/hap-nodejs/dist/lib/camera/RTPProxy.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/RTPProxy.js +0 -267
- package/vendor/hap-nodejs/dist/lib/camera/RTPProxy.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/RTPStreamManagement.d.ts +0 -379
- package/vendor/hap-nodejs/dist/lib/camera/RTPStreamManagement.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/RTPStreamManagement.js +0 -1021
- package/vendor/hap-nodejs/dist/lib/camera/RTPStreamManagement.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/RecordingManagement.d.ts +0 -325
- package/vendor/hap-nodejs/dist/lib/camera/RecordingManagement.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/RecordingManagement.js +0 -800
- package/vendor/hap-nodejs/dist/lib/camera/RecordingManagement.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/SecureVideoCredentials.d.ts +0 -20
- package/vendor/hap-nodejs/dist/lib/camera/SecureVideoCredentials.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/SecureVideoCredentials.js +0 -48
- package/vendor/hap-nodejs/dist/lib/camera/SecureVideoCredentials.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/SecureVideoTypes.d.ts +0 -618
- package/vendor/hap-nodejs/dist/lib/camera/SecureVideoTypes.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/SecureVideoTypes.js +0 -911
- package/vendor/hap-nodejs/dist/lib/camera/SecureVideoTypes.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/index.d.ts +0 -8
- package/vendor/hap-nodejs/dist/lib/camera/index.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/index.js +0 -11
- package/vendor/hap-nodejs/dist/lib/camera/index.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/AdaptiveLightingController.d.ts +0 -452
- package/vendor/hap-nodejs/dist/lib/controller/AdaptiveLightingController.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/AdaptiveLightingController.js +0 -868
- package/vendor/hap-nodejs/dist/lib/controller/AdaptiveLightingController.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/CameraController.d.ts +0 -410
- package/vendor/hap-nodejs/dist/lib/controller/CameraController.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/CameraController.js +0 -658
- package/vendor/hap-nodejs/dist/lib/controller/CameraController.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/Controller.d.ts +0 -197
- package/vendor/hap-nodejs/dist/lib/controller/Controller.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/Controller.js +0 -32
- package/vendor/hap-nodejs/dist/lib/controller/Controller.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/DoorbellController.d.ts +0 -59
- package/vendor/hap-nodejs/dist/lib/controller/DoorbellController.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/DoorbellController.js +0 -102
- package/vendor/hap-nodejs/dist/lib/controller/DoorbellController.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/RemoteController.d.ts +0 -434
- package/vendor/hap-nodejs/dist/lib/controller/RemoteController.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/RemoteController.js +0 -1178
- package/vendor/hap-nodejs/dist/lib/controller/RemoteController.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/SecureVideoController.d.ts +0 -380
- package/vendor/hap-nodejs/dist/lib/controller/SecureVideoController.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/SecureVideoController.js +0 -947
- package/vendor/hap-nodejs/dist/lib/controller/SecureVideoController.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/index.d.ts +0 -7
- package/vendor/hap-nodejs/dist/lib/controller/index.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/index.js +0 -10
- package/vendor/hap-nodejs/dist/lib/controller/index.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamManagement.d.ts +0 -73
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamManagement.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamManagement.js +0 -205
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamManagement.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamParser.d.ts +0 -186
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamParser.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamParser.js +0 -880
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamParser.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamServer.d.ts +0 -351
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamServer.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamServer.js +0 -878
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamServer.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/datastream/index.d.ts +0 -4
- package/vendor/hap-nodejs/dist/lib/datastream/index.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/datastream/index.js +0 -7
- package/vendor/hap-nodejs/dist/lib/datastream/index.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/definitions/CharacteristicDefinitions.d.ts +0 -2245
- package/vendor/hap-nodejs/dist/lib/definitions/CharacteristicDefinitions.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/definitions/CharacteristicDefinitions.js +0 -4957
- package/vendor/hap-nodejs/dist/lib/definitions/CharacteristicDefinitions.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/definitions/ServiceDefinitions.d.ts +0 -584
- package/vendor/hap-nodejs/dist/lib/definitions/ServiceDefinitions.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/definitions/ServiceDefinitions.js +0 -1518
- package/vendor/hap-nodejs/dist/lib/definitions/ServiceDefinitions.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/definitions/generate-definitions.d.ts +0 -34
- package/vendor/hap-nodejs/dist/lib/definitions/generate-definitions.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/definitions/generate-definitions.js +0 -624
- package/vendor/hap-nodejs/dist/lib/definitions/generate-definitions.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/definitions/generator-configuration.d.ts +0 -22
- package/vendor/hap-nodejs/dist/lib/definitions/generator-configuration.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/definitions/generator-configuration.js +0 -734
- package/vendor/hap-nodejs/dist/lib/definitions/generator-configuration.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/definitions/index.d.ts +0 -3
- package/vendor/hap-nodejs/dist/lib/definitions/index.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/definitions/index.js +0 -6
- package/vendor/hap-nodejs/dist/lib/definitions/index.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/gen/HomeKit.d.ts +0 -8
- package/vendor/hap-nodejs/dist/lib/gen/HomeKit.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/gen/HomeKit.js +0 -9
- package/vendor/hap-nodejs/dist/lib/gen/HomeKit.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/model/AccessoryInfo.d.ts +0 -91
- package/vendor/hap-nodejs/dist/lib/model/AccessoryInfo.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/model/AccessoryInfo.js +0 -311
- package/vendor/hap-nodejs/dist/lib/model/AccessoryInfo.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/model/ControllerStorage.d.ts +0 -46
- package/vendor/hap-nodejs/dist/lib/model/ControllerStorage.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/model/ControllerStorage.js +0 -277
- package/vendor/hap-nodejs/dist/lib/model/ControllerStorage.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/model/HAPFileStorage.d.ts +0 -75
- package/vendor/hap-nodejs/dist/lib/model/HAPFileStorage.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/model/HAPFileStorage.js +0 -190
- package/vendor/hap-nodejs/dist/lib/model/HAPFileStorage.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/model/HAPStorage.d.ts +0 -26
- package/vendor/hap-nodejs/dist/lib/model/HAPStorage.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/model/HAPStorage.js +0 -79
- package/vendor/hap-nodejs/dist/lib/model/HAPStorage.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/model/IdentifierCache.d.ts +0 -33
- package/vendor/hap-nodejs/dist/lib/model/IdentifierCache.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/model/IdentifierCache.js +0 -114
- package/vendor/hap-nodejs/dist/lib/model/IdentifierCache.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/tv/AccessControlManagement.d.ts +0 -83
- package/vendor/hap-nodejs/dist/lib/tv/AccessControlManagement.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/tv/AccessControlManagement.js +0 -127
- package/vendor/hap-nodejs/dist/lib/tv/AccessControlManagement.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/checkName.d.ts +0 -8
- package/vendor/hap-nodejs/dist/lib/util/checkName.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/checkName.js +0 -28
- package/vendor/hap-nodejs/dist/lib/util/checkName.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/clone.d.ts +0 -7
- package/vendor/hap-nodejs/dist/lib/util/clone.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/clone.js +0 -22
- package/vendor/hap-nodejs/dist/lib/util/clone.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/color-utils.d.ts +0 -18
- package/vendor/hap-nodejs/dist/lib/util/color-utils.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/color-utils.js +0 -442
- package/vendor/hap-nodejs/dist/lib/util/color-utils.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/eventedhttp.d.ts +0 -251
- package/vendor/hap-nodejs/dist/lib/util/eventedhttp.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/eventedhttp.js +0 -714
- package/vendor/hap-nodejs/dist/lib/util/eventedhttp.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/hapCrypto.d.ts +0 -50
- package/vendor/hap-nodejs/dist/lib/util/hapCrypto.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/hapCrypto.js +0 -185
- package/vendor/hap-nodejs/dist/lib/util/hapCrypto.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/hapStatusError.d.ts +0 -16
- package/vendor/hap-nodejs/dist/lib/util/hapStatusError.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/hapStatusError.js +0 -29
- package/vendor/hap-nodejs/dist/lib/util/hapStatusError.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/net-utils.d.ts +0 -21
- package/vendor/hap-nodejs/dist/lib/util/net-utils.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/net-utils.js +0 -79
- package/vendor/hap-nodejs/dist/lib/util/net-utils.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/once.d.ts +0 -7
- package/vendor/hap-nodejs/dist/lib/util/once.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/once.js +0 -22
- package/vendor/hap-nodejs/dist/lib/util/once.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/promise-utils.d.ts +0 -14
- package/vendor/hap-nodejs/dist/lib/util/promise-utils.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/promise-utils.js +0 -29
- package/vendor/hap-nodejs/dist/lib/util/promise-utils.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/request-util.d.ts +0 -36
- package/vendor/hap-nodejs/dist/lib/util/request-util.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/request-util.js +0 -108
- package/vendor/hap-nodejs/dist/lib/util/request-util.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/time.d.ts +0 -9
- package/vendor/hap-nodejs/dist/lib/util/time.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/time.js +0 -23
- package/vendor/hap-nodejs/dist/lib/util/time.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/tlv.d.ts +0 -90
- package/vendor/hap-nodejs/dist/lib/util/tlv.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/tlv.js +0 -318
- package/vendor/hap-nodejs/dist/lib/util/tlv.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/uuid.d.ts +0 -23
- package/vendor/hap-nodejs/dist/lib/util/uuid.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/uuid.js +0 -78
- package/vendor/hap-nodejs/dist/lib/util/uuid.js.map +0 -1
- package/vendor/hap-nodejs/dist/types.d.ts +0 -276
- package/vendor/hap-nodejs/dist/types.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/types.js +0 -11
- package/vendor/hap-nodejs/dist/types.js.map +0 -1
- package/vendor/hap-nodejs/package.json +0 -53
- package/vendor/hap-nodejs/src/lib/util/hapCrypto.ts +0 -208
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ControllerStorage = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const util_1 = tslib_1.__importDefault(require("util"));
|
|
6
|
-
const debug_1 = tslib_1.__importDefault(require("debug"));
|
|
7
|
-
const HAPStorage_1 = require("./HAPStorage");
|
|
8
|
-
const debug = (0, debug_1.default)("HAP-NodeJS:ControllerStorage");
|
|
9
|
-
const hksvDebug = (0, debug_1.default)("HAP-NodeJS:HKSV");
|
|
10
|
-
/**
|
|
11
|
-
* @group Model
|
|
12
|
-
*/
|
|
13
|
-
class ControllerStorage {
|
|
14
|
-
accessoryUUID;
|
|
15
|
-
initialized = false;
|
|
16
|
-
// ----- properties only set in parent storage object ------
|
|
17
|
-
username;
|
|
18
|
-
fileCreated = false;
|
|
19
|
-
purgeUnidentifiedAccessoryData = true;
|
|
20
|
-
// ---------------------------------------------------------
|
|
21
|
-
trackedControllers = []; // used to track controllers before data was loaded from disk
|
|
22
|
-
controllerData = {};
|
|
23
|
-
restoredAccessories; // indexed by accessory UUID
|
|
24
|
-
// deserializing a controller updates its characteristics, which can report state changes (its own, or
|
|
25
|
-
// those of another controller listening on a shared service) before the restore is complete.
|
|
26
|
-
// Those must not overwrite the stored data with a partially restored state.
|
|
27
|
-
restoring = false;
|
|
28
|
-
parent;
|
|
29
|
-
linkedAccessories;
|
|
30
|
-
queuedSaveTimeout;
|
|
31
|
-
queuedSaveTime;
|
|
32
|
-
constructor(accessory) {
|
|
33
|
-
this.accessoryUUID = accessory.UUID;
|
|
34
|
-
}
|
|
35
|
-
enqueueSaveRequest(timeout = 0) {
|
|
36
|
-
if (this.parent) {
|
|
37
|
-
this.parent.enqueueSaveRequest(timeout);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
const plannedTime = Date.now() + timeout;
|
|
41
|
-
if (this.queuedSaveTimeout) {
|
|
42
|
-
if (plannedTime <= (this.queuedSaveTime ?? 0)) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
clearTimeout(this.queuedSaveTimeout);
|
|
46
|
-
}
|
|
47
|
-
this.queuedSaveTimeout = setTimeout(() => {
|
|
48
|
-
this.queuedSaveTimeout = this.queuedSaveTime = undefined;
|
|
49
|
-
this.save();
|
|
50
|
-
}, timeout).unref();
|
|
51
|
-
this.queuedSaveTime = Date.now() + timeout;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Links a bridged accessory to the ControllerStorage of the bridge accessory.
|
|
55
|
-
*
|
|
56
|
-
* @param accessory
|
|
57
|
-
*/
|
|
58
|
-
linkAccessory(accessory) {
|
|
59
|
-
if (!this.linkedAccessories) {
|
|
60
|
-
this.linkedAccessories = [];
|
|
61
|
-
}
|
|
62
|
-
const storage = accessory.controllerStorage;
|
|
63
|
-
this.linkedAccessories.push(storage);
|
|
64
|
-
storage.parent = this;
|
|
65
|
-
const saved = this.restoredAccessories && this.restoredAccessories[accessory.UUID];
|
|
66
|
-
if (this.initialized) {
|
|
67
|
-
storage.init(saved);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
trackController(controller) {
|
|
71
|
-
controller.setupStateChangeDelegate(this.handleStateChange.bind(this, controller)); // setup delegate
|
|
72
|
-
hksvDebug("trackController acc=%s ctrl=%s initialized=%s", this.accessoryUUID, controller.controllerId(), this.initialized);
|
|
73
|
-
if (!this.initialized) { // track controller if data isn't loaded yet
|
|
74
|
-
this.trackedControllers.push(controller);
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
this.restoreController(controller);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
untrackController(controller) {
|
|
81
|
-
const index = this.trackedControllers.indexOf(controller);
|
|
82
|
-
if (index !== -1) { // remove from trackedControllers if storage wasn't initialized yet
|
|
83
|
-
this.trackedControllers.splice(index, 1);
|
|
84
|
-
}
|
|
85
|
-
controller.setupStateChangeDelegate(undefined); // remove association with this storage object
|
|
86
|
-
this.purgeControllerData(controller);
|
|
87
|
-
}
|
|
88
|
-
purgeControllerData(controller) {
|
|
89
|
-
delete this.controllerData[controller.controllerId()];
|
|
90
|
-
if (this.initialized) {
|
|
91
|
-
this.enqueueSaveRequest(100);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
handleStateChange(controller) {
|
|
95
|
-
if (this.restoring) {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
const id = controller.controllerId();
|
|
99
|
-
const serialized = controller.serialize();
|
|
100
|
-
hksvDebug("handleStateChange acc=%s ctrl=%s hasSerialized=%s initialized=%s hasParent=%s", this.accessoryUUID, id, !!serialized, this.initialized, !!this.parent);
|
|
101
|
-
if (!serialized) { // can be undefined when controller wishes to delete data
|
|
102
|
-
delete this.controllerData[id];
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
const controllerData = this.controllerData[id];
|
|
106
|
-
if (!controllerData) {
|
|
107
|
-
this.controllerData[id] = {
|
|
108
|
-
data: serialized,
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
controllerData.data = serialized;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
if (this.initialized) { // only save if data was loaded
|
|
116
|
-
// run save data "async", as handleStateChange call will probably always be caused by a http request
|
|
117
|
-
// this should improve our response time
|
|
118
|
-
this.enqueueSaveRequest(100);
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
hksvDebug("handleStateChange acc=%s: not enqueuing save — storage not yet initialized", this.accessoryUUID);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
restoreController(controller) {
|
|
125
|
-
if (!this.initialized) {
|
|
126
|
-
throw new Error("Illegal state. Controller data wasn't loaded yet!");
|
|
127
|
-
}
|
|
128
|
-
const controllerData = this.controllerData[controller.controllerId()];
|
|
129
|
-
hksvDebug("restoreController acc=%s ctrl=%s hasStoredData=%s", this.accessoryUUID, controller.controllerId(), !!controllerData);
|
|
130
|
-
if (controllerData) {
|
|
131
|
-
const wasRestoring = this.restoring;
|
|
132
|
-
this.restoring = true;
|
|
133
|
-
try {
|
|
134
|
-
controller.deserialize(controllerData.data);
|
|
135
|
-
}
|
|
136
|
-
catch (error) {
|
|
137
|
-
console.warn(`Could not initialize controller of type '${controller.controllerId()}' from data stored on disk. Resetting to default: ${error.stack}`);
|
|
138
|
-
controller.handleFactoryReset();
|
|
139
|
-
}
|
|
140
|
-
finally {
|
|
141
|
-
this.restoring = wasRestoring;
|
|
142
|
-
}
|
|
143
|
-
controllerData.purgeOnNextLoad = undefined;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Called when this particular Storage object is feed with data loaded from disk.
|
|
148
|
-
* This method is only called once.
|
|
149
|
-
*
|
|
150
|
-
* @param data - array of {@link StoredControllerData}. undefined if nothing was stored on disk for this particular storage object
|
|
151
|
-
*/
|
|
152
|
-
init(data) {
|
|
153
|
-
if (this.initialized) {
|
|
154
|
-
throw new Error(`ControllerStorage for accessory ${this.accessoryUUID} was already initialized!`);
|
|
155
|
-
}
|
|
156
|
-
this.initialized = true;
|
|
157
|
-
// storing data into our local controllerData Record
|
|
158
|
-
if (data) {
|
|
159
|
-
data.forEach(saved => this.controllerData[saved.type] = saved.controllerData);
|
|
160
|
-
}
|
|
161
|
-
const restoredControllers = [];
|
|
162
|
-
this.restoring = true;
|
|
163
|
-
try {
|
|
164
|
-
this.trackedControllers.forEach(controller => {
|
|
165
|
-
this.restoreController(controller);
|
|
166
|
-
restoredControllers.push(controller.controllerId());
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
finally {
|
|
170
|
-
this.restoring = false;
|
|
171
|
-
}
|
|
172
|
-
this.trackedControllers.splice(0, this.trackedControllers.length); // clear tracking list
|
|
173
|
-
let purgedData = false;
|
|
174
|
-
Object.entries(this.controllerData).forEach(([id, data]) => {
|
|
175
|
-
if (data.purgeOnNextLoad) {
|
|
176
|
-
delete this.controllerData[id];
|
|
177
|
-
purgedData = true;
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
if (!restoredControllers.includes(id)) {
|
|
181
|
-
data.purgeOnNextLoad = true;
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
if (purgedData) {
|
|
185
|
-
this.enqueueSaveRequest(500);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
load(username) {
|
|
189
|
-
if (this.username) {
|
|
190
|
-
throw new Error("ControllerStorage was already loaded!");
|
|
191
|
-
}
|
|
192
|
-
this.username = username;
|
|
193
|
-
const key = ControllerStorage.persistKey(username);
|
|
194
|
-
const saved = HAPStorage_1.HAPStorage.storage().getItem(key);
|
|
195
|
-
let ownData;
|
|
196
|
-
if (saved) {
|
|
197
|
-
this.fileCreated = true;
|
|
198
|
-
ownData = saved.accessories[this.accessoryUUID];
|
|
199
|
-
delete saved.accessories[this.accessoryUUID];
|
|
200
|
-
}
|
|
201
|
-
hksvDebug("load username=%s key=%s fileExisted=%s thisAcc=%s ownEntries=%s otherAccsInFile=%j", username, key, !!saved, this.accessoryUUID, ownData ? ownData.length : "none", saved ? Object.keys(saved.accessories) : []);
|
|
202
|
-
this.init(ownData);
|
|
203
|
-
if (this.linkedAccessories) {
|
|
204
|
-
this.linkedAccessories.forEach(linkedStorage => {
|
|
205
|
-
const savedData = saved && saved.accessories[linkedStorage.accessoryUUID];
|
|
206
|
-
linkedStorage.init(savedData);
|
|
207
|
-
if (saved) {
|
|
208
|
-
delete saved.accessories[linkedStorage.accessoryUUID];
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
if (saved && Object.keys(saved.accessories).length > 0) {
|
|
213
|
-
if (!this.purgeUnidentifiedAccessoryData) {
|
|
214
|
-
this.restoredAccessories = saved.accessories; // save data for controllers which aren't linked yet
|
|
215
|
-
}
|
|
216
|
-
else {
|
|
217
|
-
debug("Purging unidentified controller data for bridge %s", username);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
save() {
|
|
222
|
-
if (this.parent) {
|
|
223
|
-
this.parent.save();
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
226
|
-
if (!this.initialized) {
|
|
227
|
-
throw new Error("ControllerStorage has not yet been loaded!");
|
|
228
|
-
}
|
|
229
|
-
if (!this.username) {
|
|
230
|
-
throw new Error("Cannot save controllerData for a storage without a username!");
|
|
231
|
-
}
|
|
232
|
-
const accessories = {
|
|
233
|
-
[this.accessoryUUID]: this.controllerData,
|
|
234
|
-
};
|
|
235
|
-
if (this.linkedAccessories) { // grab data from all linked storage objects
|
|
236
|
-
this.linkedAccessories.forEach(accessory => accessories[accessory.accessoryUUID] = accessory.controllerData);
|
|
237
|
-
}
|
|
238
|
-
// TODO removed accessories won't ever be deleted?
|
|
239
|
-
const accessoryData = this.restoredAccessories || {};
|
|
240
|
-
Object.entries(accessories).forEach(([uuid, controllerData]) => {
|
|
241
|
-
const entries = Object.entries(controllerData);
|
|
242
|
-
if (entries.length > 0) {
|
|
243
|
-
accessoryData[uuid] = entries.map(([id, data]) => ({
|
|
244
|
-
type: id,
|
|
245
|
-
controllerData: data,
|
|
246
|
-
}));
|
|
247
|
-
}
|
|
248
|
-
});
|
|
249
|
-
const key = ControllerStorage.persistKey(this.username);
|
|
250
|
-
if (Object.keys(accessoryData).length > 0) {
|
|
251
|
-
const saved = {
|
|
252
|
-
accessories: accessoryData,
|
|
253
|
-
};
|
|
254
|
-
if (hksvDebug.enabled) {
|
|
255
|
-
// Only build the per-accessory controller-id map when the namespace is enabled,
|
|
256
|
-
// since save() runs on every debounced state change.
|
|
257
|
-
hksvDebug("save write %s accs=%j ctrlsPerAcc=%j", key, Object.keys(accessoryData), Object.fromEntries(Object.entries(accessoryData).map(([acc, entries]) => [acc, entries.map(e => e.type)])));
|
|
258
|
-
}
|
|
259
|
-
this.fileCreated = true;
|
|
260
|
-
HAPStorage_1.HAPStorage.storage().setItemSync(key, saved);
|
|
261
|
-
}
|
|
262
|
-
else if (this.fileCreated) {
|
|
263
|
-
hksvDebug("save remove %s (no controller data left)", key);
|
|
264
|
-
this.fileCreated = false;
|
|
265
|
-
HAPStorage_1.HAPStorage.storage().removeItemSync(key);
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
static persistKey(username) {
|
|
269
|
-
return util_1.default.format("ControllerStorage.%s.json", username.replace(/:/g, "").toUpperCase());
|
|
270
|
-
}
|
|
271
|
-
static remove(username) {
|
|
272
|
-
const key = ControllerStorage.persistKey(username);
|
|
273
|
-
HAPStorage_1.HAPStorage.storage().removeItemSync(key);
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
exports.ControllerStorage = ControllerStorage;
|
|
277
|
-
//# sourceMappingURL=ControllerStorage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ControllerStorage.js","sourceRoot":"","sources":["../../../src/lib/model/ControllerStorage.ts"],"names":[],"mappings":";;;;AACA,wDAAwB;AACxB,0DAAgC;AAGhC,6CAA0C;AAG1C,MAAM,KAAK,GAAG,IAAA,eAAW,EAAC,8BAA8B,CAAC,CAAC;AAC1D,MAAM,SAAS,GAAG,IAAA,eAAW,EAAC,iBAAiB,CAAC,CAAC;AAsBjD;;GAEG;AACH,MAAa,iBAAiB;IAEX,aAAa,CAAS;IAC/B,WAAW,GAAG,KAAK,CAAC;IAE5B,4DAA4D;IACpD,QAAQ,CAAc;IACtB,WAAW,GAAG,KAAK,CAAC;IAC5B,8BAA8B,GAAG,IAAI,CAAC;IACtC,4DAA4D;IAEpD,kBAAkB,GAA6B,EAAE,CAAC,CAAC,6DAA6D;IAChH,cAAc,GAAiD,EAAE,CAAC;IAClE,mBAAmB,CAA0C,CAAC,4BAA4B;IAElG,sGAAsG;IACtG,6FAA6F;IAC7F,4EAA4E;IACpE,SAAS,GAAG,KAAK,CAAC;IAElB,MAAM,CAAqB;IAC3B,iBAAiB,CAAuB;IAExC,iBAAiB,CAAkB;IACnC,cAAc,CAAU;IAE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MAAM,CAAC,MAAM,CAAC,QAAoB;QAChC,MAAM,GAAG,GAAG,iBAAiB,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QACnD,uBAAU,CAAC,OAAO,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IAC3C,CAAC;CAEF;AApUD,8CAoUC"}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Init options supported by {@link HAPFileStorage.initSync}.
|
|
3
|
-
*
|
|
4
|
-
* This is the subset of node-persist's init options which was ever functional for HAP-NodeJS's storage.
|
|
5
|
-
* Passing any other node-persist option throws instead of being silently ignored.
|
|
6
|
-
*
|
|
7
|
-
* @group Model
|
|
8
|
-
*/
|
|
9
|
-
export interface HAPFileStorageInitOptions {
|
|
10
|
-
/**
|
|
11
|
-
* Path of the storage directory. If provided, it must be an absolute path.
|
|
12
|
-
* If omitted, storage defaults to the directory `persist` inside the current working directory.
|
|
13
|
-
*/
|
|
14
|
-
dir?: string;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Minimal synchronous file storage, a drop-in replacement for the subset of `node-persist@0.0.12`
|
|
18
|
-
* which HAP-NodeJS used: `initSync`, `getItem`, `setItemSync` and `removeItemSync`.
|
|
19
|
-
*
|
|
20
|
-
* The on-disk layout is kept byte-for-byte compatible with node-persist 0.0.12:
|
|
21
|
-
* one file per key inside the storage directory, named after the raw key (no hashing or escaping),
|
|
22
|
-
* containing the bare `JSON.stringify` representation of the value. Values are read once
|
|
23
|
-
* at {@link initSync} and served from memory afterwards.
|
|
24
|
-
*
|
|
25
|
-
* Keys must therefore be plain filenames: one which names a subdirectory, escapes the storage directory
|
|
26
|
-
* or starts with a dot is rejected rather than written somewhere it could never be read back from.
|
|
27
|
-
*
|
|
28
|
-
* Writes are atomic, which node-persist's were not: see {@link setItemSync}.
|
|
29
|
-
*
|
|
30
|
-
* @group Model
|
|
31
|
-
*/
|
|
32
|
-
export declare class HAPFileStorage {
|
|
33
|
-
private dir;
|
|
34
|
-
private readonly data;
|
|
35
|
-
constructor();
|
|
36
|
-
initSync(options?: HAPFileStorageInitOptions): void;
|
|
37
|
-
/**
|
|
38
|
-
* Returns the in-memory value for the given key.
|
|
39
|
-
* node-persist's legacy `getItem(key, callback)` form throws, like every other removed API.
|
|
40
|
-
*/
|
|
41
|
-
getItem(key: string, ...legacyCallback: never[]): any;
|
|
42
|
-
/**
|
|
43
|
-
* Persists the given value, replacing the file for this key atomically.
|
|
44
|
-
*
|
|
45
|
-
* The value is written to a temporary file which is then renamed over the target, so an interrupted write
|
|
46
|
-
* leaves the previous contents intact instead of a truncated file. This matters because a truncated
|
|
47
|
-
* `AccessoryInfo` file reads back as an accessory which lost its pairings.
|
|
48
|
-
*
|
|
49
|
-
* The in-memory value is only replaced once the new one reached the disk, so a failed write cannot leave
|
|
50
|
-
* an accessory which reads as paired now and unpaired after a restart.
|
|
51
|
-
*/
|
|
52
|
-
setItemSync(key: string, value: any): void;
|
|
53
|
-
removeItemSync(key: string): void;
|
|
54
|
-
/**
|
|
55
|
-
* Rejects a key which is not a plain filename, before it reaches the filesystem.
|
|
56
|
-
*
|
|
57
|
-
* `path.join` would otherwise read a key as a path: `nested/key.json` writes into a subdirectory which
|
|
58
|
-
* {@link initSync} skips, so the value comes back `undefined` after a restart, and `../escaped.json` writes
|
|
59
|
-
* outside the storage directory altogether. node-persist 0.0.12 created such subdirectories too, but crashed
|
|
60
|
-
* with `EISDIR` on the next load rather than losing the value quietly.
|
|
61
|
-
*
|
|
62
|
-
* A leading dot is rejected for the same reason: {@link initSync} skips dotfiles, so `.hidden` would be
|
|
63
|
-
* written, served from memory while the process runs, and then be gone after a restart.
|
|
64
|
-
*/
|
|
65
|
-
private static assertPlainKey;
|
|
66
|
-
/**
|
|
67
|
-
* Whether the given path is a regular file, following symlinks.
|
|
68
|
-
*
|
|
69
|
-
* An entry which cannot be stat'ed at all, like a broken or circular symlink, is one to skip
|
|
70
|
-
* rather than one to abort startup over.
|
|
71
|
-
*/
|
|
72
|
-
private static isFile;
|
|
73
|
-
private static parse;
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=HAPFileStorage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HAPFileStorage.d.ts","sourceRoot":"","sources":["../../../src/lib/model/HAPFileStorage.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAmBD;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,cAAc;IAGzB,OAAO,CAAC,GAAG,CAAa;IAExB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA0B;;IAc/C,QAAQ,CAAC,OAAO,CAAC,EAAE,yBAAyB,GAAG,IAAI;IAuCnD;;;OAGG;IAEH,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,KAAK,EAAE,GAAG,GAAG;IASrD;;;;;;;;;OASG;IAEH,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;IA8B1C,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAWjC;;;;;;;;;;OAUG;IACH,OAAO,CAAC,MAAM,CAAC,cAAc;IAQ7B;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,MAAM;IASrB,OAAO,CAAC,MAAM,CAAC,KAAK;CASrB"}
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HAPFileStorage = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
|
|
6
|
-
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
7
|
-
const SUPPORTED_METHODS = "initSync, getItem, setItemSync and removeItemSync";
|
|
8
|
-
/**
|
|
9
|
-
* Every method of node-persist 0.0.12's `LocalStorage` prototype which {@link HAPFileStorage} does not implement.
|
|
10
|
-
* They are assigned as throwing stubs in the constructor, so code depending on the removed node-persist API
|
|
11
|
-
* fails with a clear error instead of exhibiting undefined behavior.
|
|
12
|
-
*/
|
|
13
|
-
const UNSUPPORTED_METHODS = [
|
|
14
|
-
"setOptions", "init", "key", "keys", "length", "forEach", "values", "valuesWithKeyMatch",
|
|
15
|
-
"setItem", "getItemSync", "removeItem", "clear", "clearSync", "persist", "persistSync",
|
|
16
|
-
"persistKey", "persistKeySync", "removePersistedKey", "removePersistedKeySync",
|
|
17
|
-
"parseString", "parseTTLDir", "parseTTLDirSync", "parseDataDir", "parseDataDirSync",
|
|
18
|
-
"parseDir", "parseDirSync", "parseDataFile", "parseDataFileSync", "parseTTLFile",
|
|
19
|
-
"parseTTLFileSync", "parseFile", "parseFileSync", "isExpired", "resolveDir",
|
|
20
|
-
"stopInterval", "log",
|
|
21
|
-
];
|
|
22
|
-
/**
|
|
23
|
-
* Minimal synchronous file storage, a drop-in replacement for the subset of `node-persist@0.0.12`
|
|
24
|
-
* which HAP-NodeJS used: `initSync`, `getItem`, `setItemSync` and `removeItemSync`.
|
|
25
|
-
*
|
|
26
|
-
* The on-disk layout is kept byte-for-byte compatible with node-persist 0.0.12:
|
|
27
|
-
* one file per key inside the storage directory, named after the raw key (no hashing or escaping),
|
|
28
|
-
* containing the bare `JSON.stringify` representation of the value. Values are read once
|
|
29
|
-
* at {@link initSync} and served from memory afterwards.
|
|
30
|
-
*
|
|
31
|
-
* Keys must therefore be plain filenames: one which names a subdirectory, escapes the storage directory
|
|
32
|
-
* or starts with a dot is rejected rather than written somewhere it could never be read back from.
|
|
33
|
-
*
|
|
34
|
-
* Writes are atomic, which node-persist's were not: see {@link setItemSync}.
|
|
35
|
-
*
|
|
36
|
-
* @group Model
|
|
37
|
-
*/
|
|
38
|
-
class HAPFileStorage {
|
|
39
|
-
// node-persist 0.0.12 default: the relative directory "persist", resolved against the current working directory
|
|
40
|
-
dir = "persist";
|
|
41
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
42
|
-
data = new Map();
|
|
43
|
-
constructor() {
|
|
44
|
-
for (const method of UNSUPPORTED_METHODS) {
|
|
45
|
-
// runtime-only stubs, deliberately absent from the class type: TypeScript consumers get a compile error,
|
|
46
|
-
// JavaScript consumers get this error instead of "storage.keys is not a function"
|
|
47
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
48
|
-
this[method] = () => {
|
|
49
|
-
throw new Error(`${method}() is not supported anymore: HAP-NodeJS replaced node-persist with a minimal file storage ` +
|
|
50
|
-
`which only implements ${SUPPORTED_METHODS} (see https://github.com/homebridge/HAP-NodeJS/issues/1107).`);
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
initSync(options) {
|
|
55
|
-
if (options) {
|
|
56
|
-
const unsupportedOptions = Object.keys(options).filter(key => key !== "dir");
|
|
57
|
-
if (unsupportedOptions.length > 0) {
|
|
58
|
-
throw new Error(`HAP-NodeJS's storage does not support the init options: ${unsupportedOptions.join(", ")}. ` +
|
|
59
|
-
"Only \"dir\" is supported (see https://github.com/homebridge/HAP-NodeJS/issues/1107).");
|
|
60
|
-
}
|
|
61
|
-
if ("dir" in options) {
|
|
62
|
-
if (typeof options.dir !== "string" || !node_path_1.default.isAbsolute(options.dir)) {
|
|
63
|
-
// node-persist silently redirected relative paths into its own module directory inside node_modules,
|
|
64
|
-
// where the data was lost on the next npm install. There is no sane location to keep that behavior.
|
|
65
|
-
throw new Error(`HAP-NodeJS's storage requires an absolute storage path, got ${JSON.stringify(options.dir)}!`);
|
|
66
|
-
}
|
|
67
|
-
this.dir = node_path_1.default.normalize(options.dir);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
if (node_fs_1.default.existsSync(this.dir)) {
|
|
71
|
-
for (const entry of node_fs_1.default.readdirSync(this.dir, { withFileTypes: true })) {
|
|
72
|
-
if (entry.name.startsWith(".")) {
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
const file = node_path_1.default.join(this.dir, entry.name);
|
|
76
|
-
// only regular files hold values: reading a directory here would abort startup with a cryptic EISDIR.
|
|
77
|
-
// this resolves symlinks, which entry.isDirectory() does not, so a link to a directory is skipped
|
|
78
|
-
// like the directory itself while a link to a file still loads
|
|
79
|
-
if (!HAPFileStorage.isFile(file)) {
|
|
80
|
-
continue;
|
|
81
|
-
}
|
|
82
|
-
this.data.set(entry.name, HAPFileStorage.parse(node_fs_1.default.readFileSync(file, "utf8")));
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
node_fs_1.default.mkdirSync(this.dir, { recursive: true });
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Returns the in-memory value for the given key.
|
|
91
|
-
* node-persist's legacy `getItem(key, callback)` form throws, like every other removed API.
|
|
92
|
-
*/
|
|
93
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
94
|
-
getItem(key, ...legacyCallback) {
|
|
95
|
-
if (legacyCallback.length > 0) {
|
|
96
|
-
throw new Error("getItem() with a callback is not supported anymore: HAP-NodeJS replaced node-persist with a minimal file storage " +
|
|
97
|
-
`which only implements ${SUPPORTED_METHODS} (see https://github.com/homebridge/HAP-NodeJS/issues/1107).`);
|
|
98
|
-
}
|
|
99
|
-
return this.data.get(key);
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Persists the given value, replacing the file for this key atomically.
|
|
103
|
-
*
|
|
104
|
-
* The value is written to a temporary file which is then renamed over the target, so an interrupted write
|
|
105
|
-
* leaves the previous contents intact instead of a truncated file. This matters because a truncated
|
|
106
|
-
* `AccessoryInfo` file reads back as an accessory which lost its pairings.
|
|
107
|
-
*
|
|
108
|
-
* The in-memory value is only replaced once the new one reached the disk, so a failed write cannot leave
|
|
109
|
-
* an accessory which reads as paired now and unpaired after a restart.
|
|
110
|
-
*/
|
|
111
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
112
|
-
setItemSync(key, value) {
|
|
113
|
-
HAPFileStorage.assertPlainKey(key);
|
|
114
|
-
// node-persist 0.0.12 ran mkdirp.sync before every write, which recreated a storage directory removed at runtime
|
|
115
|
-
node_fs_1.default.mkdirSync(this.dir, { recursive: true });
|
|
116
|
-
const file = node_path_1.default.join(this.dir, key);
|
|
117
|
-
// the dot prefix keeps a temporary file left behind by a crash from being loaded as a key by initSync,
|
|
118
|
-
// the pid keeps processes sharing a storage directory (like child bridges) from racing on the same temporary file.
|
|
119
|
-
// it sits in the storage directory next to its target, as renaming across directories would not be atomic
|
|
120
|
-
const temporaryFile = node_path_1.default.join(this.dir, `.${key}.${process.pid}.tmp`);
|
|
121
|
-
try {
|
|
122
|
-
node_fs_1.default.writeFileSync(temporaryFile, JSON.stringify(value));
|
|
123
|
-
node_fs_1.default.renameSync(temporaryFile, file);
|
|
124
|
-
}
|
|
125
|
-
catch (error) {
|
|
126
|
-
try {
|
|
127
|
-
node_fs_1.default.unlinkSync(temporaryFile);
|
|
128
|
-
}
|
|
129
|
-
catch {
|
|
130
|
-
// the temporary file may never have been created, in which case there is nothing to clean up
|
|
131
|
-
}
|
|
132
|
-
throw error;
|
|
133
|
-
}
|
|
134
|
-
// only now that the value is on disk: everything is served from memory afterwards, so a value cached
|
|
135
|
-
// for a write which never landed would be indistinguishable from a saved one until the next restart
|
|
136
|
-
this.data.set(key, value);
|
|
137
|
-
}
|
|
138
|
-
removeItemSync(key) {
|
|
139
|
-
HAPFileStorage.assertPlainKey(key);
|
|
140
|
-
// force ignores a file which is already gone, without the exists-then-unlink
|
|
141
|
-
// gap in which another process (child bridges share a storage directory)
|
|
142
|
-
// could remove the file first and turn this into an ENOENT crash
|
|
143
|
-
node_fs_1.default.rmSync(node_path_1.default.join(this.dir, key), { force: true });
|
|
144
|
-
this.data.delete(key);
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Rejects a key which is not a plain filename, before it reaches the filesystem.
|
|
148
|
-
*
|
|
149
|
-
* `path.join` would otherwise read a key as a path: `nested/key.json` writes into a subdirectory which
|
|
150
|
-
* {@link initSync} skips, so the value comes back `undefined` after a restart, and `../escaped.json` writes
|
|
151
|
-
* outside the storage directory altogether. node-persist 0.0.12 created such subdirectories too, but crashed
|
|
152
|
-
* with `EISDIR` on the next load rather than losing the value quietly.
|
|
153
|
-
*
|
|
154
|
-
* A leading dot is rejected for the same reason: {@link initSync} skips dotfiles, so `.hidden` would be
|
|
155
|
-
* written, served from memory while the process runs, and then be gone after a restart.
|
|
156
|
-
*/
|
|
157
|
-
static assertPlainKey(key) {
|
|
158
|
-
if (!key || key.startsWith(".") || /[/\\]/.test(key)) {
|
|
159
|
-
throw new Error(`HAP-NodeJS's storage requires a key which is a plain filename, got ${JSON.stringify(key)}! ` +
|
|
160
|
-
"One file is kept per key inside the storage directory, so a key can neither name a subdirectory, escape it, " +
|
|
161
|
-
"nor start with a dot, which would be skipped the next time the directory is loaded.");
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Whether the given path is a regular file, following symlinks.
|
|
166
|
-
*
|
|
167
|
-
* An entry which cannot be stat'ed at all, like a broken or circular symlink, is one to skip
|
|
168
|
-
* rather than one to abort startup over.
|
|
169
|
-
*/
|
|
170
|
-
static isFile(file) {
|
|
171
|
-
try {
|
|
172
|
-
return node_fs_1.default.statSync(file).isFile();
|
|
173
|
-
}
|
|
174
|
-
catch {
|
|
175
|
-
return false;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
179
|
-
static parse(json) {
|
|
180
|
-
try {
|
|
181
|
-
return JSON.parse(json);
|
|
182
|
-
}
|
|
183
|
-
catch {
|
|
184
|
-
// node-persist 0.0.12 swallowed unparseable files, leaving the value undefined
|
|
185
|
-
return undefined;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
exports.HAPFileStorage = HAPFileStorage;
|
|
190
|
-
//# sourceMappingURL=HAPFileStorage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HAPFileStorage.js","sourceRoot":"","sources":["../../../src/lib/model/HAPFileStorage.ts"],"names":[],"mappings":";;;;AAAA,8DAAyB;AACzB,kEAA6B;AAkB7B,MAAM,iBAAiB,GAAG,mDAAmD,CAAC;AAE9E;;;;GAIG;AACH,MAAM,mBAAmB,GAAG;IAC1B,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,oBAAoB;IACxF,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa;IACtF,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,wBAAwB;IAC9E,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAAE,cAAc,EAAE,kBAAkB;IACnF,UAAU,EAAE,cAAc,EAAE,eAAe,EAAE,mBAAmB,EAAE,cAAc;IAChF,kBAAkB,EAAE,WAAW,EAAE,eAAe,EAAE,WAAW,EAAE,YAAY;IAC3E,cAAc,EAAE,KAAK;CACb,CAAC;AAEX;;;;;;;;;;;;;;;GAeG;AACH,MAAa,cAAc;IAEzB,gHAAgH;IACxG,GAAG,GAAG,SAAS,CAAC;IACxB,8DAA8D;IAC7C,IAAI,GAAG,IAAI,GAAG,EAAe,CAAC;IAE/C;QACE,KAAK,MAAM,MAAM,IAAI,mBAAmB,EAAE,CAAC;YACzC,yGAAyG;YACzG,kFAAkF;YAClF,8DAA8D;YAC7D,IAAY,CAAC,MAAM,CAAC,GAAG,GAAG,EAAE;gBAC3B,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,4FAA4F;oBACnH,yBAAyB,iBAAiB,8DAA8D,CAAC,CAAC;YAC9G,CAAC,CAA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AO,iBAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;QACpC,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,8DAA8D;IACtD,MAAM,CAAC,KAAK,CAAC,IAAY;QAC/B,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;QAAC,MAAM,CAAC;YACP,+EAA+E;YAC/E,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;CAEF;AAvKD,wCAuKC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { HAPFileStorage } from "./HAPFileStorage";
|
|
2
|
-
/**
|
|
3
|
-
* @group Model
|
|
4
|
-
*/
|
|
5
|
-
export declare class HAPStorage {
|
|
6
|
-
private static readonly INSTANCE;
|
|
7
|
-
private localStore?;
|
|
8
|
-
private customStoragePath?;
|
|
9
|
-
static storage(): HAPFileStorage;
|
|
10
|
-
static setCustomStoragePath(path: string): void;
|
|
11
|
-
storage(): HAPFileStorage;
|
|
12
|
-
/**
|
|
13
|
-
* Warn early if the persist directory cannot be written to.
|
|
14
|
-
*
|
|
15
|
-
* Without this the first sign of trouble is a publish failing with an
|
|
16
|
-
* unrelated-looking error, which is what happens when a container that
|
|
17
|
-
* previously ran as root is switched to a non-root user and the existing
|
|
18
|
-
* AccessoryInfo/IdentifierCache files stay owned by root.
|
|
19
|
-
*
|
|
20
|
-
* Only warns — an unwritable directory is not necessarily fatal at this
|
|
21
|
-
* point, and throwing here would break consumers that never write.
|
|
22
|
-
*/
|
|
23
|
-
private checkStorageIsWritable;
|
|
24
|
-
setCustomStoragePath(path: string): void;
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=HAPStorage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HAPStorage.d.ts","sourceRoot":"","sources":["../../../src/lib/model/HAPStorage.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;GAEG;AACH,qBAAa,UAAU;IAErB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAoB;IAEpD,OAAO,CAAC,UAAU,CAAC,CAAiB;IACpC,OAAO,CAAC,iBAAiB,CAAC,CAAS;WAErB,OAAO,IAAI,cAAc;WAIzB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI/C,OAAO,IAAI,cAAc;IAkBhC;;;;;;;;;;OAUG;IACH,OAAO,CAAC,sBAAsB;IA8BvB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;CAQhD"}
|