@zwave-js/cc 15.22.1 → 15.23.0

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.
Files changed (227) hide show
  1. package/build/cjs/cc/AlarmSensorCC._validateArgs.d.ts +1 -1
  2. package/build/cjs/cc/AssociationCC._validateArgs.d.ts +8 -8
  3. package/build/cjs/cc/AssociationGroupInfoCC._validateArgs.d.ts +6 -6
  4. package/build/cjs/cc/BarrierOperatorCC._validateArgs.d.ts +4 -4
  5. package/build/cjs/cc/BasicCC._validateArgs.d.ts +1 -1
  6. package/build/cjs/cc/BasicWindowCoveringCC._validateArgs.d.ts +2 -2
  7. package/build/cjs/cc/BinarySensorCC._validateArgs.d.ts +3 -3
  8. package/build/cjs/cc/BinarySwitchCC._validateArgs.d.ts +1 -1
  9. package/build/cjs/cc/CentralSceneCC._validateArgs.d.ts +1 -1
  10. package/build/cjs/cc/ClimateControlScheduleCC._validateArgs.d.ts +3 -3
  11. package/build/cjs/cc/ClockCC._validateArgs.d.ts +1 -1
  12. package/build/cjs/cc/ColorSwitchCC._validateArgs.d.ts +4 -4
  13. package/build/cjs/cc/ConfigurationCC._validateArgs.d.ts +9 -9
  14. package/build/cjs/cc/DoorLockCC._validateArgs.d.ts +2 -2
  15. package/build/cjs/cc/DoorLockLoggingCC._validateArgs.d.ts +1 -1
  16. package/build/cjs/cc/EnergyProductionCC._validateArgs.d.ts +1 -1
  17. package/build/cjs/cc/EntryControlCC._validateArgs.d.ts +1 -1
  18. package/build/cjs/cc/FirmwareUpdateMetaDataCC._validateArgs.d.ts +6 -6
  19. package/build/cjs/cc/HumidityControlModeCC._validateArgs.d.ts +1 -1
  20. package/build/cjs/cc/HumidityControlSetpointCC._validateArgs.d.ts +4 -4
  21. package/build/cjs/cc/IndicatorCC._validateArgs.d.ts +9 -9
  22. package/build/cjs/cc/IrrigationCC._validateArgs.d.ts +10 -10
  23. package/build/cjs/cc/LanguageCC._validateArgs.d.ts +1 -1
  24. package/build/cjs/cc/LockCC._validateArgs.d.ts +1 -1
  25. package/build/cjs/cc/ManufacturerProprietaryCC._validateArgs.d.ts +2 -2
  26. package/build/cjs/cc/ManufacturerSpecificCC._validateArgs.d.ts +2 -2
  27. package/build/cjs/cc/MeterCC._validateArgs.d.ts +5 -5
  28. package/build/cjs/cc/MultiChannelAssociationCC._validateArgs.d.ts +5 -5
  29. package/build/cjs/cc/MultiChannelCC._validateArgs.d.ts +4 -4
  30. package/build/cjs/cc/MultiCommandCC._validateArgs.d.ts +1 -1
  31. package/build/cjs/cc/MultilevelSensorCC._validateArgs.d.ts +3 -3
  32. package/build/cjs/cc/MultilevelSwitchCC._validateArgs.d.ts +2 -2
  33. package/build/cjs/cc/NodeNamingCC._validateArgs.d.ts +2 -2
  34. package/build/cjs/cc/NotificationCC._validateArgs.d.ts +4 -4
  35. package/build/cjs/cc/PowerlevelCC._validateArgs.d.ts +4 -4
  36. package/build/cjs/cc/ProtectionCC._validateArgs.d.ts +3 -3
  37. package/build/cjs/cc/SceneActivationCC._validateArgs.d.ts +1 -1
  38. package/build/cjs/cc/SceneActuatorConfigurationCC._validateArgs.d.ts +2 -2
  39. package/build/cjs/cc/SceneControllerConfigurationCC._validateArgs.d.ts +3 -3
  40. package/build/cjs/cc/ScheduleEntryLockCC._validateArgs.d.ts +8 -8
  41. package/build/cjs/cc/SoundSwitchCC._validateArgs.d.ts +3 -3
  42. package/build/cjs/cc/ThermostatFanModeCC._validateArgs.d.ts +1 -1
  43. package/build/cjs/cc/ThermostatModeCC._validateArgs.d.ts +1 -1
  44. package/build/cjs/cc/ThermostatOperatingStateCC._validateArgs.d.ts +2 -0
  45. package/build/cjs/cc/ThermostatOperatingStateCC._validateArgs.js +51 -0
  46. package/build/cjs/cc/ThermostatOperatingStateCC._validateArgs.js.map +7 -0
  47. package/build/cjs/cc/ThermostatOperatingStateCC.d.ts +43 -2
  48. package/build/cjs/cc/ThermostatOperatingStateCC.js +272 -1
  49. package/build/cjs/cc/ThermostatOperatingStateCC.js.map +2 -2
  50. package/build/cjs/cc/ThermostatSetbackCC._validateArgs.d.ts +1 -1
  51. package/build/cjs/cc/ThermostatSetpointCC._validateArgs.d.ts +3 -3
  52. package/build/cjs/cc/TimeCC._validateArgs.d.ts +4 -4
  53. package/build/cjs/cc/TimeParametersCC._validateArgs.d.ts +1 -1
  54. package/build/cjs/cc/UserCodeCC._validateArgs.d.ts +6 -6
  55. package/build/cjs/cc/UserCredentialCC._validateArgs.d.ts +24 -0
  56. package/build/cjs/cc/UserCredentialCC._validateArgs.js +338 -0
  57. package/build/cjs/cc/UserCredentialCC._validateArgs.js.map +7 -0
  58. package/build/cjs/cc/UserCredentialCC.d.ts +452 -0
  59. package/build/cjs/cc/UserCredentialCC.js +2855 -0
  60. package/build/cjs/cc/UserCredentialCC.js.map +7 -0
  61. package/build/cjs/cc/VersionCC._validateArgs.d.ts +3 -3
  62. package/build/cjs/cc/WakeUpCC._validateArgs.d.ts +1 -1
  63. package/build/cjs/cc/WindowCoveringCC._validateArgs.d.ts +4 -4
  64. package/build/cjs/cc/ZWavePlusCC._validateArgs.d.ts +1 -1
  65. package/build/cjs/cc/_CCValues.generated.d.ts +4907 -3369
  66. package/build/cjs/cc/_CCValues.generated.js +828 -0
  67. package/build/cjs/cc/_CCValues.generated.js.map +2 -2
  68. package/build/cjs/cc/index.d.ts +6 -3
  69. package/build/cjs/cc/index.js +106 -0
  70. package/build/cjs/cc/index.js.map +2 -2
  71. package/build/cjs/cc/manufacturerProprietary/FibaroCC._validateArgs.d.ts +2 -2
  72. package/build/cjs/lib/CommandClass.js +0 -1
  73. package/build/cjs/lib/CommandClass.js.map +1 -1
  74. package/build/cjs/lib/Values.d.ts +5 -5
  75. package/build/cjs/lib/Values.js.map +1 -1
  76. package/build/cjs/lib/_CCAPI.generated.d.ts +2 -0
  77. package/build/cjs/lib/_CCAPI.generated.js.map +1 -1
  78. package/build/cjs/lib/_Types.d.ts +153 -1
  79. package/build/cjs/lib/_Types.js +163 -0
  80. package/build/cjs/lib/_Types.js.map +3 -3
  81. package/build/esm/cc/AlarmSensorCC._validateArgs.d.ts +1 -1
  82. package/build/esm/cc/AlarmSensorCC._validateArgs.d.ts.map +1 -1
  83. package/build/esm/cc/AssociationCC._validateArgs.d.ts +8 -8
  84. package/build/esm/cc/AssociationCC._validateArgs.d.ts.map +1 -1
  85. package/build/esm/cc/AssociationGroupInfoCC._validateArgs.d.ts +6 -6
  86. package/build/esm/cc/AssociationGroupInfoCC._validateArgs.d.ts.map +1 -1
  87. package/build/esm/cc/AssociationGroupInfoCC.d.ts.map +1 -1
  88. package/build/esm/cc/BarrierOperatorCC._validateArgs.d.ts +4 -4
  89. package/build/esm/cc/BarrierOperatorCC._validateArgs.d.ts.map +1 -1
  90. package/build/esm/cc/BasicCC._validateArgs.d.ts +1 -1
  91. package/build/esm/cc/BasicCC._validateArgs.d.ts.map +1 -1
  92. package/build/esm/cc/BasicWindowCoveringCC._validateArgs.d.ts +2 -2
  93. package/build/esm/cc/BasicWindowCoveringCC._validateArgs.d.ts.map +1 -1
  94. package/build/esm/cc/BinarySensorCC._validateArgs.d.ts +3 -3
  95. package/build/esm/cc/BinarySensorCC._validateArgs.d.ts.map +1 -1
  96. package/build/esm/cc/BinarySwitchCC._validateArgs.d.ts +1 -1
  97. package/build/esm/cc/BinarySwitchCC._validateArgs.d.ts.map +1 -1
  98. package/build/esm/cc/CentralSceneCC._validateArgs.d.ts +1 -1
  99. package/build/esm/cc/CentralSceneCC._validateArgs.d.ts.map +1 -1
  100. package/build/esm/cc/ClimateControlScheduleCC._validateArgs.d.ts +3 -3
  101. package/build/esm/cc/ClimateControlScheduleCC._validateArgs.d.ts.map +1 -1
  102. package/build/esm/cc/ClockCC._validateArgs.d.ts +1 -1
  103. package/build/esm/cc/ClockCC._validateArgs.d.ts.map +1 -1
  104. package/build/esm/cc/ColorSwitchCC._validateArgs.d.ts +4 -4
  105. package/build/esm/cc/ColorSwitchCC._validateArgs.d.ts.map +1 -1
  106. package/build/esm/cc/ConfigurationCC._validateArgs.d.ts +9 -9
  107. package/build/esm/cc/ConfigurationCC._validateArgs.d.ts.map +1 -1
  108. package/build/esm/cc/DoorLockCC._validateArgs.d.ts +2 -2
  109. package/build/esm/cc/DoorLockCC._validateArgs.d.ts.map +1 -1
  110. package/build/esm/cc/DoorLockLoggingCC._validateArgs.d.ts +1 -1
  111. package/build/esm/cc/DoorLockLoggingCC._validateArgs.d.ts.map +1 -1
  112. package/build/esm/cc/EnergyProductionCC._validateArgs.d.ts +1 -1
  113. package/build/esm/cc/EnergyProductionCC._validateArgs.d.ts.map +1 -1
  114. package/build/esm/cc/EntryControlCC._validateArgs.d.ts +1 -1
  115. package/build/esm/cc/EntryControlCC._validateArgs.d.ts.map +1 -1
  116. package/build/esm/cc/FirmwareUpdateMetaDataCC._validateArgs.d.ts +6 -6
  117. package/build/esm/cc/FirmwareUpdateMetaDataCC._validateArgs.d.ts.map +1 -1
  118. package/build/esm/cc/HumidityControlModeCC._validateArgs.d.ts +1 -1
  119. package/build/esm/cc/HumidityControlModeCC._validateArgs.d.ts.map +1 -1
  120. package/build/esm/cc/HumidityControlSetpointCC._validateArgs.d.ts +4 -4
  121. package/build/esm/cc/HumidityControlSetpointCC._validateArgs.d.ts.map +1 -1
  122. package/build/esm/cc/IndicatorCC._validateArgs.d.ts +9 -9
  123. package/build/esm/cc/IndicatorCC._validateArgs.d.ts.map +1 -1
  124. package/build/esm/cc/IrrigationCC._validateArgs.d.ts +10 -10
  125. package/build/esm/cc/IrrigationCC._validateArgs.d.ts.map +1 -1
  126. package/build/esm/cc/LanguageCC._validateArgs.d.ts +1 -1
  127. package/build/esm/cc/LanguageCC._validateArgs.d.ts.map +1 -1
  128. package/build/esm/cc/LockCC._validateArgs.d.ts +1 -1
  129. package/build/esm/cc/LockCC._validateArgs.d.ts.map +1 -1
  130. package/build/esm/cc/ManufacturerProprietaryCC._validateArgs.d.ts +2 -2
  131. package/build/esm/cc/ManufacturerProprietaryCC._validateArgs.d.ts.map +1 -1
  132. package/build/esm/cc/ManufacturerSpecificCC._validateArgs.d.ts +2 -2
  133. package/build/esm/cc/ManufacturerSpecificCC._validateArgs.d.ts.map +1 -1
  134. package/build/esm/cc/MeterCC._validateArgs.d.ts +5 -5
  135. package/build/esm/cc/MeterCC._validateArgs.d.ts.map +1 -1
  136. package/build/esm/cc/MultiChannelAssociationCC._validateArgs.d.ts +5 -5
  137. package/build/esm/cc/MultiChannelAssociationCC._validateArgs.d.ts.map +1 -1
  138. package/build/esm/cc/MultiChannelCC._validateArgs.d.ts +4 -4
  139. package/build/esm/cc/MultiChannelCC._validateArgs.d.ts.map +1 -1
  140. package/build/esm/cc/MultiCommandCC._validateArgs.d.ts +1 -1
  141. package/build/esm/cc/MultiCommandCC._validateArgs.d.ts.map +1 -1
  142. package/build/esm/cc/MultilevelSensorCC._validateArgs.d.ts +3 -3
  143. package/build/esm/cc/MultilevelSensorCC._validateArgs.d.ts.map +1 -1
  144. package/build/esm/cc/MultilevelSwitchCC._validateArgs.d.ts +2 -2
  145. package/build/esm/cc/MultilevelSwitchCC._validateArgs.d.ts.map +1 -1
  146. package/build/esm/cc/NodeNamingCC._validateArgs.d.ts +2 -2
  147. package/build/esm/cc/NodeNamingCC._validateArgs.d.ts.map +1 -1
  148. package/build/esm/cc/NotificationCC._validateArgs.d.ts +4 -4
  149. package/build/esm/cc/NotificationCC._validateArgs.d.ts.map +1 -1
  150. package/build/esm/cc/PowerlevelCC._validateArgs.d.ts +4 -4
  151. package/build/esm/cc/PowerlevelCC._validateArgs.d.ts.map +1 -1
  152. package/build/esm/cc/ProtectionCC._validateArgs.d.ts +3 -3
  153. package/build/esm/cc/ProtectionCC._validateArgs.d.ts.map +1 -1
  154. package/build/esm/cc/SceneActivationCC._validateArgs.d.ts +1 -1
  155. package/build/esm/cc/SceneActivationCC._validateArgs.d.ts.map +1 -1
  156. package/build/esm/cc/SceneActuatorConfigurationCC._validateArgs.d.ts +2 -2
  157. package/build/esm/cc/SceneActuatorConfigurationCC._validateArgs.d.ts.map +1 -1
  158. package/build/esm/cc/SceneControllerConfigurationCC._validateArgs.d.ts +3 -3
  159. package/build/esm/cc/SceneControllerConfigurationCC._validateArgs.d.ts.map +1 -1
  160. package/build/esm/cc/ScheduleEntryLockCC._validateArgs.d.ts +8 -8
  161. package/build/esm/cc/ScheduleEntryLockCC._validateArgs.d.ts.map +1 -1
  162. package/build/esm/cc/SoundSwitchCC._validateArgs.d.ts +3 -3
  163. package/build/esm/cc/SoundSwitchCC._validateArgs.d.ts.map +1 -1
  164. package/build/esm/cc/ThermostatFanModeCC._validateArgs.d.ts +1 -1
  165. package/build/esm/cc/ThermostatFanModeCC._validateArgs.d.ts.map +1 -1
  166. package/build/esm/cc/ThermostatModeCC._validateArgs.d.ts +1 -1
  167. package/build/esm/cc/ThermostatModeCC._validateArgs.d.ts.map +1 -1
  168. package/build/esm/cc/ThermostatOperatingStateCC._validateArgs.d.ts +2 -0
  169. package/build/esm/cc/ThermostatOperatingStateCC._validateArgs.d.ts.map +1 -0
  170. package/build/esm/cc/ThermostatOperatingStateCC._validateArgs.js +12 -0
  171. package/build/esm/cc/ThermostatOperatingStateCC._validateArgs.js.map +1 -0
  172. package/build/esm/cc/ThermostatOperatingStateCC.d.ts +43 -2
  173. package/build/esm/cc/ThermostatOperatingStateCC.d.ts.map +1 -1
  174. package/build/esm/cc/ThermostatOperatingStateCC.js +253 -6
  175. package/build/esm/cc/ThermostatOperatingStateCC.js.map +1 -1
  176. package/build/esm/cc/ThermostatSetbackCC._validateArgs.d.ts +1 -1
  177. package/build/esm/cc/ThermostatSetbackCC._validateArgs.d.ts.map +1 -1
  178. package/build/esm/cc/ThermostatSetpointCC._validateArgs.d.ts +3 -3
  179. package/build/esm/cc/ThermostatSetpointCC._validateArgs.d.ts.map +1 -1
  180. package/build/esm/cc/TimeCC._validateArgs.d.ts +4 -4
  181. package/build/esm/cc/TimeCC._validateArgs.d.ts.map +1 -1
  182. package/build/esm/cc/TimeParametersCC._validateArgs.d.ts +1 -1
  183. package/build/esm/cc/TimeParametersCC._validateArgs.d.ts.map +1 -1
  184. package/build/esm/cc/TransportServiceCC.d.ts.map +1 -1
  185. package/build/esm/cc/UserCodeCC._validateArgs.d.ts +6 -6
  186. package/build/esm/cc/UserCodeCC._validateArgs.d.ts.map +1 -1
  187. package/build/esm/cc/UserCodeCC.d.ts.map +1 -1
  188. package/build/esm/cc/UserCredentialCC._validateArgs.d.ts +24 -0
  189. package/build/esm/cc/UserCredentialCC._validateArgs.d.ts.map +1 -0
  190. package/build/esm/cc/UserCredentialCC._validateArgs.js +233 -0
  191. package/build/esm/cc/UserCredentialCC._validateArgs.js.map +1 -0
  192. package/build/esm/cc/UserCredentialCC.d.ts +452 -0
  193. package/build/esm/cc/UserCredentialCC.d.ts.map +1 -0
  194. package/build/esm/cc/UserCredentialCC.js +2731 -0
  195. package/build/esm/cc/UserCredentialCC.js.map +1 -0
  196. package/build/esm/cc/VersionCC._validateArgs.d.ts +3 -3
  197. package/build/esm/cc/VersionCC._validateArgs.d.ts.map +1 -1
  198. package/build/esm/cc/WakeUpCC._validateArgs.d.ts +1 -1
  199. package/build/esm/cc/WakeUpCC._validateArgs.d.ts.map +1 -1
  200. package/build/esm/cc/WindowCoveringCC._validateArgs.d.ts +4 -4
  201. package/build/esm/cc/WindowCoveringCC._validateArgs.d.ts.map +1 -1
  202. package/build/esm/cc/ZWavePlusCC._validateArgs.d.ts +1 -1
  203. package/build/esm/cc/ZWavePlusCC._validateArgs.d.ts.map +1 -1
  204. package/build/esm/cc/_CCValues.generated.d.ts +4907 -3369
  205. package/build/esm/cc/_CCValues.generated.d.ts.map +1 -1
  206. package/build/esm/cc/_CCValues.generated.js +898 -0
  207. package/build/esm/cc/_CCValues.generated.js.map +1 -1
  208. package/build/esm/cc/index.d.ts +6 -3
  209. package/build/esm/cc/index.d.ts.map +1 -1
  210. package/build/esm/cc/index.js +39 -2
  211. package/build/esm/cc/index.js.map +1 -1
  212. package/build/esm/cc/manufacturerProprietary/FibaroCC._validateArgs.d.ts +2 -2
  213. package/build/esm/cc/manufacturerProprietary/FibaroCC._validateArgs.d.ts.map +1 -1
  214. package/build/esm/lib/CommandClass.js +1 -3
  215. package/build/esm/lib/CommandClass.js.map +1 -1
  216. package/build/esm/lib/Security2/shared.d.ts.map +1 -1
  217. package/build/esm/lib/Values.d.ts +5 -5
  218. package/build/esm/lib/Values.d.ts.map +1 -1
  219. package/build/esm/lib/Values.js +1 -4
  220. package/build/esm/lib/Values.js.map +1 -1
  221. package/build/esm/lib/_CCAPI.generated.d.ts +2 -0
  222. package/build/esm/lib/_CCAPI.generated.d.ts.map +1 -1
  223. package/build/esm/lib/_Types.d.ts +153 -1
  224. package/build/esm/lib/_Types.d.ts.map +1 -1
  225. package/build/esm/lib/_Types.js +141 -5
  226. package/build/esm/lib/_Types.js.map +1 -1
  227. package/package.json +8 -8
