@zwave-js/cc 15.1.1 → 15.1.2
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/build/cjs/cc/AlarmSensorCC.d.ts +7 -7
- package/build/cjs/cc/AlarmSensorCC.js +22 -23
- package/build/cjs/cc/AlarmSensorCC.js.map +3 -3
- package/build/cjs/cc/AssociationCC.d.ts +8 -9
- package/build/cjs/cc/AssociationCC.js +29 -29
- package/build/cjs/cc/AssociationCC.js.map +3 -3
- package/build/cjs/cc/AssociationGroupInfoCC.d.ts +7 -7
- package/build/cjs/cc/AssociationGroupInfoCC.js +31 -32
- package/build/cjs/cc/AssociationGroupInfoCC.js.map +3 -3
- package/build/cjs/cc/BarrierOperatorCC.d.ts +8 -8
- package/build/cjs/cc/BarrierOperatorCC.js +35 -36
- package/build/cjs/cc/BarrierOperatorCC.js.map +3 -3
- package/build/cjs/cc/BasicCC.d.ts +4 -4
- package/build/cjs/cc/BasicCC.js +23 -24
- package/build/cjs/cc/BasicCC.js.map +3 -3
- package/build/cjs/cc/BatteryCC.d.ts +4 -7
- package/build/cjs/cc/BatteryCC.js +18 -20
- package/build/cjs/cc/BatteryCC.js.map +3 -3
- package/build/cjs/cc/BinarySensorCC.d.ts +5 -5
- package/build/cjs/cc/BinarySensorCC.js +20 -21
- package/build/cjs/cc/BinarySensorCC.js.map +3 -3
- package/build/cjs/cc/BinarySwitchCC._validateArgs.js +2 -2
- package/build/cjs/cc/BinarySwitchCC.d.ts +6 -6
- package/build/cjs/cc/BinarySwitchCC.js +26 -26
- package/build/cjs/cc/BinarySwitchCC.js.map +3 -3
- package/build/cjs/cc/CRC16CC.d.ts +3 -3
- package/build/cjs/cc/CRC16CC.js +15 -15
- package/build/cjs/cc/CRC16CC.js.map +3 -3
- package/build/cjs/cc/CentralSceneCC.d.ts +8 -8
- package/build/cjs/cc/CentralSceneCC.js +23 -24
- package/build/cjs/cc/CentralSceneCC.js.map +3 -3
- package/build/cjs/cc/ClimateControlScheduleCC.d.ts +6 -6
- package/build/cjs/cc/ClimateControlScheduleCC.js +19 -20
- package/build/cjs/cc/ClimateControlScheduleCC.js.map +3 -3
- package/build/cjs/cc/ClockCC.d.ts +3 -4
- package/build/cjs/cc/ClockCC.js +13 -14
- package/build/cjs/cc/ClockCC.js.map +3 -3
- package/build/cjs/cc/ColorSwitchCC.d.ts +3 -4
- package/build/cjs/cc/ColorSwitchCC.js +22 -24
- package/build/cjs/cc/ColorSwitchCC.js.map +3 -3
- package/build/cjs/cc/ConfigurationCC.d.ts +3 -3
- package/build/cjs/cc/ConfigurationCC.js +114 -115
- package/build/cjs/cc/ConfigurationCC.js.map +3 -3
- package/build/cjs/cc/DeviceResetLocallyCC.d.ts +2 -2
- package/build/cjs/cc/DeviceResetLocallyCC.js +5 -5
- package/build/cjs/cc/DeviceResetLocallyCC.js.map +1 -1
- package/build/cjs/cc/DoorLockCC.d.ts +29 -29
- package/build/cjs/cc/DoorLockCC.js +39 -40
- package/build/cjs/cc/DoorLockCC.js.map +3 -3
- package/build/cjs/cc/DoorLockLoggingCC.d.ts +4 -4
- package/build/cjs/cc/DoorLockLoggingCC.js +13 -14
- package/build/cjs/cc/DoorLockLoggingCC.js.map +3 -3
- package/build/cjs/cc/EnergyProductionCC.d.ts +2 -3
- package/build/cjs/cc/EnergyProductionCC.js.map +2 -2
- package/build/cjs/cc/EntryControlCC.d.ts +8 -8
- package/build/cjs/cc/EntryControlCC.js +41 -42
- package/build/cjs/cc/EntryControlCC.js.map +3 -3
- package/build/cjs/cc/FirmwareUpdateMetaDataCC.d.ts +9 -10
- package/build/cjs/cc/FirmwareUpdateMetaDataCC.js +52 -53
- package/build/cjs/cc/FirmwareUpdateMetaDataCC.js.map +3 -3
- package/build/cjs/cc/HailCC.js +2 -2
- package/build/cjs/cc/HailCC.js.map +1 -1
- package/build/cjs/cc/HumidityControlModeCC.d.ts +5 -5
- package/build/cjs/cc/HumidityControlModeCC.js +20 -21
- package/build/cjs/cc/HumidityControlModeCC.js.map +3 -3
- package/build/cjs/cc/HumidityControlOperatingStateCC.d.ts +3 -3
- package/build/cjs/cc/HumidityControlOperatingStateCC.js +9 -9
- package/build/cjs/cc/HumidityControlOperatingStateCC.js.map +3 -3
- package/build/cjs/cc/HumidityControlSetpointCC.d.ts +6 -6
- package/build/cjs/cc/HumidityControlSetpointCC.js +43 -44
- package/build/cjs/cc/HumidityControlSetpointCC.js.map +3 -3
- package/build/cjs/cc/InclusionControllerCC.d.ts +2 -3
- package/build/cjs/cc/InclusionControllerCC.js.map +2 -2
- package/build/cjs/cc/IndicatorCC.d.ts +3 -3
- package/build/cjs/cc/IndicatorCC.js +50 -52
- package/build/cjs/cc/IndicatorCC.js.map +3 -3
- package/build/cjs/cc/IrrigationCC.d.ts +3 -3
- package/build/cjs/cc/IrrigationCC.js +74 -75
- package/build/cjs/cc/IrrigationCC.js.map +3 -3
- package/build/cjs/cc/LanguageCC.d.ts +5 -6
- package/build/cjs/cc/LanguageCC.js +14 -15
- package/build/cjs/cc/LanguageCC.js.map +3 -3
- package/build/cjs/cc/LockCC.d.ts +4 -4
- package/build/cjs/cc/LockCC.js +10 -10
- package/build/cjs/cc/LockCC.js.map +3 -3
- package/build/cjs/cc/ManufacturerProprietaryCC.d.ts +3 -3
- package/build/cjs/cc/ManufacturerProprietaryCC.js +10 -10
- package/build/cjs/cc/ManufacturerProprietaryCC.js.map +3 -3
- package/build/cjs/cc/ManufacturerSpecificCC.d.ts +7 -8
- package/build/cjs/cc/ManufacturerSpecificCC.js +20 -21
- package/build/cjs/cc/ManufacturerSpecificCC.js.map +3 -3
- package/build/cjs/cc/MeterCC.d.ts +4 -6
- package/build/cjs/cc/MeterCC.js +52 -54
- package/build/cjs/cc/MeterCC.js.map +3 -3
- package/build/cjs/cc/MultiChannelAssociationCC.d.ts +7 -8
- package/build/cjs/cc/MultiChannelAssociationCC.js +34 -35
- package/build/cjs/cc/MultiChannelAssociationCC.js.map +3 -3
- package/build/cjs/cc/MultiChannelCC.d.ts +11 -11
- package/build/cjs/cc/MultiChannelCC.js +53 -53
- package/build/cjs/cc/MultiChannelCC.js.map +3 -3
- package/build/cjs/cc/MultiCommandCC.d.ts +3 -3
- package/build/cjs/cc/MultiCommandCC.js +13 -13
- package/build/cjs/cc/MultiCommandCC.js.map +3 -3
- package/build/cjs/cc/MultilevelSensorCC.d.ts +4 -7
- package/build/cjs/cc/MultilevelSensorCC.js +26 -28
- package/build/cjs/cc/MultilevelSensorCC.js.map +3 -3
- package/build/cjs/cc/MultilevelSwitchCC._validateArgs.js +3 -3
- package/build/cjs/cc/MultilevelSwitchCC.d.ts +13 -13
- package/build/cjs/cc/MultilevelSwitchCC.js +36 -37
- package/build/cjs/cc/MultilevelSwitchCC.js.map +3 -3
- package/build/cjs/cc/NoOperationCC.js +4 -4
- package/build/cjs/cc/NoOperationCC.js.map +1 -1
- package/build/cjs/cc/NodeNamingCC.d.ts +5 -5
- package/build/cjs/cc/NodeNamingCC.js +20 -20
- package/build/cjs/cc/NodeNamingCC.js.map +3 -3
- package/build/cjs/cc/NotificationCC.d.ts +4 -5
- package/build/cjs/cc/NotificationCC.js +66 -68
- package/build/cjs/cc/NotificationCC.js.map +3 -3
- package/build/cjs/cc/PowerlevelCC.d.ts +3 -3
- package/build/cjs/cc/PowerlevelCC.js +25 -26
- package/build/cjs/cc/PowerlevelCC.js.map +3 -3
- package/build/cjs/cc/ProtectionCC._validateArgs.js +2 -2
- package/build/cjs/cc/ProtectionCC.d.ts +11 -11
- package/build/cjs/cc/ProtectionCC.js +35 -36
- package/build/cjs/cc/ProtectionCC.js.map +3 -3
- package/build/cjs/cc/SceneActivationCC._validateArgs.js +2 -2
- package/build/cjs/cc/SceneActivationCC.d.ts +5 -6
- package/build/cjs/cc/SceneActivationCC.js +10 -10
- package/build/cjs/cc/SceneActivationCC.js.map +3 -3
- package/build/cjs/cc/SceneActuatorConfigurationCC._validateArgs.js +2 -2
- package/build/cjs/cc/SceneActuatorConfigurationCC.d.ts +5 -5
- package/build/cjs/cc/SceneActuatorConfigurationCC.js +19 -20
- package/build/cjs/cc/SceneActuatorConfigurationCC.js.map +3 -3
- package/build/cjs/cc/SceneControllerConfigurationCC._validateArgs.js +2 -2
- package/build/cjs/cc/SceneControllerConfigurationCC.d.ts +6 -6
- package/build/cjs/cc/SceneControllerConfigurationCC.js +25 -26
- package/build/cjs/cc/SceneControllerConfigurationCC.js.map +3 -3
- package/build/cjs/cc/ScheduleEntryLockCC.d.ts +2 -3
- package/build/cjs/cc/ScheduleEntryLockCC.js.map +2 -2
- package/build/cjs/cc/Security2CC.d.ts +3 -4
- package/build/cjs/cc/Security2CC.js +60 -62
- package/build/cjs/cc/Security2CC.js.map +3 -3
- package/build/cjs/cc/SecurityCC.d.ts +3 -4
- package/build/cjs/cc/SecurityCC.js +25 -26
- package/build/cjs/cc/SecurityCC.js.map +3 -3
- package/build/cjs/cc/SoundSwitchCC.d.ts +7 -7
- package/build/cjs/cc/SoundSwitchCC.js +28 -29
- package/build/cjs/cc/SoundSwitchCC.js.map +3 -3
- package/build/cjs/cc/SupervisionCC.d.ts +4 -4
- package/build/cjs/cc/SupervisionCC.js +28 -29
- package/build/cjs/cc/SupervisionCC.js.map +3 -3
- package/build/cjs/cc/ThermostatFanModeCC.d.ts +6 -6
- package/build/cjs/cc/ThermostatFanModeCC.js +21 -22
- package/build/cjs/cc/ThermostatFanModeCC.js.map +3 -3
- package/build/cjs/cc/ThermostatFanStateCC.d.ts +3 -3
- package/build/cjs/cc/ThermostatFanStateCC.js +9 -9
- package/build/cjs/cc/ThermostatFanStateCC.js.map +3 -3
- package/build/cjs/cc/ThermostatModeCC.d.ts +6 -6
- package/build/cjs/cc/ThermostatModeCC.js +30 -31
- package/build/cjs/cc/ThermostatModeCC.js.map +3 -3
- package/build/cjs/cc/ThermostatOperatingStateCC.d.ts +3 -4
- package/build/cjs/cc/ThermostatOperatingStateCC.js +9 -9
- package/build/cjs/cc/ThermostatOperatingStateCC.js.map +3 -3
- package/build/cjs/cc/ThermostatSetbackCC.d.ts +3 -3
- package/build/cjs/cc/ThermostatSetbackCC.js +14 -15
- package/build/cjs/cc/ThermostatSetbackCC.js.map +3 -3
- package/build/cjs/cc/ThermostatSetpointCC.d.ts +6 -6
- package/build/cjs/cc/ThermostatSetpointCC.js +48 -49
- package/build/cjs/cc/ThermostatSetpointCC.js.map +3 -3
- package/build/cjs/cc/TimeCC.d.ts +3 -4
- package/build/cjs/cc/TimeCC.js +9 -10
- package/build/cjs/cc/TimeCC.js.map +3 -3
- package/build/cjs/cc/TimeParametersCC.d.ts +3 -4
- package/build/cjs/cc/TimeParametersCC.js +2 -2
- package/build/cjs/cc/TimeParametersCC.js.map +2 -2
- package/build/cjs/cc/TransportServiceCC.d.ts +3 -3
- package/build/cjs/cc/TransportServiceCC.js +44 -45
- package/build/cjs/cc/TransportServiceCC.js.map +3 -3
- package/build/cjs/cc/UserCodeCC.d.ts +19 -19
- package/build/cjs/cc/UserCodeCC.js +102 -103
- package/build/cjs/cc/UserCodeCC.js.map +3 -3
- package/build/cjs/cc/VersionCC.d.ts +17 -17
- package/build/cjs/cc/VersionCC.js +46 -47
- package/build/cjs/cc/VersionCC.js.map +3 -3
- package/build/cjs/cc/WakeUpCC.d.ts +6 -6
- package/build/cjs/cc/WakeUpCC.js +16 -17
- package/build/cjs/cc/WakeUpCC.js.map +3 -3
- package/build/cjs/cc/WindowCoveringCC.d.ts +3 -4
- package/build/cjs/cc/WindowCoveringCC.js +17 -18
- package/build/cjs/cc/WindowCoveringCC.js.map +3 -3
- package/build/cjs/cc/ZWavePlusCC.d.ts +8 -8
- package/build/cjs/cc/ZWavePlusCC.js +15 -16
- package/build/cjs/cc/ZWavePlusCC.js.map +3 -3
- package/build/cjs/cc/ZWaveProtocolCC.d.ts +2 -2
- package/build/cjs/cc/ZWaveProtocolCC.js +35 -35
- package/build/cjs/cc/ZWaveProtocolCC.js.map +2 -2
- package/build/cjs/cc/_CCValues.generated.js +24 -26
- package/build/cjs/cc/_CCValues.generated.js.map +3 -3
- package/build/cjs/cc/manufacturerProprietary/FibaroCC.d.ts +3 -3
- package/build/cjs/cc/manufacturerProprietary/FibaroCC.js +14 -14
- package/build/cjs/cc/manufacturerProprietary/FibaroCC.js.map +1 -1
- package/build/cjs/lib/API.d.ts +3 -3
- package/build/cjs/lib/API.js.map +2 -2
- package/build/cjs/lib/CommandClass.d.ts +5 -6
- package/build/cjs/lib/CommandClass.js +45 -45
- package/build/cjs/lib/CommandClass.js.map +3 -3
- package/build/cjs/lib/CommandClassDecorators.d.ts +2 -2
- package/build/cjs/lib/CommandClassDecorators.js +3 -3
- package/build/cjs/lib/CommandClassDecorators.js.map +2 -2
- package/build/cjs/lib/Security2/Extension.d.ts +2 -2
- package/build/cjs/lib/Security2/Extension.js +17 -17
- package/build/cjs/lib/Security2/Extension.js.map +3 -3
- package/build/cjs/lib/SetValueResult.d.ts +1 -1
- package/build/cjs/lib/SetValueResult.js.map +1 -1
- package/build/cjs/lib/Values.d.ts +3 -3
- package/build/cjs/lib/Values.js +6 -6
- package/build/cjs/lib/Values.js.map +2 -2
- package/build/cjs/lib/_Types.d.ts +2 -2
- package/build/cjs/lib/_Types.js +3 -3
- package/build/cjs/lib/_Types.js.map +1 -1
- package/build/cjs/lib/serializers.d.ts +1 -1
- package/build/cjs/lib/serializers.js +5 -5
- package/build/cjs/lib/serializers.js.map +2 -2
- package/build/cjs/lib/traits.d.ts +2 -2
- package/build/cjs/lib/utils.d.ts +2 -2
- package/build/cjs/lib/utils.js +60 -60
- package/build/cjs/lib/utils.js.map +3 -3
- package/build/esm/cc/AlarmSensorCC.d.ts +7 -7
- package/build/esm/cc/AlarmSensorCC.d.ts.map +1 -1
- package/build/esm/cc/AlarmSensorCC.js +2 -3
- package/build/esm/cc/AlarmSensorCC.js.map +1 -1
- package/build/esm/cc/AssociationCC.d.ts +8 -9
- package/build/esm/cc/AssociationCC.d.ts.map +1 -1
- package/build/esm/cc/AssociationCC.js +2 -2
- package/build/esm/cc/AssociationCC.js.map +1 -1
- package/build/esm/cc/AssociationGroupInfoCC.d.ts +7 -7
- package/build/esm/cc/AssociationGroupInfoCC.d.ts.map +1 -1
- package/build/esm/cc/AssociationGroupInfoCC.js +2 -3
- package/build/esm/cc/AssociationGroupInfoCC.js.map +1 -1
- package/build/esm/cc/BarrierOperatorCC.d.ts +8 -8
- package/build/esm/cc/BarrierOperatorCC.d.ts.map +1 -1
- package/build/esm/cc/BarrierOperatorCC.js +2 -3
- package/build/esm/cc/BarrierOperatorCC.js.map +1 -1
- package/build/esm/cc/BasicCC.d.ts +4 -4
- package/build/esm/cc/BasicCC.d.ts.map +1 -1
- package/build/esm/cc/BasicCC.js +2 -3
- package/build/esm/cc/BasicCC.js.map +1 -1
- package/build/esm/cc/BatteryCC.d.ts +4 -7
- package/build/esm/cc/BatteryCC.d.ts.map +1 -1
- package/build/esm/cc/BatteryCC.js +2 -4
- package/build/esm/cc/BatteryCC.js.map +1 -1
- package/build/esm/cc/BinarySensorCC.d.ts +5 -5
- package/build/esm/cc/BinarySensorCC.d.ts.map +1 -1
- package/build/esm/cc/BinarySensorCC.js +2 -3
- package/build/esm/cc/BinarySensorCC.js.map +1 -1
- package/build/esm/cc/BinarySwitchCC._validateArgs.js +1 -1
- package/build/esm/cc/BinarySwitchCC._validateArgs.js.map +1 -1
- package/build/esm/cc/BinarySwitchCC.d.ts +6 -6
- package/build/esm/cc/BinarySwitchCC.d.ts.map +1 -1
- package/build/esm/cc/BinarySwitchCC.js +2 -2
- package/build/esm/cc/BinarySwitchCC.js.map +1 -1
- package/build/esm/cc/CRC16CC.d.ts +3 -3
- package/build/esm/cc/CRC16CC.d.ts.map +1 -1
- package/build/esm/cc/CRC16CC.js +2 -2
- package/build/esm/cc/CRC16CC.js.map +1 -1
- package/build/esm/cc/CentralSceneCC.d.ts +8 -8
- package/build/esm/cc/CentralSceneCC.d.ts.map +1 -1
- package/build/esm/cc/CentralSceneCC.js +2 -3
- package/build/esm/cc/CentralSceneCC.js.map +1 -1
- package/build/esm/cc/ClimateControlScheduleCC.d.ts +6 -6
- package/build/esm/cc/ClimateControlScheduleCC.d.ts.map +1 -1
- package/build/esm/cc/ClimateControlScheduleCC.js +2 -3
- package/build/esm/cc/ClimateControlScheduleCC.js.map +1 -1
- package/build/esm/cc/ClockCC.d.ts +3 -4
- package/build/esm/cc/ClockCC.d.ts.map +1 -1
- package/build/esm/cc/ClockCC.js +2 -3
- package/build/esm/cc/ClockCC.js.map +1 -1
- package/build/esm/cc/ColorSwitchCC.d.ts +3 -4
- package/build/esm/cc/ColorSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/ColorSwitchCC.js +2 -4
- package/build/esm/cc/ColorSwitchCC.js.map +1 -1
- package/build/esm/cc/ConfigurationCC.d.ts +3 -3
- package/build/esm/cc/ConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/ConfigurationCC.js +2 -3
- package/build/esm/cc/ConfigurationCC.js.map +1 -1
- package/build/esm/cc/DeviceResetLocallyCC.d.ts +2 -2
- package/build/esm/cc/DeviceResetLocallyCC.d.ts.map +1 -1
- package/build/esm/cc/DeviceResetLocallyCC.js +1 -1
- package/build/esm/cc/DeviceResetLocallyCC.js.map +1 -1
- package/build/esm/cc/DoorLockCC.d.ts +29 -29
- package/build/esm/cc/DoorLockCC.d.ts.map +1 -1
- package/build/esm/cc/DoorLockCC.js +2 -3
- package/build/esm/cc/DoorLockCC.js.map +1 -1
- package/build/esm/cc/DoorLockLoggingCC.d.ts +4 -4
- package/build/esm/cc/DoorLockLoggingCC.d.ts.map +1 -1
- package/build/esm/cc/DoorLockLoggingCC.js +2 -3
- package/build/esm/cc/DoorLockLoggingCC.js.map +1 -1
- package/build/esm/cc/EnergyProductionCC.d.ts +2 -3
- package/build/esm/cc/EnergyProductionCC.d.ts.map +1 -1
- package/build/esm/cc/EnergyProductionCC.js.map +1 -1
- package/build/esm/cc/EntryControlCC.d.ts +8 -8
- package/build/esm/cc/EntryControlCC.d.ts.map +1 -1
- package/build/esm/cc/EntryControlCC.js +2 -3
- package/build/esm/cc/EntryControlCC.js.map +1 -1
- package/build/esm/cc/FirmwareUpdateMetaDataCC.d.ts +9 -10
- package/build/esm/cc/FirmwareUpdateMetaDataCC.d.ts.map +1 -1
- package/build/esm/cc/FirmwareUpdateMetaDataCC.js +2 -3
- package/build/esm/cc/FirmwareUpdateMetaDataCC.js.map +1 -1
- package/build/esm/cc/HailCC.js +1 -1
- package/build/esm/cc/HailCC.js.map +1 -1
- package/build/esm/cc/HumidityControlModeCC.d.ts +5 -5
- package/build/esm/cc/HumidityControlModeCC.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlModeCC.js +2 -3
- package/build/esm/cc/HumidityControlModeCC.js.map +1 -1
- package/build/esm/cc/HumidityControlOperatingStateCC.d.ts +3 -3
- package/build/esm/cc/HumidityControlOperatingStateCC.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlOperatingStateCC.js +2 -2
- package/build/esm/cc/HumidityControlOperatingStateCC.js.map +1 -1
- package/build/esm/cc/HumidityControlSetpointCC.d.ts +6 -6
- package/build/esm/cc/HumidityControlSetpointCC.d.ts.map +1 -1
- package/build/esm/cc/HumidityControlSetpointCC.js +2 -3
- package/build/esm/cc/HumidityControlSetpointCC.js.map +1 -1
- package/build/esm/cc/InclusionControllerCC.d.ts +2 -3
- package/build/esm/cc/InclusionControllerCC.d.ts.map +1 -1
- package/build/esm/cc/InclusionControllerCC.js.map +1 -1
- package/build/esm/cc/IndicatorCC.d.ts +3 -3
- package/build/esm/cc/IndicatorCC.d.ts.map +1 -1
- package/build/esm/cc/IndicatorCC.js +2 -4
- package/build/esm/cc/IndicatorCC.js.map +1 -1
- package/build/esm/cc/IrrigationCC.d.ts +3 -3
- package/build/esm/cc/IrrigationCC.d.ts.map +1 -1
- package/build/esm/cc/IrrigationCC.js +2 -3
- package/build/esm/cc/IrrigationCC.js.map +1 -1
- package/build/esm/cc/LanguageCC.d.ts +5 -6
- package/build/esm/cc/LanguageCC.d.ts.map +1 -1
- package/build/esm/cc/LanguageCC.js +2 -3
- package/build/esm/cc/LanguageCC.js.map +1 -1
- package/build/esm/cc/LockCC.d.ts +4 -4
- package/build/esm/cc/LockCC.d.ts.map +1 -1
- package/build/esm/cc/LockCC.js +2 -2
- package/build/esm/cc/LockCC.js.map +1 -1
- package/build/esm/cc/ManufacturerProprietaryCC.d.ts +3 -3
- package/build/esm/cc/ManufacturerProprietaryCC.d.ts.map +1 -1
- package/build/esm/cc/ManufacturerProprietaryCC.js +2 -2
- package/build/esm/cc/ManufacturerProprietaryCC.js.map +1 -1
- package/build/esm/cc/ManufacturerSpecificCC.d.ts +7 -8
- package/build/esm/cc/ManufacturerSpecificCC.d.ts.map +1 -1
- package/build/esm/cc/ManufacturerSpecificCC.js +2 -3
- package/build/esm/cc/ManufacturerSpecificCC.js.map +1 -1
- package/build/esm/cc/MeterCC.d.ts +4 -6
- package/build/esm/cc/MeterCC.d.ts.map +1 -1
- package/build/esm/cc/MeterCC.js +2 -4
- package/build/esm/cc/MeterCC.js.map +1 -1
- package/build/esm/cc/MultiChannelAssociationCC.d.ts +7 -8
- package/build/esm/cc/MultiChannelAssociationCC.d.ts.map +1 -1
- package/build/esm/cc/MultiChannelAssociationCC.js +2 -3
- package/build/esm/cc/MultiChannelAssociationCC.js.map +1 -1
- package/build/esm/cc/MultiChannelCC.d.ts +11 -11
- package/build/esm/cc/MultiChannelCC.d.ts.map +1 -1
- package/build/esm/cc/MultiChannelCC.js +2 -2
- package/build/esm/cc/MultiChannelCC.js.map +1 -1
- package/build/esm/cc/MultiCommandCC.d.ts +3 -3
- package/build/esm/cc/MultiCommandCC.d.ts.map +1 -1
- package/build/esm/cc/MultiCommandCC.js +2 -2
- package/build/esm/cc/MultiCommandCC.js.map +1 -1
- package/build/esm/cc/MultilevelSensorCC.d.ts +4 -7
- package/build/esm/cc/MultilevelSensorCC.d.ts.map +1 -1
- package/build/esm/cc/MultilevelSensorCC.js +2 -4
- package/build/esm/cc/MultilevelSensorCC.js.map +1 -1
- package/build/esm/cc/MultilevelSwitchCC._validateArgs.js +1 -1
- package/build/esm/cc/MultilevelSwitchCC._validateArgs.js.map +1 -1
- package/build/esm/cc/MultilevelSwitchCC.d.ts +13 -13
- package/build/esm/cc/MultilevelSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/MultilevelSwitchCC.js +2 -3
- package/build/esm/cc/MultilevelSwitchCC.js.map +1 -1
- package/build/esm/cc/NoOperationCC.js +1 -1
- package/build/esm/cc/NoOperationCC.js.map +1 -1
- package/build/esm/cc/NodeNamingCC.d.ts +5 -5
- package/build/esm/cc/NodeNamingCC.d.ts.map +1 -1
- package/build/esm/cc/NodeNamingCC.js +2 -2
- package/build/esm/cc/NodeNamingCC.js.map +1 -1
- package/build/esm/cc/NotificationCC.d.ts +4 -5
- package/build/esm/cc/NotificationCC.d.ts.map +1 -1
- package/build/esm/cc/NotificationCC.js +2 -4
- package/build/esm/cc/NotificationCC.js.map +1 -1
- package/build/esm/cc/PowerlevelCC.d.ts +3 -3
- package/build/esm/cc/PowerlevelCC.d.ts.map +1 -1
- package/build/esm/cc/PowerlevelCC.js +2 -3
- package/build/esm/cc/PowerlevelCC.js.map +1 -1
- package/build/esm/cc/ProtectionCC._validateArgs.js +1 -1
- package/build/esm/cc/ProtectionCC._validateArgs.js.map +1 -1
- package/build/esm/cc/ProtectionCC.d.ts +11 -11
- package/build/esm/cc/ProtectionCC.d.ts.map +1 -1
- package/build/esm/cc/ProtectionCC.js +2 -3
- package/build/esm/cc/ProtectionCC.js.map +1 -1
- package/build/esm/cc/SceneActivationCC._validateArgs.js +1 -1
- package/build/esm/cc/SceneActivationCC._validateArgs.js.map +1 -1
- package/build/esm/cc/SceneActivationCC.d.ts +5 -6
- package/build/esm/cc/SceneActivationCC.d.ts.map +1 -1
- package/build/esm/cc/SceneActivationCC.js +2 -2
- package/build/esm/cc/SceneActivationCC.js.map +1 -1
- package/build/esm/cc/SceneActuatorConfigurationCC._validateArgs.js +1 -1
- package/build/esm/cc/SceneActuatorConfigurationCC._validateArgs.js.map +1 -1
- package/build/esm/cc/SceneActuatorConfigurationCC.d.ts +5 -5
- package/build/esm/cc/SceneActuatorConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/SceneActuatorConfigurationCC.js +2 -3
- package/build/esm/cc/SceneActuatorConfigurationCC.js.map +1 -1
- package/build/esm/cc/SceneControllerConfigurationCC._validateArgs.js +1 -1
- package/build/esm/cc/SceneControllerConfigurationCC._validateArgs.js.map +1 -1
- package/build/esm/cc/SceneControllerConfigurationCC.d.ts +6 -6
- package/build/esm/cc/SceneControllerConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/SceneControllerConfigurationCC.js +2 -3
- package/build/esm/cc/SceneControllerConfigurationCC.js.map +1 -1
- package/build/esm/cc/ScheduleEntryLockCC.d.ts +2 -3
- package/build/esm/cc/ScheduleEntryLockCC.d.ts.map +1 -1
- package/build/esm/cc/ScheduleEntryLockCC.js.map +1 -1
- package/build/esm/cc/Security2CC.d.ts +3 -4
- package/build/esm/cc/Security2CC.d.ts.map +1 -1
- package/build/esm/cc/Security2CC.js +2 -4
- package/build/esm/cc/Security2CC.js.map +1 -1
- package/build/esm/cc/SecurityCC.d.ts +3 -4
- package/build/esm/cc/SecurityCC.d.ts.map +1 -1
- package/build/esm/cc/SecurityCC.js +1 -2
- package/build/esm/cc/SecurityCC.js.map +1 -1
- package/build/esm/cc/SoundSwitchCC.d.ts +7 -7
- package/build/esm/cc/SoundSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/SoundSwitchCC.js +2 -3
- package/build/esm/cc/SoundSwitchCC.js.map +1 -1
- package/build/esm/cc/SupervisionCC.d.ts +4 -4
- package/build/esm/cc/SupervisionCC.d.ts.map +1 -1
- package/build/esm/cc/SupervisionCC.js +2 -3
- package/build/esm/cc/SupervisionCC.js.map +1 -1
- package/build/esm/cc/ThermostatFanModeCC.d.ts +6 -6
- package/build/esm/cc/ThermostatFanModeCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatFanModeCC.js +2 -3
- package/build/esm/cc/ThermostatFanModeCC.js.map +1 -1
- package/build/esm/cc/ThermostatFanStateCC.d.ts +3 -3
- package/build/esm/cc/ThermostatFanStateCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatFanStateCC.js +2 -2
- package/build/esm/cc/ThermostatFanStateCC.js.map +1 -1
- package/build/esm/cc/ThermostatModeCC.d.ts +6 -6
- package/build/esm/cc/ThermostatModeCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatModeCC.js +2 -3
- package/build/esm/cc/ThermostatModeCC.js.map +1 -1
- package/build/esm/cc/ThermostatOperatingStateCC.d.ts +3 -4
- package/build/esm/cc/ThermostatOperatingStateCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatOperatingStateCC.js +2 -2
- package/build/esm/cc/ThermostatOperatingStateCC.js.map +1 -1
- package/build/esm/cc/ThermostatSetbackCC.d.ts +3 -3
- package/build/esm/cc/ThermostatSetbackCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatSetbackCC.js +2 -3
- package/build/esm/cc/ThermostatSetbackCC.js.map +1 -1
- package/build/esm/cc/ThermostatSetpointCC.d.ts +6 -6
- package/build/esm/cc/ThermostatSetpointCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatSetpointCC.js +2 -3
- package/build/esm/cc/ThermostatSetpointCC.js.map +1 -1
- package/build/esm/cc/TimeCC.d.ts +3 -4
- package/build/esm/cc/TimeCC.d.ts.map +1 -1
- package/build/esm/cc/TimeCC.js +1 -2
- package/build/esm/cc/TimeCC.js.map +1 -1
- package/build/esm/cc/TimeParametersCC.d.ts +3 -4
- package/build/esm/cc/TimeParametersCC.d.ts.map +1 -1
- package/build/esm/cc/TimeParametersCC.js +1 -1
- package/build/esm/cc/TimeParametersCC.js.map +1 -1
- package/build/esm/cc/TransportServiceCC.d.ts +3 -3
- package/build/esm/cc/TransportServiceCC.d.ts.map +1 -1
- package/build/esm/cc/TransportServiceCC.js +2 -3
- package/build/esm/cc/TransportServiceCC.js.map +1 -1
- package/build/esm/cc/UserCodeCC.d.ts +19 -19
- package/build/esm/cc/UserCodeCC.d.ts.map +1 -1
- package/build/esm/cc/UserCodeCC.js +2 -3
- package/build/esm/cc/UserCodeCC.js.map +1 -1
- package/build/esm/cc/VersionCC.d.ts +17 -17
- package/build/esm/cc/VersionCC.d.ts.map +1 -1
- package/build/esm/cc/VersionCC.js +2 -3
- package/build/esm/cc/VersionCC.js.map +1 -1
- package/build/esm/cc/WakeUpCC.d.ts +6 -6
- package/build/esm/cc/WakeUpCC.d.ts.map +1 -1
- package/build/esm/cc/WakeUpCC.js +2 -3
- package/build/esm/cc/WakeUpCC.js.map +1 -1
- package/build/esm/cc/WindowCoveringCC.d.ts +3 -4
- package/build/esm/cc/WindowCoveringCC.d.ts.map +1 -1
- package/build/esm/cc/WindowCoveringCC.js +1 -2
- package/build/esm/cc/WindowCoveringCC.js.map +1 -1
- package/build/esm/cc/ZWavePlusCC.d.ts +8 -8
- package/build/esm/cc/ZWavePlusCC.d.ts.map +1 -1
- package/build/esm/cc/ZWavePlusCC.js +2 -3
- package/build/esm/cc/ZWavePlusCC.js.map +1 -1
- package/build/esm/cc/ZWaveProtocolCC.d.ts +2 -2
- package/build/esm/cc/ZWaveProtocolCC.d.ts.map +1 -1
- package/build/esm/cc/ZWaveProtocolCC.js +1 -1
- package/build/esm/cc/ZWaveProtocolCC.js.map +1 -1
- package/build/esm/cc/_CCValues.generated.d.ts.map +1 -1
- package/build/esm/cc/_CCValues.generated.js +2 -4
- package/build/esm/cc/_CCValues.generated.js.map +1 -1
- package/build/esm/cc/manufacturerProprietary/FibaroCC.d.ts +3 -3
- package/build/esm/cc/manufacturerProprietary/FibaroCC.d.ts.map +1 -1
- package/build/esm/cc/manufacturerProprietary/FibaroCC.js +1 -1
- package/build/esm/cc/manufacturerProprietary/FibaroCC.js.map +1 -1
- package/build/esm/lib/API.d.ts +3 -3
- package/build/esm/lib/API.d.ts.map +1 -1
- package/build/esm/lib/API.js.map +1 -1
- package/build/esm/lib/CommandClass.d.ts +5 -6
- package/build/esm/lib/CommandClass.d.ts.map +1 -1
- package/build/esm/lib/CommandClass.js +2 -2
- package/build/esm/lib/CommandClass.js.map +1 -1
- package/build/esm/lib/CommandClassDecorators.d.ts +2 -2
- package/build/esm/lib/CommandClassDecorators.d.ts.map +1 -1
- package/build/esm/lib/CommandClassDecorators.js +1 -1
- package/build/esm/lib/CommandClassDecorators.js.map +1 -1
- package/build/esm/lib/Security2/Extension.d.ts +2 -2
- package/build/esm/lib/Security2/Extension.d.ts.map +1 -1
- package/build/esm/lib/Security2/Extension.js +2 -2
- package/build/esm/lib/Security2/Extension.js.map +1 -1
- package/build/esm/lib/SetValueResult.d.ts +1 -1
- package/build/esm/lib/SetValueResult.d.ts.map +1 -1
- package/build/esm/lib/Values.d.ts +3 -3
- package/build/esm/lib/Values.d.ts.map +1 -1
- package/build/esm/lib/Values.js +1 -1
- package/build/esm/lib/Values.js.map +1 -1
- package/build/esm/lib/_Types.d.ts +2 -2
- package/build/esm/lib/_Types.d.ts.map +1 -1
- package/build/esm/lib/_Types.js +1 -1
- package/build/esm/lib/_Types.js.map +1 -1
- package/build/esm/lib/serializers.d.ts +1 -1
- package/build/esm/lib/serializers.d.ts.map +1 -1
- package/build/esm/lib/serializers.js +1 -1
- package/build/esm/lib/serializers.js.map +1 -1
- package/build/esm/lib/traits.d.ts +2 -2
- package/build/esm/lib/traits.d.ts.map +1 -1
- package/build/esm/lib/utils.d.ts +2 -2
- package/build/esm/lib/utils.d.ts.map +1 -1
- package/build/esm/lib/utils.js +2 -2
- package/build/esm/lib/utils.js.map +1 -1
- package/package.json +6 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/CommandClassDecorators.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n\tcreateReflectionDecorator,\n\tcreateReflectionDecoratorPair,\n\tcreateValuelessReflectionDecorator,\n} from \"@zwave-js/core/reflection\";\nimport {\n\ttype CommandClasses,\n\tZWaveError,\n\tZWaveErrorCodes,\n} from \"@zwave-js/core/safe\";\nimport type { TypedClassDecorator } from \"@zwave-js/shared\";\nimport type { APIConstructor, CCAPI } from \"./API.js\";\nimport {\n\ttype CCConstructor,\n\ttype CCResponsePredicate,\n\ttype CommandClass,\n\ttype DynamicCCResponse,\n} from \"./CommandClass.js\";\nimport type {\n\tDynamicCCValue,\n\tStaticCCValue,\n\tStaticCCValueFactory,\n} from \"./Values.js\";\n\nconst CCAndCommandDecorator = createReflectionDecoratorPair<\n\ttypeof CommandClass,\n\t[ccId: CommandClasses],\n\t[ccCommand: number],\n\tCCConstructor<CommandClass>\n>({ superName: \"ccId\", subName: \"ccCommand\" });\n\n/**\n * @publicAPI\n * Defines the CC ID associated with a Z-Wave Command Class\n */\nexport const commandClass = CCAndCommandDecorator.superDecorator;\n\n/**\n * @publicAPI\n * Looks up the command class constructor for a given CC ID\n */\nexport const getCCConstructor = CCAndCommandDecorator.lookupSuperConstructor;\n\n/**\n * @publicAPI\n * Defines the CC command a subclass of a CC implements\n */\nexport const CCCommand = CCAndCommandDecorator.subDecorator;\n\n/**\n * @publicAPI\n * Retrieves the CC command a subclass of a CC implements\n */\nexport const getCCCommand = CCAndCommandDecorator.lookupSubValue;\n\n/**\n * @publicAPI\n * Looks up the command class constructor for a given CC ID and command\n */\nexport const getCCCommandConstructor =\n\tCCAndCommandDecorator.lookupSubConstructor;\n\n/**\n * @publicAPI\n * Retrieves the CC ID defined for a Z-Wave Command Class\n */\nexport function getCommandClassStatic<T extends CCConstructor<CommandClass>>(\n\tclassConstructor: T,\n): CommandClasses {\n\t// retrieve the current metadata\n\tconst ret = CCAndCommandDecorator.lookupSuperValueStatic(classConstructor);\n\tif (ret == undefined) {\n\t\tthrow new ZWaveError(\n\t\t\t`No command class defined for ${classConstructor.name}!`,\n\t\t\tZWaveErrorCodes.CC_Invalid,\n\t\t);\n\t}\n\treturn ret;\n}\n\nconst apiDecorator = createReflectionDecorator<\n\ttypeof CCAPI,\n\t[cc: CommandClasses],\n\tCommandClasses,\n\tAPIConstructor\n>({\n\tname: \"API\",\n\tvalueFromArgs: (cc) => cc,\n});\n\n/**\n * @publicAPI\n * Defines the CC ID a CC API implementation belongs to\n */\nexport const API = apiDecorator.decorator;\n\n/**\n * @publicAPI\n * Retrieves the CC API constructor that is defined for a Z-Wave CC ID\n */\nexport function getAPI(cc: CommandClasses): APIConstructor | undefined {\n\treturn apiDecorator.lookupConstructorByValue(cc);\n}\n\n/**\n * @publicAPI\n * Retrieves the CC ID associated with a Z-Wave Command Class or CC API\n */\nexport function getCommandClass(cc: CommandClass | CCAPI): CommandClasses {\n\t// get the class constructor\n\tconst constr = cc.constructor;\n\t// retrieve the current metadata\n\tconst ret = CCAndCommandDecorator.lookupSuperValueStatic(\n\t\tconstr as typeof CommandClass,\n\t)\n\t\t?? apiDecorator.lookupValueStatic(constr as typeof CCAPI);\n\n\tif (ret == undefined) {\n\t\tthrow new ZWaveError(\n\t\t\t`No command class defined for ${constr.name}!`,\n\t\t\tZWaveErrorCodes.CC_Invalid,\n\t\t);\n\t}\n\treturn ret;\n}\n\nconst implementedVersionDecorator = createReflectionDecorator<\n\ttypeof CommandClass,\n\t[version: number],\n\tnumber\n>({\n\tname: \"implementedVersion\",\n\tvalueFromArgs: (version) => version,\n\tconstructorLookupKey: false,\n});\n\n/**\n * @publicAPI\n * Defines the implemented version of a Z-Wave command class\n */\nexport const implementedVersion = implementedVersionDecorator.decorator;\n\n/**\n * @publicAPI\n * Retrieves the implemented version defined for a Z-Wave command class\n */\nexport function getImplementedVersion<T extends CommandClass>(\n\tcc: T | CommandClasses,\n): number {\n\t// get the class constructor\n\tlet constr: CCConstructor<CommandClass> | undefined;\n\tif (typeof cc === \"number\") {\n\t\tconstr = getCCConstructor(cc);\n\t} else {\n\t\tconstr = cc.constructor as CCConstructor<CommandClass>;\n\t}\n\n\tif (!constr) return 0;\n\treturn implementedVersionDecorator.lookupValueStatic(constr) ?? 0;\n}\n\n/**\n * @publicAPI\n * Retrieves the implemented version defined for a Z-Wave command class\n */\nexport function getImplementedVersionStatic<\n\tT extends CCConstructor<CommandClass>,\n>(classConstructor: T): number {\n\treturn implementedVersionDecorator.lookupValueStatic(classConstructor) ?? 0;\n}\n\nconst expectedCCResponseDecorator = createReflectionDecorator<\n\ttypeof CommandClass,\n\t[\n\t\tcc:\n\t\t\t| CCConstructor<CommandClass>\n\t\t\t| DynamicCCResponse<CommandClass, CommandClass>,\n\t\tpredicate?: CCResponsePredicate<CommandClass, CommandClass>,\n\t],\n\t{\n\t\tcc:\n\t\t\t| CCConstructor<CommandClass>\n\t\t\t| DynamicCCResponse<CommandClass, CommandClass>;\n\t\tpredicate?: CCResponsePredicate<CommandClass, CommandClass>;\n\t}\n>({\n\tname: \"expectedCCResponse\",\n\tvalueFromArgs: (cc, predicate) => ({ cc, predicate }),\n\t// We don't need reverse lookup\n\tconstructorLookupKey: false,\n});\n\n/**\n * @publicAPI\n * Defines the expected response associated with a Z-Wave message\n */\nexport function expectedCCResponse<\n\tTTarget extends typeof CommandClass,\n\tTSent extends CommandClass,\n\tTReceived extends CommandClass,\n>(\n\tcc: CCConstructor<TReceived> | DynamicCCResponse<TSent, TReceived>,\n\tpredicate?: CCResponsePredicate<TSent, TReceived>,\n): TypedClassDecorator<TTarget> {\n\treturn expectedCCResponseDecorator.decorator(cc as any, predicate as any);\n}\n\n/**\n * @publicAPI\n * Retrieves the expected response (static or dynamic) defined for a Z-Wave message class\n */\nexport function getExpectedCCResponse<T extends CommandClass>(\n\tccClass: T,\n): typeof CommandClass | DynamicCCResponse<T> | undefined {\n\treturn expectedCCResponseDecorator.lookupValue(ccClass)?.cc;\n}\n\n/**\n * @publicAPI\n * Retrieves the CC response predicate defined for a Z-Wave message class\n */\nexport function getCCResponsePredicate<T extends CommandClass>(\n\tccClass: T,\n): CCResponsePredicate<T> | undefined {\n\treturn expectedCCResponseDecorator.lookupValue(ccClass)?.predicate;\n}\n\nconst ccValuesDecorator = createReflectionDecorator<\n\ttypeof CommandClass,\n\t[valueDefinition: Record<string, StaticCCValue | DynamicCCValue>],\n\tRecord<string, StaticCCValue | DynamicCCValue | undefined>\n>({\n\tname: \"ccValues\",\n\tvalueFromArgs: (valueDefinition) => valueDefinition,\n\t// We don't need reverse lookup\n\tconstructorLookupKey: false,\n});\n\n/**\n * @publicAPI\n * Defines which CC value definitions belong to a Z-Wave command class\n */\nexport const ccValues = ccValuesDecorator.decorator;\n\n/**\n * @publicAPI\n * Retrieves the CC value definitions which belong to a Z-Wave command class\n */\nexport function getCCValues<T extends CommandClass>(\n\tcc: T | CommandClasses,\n): Record<string, StaticCCValue | DynamicCCValue | undefined> | undefined {\n\t// get the class constructor\n\tlet constr: CCConstructor<CommandClass> | undefined;\n\tif (typeof cc === \"number\") {\n\t\tconstr = getCCConstructor(cc);\n\t} else {\n\t\tconstr = cc.constructor as CCConstructor<CommandClass>;\n\t}\n\n\tif (constr) return ccValuesDecorator.lookupValueStatic(constr);\n}\n\nconst ccValue_METADATA = Symbol.for(`METADATA_ccValue`);\n\n// /**\n// * @publicAPI\n// * Defines which CC value a Z-Wave command class property belongs to\n// */\n// export function ccValue<TTarget extends CommandClass>(\n// \tvalue: StaticCCValue,\n// ): TypedPropertyDecorator<TTarget>;\n\n// export function ccValue<TTarget extends CommandClass, TArgs extends any[]>(\n// \tvalue: DynamicCCValue<TArgs>,\n// \tgetArgs: (self: TTarget) => Readonly<TArgs>,\n// ): TypedPropertyDecorator<TTarget>;\n\n// // Ideally this should use the PropertyReflectionDecorator, but we cannot reuse the\n// // target type in the getArgs function then.\n// export function ccValue<TTarget extends CommandClass, TArgs extends any[]>(\n// \t...args:\n// \t\t| [value: StaticCCValue]\n// \t\t| [value: DynamicCCValue<TArgs>, getArgs: (self: TTarget) => TArgs]\n// ): TypedPropertyDecorator<TTarget> {\n// \t// Normalize the arguments to the expected format\n// \tdebugger;\n// \tlet valueOrFactory: StaticCCValue | StaticCCValueFactory<TTarget>;\n// \tif (args.length === 1) {\n// \t\tvalueOrFactory = args[0];\n// \t} else {\n// \t\tconst [value, getArgs] = args;\n// \t\tvalueOrFactory = (self: TTarget) => {\n// \t\t\tconst args = getArgs(self);\n// \t\t\tconst base = value(...args);\n// \t\t\treturn {\n// \t\t\t\t...base,\n// \t\t\t\tis: value.is,\n// \t\t\t\toptions: value.options,\n// \t\t\t};\n// \t\t};\n// \t}\n\n// \treturn function decoratorBody_ccValue(\n// \t\ttarget: TTarget,\n// \t\tproperty: string | number | symbol,\n// \t): void {\n// \t\t// get the class constructor\n// \t\tconst constr = target.constructor;\n\n// \t\t// retrieve the current metadata\n// \t\tconst metadata: Map<\n// \t\t\tstring | number,\n// \t\t\tStaticCCValue | StaticCCValueFactory<TTarget>\n// \t\t> = Reflect.getMetadata(ccValue_METADATA, constr) ?? new Map();\n\n// \t\t// Add the variable\n// \t\tmetadata.set(property as string | number, valueOrFactory);\n\n// \t\t// And store it back\n// \t\tReflect.defineMetadata(ccValue_METADATA, metadata, constr);\n// \t};\n// }\n\nexport function ccValueProperty<\n\tClass extends abstract new (...args: any) => any,\n>(\n\tproperty: keyof InstanceType<Class>,\n\tvalue: StaticCCValue,\n): TypedClassDecorator<Class>;\n\nexport function ccValueProperty<\n\tClass extends abstract new (...args: any) => any,\n\tconst TArgs extends any[],\n>(\n\tproperty: keyof InstanceType<Class>,\n\tvalue: DynamicCCValue<TArgs>,\n\tgetArgs: (self: InstanceType<Class>) => TArgs,\n): TypedClassDecorator<Class>;\n\n/**\n * @publicAPI\n * Defines which CC values the properties of a Z-Wave Command Class correspond to\n */\nexport function ccValueProperty<\n\tClass extends abstract new (...args: any) => any,\n\tconst TArgs extends any[],\n>(\n\tproperty: keyof InstanceType<Class>,\n\t...args:\n\t\t| [value: StaticCCValue]\n\t\t| [\n\t\t\tvalue: DynamicCCValue<TArgs>,\n\t\t\tgetArgs: (self: InstanceType<Class>) => TArgs,\n\t\t]\n): TypedClassDecorator<Class> {\n\treturn function decorator_ccValueProperty(constr: Class): void {\n\t\t// retrieve the current metadata\n\t\tconst metadata: Map<\n\t\t\tstring | number,\n\t\t\tStaticCCValue | StaticCCValueFactory<InstanceType<Class>>\n\t\t> = Reflect.getMetadata(ccValue_METADATA, constr) ?? new Map();\n\n\t\t// Determine the correct metadata\n\t\tlet valueOrFactory:\n\t\t\t| StaticCCValue\n\t\t\t| StaticCCValueFactory<InstanceType<Class>>;\n\t\tif (args.length === 1) {\n\t\t\tvalueOrFactory = args[0];\n\t\t} else {\n\t\t\tconst [value, getArgs] = args;\n\t\t\tvalueOrFactory = (self: InstanceType<Class>) => {\n\t\t\t\tconst args = getArgs(self);\n\t\t\t\tconst base = value(...args);\n\t\t\t\treturn {\n\t\t\t\t\t...base,\n\t\t\t\t\tis: value.is,\n\t\t\t\t\toptions: value.options,\n\t\t\t\t};\n\t\t\t};\n\t\t}\n\n\t\t// Add the metadata\n\t\tmetadata.set(property as string | number, valueOrFactory);\n\n\t\t// And store it back\n\t\tReflect.defineMetadata(ccValue_METADATA, metadata, constr);\n\t};\n}\n\n/**\n * @publicAPI\n * Retrieves the defined mapping between properties and CC values of a Z-Wave command class instance\n */\nexport function getCCValueProperties<TTarget extends CommandClass>(\n\ttarget: TTarget,\n): ReadonlyMap<string | number, StaticCCValue | StaticCCValueFactory<TTarget>> {\n\treturn (\n\t\tReflect.getMetadata(ccValue_METADATA, target.constructor) ?? new Map()\n\t);\n}\n\n// const ccValueDecorator = createPropertyReflectionDecorator<\n// \tCommandClass,\n// \t[value: StaticCCValue | StaticCCValueFactory<CommandClass>],\n// \tStaticCCValue | StaticCCValueFactory<CommandClass>\n// >({\n// \tname: \"ccValue\",\n// \tvalueFromArgs: (valueDefinition) => valueDefinition,\n// });\n\n// /**\n// * @publicAPI\n// * Defines which CC value a Z-Wave command class property belongs to\n// */\n// export const ccValue = ccValueDecorator.decorator;\n\n// /**\n// * @publicAPI\n// * Retrieves the defined mapping between properties and CC values of a Z-Wave command class instance\n// */\n// export const getCCValueDefinitions = ccValueDecorator.lookupValues;\n\nconst supervisionDecorator = createValuelessReflectionDecorator<\n\ttypeof CommandClass\n>({\n\tname: \"useSupervision\",\n});\n\n/**\n * @publicAPI\n * Defines that this CC may be sent supervised\n */\nexport const useSupervision = supervisionDecorator.decorator;\n\n/**\n * @publicAPI\n * Checks if the given CC may be sent supervised\n */\nexport const shouldUseSupervision = supervisionDecorator.isDecorated;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
4
|
+
"sourcesContent": ["import {\n\ttype CommandClasses,\n\tZWaveError,\n\tZWaveErrorCodes,\n} from \"@zwave-js/core\";\nimport {\n\tcreateReflectionDecorator,\n\tcreateReflectionDecoratorPair,\n\tcreateValuelessReflectionDecorator,\n} from \"@zwave-js/core/reflection\";\nimport type { TypedClassDecorator } from \"@zwave-js/shared\";\nimport type { APIConstructor, CCAPI } from \"./API.js\";\nimport type {\n\tCCConstructor,\n\tCCResponsePredicate,\n\tCommandClass,\n\tDynamicCCResponse,\n} from \"./CommandClass.js\";\nimport type {\n\tDynamicCCValue,\n\tStaticCCValue,\n\tStaticCCValueFactory,\n} from \"./Values.js\";\n\nconst CCAndCommandDecorator = createReflectionDecoratorPair<\n\ttypeof CommandClass,\n\t[ccId: CommandClasses],\n\t[ccCommand: number],\n\tCCConstructor<CommandClass>\n>({ superName: \"ccId\", subName: \"ccCommand\" });\n\n/**\n * @publicAPI\n * Defines the CC ID associated with a Z-Wave Command Class\n */\nexport const commandClass = CCAndCommandDecorator.superDecorator;\n\n/**\n * @publicAPI\n * Looks up the command class constructor for a given CC ID\n */\nexport const getCCConstructor = CCAndCommandDecorator.lookupSuperConstructor;\n\n/**\n * @publicAPI\n * Defines the CC command a subclass of a CC implements\n */\nexport const CCCommand = CCAndCommandDecorator.subDecorator;\n\n/**\n * @publicAPI\n * Retrieves the CC command a subclass of a CC implements\n */\nexport const getCCCommand = CCAndCommandDecorator.lookupSubValue;\n\n/**\n * @publicAPI\n * Looks up the command class constructor for a given CC ID and command\n */\nexport const getCCCommandConstructor =\n\tCCAndCommandDecorator.lookupSubConstructor;\n\n/**\n * @publicAPI\n * Retrieves the CC ID defined for a Z-Wave Command Class\n */\nexport function getCommandClassStatic<T extends CCConstructor<CommandClass>>(\n\tclassConstructor: T,\n): CommandClasses {\n\t// retrieve the current metadata\n\tconst ret = CCAndCommandDecorator.lookupSuperValueStatic(classConstructor);\n\tif (ret == undefined) {\n\t\tthrow new ZWaveError(\n\t\t\t`No command class defined for ${classConstructor.name}!`,\n\t\t\tZWaveErrorCodes.CC_Invalid,\n\t\t);\n\t}\n\treturn ret;\n}\n\nconst apiDecorator = createReflectionDecorator<\n\ttypeof CCAPI,\n\t[cc: CommandClasses],\n\tCommandClasses,\n\tAPIConstructor\n>({\n\tname: \"API\",\n\tvalueFromArgs: (cc) => cc,\n});\n\n/**\n * @publicAPI\n * Defines the CC ID a CC API implementation belongs to\n */\nexport const API = apiDecorator.decorator;\n\n/**\n * @publicAPI\n * Retrieves the CC API constructor that is defined for a Z-Wave CC ID\n */\nexport function getAPI(cc: CommandClasses): APIConstructor | undefined {\n\treturn apiDecorator.lookupConstructorByValue(cc);\n}\n\n/**\n * @publicAPI\n * Retrieves the CC ID associated with a Z-Wave Command Class or CC API\n */\nexport function getCommandClass(cc: CommandClass | CCAPI): CommandClasses {\n\t// get the class constructor\n\tconst constr = cc.constructor;\n\t// retrieve the current metadata\n\tconst ret = CCAndCommandDecorator.lookupSuperValueStatic(\n\t\tconstr as typeof CommandClass,\n\t)\n\t\t?? apiDecorator.lookupValueStatic(constr as typeof CCAPI);\n\n\tif (ret == undefined) {\n\t\tthrow new ZWaveError(\n\t\t\t`No command class defined for ${constr.name}!`,\n\t\t\tZWaveErrorCodes.CC_Invalid,\n\t\t);\n\t}\n\treturn ret;\n}\n\nconst implementedVersionDecorator = createReflectionDecorator<\n\ttypeof CommandClass,\n\t[version: number],\n\tnumber\n>({\n\tname: \"implementedVersion\",\n\tvalueFromArgs: (version) => version,\n\tconstructorLookupKey: false,\n});\n\n/**\n * @publicAPI\n * Defines the implemented version of a Z-Wave command class\n */\nexport const implementedVersion = implementedVersionDecorator.decorator;\n\n/**\n * @publicAPI\n * Retrieves the implemented version defined for a Z-Wave command class\n */\nexport function getImplementedVersion<T extends CommandClass>(\n\tcc: T | CommandClasses,\n): number {\n\t// get the class constructor\n\tlet constr: CCConstructor<CommandClass> | undefined;\n\tif (typeof cc === \"number\") {\n\t\tconstr = getCCConstructor(cc);\n\t} else {\n\t\tconstr = cc.constructor as CCConstructor<CommandClass>;\n\t}\n\n\tif (!constr) return 0;\n\treturn implementedVersionDecorator.lookupValueStatic(constr) ?? 0;\n}\n\n/**\n * @publicAPI\n * Retrieves the implemented version defined for a Z-Wave command class\n */\nexport function getImplementedVersionStatic<\n\tT extends CCConstructor<CommandClass>,\n>(classConstructor: T): number {\n\treturn implementedVersionDecorator.lookupValueStatic(classConstructor) ?? 0;\n}\n\nconst expectedCCResponseDecorator = createReflectionDecorator<\n\ttypeof CommandClass,\n\t[\n\t\tcc:\n\t\t\t| CCConstructor<CommandClass>\n\t\t\t| DynamicCCResponse<CommandClass, CommandClass>,\n\t\tpredicate?: CCResponsePredicate<CommandClass, CommandClass>,\n\t],\n\t{\n\t\tcc:\n\t\t\t| CCConstructor<CommandClass>\n\t\t\t| DynamicCCResponse<CommandClass, CommandClass>;\n\t\tpredicate?: CCResponsePredicate<CommandClass, CommandClass>;\n\t}\n>({\n\tname: \"expectedCCResponse\",\n\tvalueFromArgs: (cc, predicate) => ({ cc, predicate }),\n\t// We don't need reverse lookup\n\tconstructorLookupKey: false,\n});\n\n/**\n * @publicAPI\n * Defines the expected response associated with a Z-Wave message\n */\nexport function expectedCCResponse<\n\tTTarget extends typeof CommandClass,\n\tTSent extends CommandClass,\n\tTReceived extends CommandClass,\n>(\n\tcc: CCConstructor<TReceived> | DynamicCCResponse<TSent, TReceived>,\n\tpredicate?: CCResponsePredicate<TSent, TReceived>,\n): TypedClassDecorator<TTarget> {\n\treturn expectedCCResponseDecorator.decorator(cc as any, predicate as any);\n}\n\n/**\n * @publicAPI\n * Retrieves the expected response (static or dynamic) defined for a Z-Wave message class\n */\nexport function getExpectedCCResponse<T extends CommandClass>(\n\tccClass: T,\n): typeof CommandClass | DynamicCCResponse<T> | undefined {\n\treturn expectedCCResponseDecorator.lookupValue(ccClass)?.cc;\n}\n\n/**\n * @publicAPI\n * Retrieves the CC response predicate defined for a Z-Wave message class\n */\nexport function getCCResponsePredicate<T extends CommandClass>(\n\tccClass: T,\n): CCResponsePredicate<T> | undefined {\n\treturn expectedCCResponseDecorator.lookupValue(ccClass)?.predicate;\n}\n\nconst ccValuesDecorator = createReflectionDecorator<\n\ttypeof CommandClass,\n\t[valueDefinition: Record<string, StaticCCValue | DynamicCCValue>],\n\tRecord<string, StaticCCValue | DynamicCCValue | undefined>\n>({\n\tname: \"ccValues\",\n\tvalueFromArgs: (valueDefinition) => valueDefinition,\n\t// We don't need reverse lookup\n\tconstructorLookupKey: false,\n});\n\n/**\n * @publicAPI\n * Defines which CC value definitions belong to a Z-Wave command class\n */\nexport const ccValues = ccValuesDecorator.decorator;\n\n/**\n * @publicAPI\n * Retrieves the CC value definitions which belong to a Z-Wave command class\n */\nexport function getCCValues<T extends CommandClass>(\n\tcc: T | CommandClasses,\n): Record<string, StaticCCValue | DynamicCCValue | undefined> | undefined {\n\t// get the class constructor\n\tlet constr: CCConstructor<CommandClass> | undefined;\n\tif (typeof cc === \"number\") {\n\t\tconstr = getCCConstructor(cc);\n\t} else {\n\t\tconstr = cc.constructor as CCConstructor<CommandClass>;\n\t}\n\n\tif (constr) return ccValuesDecorator.lookupValueStatic(constr);\n}\n\nconst ccValue_METADATA = Symbol.for(`METADATA_ccValue`);\n\n// /**\n// * @publicAPI\n// * Defines which CC value a Z-Wave command class property belongs to\n// */\n// export function ccValue<TTarget extends CommandClass>(\n// \tvalue: StaticCCValue,\n// ): TypedPropertyDecorator<TTarget>;\n\n// export function ccValue<TTarget extends CommandClass, TArgs extends any[]>(\n// \tvalue: DynamicCCValue<TArgs>,\n// \tgetArgs: (self: TTarget) => Readonly<TArgs>,\n// ): TypedPropertyDecorator<TTarget>;\n\n// // Ideally this should use the PropertyReflectionDecorator, but we cannot reuse the\n// // target type in the getArgs function then.\n// export function ccValue<TTarget extends CommandClass, TArgs extends any[]>(\n// \t...args:\n// \t\t| [value: StaticCCValue]\n// \t\t| [value: DynamicCCValue<TArgs>, getArgs: (self: TTarget) => TArgs]\n// ): TypedPropertyDecorator<TTarget> {\n// \t// Normalize the arguments to the expected format\n// \tdebugger;\n// \tlet valueOrFactory: StaticCCValue | StaticCCValueFactory<TTarget>;\n// \tif (args.length === 1) {\n// \t\tvalueOrFactory = args[0];\n// \t} else {\n// \t\tconst [value, getArgs] = args;\n// \t\tvalueOrFactory = (self: TTarget) => {\n// \t\t\tconst args = getArgs(self);\n// \t\t\tconst base = value(...args);\n// \t\t\treturn {\n// \t\t\t\t...base,\n// \t\t\t\tis: value.is,\n// \t\t\t\toptions: value.options,\n// \t\t\t};\n// \t\t};\n// \t}\n\n// \treturn function decoratorBody_ccValue(\n// \t\ttarget: TTarget,\n// \t\tproperty: string | number | symbol,\n// \t): void {\n// \t\t// get the class constructor\n// \t\tconst constr = target.constructor;\n\n// \t\t// retrieve the current metadata\n// \t\tconst metadata: Map<\n// \t\t\tstring | number,\n// \t\t\tStaticCCValue | StaticCCValueFactory<TTarget>\n// \t\t> = Reflect.getMetadata(ccValue_METADATA, constr) ?? new Map();\n\n// \t\t// Add the variable\n// \t\tmetadata.set(property as string | number, valueOrFactory);\n\n// \t\t// And store it back\n// \t\tReflect.defineMetadata(ccValue_METADATA, metadata, constr);\n// \t};\n// }\n\nexport function ccValueProperty<\n\tClass extends abstract new (...args: any) => any,\n>(\n\tproperty: keyof InstanceType<Class>,\n\tvalue: StaticCCValue,\n): TypedClassDecorator<Class>;\n\nexport function ccValueProperty<\n\tClass extends abstract new (...args: any) => any,\n\tconst TArgs extends any[],\n>(\n\tproperty: keyof InstanceType<Class>,\n\tvalue: DynamicCCValue<TArgs>,\n\tgetArgs: (self: InstanceType<Class>) => TArgs,\n): TypedClassDecorator<Class>;\n\n/**\n * @publicAPI\n * Defines which CC values the properties of a Z-Wave Command Class correspond to\n */\nexport function ccValueProperty<\n\tClass extends abstract new (...args: any) => any,\n\tconst TArgs extends any[],\n>(\n\tproperty: keyof InstanceType<Class>,\n\t...args:\n\t\t| [value: StaticCCValue]\n\t\t| [\n\t\t\tvalue: DynamicCCValue<TArgs>,\n\t\t\tgetArgs: (self: InstanceType<Class>) => TArgs,\n\t\t]\n): TypedClassDecorator<Class> {\n\treturn function decorator_ccValueProperty(constr: Class): void {\n\t\t// retrieve the current metadata\n\t\tconst metadata: Map<\n\t\t\tstring | number,\n\t\t\tStaticCCValue | StaticCCValueFactory<InstanceType<Class>>\n\t\t> = Reflect.getMetadata(ccValue_METADATA, constr) ?? new Map();\n\n\t\t// Determine the correct metadata\n\t\tlet valueOrFactory:\n\t\t\t| StaticCCValue\n\t\t\t| StaticCCValueFactory<InstanceType<Class>>;\n\t\tif (args.length === 1) {\n\t\t\tvalueOrFactory = args[0];\n\t\t} else {\n\t\t\tconst [value, getArgs] = args;\n\t\t\tvalueOrFactory = (self: InstanceType<Class>) => {\n\t\t\t\tconst args = getArgs(self);\n\t\t\t\tconst base = value(...args);\n\t\t\t\treturn {\n\t\t\t\t\t...base,\n\t\t\t\t\tis: value.is,\n\t\t\t\t\toptions: value.options,\n\t\t\t\t};\n\t\t\t};\n\t\t}\n\n\t\t// Add the metadata\n\t\tmetadata.set(property as string | number, valueOrFactory);\n\n\t\t// And store it back\n\t\tReflect.defineMetadata(ccValue_METADATA, metadata, constr);\n\t};\n}\n\n/**\n * @publicAPI\n * Retrieves the defined mapping between properties and CC values of a Z-Wave command class instance\n */\nexport function getCCValueProperties<TTarget extends CommandClass>(\n\ttarget: TTarget,\n): ReadonlyMap<string | number, StaticCCValue | StaticCCValueFactory<TTarget>> {\n\treturn (\n\t\tReflect.getMetadata(ccValue_METADATA, target.constructor) ?? new Map()\n\t);\n}\n\n// const ccValueDecorator = createPropertyReflectionDecorator<\n// \tCommandClass,\n// \t[value: StaticCCValue | StaticCCValueFactory<CommandClass>],\n// \tStaticCCValue | StaticCCValueFactory<CommandClass>\n// >({\n// \tname: \"ccValue\",\n// \tvalueFromArgs: (valueDefinition) => valueDefinition,\n// });\n\n// /**\n// * @publicAPI\n// * Defines which CC value a Z-Wave command class property belongs to\n// */\n// export const ccValue = ccValueDecorator.decorator;\n\n// /**\n// * @publicAPI\n// * Retrieves the defined mapping between properties and CC values of a Z-Wave command class instance\n// */\n// export const getCCValueDefinitions = ccValueDecorator.lookupValues;\n\nconst supervisionDecorator = createValuelessReflectionDecorator<\n\ttypeof CommandClass\n>({\n\tname: \"useSupervision\",\n});\n\n/**\n * @publicAPI\n * Defines that this CC may be sent supervised\n */\nexport const useSupervision = supervisionDecorator.decorator;\n\n/**\n * @publicAPI\n * Checks if the given CC may be sent supervised\n */\nexport const shouldUseSupervision = supervisionDecorator.isDecorated;\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": ["args"]
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Bytes } from "@zwave-js/shared
|
|
1
|
+
import { Bytes } from "@zwave-js/shared";
|
|
2
2
|
declare enum S2ExtensionType {
|
|
3
3
|
SPAN = 1,
|
|
4
4
|
MPAN = 2,
|
|
@@ -6,7 +6,7 @@ declare enum S2ExtensionType {
|
|
|
6
6
|
MOS = 4
|
|
7
7
|
}
|
|
8
8
|
/** Defines which S2 extension type a subclass of S2Extension has */
|
|
9
|
-
export declare const extensionType: <TTarget extends typeof Security2Extension>(type: S2ExtensionType) => import("@zwave-js/shared
|
|
9
|
+
export declare const extensionType: <TTarget extends typeof Security2Extension>(type: S2ExtensionType) => import("@zwave-js/shared").TypedClassDecorator<TTarget>;
|
|
10
10
|
/** Returns which S2 extension type a subclass of S2Extension has */
|
|
11
11
|
export declare const getExtensionType: (target: Security2Extension) => S2ExtensionType | undefined;
|
|
12
12
|
/**
|
|
@@ -33,9 +33,9 @@ __export(Extension_exports, {
|
|
|
33
33
|
validateS2Extension: () => validateS2Extension
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(Extension_exports);
|
|
36
|
+
var import_core = require("@zwave-js/core");
|
|
36
37
|
var import_reflection = require("@zwave-js/core/reflection");
|
|
37
|
-
var
|
|
38
|
-
var import_safe2 = require("@zwave-js/shared/safe");
|
|
38
|
+
var import_shared = require("@zwave-js/shared");
|
|
39
39
|
var __esDecorate = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
40
40
|
function accept(f) {
|
|
41
41
|
if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected");
|
|
@@ -134,7 +134,7 @@ class Security2ExtensionRaw {
|
|
|
134
134
|
this.payload = payload;
|
|
135
135
|
}
|
|
136
136
|
static parse(data) {
|
|
137
|
-
(0,
|
|
137
|
+
(0, import_core.validatePayload)(data.length >= 2);
|
|
138
138
|
const totalLength = data[0];
|
|
139
139
|
const moreToFollow = !!(data[1] & 128);
|
|
140
140
|
const critical = !!(data[1] & 64);
|
|
@@ -159,7 +159,7 @@ class Security2Extension {
|
|
|
159
159
|
payload = new Uint8Array()
|
|
160
160
|
} = options;
|
|
161
161
|
if (type == void 0) {
|
|
162
|
-
throw new
|
|
162
|
+
throw new import_core.ZWaveError("A Security2Extension must have a given or predefined extension type", import_core.ZWaveErrorCodes.Argument_Invalid);
|
|
163
163
|
}
|
|
164
164
|
this.type = type;
|
|
165
165
|
this.critical = critical;
|
|
@@ -188,8 +188,8 @@ class Security2Extension {
|
|
|
188
188
|
return false;
|
|
189
189
|
}
|
|
190
190
|
serialize(moreToFollow) {
|
|
191
|
-
return
|
|
192
|
-
|
|
191
|
+
return import_shared.Bytes.concat([
|
|
192
|
+
import_shared.Bytes.from([
|
|
193
193
|
2 + this.payload.length,
|
|
194
194
|
(moreToFollow ? 128 : 0) | (this.critical ? 64 : 0) | this.type & 63
|
|
195
195
|
]),
|
|
@@ -223,10 +223,10 @@ class Security2Extension {
|
|
|
223
223
|
}
|
|
224
224
|
toLogEntry() {
|
|
225
225
|
let ret = `
|
|
226
|
-
\xB7 type: ${(0,
|
|
226
|
+
\xB7 type: ${(0, import_shared.getEnumMemberName)(S2ExtensionType, this.type)}`;
|
|
227
227
|
if (this.payload.length > 0) {
|
|
228
228
|
ret += `
|
|
229
|
-
payload: ${(0,
|
|
229
|
+
payload: ${(0, import_shared.buffer2hex)(this.payload)}`;
|
|
230
230
|
}
|
|
231
231
|
return ret;
|
|
232
232
|
}
|
|
@@ -257,13 +257,13 @@ let SPANExtension = (() => {
|
|
|
257
257
|
}
|
|
258
258
|
constructor(options) {
|
|
259
259
|
if (options.senderEI.length !== 16) {
|
|
260
|
-
throw new
|
|
260
|
+
throw new import_core.ZWaveError("The sender's entropy must be a 16-byte buffer!", import_core.ZWaveErrorCodes.Argument_Invalid);
|
|
261
261
|
}
|
|
262
262
|
super({ critical: true, ...options });
|
|
263
263
|
this.senderEI = options.senderEI;
|
|
264
264
|
}
|
|
265
265
|
static from(raw) {
|
|
266
|
-
(0,
|
|
266
|
+
(0, import_core.validatePayload)(raw.payload.length === 16);
|
|
267
267
|
const senderEI = raw.payload;
|
|
268
268
|
return new SPANExtension2({
|
|
269
269
|
critical: raw.critical,
|
|
@@ -279,7 +279,7 @@ let SPANExtension = (() => {
|
|
|
279
279
|
}
|
|
280
280
|
toLogEntry() {
|
|
281
281
|
let ret = super.toLogEntry().replace(/^ payload:.+$/m, "");
|
|
282
|
-
ret += ` sender EI: ${(0,
|
|
282
|
+
ret += ` sender EI: ${(0, import_shared.buffer2hex)(this.senderEI)}`;
|
|
283
283
|
return ret;
|
|
284
284
|
}
|
|
285
285
|
static {
|
|
@@ -309,14 +309,14 @@ let MPANExtension = (() => {
|
|
|
309
309
|
}
|
|
310
310
|
constructor(options) {
|
|
311
311
|
if (options.innerMPANState.length !== 16) {
|
|
312
|
-
throw new
|
|
312
|
+
throw new import_core.ZWaveError("The inner MPAN state must be a 16-byte buffer!", import_core.ZWaveErrorCodes.Argument_Invalid);
|
|
313
313
|
}
|
|
314
314
|
super({ critical: true, ...options });
|
|
315
315
|
this.groupId = options.groupId;
|
|
316
316
|
this.innerMPANState = options.innerMPANState;
|
|
317
317
|
}
|
|
318
318
|
static from(raw) {
|
|
319
|
-
(0,
|
|
319
|
+
(0, import_core.validatePayload)(raw.payload.length === 17);
|
|
320
320
|
const groupId = raw.payload[0];
|
|
321
321
|
const innerMPANState = raw.payload.subarray(1);
|
|
322
322
|
return new MPANExtension2({
|
|
@@ -333,14 +333,14 @@ let MPANExtension = (() => {
|
|
|
333
333
|
}
|
|
334
334
|
static expectedLength = 19;
|
|
335
335
|
serialize(moreToFollow) {
|
|
336
|
-
this.payload =
|
|
336
|
+
this.payload = import_shared.Bytes.concat([
|
|
337
337
|
[this.groupId],
|
|
338
338
|
this.innerMPANState
|
|
339
339
|
]);
|
|
340
340
|
return super.serialize(moreToFollow);
|
|
341
341
|
}
|
|
342
342
|
toLogEntry() {
|
|
343
|
-
const mpanState = process.env.NODE_ENV === "test" || process.env.NODE_ENV === "development" ? (0,
|
|
343
|
+
const mpanState = process.env.NODE_ENV === "test" || process.env.NODE_ENV === "development" ? (0, import_shared.buffer2hex)(this.innerMPANState) : "(hidden)";
|
|
344
344
|
let ret = super.toLogEntry().replace(/^ payload:.+$/m, "");
|
|
345
345
|
ret += ` group ID: ${this.groupId}
|
|
346
346
|
MPAN state: ${mpanState}`;
|
|
@@ -376,7 +376,7 @@ let MGRPExtension = (() => {
|
|
|
376
376
|
this.groupId = options.groupId;
|
|
377
377
|
}
|
|
378
378
|
static from(raw) {
|
|
379
|
-
(0,
|
|
379
|
+
(0, import_core.validatePayload)(raw.payload.length === 1);
|
|
380
380
|
const groupId = raw.payload[0];
|
|
381
381
|
return new MGRPExtension2({
|
|
382
382
|
critical: raw.critical,
|
|
@@ -387,7 +387,7 @@ let MGRPExtension = (() => {
|
|
|
387
387
|
groupId;
|
|
388
388
|
static expectedLength = 3;
|
|
389
389
|
serialize(moreToFollow) {
|
|
390
|
-
this.payload =
|
|
390
|
+
this.payload = import_shared.Bytes.from([this.groupId]);
|
|
391
391
|
return super.serialize(moreToFollow);
|
|
392
392
|
}
|
|
393
393
|
toLogEntry() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/lib/Security2/Extension.ts"],
|
|
4
|
-
"sourcesContent": ["import { createSimpleReflectionDecorator } from \"@zwave-js/core/reflection\";\nimport {\n\tZWaveError,\n\tZWaveErrorCodes,\n\tvalidatePayload,\n} from \"@zwave-js/core/safe\";\nimport { Bytes, buffer2hex, getEnumMemberName } from \"@zwave-js/shared/safe\";\n\nenum S2ExtensionType {\n\tSPAN = 0x01,\n\tMPAN = 0x02,\n\tMGRP = 0x03,\n\tMOS = 0x04,\n}\n\nconst extensionTypeDecorator = createSimpleReflectionDecorator<\n\ttypeof Security2Extension,\n\t[type: S2ExtensionType],\n\tSecurity2ExtensionConstructor<Security2Extension>\n>({\n\tname: \"extensionType\",\n});\n\n/** Defines which S2 extension type a subclass of S2Extension has */\nexport const extensionType = extensionTypeDecorator.decorator;\n\n/** Returns which S2 extension type a subclass of S2Extension has */\nexport const getExtensionType = extensionTypeDecorator.lookupValue;\n\n/**\n * Looks up the S2 extension constructor for a given S2 extension type\n */\nexport const getS2ExtensionConstructor =\n\textensionTypeDecorator.lookupConstructor;\n\nexport type Security2ExtensionConstructor<T extends Security2Extension> =\n\t& typeof Security2Extension\n\t& {\n\t\tnew (options: Security2ExtensionOptions): T;\n\t};\n\nexport enum ValidateS2ExtensionResult {\n\tOK,\n\tDiscardExtension,\n\tDiscardCommand,\n}\n\n/** Tests if the extension may be accepted */\nexport function validateS2Extension(\n\text: Security2Extension,\n\twasEncrypted: boolean,\n): ValidateS2ExtensionResult {\n\tif (ext instanceof InvalidExtension) {\n\t\t// The extension could not be parsed, ignore it\n\t\treturn ValidateS2ExtensionResult.DiscardExtension;\n\t}\n\n\tif (ext.critical && !(ext.type in S2ExtensionType)) {\n\t\t// A receiving node MUST discard the entire command if the Critical flag\n\t\t// is set to \u20181\u2019 and the Type field advertises a value that the\n\t\t// receiving node does not support.\n\t\treturn ValidateS2ExtensionResult.DiscardCommand;\n\t}\n\n\t// Check if the extension is correctly encrypted or not encrypted\n\tswitch (ext.type) {\n\t\tcase S2ExtensionType.MPAN:\n\t\t\tif (!wasEncrypted) {\n\t\t\t\treturn ValidateS2ExtensionResult.DiscardExtension;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase S2ExtensionType.SPAN:\n\t\tcase S2ExtensionType.MGRP:\n\t\tcase S2ExtensionType.MOS:\n\t\t\tif (wasEncrypted) {\n\t\t\t\treturn ValidateS2ExtensionResult.DiscardExtension;\n\t\t\t}\n\t\t\tbreak;\n\t}\n\n\treturn ValidateS2ExtensionResult.OK;\n}\n\nexport class Security2ExtensionRaw {\n\tpublic constructor(\n\t\tpublic type: S2ExtensionType,\n\t\tpublic critical: boolean,\n\t\tpublic readonly moreToFollow: boolean,\n\t\tpublic payload: Uint8Array,\n\t) {}\n\n\tpublic static parse(data: Uint8Array): Security2ExtensionRaw {\n\t\tvalidatePayload(data.length >= 2);\n\t\tconst totalLength = data[0];\n\t\tconst moreToFollow = !!(data[1] & 0b1000_0000);\n\t\tconst critical = !!(data[1] & 0b0100_0000);\n\t\tconst type = data[1] & 0b11_1111;\n\t\tconst payload = data.subarray(2, totalLength);\n\n\t\treturn new Security2ExtensionRaw(type, critical, moreToFollow, payload);\n\t}\n\n\tpublic withPayload(payload: Bytes): Security2ExtensionRaw {\n\t\treturn new Security2ExtensionRaw(\n\t\t\tthis.type,\n\t\t\tthis.critical,\n\t\t\tthis.moreToFollow,\n\t\t\tpayload,\n\t\t);\n\t}\n}\n\ninterface Security2ExtensionBaseOptions {\n\tcritical?: boolean;\n\tmoreToFollow?: boolean;\n}\n\ninterface Security2ExtensionOptions extends Security2ExtensionBaseOptions {\n\ttype?: S2ExtensionType;\n\tpayload?: Uint8Array;\n}\n\nexport class Security2Extension {\n\tpublic constructor(options: Security2ExtensionOptions) {\n\t\tconst {\n\t\t\t// Try to determine the extension type if none is given\n\t\t\ttype = getExtensionType(this),\n\t\t\tcritical = false,\n\t\t\tmoreToFollow = false,\n\t\t\tpayload = new Uint8Array(),\n\t\t} = options;\n\n\t\tif (type == undefined) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"A Security2Extension must have a given or predefined extension type\",\n\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t);\n\t\t}\n\n\t\tthis.type = type;\n\t\tthis.critical = critical;\n\t\tthis.moreToFollow = moreToFollow;\n\t\tthis.payload = payload;\n\t}\n\n\tpublic static parse(\n\t\tdata: Uint8Array,\n\t): Security2Extension {\n\t\tconst raw = Security2ExtensionRaw.parse(data);\n\t\tconst Constructor = getS2ExtensionConstructor(raw.type)\n\t\t\t?? Security2Extension;\n\t\treturn Constructor.from(raw);\n\t}\n\n\t/** Creates an instance of the message that is serialized in the given buffer */\n\tpublic static from(\n\t\traw: Security2ExtensionRaw,\n\t): Security2Extension {\n\t\treturn new this({\n\t\t\ttype: raw.type,\n\t\t\tcritical: raw.critical,\n\t\t\tmoreToFollow: raw.moreToFollow,\n\t\t\tpayload: raw.payload,\n\t\t});\n\t}\n\n\tpublic type: S2ExtensionType;\n\tpublic critical: boolean;\n\tpublic readonly moreToFollow?: boolean;\n\tpublic payload: Uint8Array;\n\n\tpublic isEncrypted(): boolean {\n\t\treturn false;\n\t}\n\n\tpublic serialize(moreToFollow: boolean): Bytes {\n\t\treturn Bytes.concat([\n\t\t\tBytes.from([\n\t\t\t\t2 + this.payload.length,\n\t\t\t\t(moreToFollow ? 0b1000_0000 : 0)\n\t\t\t\t| (this.critical ? 0b0100_0000 : 0)\n\t\t\t\t| (this.type & 0b11_1111),\n\t\t\t]),\n\t\t\tthis.payload,\n\t\t]);\n\t}\n\n\t/** Returns the number of bytes the first extension in the buffer occupies */\n\tpublic static getExtensionLength(\n\t\tdata: Uint8Array,\n\t): { expected?: number; actual: number } {\n\t\tconst actual = data[0];\n\t\tlet expected: number | undefined;\n\n\t\t// For known extensions, return the expected length\n\t\tconst type = data[1] & 0b11_1111;\n\t\tswitch (type) {\n\t\t\tcase S2ExtensionType.SPAN:\n\t\t\t\texpected = SPANExtension.expectedLength;\n\t\t\t\tbreak;\n\t\t\tcase S2ExtensionType.MPAN:\n\t\t\t\texpected = MPANExtension.expectedLength;\n\t\t\t\tbreak;\n\t\t\tcase S2ExtensionType.MGRP:\n\t\t\t\texpected = MGRPExtension.expectedLength;\n\t\t\t\tbreak;\n\t\t\tcase S2ExtensionType.MOS:\n\t\t\t\texpected = MOSExtension.expectedLength;\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn { expected, actual };\n\t}\n\n\t/** Returns the number of bytes the serialized extension will occupy */\n\tpublic computeLength(): number {\n\t\treturn 2 + this.payload.length;\n\t}\n\n\tpublic toLogEntry(): string {\n\t\tlet ret = `\n\u00B7 type: ${getEnumMemberName(S2ExtensionType, this.type)}`;\n\t\tif (this.payload.length > 0) {\n\t\t\tret += `\n payload: ${buffer2hex(this.payload)}`;\n\t\t}\n\t\treturn ret;\n\t}\n}\n\nexport class InvalidExtension extends Security2Extension {\n}\n\ninterface SPANExtensionOptions {\n\tsenderEI: Uint8Array;\n}\n\n@extensionType(S2ExtensionType.SPAN)\nexport class SPANExtension extends Security2Extension {\n\tpublic constructor(\n\t\toptions: SPANExtensionOptions & Security2ExtensionBaseOptions,\n\t) {\n\t\tif (options.senderEI.length !== 16) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"The sender's entropy must be a 16-byte buffer!\",\n\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t);\n\t\t}\n\t\tsuper({ critical: true, ...options });\n\t\tthis.senderEI = options.senderEI;\n\t}\n\n\tpublic static from(raw: Security2ExtensionRaw): Security2Extension {\n\t\tvalidatePayload(raw.payload.length === 16);\n\t\tconst senderEI = raw.payload;\n\n\t\treturn new SPANExtension({\n\t\t\tcritical: raw.critical,\n\t\t\tmoreToFollow: raw.moreToFollow,\n\t\t\tsenderEI,\n\t\t});\n\t}\n\n\tpublic senderEI: Uint8Array;\n\tpublic static readonly expectedLength = 18;\n\n\tpublic serialize(moreToFollow: boolean): Bytes {\n\t\tthis.payload = this.senderEI;\n\t\treturn super.serialize(moreToFollow);\n\t}\n\n\tpublic toLogEntry(): string {\n\t\tlet ret = super.toLogEntry().replace(/^ payload:.+$/m, \"\");\n\t\tret += ` sender EI: ${buffer2hex(this.senderEI)}`;\n\t\treturn ret;\n\t}\n}\n\ninterface MPANExtensionOptions {\n\tgroupId: number;\n\tinnerMPANState: Uint8Array;\n}\n\n@extensionType(S2ExtensionType.MPAN)\nexport class MPANExtension extends Security2Extension {\n\tpublic constructor(\n\t\toptions: MPANExtensionOptions & Security2ExtensionBaseOptions,\n\t) {\n\t\tif (options.innerMPANState.length !== 16) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"The inner MPAN state must be a 16-byte buffer!\",\n\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t);\n\t\t}\n\t\tsuper({ critical: true, ...options });\n\t\tthis.groupId = options.groupId;\n\t\tthis.innerMPANState = options.innerMPANState;\n\t}\n\n\tpublic static from(raw: Security2ExtensionRaw): Security2Extension {\n\t\tvalidatePayload(raw.payload.length === 17);\n\t\tconst groupId = raw.payload[0];\n\t\tconst innerMPANState = raw.payload.subarray(1);\n\n\t\treturn new MPANExtension({\n\t\t\tcritical: raw.critical,\n\t\t\tmoreToFollow: raw.moreToFollow,\n\t\t\tgroupId,\n\t\t\tinnerMPANState,\n\t\t});\n\t}\n\n\tpublic groupId: number;\n\tpublic innerMPANState: Uint8Array;\n\n\tpublic isEncrypted(): boolean {\n\t\treturn true;\n\t}\n\n\tpublic static readonly expectedLength = 19;\n\n\tpublic serialize(moreToFollow: boolean): Bytes {\n\t\tthis.payload = Bytes.concat([\n\t\t\t[this.groupId],\n\t\t\tthis.innerMPANState,\n\t\t]);\n\t\treturn super.serialize(moreToFollow);\n\t}\n\n\tpublic toLogEntry(): string {\n\t\tconst mpanState = process.env.NODE_ENV === \"test\"\n\t\t\t\t|| process.env.NODE_ENV === \"development\"\n\t\t\t? buffer2hex(this.innerMPANState)\n\t\t\t: \"(hidden)\";\n\t\tlet ret = super.toLogEntry().replace(/^ payload:.+$/m, \"\");\n\t\tret += ` group ID: ${this.groupId}\n MPAN state: ${mpanState}`;\n\t\treturn ret;\n\t}\n}\n\ninterface MGRPExtensionOptions {\n\tgroupId: number;\n}\n\n@extensionType(S2ExtensionType.MGRP)\nexport class MGRPExtension extends Security2Extension {\n\tpublic constructor(\n\t\toptions: MGRPExtensionOptions & Security2ExtensionBaseOptions,\n\t) {\n\t\tsuper({ critical: true, ...options });\n\t\tthis.groupId = options.groupId;\n\t}\n\n\tpublic static from(raw: Security2ExtensionRaw): Security2Extension {\n\t\tvalidatePayload(raw.payload.length === 1);\n\t\tconst groupId = raw.payload[0];\n\n\t\treturn new MGRPExtension({\n\t\t\tcritical: raw.critical,\n\t\t\tmoreToFollow: raw.moreToFollow,\n\t\t\tgroupId,\n\t\t});\n\t}\n\n\tpublic groupId: number;\n\n\tpublic static readonly expectedLength = 3;\n\n\tpublic serialize(moreToFollow: boolean): Bytes {\n\t\tthis.payload = Bytes.from([this.groupId]);\n\t\treturn super.serialize(moreToFollow);\n\t}\n\n\tpublic toLogEntry(): string {\n\t\tlet ret = super.toLogEntry().replace(/^ payload:.+$/m, \"\");\n\t\tret += ` group ID: ${this.groupId}`;\n\t\treturn ret;\n\t}\n}\n\n@extensionType(S2ExtensionType.MOS)\nexport class MOSExtension extends Security2Extension {\n\tpublic constructor(options: Security2ExtensionBaseOptions = {}) {\n\t\tsuper({ critical: false, ...options });\n\t}\n\n\tpublic static readonly expectedLength = 2;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wBAAgD;AAChD,
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["import { ZWaveError, ZWaveErrorCodes, validatePayload } from \"@zwave-js/core\";\nimport { createSimpleReflectionDecorator } from \"@zwave-js/core/reflection\";\nimport { Bytes, buffer2hex, getEnumMemberName } from \"@zwave-js/shared\";\n\nenum S2ExtensionType {\n\tSPAN = 0x01,\n\tMPAN = 0x02,\n\tMGRP = 0x03,\n\tMOS = 0x04,\n}\n\nconst extensionTypeDecorator = createSimpleReflectionDecorator<\n\ttypeof Security2Extension,\n\t[type: S2ExtensionType],\n\tSecurity2ExtensionConstructor<Security2Extension>\n>({\n\tname: \"extensionType\",\n});\n\n/** Defines which S2 extension type a subclass of S2Extension has */\nexport const extensionType = extensionTypeDecorator.decorator;\n\n/** Returns which S2 extension type a subclass of S2Extension has */\nexport const getExtensionType = extensionTypeDecorator.lookupValue;\n\n/**\n * Looks up the S2 extension constructor for a given S2 extension type\n */\nexport const getS2ExtensionConstructor =\n\textensionTypeDecorator.lookupConstructor;\n\nexport type Security2ExtensionConstructor<T extends Security2Extension> =\n\t& typeof Security2Extension\n\t& {\n\t\tnew (options: Security2ExtensionOptions): T;\n\t};\n\nexport enum ValidateS2ExtensionResult {\n\tOK,\n\tDiscardExtension,\n\tDiscardCommand,\n}\n\n/** Tests if the extension may be accepted */\nexport function validateS2Extension(\n\text: Security2Extension,\n\twasEncrypted: boolean,\n): ValidateS2ExtensionResult {\n\tif (ext instanceof InvalidExtension) {\n\t\t// The extension could not be parsed, ignore it\n\t\treturn ValidateS2ExtensionResult.DiscardExtension;\n\t}\n\n\tif (ext.critical && !(ext.type in S2ExtensionType)) {\n\t\t// A receiving node MUST discard the entire command if the Critical flag\n\t\t// is set to \u20181\u2019 and the Type field advertises a value that the\n\t\t// receiving node does not support.\n\t\treturn ValidateS2ExtensionResult.DiscardCommand;\n\t}\n\n\t// Check if the extension is correctly encrypted or not encrypted\n\tswitch (ext.type) {\n\t\tcase S2ExtensionType.MPAN:\n\t\t\tif (!wasEncrypted) {\n\t\t\t\treturn ValidateS2ExtensionResult.DiscardExtension;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase S2ExtensionType.SPAN:\n\t\tcase S2ExtensionType.MGRP:\n\t\tcase S2ExtensionType.MOS:\n\t\t\tif (wasEncrypted) {\n\t\t\t\treturn ValidateS2ExtensionResult.DiscardExtension;\n\t\t\t}\n\t\t\tbreak;\n\t}\n\n\treturn ValidateS2ExtensionResult.OK;\n}\n\nexport class Security2ExtensionRaw {\n\tpublic constructor(\n\t\tpublic type: S2ExtensionType,\n\t\tpublic critical: boolean,\n\t\tpublic readonly moreToFollow: boolean,\n\t\tpublic payload: Uint8Array,\n\t) {}\n\n\tpublic static parse(data: Uint8Array): Security2ExtensionRaw {\n\t\tvalidatePayload(data.length >= 2);\n\t\tconst totalLength = data[0];\n\t\tconst moreToFollow = !!(data[1] & 0b1000_0000);\n\t\tconst critical = !!(data[1] & 0b0100_0000);\n\t\tconst type = data[1] & 0b11_1111;\n\t\tconst payload = data.subarray(2, totalLength);\n\n\t\treturn new Security2ExtensionRaw(type, critical, moreToFollow, payload);\n\t}\n\n\tpublic withPayload(payload: Bytes): Security2ExtensionRaw {\n\t\treturn new Security2ExtensionRaw(\n\t\t\tthis.type,\n\t\t\tthis.critical,\n\t\t\tthis.moreToFollow,\n\t\t\tpayload,\n\t\t);\n\t}\n}\n\ninterface Security2ExtensionBaseOptions {\n\tcritical?: boolean;\n\tmoreToFollow?: boolean;\n}\n\ninterface Security2ExtensionOptions extends Security2ExtensionBaseOptions {\n\ttype?: S2ExtensionType;\n\tpayload?: Uint8Array;\n}\n\nexport class Security2Extension {\n\tpublic constructor(options: Security2ExtensionOptions) {\n\t\tconst {\n\t\t\t// Try to determine the extension type if none is given\n\t\t\ttype = getExtensionType(this),\n\t\t\tcritical = false,\n\t\t\tmoreToFollow = false,\n\t\t\tpayload = new Uint8Array(),\n\t\t} = options;\n\n\t\tif (type == undefined) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"A Security2Extension must have a given or predefined extension type\",\n\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t);\n\t\t}\n\n\t\tthis.type = type;\n\t\tthis.critical = critical;\n\t\tthis.moreToFollow = moreToFollow;\n\t\tthis.payload = payload;\n\t}\n\n\tpublic static parse(\n\t\tdata: Uint8Array,\n\t): Security2Extension {\n\t\tconst raw = Security2ExtensionRaw.parse(data);\n\t\tconst Constructor = getS2ExtensionConstructor(raw.type)\n\t\t\t?? Security2Extension;\n\t\treturn Constructor.from(raw);\n\t}\n\n\t/** Creates an instance of the message that is serialized in the given buffer */\n\tpublic static from(\n\t\traw: Security2ExtensionRaw,\n\t): Security2Extension {\n\t\treturn new this({\n\t\t\ttype: raw.type,\n\t\t\tcritical: raw.critical,\n\t\t\tmoreToFollow: raw.moreToFollow,\n\t\t\tpayload: raw.payload,\n\t\t});\n\t}\n\n\tpublic type: S2ExtensionType;\n\tpublic critical: boolean;\n\tpublic readonly moreToFollow?: boolean;\n\tpublic payload: Uint8Array;\n\n\tpublic isEncrypted(): boolean {\n\t\treturn false;\n\t}\n\n\tpublic serialize(moreToFollow: boolean): Bytes {\n\t\treturn Bytes.concat([\n\t\t\tBytes.from([\n\t\t\t\t2 + this.payload.length,\n\t\t\t\t(moreToFollow ? 0b1000_0000 : 0)\n\t\t\t\t| (this.critical ? 0b0100_0000 : 0)\n\t\t\t\t| (this.type & 0b11_1111),\n\t\t\t]),\n\t\t\tthis.payload,\n\t\t]);\n\t}\n\n\t/** Returns the number of bytes the first extension in the buffer occupies */\n\tpublic static getExtensionLength(\n\t\tdata: Uint8Array,\n\t): { expected?: number; actual: number } {\n\t\tconst actual = data[0];\n\t\tlet expected: number | undefined;\n\n\t\t// For known extensions, return the expected length\n\t\tconst type = data[1] & 0b11_1111;\n\t\tswitch (type) {\n\t\t\tcase S2ExtensionType.SPAN:\n\t\t\t\texpected = SPANExtension.expectedLength;\n\t\t\t\tbreak;\n\t\t\tcase S2ExtensionType.MPAN:\n\t\t\t\texpected = MPANExtension.expectedLength;\n\t\t\t\tbreak;\n\t\t\tcase S2ExtensionType.MGRP:\n\t\t\t\texpected = MGRPExtension.expectedLength;\n\t\t\t\tbreak;\n\t\t\tcase S2ExtensionType.MOS:\n\t\t\t\texpected = MOSExtension.expectedLength;\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn { expected, actual };\n\t}\n\n\t/** Returns the number of bytes the serialized extension will occupy */\n\tpublic computeLength(): number {\n\t\treturn 2 + this.payload.length;\n\t}\n\n\tpublic toLogEntry(): string {\n\t\tlet ret = `\n\u00B7 type: ${getEnumMemberName(S2ExtensionType, this.type)}`;\n\t\tif (this.payload.length > 0) {\n\t\t\tret += `\n payload: ${buffer2hex(this.payload)}`;\n\t\t}\n\t\treturn ret;\n\t}\n}\n\nexport class InvalidExtension extends Security2Extension {\n}\n\ninterface SPANExtensionOptions {\n\tsenderEI: Uint8Array;\n}\n\n@extensionType(S2ExtensionType.SPAN)\nexport class SPANExtension extends Security2Extension {\n\tpublic constructor(\n\t\toptions: SPANExtensionOptions & Security2ExtensionBaseOptions,\n\t) {\n\t\tif (options.senderEI.length !== 16) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"The sender's entropy must be a 16-byte buffer!\",\n\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t);\n\t\t}\n\t\tsuper({ critical: true, ...options });\n\t\tthis.senderEI = options.senderEI;\n\t}\n\n\tpublic static from(raw: Security2ExtensionRaw): Security2Extension {\n\t\tvalidatePayload(raw.payload.length === 16);\n\t\tconst senderEI = raw.payload;\n\n\t\treturn new SPANExtension({\n\t\t\tcritical: raw.critical,\n\t\t\tmoreToFollow: raw.moreToFollow,\n\t\t\tsenderEI,\n\t\t});\n\t}\n\n\tpublic senderEI: Uint8Array;\n\tpublic static readonly expectedLength = 18;\n\n\tpublic serialize(moreToFollow: boolean): Bytes {\n\t\tthis.payload = this.senderEI;\n\t\treturn super.serialize(moreToFollow);\n\t}\n\n\tpublic toLogEntry(): string {\n\t\tlet ret = super.toLogEntry().replace(/^ payload:.+$/m, \"\");\n\t\tret += ` sender EI: ${buffer2hex(this.senderEI)}`;\n\t\treturn ret;\n\t}\n}\n\ninterface MPANExtensionOptions {\n\tgroupId: number;\n\tinnerMPANState: Uint8Array;\n}\n\n@extensionType(S2ExtensionType.MPAN)\nexport class MPANExtension extends Security2Extension {\n\tpublic constructor(\n\t\toptions: MPANExtensionOptions & Security2ExtensionBaseOptions,\n\t) {\n\t\tif (options.innerMPANState.length !== 16) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"The inner MPAN state must be a 16-byte buffer!\",\n\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t);\n\t\t}\n\t\tsuper({ critical: true, ...options });\n\t\tthis.groupId = options.groupId;\n\t\tthis.innerMPANState = options.innerMPANState;\n\t}\n\n\tpublic static from(raw: Security2ExtensionRaw): Security2Extension {\n\t\tvalidatePayload(raw.payload.length === 17);\n\t\tconst groupId = raw.payload[0];\n\t\tconst innerMPANState = raw.payload.subarray(1);\n\n\t\treturn new MPANExtension({\n\t\t\tcritical: raw.critical,\n\t\t\tmoreToFollow: raw.moreToFollow,\n\t\t\tgroupId,\n\t\t\tinnerMPANState,\n\t\t});\n\t}\n\n\tpublic groupId: number;\n\tpublic innerMPANState: Uint8Array;\n\n\tpublic isEncrypted(): boolean {\n\t\treturn true;\n\t}\n\n\tpublic static readonly expectedLength = 19;\n\n\tpublic serialize(moreToFollow: boolean): Bytes {\n\t\tthis.payload = Bytes.concat([\n\t\t\t[this.groupId],\n\t\t\tthis.innerMPANState,\n\t\t]);\n\t\treturn super.serialize(moreToFollow);\n\t}\n\n\tpublic toLogEntry(): string {\n\t\tconst mpanState = process.env.NODE_ENV === \"test\"\n\t\t\t\t|| process.env.NODE_ENV === \"development\"\n\t\t\t? buffer2hex(this.innerMPANState)\n\t\t\t: \"(hidden)\";\n\t\tlet ret = super.toLogEntry().replace(/^ payload:.+$/m, \"\");\n\t\tret += ` group ID: ${this.groupId}\n MPAN state: ${mpanState}`;\n\t\treturn ret;\n\t}\n}\n\ninterface MGRPExtensionOptions {\n\tgroupId: number;\n}\n\n@extensionType(S2ExtensionType.MGRP)\nexport class MGRPExtension extends Security2Extension {\n\tpublic constructor(\n\t\toptions: MGRPExtensionOptions & Security2ExtensionBaseOptions,\n\t) {\n\t\tsuper({ critical: true, ...options });\n\t\tthis.groupId = options.groupId;\n\t}\n\n\tpublic static from(raw: Security2ExtensionRaw): Security2Extension {\n\t\tvalidatePayload(raw.payload.length === 1);\n\t\tconst groupId = raw.payload[0];\n\n\t\treturn new MGRPExtension({\n\t\t\tcritical: raw.critical,\n\t\t\tmoreToFollow: raw.moreToFollow,\n\t\t\tgroupId,\n\t\t});\n\t}\n\n\tpublic groupId: number;\n\n\tpublic static readonly expectedLength = 3;\n\n\tpublic serialize(moreToFollow: boolean): Bytes {\n\t\tthis.payload = Bytes.from([this.groupId]);\n\t\treturn super.serialize(moreToFollow);\n\t}\n\n\tpublic toLogEntry(): string {\n\t\tlet ret = super.toLogEntry().replace(/^ payload:.+$/m, \"\");\n\t\tret += ` group ID: ${this.groupId}`;\n\t\treturn ret;\n\t}\n}\n\n@extensionType(S2ExtensionType.MOS)\nexport class MOSExtension extends Security2Extension {\n\tpublic constructor(options: Security2ExtensionBaseOptions = {}) {\n\t\tsuper({ critical: false, ...options });\n\t}\n\n\tpublic static readonly expectedLength = 2;\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["S2ExtensionType", "ValidateS2ExtensionResult", "SPANExtension", "MPANExtension", "MGRPExtension"]
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Duration, SupervisionResult } from "@zwave-js/core";
|
|
2
2
|
/**
|
|
3
3
|
* Indicates the status of a `setValue` call. This enum is an extension of `SupervisionStatus`
|
|
4
4
|
* with additional status codes to indicate errors that are not related to supervision.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/SetValueResult.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
4
|
+
"sourcesContent": ["import type { Duration, SupervisionResult } from \"@zwave-js/core\";\n\n/**\n * Indicates the status of a `setValue` call. This enum is an extension of `SupervisionStatus`\n * with additional status codes to indicate errors that are not related to supervision.\n */\nexport enum SetValueStatus {\n\t/** The device reports no support for this command */\n\tNoDeviceSupport = 0x00,\n\t/** The device has accepted the command and is working on it */\n\tWorking = 0x01,\n\t/** The device has rejected the command */\n\tFail = 0x02,\n\t/** The endpoint specified in the value ID does not exist */\n\tEndpointNotFound = 0x03,\n\t/** The given CC or its API is not implemented (yet) or it has no `setValue` implementation */\n\tNotImplemented = 0x04,\n\t/** The value to set (or a related value) is invalid */\n\tInvalidValue = 0x05,\n\t/** The command was sent successfully, but it is unknown whether it was executed */\n\tSuccessUnsupervised = 0xfe,\n\t/** The device has executed the command successfully */\n\tSuccess = 0xff,\n}\n\n/** Indicates the result of a `setValue` call. */\nexport type SetValueResult =\n\t// Derived from SupervisionResult\n\t| {\n\t\tstatus:\n\t\t\t| SetValueStatus.NoDeviceSupport\n\t\t\t| SetValueStatus.Fail\n\t\t\t| SetValueStatus.Success;\n\t\tremainingDuration?: undefined;\n\t\tmessage?: undefined;\n\t}\n\t| {\n\t\tstatus: SetValueStatus.Working;\n\t\tremainingDuration: Duration;\n\t\tmessage?: undefined;\n\t}\n\t// Added by setValue\n\t| {\n\t\tstatus: SetValueStatus.SuccessUnsupervised;\n\t\tremainingDuration?: undefined;\n\t\tmessage?: undefined;\n\t}\n\t| {\n\t\tstatus:\n\t\t\t| SetValueStatus.EndpointNotFound\n\t\t\t| SetValueStatus.NotImplemented\n\t\t\t| SetValueStatus.InvalidValue;\n\t\tremainingDuration?: undefined;\n\t\tmessage: string;\n\t};\n\nexport function supervisionResultToSetValueResult(\n\tresult: SupervisionResult | undefined,\n): SetValueResult {\n\tif (result == undefined) {\n\t\treturn {\n\t\t\tstatus: SetValueStatus.SuccessUnsupervised,\n\t\t};\n\t} else {\n\t\t// @ts-expect-error We only care about the compatible subset of status codes\n\t\treturn result;\n\t}\n}\n\n/** Tests whether a `SetValueResult` indicates that the device accepted the command. */\nexport function setValueSucceeded(\n\tresult: SetValueResult,\n): result is SetValueResult & {\n\tstatus: SetValueStatus.Success | SetValueStatus.Working;\n} {\n\treturn (\n\t\tresult.status === SetValueStatus.Success\n\t\t|| result.status === SetValueStatus.Working\n\t);\n}\n\n/** Tests whether a `SetValueResult` indicates that the command could not be sent or the device did not accept the command. */\nexport function setValueFailed(\n\tresult: SetValueResult,\n): result is SetValueResult & {\n\tstatus:\n\t\t| SetValueStatus.NoDeviceSupport\n\t\t| SetValueStatus.Fail\n\t\t| SetValueStatus.EndpointNotFound\n\t\t| SetValueStatus.NotImplemented\n\t\t| SetValueStatus.InvalidValue;\n} {\n\treturn (\n\t\tresult.status === SetValueStatus.NoDeviceSupport\n\t\t|| result.status === SetValueStatus.Fail\n\t\t|| result.status === SetValueStatus.EndpointNotFound\n\t\t|| result.status === SetValueStatus.NotImplemented\n\t\t|| result.status === SetValueStatus.InvalidValue\n\t);\n}\n\n/** Tests whether a `SetValueResult` indicates that the command was sent and that the device maybe accepted the command. */\nexport function setValueWasUnsupervisedOrSucceeded(\n\tresult: SetValueResult,\n): result is SetValueResult & {\n\tstatus:\n\t\t| SetValueStatus.SuccessUnsupervised\n\t\t| SetValueStatus.Success\n\t\t| SetValueStatus.Working;\n} {\n\treturn (\n\t\tresult.status === SetValueStatus.SuccessUnsupervised\n\t\t|| setValueSucceeded(result)\n\t);\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;AAEA;;;;;;;;;AAIA,IAAY;CAAZ,SAAYA,iBAAc;AAEzB,EAAAA,gBAAAA,gBAAA,iBAAA,IAAA,CAAA,IAAA;AAEA,EAAAA,gBAAAA,gBAAA,SAAA,IAAA,CAAA,IAAA;AAEA,EAAAA,gBAAAA,gBAAA,MAAA,IAAA,CAAA,IAAA;AAEA,EAAAA,gBAAAA,gBAAA,kBAAA,IAAA,CAAA,IAAA;AAEA,EAAAA,gBAAAA,gBAAA,gBAAA,IAAA,CAAA,IAAA;AAEA,EAAAA,gBAAAA,gBAAA,cAAA,IAAA,CAAA,IAAA;AAEA,EAAAA,gBAAAA,gBAAA,qBAAA,IAAA,GAAA,IAAA;AAEA,EAAAA,gBAAAA,gBAAA,SAAA,IAAA,GAAA,IAAA;AACD,GAjBY,mBAAA,iBAAc,CAAA,EAAA;AAkDpB,SAAU,kCACf,QAAqC;AAErC,MAAI,UAAU,QAAW;AACxB,WAAO;MACN,QAAQ,eAAe;;EAEzB,OAAO;AAEN,WAAO;EACR;AACD;AAXgB;AAcV,SAAU,kBACf,QAAsB;AAItB,SACC,OAAO,WAAW,eAAe,WAC9B,OAAO,WAAW,eAAe;AAEtC;AATgB;AAYV,SAAU,eACf,QAAsB;AAStB,SACC,OAAO,WAAW,eAAe,mBAC9B,OAAO,WAAW,eAAe,QACjC,OAAO,WAAW,eAAe,oBACjC,OAAO,WAAW,eAAe,kBACjC,OAAO,WAAW,eAAe;AAEtC;AAjBgB;AAoBV,SAAU,mCACf,QAAsB;AAOtB,SACC,OAAO,WAAW,eAAe,uBAC9B,kBAAkB,MAAM;AAE7B;AAZgB;",
|
|
6
6
|
"names": ["SetValueStatus"]
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { type FnOrStatic, type ReturnTypeOrStatic } from "@zwave-js/shared
|
|
1
|
+
import type { GetDeviceConfig } from "@zwave-js/config";
|
|
2
|
+
import type { CommandClasses, EndpointId, GetValueDB, ValueID, ValueMetadata } from "@zwave-js/core";
|
|
3
|
+
import { type FnOrStatic, type ReturnTypeOrStatic } from "@zwave-js/shared";
|
|
4
4
|
import type { ValueIDProperties } from "./API.js";
|
|
5
5
|
declare function defineCCValues<T extends CommandClasses>(commandClass: T, _: Record<string, CCValueBlueprint | DynamicCCValueBlueprint<any[]>>): typeof import("../cc/_CCValues.generated.js").CCValues[T];
|
|
6
6
|
export interface CCValueOptions {
|
package/build/cjs/lib/Values.js
CHANGED
|
@@ -23,7 +23,7 @@ __export(Values_exports, {
|
|
|
23
23
|
defaultCCValueOptions: () => defaultCCValueOptions
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(Values_exports);
|
|
26
|
-
var
|
|
26
|
+
var import_shared = require("@zwave-js/shared");
|
|
27
27
|
var import_CCValues_generated = require("../cc/_CCValues.generated.js");
|
|
28
28
|
function defineCCValues(commandClass, _) {
|
|
29
29
|
return import_CCValues_generated.CCValues[commandClass];
|
|
@@ -73,8 +73,8 @@ const V = {
|
|
|
73
73
|
dynamicPropertyWithName(name, property, is, meta, options) {
|
|
74
74
|
return {
|
|
75
75
|
[name]: Object.assign((...args) => ({
|
|
76
|
-
property: (0,
|
|
77
|
-
meta: (0,
|
|
76
|
+
property: (0, import_shared.evalOrStatic)(property, ...args),
|
|
77
|
+
meta: (0, import_shared.evalOrStatic)(meta, ...args)
|
|
78
78
|
}), { is, options })
|
|
79
79
|
};
|
|
80
80
|
},
|
|
@@ -83,9 +83,9 @@ const V = {
|
|
|
83
83
|
return {
|
|
84
84
|
[name]: Object.assign((...args) => {
|
|
85
85
|
return {
|
|
86
|
-
property: (0,
|
|
87
|
-
propertyKey: (0,
|
|
88
|
-
meta: (0,
|
|
86
|
+
property: (0, import_shared.evalOrStatic)(property, ...args),
|
|
87
|
+
propertyKey: (0, import_shared.evalOrStatic)(propertyKey, ...args),
|
|
88
|
+
meta: (0, import_shared.evalOrStatic)(meta, ...args)
|
|
89
89
|
};
|
|
90
90
|
}, { is, options })
|
|
91
91
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/Values.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAQA;;;;;;AAAA,
|
|
4
|
+
"sourcesContent": ["import type { GetDeviceConfig } from \"@zwave-js/config\";\nimport type {\n\tCommandClasses,\n\tEndpointId,\n\tGetValueDB,\n\tValueID,\n\tValueMetadata,\n} from \"@zwave-js/core\";\nimport {\n\ttype FnOrStatic,\n\ttype ReturnTypeOrStatic,\n\tevalOrStatic,\n} from \"@zwave-js/shared\";\nimport type { ValueIDProperties } from \"./API.js\";\n\nimport { CCValues } from \"../cc/_CCValues.generated.js\";\n\nfunction defineCCValues<T extends CommandClasses>(\n\tcommandClass: T,\n\t_: Record<string, CCValueBlueprint | DynamicCCValueBlueprint<any[]>>,\n\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t// @ts-ignore I know what I'm doing!\n): typeof import(\"../cc/_CCValues.generated.js\").CCValues[T] {\n\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t// @ts-ignore I know what I'm doing!\n\treturn CCValues[commandClass];\n}\n\n// HINT: To fully view types for definitions created by this, open\n// node_modules/typescript/lib/tsserver.js and change the definition of\n// ts.defaultMaximumTruncationLength = 160\n// to something higher like\n// ts.defaultMaximumTruncationLength = 1000\n// Then restart TS Server\n\nexport interface CCValueOptions {\n\t/**\n\t * Whether the CC value is internal. Internal values are not exposed to the user.\n\t */\n\tinternal?: boolean;\n\t/**\n\t * The minimum CC version required for this value to exist.\n\t */\n\tminVersion?: number;\n\t/**\n\t * Whether this value represents a state (`true`) or a notification/event (`false`). Default: `true`\n\t */\n\tstateful?: boolean;\n\t/**\n\t * Omit this value from value logs. Default: `false`\n\t */\n\tsecret?: boolean;\n\n\t/** Whether the CC value may exist on endpoints. Default: `true` */\n\tsupportsEndpoints?: boolean;\n\n\t/**\n\t * Can be used to dynamically decide if this value should be created automatically.\n\t * This is ignored for dynamic values and defaults to `true` if not given.\n\t */\n\tautoCreate?:\n\t\t| boolean\n\t\t| ((\n\t\t\tctx: GetValueDB & GetDeviceConfig,\n\t\t\tendpoint: EndpointId,\n\t\t) => boolean);\n}\n\nexport const defaultCCValueOptions = {\n\tinternal: false,\n\tminVersion: 1,\n\tsecret: false,\n\tstateful: true,\n\tsupportsEndpoints: true,\n\tautoCreate: true,\n} as const;\n\n// expands object types recursively\nexport type ExpandRecursively<T> =\n\t// Split functions with properties into the function and object parts\n\tT extends (...args: infer A) => infer R\n\t\t? [keyof T] extends [never] ? (...args: A) => ExpandRecursively<R>\n\t\t:\n\t\t\t& ((...args: A) => ExpandRecursively<R>)\n\t\t\t& {\n\t\t\t\t[P in keyof T]: ExpandRecursively<T[P]>;\n\t\t\t}\n\t\t// Expand object types\n\t\t: T extends object\n\t\t\t? T extends infer O ? { [K in keyof O]: ExpandRecursively<O[K]> }\n\t\t\t: never\n\t\t// Fallback to the type itself if no match\n\t\t: T;\n\nexport type ExpandRecursivelySkipMeta<T> =\n\t// Split functions with properties into the function and object parts\n\tT extends (...args: infer A) => infer R\n\t\t? [keyof T] extends [never]\n\t\t\t? (...args: A) => ExpandRecursivelySkipMeta<R>\n\t\t:\n\t\t\t& ((...args: A) => ExpandRecursivelySkipMeta<R>)\n\t\t\t& {\n\t\t\t\t[P in keyof T]: ExpandRecursivelySkipMeta<T[P]>;\n\t\t\t}\n\t\t// Ignore the ValueMetadata type\n\t\t: T extends ValueMetadata ? T\n\t\t// Expand object types\n\t\t: T extends object\n\t\t\t? T extends infer O\n\t\t\t\t? { [K in keyof O]: ExpandRecursivelySkipMeta<O[K]> }\n\t\t\t: never\n\t\t// Fallback to the type itself if no match\n\t\t: T;\n\ntype InferArgs<T extends FnOrStatic<any, any>[]> = T extends [\n\t(...args: infer A) => any,\n\t...any,\n] ? A\n\t: T extends [any, ...infer R] ? InferArgs<R>\n\t: [];\n\n// Namespace for utilities to define CC values\nexport const V = {\n\t/** Returns a CC value definition that is named like the value `property` */\n\tstaticProperty<\n\t\tTProp extends string | number,\n\t\tconst TMeta extends ValueMetadata,\n\t\tconst TOptions extends CCValueOptions,\n\t>(\n\t\tproperty: TProp,\n\t\tmeta?: TMeta,\n\t\toptions?: TOptions,\n\t): {\n\t\t[K in TProp]: {\n\t\t\tproperty: TProp;\n\t\t\tmeta: TMeta;\n\t\t\toptions: TOptions;\n\t\t};\n\t} {\n\t\treturn {\n\t\t\t[property]: {\n\t\t\t\tproperty,\n\t\t\t\tmeta,\n\t\t\t\toptions,\n\t\t\t},\n\t\t} as any;\n\t},\n\n\t/** Returns a CC value definition with the given name and `property` */\n\tstaticPropertyWithName<\n\t\tTName extends string,\n\t\tTProp extends string | number,\n\t\tconst TMeta extends ValueMetadata,\n\t\tconst TOptions extends CCValueOptions,\n\t>(\n\t\tname: TName,\n\t\tproperty: TProp,\n\t\tmeta?: TMeta,\n\t\toptions?: TOptions,\n\t): {\n\t\t[K in TName]: {\n\t\t\tproperty: TProp;\n\t\t\tmeta: TMeta;\n\t\t\toptions: TOptions;\n\t\t};\n\t} {\n\t\treturn {\n\t\t\t[name]: {\n\t\t\t\tproperty,\n\t\t\t\tmeta,\n\t\t\t\toptions,\n\t\t\t},\n\t\t} as any;\n\t},\n\n\t/** Returns a CC value definition with the given name, `property` and `propertyKey` */\n\tstaticPropertyAndKeyWithName<\n\t\tTName extends string,\n\t\tTProp extends string | number,\n\t\tTKey extends string | number,\n\t\tTMeta extends ValueMetadata,\n\t\tTOptions extends CCValueOptions,\n\t>(\n\t\tname: TName,\n\t\tproperty: TProp,\n\t\tpropertyKey: TKey,\n\t\tmeta?: TMeta,\n\t\toptions?: TOptions,\n\t): {\n\t\t[K in TName]: {\n\t\t\tproperty: TProp;\n\t\t\tpropertyKey: TKey;\n\t\t\tmeta: TMeta;\n\t\t\toptions: TOptions;\n\t\t};\n\t} {\n\t\treturn {\n\t\t\t[name]: {\n\t\t\t\tproperty,\n\t\t\t\tpropertyKey,\n\t\t\t\tmeta,\n\t\t\t\toptions,\n\t\t\t},\n\t\t} as any;\n\t},\n\n\t/** Returns a CC value definition with the given name and a dynamic `property` */\n\tdynamicPropertyWithName<\n\t\tTName extends string,\n\t\tTProp extends FnOrStatic<any[], ValueIDProperties[\"property\"]>,\n\t\tTMeta extends FnOrStatic<any[], ValueMetadata> = ValueMetadata,\n\t\tTOptions extends CCValueOptions = CCValueOptions,\n\t>(\n\t\tname: TName,\n\t\tproperty: TProp,\n\t\tis: PartialCCValuePredicate,\n\t\tmeta?: TMeta,\n\t\toptions?: TOptions,\n\t): {\n\t\t[K in TName]: {\n\t\t\t(...args: InferArgs<[TProp, TMeta]>): {\n\t\t\t\tproperty: ReturnTypeOrStatic<TProp>;\n\t\t\t\tmeta: ReturnTypeOrStatic<TMeta>;\n\t\t\t};\n\t\t\tis: PartialCCValuePredicate;\n\t\t\toptions: TOptions;\n\t\t};\n\t} {\n\t\treturn {\n\t\t\t[name]: Object.assign(\n\t\t\t\t(...args: InferArgs<[TProp, TMeta]>) => ({\n\t\t\t\t\tproperty: evalOrStatic(property, ...args),\n\t\t\t\t\tmeta: evalOrStatic(meta, ...args),\n\t\t\t\t}),\n\t\t\t\t{ is, options },\n\t\t\t),\n\t\t} as any;\n\t},\n\n\t/** Returns a CC value definition with the given name and a dynamic `property` */\n\tdynamicPropertyAndKeyWithName<\n\t\tTName extends string,\n\t\tTProp extends FnOrStatic<any[], ValueIDProperties[\"property\"]>,\n\t\tTKey extends FnOrStatic<any[], ValueIDProperties[\"propertyKey\"]>,\n\t\tTOptions extends CCValueOptions,\n\t\tTMeta extends FnOrStatic<any[], ValueMetadata> = ValueMetadata,\n\t>(\n\t\tname: TName,\n\t\tproperty: TProp,\n\t\tpropertyKey: TKey,\n\t\tis: PartialCCValuePredicate,\n\t\tmeta?: TMeta,\n\t\toptions?: TOptions,\n\t): {\n\t\t[K in TName]: {\n\t\t\t(...args: InferArgs<[TProp, TKey, TMeta]>): {\n\t\t\t\tproperty: ReturnTypeOrStatic<TProp>;\n\t\t\t\tpropertyKey: ReturnTypeOrStatic<TKey>;\n\t\t\t\tmeta: ReturnTypeOrStatic<TMeta>;\n\t\t\t};\n\t\t\tis: PartialCCValuePredicate;\n\t\t\toptions: TOptions;\n\t\t};\n\t} {\n\t\treturn {\n\t\t\t[name]: Object.assign(\n\t\t\t\t(...args: any[]) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tproperty: evalOrStatic(property, ...args),\n\t\t\t\t\t\tpropertyKey: evalOrStatic(propertyKey, ...args),\n\t\t\t\t\t\tmeta: evalOrStatic(meta, ...args),\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t\t{ is, options },\n\t\t\t),\n\t\t} as any;\n\t},\n\n\tdefineCCValues,\n};\n\nexport interface CCValueBlueprint extends Readonly<ValueIDProperties> {\n\treadonly meta?: Readonly<ValueMetadata>;\n\treadonly options?: Readonly<CCValueOptions>;\n}\n\nexport type CCValuePredicate = (valueId: ValueID) => boolean;\nexport type PartialCCValuePredicate = (\n\tproperties: ValueIDProperties,\n) => boolean;\n\n/** A blueprint for a CC value which depends on one or more parameters */\nexport interface DynamicCCValueBlueprint<TArgs extends any[]> {\n\t(...args: TArgs): Omit<CCValueBlueprint, \"options\">;\n\tis: PartialCCValuePredicate;\n\treadonly options?: Readonly<CCValueOptions>;\n}\n\n/** The common base type of all CC value definitions */\nexport interface CCValue {\n\treadonly id: Omit<ValueID, \"endpoint\">;\n\tendpoint(endpoint?: number): ValueID;\n\treadonly meta: ValueMetadata;\n}\n\nexport interface StaticCCValue extends CCValue {\n\t/** Whether the given value ID matches this value definition */\n\tis: CCValuePredicate;\n\treadonly options: Required<CCValueOptions>;\n}\n\nexport type DynamicCCValue<TArgs extends any[] = any[]> =\n\t& ExpandRecursivelySkipMeta<(...args: TArgs) => CCValue>\n\t& {\n\t\t/** Whether the given value ID matches this value definition */\n\t\tis: CCValuePredicate;\n\t\treadonly options: Required<CCValueOptions>;\n\t};\n\nexport type StaticCCValueFactory<T> = (self: T) => StaticCCValue;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAQA;;;;;;AAAA,oBAIO;AAGP,gCAAyB;AAEzB,SAAS,eACR,cACA,GAAoE;AAMpE,SAAO,mCAAS,YAAY;AAC7B;AATS;AAmDF,MAAM,wBAAwB;EACpC,UAAU;EACV,YAAY;EACZ,QAAQ;EACR,UAAU;EACV,mBAAmB;EACnB,YAAY;;AAgDN,MAAM,IAAI;;EAEhB,eAKC,UACA,MACA,SAAkB;AAQlB,WAAO;MACN,CAAC,QAAQ,GAAG;QACX;QACA;QACA;;;EAGH;;EAGA,uBAMC,MACA,UACA,MACA,SAAkB;AAQlB,WAAO;MACN,CAAC,IAAI,GAAG;QACP;QACA;QACA;;;EAGH;;EAGA,6BAOC,MACA,UACA,aACA,MACA,SAAkB;AASlB,WAAO;MACN,CAAC,IAAI,GAAG;QACP;QACA;QACA;QACA;;;EAGH;;EAGA,wBAMC,MACA,UACA,IACA,MACA,SAAkB;AAWlB,WAAO;MACN,CAAC,IAAI,GAAG,OAAO,OACd,IAAI,UAAqC;QACxC,cAAU,4BAAa,UAAU,GAAG,IAAI;QACxC,UAAM,4BAAa,MAAM,GAAG,IAAI;UAEjC,EAAE,IAAI,QAAO,CAAE;;EAGlB;;EAGA,8BAOC,MACA,UACA,aACA,IACA,MACA,SAAkB;AAYlB,WAAO;MACN,CAAC,IAAI,GAAG,OAAO,OACd,IAAI,SAAe;AAClB,eAAO;UACN,cAAU,4BAAa,UAAU,GAAG,IAAI;UACxC,iBAAa,4BAAa,aAAa,GAAG,IAAI;UAC9C,UAAM,4BAAa,MAAM,GAAG,IAAI;;MAElC,GACA,EAAE,IAAI,QAAO,CAAE;;EAGlB;EAEA;;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CommandClasses, type DataRate, type FLiRS, type MaybeNotKnown, type MaybeUnknown, type MeterScale, type Scale, type ValueMetadata, ZWaveDataRate } from "@zwave-js/core
|
|
1
|
+
import { type CommandClasses, type DataRate, type FLiRS, type MaybeNotKnown, type MaybeUnknown, type MeterScale, type Scale, type ValueMetadata, ZWaveDataRate } from "@zwave-js/core";
|
|
2
2
|
export declare enum AlarmSensorCommand {
|
|
3
3
|
Get = 1,
|
|
4
4
|
Report = 2,
|
|
@@ -417,7 +417,7 @@ export declare enum ConfigurationCommand {
|
|
|
417
417
|
PropertiesReport = 15,
|
|
418
418
|
DefaultReset = 1
|
|
419
419
|
}
|
|
420
|
-
export type { ConfigValue } from "@zwave-js/core
|
|
420
|
+
export type { ConfigValue } from "@zwave-js/core";
|
|
421
421
|
export declare enum CRC16Command {
|
|
422
422
|
CommandEncapsulation = 1
|
|
423
423
|
}
|
package/build/cjs/lib/_Types.js
CHANGED
|
@@ -148,7 +148,7 @@ __export(Types_exports, {
|
|
|
148
148
|
wakeUpTime2FLiRS: () => wakeUpTime2FLiRS
|
|
149
149
|
});
|
|
150
150
|
module.exports = __toCommonJS(Types_exports);
|
|
151
|
-
var
|
|
151
|
+
var import_core = require("@zwave-js/core");
|
|
152
152
|
var AlarmSensorCommand;
|
|
153
153
|
(function(AlarmSensorCommand2) {
|
|
154
154
|
AlarmSensorCommand2[AlarmSensorCommand2["Get"] = 1] = "Get";
|
|
@@ -1529,11 +1529,11 @@ function wakeUpTime2FLiRS(value) {
|
|
|
1529
1529
|
}
|
|
1530
1530
|
__name(wakeUpTime2FLiRS, "wakeUpTime2FLiRS");
|
|
1531
1531
|
function dataRate2ZWaveDataRate(dataRate) {
|
|
1532
|
-
return dataRate === 1e5 ?
|
|
1532
|
+
return dataRate === 1e5 ? import_core.ZWaveDataRate["100k"] : dataRate === 4e4 ? import_core.ZWaveDataRate["40k"] : import_core.ZWaveDataRate["9k6"];
|
|
1533
1533
|
}
|
|
1534
1534
|
__name(dataRate2ZWaveDataRate, "dataRate2ZWaveDataRate");
|
|
1535
1535
|
function ZWaveDataRate2DataRate(zdr) {
|
|
1536
|
-
return zdr ===
|
|
1536
|
+
return zdr === import_core.ZWaveDataRate["100k"] ? 1e5 : zdr === import_core.ZWaveDataRate["40k"] ? 4e4 : 9600;
|
|
1537
1537
|
}
|
|
1538
1538
|
__name(ZWaveDataRate2DataRate, "ZWaveDataRate2DataRate");
|
|
1539
1539
|
function parseWakeUpTime(value) {
|