@@ -0,0 +1,2855 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var UserCredentialCC_exports = {};
31
+ __export(UserCredentialCC_exports, {
32
+ UserCredentialCC: () => UserCredentialCC,
33
+ UserCredentialCCAPI: () => UserCredentialCCAPI,
34
+ UserCredentialCCAdminPinCodeGet: () => UserCredentialCCAdminPinCodeGet,
35
+ UserCredentialCCAdminPinCodeReport: () => UserCredentialCCAdminPinCodeReport,
36
+ UserCredentialCCAdminPinCodeSet: () => UserCredentialCCAdminPinCodeSet,
37
+ UserCredentialCCAllUsersChecksumGet: () => UserCredentialCCAllUsersChecksumGet,
38
+ UserCredentialCCAllUsersChecksumReport: () => UserCredentialCCAllUsersChecksumReport,
39
+ UserCredentialCCCredentialCapabilitiesGet: () => UserCredentialCCCredentialCapabilitiesGet,
40
+ UserCredentialCCCredentialCapabilitiesReport: () => UserCredentialCCCredentialCapabilitiesReport,
41
+ UserCredentialCCCredentialChecksumGet: () => UserCredentialCCCredentialChecksumGet,
42
+ UserCredentialCCCredentialChecksumReport: () => UserCredentialCCCredentialChecksumReport,
43
+ UserCredentialCCCredentialGet: () => UserCredentialCCCredentialGet,
44
+ UserCredentialCCCredentialLearnCancel: () => UserCredentialCCCredentialLearnCancel,
45
+ UserCredentialCCCredentialLearnReport: () => UserCredentialCCCredentialLearnReport,
46
+ UserCredentialCCCredentialLearnStart: () => UserCredentialCCCredentialLearnStart,
47
+ UserCredentialCCCredentialReport: () => UserCredentialCCCredentialReport,
48
+ UserCredentialCCCredentialSet: () => UserCredentialCCCredentialSet,
49
+ UserCredentialCCKeyLockerCapabilitiesGet: () => UserCredentialCCKeyLockerCapabilitiesGet,
50
+ UserCredentialCCKeyLockerCapabilitiesReport: () => UserCredentialCCKeyLockerCapabilitiesReport,
51
+ UserCredentialCCKeyLockerEntryGet: () => UserCredentialCCKeyLockerEntryGet,
52
+ UserCredentialCCKeyLockerEntryReport: () => UserCredentialCCKeyLockerEntryReport,
53
+ UserCredentialCCKeyLockerEntrySet: () => UserCredentialCCKeyLockerEntrySet,
54
+ UserCredentialCCUserCapabilitiesGet: () => UserCredentialCCUserCapabilitiesGet,
55
+ UserCredentialCCUserCapabilitiesReport: () => UserCredentialCCUserCapabilitiesReport,
56
+ UserCredentialCCUserChecksumGet: () => UserCredentialCCUserChecksumGet,
57
+ UserCredentialCCUserChecksumReport: () => UserCredentialCCUserChecksumReport,
58
+ UserCredentialCCUserCredentialAssociationReport: () => UserCredentialCCUserCredentialAssociationReport,
59
+ UserCredentialCCUserCredentialAssociationSet: () => UserCredentialCCUserCredentialAssociationSet,
60
+ UserCredentialCCUserGet: () => UserCredentialCCUserGet,
61
+ UserCredentialCCUserReport: () => UserCredentialCCUserReport,
62
+ UserCredentialCCUserSet: () => UserCredentialCCUserSet,
63
+ UserCredentialCCValues: () => import_CCValues_generated.UserCredentialCCValues
64
+ });
65
+ module.exports = __toCommonJS(UserCredentialCC_exports);
66
+ var import_tslib = require("tslib");
67
+ var __validateArgs = __toESM(require("./UserCredentialCC._validateArgs.js"), 1);
68
+ var import_core = require("@zwave-js/core");
69
+ var import_shared = require("@zwave-js/shared");
70
+ var import_API = require("../lib/API.js");
71
+ var import_CommandClass = require("../lib/CommandClass.js");
72
+ var import_CommandClassDecorators = require("../lib/CommandClassDecorators.js");
73
+ var import_Types = require("../lib/_Types.js");
74
+ var import_CCValues_generated = require("./_CCValues.generated.js");
75
+ const { validateArgs_UserCredentialCCAPI_setUser, validateArgs_UserCredentialCCAPI_getUser, validateArgs_UserCredentialCCAPI_setCredential, validateArgs_UserCredentialCCAPI_getCredential, validateArgs_UserCredentialCCAPI_startCredentialLearn, validateArgs_UserCredentialCCAPI_setUserCredentialAssociation, validateArgs_UserCredentialCCAPI_getUserChecksum, validateArgs_UserCredentialCCAPI_getCredentialChecksum, validateArgs_UserCredentialCCAPI_setAdminPinCode, validateArgs_UserCredentialCCAPI_setKeyLockerEntry, validateArgs_UserCredentialCCAPI_getKeyLockerEntry, validateArgs_UserCredentialCCAPI_sendUserCapabilitiesReport, validateArgs_UserCredentialCCAPI_sendCredentialCapabilitiesReport, validateArgs_UserCredentialCCAPI_sendKeyLockerCapabilitiesReport, validateArgs_UserCredentialCCAPI_sendUserReport, validateArgs_UserCredentialCCAPI_sendCredentialReport, validateArgs_UserCredentialCCAPI_sendCredentialLearnReport, validateArgs_UserCredentialCCAPI_sendUserCredentialAssociationReport, validateArgs_UserCredentialCCAPI_sendAllUsersChecksumReport, validateArgs_UserCredentialCCAPI_sendUserChecksumReport, validateArgs_UserCredentialCCAPI_sendCredentialChecksumReport, validateArgs_UserCredentialCCAPI_sendAdminPinCodeReport, validateArgs_UserCredentialCCAPI_sendKeyLockerEntryReport } = __validateArgs;
76
+ function credentialToLogString(credential) {
77
+ if (credential.length === 0)
78
+ return "(empty)";
79
+ return "*".repeat(credential.length);
80
+ }
81
+ __name(credentialToLogString, "credentialToLogString");
82
+ let UserCredentialCCAPI = (() => {
83
+ let _classDecorators = [(0, import_CommandClassDecorators.API)(import_core.CommandClasses["User Credential"])];
84
+ let _classDescriptor;
85
+ let _classExtraInitializers = [];
86
+ let _classThis;
87
+ let _classSuper = import_API.PhysicalCCAPI;
88
+ let _instanceExtraInitializers = [];
89
+ let _setUser_decorators;
90
+ let _getUser_decorators;
91
+ let _setCredential_decorators;
92
+ let _getCredential_decorators;
93
+ let _startCredentialLearn_decorators;
94
+ let _setUserCredentialAssociation_decorators;
95
+ let _getUserChecksum_decorators;
96
+ let _getCredentialChecksum_decorators;
97
+ let _setAdminPinCode_decorators;
98
+ let _setKeyLockerEntry_decorators;
99
+ let _getKeyLockerEntry_decorators;
100
+ let _sendUserCapabilitiesReport_decorators;
101
+ let _sendCredentialCapabilitiesReport_decorators;
102
+ let _sendKeyLockerCapabilitiesReport_decorators;
103
+ let _sendUserReport_decorators;
104
+ let _sendCredentialReport_decorators;
105
+ let _sendCredentialLearnReport_decorators;
106
+ let _sendUserCredentialAssociationReport_decorators;
107
+ let _sendAllUsersChecksumReport_decorators;
108
+ let _sendUserChecksumReport_decorators;
109
+ let _sendCredentialChecksumReport_decorators;
110
+ let _sendAdminPinCodeReport_decorators;
111
+ let _sendKeyLockerEntryReport_decorators;
112
+ var UserCredentialCCAPI2 = class extends _classSuper {
113
+ static {
114
+ __name(this, "UserCredentialCCAPI");
115
+ }
116
+ static {
117
+ _classThis = this;
118
+ }
119
+ static {
120
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
121
+ _setUser_decorators = [validateArgs_UserCredentialCCAPI_setUser()];
122
+ _getUser_decorators = [validateArgs_UserCredentialCCAPI_getUser()];
123
+ _setCredential_decorators = [validateArgs_UserCredentialCCAPI_setCredential()];
124
+ _getCredential_decorators = [validateArgs_UserCredentialCCAPI_getCredential()];
125
+ _startCredentialLearn_decorators = [validateArgs_UserCredentialCCAPI_startCredentialLearn()];
126
+ _setUserCredentialAssociation_decorators = [validateArgs_UserCredentialCCAPI_setUserCredentialAssociation()];
127
+ _getUserChecksum_decorators = [validateArgs_UserCredentialCCAPI_getUserChecksum()];
128
+ _getCredentialChecksum_decorators = [validateArgs_UserCredentialCCAPI_getCredentialChecksum()];
129
+ _setAdminPinCode_decorators = [validateArgs_UserCredentialCCAPI_setAdminPinCode()];
130
+ _setKeyLockerEntry_decorators = [validateArgs_UserCredentialCCAPI_setKeyLockerEntry()];
131
+ _getKeyLockerEntry_decorators = [validateArgs_UserCredentialCCAPI_getKeyLockerEntry()];
132
+ _sendUserCapabilitiesReport_decorators = [validateArgs_UserCredentialCCAPI_sendUserCapabilitiesReport()];
133
+ _sendCredentialCapabilitiesReport_decorators = [validateArgs_UserCredentialCCAPI_sendCredentialCapabilitiesReport()];
134
+ _sendKeyLockerCapabilitiesReport_decorators = [validateArgs_UserCredentialCCAPI_sendKeyLockerCapabilitiesReport()];
135
+ _sendUserReport_decorators = [validateArgs_UserCredentialCCAPI_sendUserReport()];
136
+ _sendCredentialReport_decorators = [validateArgs_UserCredentialCCAPI_sendCredentialReport()];
137
+ _sendCredentialLearnReport_decorators = [validateArgs_UserCredentialCCAPI_sendCredentialLearnReport()];
138
+ _sendUserCredentialAssociationReport_decorators = [validateArgs_UserCredentialCCAPI_sendUserCredentialAssociationReport()];
139
+ _sendAllUsersChecksumReport_decorators = [validateArgs_UserCredentialCCAPI_sendAllUsersChecksumReport()];
140
+ _sendUserChecksumReport_decorators = [validateArgs_UserCredentialCCAPI_sendUserChecksumReport()];
141
+ _sendCredentialChecksumReport_decorators = [validateArgs_UserCredentialCCAPI_sendCredentialChecksumReport()];
142
+ _sendAdminPinCodeReport_decorators = [validateArgs_UserCredentialCCAPI_sendAdminPinCodeReport()];
143
+ _sendKeyLockerEntryReport_decorators = [validateArgs_UserCredentialCCAPI_sendKeyLockerEntryReport()];
144
+ (0, import_tslib.__esDecorate)(this, null, _setUser_decorators, { kind: "method", name: "setUser", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "setUser" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.setUser, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
145
+ (0, import_tslib.__esDecorate)(this, null, _getUser_decorators, { kind: "method", name: "getUser", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "getUser" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.getUser, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
146
+ (0, import_tslib.__esDecorate)(this, null, _setCredential_decorators, { kind: "method", name: "setCredential", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "setCredential" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.setCredential, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
147
+ (0, import_tslib.__esDecorate)(this, null, _getCredential_decorators, { kind: "method", name: "getCredential", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "getCredential" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.getCredential, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
148
+ (0, import_tslib.__esDecorate)(this, null, _startCredentialLearn_decorators, { kind: "method", name: "startCredentialLearn", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "startCredentialLearn" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.startCredentialLearn, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
149
+ (0, import_tslib.__esDecorate)(this, null, _setUserCredentialAssociation_decorators, { kind: "method", name: "setUserCredentialAssociation", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "setUserCredentialAssociation" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.setUserCredentialAssociation, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
150
+ (0, import_tslib.__esDecorate)(this, null, _getUserChecksum_decorators, { kind: "method", name: "getUserChecksum", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "getUserChecksum" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.getUserChecksum, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
151
+ (0, import_tslib.__esDecorate)(this, null, _getCredentialChecksum_decorators, { kind: "method", name: "getCredentialChecksum", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "getCredentialChecksum" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.getCredentialChecksum, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
152
+ (0, import_tslib.__esDecorate)(this, null, _setAdminPinCode_decorators, { kind: "method", name: "setAdminPinCode", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "setAdminPinCode" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.setAdminPinCode, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
153
+ (0, import_tslib.__esDecorate)(this, null, _setKeyLockerEntry_decorators, { kind: "method", name: "setKeyLockerEntry", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "setKeyLockerEntry" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.setKeyLockerEntry, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
154
+ (0, import_tslib.__esDecorate)(this, null, _getKeyLockerEntry_decorators, { kind: "method", name: "getKeyLockerEntry", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "getKeyLockerEntry" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.getKeyLockerEntry, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
155
+ (0, import_tslib.__esDecorate)(this, null, _sendUserCapabilitiesReport_decorators, { kind: "method", name: "sendUserCapabilitiesReport", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "sendUserCapabilitiesReport" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.sendUserCapabilitiesReport, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
156
+ (0, import_tslib.__esDecorate)(this, null, _sendCredentialCapabilitiesReport_decorators, { kind: "method", name: "sendCredentialCapabilitiesReport", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "sendCredentialCapabilitiesReport" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.sendCredentialCapabilitiesReport, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
157
+ (0, import_tslib.__esDecorate)(this, null, _sendKeyLockerCapabilitiesReport_decorators, { kind: "method", name: "sendKeyLockerCapabilitiesReport", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "sendKeyLockerCapabilitiesReport" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.sendKeyLockerCapabilitiesReport, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
158
+ (0, import_tslib.__esDecorate)(this, null, _sendUserReport_decorators, { kind: "method", name: "sendUserReport", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "sendUserReport" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.sendUserReport, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
159
+ (0, import_tslib.__esDecorate)(this, null, _sendCredentialReport_decorators, { kind: "method", name: "sendCredentialReport", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "sendCredentialReport" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.sendCredentialReport, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
160
+ (0, import_tslib.__esDecorate)(this, null, _sendCredentialLearnReport_decorators, { kind: "method", name: "sendCredentialLearnReport", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "sendCredentialLearnReport" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.sendCredentialLearnReport, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
161
+ (0, import_tslib.__esDecorate)(this, null, _sendUserCredentialAssociationReport_decorators, { kind: "method", name: "sendUserCredentialAssociationReport", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "sendUserCredentialAssociationReport" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.sendUserCredentialAssociationReport, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
162
+ (0, import_tslib.__esDecorate)(this, null, _sendAllUsersChecksumReport_decorators, { kind: "method", name: "sendAllUsersChecksumReport", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "sendAllUsersChecksumReport" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.sendAllUsersChecksumReport, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
163
+ (0, import_tslib.__esDecorate)(this, null, _sendUserChecksumReport_decorators, { kind: "method", name: "sendUserChecksumReport", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "sendUserChecksumReport" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.sendUserChecksumReport, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
164
+ (0, import_tslib.__esDecorate)(this, null, _sendCredentialChecksumReport_decorators, { kind: "method", name: "sendCredentialChecksumReport", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "sendCredentialChecksumReport" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.sendCredentialChecksumReport, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
165
+ (0, import_tslib.__esDecorate)(this, null, _sendAdminPinCodeReport_decorators, { kind: "method", name: "sendAdminPinCodeReport", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "sendAdminPinCodeReport" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.sendAdminPinCodeReport, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
166
+ (0, import_tslib.__esDecorate)(this, null, _sendKeyLockerEntryReport_decorators, { kind: "method", name: "sendKeyLockerEntryReport", static: false, private: false, access: { has: /* @__PURE__ */ __name((obj) => "sendKeyLockerEntryReport" in obj, "has"), get: /* @__PURE__ */ __name((obj) => obj.sendKeyLockerEntryReport, "get") }, metadata: _metadata }, null, _instanceExtraInitializers);
167
+ (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
168
+ UserCredentialCCAPI2 = _classThis = _classDescriptor.value;
169
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
170
+ (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
171
+ }
172
+ supportsCommand(cmd) {
173
+ switch (cmd) {
174
+ // Mandatory v1 commands
175
+ case import_Types.UserCredentialCommand.UserCapabilitiesGet:
176
+ case import_Types.UserCredentialCommand.UserCapabilitiesReport:
177
+ case import_Types.UserCredentialCommand.CredentialCapabilitiesGet:
178
+ case import_Types.UserCredentialCommand.CredentialCapabilitiesReport:
179
+ case import_Types.UserCredentialCommand.UserSet:
180
+ case import_Types.UserCredentialCommand.UserGet:
181
+ case import_Types.UserCredentialCommand.UserReport:
182
+ case import_Types.UserCredentialCommand.CredentialSet:
183
+ case import_Types.UserCredentialCommand.CredentialGet:
184
+ case import_Types.UserCredentialCommand.CredentialReport:
185
+ case import_Types.UserCredentialCommand.CredentialLearnStart:
186
+ case import_Types.UserCredentialCommand.CredentialLearnCancel:
187
+ case import_Types.UserCredentialCommand.CredentialLearnReport:
188
+ case import_Types.UserCredentialCommand.UserCredentialAssociationSet:
189
+ case import_Types.UserCredentialCommand.UserCredentialAssociationReport:
190
+ return true;
191
+ case import_Types.UserCredentialCommand.AllUsersChecksumGet:
192
+ case import_Types.UserCredentialCommand.AllUsersChecksumReport: {
193
+ return this.tryGetValueDB()?.getValue(import_CCValues_generated.UserCredentialCCValues.supportsAllUsersChecksum.endpoint(this.endpoint.index));
194
+ }
195
+ case import_Types.UserCredentialCommand.UserChecksumGet:
196
+ case import_Types.UserCredentialCommand.UserChecksumReport: {
197
+ return this.tryGetValueDB()?.getValue(import_CCValues_generated.UserCredentialCCValues.supportsUserChecksum.endpoint(this.endpoint.index));
198
+ }
199
+ case import_Types.UserCredentialCommand.CredentialChecksumGet:
200
+ case import_Types.UserCredentialCommand.CredentialChecksumReport: {
201
+ return this.tryGetValueDB()?.getValue(import_CCValues_generated.UserCredentialCCValues.supportsCredentialChecksum.endpoint(this.endpoint.index));
202
+ }
203
+ case import_Types.UserCredentialCommand.AdminPinCodeSet:
204
+ case import_Types.UserCredentialCommand.AdminPinCodeGet:
205
+ case import_Types.UserCredentialCommand.AdminPinCodeReport: {
206
+ return this.tryGetValueDB()?.getValue(import_CCValues_generated.UserCredentialCCValues.supportsAdminCode.endpoint(this.endpoint.index));
207
+ }
208
+ // V2 commands
209
+ case import_Types.UserCredentialCommand.KeyLockerCapabilitiesGet:
210
+ case import_Types.UserCredentialCommand.KeyLockerCapabilitiesReport:
211
+ case import_Types.UserCredentialCommand.KeyLockerEntrySet:
212
+ case import_Types.UserCredentialCommand.KeyLockerEntryGet:
213
+ case import_Types.UserCredentialCommand.KeyLockerEntryReport:
214
+ return this.version >= 2;
215
+ }
216
+ return super.supportsCommand(cmd);
217
+ }
218
+ // oxlint-disable-next-line typescript/explicit-module-boundary-types
219
+ async getUserCapabilities() {
220
+ this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.UserCapabilitiesGet);
221
+ const cc = new UserCredentialCCUserCapabilitiesGet({
222
+ nodeId: this.endpoint.nodeId,
223
+ endpointIndex: this.endpoint.index
224
+ });
225
+ const response = await this.host.sendCommand(cc, this.commandOptions);
226
+ if (response) {
227
+ return (0, import_shared.pick)(response, [
228
+ "numberOfSupportedUsers",
229
+ "supportedCredentialRules",
230
+ "maxUserNameLength",
231
+ "supportsUserSchedule",
232
+ "supportsAllUsersChecksum",
233
+ "supportsUserChecksum",
234
+ "supportedUserNameEncodings",
235
+ "supportedUserTypes"
236
+ ]);
237
+ }
238
+ }
239
+ // oxlint-disable-next-line typescript/explicit-module-boundary-types
240
+ async getCredentialCapabilities() {
241
+ this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.CredentialCapabilitiesGet);
242
+ const cc = new UserCredentialCCCredentialCapabilitiesGet({
243
+ nodeId: this.endpoint.nodeId,
244
+ endpointIndex: this.endpoint.index
245
+ });
246
+ const response = await this.host.sendCommand(cc, this.commandOptions);
247
+ if (response) {
248
+ return (0, import_shared.pick)(response, [
249
+ "supportsCredentialChecksum",
250
+ "supportsAdminCode",
251
+ "supportsAdminCodeDeactivation",
252
+ "credentialTypes"
253
+ ]);
254
+ }
255
+ }
256
+ // oxlint-disable-next-line typescript/explicit-module-boundary-types
257
+ async getKeyLockerCapabilities() {
258
+ this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.KeyLockerCapabilitiesGet);
259
+ const cc = new UserCredentialCCKeyLockerCapabilitiesGet({
260
+ nodeId: this.endpoint.nodeId,
261
+ endpointIndex: this.endpoint.index
262
+ });
263
+ const response = await this.host.sendCommand(cc, this.commandOptions);
264
+ return response?.keyLockerCapabilities;
265
+ }
266
+ // User Management
267
+ async setUser(options) {
268
+ this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.UserSet);
269
+ const cc = new UserCredentialCCUserSet({
270
+ nodeId: this.endpoint.nodeId,
271
+ endpointIndex: this.endpoint.index,
272
+ ...options
273
+ });
274
+ return this.host.sendCommand(cc, this.commandOptions);
275
+ }
276
+ async getUser(userId) {
277
+ this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.UserGet);
278
+ const cc = new UserCredentialCCUserGet({
279
+ nodeId: this.endpoint.nodeId,
280
+ endpointIndex: this.endpoint.index,
281
+ userId
282
+ });
283
+ const response = await this.host.sendCommand(cc, this.commandOptions);
284
+ if (response) {
285
+ return (0, import_shared.pick)(response, [
286
+ "nextUserId",
287
+ "modifierType",
288
+ "modifierNodeId",
289
+ "userId",
290
+ "userType",
291
+ "active",
292
+ "credentialRule",
293
+ "expiringTimeoutMinutes",
294
+ "nameEncoding",
295
+ "userName"
296
+ ]);
297
+ }
298
+ }
299
+ // Credential Management
300
+ async setCredential(options) {
301
+ this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.CredentialSet);
302
+ const cc = new UserCredentialCCCredentialSet({
303
+ nodeId: this.endpoint.nodeId,
304
+ endpointIndex: this.endpoint.index,
305
+ ...options
306
+ });
307
+ return this.host.sendCommand(cc, this.commandOptions);
308
+ }
309
+ async getCredential(userId, credentialType, credentialSlot) {
310
+ this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.CredentialGet);
311
+ const cc = new UserCredentialCCCredentialGet({
312
+ nodeId: this.endpoint.nodeId,
313
+ endpointIndex: this.endpoint.index,
314
+ userId,
315
+ credentialType,
316
+ credentialSlot
317
+ });
318
+ const response = await this.host.sendCommand(cc, this.commandOptions);
319
+ if (response) {
320
+ return (0, import_shared.pick)(response, [
321
+ // UserId, credential type and slot can be zero in the
322
+ // request to return the first credential, so we cannot
323
+ // simply omit them here
324
+ "userId",
325
+ "credentialType",
326
+ "credentialSlot",
327
+ "credentialReadBack",
328
+ "credentialLength",
329
+ "credentialData",
330
+ "modifierType",
331
+ "modifierNodeId",
332
+ "nextCredentialType",
333
+ "nextCredentialSlot"
334
+ ]);
335
+ }
336
+ }
337
+ async startCredentialLearn(options) {
338
+ this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.CredentialLearnStart);
339
+ const caps = UserCredentialCC.getCredentialCapabilitiesCached(this.host, this.endpoint, options.credentialType);
340
+ if (caps && !caps.supportsCredentialLearn) {
341
+ throw new import_core.ZWaveError(`Credential learning is not supported for credential type ${(0, import_shared.getEnumMemberName)(import_Types.UserCredentialType, options.credentialType)}`, import_core.ZWaveErrorCodes.CC_NotSupported);
342
+ }
343
+ const cc = new UserCredentialCCCredentialLearnStart({
344
+ nodeId: this.endpoint.nodeId,
345
+ endpointIndex: this.endpoint.index,
346
+ ...options
347
+ });
348
+ return this.host.sendCommand(cc, this.commandOptions);
349
+ }
350
+ async cancelCredentialLearn() {
351
+ this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.CredentialLearnCancel);
352
+ const cc = new UserCredentialCCCredentialLearnCancel({
353
+ nodeId: this.endpoint.nodeId,
354
+ endpointIndex: this.endpoint.index
355
+ });
356
+ return this.host.sendCommand(cc, this.commandOptions);
357
+ }
358
+ async setUserCredentialAssociation(options) {
359
+ this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.UserCredentialAssociationSet);
360
+ const cc = new UserCredentialCCUserCredentialAssociationSet({
361
+ nodeId: this.endpoint.nodeId,
362
+ endpointIndex: this.endpoint.index,
363
+ ...options
364
+ });
365
+ return this.host.sendCommand(cc, this.commandOptions);
366
+ }
367
+ // oxlint-disable-next-line typescript/explicit-module-boundary-types
368
+ async getAllUsersChecksum() {
369
+ this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.AllUsersChecksumGet);
370
+ const cc = new UserCredentialCCAllUsersChecksumGet({
371
+ nodeId: this.endpoint.nodeId,
372
+ endpointIndex: this.endpoint.index
373
+ });
374
+ const response = await this.host.sendCommand(cc, this.commandOptions);
375
+ return response?.checksum;
376
+ }
377
+ async getUserChecksum(userId) {
378
+ this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.UserChecksumGet);
379
+ const cc = new UserCredentialCCUserChecksumGet({
380
+ nodeId: this.endpoint.nodeId,
381
+ endpointIndex: this.endpoint.index,
382
+ userId
383
+ });
384
+ const response = await this.host.sendCommand(cc, this.commandOptions);
385
+ return response?.checksum;
386
+ }
387
+ async getCredentialChecksum(credentialType) {
388
+ this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.CredentialChecksumGet);
389
+ const cc = new UserCredentialCCCredentialChecksumGet({
390
+ nodeId: this.endpoint.nodeId,
391
+ endpointIndex: this.endpoint.index,
392
+ credentialType
393
+ });
394
+ const response = await this.host.sendCommand(cc, this.commandOptions);
395
+ return response?.checksum;
396
+ }
397
+ async setAdminPinCode(options) {
398
+ this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.AdminPinCodeSet);
399
+ if (options.pinCode.length === 0) {
400
+ const supportsDeactivation = this.tryGetValueDB()?.getValue(import_CCValues_generated.UserCredentialCCValues.supportsAdminCodeDeactivation.endpoint(this.endpoint.index));
401
+ if (supportsDeactivation === false) {
402
+ throw new import_core.ZWaveError("This node does not support deactivating the Admin Code", import_core.ZWaveErrorCodes.CC_NotSupported);
403
+ }
404
+ }
405
+ const cc = new UserCredentialCCAdminPinCodeSet({
406
+ nodeId: this.endpoint.nodeId,
407
+ endpointIndex: this.endpoint.index,
408
+ ...options
409
+ });
410
+ return this.host.sendCommand(cc, this.commandOptions);
411
+ }
412
+ // oxlint-disable-next-line typescript/explicit-module-boundary-types
413
+ async getAdminPinCode() {
414
+ this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.AdminPinCodeGet);
415
+ const cc = new UserCredentialCCAdminPinCodeGet({
416
+ nodeId: this.endpoint.nodeId,
417
+ endpointIndex: this.endpoint.index
418
+ });
419
+ const response = await this.host.sendCommand(cc, this.commandOptions);
420
+ return response?.pinCode;
421
+ }
422
+ async setKeyLockerEntry(options) {
423
+ this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.KeyLockerEntrySet);
424
+ const cc = new UserCredentialCCKeyLockerEntrySet({
425
+ nodeId: this.endpoint.nodeId,
426
+ endpointIndex: this.endpoint.index,
427
+ ...options
428
+ });
429
+ return this.host.sendCommand(cc, this.commandOptions);
430
+ }
431
+ async getKeyLockerEntry(entryType, entrySlot) {
432
+ this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.KeyLockerEntryGet);
433
+ const cc = new UserCredentialCCKeyLockerEntryGet({
434
+ nodeId: this.endpoint.nodeId,
435
+ endpointIndex: this.endpoint.index,
436
+ entryType,
437
+ entrySlot
438
+ });
439
+ const response = await this.host.sendCommand(cc, this.commandOptions);
440
+ if (response) {
441
+ return (0, import_shared.pick)(response, [
442
+ "occupied",
443
+ "entryType",
444
+ "entrySlot"
445
+ ]);
446
+ }
447
+ }
448
+ async sendUserCapabilitiesReport(options) {
449
+ this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.UserCapabilitiesReport);
450
+ const cc = new UserCredentialCCUserCapabilitiesReport({
451
+ nodeId: this.endpoint.nodeId,
452
+ endpointIndex: this.endpoint.index,
453
+ ...options
454
+ });
455
+ return this.host.sendCommand(cc, this.commandOptions);
456
+ }
457
+ async sendCredentialCapabilitiesReport(options) {
458
+ this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.CredentialCapabilitiesReport);
459
+ const cc = new UserCredentialCCCredentialCapabilitiesReport({
460
+ nodeId: this.endpoint.nodeId,
461
+ endpointIndex: this.endpoint.index,
462
+ ...options
463
+ });
464
+ return this.host.sendCommand(cc, this.commandOptions);
465
+ }
466
+ async sendKeyLockerCapabilitiesReport(options) {
467
+ this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.KeyLockerCapabilitiesReport);
468
+ const cc = new UserCredentialCCKeyLockerCapabilitiesReport({
469
+ nodeId: this.endpoint.nodeId,
470
+ endpointIndex: this.endpoint.index,
471
+ ...options
472
+ });
473
+ return this.host.sendCommand(cc, this.commandOptions);
474
+ }
475
+ async sendUserReport(options) {
476
+ this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.UserReport);
477
+ const cc = new UserCredentialCCUserReport({
478
+ nodeId: this.endpoint.nodeId,
479
+ endpointIndex: this.endpoint.index,
480
+ ...options
481
+ });
482
+ return this.host.sendCommand(cc, this.commandOptions);
483
+ }
484
+ async sendCredentialReport(options) {
485
+ this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.CredentialReport);
486
+ const cc = new UserCredentialCCCredentialReport({
487
+ nodeId: this.endpoint.nodeId,
488
+ endpointIndex: this.endpoint.index,
489
+ ...options
490
+ });
491
+ return this.host.sendCommand(cc, this.commandOptions);
492
+ }
493
+ async sendCredentialLearnReport(options) {
494
+ this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.CredentialLearnReport);
495
+ const cc = new UserCredentialCCCredentialLearnReport({
496
+ nodeId: this.endpoint.nodeId,
497
+ endpointIndex: this.endpoint.index,
498
+ ...options
499
+ });
500
+ return this.host.sendCommand(cc, this.commandOptions);
501
+ }
502
+ async sendUserCredentialAssociationReport(options) {
503
+ this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.UserCredentialAssociationReport);
504
+ const cc = new UserCredentialCCUserCredentialAssociationReport({
505
+ nodeId: this.endpoint.nodeId,
506
+ endpointIndex: this.endpoint.index,
507
+ ...options
508
+ });
509
+ return this.host.sendCommand(cc, this.commandOptions);
510
+ }
511
+ async sendAllUsersChecksumReport(options) {
512
+ this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.AllUsersChecksumReport);
513
+ const cc = new UserCredentialCCAllUsersChecksumReport({
514
+ nodeId: this.endpoint.nodeId,
515
+ endpointIndex: this.endpoint.index,
516
+ ...options
517
+ });
518
+ return this.host.sendCommand(cc, this.commandOptions);
519
+ }
520
+ async sendUserChecksumReport(options) {
521
+ this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.UserChecksumReport);
522
+ const cc = new UserCredentialCCUserChecksumReport({
523
+ nodeId: this.endpoint.nodeId,
524
+ endpointIndex: this.endpoint.index,
525
+ ...options
526
+ });
527
+ return this.host.sendCommand(cc, this.commandOptions);
528
+ }
529
+ async sendCredentialChecksumReport(options) {
530
+ this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.CredentialChecksumReport);
531
+ const cc = new UserCredentialCCCredentialChecksumReport({
532
+ nodeId: this.endpoint.nodeId,
533
+ endpointIndex: this.endpoint.index,
534
+ ...options
535
+ });
536
+ return this.host.sendCommand(cc, this.commandOptions);
537
+ }
538
+ async sendAdminPinCodeReport(options) {
539
+ this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.AdminPinCodeReport);
540
+ const cc = new UserCredentialCCAdminPinCodeReport({
541
+ nodeId: this.endpoint.nodeId,
542
+ endpointIndex: this.endpoint.index,
543
+ ...options
544
+ });
545
+ return this.host.sendCommand(cc, this.commandOptions);
546
+ }
547
+ async sendKeyLockerEntryReport(options) {
548
+ this.assertSupportsCommand(import_Types.UserCredentialCommand, import_Types.UserCredentialCommand.KeyLockerEntryReport);
549
+ const cc = new UserCredentialCCKeyLockerEntryReport({
550
+ nodeId: this.endpoint.nodeId,
551
+ endpointIndex: this.endpoint.index,
552
+ ...options
553
+ });
554
+ return this.host.sendCommand(cc, this.commandOptions);
555
+ }
556
+ constructor() {
557
+ super(...arguments);
558
+ (0, import_tslib.__runInitializers)(this, _instanceExtraInitializers);
559
+ }
560
+ };
561
+ return UserCredentialCCAPI2 = _classThis;
562
+ })();
563
+ let UserCredentialCC = (() => {
564
+ let _classDecorators = [(0, import_CommandClassDecorators.commandClass)(import_core.CommandClasses["User Credential"]), (0, import_CommandClassDecorators.implementedVersion)(2), (0, import_CommandClassDecorators.ccValues)(import_CCValues_generated.UserCredentialCCValues)];
565
+ let _classDescriptor;
566
+ let _classExtraInitializers = [];
567
+ let _classThis;
568
+ let _classSuper = import_CommandClass.CommandClass;
569
+ var UserCredentialCC2 = class extends _classSuper {
570
+ static {
571
+ __name(this, "UserCredentialCC");
572
+ }
573
+ static {
574
+ _classThis = this;
575
+ }
576
+ static {
577
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
578
+ (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
579
+ UserCredentialCC2 = _classThis = _classDescriptor.value;
580
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
581
+ (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
582
+ }
583
+ async interview(ctx) {
584
+ const node = this.getNode(ctx);
585
+ const endpoint = this.getEndpoint(ctx);
586
+ const api = import_API.CCAPI.create(import_core.CommandClasses["User Credential"], ctx, endpoint).withOptions({
587
+ priority: import_core.MessagePriority.NodeQuery
588
+ });
589
+ ctx.logNode(node.id, {
590
+ endpoint: this.endpointIndex,
591
+ message: "querying user capabilities...",
592
+ direction: "outbound"
593
+ });
594
+ const userCaps = await api.getUserCapabilities();
595
+ if (!userCaps) {
596
+ ctx.logNode(node.id, {
597
+ endpoint: this.endpointIndex,
598
+ message: "User capabilities query timed out - skipping interview",
599
+ level: "warn"
600
+ });
601
+ return;
602
+ }
603
+ ctx.logNode(node.id, {
604
+ endpoint: this.endpointIndex,
605
+ message: "querying credential capabilities...",
606
+ direction: "outbound"
607
+ });
608
+ const credCaps = await api.getCredentialCapabilities();
609
+ if (!credCaps) {
610
+ ctx.logNode(node.id, {
611
+ endpoint: this.endpointIndex,
612
+ message: "Credential capabilities query timed out - skipping interview",
613
+ level: "warn"
614
+ });
615
+ return;
616
+ }
617
+ if (api.version >= 2) {
618
+ ctx.logNode(node.id, {
619
+ endpoint: this.endpointIndex,
620
+ message: "querying key locker capabilities...",
621
+ direction: "outbound"
622
+ });
623
+ await api.getKeyLockerCapabilities();
624
+ }
625
+ await this.refreshValues(ctx);
626
+ this.setInterviewComplete(ctx, true);
627
+ }
628
+ async refreshValues(ctx) {
629
+ const node = this.getNode(ctx);
630
+ const endpoint = this.getEndpoint(ctx);
631
+ const api = import_API.CCAPI.create(import_core.CommandClasses["User Credential"], ctx, endpoint).withOptions({
632
+ priority: import_core.MessagePriority.NodeQuery
633
+ });
634
+ const supportsAllUsersChecksum = this.getValue(ctx, import_CCValues_generated.UserCredentialCCValues.supportsAllUsersChecksum);
635
+ const supportsUserChecksum = this.getValue(ctx, import_CCValues_generated.UserCredentialCCValues.supportsUserChecksum);
636
+ const supportsAdminCode = this.getValue(ctx, import_CCValues_generated.UserCredentialCCValues.supportsAdminCode);
637
+ const supportedKeyLockerEntryTypes = this.getValue(ctx, import_CCValues_generated.UserCredentialCCValues.supportedKeyLockerEntryTypes);
638
+ let skipFullSync = false;
639
+ let allUsersChecksum;
640
+ if (supportsAllUsersChecksum) {
641
+ allUsersChecksum = await api.getAllUsersChecksum();
642
+ const cachedChecksum = this.getValue(ctx, import_CCValues_generated.UserCredentialCCValues.allUsersChecksum);
643
+ if (allUsersChecksum != void 0 && cachedChecksum != void 0 && allUsersChecksum === cachedChecksum) {
644
+ ctx.logNode(node.id, {
645
+ endpoint: this.endpointIndex,
646
+ message: "all-users checksum unchanged, skipping full sync",
647
+ direction: "none"
648
+ });
649
+ skipFullSync = true;
650
+ }
651
+ }
652
+ if (!skipFullSync) {
653
+ let nextUserId = 0;
654
+ let previousUserId = 0;
655
+ do {
656
+ ctx.logNode(node.id, {
657
+ endpoint: this.endpointIndex,
658
+ message: `querying user with UUID ${nextUserId}...`,
659
+ direction: "outbound"
660
+ });
661
+ const user = await api.getUser(nextUserId);
662
+ if (!user?.userId)
663
+ break;
664
+ const currentUserId = user.userId;
665
+ for (let gapUserId = previousUserId + 1; gapUserId < currentUserId; gapUserId++) {
666
+ this.purgeUserFromCache(ctx, gapUserId);
667
+ }
668
+ let userChecksum;
669
+ let syncCredentials = true;
670
+ if (supportsUserChecksum) {
671
+ userChecksum = await api.getUserChecksum(currentUserId);
672
+ const cachedUserChecksum = this.getValue(ctx, import_CCValues_generated.UserCredentialCCValues.userChecksum(currentUserId));
673
+ if (userChecksum != void 0 && cachedUserChecksum != void 0 && userChecksum === cachedUserChecksum) {
674
+ ctx.logNode(node.id, {
675
+ endpoint: this.endpointIndex,
676
+ message: `user ${currentUserId} checksum unchanged, skipping credential sync`,
677
+ direction: "none"
678
+ });
679
+ syncCredentials = false;
680
+ }
681
+ }
682
+ if (syncCredentials) {
683
+ await this.queryCredentialsForUser(ctx, api, node.id, currentUserId);
684
+ if (userChecksum != void 0) {
685
+ this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.userChecksum(currentUserId), userChecksum);
686
+ }
687
+ }
688
+ previousUserId = currentUserId;
689
+ nextUserId = user.nextUserId;
690
+ } while (nextUserId > 0);
691
+ }
692
+ if (allUsersChecksum != void 0) {
693
+ this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.allUsersChecksum, allUsersChecksum);
694
+ }
695
+ if (supportsAdminCode) {
696
+ ctx.logNode(node.id, {
697
+ endpoint: this.endpointIndex,
698
+ message: "querying admin PIN code...",
699
+ direction: "outbound"
700
+ });
701
+ await api.getAdminPinCode();
702
+ }
703
+ if (api.version >= 2 && supportedKeyLockerEntryTypes?.length) {
704
+ for (const entryType of supportedKeyLockerEntryTypes) {
705
+ const entry = this.getValue(ctx, import_CCValues_generated.UserCredentialCCValues.keyLockerCapabilities(entryType));
706
+ if (!entry)
707
+ continue;
708
+ for (let slot = 1; slot <= entry.numberOfEntrySlots; slot++) {
709
+ ctx.logNode(node.id, {
710
+ endpoint: this.endpointIndex,
711
+ message: `querying key locker entry type ${entryType}, slot ${slot}...`,
712
+ direction: "outbound"
713
+ });
714
+ await api.getKeyLockerEntry(entryType, slot);
715
+ }
716
+ }
717
+ }
718
+ }
719
+ purgeUserFromCache(ctx, userId) {
720
+ this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.userType(userId));
721
+ this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.userActive(userId));
722
+ this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialRule(userId));
723
+ this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.expiringTimeoutMinutes(userId));
724
+ this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.userName(userId));
725
+ this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.userModifierType(userId));
726
+ this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.userModifierNodeId(userId));
727
+ this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.userChecksum(userId));
728
+ const valueDB = this.getValueDB(ctx);
729
+ const credentialValues = valueDB.findValues((vid) => (import_CCValues_generated.UserCredentialCCValues.credential.is(vid) || import_CCValues_generated.UserCredentialCCValues.credentialModifierType.is(vid) || import_CCValues_generated.UserCredentialCCValues.credentialModifierNodeId.is(vid)) && vid.propertyKey >> 24 === userId);
730
+ for (const { commandClass: commandClass2, endpoint, property, propertyKey } of credentialValues) {
731
+ valueDB.removeValue({
732
+ commandClass: commandClass2,
733
+ endpoint,
734
+ property,
735
+ propertyKey
736
+ });
737
+ }
738
+ }
739
+ async queryCredentialsForUser(ctx, api, nodeId, userId) {
740
+ let nextCredType = import_Types.UserCredentialType.None;
741
+ let nextCredSlot = 0;
742
+ do {
743
+ ctx.logNode(nodeId, {
744
+ endpoint: this.endpointIndex,
745
+ message: `querying credential for user ${userId}, type ${nextCredType}, slot ${nextCredSlot}...`,
746
+ direction: "outbound"
747
+ });
748
+ const cred = await api.getCredential(userId, nextCredType, nextCredSlot);
749
+ if (!cred?.credentialSlot)
750
+ break;
751
+ nextCredType = cred.nextCredentialType;
752
+ nextCredSlot = cred.nextCredentialSlot;
753
+ } while (nextCredType !== import_Types.UserCredentialType.None || nextCredSlot !== 0);
754
+ }
755
+ static getSupportedUsersCached(ctx, endpoint) {
756
+ return ctx.getValueDB(endpoint.nodeId).getValue(import_CCValues_generated.UserCredentialCCValues.supportedUsers.endpoint(endpoint.index));
757
+ }
758
+ static getSupportedCredentialTypesCached(ctx, endpoint) {
759
+ return ctx.getValueDB(endpoint.nodeId).getValue(import_CCValues_generated.UserCredentialCCValues.supportedCredentialTypes.endpoint(endpoint.index));
760
+ }
761
+ static getCredentialCapabilitiesCached(ctx, endpoint, credentialType) {
762
+ return ctx.getValueDB(endpoint.nodeId).getValue(import_CCValues_generated.UserCredentialCCValues.credentialCapabilities(credentialType).endpoint(endpoint.index));
763
+ }
764
+ static supportsAdminCodeCached(ctx, endpoint) {
765
+ return ctx.getValueDB(endpoint.nodeId).getValue(import_CCValues_generated.UserCredentialCCValues.supportsAdminCode.endpoint(endpoint.index)) ?? false;
766
+ }
767
+ };
768
+ return UserCredentialCC2 = _classThis;
769
+ })();
770
+ let UserCredentialCCUserCapabilitiesReport = (() => {
771
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.UserCapabilitiesReport), (0, import_CommandClassDecorators.ccValueProperty)("numberOfSupportedUsers", import_CCValues_generated.UserCredentialCCValues.supportedUsers), (0, import_CommandClassDecorators.ccValueProperty)("supportedCredentialRules", import_CCValues_generated.UserCredentialCCValues.supportedCredentialRules), (0, import_CommandClassDecorators.ccValueProperty)("maxUserNameLength", import_CCValues_generated.UserCredentialCCValues.maxUserNameLength), (0, import_CommandClassDecorators.ccValueProperty)("supportsUserSchedule", import_CCValues_generated.UserCredentialCCValues.supportsUserSchedule), (0, import_CommandClassDecorators.ccValueProperty)("supportsAllUsersChecksum", import_CCValues_generated.UserCredentialCCValues.supportsAllUsersChecksum), (0, import_CommandClassDecorators.ccValueProperty)("supportsUserChecksum", import_CCValues_generated.UserCredentialCCValues.supportsUserChecksum), (0, import_CommandClassDecorators.ccValueProperty)("supportedUserNameEncodings", import_CCValues_generated.UserCredentialCCValues.supportedUserNameEncodings), (0, import_CommandClassDecorators.ccValueProperty)("supportedUserTypes", import_CCValues_generated.UserCredentialCCValues.supportedUserTypes)];
772
+ let _classDescriptor;
773
+ let _classExtraInitializers = [];
774
+ let _classThis;
775
+ let _classSuper = UserCredentialCC;
776
+ var UserCredentialCCUserCapabilitiesReport2 = class extends _classSuper {
777
+ static {
778
+ __name(this, "UserCredentialCCUserCapabilitiesReport");
779
+ }
780
+ static {
781
+ _classThis = this;
782
+ }
783
+ static {
784
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
785
+ (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
786
+ UserCredentialCCUserCapabilitiesReport2 = _classThis = _classDescriptor.value;
787
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
788
+ (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
789
+ }
790
+ constructor(options) {
791
+ super(options);
792
+ this.numberOfSupportedUsers = options.numberOfSupportedUsers;
793
+ this.supportedCredentialRules = options.supportedCredentialRules;
794
+ this.maxUserNameLength = options.maxUserNameLength;
795
+ this.supportsUserSchedule = options.supportsUserSchedule;
796
+ this.supportsAllUsersChecksum = options.supportsAllUsersChecksum;
797
+ this.supportsUserChecksum = options.supportsUserChecksum;
798
+ this.supportedUserNameEncodings = options.supportedUserNameEncodings;
799
+ this.supportedUserTypes = options.supportedUserTypes;
800
+ }
801
+ static from(raw, ctx) {
802
+ (0, import_core.validatePayload)(raw.payload.length >= 4);
803
+ const numberOfSupportedUsers = raw.payload.readUInt16BE(0);
804
+ const credentialRulesBitmask = raw.payload[2];
805
+ const supportedCredentialRules = (0, import_core.parseBitMask)(import_shared.Bytes.from([credentialRulesBitmask]), 0).filter((v) => v in import_Types.UserCredentialRule);
806
+ const maxUserNameLength = raw.payload[3];
807
+ (0, import_core.validatePayload)(raw.payload.length >= 5);
808
+ const flagsByte = raw.payload[4];
809
+ const supportsUserSchedule = !!(flagsByte & 128);
810
+ const supportsAllUsersChecksum = !!(flagsByte & 64);
811
+ const supportsUserChecksum = !!(flagsByte & 32);
812
+ const nameEncodingBitmask = flagsByte >> 2 & 7;
813
+ let supportedUserNameEncodings;
814
+ if (nameEncodingBitmask === 0) {
815
+ supportedUserNameEncodings = [
816
+ import_Types.UserCredentialNameEncoding.ASCII,
817
+ import_Types.UserCredentialNameEncoding.ExtendedASCII,
818
+ import_Types.UserCredentialNameEncoding.UTF16BE
819
+ ];
820
+ } else {
821
+ supportedUserNameEncodings = (0, import_core.parseBitMask)(import_shared.Bytes.from([nameEncodingBitmask]), 0).filter((v) => v in import_Types.UserCredentialNameEncoding);
822
+ }
823
+ (0, import_core.validatePayload)(raw.payload.length >= 6);
824
+ const userTypesBitmaskLength = raw.payload[5];
825
+ (0, import_core.validatePayload)(raw.payload.length >= 6 + userTypesBitmaskLength);
826
+ const supportedUserTypes = (0, import_core.parseBitMask)(raw.payload.subarray(6, 6 + userTypesBitmaskLength), 0).filter((v) => v in import_Types.UserCredentialUserType);
827
+ return new this({
828
+ nodeId: ctx.sourceNodeId,
829
+ numberOfSupportedUsers,
830
+ supportedCredentialRules,
831
+ maxUserNameLength,
832
+ supportsUserSchedule,
833
+ supportsAllUsersChecksum,
834
+ supportsUserChecksum,
835
+ supportedUserNameEncodings,
836
+ supportedUserTypes
837
+ });
838
+ }
839
+ numberOfSupportedUsers;
840
+ supportedCredentialRules;
841
+ maxUserNameLength;
842
+ supportsUserSchedule;
843
+ supportsAllUsersChecksum;
844
+ supportsUserChecksum;
845
+ supportedUserNameEncodings;
846
+ supportedUserTypes;
847
+ serialize(ctx) {
848
+ const credentialRulesBitmask = (0, import_core.encodeBitMask)(this.supportedCredentialRules, import_Types.UserCredentialRule.Triple, 0);
849
+ const nameEncodingBitmask = (0, import_core.encodeBitMask)(this.supportedUserNameEncodings, import_Types.UserCredentialNameEncoding.UTF16BE, import_Types.UserCredentialNameEncoding.ASCII);
850
+ const flagsByte = (this.supportsUserSchedule ? 128 : 0) | (this.supportsAllUsersChecksum ? 64 : 0) | (this.supportsUserChecksum ? 32 : 0) | (nameEncodingBitmask[0] & 7) << 2;
851
+ const userTypesBitmask = (0, import_core.encodeBitMask)(this.supportedUserTypes, import_Types.UserCredentialUserType.RemoteOnly, import_Types.UserCredentialUserType.General);
852
+ this.payload = import_shared.Bytes.alloc(6 + userTypesBitmask.length);
853
+ this.payload.writeUInt16BE(this.numberOfSupportedUsers, 0);
854
+ this.payload[2] = credentialRulesBitmask[0];
855
+ this.payload[3] = this.maxUserNameLength;
856
+ this.payload[4] = flagsByte;
857
+ this.payload[5] = userTypesBitmask.length;
858
+ this.payload.set(userTypesBitmask, 6);
859
+ return super.serialize(ctx);
860
+ }
861
+ toLogEntry(ctx) {
862
+ return {
863
+ ...super.toLogEntry(ctx),
864
+ message: {
865
+ "supported users": this.numberOfSupportedUsers,
866
+ "supported credential rules": this.supportedCredentialRules.map((r) => (0, import_shared.getEnumMemberName)(import_Types.UserCredentialRule, r)).join(", "),
867
+ "max user name length": this.maxUserNameLength,
868
+ "user schedule support": this.supportsUserSchedule,
869
+ "all users checksum support": this.supportsAllUsersChecksum,
870
+ "user checksum support": this.supportsUserChecksum,
871
+ "supported name encodings": this.supportedUserNameEncodings.map((e) => (0, import_shared.getEnumMemberName)(import_Types.UserCredentialNameEncoding, e)).join(", "),
872
+ "supported user types": this.supportedUserTypes.map((t) => (0, import_shared.getEnumMemberName)(import_Types.UserCredentialUserType, t)).join(", ")
873
+ }
874
+ };
875
+ }
876
+ };
877
+ return UserCredentialCCUserCapabilitiesReport2 = _classThis;
878
+ })();
879
+ let UserCredentialCCUserCapabilitiesGet = (() => {
880
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.UserCapabilitiesGet), (0, import_CommandClassDecorators.expectedCCResponse)(UserCredentialCCUserCapabilitiesReport)];
881
+ let _classDescriptor;
882
+ let _classExtraInitializers = [];
883
+ let _classThis;
884
+ let _classSuper = UserCredentialCC;
885
+ var UserCredentialCCUserCapabilitiesGet2 = class extends _classSuper {
886
+ static {
887
+ __name(this, "UserCredentialCCUserCapabilitiesGet");
888
+ }
889
+ static {
890
+ _classThis = this;
891
+ }
892
+ static {
893
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
894
+ (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
895
+ UserCredentialCCUserCapabilitiesGet2 = _classThis = _classDescriptor.value;
896
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
897
+ (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
898
+ }
899
+ };
900
+ return UserCredentialCCUserCapabilitiesGet2 = _classThis;
901
+ })();
902
+ let UserCredentialCCCredentialCapabilitiesReport = (() => {
903
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.CredentialCapabilitiesReport), (0, import_CommandClassDecorators.ccValueProperty)("supportsCredentialChecksum", import_CCValues_generated.UserCredentialCCValues.supportsCredentialChecksum), (0, import_CommandClassDecorators.ccValueProperty)("supportsAdminCode", import_CCValues_generated.UserCredentialCCValues.supportsAdminCode), (0, import_CommandClassDecorators.ccValueProperty)("supportsAdminCodeDeactivation", import_CCValues_generated.UserCredentialCCValues.supportsAdminCodeDeactivation)];
904
+ let _classDescriptor;
905
+ let _classExtraInitializers = [];
906
+ let _classThis;
907
+ let _classSuper = UserCredentialCC;
908
+ var UserCredentialCCCredentialCapabilitiesReport2 = class extends _classSuper {
909
+ static {
910
+ __name(this, "UserCredentialCCCredentialCapabilitiesReport");
911
+ }
912
+ static {
913
+ _classThis = this;
914
+ }
915
+ static {
916
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
917
+ (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
918
+ UserCredentialCCCredentialCapabilitiesReport2 = _classThis = _classDescriptor.value;
919
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
920
+ (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
921
+ }
922
+ constructor(options) {
923
+ super(options);
924
+ this.supportsCredentialChecksum = options.supportsCredentialChecksum;
925
+ this.supportsAdminCode = options.supportsAdminCode;
926
+ this.supportsAdminCodeDeactivation = options.supportsAdminCodeDeactivation;
927
+ this.credentialTypes = options.credentialTypes;
928
+ }
929
+ static from(raw, ctx) {
930
+ (0, import_core.validatePayload)(raw.payload.length >= 2);
931
+ const flagsByte = raw.payload[0];
932
+ const supportsCredentialChecksum = !!(flagsByte & 128);
933
+ const supportsAdminCode = !!(flagsByte & 64);
934
+ const supportsAdminCodeDeactivation = !!(flagsByte & 32);
935
+ const numberOfCredentialTypes = raw.payload[1];
936
+ const n = numberOfCredentialTypes;
937
+ (0, import_core.validatePayload)(raw.payload.length >= 2 + n * 9);
938
+ const credentialTypes = /* @__PURE__ */ new Map();
939
+ const credTypeOff = 2;
940
+ const clSupportOff = credTypeOff + n;
941
+ const numSlotsOff = clSupportOff + n;
942
+ const minLenOff = numSlotsOff + n * 2;
943
+ const maxLenOff = minLenOff + n;
944
+ const clTimeoutOff = maxLenOff + n;
945
+ const clStepsOff = clTimeoutOff + n;
946
+ const maxHashLenOff = clStepsOff + n;
947
+ for (let i = 0; i < n; i++) {
948
+ const credentialType = raw.payload[credTypeOff + i];
949
+ const clByte = raw.payload[clSupportOff + i];
950
+ const supportsCredentialLearn = !!(clByte & 128);
951
+ const numberOfCredentialSlots = raw.payload.readUInt16BE(numSlotsOff + i * 2);
952
+ const minCredentialLength = raw.payload[minLenOff + i];
953
+ const maxCredentialLength = raw.payload[maxLenOff + i];
954
+ const credentialLearnRecommendedTimeout = raw.payload[clTimeoutOff + i];
955
+ const credentialLearnNumberOfSteps = raw.payload[clStepsOff + i];
956
+ const maxCredentialHashLength = raw.payload[maxHashLenOff + i];
957
+ if (supportsCredentialLearn) {
958
+ (0, import_core.validatePayload)(credentialLearnRecommendedTimeout > 0);
959
+ (0, import_core.validatePayload)(credentialLearnNumberOfSteps > 0);
960
+ credentialTypes.set(credentialType, {
961
+ supportsCredentialLearn,
962
+ numberOfCredentialSlots,
963
+ minCredentialLength,
964
+ maxCredentialLength,
965
+ credentialLearnRecommendedTimeout,
966
+ credentialLearnNumberOfSteps,
967
+ maxCredentialHashLength
968
+ });
969
+ } else {
970
+ (0, import_core.validatePayload)(credentialLearnRecommendedTimeout === 0);
971
+ (0, import_core.validatePayload)(credentialLearnNumberOfSteps === 0);
972
+ credentialTypes.set(credentialType, {
973
+ supportsCredentialLearn,
974
+ numberOfCredentialSlots,
975
+ minCredentialLength,
976
+ maxCredentialLength,
977
+ maxCredentialHashLength
978
+ });
979
+ }
980
+ }
981
+ return new this({
982
+ nodeId: ctx.sourceNodeId,
983
+ supportsCredentialChecksum,
984
+ supportsAdminCode,
985
+ supportsAdminCodeDeactivation,
986
+ credentialTypes
987
+ });
988
+ }
989
+ supportsCredentialChecksum;
990
+ supportsAdminCode;
991
+ supportsAdminCodeDeactivation;
992
+ credentialTypes;
993
+ persistValues(ctx) {
994
+ if (!super.persistValues(ctx))
995
+ return false;
996
+ this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.supportedCredentialTypes, [...this.credentialTypes.keys()]);
997
+ for (const [credentialType, capability] of this.credentialTypes) {
998
+ this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialCapabilities(credentialType), capability);
999
+ }
1000
+ return true;
1001
+ }
1002
+ serialize(ctx) {
1003
+ const n = this.credentialTypes.size;
1004
+ this.payload = import_shared.Bytes.alloc(2 + n * 9);
1005
+ this.payload[0] = (this.supportsCredentialChecksum ? 128 : 0) | (this.supportsAdminCode ? 64 : 0) | (this.supportsAdminCodeDeactivation ? 32 : 0);
1006
+ this.payload[1] = n;
1007
+ const credTypeOff = 2;
1008
+ const clSupportOff = credTypeOff + n;
1009
+ const numSlotsOff = clSupportOff + n;
1010
+ const minLenOff = numSlotsOff + n * 2;
1011
+ const maxLenOff = minLenOff + n;
1012
+ const clTimeoutOff = maxLenOff + n;
1013
+ const clStepsOff = clTimeoutOff + n;
1014
+ const maxHashLenOff = clStepsOff + n;
1015
+ let i = 0;
1016
+ for (const [credentialType, ct] of this.credentialTypes) {
1017
+ this.payload[credTypeOff + i] = credentialType;
1018
+ this.payload[clSupportOff + i] = ct.supportsCredentialLearn ? 128 : 0;
1019
+ this.payload.writeUInt16BE(ct.numberOfCredentialSlots, numSlotsOff + i * 2);
1020
+ this.payload[minLenOff + i] = ct.minCredentialLength;
1021
+ this.payload[maxLenOff + i] = ct.maxCredentialLength;
1022
+ this.payload[clTimeoutOff + i] = ct.credentialLearnRecommendedTimeout ?? 0;
1023
+ this.payload[clStepsOff + i] = ct.credentialLearnNumberOfSteps ?? 0;
1024
+ this.payload[maxHashLenOff + i] = ct.maxCredentialHashLength;
1025
+ i++;
1026
+ }
1027
+ return super.serialize(ctx);
1028
+ }
1029
+ toLogEntry(ctx) {
1030
+ const message = {
1031
+ "credential checksum support": this.supportsCredentialChecksum,
1032
+ "admin code support": this.supportsAdminCode,
1033
+ "admin code deactivation support": this.supportsAdminCodeDeactivation
1034
+ };
1035
+ for (const [credentialType, ct] of this.credentialTypes) {
1036
+ message[`credential type ${(0, import_shared.getEnumMemberName)(import_Types.UserCredentialType, credentialType)}`] = `slots: ${ct.numberOfCredentialSlots}, length: ${ct.minCredentialLength}-${ct.maxCredentialLength}`;
1037
+ }
1038
+ return {
1039
+ ...super.toLogEntry(ctx),
1040
+ message
1041
+ };
1042
+ }
1043
+ };
1044
+ return UserCredentialCCCredentialCapabilitiesReport2 = _classThis;
1045
+ })();
1046
+ let UserCredentialCCCredentialCapabilitiesGet = (() => {
1047
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.CredentialCapabilitiesGet), (0, import_CommandClassDecorators.expectedCCResponse)(UserCredentialCCCredentialCapabilitiesReport)];
1048
+ let _classDescriptor;
1049
+ let _classExtraInitializers = [];
1050
+ let _classThis;
1051
+ let _classSuper = UserCredentialCC;
1052
+ var UserCredentialCCCredentialCapabilitiesGet2 = class extends _classSuper {
1053
+ static {
1054
+ __name(this, "UserCredentialCCCredentialCapabilitiesGet");
1055
+ }
1056
+ static {
1057
+ _classThis = this;
1058
+ }
1059
+ static {
1060
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1061
+ (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1062
+ UserCredentialCCCredentialCapabilitiesGet2 = _classThis = _classDescriptor.value;
1063
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1064
+ (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
1065
+ }
1066
+ };
1067
+ return UserCredentialCCCredentialCapabilitiesGet2 = _classThis;
1068
+ })();
1069
+ let UserCredentialCCKeyLockerCapabilitiesReport = (() => {
1070
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.KeyLockerCapabilitiesReport)];
1071
+ let _classDescriptor;
1072
+ let _classExtraInitializers = [];
1073
+ let _classThis;
1074
+ let _classSuper = UserCredentialCC;
1075
+ var UserCredentialCCKeyLockerCapabilitiesReport2 = class extends _classSuper {
1076
+ static {
1077
+ __name(this, "UserCredentialCCKeyLockerCapabilitiesReport");
1078
+ }
1079
+ static {
1080
+ _classThis = this;
1081
+ }
1082
+ static {
1083
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1084
+ (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1085
+ UserCredentialCCKeyLockerCapabilitiesReport2 = _classThis = _classDescriptor.value;
1086
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1087
+ (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
1088
+ }
1089
+ constructor(options) {
1090
+ super(options);
1091
+ this.keyLockerCapabilities = options.keyLockerCapabilities;
1092
+ }
1093
+ static from(raw, ctx) {
1094
+ (0, import_core.validatePayload)(raw.payload.length >= 1);
1095
+ const numberOfEntryTypes = raw.payload[0];
1096
+ const n = numberOfEntryTypes;
1097
+ (0, import_core.validatePayload)(raw.payload.length >= 1 + n * 7);
1098
+ const keyLockerCapabilities = /* @__PURE__ */ new Map();
1099
+ const entryTypeOff = 1;
1100
+ const numSlotsOff = entryTypeOff + n;
1101
+ const minLenOff = numSlotsOff + n * 2;
1102
+ const maxLenOff = minLenOff + n * 2;
1103
+ for (let i = 0; i < n; i++) {
1104
+ const entryType = raw.payload[entryTypeOff + i];
1105
+ const numberOfEntrySlots = raw.payload.readUInt16BE(numSlotsOff + i * 2);
1106
+ const minEntryDataLength = raw.payload.readUInt16BE(minLenOff + i * 2);
1107
+ const maxEntryDataLength = raw.payload.readUInt16BE(maxLenOff + i * 2);
1108
+ keyLockerCapabilities.set(entryType, {
1109
+ numberOfEntrySlots,
1110
+ minEntryDataLength,
1111
+ maxEntryDataLength
1112
+ });
1113
+ }
1114
+ return new this({
1115
+ nodeId: ctx.sourceNodeId,
1116
+ keyLockerCapabilities
1117
+ });
1118
+ }
1119
+ keyLockerCapabilities;
1120
+ persistValues(ctx) {
1121
+ if (!super.persistValues(ctx))
1122
+ return false;
1123
+ this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.supportedKeyLockerEntryTypes, [...this.keyLockerCapabilities.keys()]);
1124
+ for (const [entryType, capability] of this.keyLockerCapabilities) {
1125
+ this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.keyLockerCapabilities(entryType), capability);
1126
+ }
1127
+ return true;
1128
+ }
1129
+ serialize(ctx) {
1130
+ const n = this.keyLockerCapabilities.size;
1131
+ this.payload = import_shared.Bytes.alloc(1 + n * 7);
1132
+ this.payload[0] = n;
1133
+ const entryTypeOff = 1;
1134
+ const numSlotsOff = entryTypeOff + n;
1135
+ const minLenOff = numSlotsOff + n * 2;
1136
+ const maxLenOff = minLenOff + n * 2;
1137
+ let i = 0;
1138
+ for (const [entryType, capability] of this.keyLockerCapabilities) {
1139
+ this.payload[entryTypeOff + i] = entryType;
1140
+ this.payload.writeUInt16BE(capability.numberOfEntrySlots, numSlotsOff + i * 2);
1141
+ this.payload.writeUInt16BE(capability.minEntryDataLength, minLenOff + i * 2);
1142
+ this.payload.writeUInt16BE(capability.maxEntryDataLength, maxLenOff + i * 2);
1143
+ i++;
1144
+ }
1145
+ return super.serialize(ctx);
1146
+ }
1147
+ toLogEntry(ctx) {
1148
+ const message = {};
1149
+ for (const [entryType, capability] of this.keyLockerCapabilities) {
1150
+ message[`entry type ${(0, import_shared.getEnumMemberName)(import_Types.UserCredentialKeyLockerEntryType, entryType)}`] = `slots: ${capability.numberOfEntrySlots}, length: ${capability.minEntryDataLength}-${capability.maxEntryDataLength}`;
1151
+ }
1152
+ return {
1153
+ ...super.toLogEntry(ctx),
1154
+ message
1155
+ };
1156
+ }
1157
+ };
1158
+ return UserCredentialCCKeyLockerCapabilitiesReport2 = _classThis;
1159
+ })();
1160
+ let UserCredentialCCKeyLockerCapabilitiesGet = (() => {
1161
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.KeyLockerCapabilitiesGet), (0, import_CommandClassDecorators.expectedCCResponse)(UserCredentialCCKeyLockerCapabilitiesReport)];
1162
+ let _classDescriptor;
1163
+ let _classExtraInitializers = [];
1164
+ let _classThis;
1165
+ let _classSuper = UserCredentialCC;
1166
+ var UserCredentialCCKeyLockerCapabilitiesGet2 = class extends _classSuper {
1167
+ static {
1168
+ __name(this, "UserCredentialCCKeyLockerCapabilitiesGet");
1169
+ }
1170
+ static {
1171
+ _classThis = this;
1172
+ }
1173
+ static {
1174
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1175
+ (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1176
+ UserCredentialCCKeyLockerCapabilitiesGet2 = _classThis = _classDescriptor.value;
1177
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1178
+ (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
1179
+ }
1180
+ };
1181
+ return UserCredentialCCKeyLockerCapabilitiesGet2 = _classThis;
1182
+ })();
1183
+ let UserCredentialCCUserSet = (() => {
1184
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.UserSet), (0, import_CommandClassDecorators.useSupervision)()];
1185
+ let _classDescriptor;
1186
+ let _classExtraInitializers = [];
1187
+ let _classThis;
1188
+ let _classSuper = UserCredentialCC;
1189
+ var UserCredentialCCUserSet2 = class extends _classSuper {
1190
+ static {
1191
+ __name(this, "UserCredentialCCUserSet");
1192
+ }
1193
+ static {
1194
+ _classThis = this;
1195
+ }
1196
+ static {
1197
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1198
+ (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1199
+ UserCredentialCCUserSet2 = _classThis = _classDescriptor.value;
1200
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1201
+ (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
1202
+ }
1203
+ constructor(options) {
1204
+ super(options);
1205
+ this.operationType = options.operationType;
1206
+ this.userId = options.userId;
1207
+ if (options.operationType !== import_Types.UserCredentialOperationType.Delete) {
1208
+ this.userType = options.userType;
1209
+ this.active = options.active;
1210
+ this.credentialRule = options.credentialRule;
1211
+ this.expiringTimeoutMinutes = options.expiringTimeoutMinutes;
1212
+ this.nameEncoding = options.nameEncoding;
1213
+ this.userName = options.userName;
1214
+ }
1215
+ }
1216
+ operationType;
1217
+ userId;
1218
+ userType;
1219
+ active;
1220
+ credentialRule;
1221
+ expiringTimeoutMinutes;
1222
+ nameEncoding;
1223
+ userName;
1224
+ static from(raw, ctx) {
1225
+ (0, import_core.validatePayload)(raw.payload.length >= 3);
1226
+ const operationType = raw.payload[0] & 3;
1227
+ const userId = raw.payload.readUInt16BE(1);
1228
+ if (operationType === import_Types.UserCredentialOperationType.Delete) {
1229
+ return new this({
1230
+ nodeId: ctx.sourceNodeId,
1231
+ operationType,
1232
+ userId
1233
+ });
1234
+ }
1235
+ if (raw.payload.length < 10) {
1236
+ return new this({
1237
+ nodeId: ctx.sourceNodeId,
1238
+ operationType,
1239
+ userId
1240
+ });
1241
+ }
1242
+ const userType = raw.payload[3];
1243
+ const active = !!(raw.payload[4] & 1);
1244
+ const credentialRule = raw.payload[5];
1245
+ const expiringTimeoutMinutes = raw.payload.readUInt16BE(6);
1246
+ const nameEncoding = raw.payload[8] & 7;
1247
+ const nameLength = raw.payload[9];
1248
+ (0, import_core.validatePayload)(raw.payload.length >= 10 + nameLength);
1249
+ let userName;
1250
+ if (nameEncoding === import_Types.UserCredentialNameEncoding.UTF16BE) {
1251
+ userName = (0, import_shared.uint8ArrayToStringUTF16BE)(raw.payload.subarray(10, 10 + nameLength));
1252
+ } else {
1253
+ userName = raw.payload.subarray(10, 10 + nameLength).toString("ascii");
1254
+ }
1255
+ if (userType === import_Types.UserCredentialUserType.Expiring) {
1256
+ return new this({
1257
+ nodeId: ctx.sourceNodeId,
1258
+ operationType,
1259
+ userId,
1260
+ userType,
1261
+ expiringTimeoutMinutes,
1262
+ active,
1263
+ credentialRule,
1264
+ nameEncoding,
1265
+ userName
1266
+ });
1267
+ }
1268
+ return new this({
1269
+ nodeId: ctx.sourceNodeId,
1270
+ operationType,
1271
+ userId,
1272
+ userType,
1273
+ active,
1274
+ credentialRule,
1275
+ nameEncoding,
1276
+ userName
1277
+ });
1278
+ }
1279
+ serialize(ctx) {
1280
+ if (this.operationType === import_Types.UserCredentialOperationType.Delete) {
1281
+ this.payload = import_shared.Bytes.alloc(3);
1282
+ this.payload[0] = this.operationType & 3;
1283
+ this.payload.writeUInt16BE(this.userId, 1);
1284
+ return super.serialize(ctx);
1285
+ }
1286
+ if (this.userType == void 0) {
1287
+ throw new import_core.ZWaveError(`${this.constructor.name}: user type must be set for Add/Modify operations`, import_core.ZWaveErrorCodes.Argument_Invalid);
1288
+ }
1289
+ if (this.active == void 0) {
1290
+ throw new import_core.ZWaveError(`${this.constructor.name}: The active flag must be set for Add/Modify operations`, import_core.ZWaveErrorCodes.Argument_Invalid);
1291
+ }
1292
+ const credentialRule = this.credentialRule ?? import_Types.UserCredentialRule.Single;
1293
+ let expiringTimeoutMinutes;
1294
+ if (this.userType === import_Types.UserCredentialUserType.Expiring) {
1295
+ if (this.expiringTimeoutMinutes == void 0) {
1296
+ throw new import_core.ZWaveError(`${this.constructor.name}: expiring timeout minutes must be set for Expiring user type`, import_core.ZWaveErrorCodes.Argument_Invalid);
1297
+ }
1298
+ expiringTimeoutMinutes = this.expiringTimeoutMinutes;
1299
+ } else {
1300
+ expiringTimeoutMinutes = 0;
1301
+ }
1302
+ const nameEncoding = this.nameEncoding ?? import_Types.UserCredentialNameEncoding.ASCII;
1303
+ const userName = this.userName ?? "";
1304
+ let nameBuffer;
1305
+ if (nameEncoding === import_Types.UserCredentialNameEncoding.UTF16BE) {
1306
+ nameBuffer = (0, import_shared.stringToUint8ArrayUTF16BE)(userName);
1307
+ } else {
1308
+ nameBuffer = import_shared.Bytes.from(userName, "ascii");
1309
+ }
1310
+ this.payload = import_shared.Bytes.alloc(10 + nameBuffer.length);
1311
+ this.payload[0] = this.operationType & 3;
1312
+ this.payload.writeUInt16BE(this.userId, 1);
1313
+ this.payload[3] = this.userType;
1314
+ this.payload[4] = this.active ? 1 : 0;
1315
+ this.payload[5] = credentialRule;
1316
+ this.payload.writeUInt16BE(expiringTimeoutMinutes, 6);
1317
+ this.payload[8] = nameEncoding & 7;
1318
+ this.payload[9] = nameBuffer.length;
1319
+ if (nameBuffer.length > 0) {
1320
+ this.payload.set(nameBuffer, 10);
1321
+ }
1322
+ return super.serialize(ctx);
1323
+ }
1324
+ toLogEntry(ctx) {
1325
+ const message = {
1326
+ "operation type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialOperationType, this.operationType),
1327
+ "user ID": this.userId
1328
+ };
1329
+ if (this.userType != void 0) {
1330
+ message["user type"] = (0, import_shared.getEnumMemberName)(import_Types.UserCredentialUserType, this.userType);
1331
+ }
1332
+ if (this.active != void 0) {
1333
+ message["active"] = this.active;
1334
+ }
1335
+ if (this.credentialRule != void 0) {
1336
+ message["credential rule"] = (0, import_shared.getEnumMemberName)(import_Types.UserCredentialRule, this.credentialRule);
1337
+ }
1338
+ if (this.expiringTimeoutMinutes != void 0) {
1339
+ message["expiring timeout (minutes)"] = this.expiringTimeoutMinutes;
1340
+ }
1341
+ if (this.nameEncoding != void 0) {
1342
+ message["name encoding"] = (0, import_shared.getEnumMemberName)(import_Types.UserCredentialNameEncoding, this.nameEncoding);
1343
+ }
1344
+ if (this.userName != void 0) {
1345
+ message["user name"] = this.userName;
1346
+ }
1347
+ return { ...super.toLogEntry(ctx), message };
1348
+ }
1349
+ };
1350
+ return UserCredentialCCUserSet2 = _classThis;
1351
+ })();
1352
+ let UserCredentialCCUserReport = (() => {
1353
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.UserReport)];
1354
+ let _classDescriptor;
1355
+ let _classExtraInitializers = [];
1356
+ let _classThis;
1357
+ let _classSuper = UserCredentialCC;
1358
+ var UserCredentialCCUserReport2 = class extends _classSuper {
1359
+ static {
1360
+ __name(this, "UserCredentialCCUserReport");
1361
+ }
1362
+ static {
1363
+ _classThis = this;
1364
+ }
1365
+ static {
1366
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1367
+ (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1368
+ UserCredentialCCUserReport2 = _classThis = _classDescriptor.value;
1369
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1370
+ (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
1371
+ }
1372
+ constructor(options) {
1373
+ super(options);
1374
+ this.reportType = options.reportType;
1375
+ this.nextUserId = options.nextUserId;
1376
+ this.modifierType = options.modifierType;
1377
+ this.modifierNodeId = options.modifierNodeId;
1378
+ this.userId = options.userId;
1379
+ this.userType = options.userType;
1380
+ this.active = options.active;
1381
+ this.credentialRule = options.credentialRule;
1382
+ this.expiringTimeoutMinutes = options.expiringTimeoutMinutes;
1383
+ this.nameEncoding = options.nameEncoding;
1384
+ this.userName = options.userName;
1385
+ }
1386
+ static from(raw, ctx) {
1387
+ (0, import_core.validatePayload)(raw.payload.length >= 13);
1388
+ const reportType = raw.payload[0];
1389
+ const nextUserId = raw.payload.readUInt16BE(1);
1390
+ const modifierType = raw.payload[3];
1391
+ const modifierNodeId = raw.payload.readUInt16BE(4);
1392
+ const userId = raw.payload.readUInt16BE(6);
1393
+ const userType = raw.payload[8];
1394
+ const active = !!(raw.payload[9] & 1);
1395
+ const credentialRule = raw.payload[10];
1396
+ const expiringTimeoutMinutes = raw.payload.readUInt16BE(11);
1397
+ (0, import_core.validatePayload)(raw.payload.length >= 15);
1398
+ const nameEncoding = raw.payload[13] & 7;
1399
+ const nameLength = raw.payload[14];
1400
+ (0, import_core.validatePayload)(raw.payload.length >= 15 + nameLength);
1401
+ let userName;
1402
+ if (nameEncoding === import_Types.UserCredentialNameEncoding.UTF16BE) {
1403
+ userName = (0, import_shared.uint8ArrayToStringUTF16BE)(raw.payload.subarray(15, 15 + nameLength));
1404
+ } else {
1405
+ userName = raw.payload.subarray(15, 15 + nameLength).toString("ascii");
1406
+ }
1407
+ return new this({
1408
+ nodeId: ctx.sourceNodeId,
1409
+ reportType,
1410
+ nextUserId,
1411
+ modifierType,
1412
+ modifierNodeId,
1413
+ userId,
1414
+ userType,
1415
+ active,
1416
+ credentialRule,
1417
+ expiringTimeoutMinutes,
1418
+ nameEncoding,
1419
+ userName
1420
+ });
1421
+ }
1422
+ reportType;
1423
+ nextUserId;
1424
+ modifierType;
1425
+ modifierNodeId;
1426
+ userId;
1427
+ userType;
1428
+ active;
1429
+ credentialRule;
1430
+ expiringTimeoutMinutes;
1431
+ nameEncoding;
1432
+ userName;
1433
+ serialize(ctx) {
1434
+ let nameBuffer;
1435
+ if (this.nameEncoding === import_Types.UserCredentialNameEncoding.UTF16BE) {
1436
+ nameBuffer = (0, import_shared.stringToUint8ArrayUTF16BE)(this.userName);
1437
+ } else {
1438
+ nameBuffer = import_shared.Bytes.from(this.userName, "ascii");
1439
+ }
1440
+ this.payload = import_shared.Bytes.alloc(15 + nameBuffer.length);
1441
+ this.payload[0] = this.reportType;
1442
+ this.payload.writeUInt16BE(this.nextUserId, 1);
1443
+ this.payload[3] = this.modifierType;
1444
+ this.payload.writeUInt16BE(this.modifierNodeId, 4);
1445
+ this.payload.writeUInt16BE(this.userId, 6);
1446
+ this.payload[8] = this.userType;
1447
+ this.payload[9] = this.active ? 1 : 0;
1448
+ this.payload[10] = this.credentialRule;
1449
+ this.payload.writeUInt16BE(this.expiringTimeoutMinutes, 11);
1450
+ this.payload[13] = this.nameEncoding & 7;
1451
+ this.payload[14] = nameBuffer.length;
1452
+ if (nameBuffer.length > 0) {
1453
+ this.payload.set(nameBuffer, 15);
1454
+ }
1455
+ return super.serialize(ctx);
1456
+ }
1457
+ persistValues(ctx) {
1458
+ if (!super.persistValues(ctx))
1459
+ return false;
1460
+ if (this.userId === 0)
1461
+ return true;
1462
+ if (this.reportType === import_Types.UserCredentialUserReportType.UserDeleted) {
1463
+ const userId2 = this.userId;
1464
+ this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.userType(userId2));
1465
+ this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.userActive(userId2));
1466
+ this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialRule(userId2));
1467
+ this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.expiringTimeoutMinutes(userId2));
1468
+ this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.userName(userId2));
1469
+ this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.userModifierType(userId2));
1470
+ this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.userModifierNodeId(userId2));
1471
+ return true;
1472
+ }
1473
+ if (this.reportType !== import_Types.UserCredentialUserReportType.ResponseToGet && this.reportType !== import_Types.UserCredentialUserReportType.UserAdded && this.reportType !== import_Types.UserCredentialUserReportType.UserModified) {
1474
+ return true;
1475
+ }
1476
+ const userId = this.userId;
1477
+ this.ensureMetadata(ctx, import_CCValues_generated.UserCredentialCCValues.userType(userId));
1478
+ this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.userType(userId), this.userType);
1479
+ this.ensureMetadata(ctx, import_CCValues_generated.UserCredentialCCValues.userActive(userId));
1480
+ this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.userActive(userId), this.active);
1481
+ this.ensureMetadata(ctx, import_CCValues_generated.UserCredentialCCValues.credentialRule(userId));
1482
+ this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialRule(userId), this.credentialRule);
1483
+ this.ensureMetadata(ctx, import_CCValues_generated.UserCredentialCCValues.expiringTimeoutMinutes(userId));
1484
+ this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.expiringTimeoutMinutes(userId), this.expiringTimeoutMinutes);
1485
+ this.ensureMetadata(ctx, import_CCValues_generated.UserCredentialCCValues.userName(userId));
1486
+ this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.userName(userId), this.userName);
1487
+ this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.userModifierType(userId), this.modifierType);
1488
+ this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.userModifierNodeId(userId), this.modifierNodeId);
1489
+ return true;
1490
+ }
1491
+ toLogEntry(ctx) {
1492
+ return {
1493
+ ...super.toLogEntry(ctx),
1494
+ message: {
1495
+ "report type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialUserReportType, this.reportType),
1496
+ "next user ID": this.nextUserId,
1497
+ "modifier type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialModifierType, this.modifierType),
1498
+ "modifier node id": this.modifierNodeId,
1499
+ "user ID": this.userId,
1500
+ "user type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialUserType, this.userType),
1501
+ active: this.active,
1502
+ "credential rule": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialRule, this.credentialRule),
1503
+ "expiring timeout (minutes)": this.expiringTimeoutMinutes,
1504
+ "name encoding": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialNameEncoding, this.nameEncoding),
1505
+ "user name": this.userName
1506
+ }
1507
+ };
1508
+ }
1509
+ };
1510
+ return UserCredentialCCUserReport2 = _classThis;
1511
+ })();
1512
+ function testResponseForUserCredentialUserGet(sent, received) {
1513
+ return received.reportType === import_Types.UserCredentialUserReportType.ResponseToGet;
1514
+ }
1515
+ __name(testResponseForUserCredentialUserGet, "testResponseForUserCredentialUserGet");
1516
+ let UserCredentialCCUserGet = (() => {
1517
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.UserGet), (0, import_CommandClassDecorators.expectedCCResponse)(UserCredentialCCUserReport, testResponseForUserCredentialUserGet)];
1518
+ let _classDescriptor;
1519
+ let _classExtraInitializers = [];
1520
+ let _classThis;
1521
+ let _classSuper = UserCredentialCC;
1522
+ var UserCredentialCCUserGet2 = class extends _classSuper {
1523
+ static {
1524
+ __name(this, "UserCredentialCCUserGet");
1525
+ }
1526
+ static {
1527
+ _classThis = this;
1528
+ }
1529
+ static {
1530
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1531
+ (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1532
+ UserCredentialCCUserGet2 = _classThis = _classDescriptor.value;
1533
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1534
+ (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
1535
+ }
1536
+ constructor(options) {
1537
+ super(options);
1538
+ this.userId = options.userId;
1539
+ }
1540
+ userId;
1541
+ static from(raw, ctx) {
1542
+ (0, import_core.validatePayload)(raw.payload.length >= 2);
1543
+ const userId = raw.payload.readUInt16BE(0);
1544
+ return new this({
1545
+ nodeId: ctx.sourceNodeId,
1546
+ userId
1547
+ });
1548
+ }
1549
+ serialize(ctx) {
1550
+ this.payload = import_shared.Bytes.alloc(2);
1551
+ this.payload.writeUInt16BE(this.userId, 0);
1552
+ return super.serialize(ctx);
1553
+ }
1554
+ toLogEntry(ctx) {
1555
+ return {
1556
+ ...super.toLogEntry(ctx),
1557
+ message: {
1558
+ "user ID": this.userId
1559
+ }
1560
+ };
1561
+ }
1562
+ };
1563
+ return UserCredentialCCUserGet2 = _classThis;
1564
+ })();
1565
+ let UserCredentialCCCredentialSet = (() => {
1566
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.CredentialSet), (0, import_CommandClassDecorators.useSupervision)()];
1567
+ let _classDescriptor;
1568
+ let _classExtraInitializers = [];
1569
+ let _classThis;
1570
+ let _classSuper = UserCredentialCC;
1571
+ var UserCredentialCCCredentialSet2 = class extends _classSuper {
1572
+ static {
1573
+ __name(this, "UserCredentialCCCredentialSet");
1574
+ }
1575
+ static {
1576
+ _classThis = this;
1577
+ }
1578
+ static {
1579
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1580
+ (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1581
+ UserCredentialCCCredentialSet2 = _classThis = _classDescriptor.value;
1582
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1583
+ (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
1584
+ }
1585
+ constructor(options) {
1586
+ super(options);
1587
+ this.userId = options.userId;
1588
+ this.credentialType = options.credentialType;
1589
+ this.credentialSlot = options.credentialSlot;
1590
+ this.operationType = options.operationType;
1591
+ if (options.operationType !== import_Types.UserCredentialOperationType.Delete) {
1592
+ this.credentialData = options.credentialData;
1593
+ }
1594
+ }
1595
+ userId;
1596
+ credentialType;
1597
+ credentialSlot;
1598
+ operationType;
1599
+ credentialData;
1600
+ static from(raw, ctx) {
1601
+ (0, import_core.validatePayload)(raw.payload.length >= 6);
1602
+ const userId = raw.payload.readUInt16BE(0);
1603
+ const credentialType = raw.payload[2];
1604
+ const credentialSlot = raw.payload.readUInt16BE(3);
1605
+ const operationType = raw.payload[5] & 3;
1606
+ if (operationType === import_Types.UserCredentialOperationType.Delete) {
1607
+ return new this({
1608
+ nodeId: ctx.sourceNodeId,
1609
+ userId,
1610
+ credentialType,
1611
+ credentialSlot,
1612
+ operationType
1613
+ });
1614
+ }
1615
+ let credentialData = new import_shared.Bytes();
1616
+ if (raw.payload.length >= 7) {
1617
+ const credentialLength = raw.payload[6];
1618
+ (0, import_core.validatePayload)(raw.payload.length >= 7 + credentialLength);
1619
+ credentialData = import_shared.Bytes.from(raw.payload.subarray(7, 7 + credentialLength));
1620
+ }
1621
+ return new this({
1622
+ nodeId: ctx.sourceNodeId,
1623
+ userId,
1624
+ credentialType,
1625
+ credentialSlot,
1626
+ operationType,
1627
+ credentialData
1628
+ });
1629
+ }
1630
+ serialize(ctx) {
1631
+ if (this.operationType === import_Types.UserCredentialOperationType.Delete) {
1632
+ this.payload = import_shared.Bytes.alloc(6);
1633
+ this.payload.writeUInt16BE(this.userId, 0);
1634
+ this.payload[2] = this.credentialType;
1635
+ this.payload.writeUInt16BE(this.credentialSlot, 3);
1636
+ this.payload[5] = this.operationType & 3;
1637
+ return super.serialize(ctx);
1638
+ }
1639
+ if (this.credentialData == void 0) {
1640
+ throw new import_core.ZWaveError(`${this.constructor.name}: credential data must be set for Add/Modify operations`, import_core.ZWaveErrorCodes.Argument_Invalid);
1641
+ }
1642
+ this.payload = import_shared.Bytes.alloc(7 + this.credentialData.length);
1643
+ this.payload.writeUInt16BE(this.userId, 0);
1644
+ this.payload[2] = this.credentialType;
1645
+ this.payload.writeUInt16BE(this.credentialSlot, 3);
1646
+ this.payload[5] = this.operationType & 3;
1647
+ this.payload[6] = this.credentialData.length;
1648
+ if (this.credentialData.length > 0) {
1649
+ this.payload.set(this.credentialData, 7);
1650
+ }
1651
+ return super.serialize(ctx);
1652
+ }
1653
+ toLogEntry(ctx) {
1654
+ const message = {
1655
+ "user ID": this.userId,
1656
+ "credential type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialType, this.credentialType),
1657
+ "credential slot": this.credentialSlot,
1658
+ "operation type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialOperationType, this.operationType)
1659
+ };
1660
+ if (this.credentialData != void 0) {
1661
+ message["credential data"] = credentialToLogString(this.credentialData);
1662
+ }
1663
+ return { ...super.toLogEntry(ctx), message };
1664
+ }
1665
+ };
1666
+ return UserCredentialCCCredentialSet2 = _classThis;
1667
+ })();
1668
+ let UserCredentialCCCredentialReport = (() => {
1669
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.CredentialReport)];
1670
+ let _classDescriptor;
1671
+ let _classExtraInitializers = [];
1672
+ let _classThis;
1673
+ let _classSuper = UserCredentialCC;
1674
+ var UserCredentialCCCredentialReport2 = class extends _classSuper {
1675
+ static {
1676
+ __name(this, "UserCredentialCCCredentialReport");
1677
+ }
1678
+ static {
1679
+ _classThis = this;
1680
+ }
1681
+ static {
1682
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1683
+ (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1684
+ UserCredentialCCCredentialReport2 = _classThis = _classDescriptor.value;
1685
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1686
+ (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
1687
+ }
1688
+ constructor(options) {
1689
+ super(options);
1690
+ this.reportType = options.reportType;
1691
+ this.userId = options.userId;
1692
+ this.credentialType = options.credentialType;
1693
+ this.credentialSlot = options.credentialSlot;
1694
+ this.credentialReadBack = options.credentialReadBack;
1695
+ this.credentialLength = options.credentialLength;
1696
+ this.credentialData = options.credentialData;
1697
+ this.modifierType = options.modifierType;
1698
+ this.modifierNodeId = options.modifierNodeId;
1699
+ this.nextCredentialType = options.nextCredentialType;
1700
+ this.nextCredentialSlot = options.nextCredentialSlot;
1701
+ }
1702
+ static from(raw, ctx) {
1703
+ (0, import_core.validatePayload)(raw.payload.length >= 8);
1704
+ const reportType = raw.payload[0];
1705
+ const userId = raw.payload.readUInt16BE(1);
1706
+ const credentialType = raw.payload[3];
1707
+ const credentialSlot = raw.payload.readUInt16BE(4);
1708
+ const credentialReadBack = !!(raw.payload[6] & 128);
1709
+ const credentialLength = raw.payload[7];
1710
+ (0, import_core.validatePayload)(raw.payload.length >= 8 + credentialLength + 6);
1711
+ const credentialData = import_shared.Bytes.from(raw.payload.subarray(8, 8 + credentialLength));
1712
+ let offset = 8 + credentialLength;
1713
+ const modifierType = raw.payload[offset];
1714
+ const modifierNodeId = raw.payload.readUInt16BE(offset + 1);
1715
+ const nextCredentialType = raw.payload[offset + 3];
1716
+ const nextCredentialSlot = raw.payload.readUInt16BE(offset + 4);
1717
+ return new this({
1718
+ nodeId: ctx.sourceNodeId,
1719
+ reportType,
1720
+ userId,
1721
+ credentialType,
1722
+ credentialSlot,
1723
+ credentialReadBack,
1724
+ credentialLength,
1725
+ credentialData,
1726
+ modifierType,
1727
+ modifierNodeId,
1728
+ nextCredentialType,
1729
+ nextCredentialSlot
1730
+ });
1731
+ }
1732
+ reportType;
1733
+ userId;
1734
+ credentialType;
1735
+ credentialSlot;
1736
+ credentialReadBack;
1737
+ credentialLength;
1738
+ credentialData;
1739
+ modifierType;
1740
+ modifierNodeId;
1741
+ nextCredentialType;
1742
+ nextCredentialSlot;
1743
+ serialize(ctx) {
1744
+ this.payload = import_shared.Bytes.alloc(14 + this.credentialData.length);
1745
+ this.payload[0] = this.reportType;
1746
+ this.payload.writeUInt16BE(this.userId, 1);
1747
+ this.payload[3] = this.credentialType;
1748
+ this.payload.writeUInt16BE(this.credentialSlot, 4);
1749
+ this.payload[6] = this.credentialReadBack ? 128 : 0;
1750
+ this.payload[7] = this.credentialData.length;
1751
+ if (this.credentialData.length > 0) {
1752
+ this.payload.set(this.credentialData, 8);
1753
+ }
1754
+ let offset = 8 + this.credentialData.length;
1755
+ this.payload[offset] = this.modifierType;
1756
+ this.payload.writeUInt16BE(this.modifierNodeId, offset + 1);
1757
+ this.payload[offset + 3] = this.nextCredentialType;
1758
+ this.payload.writeUInt16BE(this.nextCredentialSlot, offset + 4);
1759
+ return super.serialize(ctx);
1760
+ }
1761
+ persistValues(ctx) {
1762
+ if (!super.persistValues(ctx))
1763
+ return false;
1764
+ if (this.credentialType === import_Types.UserCredentialType.None || this.credentialSlot === 0) {
1765
+ return true;
1766
+ }
1767
+ if (this.reportType === import_Types.UserCredentialCredentialReportType.CredentialDeleted) {
1768
+ this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.credential(this.userId, this.credentialType, this.credentialSlot));
1769
+ this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialModifierType(this.userId, this.credentialType, this.credentialSlot));
1770
+ this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialModifierNodeId(this.userId, this.credentialType, this.credentialSlot));
1771
+ return true;
1772
+ }
1773
+ if (this.reportType !== import_Types.UserCredentialCredentialReportType.ResponseToGet && this.reportType !== import_Types.UserCredentialCredentialReportType.CredentialAdded && this.reportType !== import_Types.UserCredentialCredentialReportType.CredentialModified) {
1774
+ return true;
1775
+ }
1776
+ this.ensureMetadata(ctx, import_CCValues_generated.UserCredentialCCValues.credential(this.userId, this.credentialType, this.credentialSlot));
1777
+ this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.credential(this.userId, this.credentialType, this.credentialSlot), this.credentialData);
1778
+ this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialModifierType(this.userId, this.credentialType, this.credentialSlot), this.modifierType);
1779
+ this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialModifierNodeId(this.userId, this.credentialType, this.credentialSlot), this.modifierNodeId);
1780
+ return true;
1781
+ }
1782
+ toLogEntry(ctx) {
1783
+ return {
1784
+ ...super.toLogEntry(ctx),
1785
+ message: {
1786
+ "report type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialCredentialReportType, this.reportType),
1787
+ "user ID": this.userId,
1788
+ "credential type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialType, this.credentialType),
1789
+ "credential slot": this.credentialSlot,
1790
+ "credential read-back": this.credentialReadBack,
1791
+ "credential data": credentialToLogString(this.credentialData),
1792
+ "modifier type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialModifierType, this.modifierType),
1793
+ "modifier node id": this.modifierNodeId,
1794
+ "next credential type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialType, this.nextCredentialType),
1795
+ "next credential slot": this.nextCredentialSlot
1796
+ }
1797
+ };
1798
+ }
1799
+ };
1800
+ return UserCredentialCCCredentialReport2 = _classThis;
1801
+ })();
1802
+ function testResponseForUserCredentialCredentialGet(_sent, received) {
1803
+ return received.reportType === import_Types.UserCredentialCredentialReportType.ResponseToGet;
1804
+ }
1805
+ __name(testResponseForUserCredentialCredentialGet, "testResponseForUserCredentialCredentialGet");
1806
+ let UserCredentialCCCredentialGet = (() => {
1807
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.CredentialGet), (0, import_CommandClassDecorators.expectedCCResponse)(UserCredentialCCCredentialReport, testResponseForUserCredentialCredentialGet)];
1808
+ let _classDescriptor;
1809
+ let _classExtraInitializers = [];
1810
+ let _classThis;
1811
+ let _classSuper = UserCredentialCC;
1812
+ var UserCredentialCCCredentialGet2 = class extends _classSuper {
1813
+ static {
1814
+ __name(this, "UserCredentialCCCredentialGet");
1815
+ }
1816
+ static {
1817
+ _classThis = this;
1818
+ }
1819
+ static {
1820
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1821
+ (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1822
+ UserCredentialCCCredentialGet2 = _classThis = _classDescriptor.value;
1823
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1824
+ (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
1825
+ }
1826
+ constructor(options) {
1827
+ super(options);
1828
+ this.userId = options.userId;
1829
+ this.credentialType = options.credentialType;
1830
+ this.credentialSlot = options.credentialSlot;
1831
+ }
1832
+ userId;
1833
+ credentialType;
1834
+ credentialSlot;
1835
+ static from(raw, ctx) {
1836
+ (0, import_core.validatePayload)(raw.payload.length >= 5);
1837
+ const userId = raw.payload.readUInt16BE(0);
1838
+ const credentialType = raw.payload[2];
1839
+ const credentialSlot = raw.payload.readUInt16BE(3);
1840
+ return new this({
1841
+ nodeId: ctx.sourceNodeId,
1842
+ userId,
1843
+ credentialType,
1844
+ credentialSlot
1845
+ });
1846
+ }
1847
+ serialize(ctx) {
1848
+ this.payload = import_shared.Bytes.alloc(5);
1849
+ this.payload.writeUInt16BE(this.userId, 0);
1850
+ this.payload[2] = this.credentialType;
1851
+ this.payload.writeUInt16BE(this.credentialSlot, 3);
1852
+ return super.serialize(ctx);
1853
+ }
1854
+ toLogEntry(ctx) {
1855
+ return {
1856
+ ...super.toLogEntry(ctx),
1857
+ message: {
1858
+ "user ID": this.userId,
1859
+ "credential type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialType, this.credentialType),
1860
+ "credential slot": this.credentialSlot
1861
+ }
1862
+ };
1863
+ }
1864
+ };
1865
+ return UserCredentialCCCredentialGet2 = _classThis;
1866
+ })();
1867
+ let UserCredentialCCCredentialLearnStart = (() => {
1868
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.CredentialLearnStart), (0, import_CommandClassDecorators.useSupervision)()];
1869
+ let _classDescriptor;
1870
+ let _classExtraInitializers = [];
1871
+ let _classThis;
1872
+ let _classSuper = UserCredentialCC;
1873
+ var UserCredentialCCCredentialLearnStart2 = class extends _classSuper {
1874
+ static {
1875
+ __name(this, "UserCredentialCCCredentialLearnStart");
1876
+ }
1877
+ static {
1878
+ _classThis = this;
1879
+ }
1880
+ static {
1881
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1882
+ (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1883
+ UserCredentialCCCredentialLearnStart2 = _classThis = _classDescriptor.value;
1884
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1885
+ (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
1886
+ }
1887
+ constructor(options) {
1888
+ super(options);
1889
+ this.userId = options.userId;
1890
+ this.credentialType = options.credentialType;
1891
+ this.credentialSlot = options.credentialSlot;
1892
+ this.operationType = options.operationType;
1893
+ this.learnTimeout = options.learnTimeout;
1894
+ }
1895
+ userId;
1896
+ credentialType;
1897
+ credentialSlot;
1898
+ operationType;
1899
+ learnTimeout;
1900
+ static from(raw, ctx) {
1901
+ (0, import_core.validatePayload)(raw.payload.length >= 7);
1902
+ const userId = raw.payload.readUInt16BE(0);
1903
+ const credentialType = raw.payload[2];
1904
+ const credentialSlot = raw.payload.readUInt16BE(3);
1905
+ const operationType = raw.payload[5] & 3;
1906
+ const learnTimeout = raw.payload[6];
1907
+ return new this({
1908
+ nodeId: ctx.sourceNodeId,
1909
+ userId,
1910
+ credentialType,
1911
+ credentialSlot,
1912
+ operationType,
1913
+ learnTimeout
1914
+ });
1915
+ }
1916
+ serialize(ctx) {
1917
+ this.payload = import_shared.Bytes.alloc(7);
1918
+ this.payload.writeUInt16BE(this.userId, 0);
1919
+ this.payload[2] = this.credentialType;
1920
+ this.payload.writeUInt16BE(this.credentialSlot, 3);
1921
+ this.payload[5] = this.operationType & 3;
1922
+ this.payload[6] = this.learnTimeout;
1923
+ return super.serialize(ctx);
1924
+ }
1925
+ toLogEntry(ctx) {
1926
+ return {
1927
+ ...super.toLogEntry(ctx),
1928
+ message: {
1929
+ "user ID": this.userId,
1930
+ "credential type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialType, this.credentialType),
1931
+ "credential slot": this.credentialSlot,
1932
+ "operation type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialOperationType, this.operationType),
1933
+ "learn timeout": this.learnTimeout
1934
+ }
1935
+ };
1936
+ }
1937
+ };
1938
+ return UserCredentialCCCredentialLearnStart2 = _classThis;
1939
+ })();
1940
+ let UserCredentialCCCredentialLearnCancel = (() => {
1941
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.CredentialLearnCancel), (0, import_CommandClassDecorators.useSupervision)()];
1942
+ let _classDescriptor;
1943
+ let _classExtraInitializers = [];
1944
+ let _classThis;
1945
+ let _classSuper = UserCredentialCC;
1946
+ var UserCredentialCCCredentialLearnCancel2 = class extends _classSuper {
1947
+ static {
1948
+ __name(this, "UserCredentialCCCredentialLearnCancel");
1949
+ }
1950
+ static {
1951
+ _classThis = this;
1952
+ }
1953
+ static {
1954
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1955
+ (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1956
+ UserCredentialCCCredentialLearnCancel2 = _classThis = _classDescriptor.value;
1957
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1958
+ (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
1959
+ }
1960
+ };
1961
+ return UserCredentialCCCredentialLearnCancel2 = _classThis;
1962
+ })();
1963
+ let UserCredentialCCCredentialLearnReport = (() => {
1964
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.CredentialLearnReport)];
1965
+ let _classDescriptor;
1966
+ let _classExtraInitializers = [];
1967
+ let _classThis;
1968
+ let _classSuper = UserCredentialCC;
1969
+ var UserCredentialCCCredentialLearnReport2 = class extends _classSuper {
1970
+ static {
1971
+ __name(this, "UserCredentialCCCredentialLearnReport");
1972
+ }
1973
+ static {
1974
+ _classThis = this;
1975
+ }
1976
+ static {
1977
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1978
+ (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1979
+ UserCredentialCCCredentialLearnReport2 = _classThis = _classDescriptor.value;
1980
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1981
+ (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
1982
+ }
1983
+ constructor(options) {
1984
+ super(options);
1985
+ this.learnStatus = options.learnStatus;
1986
+ this.userId = options.userId;
1987
+ this.credentialType = options.credentialType;
1988
+ this.credentialSlot = options.credentialSlot;
1989
+ this.stepsRemaining = options.stepsRemaining;
1990
+ }
1991
+ static from(raw, ctx) {
1992
+ (0, import_core.validatePayload)(raw.payload.length >= 7);
1993
+ const learnStatus = raw.payload[0];
1994
+ const userId = raw.payload.readUInt16BE(1);
1995
+ const credentialType = raw.payload[3];
1996
+ const credentialSlot = raw.payload.readUInt16BE(4);
1997
+ const stepsRemaining = raw.payload[6];
1998
+ return new this({
1999
+ nodeId: ctx.sourceNodeId,
2000
+ learnStatus,
2001
+ userId,
2002
+ credentialType,
2003
+ credentialSlot,
2004
+ stepsRemaining
2005
+ });
2006
+ }
2007
+ learnStatus;
2008
+ userId;
2009
+ credentialType;
2010
+ credentialSlot;
2011
+ stepsRemaining;
2012
+ serialize(ctx) {
2013
+ this.payload = import_shared.Bytes.alloc(7);
2014
+ this.payload[0] = this.learnStatus;
2015
+ this.payload.writeUInt16BE(this.userId, 1);
2016
+ this.payload[3] = this.credentialType;
2017
+ this.payload.writeUInt16BE(this.credentialSlot, 4);
2018
+ this.payload[6] = this.stepsRemaining;
2019
+ return super.serialize(ctx);
2020
+ }
2021
+ toLogEntry(ctx) {
2022
+ return {
2023
+ ...super.toLogEntry(ctx),
2024
+ message: {
2025
+ "learn status": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialLearnStatus, this.learnStatus),
2026
+ "user ID": this.userId,
2027
+ "credential type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialType, this.credentialType),
2028
+ "credential slot": this.credentialSlot,
2029
+ "steps remaining": this.stepsRemaining
2030
+ }
2031
+ };
2032
+ }
2033
+ };
2034
+ return UserCredentialCCCredentialLearnReport2 = _classThis;
2035
+ })();
2036
+ let UserCredentialCCUserCredentialAssociationSet = (() => {
2037
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.UserCredentialAssociationSet), (0, import_CommandClassDecorators.useSupervision)()];
2038
+ let _classDescriptor;
2039
+ let _classExtraInitializers = [];
2040
+ let _classThis;
2041
+ let _classSuper = UserCredentialCC;
2042
+ var UserCredentialCCUserCredentialAssociationSet2 = class extends _classSuper {
2043
+ static {
2044
+ __name(this, "UserCredentialCCUserCredentialAssociationSet");
2045
+ }
2046
+ static {
2047
+ _classThis = this;
2048
+ }
2049
+ static {
2050
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
2051
+ (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
2052
+ UserCredentialCCUserCredentialAssociationSet2 = _classThis = _classDescriptor.value;
2053
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
2054
+ (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
2055
+ }
2056
+ constructor(options) {
2057
+ super(options);
2058
+ this.credentialType = options.credentialType;
2059
+ this.credentialSlot = options.credentialSlot;
2060
+ this.destinationUserId = options.destinationUserId;
2061
+ }
2062
+ credentialType;
2063
+ credentialSlot;
2064
+ destinationUserId;
2065
+ static from(raw, ctx) {
2066
+ (0, import_core.validatePayload)(raw.payload.length >= 5);
2067
+ const credentialType = raw.payload[0];
2068
+ const credentialSlot = raw.payload.readUInt16BE(1);
2069
+ const destinationUserId = raw.payload.readUInt16BE(3);
2070
+ return new this({
2071
+ nodeId: ctx.sourceNodeId,
2072
+ credentialType,
2073
+ credentialSlot,
2074
+ destinationUserId
2075
+ });
2076
+ }
2077
+ serialize(ctx) {
2078
+ this.payload = import_shared.Bytes.alloc(5);
2079
+ this.payload[0] = this.credentialType;
2080
+ this.payload.writeUInt16BE(this.credentialSlot, 1);
2081
+ this.payload.writeUInt16BE(this.destinationUserId, 3);
2082
+ return super.serialize(ctx);
2083
+ }
2084
+ toLogEntry(ctx) {
2085
+ return {
2086
+ ...super.toLogEntry(ctx),
2087
+ message: {
2088
+ "credential type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialType, this.credentialType),
2089
+ "credential slot": this.credentialSlot,
2090
+ "destination user ID": this.destinationUserId
2091
+ }
2092
+ };
2093
+ }
2094
+ };
2095
+ return UserCredentialCCUserCredentialAssociationSet2 = _classThis;
2096
+ })();
2097
+ let UserCredentialCCUserCredentialAssociationReport = (() => {
2098
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.UserCredentialAssociationReport)];
2099
+ let _classDescriptor;
2100
+ let _classExtraInitializers = [];
2101
+ let _classThis;
2102
+ let _classSuper = UserCredentialCC;
2103
+ var UserCredentialCCUserCredentialAssociationReport2 = class extends _classSuper {
2104
+ static {
2105
+ __name(this, "UserCredentialCCUserCredentialAssociationReport");
2106
+ }
2107
+ static {
2108
+ _classThis = this;
2109
+ }
2110
+ static {
2111
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
2112
+ (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
2113
+ UserCredentialCCUserCredentialAssociationReport2 = _classThis = _classDescriptor.value;
2114
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
2115
+ (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
2116
+ }
2117
+ constructor(options) {
2118
+ super(options);
2119
+ this.credentialType = options.credentialType;
2120
+ this.credentialSlot = options.credentialSlot;
2121
+ this.destinationUserId = options.destinationUserId;
2122
+ this.status = options.status;
2123
+ }
2124
+ static from(raw, ctx) {
2125
+ (0, import_core.validatePayload)(raw.payload.length >= 6);
2126
+ const credentialType = raw.payload[0];
2127
+ const credentialSlot = raw.payload.readUInt16BE(1);
2128
+ const destinationUserId = raw.payload.readUInt16BE(3);
2129
+ const status = raw.payload[5];
2130
+ return new this({
2131
+ nodeId: ctx.sourceNodeId,
2132
+ credentialType,
2133
+ credentialSlot,
2134
+ destinationUserId,
2135
+ status
2136
+ });
2137
+ }
2138
+ credentialType;
2139
+ credentialSlot;
2140
+ destinationUserId;
2141
+ status;
2142
+ serialize(ctx) {
2143
+ this.payload = import_shared.Bytes.alloc(6);
2144
+ this.payload[0] = this.credentialType;
2145
+ this.payload.writeUInt16BE(this.credentialSlot, 1);
2146
+ this.payload.writeUInt16BE(this.destinationUserId, 3);
2147
+ this.payload[5] = this.status;
2148
+ return super.serialize(ctx);
2149
+ }
2150
+ toLogEntry(ctx) {
2151
+ return {
2152
+ ...super.toLogEntry(ctx),
2153
+ message: {
2154
+ "credential type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialType, this.credentialType),
2155
+ "credential slot": this.credentialSlot,
2156
+ "destination user ID": this.destinationUserId,
2157
+ status: this.status
2158
+ }
2159
+ };
2160
+ }
2161
+ };
2162
+ return UserCredentialCCUserCredentialAssociationReport2 = _classThis;
2163
+ })();
2164
+ let UserCredentialCCAllUsersChecksumReport = (() => {
2165
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.AllUsersChecksumReport)];
2166
+ let _classDescriptor;
2167
+ let _classExtraInitializers = [];
2168
+ let _classThis;
2169
+ let _classSuper = UserCredentialCC;
2170
+ var UserCredentialCCAllUsersChecksumReport2 = class extends _classSuper {
2171
+ static {
2172
+ __name(this, "UserCredentialCCAllUsersChecksumReport");
2173
+ }
2174
+ static {
2175
+ _classThis = this;
2176
+ }
2177
+ static {
2178
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
2179
+ (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
2180
+ UserCredentialCCAllUsersChecksumReport2 = _classThis = _classDescriptor.value;
2181
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
2182
+ (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
2183
+ }
2184
+ constructor(options) {
2185
+ super(options);
2186
+ this.checksum = options.checksum;
2187
+ }
2188
+ static from(raw, ctx) {
2189
+ (0, import_core.validatePayload)(raw.payload.length >= 2);
2190
+ const checksum = raw.payload.readUInt16BE(0);
2191
+ return new this({
2192
+ nodeId: ctx.sourceNodeId,
2193
+ checksum
2194
+ });
2195
+ }
2196
+ checksum;
2197
+ serialize(ctx) {
2198
+ this.payload = import_shared.Bytes.alloc(2);
2199
+ this.payload.writeUInt16BE(this.checksum, 0);
2200
+ return super.serialize(ctx);
2201
+ }
2202
+ toLogEntry(ctx) {
2203
+ return {
2204
+ ...super.toLogEntry(ctx),
2205
+ message: { checksum: this.checksum }
2206
+ };
2207
+ }
2208
+ };
2209
+ return UserCredentialCCAllUsersChecksumReport2 = _classThis;
2210
+ })();
2211
+ let UserCredentialCCAllUsersChecksumGet = (() => {
2212
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.AllUsersChecksumGet), (0, import_CommandClassDecorators.expectedCCResponse)(UserCredentialCCAllUsersChecksumReport)];
2213
+ let _classDescriptor;
2214
+ let _classExtraInitializers = [];
2215
+ let _classThis;
2216
+ let _classSuper = UserCredentialCC;
2217
+ var UserCredentialCCAllUsersChecksumGet2 = class extends _classSuper {
2218
+ static {
2219
+ __name(this, "UserCredentialCCAllUsersChecksumGet");
2220
+ }
2221
+ static {
2222
+ _classThis = this;
2223
+ }
2224
+ static {
2225
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
2226
+ (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
2227
+ UserCredentialCCAllUsersChecksumGet2 = _classThis = _classDescriptor.value;
2228
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
2229
+ (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
2230
+ }
2231
+ };
2232
+ return UserCredentialCCAllUsersChecksumGet2 = _classThis;
2233
+ })();
2234
+ let UserCredentialCCUserChecksumReport = (() => {
2235
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.UserChecksumReport)];
2236
+ let _classDescriptor;
2237
+ let _classExtraInitializers = [];
2238
+ let _classThis;
2239
+ let _classSuper = UserCredentialCC;
2240
+ var UserCredentialCCUserChecksumReport2 = class extends _classSuper {
2241
+ static {
2242
+ __name(this, "UserCredentialCCUserChecksumReport");
2243
+ }
2244
+ static {
2245
+ _classThis = this;
2246
+ }
2247
+ static {
2248
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
2249
+ (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
2250
+ UserCredentialCCUserChecksumReport2 = _classThis = _classDescriptor.value;
2251
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
2252
+ (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
2253
+ }
2254
+ constructor(options) {
2255
+ super(options);
2256
+ this.userId = options.userId;
2257
+ this.checksum = options.checksum;
2258
+ }
2259
+ static from(raw, ctx) {
2260
+ (0, import_core.validatePayload)(raw.payload.length >= 4);
2261
+ const userId = raw.payload.readUInt16BE(0);
2262
+ const checksum = raw.payload.readUInt16BE(2);
2263
+ return new this({
2264
+ nodeId: ctx.sourceNodeId,
2265
+ userId,
2266
+ checksum
2267
+ });
2268
+ }
2269
+ userId;
2270
+ checksum;
2271
+ serialize(ctx) {
2272
+ this.payload = import_shared.Bytes.alloc(4);
2273
+ this.payload.writeUInt16BE(this.userId, 0);
2274
+ this.payload.writeUInt16BE(this.checksum, 2);
2275
+ return super.serialize(ctx);
2276
+ }
2277
+ toLogEntry(ctx) {
2278
+ return {
2279
+ ...super.toLogEntry(ctx),
2280
+ message: {
2281
+ "user ID": this.userId,
2282
+ checksum: this.checksum
2283
+ }
2284
+ };
2285
+ }
2286
+ };
2287
+ return UserCredentialCCUserChecksumReport2 = _classThis;
2288
+ })();
2289
+ function testResponseForUserCredentialUserChecksumGet(sent, received) {
2290
+ return received.userId === sent.userId;
2291
+ }
2292
+ __name(testResponseForUserCredentialUserChecksumGet, "testResponseForUserCredentialUserChecksumGet");
2293
+ let UserCredentialCCUserChecksumGet = (() => {
2294
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.UserChecksumGet), (0, import_CommandClassDecorators.expectedCCResponse)(UserCredentialCCUserChecksumReport, testResponseForUserCredentialUserChecksumGet)];
2295
+ let _classDescriptor;
2296
+ let _classExtraInitializers = [];
2297
+ let _classThis;
2298
+ let _classSuper = UserCredentialCC;
2299
+ var UserCredentialCCUserChecksumGet2 = class extends _classSuper {
2300
+ static {
2301
+ __name(this, "UserCredentialCCUserChecksumGet");
2302
+ }
2303
+ static {
2304
+ _classThis = this;
2305
+ }
2306
+ static {
2307
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
2308
+ (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
2309
+ UserCredentialCCUserChecksumGet2 = _classThis = _classDescriptor.value;
2310
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
2311
+ (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
2312
+ }
2313
+ constructor(options) {
2314
+ super(options);
2315
+ this.userId = options.userId;
2316
+ }
2317
+ userId;
2318
+ static from(raw, ctx) {
2319
+ (0, import_core.validatePayload)(raw.payload.length >= 2);
2320
+ const userId = raw.payload.readUInt16BE(0);
2321
+ return new this({
2322
+ nodeId: ctx.sourceNodeId,
2323
+ userId
2324
+ });
2325
+ }
2326
+ serialize(ctx) {
2327
+ this.payload = import_shared.Bytes.alloc(2);
2328
+ this.payload.writeUInt16BE(this.userId, 0);
2329
+ return super.serialize(ctx);
2330
+ }
2331
+ toLogEntry(ctx) {
2332
+ return {
2333
+ ...super.toLogEntry(ctx),
2334
+ message: {
2335
+ "user ID": this.userId
2336
+ }
2337
+ };
2338
+ }
2339
+ };
2340
+ return UserCredentialCCUserChecksumGet2 = _classThis;
2341
+ })();
2342
+ let UserCredentialCCCredentialChecksumReport = (() => {
2343
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.CredentialChecksumReport)];
2344
+ let _classDescriptor;
2345
+ let _classExtraInitializers = [];
2346
+ let _classThis;
2347
+ let _classSuper = UserCredentialCC;
2348
+ var UserCredentialCCCredentialChecksumReport2 = class extends _classSuper {
2349
+ static {
2350
+ __name(this, "UserCredentialCCCredentialChecksumReport");
2351
+ }
2352
+ static {
2353
+ _classThis = this;
2354
+ }
2355
+ static {
2356
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
2357
+ (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
2358
+ UserCredentialCCCredentialChecksumReport2 = _classThis = _classDescriptor.value;
2359
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
2360
+ (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
2361
+ }
2362
+ constructor(options) {
2363
+ super(options);
2364
+ this.credentialType = options.credentialType;
2365
+ this.checksum = options.checksum;
2366
+ }
2367
+ static from(raw, ctx) {
2368
+ (0, import_core.validatePayload)(raw.payload.length >= 3);
2369
+ const credentialType = raw.payload[0];
2370
+ const checksum = raw.payload.readUInt16BE(1);
2371
+ return new this({
2372
+ nodeId: ctx.sourceNodeId,
2373
+ credentialType,
2374
+ checksum
2375
+ });
2376
+ }
2377
+ credentialType;
2378
+ checksum;
2379
+ serialize(ctx) {
2380
+ this.payload = import_shared.Bytes.alloc(3);
2381
+ this.payload[0] = this.credentialType;
2382
+ this.payload.writeUInt16BE(this.checksum, 1);
2383
+ return super.serialize(ctx);
2384
+ }
2385
+ toLogEntry(ctx) {
2386
+ return {
2387
+ ...super.toLogEntry(ctx),
2388
+ message: {
2389
+ "credential type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialType, this.credentialType),
2390
+ checksum: this.checksum
2391
+ }
2392
+ };
2393
+ }
2394
+ };
2395
+ return UserCredentialCCCredentialChecksumReport2 = _classThis;
2396
+ })();
2397
+ function testResponseForUserCredentialCredentialChecksumGet(sent, received) {
2398
+ return received.credentialType === sent.credentialType;
2399
+ }
2400
+ __name(testResponseForUserCredentialCredentialChecksumGet, "testResponseForUserCredentialCredentialChecksumGet");
2401
+ let UserCredentialCCCredentialChecksumGet = (() => {
2402
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.CredentialChecksumGet), (0, import_CommandClassDecorators.expectedCCResponse)(UserCredentialCCCredentialChecksumReport, testResponseForUserCredentialCredentialChecksumGet)];
2403
+ let _classDescriptor;
2404
+ let _classExtraInitializers = [];
2405
+ let _classThis;
2406
+ let _classSuper = UserCredentialCC;
2407
+ var UserCredentialCCCredentialChecksumGet2 = class extends _classSuper {
2408
+ static {
2409
+ __name(this, "UserCredentialCCCredentialChecksumGet");
2410
+ }
2411
+ static {
2412
+ _classThis = this;
2413
+ }
2414
+ static {
2415
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
2416
+ (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
2417
+ UserCredentialCCCredentialChecksumGet2 = _classThis = _classDescriptor.value;
2418
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
2419
+ (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
2420
+ }
2421
+ constructor(options) {
2422
+ super(options);
2423
+ this.credentialType = options.credentialType;
2424
+ }
2425
+ credentialType;
2426
+ static from(raw, ctx) {
2427
+ (0, import_core.validatePayload)(raw.payload.length >= 1);
2428
+ const credentialType = raw.payload[0];
2429
+ return new this({
2430
+ nodeId: ctx.sourceNodeId,
2431
+ credentialType
2432
+ });
2433
+ }
2434
+ serialize(ctx) {
2435
+ this.payload = import_shared.Bytes.alloc(1);
2436
+ this.payload[0] = this.credentialType;
2437
+ return super.serialize(ctx);
2438
+ }
2439
+ toLogEntry(ctx) {
2440
+ return {
2441
+ ...super.toLogEntry(ctx),
2442
+ message: {
2443
+ "credential type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialType, this.credentialType)
2444
+ }
2445
+ };
2446
+ }
2447
+ };
2448
+ return UserCredentialCCCredentialChecksumGet2 = _classThis;
2449
+ })();
2450
+ let UserCredentialCCAdminPinCodeSet = (() => {
2451
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.AdminPinCodeSet), (0, import_CommandClassDecorators.useSupervision)()];
2452
+ let _classDescriptor;
2453
+ let _classExtraInitializers = [];
2454
+ let _classThis;
2455
+ let _classSuper = UserCredentialCC;
2456
+ var UserCredentialCCAdminPinCodeSet2 = class extends _classSuper {
2457
+ static {
2458
+ __name(this, "UserCredentialCCAdminPinCodeSet");
2459
+ }
2460
+ static {
2461
+ _classThis = this;
2462
+ }
2463
+ static {
2464
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
2465
+ (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
2466
+ UserCredentialCCAdminPinCodeSet2 = _classThis = _classDescriptor.value;
2467
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
2468
+ (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
2469
+ }
2470
+ constructor(options) {
2471
+ super(options);
2472
+ this.pinCode = options.pinCode;
2473
+ }
2474
+ pinCode;
2475
+ static from(raw, ctx) {
2476
+ (0, import_core.validatePayload)(raw.payload.length >= 1);
2477
+ const pinLength = raw.payload[0] & 15;
2478
+ (0, import_core.validatePayload)(raw.payload.length >= 1 + pinLength);
2479
+ const pinCode = raw.payload.subarray(1, 1 + pinLength).toString("ascii");
2480
+ return new this({
2481
+ nodeId: ctx.sourceNodeId,
2482
+ pinCode
2483
+ });
2484
+ }
2485
+ serialize(ctx) {
2486
+ const pinCode = this.pinCode.slice(0, 15);
2487
+ this.payload = import_shared.Bytes.concat([
2488
+ [pinCode.length & 15],
2489
+ import_shared.Bytes.from(pinCode, "ascii")
2490
+ ]);
2491
+ return super.serialize(ctx);
2492
+ }
2493
+ toLogEntry(ctx) {
2494
+ return {
2495
+ ...super.toLogEntry(ctx),
2496
+ message: {
2497
+ "PIN code": credentialToLogString(this.pinCode)
2498
+ }
2499
+ };
2500
+ }
2501
+ };
2502
+ return UserCredentialCCAdminPinCodeSet2 = _classThis;
2503
+ })();
2504
+ let UserCredentialCCAdminPinCodeReport = (() => {
2505
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.AdminPinCodeReport)];
2506
+ let _classDescriptor;
2507
+ let _classExtraInitializers = [];
2508
+ let _classThis;
2509
+ let _classSuper = UserCredentialCC;
2510
+ var UserCredentialCCAdminPinCodeReport2 = class extends _classSuper {
2511
+ static {
2512
+ __name(this, "UserCredentialCCAdminPinCodeReport");
2513
+ }
2514
+ static {
2515
+ _classThis = this;
2516
+ }
2517
+ static {
2518
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
2519
+ (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
2520
+ UserCredentialCCAdminPinCodeReport2 = _classThis = _classDescriptor.value;
2521
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
2522
+ (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
2523
+ }
2524
+ constructor(options) {
2525
+ super(options);
2526
+ this.operationResult = options.operationResult;
2527
+ this.pinCode = options.pinCode;
2528
+ }
2529
+ static from(raw, ctx) {
2530
+ (0, import_core.validatePayload)(raw.payload.length >= 1);
2531
+ const operationResult = raw.payload[0] >> 4 & 15;
2532
+ const pinLength = raw.payload[0] & 15;
2533
+ (0, import_core.validatePayload)(raw.payload.length >= 1 + pinLength);
2534
+ const pinCode = raw.payload.subarray(1, 1 + pinLength).toString("ascii");
2535
+ return new this({
2536
+ nodeId: ctx.sourceNodeId,
2537
+ operationResult,
2538
+ pinCode
2539
+ });
2540
+ }
2541
+ operationResult;
2542
+ pinCode;
2543
+ serialize(ctx) {
2544
+ const pinBuffer = import_shared.Bytes.from(this.pinCode, "ascii");
2545
+ this.payload = import_shared.Bytes.alloc(1 + pinBuffer.length);
2546
+ this.payload[0] = (this.operationResult & 15) << 4 | pinBuffer.length & 15;
2547
+ if (pinBuffer.length > 0) {
2548
+ this.payload.set(pinBuffer, 1);
2549
+ }
2550
+ return super.serialize(ctx);
2551
+ }
2552
+ persistValues(ctx) {
2553
+ if (!super.persistValues(ctx))
2554
+ return false;
2555
+ if (this.operationResult === import_Types.UserCredentialAdminCodeOperationResult.Modified || this.operationResult === import_Types.UserCredentialAdminCodeOperationResult.ResponseToGet) {
2556
+ this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.adminPinCode, this.pinCode);
2557
+ }
2558
+ return true;
2559
+ }
2560
+ toLogEntry(ctx) {
2561
+ return {
2562
+ ...super.toLogEntry(ctx),
2563
+ message: {
2564
+ "operation result": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialAdminCodeOperationResult, this.operationResult),
2565
+ "PIN code": credentialToLogString(this.pinCode)
2566
+ }
2567
+ };
2568
+ }
2569
+ };
2570
+ return UserCredentialCCAdminPinCodeReport2 = _classThis;
2571
+ })();
2572
+ function testResponseForUserCredentialAdminPinCodeGet(_sent, received) {
2573
+ return received.operationResult === import_Types.UserCredentialAdminCodeOperationResult.ResponseToGet;
2574
+ }
2575
+ __name(testResponseForUserCredentialAdminPinCodeGet, "testResponseForUserCredentialAdminPinCodeGet");
2576
+ let UserCredentialCCAdminPinCodeGet = (() => {
2577
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.AdminPinCodeGet), (0, import_CommandClassDecorators.expectedCCResponse)(UserCredentialCCAdminPinCodeReport, testResponseForUserCredentialAdminPinCodeGet)];
2578
+ let _classDescriptor;
2579
+ let _classExtraInitializers = [];
2580
+ let _classThis;
2581
+ let _classSuper = UserCredentialCC;
2582
+ var UserCredentialCCAdminPinCodeGet2 = class extends _classSuper {
2583
+ static {
2584
+ __name(this, "UserCredentialCCAdminPinCodeGet");
2585
+ }
2586
+ static {
2587
+ _classThis = this;
2588
+ }
2589
+ static {
2590
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
2591
+ (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
2592
+ UserCredentialCCAdminPinCodeGet2 = _classThis = _classDescriptor.value;
2593
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
2594
+ (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
2595
+ }
2596
+ };
2597
+ return UserCredentialCCAdminPinCodeGet2 = _classThis;
2598
+ })();
2599
+ let UserCredentialCCKeyLockerEntrySet = (() => {
2600
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.KeyLockerEntrySet), (0, import_CommandClassDecorators.useSupervision)()];
2601
+ let _classDescriptor;
2602
+ let _classExtraInitializers = [];
2603
+ let _classThis;
2604
+ let _classSuper = UserCredentialCC;
2605
+ var UserCredentialCCKeyLockerEntrySet2 = class extends _classSuper {
2606
+ static {
2607
+ __name(this, "UserCredentialCCKeyLockerEntrySet");
2608
+ }
2609
+ static {
2610
+ _classThis = this;
2611
+ }
2612
+ static {
2613
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
2614
+ (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
2615
+ UserCredentialCCKeyLockerEntrySet2 = _classThis = _classDescriptor.value;
2616
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
2617
+ (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
2618
+ }
2619
+ constructor(options) {
2620
+ super(options);
2621
+ this.entryType = options.entryType;
2622
+ this.entrySlot = options.entrySlot;
2623
+ this.operationType = options.operationType;
2624
+ if (options.operationType !== import_Types.UserCredentialOperationType.Delete) {
2625
+ this.entryData = options.entryData;
2626
+ }
2627
+ }
2628
+ entryType;
2629
+ entrySlot;
2630
+ operationType;
2631
+ entryData;
2632
+ static from(raw, ctx) {
2633
+ (0, import_core.validatePayload)(raw.payload.length >= 4);
2634
+ const entryType = raw.payload[0];
2635
+ const entrySlot = raw.payload.readUInt16BE(1);
2636
+ const operationType = raw.payload[3] & 3;
2637
+ if (operationType === import_Types.UserCredentialOperationType.Delete) {
2638
+ return new this({
2639
+ nodeId: ctx.sourceNodeId,
2640
+ entryType,
2641
+ entrySlot,
2642
+ operationType
2643
+ });
2644
+ }
2645
+ let entryData = new import_shared.Bytes();
2646
+ if (raw.payload.length >= 6) {
2647
+ const entryDataLength = raw.payload.readUInt16BE(4);
2648
+ (0, import_core.validatePayload)(raw.payload.length >= 6 + entryDataLength);
2649
+ entryData = import_shared.Bytes.from(raw.payload.subarray(6, 6 + entryDataLength));
2650
+ }
2651
+ return new this({
2652
+ nodeId: ctx.sourceNodeId,
2653
+ entryType,
2654
+ entrySlot,
2655
+ operationType,
2656
+ entryData
2657
+ });
2658
+ }
2659
+ serialize(ctx) {
2660
+ if (this.operationType === import_Types.UserCredentialOperationType.Delete) {
2661
+ this.payload = import_shared.Bytes.alloc(4);
2662
+ this.payload[0] = this.entryType;
2663
+ this.payload.writeUInt16BE(this.entrySlot, 1);
2664
+ this.payload[3] = this.operationType & 3;
2665
+ return super.serialize(ctx);
2666
+ }
2667
+ if (this.entryData == void 0) {
2668
+ throw new import_core.ZWaveError(`${this.constructor.name}: entry data must be set for Add/Modify operations`, import_core.ZWaveErrorCodes.Argument_Invalid);
2669
+ }
2670
+ this.payload = import_shared.Bytes.alloc(6 + this.entryData.length);
2671
+ this.payload[0] = this.entryType;
2672
+ this.payload.writeUInt16BE(this.entrySlot, 1);
2673
+ this.payload[3] = this.operationType & 3;
2674
+ this.payload.writeUInt16BE(this.entryData.length, 4);
2675
+ if (this.entryData.length > 0) {
2676
+ this.payload.set(this.entryData, 6);
2677
+ }
2678
+ return super.serialize(ctx);
2679
+ }
2680
+ toLogEntry(ctx) {
2681
+ const message = {
2682
+ "entry type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialKeyLockerEntryType, this.entryType),
2683
+ "entry slot": this.entrySlot,
2684
+ "operation type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialOperationType, this.operationType)
2685
+ };
2686
+ if (this.entryData != void 0) {
2687
+ message["entry data length"] = this.entryData.length;
2688
+ }
2689
+ return { ...super.toLogEntry(ctx), message };
2690
+ }
2691
+ };
2692
+ return UserCredentialCCKeyLockerEntrySet2 = _classThis;
2693
+ })();
2694
+ let UserCredentialCCKeyLockerEntryReport = (() => {
2695
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.KeyLockerEntryReport)];
2696
+ let _classDescriptor;
2697
+ let _classExtraInitializers = [];
2698
+ let _classThis;
2699
+ let _classSuper = UserCredentialCC;
2700
+ var UserCredentialCCKeyLockerEntryReport2 = class extends _classSuper {
2701
+ static {
2702
+ __name(this, "UserCredentialCCKeyLockerEntryReport");
2703
+ }
2704
+ static {
2705
+ _classThis = this;
2706
+ }
2707
+ static {
2708
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
2709
+ (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
2710
+ UserCredentialCCKeyLockerEntryReport2 = _classThis = _classDescriptor.value;
2711
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
2712
+ (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
2713
+ }
2714
+ constructor(options) {
2715
+ super(options);
2716
+ this.occupied = options.occupied;
2717
+ this.entryType = options.entryType;
2718
+ this.entrySlot = options.entrySlot;
2719
+ }
2720
+ static from(raw, ctx) {
2721
+ (0, import_core.validatePayload)(raw.payload.length >= 4);
2722
+ const occupied = !!(raw.payload[0] & 1);
2723
+ const entryType = raw.payload[1];
2724
+ const entrySlot = raw.payload.readUInt16BE(2);
2725
+ return new this({
2726
+ nodeId: ctx.sourceNodeId,
2727
+ occupied,
2728
+ entryType,
2729
+ entrySlot
2730
+ });
2731
+ }
2732
+ occupied;
2733
+ entryType;
2734
+ entrySlot;
2735
+ serialize(ctx) {
2736
+ this.payload = import_shared.Bytes.alloc(4);
2737
+ this.payload[0] = this.occupied ? 1 : 0;
2738
+ this.payload[1] = this.entryType;
2739
+ this.payload.writeUInt16BE(this.entrySlot, 2);
2740
+ return super.serialize(ctx);
2741
+ }
2742
+ persistValues(ctx) {
2743
+ if (!super.persistValues(ctx))
2744
+ return false;
2745
+ this.setValue(ctx, import_CCValues_generated.UserCredentialCCValues.keyLockerEntry(this.entryType, this.entrySlot), this.occupied);
2746
+ return true;
2747
+ }
2748
+ toLogEntry(ctx) {
2749
+ return {
2750
+ ...super.toLogEntry(ctx),
2751
+ message: {
2752
+ occupied: this.occupied,
2753
+ "entry type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialKeyLockerEntryType, this.entryType),
2754
+ "entry slot": this.entrySlot
2755
+ }
2756
+ };
2757
+ }
2758
+ };
2759
+ return UserCredentialCCKeyLockerEntryReport2 = _classThis;
2760
+ })();
2761
+ function testResponseForUserCredentialKeyLockerEntryGet(sent, received) {
2762
+ return received.entryType === sent.entryType && received.entrySlot === sent.entrySlot;
2763
+ }
2764
+ __name(testResponseForUserCredentialKeyLockerEntryGet, "testResponseForUserCredentialKeyLockerEntryGet");
2765
+ let UserCredentialCCKeyLockerEntryGet = (() => {
2766
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.UserCredentialCommand.KeyLockerEntryGet), (0, import_CommandClassDecorators.expectedCCResponse)(UserCredentialCCKeyLockerEntryReport, testResponseForUserCredentialKeyLockerEntryGet)];
2767
+ let _classDescriptor;
2768
+ let _classExtraInitializers = [];
2769
+ let _classThis;
2770
+ let _classSuper = UserCredentialCC;
2771
+ var UserCredentialCCKeyLockerEntryGet2 = class extends _classSuper {
2772
+ static {
2773
+ __name(this, "UserCredentialCCKeyLockerEntryGet");
2774
+ }
2775
+ static {
2776
+ _classThis = this;
2777
+ }
2778
+ static {
2779
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
2780
+ (0, import_tslib.__esDecorate)(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
2781
+ UserCredentialCCKeyLockerEntryGet2 = _classThis = _classDescriptor.value;
2782
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
2783
+ (0, import_tslib.__runInitializers)(_classThis, _classExtraInitializers);
2784
+ }
2785
+ constructor(options) {
2786
+ super(options);
2787
+ this.entryType = options.entryType;
2788
+ this.entrySlot = options.entrySlot;
2789
+ }
2790
+ entryType;
2791
+ entrySlot;
2792
+ static from(raw, ctx) {
2793
+ (0, import_core.validatePayload)(raw.payload.length >= 3);
2794
+ const entryType = raw.payload[0];
2795
+ const entrySlot = raw.payload.readUInt16BE(1);
2796
+ return new this({
2797
+ nodeId: ctx.sourceNodeId,
2798
+ entryType,
2799
+ entrySlot
2800
+ });
2801
+ }
2802
+ serialize(ctx) {
2803
+ this.payload = import_shared.Bytes.alloc(3);
2804
+ this.payload[0] = this.entryType;
2805
+ this.payload.writeUInt16BE(this.entrySlot, 1);
2806
+ return super.serialize(ctx);
2807
+ }
2808
+ toLogEntry(ctx) {
2809
+ return {
2810
+ ...super.toLogEntry(ctx),
2811
+ message: {
2812
+ "entry type": (0, import_shared.getEnumMemberName)(import_Types.UserCredentialKeyLockerEntryType, this.entryType),
2813
+ "entry slot": this.entrySlot
2814
+ }
2815
+ };
2816
+ }
2817
+ };
2818
+ return UserCredentialCCKeyLockerEntryGet2 = _classThis;
2819
+ })();
2820
+ // Annotate the CommonJS export names for ESM import in node:
2821
+ 0 && (module.exports = {
2822
+ UserCredentialCC,
2823
+ UserCredentialCCAPI,
2824
+ UserCredentialCCAdminPinCodeGet,
2825
+ UserCredentialCCAdminPinCodeReport,
2826
+ UserCredentialCCAdminPinCodeSet,
2827
+ UserCredentialCCAllUsersChecksumGet,
2828
+ UserCredentialCCAllUsersChecksumReport,
2829
+ UserCredentialCCCredentialCapabilitiesGet,
2830
+ UserCredentialCCCredentialCapabilitiesReport,
2831
+ UserCredentialCCCredentialChecksumGet,
2832
+ UserCredentialCCCredentialChecksumReport,
2833
+ UserCredentialCCCredentialGet,
2834
+ UserCredentialCCCredentialLearnCancel,
2835
+ UserCredentialCCCredentialLearnReport,
2836
+ UserCredentialCCCredentialLearnStart,
2837
+ UserCredentialCCCredentialReport,
2838
+ UserCredentialCCCredentialSet,
2839
+ UserCredentialCCKeyLockerCapabilitiesGet,
2840
+ UserCredentialCCKeyLockerCapabilitiesReport,
2841
+ UserCredentialCCKeyLockerEntryGet,
2842
+ UserCredentialCCKeyLockerEntryReport,
2843
+ UserCredentialCCKeyLockerEntrySet,
2844
+ UserCredentialCCUserCapabilitiesGet,
2845
+ UserCredentialCCUserCapabilitiesReport,
2846
+ UserCredentialCCUserChecksumGet,
2847
+ UserCredentialCCUserChecksumReport,
2848
+ UserCredentialCCUserCredentialAssociationReport,
2849
+ UserCredentialCCUserCredentialAssociationSet,
2850
+ UserCredentialCCUserGet,
2851
+ UserCredentialCCUserReport,
2852
+ UserCredentialCCUserSet,
2853
+ UserCredentialCCValues
2854
+ });
2855
+ //# sourceMappingURL=UserCredentialCC.js.map