@zwave-js/nvmedit 15.1.0 → 15.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. package/build/cjs/convert.d.ts +3 -3
  2. package/build/cjs/convert.js +45 -45
  3. package/build/cjs/convert.js.map +3 -3
  4. package/build/cjs/lib/NVM3.js +17 -17
  5. package/build/cjs/lib/NVM3.js.map +3 -3
  6. package/build/cjs/lib/NVM500.js +54 -54
  7. package/build/cjs/lib/NVM500.js.map +3 -3
  8. package/build/cjs/lib/common/definitions.d.ts +5 -5
  9. package/build/cjs/lib/common/definitions.js.map +1 -1
  10. package/build/cjs/lib/common/routeCache.d.ts +2 -2
  11. package/build/cjs/lib/common/routeCache.js +10 -10
  12. package/build/cjs/lib/common/routeCache.js.map +3 -3
  13. package/build/cjs/lib/common/sucUpdateEntry.d.ts +1 -1
  14. package/build/cjs/lib/common/sucUpdateEntry.js +4 -4
  15. package/build/cjs/lib/common/sucUpdateEntry.js.map +1 -1
  16. package/build/cjs/lib/common/utils.js +6 -6
  17. package/build/cjs/lib/common/utils.js.map +2 -2
  18. package/build/cjs/lib/io/BufferedNVMReader.d.ts +1 -1
  19. package/build/cjs/lib/io/BufferedNVMReader.js +2 -2
  20. package/build/cjs/lib/io/BufferedNVMReader.js.map +2 -2
  21. package/build/cjs/lib/nvm3/adapter.d.ts +2 -2
  22. package/build/cjs/lib/nvm3/adapter.js +6 -6
  23. package/build/cjs/lib/nvm3/adapter.js.map +3 -3
  24. package/build/cjs/lib/nvm3/files/ApplicationCCsFile.d.ts +2 -2
  25. package/build/cjs/lib/nvm3/files/ApplicationCCsFile.js +6 -6
  26. package/build/cjs/lib/nvm3/files/ApplicationCCsFile.js.map +3 -3
  27. package/build/cjs/lib/nvm3/files/ApplicationDataFile.d.ts +1 -1
  28. package/build/cjs/lib/nvm3/files/ApplicationDataFile.js.map +1 -1
  29. package/build/cjs/lib/nvm3/files/ApplicationNameFile.d.ts +1 -1
  30. package/build/cjs/lib/nvm3/files/ApplicationNameFile.js.map +1 -1
  31. package/build/cjs/lib/nvm3/files/ApplicationRFConfigFile.d.ts +2 -2
  32. package/build/cjs/lib/nvm3/files/ApplicationRFConfigFile.js +9 -9
  33. package/build/cjs/lib/nvm3/files/ApplicationRFConfigFile.js.map +3 -3
  34. package/build/cjs/lib/nvm3/files/ApplicationTypeFile.d.ts +1 -1
  35. package/build/cjs/lib/nvm3/files/ApplicationTypeFile.js +2 -2
  36. package/build/cjs/lib/nvm3/files/ApplicationTypeFile.js.map +2 -2
  37. package/build/cjs/lib/nvm3/files/ControllerInfoFile.js +3 -3
  38. package/build/cjs/lib/nvm3/files/ControllerInfoFile.js.map +2 -2
  39. package/build/cjs/lib/nvm3/files/NVMFile.js +4 -4
  40. package/build/cjs/lib/nvm3/files/NVMFile.js.map +2 -2
  41. package/build/cjs/lib/nvm3/files/NodeInfoFiles.d.ts +2 -2
  42. package/build/cjs/lib/nvm3/files/NodeInfoFiles.js +18 -18
  43. package/build/cjs/lib/nvm3/files/NodeInfoFiles.js.map +3 -3
  44. package/build/cjs/lib/nvm3/files/ProtocolNodeMaskFiles.d.ts +1 -1
  45. package/build/cjs/lib/nvm3/files/ProtocolNodeMaskFiles.js +5 -5
  46. package/build/cjs/lib/nvm3/files/ProtocolNodeMaskFiles.js.map +1 -1
  47. package/build/cjs/lib/nvm3/files/RouteCacheFiles.d.ts +1 -1
  48. package/build/cjs/lib/nvm3/files/RouteCacheFiles.js +11 -11
  49. package/build/cjs/lib/nvm3/files/RouteCacheFiles.js.map +3 -3
  50. package/build/cjs/lib/nvm3/files/SUCUpdateEntriesFile.d.ts +1 -1
  51. package/build/cjs/lib/nvm3/files/SUCUpdateEntriesFile.js +3 -3
  52. package/build/cjs/lib/nvm3/files/SUCUpdateEntriesFile.js.map +2 -2
  53. package/build/cjs/lib/nvm3/page.d.ts +1 -1
  54. package/build/cjs/lib/nvm3/page.js.map +1 -1
  55. package/build/cjs/lib/nvm3/utils.d.ts +1 -1
  56. package/build/cjs/lib/nvm3/utils.js +3 -3
  57. package/build/cjs/lib/nvm3/utils.js.map +1 -1
  58. package/build/cjs/lib/nvm500/EntryParsers.d.ts +2 -2
  59. package/build/cjs/lib/nvm500/EntryParsers.js +10 -10
  60. package/build/cjs/lib/nvm500/EntryParsers.js.map +3 -3
  61. package/build/cjs/lib/nvm500/adapter.d.ts +2 -2
  62. package/build/cjs/lib/nvm500/adapter.js.map +1 -1
  63. package/build/cjs/lib/nvm500/impls/Bridge_6_6x.d.ts +1 -1
  64. package/build/cjs/lib/nvm500/impls/Bridge_6_6x.js +7 -7
  65. package/build/cjs/lib/nvm500/impls/Bridge_6_6x.js.map +2 -2
  66. package/build/cjs/lib/nvm500/impls/Bridge_6_7x.d.ts +1 -1
  67. package/build/cjs/lib/nvm500/impls/Bridge_6_7x.js +7 -7
  68. package/build/cjs/lib/nvm500/impls/Bridge_6_7x.js.map +2 -2
  69. package/build/cjs/lib/nvm500/impls/Bridge_6_8x.d.ts +1 -1
  70. package/build/cjs/lib/nvm500/impls/Bridge_6_8x.js +7 -7
  71. package/build/cjs/lib/nvm500/impls/Bridge_6_8x.js.map +2 -2
  72. package/build/cjs/lib/nvm500/impls/Static_6_6x.d.ts +1 -1
  73. package/build/cjs/lib/nvm500/impls/Static_6_6x.js +7 -7
  74. package/build/cjs/lib/nvm500/impls/Static_6_6x.js.map +2 -2
  75. package/build/cjs/lib/nvm500/impls/Static_6_7x.d.ts +1 -1
  76. package/build/cjs/lib/nvm500/impls/Static_6_7x.js +7 -7
  77. package/build/cjs/lib/nvm500/impls/Static_6_7x.js.map +2 -2
  78. package/build/cjs/lib/nvm500/impls/Static_6_8x.d.ts +1 -1
  79. package/build/cjs/lib/nvm500/impls/Static_6_8x.js +7 -7
  80. package/build/cjs/lib/nvm500/impls/Static_6_8x.js.map +2 -2
  81. package/build/cjs/lib/nvm500/shared.d.ts +2 -2
  82. package/build/cjs/lib/nvm500/shared.js +2 -2
  83. package/build/cjs/lib/nvm500/shared.js.map +1 -1
  84. package/build/cjs/nvm500/NVMParser.d.ts +5 -5
  85. package/build/esm/convert.d.ts +3 -3
  86. package/build/esm/convert.d.ts.map +1 -1
  87. package/build/esm/convert.js +2 -2
  88. package/build/esm/convert.js.map +1 -1
  89. package/build/esm/lib/NVM3.js +2 -2
  90. package/build/esm/lib/NVM3.js.map +1 -1
  91. package/build/esm/lib/NVM500.js +1 -1
  92. package/build/esm/lib/NVM500.js.map +1 -1
  93. package/build/esm/lib/common/definitions.d.ts +5 -5
  94. package/build/esm/lib/common/definitions.d.ts.map +1 -1
  95. package/build/esm/lib/common/routeCache.d.ts +2 -2
  96. package/build/esm/lib/common/routeCache.d.ts.map +1 -1
  97. package/build/esm/lib/common/routeCache.js +2 -2
  98. package/build/esm/lib/common/routeCache.js.map +1 -1
  99. package/build/esm/lib/common/sucUpdateEntry.d.ts +1 -1
  100. package/build/esm/lib/common/sucUpdateEntry.d.ts.map +1 -1
  101. package/build/esm/lib/common/sucUpdateEntry.js +1 -1
  102. package/build/esm/lib/common/sucUpdateEntry.js.map +1 -1
  103. package/build/esm/lib/common/utils.js +1 -1
  104. package/build/esm/lib/common/utils.js.map +1 -1
  105. package/build/esm/lib/io/BufferedNVMReader.d.ts +1 -1
  106. package/build/esm/lib/io/BufferedNVMReader.d.ts.map +1 -1
  107. package/build/esm/lib/io/BufferedNVMReader.js +1 -1
  108. package/build/esm/lib/io/BufferedNVMReader.js.map +1 -1
  109. package/build/esm/lib/nvm3/adapter.d.ts +2 -2
  110. package/build/esm/lib/nvm3/adapter.d.ts.map +1 -1
  111. package/build/esm/lib/nvm3/adapter.js +2 -2
  112. package/build/esm/lib/nvm3/adapter.js.map +1 -1
  113. package/build/esm/lib/nvm3/files/ApplicationCCsFile.d.ts +2 -2
  114. package/build/esm/lib/nvm3/files/ApplicationCCsFile.d.ts.map +1 -1
  115. package/build/esm/lib/nvm3/files/ApplicationCCsFile.js +2 -2
  116. package/build/esm/lib/nvm3/files/ApplicationCCsFile.js.map +1 -1
  117. package/build/esm/lib/nvm3/files/ApplicationDataFile.d.ts +1 -1
  118. package/build/esm/lib/nvm3/files/ApplicationDataFile.d.ts.map +1 -1
  119. package/build/esm/lib/nvm3/files/ApplicationNameFile.d.ts +1 -1
  120. package/build/esm/lib/nvm3/files/ApplicationNameFile.d.ts.map +1 -1
  121. package/build/esm/lib/nvm3/files/ApplicationRFConfigFile.d.ts +2 -2
  122. package/build/esm/lib/nvm3/files/ApplicationRFConfigFile.d.ts.map +1 -1
  123. package/build/esm/lib/nvm3/files/ApplicationRFConfigFile.js +2 -2
  124. package/build/esm/lib/nvm3/files/ApplicationRFConfigFile.js.map +1 -1
  125. package/build/esm/lib/nvm3/files/ApplicationTypeFile.d.ts +1 -1
  126. package/build/esm/lib/nvm3/files/ApplicationTypeFile.d.ts.map +1 -1
  127. package/build/esm/lib/nvm3/files/ApplicationTypeFile.js +1 -1
  128. package/build/esm/lib/nvm3/files/ApplicationTypeFile.js.map +1 -1
  129. package/build/esm/lib/nvm3/files/ControllerInfoFile.d.ts.map +1 -1
  130. package/build/esm/lib/nvm3/files/ControllerInfoFile.js +1 -1
  131. package/build/esm/lib/nvm3/files/ControllerInfoFile.js.map +1 -1
  132. package/build/esm/lib/nvm3/files/NVMFile.js +1 -1
  133. package/build/esm/lib/nvm3/files/NVMFile.js.map +1 -1
  134. package/build/esm/lib/nvm3/files/NodeInfoFiles.d.ts +2 -2
  135. package/build/esm/lib/nvm3/files/NodeInfoFiles.d.ts.map +1 -1
  136. package/build/esm/lib/nvm3/files/NodeInfoFiles.js +2 -2
  137. package/build/esm/lib/nvm3/files/NodeInfoFiles.js.map +1 -1
  138. package/build/esm/lib/nvm3/files/ProtocolNodeMaskFiles.d.ts +1 -1
  139. package/build/esm/lib/nvm3/files/ProtocolNodeMaskFiles.d.ts.map +1 -1
  140. package/build/esm/lib/nvm3/files/ProtocolNodeMaskFiles.js +1 -1
  141. package/build/esm/lib/nvm3/files/ProtocolNodeMaskFiles.js.map +1 -1
  142. package/build/esm/lib/nvm3/files/RouteCacheFiles.d.ts +1 -1
  143. package/build/esm/lib/nvm3/files/RouteCacheFiles.d.ts.map +1 -1
  144. package/build/esm/lib/nvm3/files/RouteCacheFiles.js +2 -2
  145. package/build/esm/lib/nvm3/files/RouteCacheFiles.js.map +1 -1
  146. package/build/esm/lib/nvm3/files/SUCUpdateEntriesFile.d.ts +1 -1
  147. package/build/esm/lib/nvm3/files/SUCUpdateEntriesFile.d.ts.map +1 -1
  148. package/build/esm/lib/nvm3/files/SUCUpdateEntriesFile.js +1 -1
  149. package/build/esm/lib/nvm3/files/SUCUpdateEntriesFile.js.map +1 -1
  150. package/build/esm/lib/nvm3/page.d.ts +1 -1
  151. package/build/esm/lib/nvm3/page.d.ts.map +1 -1
  152. package/build/esm/lib/nvm3/utils.d.ts +1 -1
  153. package/build/esm/lib/nvm3/utils.d.ts.map +1 -1
  154. package/build/esm/lib/nvm3/utils.js +1 -1
  155. package/build/esm/lib/nvm3/utils.js.map +1 -1
  156. package/build/esm/lib/nvm500/EntryParsers.d.ts +2 -2
  157. package/build/esm/lib/nvm500/EntryParsers.d.ts.map +1 -1
  158. package/build/esm/lib/nvm500/EntryParsers.js +2 -2
  159. package/build/esm/lib/nvm500/EntryParsers.js.map +1 -1
  160. package/build/esm/lib/nvm500/adapter.d.ts +2 -2
  161. package/build/esm/lib/nvm500/adapter.d.ts.map +1 -1
  162. package/build/esm/lib/nvm500/impls/Bridge_6_6x.d.ts +1 -1
  163. package/build/esm/lib/nvm500/impls/Bridge_6_6x.d.ts.map +1 -1
  164. package/build/esm/lib/nvm500/impls/Bridge_6_6x.js +1 -1
  165. package/build/esm/lib/nvm500/impls/Bridge_6_6x.js.map +1 -1
  166. package/build/esm/lib/nvm500/impls/Bridge_6_7x.d.ts +1 -1
  167. package/build/esm/lib/nvm500/impls/Bridge_6_7x.d.ts.map +1 -1
  168. package/build/esm/lib/nvm500/impls/Bridge_6_7x.js +1 -1
  169. package/build/esm/lib/nvm500/impls/Bridge_6_7x.js.map +1 -1
  170. package/build/esm/lib/nvm500/impls/Bridge_6_8x.d.ts +1 -1
  171. package/build/esm/lib/nvm500/impls/Bridge_6_8x.d.ts.map +1 -1
  172. package/build/esm/lib/nvm500/impls/Bridge_6_8x.js +1 -1
  173. package/build/esm/lib/nvm500/impls/Bridge_6_8x.js.map +1 -1
  174. package/build/esm/lib/nvm500/impls/Static_6_6x.d.ts +1 -1
  175. package/build/esm/lib/nvm500/impls/Static_6_6x.d.ts.map +1 -1
  176. package/build/esm/lib/nvm500/impls/Static_6_6x.js +1 -1
  177. package/build/esm/lib/nvm500/impls/Static_6_6x.js.map +1 -1
  178. package/build/esm/lib/nvm500/impls/Static_6_7x.d.ts +1 -1
  179. package/build/esm/lib/nvm500/impls/Static_6_7x.d.ts.map +1 -1
  180. package/build/esm/lib/nvm500/impls/Static_6_7x.js +1 -1
  181. package/build/esm/lib/nvm500/impls/Static_6_7x.js.map +1 -1
  182. package/build/esm/lib/nvm500/impls/Static_6_8x.d.ts +1 -1
  183. package/build/esm/lib/nvm500/impls/Static_6_8x.d.ts.map +1 -1
  184. package/build/esm/lib/nvm500/impls/Static_6_8x.js +1 -1
  185. package/build/esm/lib/nvm500/impls/Static_6_8x.js.map +1 -1
  186. package/build/esm/lib/nvm500/shared.d.ts +2 -2
  187. package/build/esm/lib/nvm500/shared.d.ts.map +1 -1
  188. package/build/esm/lib/nvm500/shared.js +1 -1
  189. package/build/esm/lib/nvm500/shared.js.map +1 -1
  190. package/build/esm/nvm500/NVMParser.d.ts +5 -5
  191. package/build/esm/nvm500/NVMParser.d.ts.map +1 -1
  192. package/package.json +3 -3
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/lib/nvm3/files/ControllerInfoFile.ts"],
4
- "sourcesContent": ["import {\n\tZWaveError,\n\tZWaveErrorCodes,\n\tstripUndefined,\n} from \"@zwave-js/core/safe\";\nimport { Bytes, buffer2hex } from \"@zwave-js/shared\";\nimport type { NVM3Object } from \"../object.js\";\nimport {\n\tNVMFile,\n\ttype NVMFileCreationOptions,\n\ttype NVMFileDeserializationOptions,\n\tgotDeserializationOptions,\n\tnvmFileID,\n\tnvmSection,\n} from \"./NVMFile.js\";\n\nexport type ControllerInfoFileOptions =\n\t& NVMFileCreationOptions\n\t& {\n\t\thomeId: Uint8Array;\n\t\tnodeId: number;\n\t\tlastNodeId: number;\n\t\tstaticControllerNodeId: number;\n\t\tsucLastIndex: number;\n\t\tcontrollerConfiguration: number;\n\t\tmaxNodeId: number;\n\t\treservedId: number;\n\t\tsystemState: number;\n\t}\n\t& (\n\t\t| {\n\t\t\tsucAwarenessPushNeeded: number;\n\t\t}\n\t\t| {\n\t\t\tlastNodeIdLR: number;\n\t\t\tmaxNodeIdLR: number;\n\t\t\treservedIdLR: number;\n\t\t\tprimaryLongRangeChannelId: number;\n\t\t\tdcdcConfig: number;\n\t\t}\n\t);\n\nexport const ControllerInfoFileID = 0x50004;\n\n@nvmFileID(ControllerInfoFileID)\n@nvmSection(\"protocol\")\nexport class ControllerInfoFile extends NVMFile {\n\tpublic constructor(\n\t\toptions: NVMFileDeserializationOptions | ControllerInfoFileOptions,\n\t) {\n\t\tsuper(options);\n\t\tif (gotDeserializationOptions(options)) {\n\t\t\tthis.homeId = this.payload.subarray(0, 4);\n\t\t\tif (this.payload.length === 13) {\n\t\t\t\tthis.nodeId = this.payload[4];\n\t\t\t\tthis.lastNodeId = this.payload[5];\n\t\t\t\tthis.staticControllerNodeId = this.payload[6];\n\t\t\t\tthis.sucLastIndex = this.payload[7];\n\t\t\t\tthis.controllerConfiguration = this.payload[8];\n\t\t\t\tthis.sucAwarenessPushNeeded = this.payload[9];\n\t\t\t\tthis.maxNodeId = this.payload[10];\n\t\t\t\tthis.reservedId = this.payload[11];\n\t\t\t\tthis.systemState = this.payload[12];\n\t\t\t} else if (this.payload.length === 22) {\n\t\t\t\tthis.nodeId = this.payload.readUInt16LE(4);\n\t\t\t\tthis.staticControllerNodeId = this.payload.readUInt16LE(6);\n\t\t\t\tthis.lastNodeIdLR = this.payload.readUInt16LE(8);\n\t\t\t\tthis.lastNodeId = this.payload[10];\n\t\t\t\tthis.sucLastIndex = this.payload[11];\n\t\t\t\tthis.maxNodeIdLR = this.payload.readUInt16LE(12);\n\t\t\t\tthis.maxNodeId = this.payload[14];\n\t\t\t\tthis.controllerConfiguration = this.payload[15];\n\t\t\t\tthis.reservedIdLR = this.payload.readUInt16LE(16);\n\t\t\t\tthis.reservedId = this.payload[18];\n\t\t\t\tthis.systemState = this.payload[19];\n\t\t\t\tthis.primaryLongRangeChannelId = this.payload[20];\n\t\t\t\tthis.dcdcConfig = this.payload[21];\n\t\t\t} else {\n\t\t\t\tthrow new ZWaveError(\n\t\t\t\t\t`Unsupported payload length`,\n\t\t\t\t\tZWaveErrorCodes.NVM_InvalidFormat,\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\tthis.homeId = Bytes.view(options.homeId);\n\t\t\tthis.nodeId = options.nodeId;\n\t\t\tthis.lastNodeId = options.lastNodeId;\n\t\t\tthis.staticControllerNodeId = options.staticControllerNodeId;\n\t\t\tthis.sucLastIndex = options.sucLastIndex;\n\t\t\tthis.controllerConfiguration = options.controllerConfiguration;\n\t\t\tthis.maxNodeId = options.maxNodeId;\n\t\t\tthis.reservedId = options.reservedId;\n\t\t\tthis.systemState = options.systemState;\n\t\t\tif (\"lastNodeIdLR\" in options) {\n\t\t\t\tthis.lastNodeIdLR = options.lastNodeIdLR;\n\t\t\t\tthis.maxNodeIdLR = options.maxNodeIdLR;\n\t\t\t\tthis.reservedIdLR = options.reservedIdLR;\n\t\t\t\tthis.primaryLongRangeChannelId =\n\t\t\t\t\toptions.primaryLongRangeChannelId;\n\t\t\t\tthis.dcdcConfig = options.dcdcConfig;\n\t\t\t} else {\n\t\t\t\tthis.sucAwarenessPushNeeded = options.sucAwarenessPushNeeded;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic homeId: Uint8Array;\n\tpublic nodeId: number;\n\tpublic lastNodeId: number;\n\tpublic staticControllerNodeId: number;\n\tpublic sucLastIndex: number;\n\tpublic controllerConfiguration: number; // TODO: Figure out what this is\n\tpublic sucAwarenessPushNeeded?: number;\n\tpublic maxNodeId: number;\n\tpublic reservedId: number;\n\tpublic systemState: number;\n\tpublic lastNodeIdLR?: number;\n\tpublic maxNodeIdLR?: number;\n\tpublic reservedIdLR?: number;\n\tpublic primaryLongRangeChannelId?: number;\n\tpublic dcdcConfig?: number;\n\n\tpublic serialize(): NVM3Object & { data: Bytes } {\n\t\tif (this.lastNodeIdLR != undefined) {\n\t\t\tthis.payload = new Bytes(22);\n\t\t\tthis.payload.set(this.homeId, 0);\n\t\t\tthis.payload.writeUInt16LE(this.nodeId, 4);\n\t\t\tthis.payload.writeUInt16LE(this.staticControllerNodeId, 6);\n\t\t\tthis.payload.writeUInt16LE(this.lastNodeIdLR, 8);\n\t\t\tthis.payload[10] = this.lastNodeId;\n\t\t\tthis.payload[11] = this.sucLastIndex;\n\t\t\tthis.payload.writeUInt16LE(this.maxNodeIdLR!, 12);\n\t\t\tthis.payload[14] = this.maxNodeId;\n\t\t\tthis.payload[15] = this.controllerConfiguration;\n\t\t\tthis.payload.writeUInt16LE(this.reservedIdLR!, 16);\n\t\t\tthis.payload[18] = this.reservedId;\n\t\t\tthis.payload[19] = this.systemState;\n\t\t\tthis.payload[20] = this.primaryLongRangeChannelId!;\n\t\t\tthis.payload[21] = this.dcdcConfig!;\n\t\t} else {\n\t\t\t// V0\n\t\t\tthis.payload = Bytes.concat([\n\t\t\t\tthis.homeId,\n\t\t\t\tBytes.from([\n\t\t\t\t\tthis.nodeId,\n\t\t\t\t\tthis.lastNodeId,\n\t\t\t\t\tthis.staticControllerNodeId,\n\t\t\t\t\tthis.sucLastIndex,\n\t\t\t\t\tthis.controllerConfiguration,\n\t\t\t\t\tthis.sucAwarenessPushNeeded ?? 0,\n\t\t\t\t\tthis.maxNodeId,\n\t\t\t\t\tthis.reservedId,\n\t\t\t\t\tthis.systemState,\n\t\t\t\t]),\n\t\t\t]);\n\t\t}\n\t\treturn super.serialize();\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic toJSON() {\n\t\treturn stripUndefined({\n\t\t\t...super.toJSON(),\n\t\t\thomeId: buffer2hex(this.homeId),\n\t\t\tnodeId: this.nodeId,\n\t\t\tlastNodeId: this.lastNodeId,\n\t\t\tstaticControllerNodeId: this.staticControllerNodeId,\n\t\t\tsucLastIndex: this.sucLastIndex,\n\t\t\tcontrollerConfiguration: this.controllerConfiguration,\n\t\t\tsucAwarenessPushNeeded: this.sucAwarenessPushNeeded,\n\t\t\tmaxNodeId: this.maxNodeId,\n\t\t\treservedId: this.reservedId,\n\t\t\tsystemState: this.systemState,\n\t\t\tlastNodeIdLR: this.lastNodeIdLR,\n\t\t\tmaxNodeIdLR: this.maxNodeIdLR,\n\t\t\treservedIdLR: this.reservedIdLR,\n\t\t\tprimaryLongRangeChannelId: this.primaryLongRangeChannelId,\n\t\t\tdcdcConfig: this.dcdcConfig,\n\t\t});\n\t}\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kBAIO;AACP,oBAAkC;AAElC,qBAOO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAM,uBAAuB;IAIvB,sBAAkB,MAAA;8BAF9B,0BAAU,oBAAoB,OAC9B,2BAAW,UAAU,CAAC;;;;oBACiB;0CAAA,YAAO;WAAA;;;;;;;;AAA/C,mBAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,wBAAA,YAAA,uBAAA;;IACZ,YACC,SAAkE;AAElE,YAAM,OAAO;AACb,cAAI,0CAA0B,OAAO,GAAG;AACvC,aAAK,SAAS,KAAK,QAAQ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IAGO,SAAM;AACZ,iBAAO,4BAAe;QACrB,GAAG,MAAM,OAAM;QACf,YAAQ,0BAAW,KAAK,MAAM;QAC9B,QAAQ,KAAK;QACb,YAAY,KAAK;QACjB,wBAAwB,KAAK;QAC7B,cAAc,KAAK;QACnB,yBAAyB,KAAK;QAC9B,wBAAwB,KAAK;QAC7B,WAAW,KAAK;QAChB,YAAY,KAAK;QACjB,aAAa,KAAK;QAClB,cAAc,KAAK;QACnB,aAAa,KAAK;QAClB,cAAc,KAAK;QACnB,2BAA2B,KAAK;QAChC,YAAY,KAAK;OACjB;IACF;;;;",
4
+ "sourcesContent": ["import { ZWaveError, ZWaveErrorCodes, stripUndefined } from \"@zwave-js/core\";\nimport { Bytes, buffer2hex } from \"@zwave-js/shared\";\nimport type { NVM3Object } from \"../object.js\";\nimport {\n\tNVMFile,\n\ttype NVMFileCreationOptions,\n\ttype NVMFileDeserializationOptions,\n\tgotDeserializationOptions,\n\tnvmFileID,\n\tnvmSection,\n} from \"./NVMFile.js\";\n\nexport type ControllerInfoFileOptions =\n\t& NVMFileCreationOptions\n\t& {\n\t\thomeId: Uint8Array;\n\t\tnodeId: number;\n\t\tlastNodeId: number;\n\t\tstaticControllerNodeId: number;\n\t\tsucLastIndex: number;\n\t\tcontrollerConfiguration: number;\n\t\tmaxNodeId: number;\n\t\treservedId: number;\n\t\tsystemState: number;\n\t}\n\t& (\n\t\t| {\n\t\t\tsucAwarenessPushNeeded: number;\n\t\t}\n\t\t| {\n\t\t\tlastNodeIdLR: number;\n\t\t\tmaxNodeIdLR: number;\n\t\t\treservedIdLR: number;\n\t\t\tprimaryLongRangeChannelId: number;\n\t\t\tdcdcConfig: number;\n\t\t}\n\t);\n\nexport const ControllerInfoFileID = 0x50004;\n\n@nvmFileID(ControllerInfoFileID)\n@nvmSection(\"protocol\")\nexport class ControllerInfoFile extends NVMFile {\n\tpublic constructor(\n\t\toptions: NVMFileDeserializationOptions | ControllerInfoFileOptions,\n\t) {\n\t\tsuper(options);\n\t\tif (gotDeserializationOptions(options)) {\n\t\t\tthis.homeId = this.payload.subarray(0, 4);\n\t\t\tif (this.payload.length === 13) {\n\t\t\t\tthis.nodeId = this.payload[4];\n\t\t\t\tthis.lastNodeId = this.payload[5];\n\t\t\t\tthis.staticControllerNodeId = this.payload[6];\n\t\t\t\tthis.sucLastIndex = this.payload[7];\n\t\t\t\tthis.controllerConfiguration = this.payload[8];\n\t\t\t\tthis.sucAwarenessPushNeeded = this.payload[9];\n\t\t\t\tthis.maxNodeId = this.payload[10];\n\t\t\t\tthis.reservedId = this.payload[11];\n\t\t\t\tthis.systemState = this.payload[12];\n\t\t\t} else if (this.payload.length === 22) {\n\t\t\t\tthis.nodeId = this.payload.readUInt16LE(4);\n\t\t\t\tthis.staticControllerNodeId = this.payload.readUInt16LE(6);\n\t\t\t\tthis.lastNodeIdLR = this.payload.readUInt16LE(8);\n\t\t\t\tthis.lastNodeId = this.payload[10];\n\t\t\t\tthis.sucLastIndex = this.payload[11];\n\t\t\t\tthis.maxNodeIdLR = this.payload.readUInt16LE(12);\n\t\t\t\tthis.maxNodeId = this.payload[14];\n\t\t\t\tthis.controllerConfiguration = this.payload[15];\n\t\t\t\tthis.reservedIdLR = this.payload.readUInt16LE(16);\n\t\t\t\tthis.reservedId = this.payload[18];\n\t\t\t\tthis.systemState = this.payload[19];\n\t\t\t\tthis.primaryLongRangeChannelId = this.payload[20];\n\t\t\t\tthis.dcdcConfig = this.payload[21];\n\t\t\t} else {\n\t\t\t\tthrow new ZWaveError(\n\t\t\t\t\t`Unsupported payload length`,\n\t\t\t\t\tZWaveErrorCodes.NVM_InvalidFormat,\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\tthis.homeId = Bytes.view(options.homeId);\n\t\t\tthis.nodeId = options.nodeId;\n\t\t\tthis.lastNodeId = options.lastNodeId;\n\t\t\tthis.staticControllerNodeId = options.staticControllerNodeId;\n\t\t\tthis.sucLastIndex = options.sucLastIndex;\n\t\t\tthis.controllerConfiguration = options.controllerConfiguration;\n\t\t\tthis.maxNodeId = options.maxNodeId;\n\t\t\tthis.reservedId = options.reservedId;\n\t\t\tthis.systemState = options.systemState;\n\t\t\tif (\"lastNodeIdLR\" in options) {\n\t\t\t\tthis.lastNodeIdLR = options.lastNodeIdLR;\n\t\t\t\tthis.maxNodeIdLR = options.maxNodeIdLR;\n\t\t\t\tthis.reservedIdLR = options.reservedIdLR;\n\t\t\t\tthis.primaryLongRangeChannelId =\n\t\t\t\t\toptions.primaryLongRangeChannelId;\n\t\t\t\tthis.dcdcConfig = options.dcdcConfig;\n\t\t\t} else {\n\t\t\t\tthis.sucAwarenessPushNeeded = options.sucAwarenessPushNeeded;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic homeId: Uint8Array;\n\tpublic nodeId: number;\n\tpublic lastNodeId: number;\n\tpublic staticControllerNodeId: number;\n\tpublic sucLastIndex: number;\n\tpublic controllerConfiguration: number; // TODO: Figure out what this is\n\tpublic sucAwarenessPushNeeded?: number;\n\tpublic maxNodeId: number;\n\tpublic reservedId: number;\n\tpublic systemState: number;\n\tpublic lastNodeIdLR?: number;\n\tpublic maxNodeIdLR?: number;\n\tpublic reservedIdLR?: number;\n\tpublic primaryLongRangeChannelId?: number;\n\tpublic dcdcConfig?: number;\n\n\tpublic serialize(): NVM3Object & { data: Bytes } {\n\t\tif (this.lastNodeIdLR != undefined) {\n\t\t\tthis.payload = new Bytes(22);\n\t\t\tthis.payload.set(this.homeId, 0);\n\t\t\tthis.payload.writeUInt16LE(this.nodeId, 4);\n\t\t\tthis.payload.writeUInt16LE(this.staticControllerNodeId, 6);\n\t\t\tthis.payload.writeUInt16LE(this.lastNodeIdLR, 8);\n\t\t\tthis.payload[10] = this.lastNodeId;\n\t\t\tthis.payload[11] = this.sucLastIndex;\n\t\t\tthis.payload.writeUInt16LE(this.maxNodeIdLR!, 12);\n\t\t\tthis.payload[14] = this.maxNodeId;\n\t\t\tthis.payload[15] = this.controllerConfiguration;\n\t\t\tthis.payload.writeUInt16LE(this.reservedIdLR!, 16);\n\t\t\tthis.payload[18] = this.reservedId;\n\t\t\tthis.payload[19] = this.systemState;\n\t\t\tthis.payload[20] = this.primaryLongRangeChannelId!;\n\t\t\tthis.payload[21] = this.dcdcConfig!;\n\t\t} else {\n\t\t\t// V0\n\t\t\tthis.payload = Bytes.concat([\n\t\t\t\tthis.homeId,\n\t\t\t\tBytes.from([\n\t\t\t\t\tthis.nodeId,\n\t\t\t\t\tthis.lastNodeId,\n\t\t\t\t\tthis.staticControllerNodeId,\n\t\t\t\t\tthis.sucLastIndex,\n\t\t\t\t\tthis.controllerConfiguration,\n\t\t\t\t\tthis.sucAwarenessPushNeeded ?? 0,\n\t\t\t\t\tthis.maxNodeId,\n\t\t\t\t\tthis.reservedId,\n\t\t\t\t\tthis.systemState,\n\t\t\t\t]),\n\t\t\t]);\n\t\t}\n\t\treturn super.serialize();\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic toJSON() {\n\t\treturn stripUndefined({\n\t\t\t...super.toJSON(),\n\t\t\thomeId: buffer2hex(this.homeId),\n\t\t\tnodeId: this.nodeId,\n\t\t\tlastNodeId: this.lastNodeId,\n\t\t\tstaticControllerNodeId: this.staticControllerNodeId,\n\t\t\tsucLastIndex: this.sucLastIndex,\n\t\t\tcontrollerConfiguration: this.controllerConfiguration,\n\t\t\tsucAwarenessPushNeeded: this.sucAwarenessPushNeeded,\n\t\t\tmaxNodeId: this.maxNodeId,\n\t\t\treservedId: this.reservedId,\n\t\t\tsystemState: this.systemState,\n\t\t\tlastNodeIdLR: this.lastNodeIdLR,\n\t\t\tmaxNodeIdLR: this.maxNodeIdLR,\n\t\t\treservedIdLR: this.reservedIdLR,\n\t\t\tprimaryLongRangeChannelId: this.primaryLongRangeChannelId,\n\t\t\tdcdcConfig: this.dcdcConfig,\n\t\t});\n\t}\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kBAA4D;AAC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;AACxB,aAAK,QAAQ,EAAE,IAAI,KAAK;AACxB,aAAK,QAAQ,cAAc,KAAK,cAAe,EAAE;AACjD,aAAK,QAAQ,EAAE,IAAI,KAAK;AACxB,aAAK,QAAQ,EAAE,IAAI,KAAK;AACxB,aAAK,QAAQ,EAAE,IAAI,KAAK;AACxB,aAAK,QAAQ,EAAE,IAAI,KAAK;MACzB,OAAO;AAEN,aAAK,UAAU,oBAAM,OAAO;UAC3B,KAAK;UACL,oBAAM,KAAK;YACV,KAAK;YACL,KAAK;YACL,KAAK;YACL,KAAK;YACL,KAAK;YACL,KAAK,0BAA0B;YAC/B,KAAK;YACL,KAAK;YACL,KAAK;WACL;SACD;MACF;AACA,aAAO,MAAM,UAAS;IACvB;;IAGO,SAAM;AACZ,iBAAO,4BAAe;QACrB,GAAG,MAAM,OAAM;QACf,YAAQ,0BAAW,KAAK,MAAM;QAC9B,QAAQ,KAAK;QACb,YAAY,KAAK;QACjB,wBAAwB,KAAK;QAC7B,cAAc,KAAK;QACnB,yBAAyB,KAAK;QAC9B,wBAAwB,KAAK;QAC7B,WAAW,KAAK;QAChB,YAAY,KAAK;QACjB,aAAa,KAAK;QAClB,cAAc,KAAK;QACnB,aAAa,KAAK;QAClB,cAAc,KAAK;QACnB,2BAA2B,KAAK;QAChC,YAAY,KAAK;OACjB;IACF;;;;",
6
6
  "names": []
7
7
  }
@@ -31,8 +31,8 @@ __export(NVMFile_exports, {
31
31
  nvmSection: () => nvmSection
32
32
  });
33
33
  module.exports = __toCommonJS(NVMFile_exports);
34
+ var import_core = require("@zwave-js/core");
34
35
  var import_reflection = require("@zwave-js/core/reflection");
35
- var import_safe = require("@zwave-js/core/safe");
36
36
  var import_shared = require("@zwave-js/shared");
37
37
  var import_consts = require("../consts.js");
38
38
  function gotDeserializationOptions(options) {
@@ -107,7 +107,7 @@ function getNVMFileID(id) {
107
107
  const constr = id.constructor;
108
108
  const ret = id instanceof NVMFile ? Reflect.getMetadata(METADATA_nvmFileID, constr) : void 0;
109
109
  if (ret == void 0) {
110
- throw new import_safe.ZWaveError(`No NVM file ID defined for ${constr.name}!`, import_safe.ZWaveErrorCodes.CC_Invalid);
110
+ throw new import_core.ZWaveError(`No NVM file ID defined for ${constr.name}!`, import_core.ZWaveErrorCodes.CC_Invalid);
111
111
  }
112
112
  return ret;
113
113
  }
@@ -127,7 +127,7 @@ __name(getNVMFileConstructor, "getNVMFileConstructor");
127
127
  function getNVMFileIDStatic(classConstructor) {
128
128
  const ret = Reflect.getMetadata(METADATA_nvmFileID, classConstructor);
129
129
  if (ret == void 0) {
130
- throw new import_safe.ZWaveError(`No NVM file ID defined for ${classConstructor.name}!`, import_safe.ZWaveErrorCodes.CC_Invalid);
130
+ throw new import_core.ZWaveError(`No NVM file ID defined for ${classConstructor.name}!`, import_core.ZWaveErrorCodes.CC_Invalid);
131
131
  }
132
132
  return ret;
133
133
  }
@@ -146,7 +146,7 @@ function getNVMSectionByFileID(fileId) {
146
146
  }
147
147
  if (ret)
148
148
  return ret;
149
- throw new import_safe.ZWaveError(`NVM section for file with ID ${(0, import_shared.num2hex)(fileId)} could not be determined`, import_safe.ZWaveErrorCodes.Argument_Invalid);
149
+ throw new import_core.ZWaveError(`NVM section for file with ID ${(0, import_shared.num2hex)(fileId)} could not be determined`, import_core.ZWaveErrorCodes.Argument_Invalid);
150
150
  }
151
151
  __name(getNVMSectionByFileID, "getNVMSectionByFileID");
152
152
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/lib/nvm3/files/NVMFile.ts"],
4
- "sourcesContent": ["import { createSimpleReflectionDecorator } from \"@zwave-js/core/reflection\";\nimport { ZWaveError, ZWaveErrorCodes } from \"@zwave-js/core/safe\";\nimport {\n\tBytes,\n\ttype TypedClassDecorator,\n\tisUint8Array,\n\tnum2hex,\n} from \"@zwave-js/shared\";\nimport {\n\tFragmentType,\n\tNVM3_MAX_OBJ_SIZE_SMALL,\n\tObjectType,\n} from \"../consts.js\";\nimport type { NVM3Object } from \"../object.js\";\n\nexport interface NVMFileBaseOptions {\n\tfileId?: number;\n\tfileVersion: string;\n}\nexport interface NVMFileDeserializationOptions extends NVMFileBaseOptions {\n\tfileId: number;\n\tdata: Bytes;\n}\n\nexport function gotDeserializationOptions(\n\toptions: NVMFileOptions,\n): options is NVMFileDeserializationOptions {\n\treturn \"data\" in options && isUint8Array(options.data);\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface NVMFileCreationOptions extends NVMFileBaseOptions {}\n\nexport type NVMFileOptions =\n\t| NVMFileCreationOptions\n\t| NVMFileDeserializationOptions;\n\nexport class NVMFile {\n\tpublic constructor(options: NVMFileOptions) {\n\t\tthis.fileVersion = options.fileVersion;\n\n\t\tif (gotDeserializationOptions(options)) {\n\t\t\tthis.fileId = options.fileId;\n\t\t\tthis.payload = options.data;\n\t\t} else {\n\t\t\tconst fileId = options.fileId ?? getNVMFileID(this);\n\t\t\tif (typeof fileId === \"number\") {\n\t\t\t\tthis.fileId = fileId;\n\t\t\t}\n\t\t\tthis.payload = new Bytes();\n\t\t}\n\t}\n\n\tprotected payload: Bytes;\n\tpublic fileId: number = 0;\n\tpublic fileVersion: string;\n\n\t/**\n\t * Creates an instance of the NVM file that is contained in the given NVM object\n\t */\n\tpublic static from(\n\t\tfileId: number,\n\t\tdata: Uint8Array,\n\t\tfileVersion: string,\n\t): NVMFile {\n\t\tconst Constructor = getNVMFileConstructor(fileId)!;\n\t\treturn new Constructor({\n\t\t\tfileId,\n\t\t\tfileVersion,\n\t\t\tdata,\n\t\t});\n\t}\n\n\t/**\n\t * Serializes this NVMFile into an NVM Object\n\t */\n\tpublic serialize(): NVM3Object & { data: Bytes } {\n\t\tif (!this.fileId) {\n\t\t\tthrow new Error(\"The NVM file ID must be set before serializing\");\n\t\t}\n\t\treturn {\n\t\t\tkey: this.fileId,\n\t\t\tdata: this.payload,\n\t\t\t// We only support large and small data objects for now\n\t\t\ttype: this.payload.length <= NVM3_MAX_OBJ_SIZE_SMALL\n\t\t\t\t? ObjectType.DataSmall\n\t\t\t\t: ObjectType.DataLarge,\n\t\t\t// By default output unfragmented objects, they will be split later\n\t\t\tfragmentType: FragmentType.None,\n\t\t};\n\t}\n\n\tpublic toJSON(): Record<string, any> {\n\t\treturn {\n\t\t\t\"file ID\": `0x${\n\t\t\t\tthis.fileId.toString(16)\n\t\t\t} (${this.constructor.name})`,\n\t\t};\n\t}\n}\n\nconst METADATA_nvmFileID = Symbol(\"nvmFileID\");\nconst METADATA_nvmFileIDMap = Symbol(\"nvmFileIDMap\");\n\ntype NVMFileIDMap = Map<\n\tnumber | ((id: number) => boolean),\n\tNVMFileConstructor<NVMFile>\n>;\n\nexport type NVMFileConstructor<T extends NVMFile> = typeof NVMFile & {\n\tnew (options: any): T;\n};\n\n/**\n * Defines the ID associated with a NVM file class\n */\nexport function nvmFileID<Class extends typeof NVMFile>(\n\tid: number | ((id: number) => boolean),\n): TypedClassDecorator<Class> {\n\treturn (messageClass) => {\n\t\tReflect.defineMetadata(METADATA_nvmFileID, id, messageClass);\n\n\t\t// also store a map in the NVMFile metadata for lookup.\n\t\tconst map: NVMFileIDMap =\n\t\t\tReflect.getMetadata(METADATA_nvmFileIDMap, NVMFile) || new Map();\n\t\tmap.set(id, messageClass as unknown as NVMFileConstructor<NVMFile>);\n\t\tReflect.defineMetadata(METADATA_nvmFileIDMap, map, NVMFile);\n\t};\n}\n\n/**\n * Retrieves the file ID defined for a NVM file class\n */\nexport function getNVMFileID<T extends NVMFile>(\n\tid: T,\n): number | ((id: number) => boolean) {\n\t// get the class constructor\n\tconst constr = id.constructor;\n\t// retrieve the current metadata\n\tconst ret: number | undefined = id instanceof NVMFile\n\t\t? Reflect.getMetadata(METADATA_nvmFileID, constr)\n\t\t: undefined;\n\tif (ret == undefined) {\n\t\tthrow new ZWaveError(\n\t\t\t`No NVM file ID defined for ${constr.name}!`,\n\t\t\tZWaveErrorCodes.CC_Invalid,\n\t\t);\n\t}\n\treturn ret;\n}\n\n/**\n * Looks up the NVM file constructor for a given file ID\n */\nexport function getNVMFileConstructor(\n\tid: number,\n): NVMFileConstructor<NVMFile> | undefined {\n\t// Retrieve the constructor map from the NVMFile class\n\tconst map = Reflect.getMetadata(METADATA_nvmFileIDMap, NVMFile) as\n\t\t| NVMFileIDMap\n\t\t| undefined;\n\tif (map != undefined) {\n\t\tif (map.has(id)) return map.get(id);\n\t\t// Otherwise loop through predicates\n\t\tfor (const [key, value] of map.entries()) {\n\t\t\tif (typeof key === \"function\" && key(id)) return value;\n\t\t}\n\t}\n}\n\n/**\n * Retrieves the file ID defined for a NVM file class\n */\nexport function getNVMFileIDStatic<T extends NVMFileConstructor<NVMFile>>(\n\tclassConstructor: T,\n): number | ((id: number) => boolean) {\n\t// retrieve the current metadata\n\tconst ret = Reflect.getMetadata(METADATA_nvmFileID, classConstructor);\n\tif (ret == undefined) {\n\t\tthrow new ZWaveError(\n\t\t\t`No NVM file ID defined for ${classConstructor.name}!`,\n\t\t\tZWaveErrorCodes.CC_Invalid,\n\t\t);\n\t}\n\treturn ret;\n}\n\nexport type NVMSection = \"application\" | \"protocol\";\n\nconst nvmSectionDecorator = createSimpleReflectionDecorator<\n\ttypeof NVMFile,\n\t[section: NVMSection]\n>({\n\tname: \"nvmSection\",\n});\n\n/** Defines in which section an NVM file is stored */\nexport const nvmSection = nvmSectionDecorator.decorator;\n\n/** Returns in which section an NVM file is stored (using an instance of the file) */\nexport const getNVMSection = nvmSectionDecorator.lookupValue;\n\n/** Returns in which section an NVM file is stored (using the constructor of the file) */\nexport const getNVMSectionStatic = nvmSectionDecorator.lookupValueStatic;\n\n/** Returns in which NVM section the file with the given ID resides in */\nexport function getNVMSectionByFileID(fileId: number): NVMSection {\n\tconst File = getNVMFileConstructor(fileId);\n\tlet ret: NVMSection | undefined;\n\tif (File) {\n\t\tret = getNVMSectionStatic(File);\n\t}\n\tif (ret) return ret;\n\n\tthrow new ZWaveError(\n\t\t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;AAElC;AAdgB;",
4
+ "sourcesContent": ["import { ZWaveError, ZWaveErrorCodes } from \"@zwave-js/core\";\nimport { createSimpleReflectionDecorator } from \"@zwave-js/core/reflection\";\nimport {\n\tBytes,\n\ttype TypedClassDecorator,\n\tisUint8Array,\n\tnum2hex,\n} from \"@zwave-js/shared\";\nimport {\n\tFragmentType,\n\tNVM3_MAX_OBJ_SIZE_SMALL,\n\tObjectType,\n} from \"../consts.js\";\nimport type { NVM3Object } from \"../object.js\";\n\nexport interface NVMFileBaseOptions {\n\tfileId?: number;\n\tfileVersion: string;\n}\nexport interface NVMFileDeserializationOptions extends NVMFileBaseOptions {\n\tfileId: number;\n\tdata: Bytes;\n}\n\nexport function gotDeserializationOptions(\n\toptions: NVMFileOptions,\n): options is NVMFileDeserializationOptions {\n\treturn \"data\" in options && isUint8Array(options.data);\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface NVMFileCreationOptions extends NVMFileBaseOptions {}\n\nexport type NVMFileOptions =\n\t| NVMFileCreationOptions\n\t| NVMFileDeserializationOptions;\n\nexport class NVMFile {\n\tpublic constructor(options: NVMFileOptions) {\n\t\tthis.fileVersion = options.fileVersion;\n\n\t\tif (gotDeserializationOptions(options)) {\n\t\t\tthis.fileId = options.fileId;\n\t\t\tthis.payload = options.data;\n\t\t} else {\n\t\t\tconst fileId = options.fileId ?? getNVMFileID(this);\n\t\t\tif (typeof fileId === \"number\") {\n\t\t\t\tthis.fileId = fileId;\n\t\t\t}\n\t\t\tthis.payload = new Bytes();\n\t\t}\n\t}\n\n\tprotected payload: Bytes;\n\tpublic fileId: number = 0;\n\tpublic fileVersion: string;\n\n\t/**\n\t * Creates an instance of the NVM file that is contained in the given NVM object\n\t */\n\tpublic static from(\n\t\tfileId: number,\n\t\tdata: Uint8Array,\n\t\tfileVersion: string,\n\t): NVMFile {\n\t\tconst Constructor = getNVMFileConstructor(fileId)!;\n\t\treturn new Constructor({\n\t\t\tfileId,\n\t\t\tfileVersion,\n\t\t\tdata,\n\t\t});\n\t}\n\n\t/**\n\t * Serializes this NVMFile into an NVM Object\n\t */\n\tpublic serialize(): NVM3Object & { data: Bytes } {\n\t\tif (!this.fileId) {\n\t\t\tthrow new Error(\"The NVM file ID must be set before serializing\");\n\t\t}\n\t\treturn {\n\t\t\tkey: this.fileId,\n\t\t\tdata: this.payload,\n\t\t\t// We only support large and small data objects for now\n\t\t\ttype: this.payload.length <= NVM3_MAX_OBJ_SIZE_SMALL\n\t\t\t\t? ObjectType.DataSmall\n\t\t\t\t: ObjectType.DataLarge,\n\t\t\t// By default output unfragmented objects, they will be split later\n\t\t\tfragmentType: FragmentType.None,\n\t\t};\n\t}\n\n\tpublic toJSON(): Record<string, any> {\n\t\treturn {\n\t\t\t\"file ID\": `0x${\n\t\t\t\tthis.fileId.toString(16)\n\t\t\t} (${this.constructor.name})`,\n\t\t};\n\t}\n}\n\nconst METADATA_nvmFileID = Symbol(\"nvmFileID\");\nconst METADATA_nvmFileIDMap = Symbol(\"nvmFileIDMap\");\n\ntype NVMFileIDMap = Map<\n\tnumber | ((id: number) => boolean),\n\tNVMFileConstructor<NVMFile>\n>;\n\nexport type NVMFileConstructor<T extends NVMFile> = typeof NVMFile & {\n\tnew (options: any): T;\n};\n\n/**\n * Defines the ID associated with a NVM file class\n */\nexport function nvmFileID<Class extends typeof NVMFile>(\n\tid: number | ((id: number) => boolean),\n): TypedClassDecorator<Class> {\n\treturn (messageClass) => {\n\t\tReflect.defineMetadata(METADATA_nvmFileID, id, messageClass);\n\n\t\t// also store a map in the NVMFile metadata for lookup.\n\t\tconst map: NVMFileIDMap =\n\t\t\tReflect.getMetadata(METADATA_nvmFileIDMap, NVMFile) || new Map();\n\t\tmap.set(id, messageClass as unknown as NVMFileConstructor<NVMFile>);\n\t\tReflect.defineMetadata(METADATA_nvmFileIDMap, map, NVMFile);\n\t};\n}\n\n/**\n * Retrieves the file ID defined for a NVM file class\n */\nexport function getNVMFileID<T extends NVMFile>(\n\tid: T,\n): number | ((id: number) => boolean) {\n\t// get the class constructor\n\tconst constr = id.constructor;\n\t// retrieve the current metadata\n\tconst ret: number | undefined = id instanceof NVMFile\n\t\t? Reflect.getMetadata(METADATA_nvmFileID, constr)\n\t\t: undefined;\n\tif (ret == undefined) {\n\t\tthrow new ZWaveError(\n\t\t\t`No NVM file ID defined for ${constr.name}!`,\n\t\t\tZWaveErrorCodes.CC_Invalid,\n\t\t);\n\t}\n\treturn ret;\n}\n\n/**\n * Looks up the NVM file constructor for a given file ID\n */\nexport function getNVMFileConstructor(\n\tid: number,\n): NVMFileConstructor<NVMFile> | undefined {\n\t// Retrieve the constructor map from the NVMFile class\n\tconst map = Reflect.getMetadata(METADATA_nvmFileIDMap, NVMFile) as\n\t\t| NVMFileIDMap\n\t\t| undefined;\n\tif (map != undefined) {\n\t\tif (map.has(id)) return map.get(id);\n\t\t// Otherwise loop through predicates\n\t\tfor (const [key, value] of map.entries()) {\n\t\t\tif (typeof key === \"function\" && key(id)) return value;\n\t\t}\n\t}\n}\n\n/**\n * Retrieves the file ID defined for a NVM file class\n */\nexport function getNVMFileIDStatic<T extends NVMFileConstructor<NVMFile>>(\n\tclassConstructor: T,\n): number | ((id: number) => boolean) {\n\t// retrieve the current metadata\n\tconst ret = Reflect.getMetadata(METADATA_nvmFileID, classConstructor);\n\tif (ret == undefined) {\n\t\tthrow new ZWaveError(\n\t\t\t`No NVM file ID defined for ${classConstructor.name}!`,\n\t\t\tZWaveErrorCodes.CC_Invalid,\n\t\t);\n\t}\n\treturn ret;\n}\n\nexport type NVMSection = \"application\" | \"protocol\";\n\nconst nvmSectionDecorator = createSimpleReflectionDecorator<\n\ttypeof NVMFile,\n\t[section: NVMSection]\n>({\n\tname: \"nvmSection\",\n});\n\n/** Defines in which section an NVM file is stored */\nexport const nvmSection = nvmSectionDecorator.decorator;\n\n/** Returns in which section an NVM file is stored (using an instance of the file) */\nexport const getNVMSection = nvmSectionDecorator.lookupValue;\n\n/** Returns in which section an NVM file is stored (using the constructor of the file) */\nexport const getNVMSectionStatic = nvmSectionDecorator.lookupValueStatic;\n\n/** Returns in which NVM section the file with the given ID resides in */\nexport function getNVMSectionByFileID(fileId: number): NVMSection {\n\tconst File = getNVMFileConstructor(fileId);\n\tlet ret: NVMSection | undefined;\n\tif (File) {\n\t\tret = getNVMSectionStatic(File);\n\t}\n\tif (ret) return ret;\n\n\tthrow new ZWaveError(\n\t\t`NVM section for file with ID ${\n\t\t\tnum2hex(fileId)\n\t\t} could not be determined`,\n\t\tZWaveErrorCodes.Argument_Invalid,\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;AAAA,kBAA4C;AAC5C,wBAAgD;AAChD,oBAKO;AACP,oBAIO;AAYD,SAAU,0BACf,SAAuB;AAEvB,SAAO,UAAU,eAAW,4BAAa,QAAQ,IAAI;AACtD;AAJgB;AAaV,MAAO,QAAO;EArCpB,OAqCoB;;;EACnB,YAAmB,SAAuB;AACzC,SAAK,cAAc,QAAQ;AAE3B,QAAI,0BAA0B,OAAO,GAAG;AACvC,WAAK,SAAS,QAAQ;AACtB,WAAK,UAAU,QAAQ;IACxB,OAAO;AACN,YAAM,SAAS,QAAQ,UAAU,aAAa,IAAI;AAClD,UAAI,OAAO,WAAW,UAAU;AAC/B,aAAK,SAAS;MACf;AACA,WAAK,UAAU,IAAI,oBAAK;IACzB;EACD;EAEU;EACH,SAAiB;EACjB;;;;EAKA,OAAO,KACb,QACA,MACA,aAAmB;AAEnB,UAAM,cAAc,sBAAsB,MAAM;AAChD,WAAO,IAAI,YAAY;MACtB;MACA;MACA;KACA;EACF;;;;EAKO,YAAS;AACf,QAAI,CAAC,KAAK,QAAQ;AACjB,YAAM,IAAI,MAAM,gDAAgD;IACjE;AACA,WAAO;MACN,KAAK,KAAK;MACV,MAAM,KAAK;;MAEX,MAAM,KAAK,QAAQ,UAAU,wCAC1B,yBAAW,YACX,yBAAW;;MAEd,cAAc,2BAAa;;EAE7B;EAEO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BAAoB;AAG1C,MAAM,sBAAsB,oBAAoB;AAGjD,SAAU,sBAAsB,QAAc;AACnD,QAAM,OAAO,sBAAsB,MAAM;AACzC,MAAI;AACJ,MAAI,MAAM;AACT,UAAM,oBAAoB,IAAI;EAC/B;AACA,MAAI;AAAK,WAAO;AAEhB,QAAM,IAAI,uBACT,oCACC,uBAAQ,MAAM,CACf,4BACA,4BAAgB,gBAAgB;AAElC;AAdgB;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,5 @@
1
- import { type NodeProtocolInfo } from "@zwave-js/core/safe";
2
- import { Bytes } from "@zwave-js/shared/safe";
1
+ import { type NodeProtocolInfo } from "@zwave-js/core";
2
+ import { Bytes } from "@zwave-js/shared";
3
3
  import type { NVM3Object } from "../object.js";
4
4
  import { NVMFile, type NVMFileCreationOptions, type NVMFileDeserializationOptions } from "./NVMFile.js";
5
5
  export declare const NODEINFOS_PER_FILE_V1 = 4;
@@ -32,8 +32,8 @@ __export(NodeInfoFiles_exports, {
32
32
  nodeIdToNodeInfoFileIDV1: () => nodeIdToNodeInfoFileIDV1
33
33
  });
34
34
  module.exports = __toCommonJS(NodeInfoFiles_exports);
35
- var import_safe = require("@zwave-js/core/safe");
36
- var import_safe2 = require("@zwave-js/shared/safe");
35
+ var import_core = require("@zwave-js/core");
36
+ var import_shared = require("@zwave-js/shared");
37
37
  var import_NVMFile = require("./NVMFile.js");
38
38
  var __esDecorate = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
39
39
  function accept(f) {
@@ -77,16 +77,16 @@ var __runInitializers = function(thisArg, initializers, value) {
77
77
  };
78
78
  const NODEINFOS_PER_FILE_V1 = 4;
79
79
  const LR_NODEINFOS_PER_FILE_V5 = 50;
80
- const NODEINFO_SIZE = 1 + 5 + import_safe.NUM_NODEMASK_BYTES;
80
+ const NODEINFO_SIZE = 1 + 5 + import_core.NUM_NODEMASK_BYTES;
81
81
  const LR_NODEINFO_SIZE = 3;
82
82
  const EMPTY_NODEINFO_FILL = 255;
83
83
  const emptyNodeInfo = new Uint8Array(NODEINFO_SIZE).fill(EMPTY_NODEINFO_FILL);
84
84
  function parseNodeInfo(nodeId, buffer, offset) {
85
- const { hasSpecificDeviceClass, ...protocolInfo } = (0, import_safe.parseNodeProtocolInfo)(buffer, offset);
85
+ const { hasSpecificDeviceClass, ...protocolInfo } = (0, import_core.parseNodeProtocolInfo)(buffer, offset);
86
86
  const genericDeviceClass = buffer[offset + 3];
87
87
  const specificDeviceClass = hasSpecificDeviceClass ? buffer[offset + 4] : null;
88
- const neighbors = (0, import_safe.parseBitMask)(buffer.subarray(offset + 5, offset + 5 + import_safe.NUM_NODEMASK_BYTES));
89
- const sucUpdateIndex = buffer[offset + 5 + import_safe.NUM_NODEMASK_BYTES];
88
+ const neighbors = (0, import_core.parseBitMask)(buffer.subarray(offset + 5, offset + 5 + import_core.NUM_NODEMASK_BYTES));
89
+ const sucUpdateIndex = buffer[offset + 5 + import_core.NUM_NODEMASK_BYTES];
90
90
  return {
91
91
  nodeId,
92
92
  ...protocolInfo,
@@ -98,10 +98,10 @@ function parseNodeInfo(nodeId, buffer, offset) {
98
98
  }
99
99
  __name(parseNodeInfo, "parseNodeInfo");
100
100
  function encodeNodeInfo(nodeInfo) {
101
- const ret = new import_safe2.Bytes(NODEINFO_SIZE);
101
+ const ret = new import_shared.Bytes(NODEINFO_SIZE);
102
102
  const hasSpecificDeviceClass = nodeInfo.specificDeviceClass != null;
103
103
  const protocolInfo = {
104
- ...(0, import_safe2.pick)(nodeInfo, [
104
+ ...(0, import_shared.pick)(nodeInfo, [
105
105
  "isListening",
106
106
  "isFrequentListening",
107
107
  "isRouting",
@@ -114,12 +114,12 @@ function encodeNodeInfo(nodeInfo) {
114
114
  ]),
115
115
  hasSpecificDeviceClass
116
116
  };
117
- ret.set((0, import_safe.encodeNodeProtocolInfo)(protocolInfo), 0);
117
+ ret.set((0, import_core.encodeNodeProtocolInfo)(protocolInfo), 0);
118
118
  ret[3] = nodeInfo.genericDeviceClass;
119
119
  if (hasSpecificDeviceClass)
120
120
  ret[4] = nodeInfo.specificDeviceClass;
121
- ret.set((0, import_safe.encodeBitMask)(nodeInfo.neighbors, import_safe.MAX_NODES), 5);
122
- ret[5 + import_safe.NUM_NODEMASK_BYTES] = nodeInfo.sucUpdateIndex;
121
+ ret.set((0, import_core.encodeBitMask)(nodeInfo.neighbors, import_core.MAX_NODES), 5);
122
+ ret[5 + import_core.NUM_NODEMASK_BYTES] = nodeInfo.sucUpdateIndex;
123
123
  return ret;
124
124
  }
125
125
  __name(encodeNodeInfo, "encodeNodeInfo");
@@ -141,7 +141,7 @@ function parseLRNodeInfo(nodeId, buffer, offset) {
141
141
  default:
142
142
  isFrequentListening = false;
143
143
  }
144
- const nodeType = import_safe.NodeType["End Node"];
144
+ const nodeType = import_core.NodeType["End Node"];
145
145
  const supportsSecurity = true;
146
146
  const protocolVersion = 3;
147
147
  const supportedDataRates = [1e5];
@@ -162,7 +162,7 @@ function parseLRNodeInfo(nodeId, buffer, offset) {
162
162
  }
163
163
  __name(parseLRNodeInfo, "parseLRNodeInfo");
164
164
  function encodeLRNodeInfo(nodeInfo) {
165
- const ret = new import_safe2.Bytes(LR_NODEINFO_SIZE);
165
+ const ret = new import_shared.Bytes(LR_NODEINFO_SIZE);
166
166
  let capability = 0;
167
167
  if (nodeInfo.isRouting)
168
168
  capability |= 1;
@@ -191,7 +191,7 @@ function nodeIdToNodeInfoFileIDV0(nodeId) {
191
191
  }
192
192
  __name(nodeIdToNodeInfoFileIDV0, "nodeIdToNodeInfoFileIDV0");
193
193
  let NodeInfoFileV0 = (() => {
194
- let _classDecorators = [(0, import_NVMFile.nvmFileID)((id) => id >= NodeInfoFileV0IDBase && id < NodeInfoFileV0IDBase + import_safe.MAX_NODES), (0, import_NVMFile.nvmSection)("protocol")];
194
+ let _classDecorators = [(0, import_NVMFile.nvmFileID)((id) => id >= NodeInfoFileV0IDBase && id < NodeInfoFileV0IDBase + import_core.MAX_NODES), (0, import_NVMFile.nvmSection)("protocol")];
195
195
  let _classDescriptor;
196
196
  let _classExtraInitializers = [];
197
197
  let _classThis;
@@ -240,7 +240,7 @@ function nodeIdToNodeInfoFileIDV1(nodeId) {
240
240
  }
241
241
  __name(nodeIdToNodeInfoFileIDV1, "nodeIdToNodeInfoFileIDV1");
242
242
  let NodeInfoFileV1 = (() => {
243
- let _classDecorators = [(0, import_NVMFile.nvmFileID)((id) => id >= NodeInfoFileV1IDBase && id < NodeInfoFileV1IDBase + import_safe.MAX_NODES / NODEINFOS_PER_FILE_V1), (0, import_NVMFile.nvmSection)("protocol")];
243
+ let _classDecorators = [(0, import_NVMFile.nvmFileID)((id) => id >= NodeInfoFileV1IDBase && id < NodeInfoFileV1IDBase + import_core.MAX_NODES / NODEINFOS_PER_FILE_V1), (0, import_NVMFile.nvmSection)("protocol")];
244
244
  let _classDescriptor;
245
245
  let _classExtraInitializers = [];
246
246
  let _classThis;
@@ -281,7 +281,7 @@ let NodeInfoFileV1 = (() => {
281
281
  this.nodeInfos.sort((a, b) => a.nodeId - b.nodeId);
282
282
  const minNodeId = this.nodeInfos[0].nodeId;
283
283
  this.fileId = nodeIdToNodeInfoFileIDV1(minNodeId);
284
- this.payload = new import_safe2.Bytes(NODEINFO_SIZE * NODEINFOS_PER_FILE_V1).fill(EMPTY_NODEINFO_FILL);
284
+ this.payload = new import_shared.Bytes(NODEINFO_SIZE * NODEINFOS_PER_FILE_V1).fill(EMPTY_NODEINFO_FILL);
285
285
  const minFileNodeId = Math.floor((minNodeId - 1) / NODEINFOS_PER_FILE_V1) * NODEINFOS_PER_FILE_V1 + 1;
286
286
  for (const nodeInfo of this.nodeInfos) {
287
287
  const offset = (nodeInfo.nodeId - minFileNodeId) * NODEINFO_SIZE;
@@ -305,7 +305,7 @@ function nodeIdToLRNodeInfoFileIDV5(nodeId) {
305
305
  }
306
306
  __name(nodeIdToLRNodeInfoFileIDV5, "nodeIdToLRNodeInfoFileIDV5");
307
307
  let LRNodeInfoFileV5 = (() => {
308
- let _classDecorators = [(0, import_NVMFile.nvmFileID)((id) => id >= LRNodeInfoFileV5IDBase && id < LRNodeInfoFileV5IDBase + import_safe.MAX_NODES_LR / LR_NODEINFOS_PER_FILE_V5), (0, import_NVMFile.nvmSection)("protocol")];
308
+ let _classDecorators = [(0, import_NVMFile.nvmFileID)((id) => id >= LRNodeInfoFileV5IDBase && id < LRNodeInfoFileV5IDBase + import_core.MAX_NODES_LR / LR_NODEINFOS_PER_FILE_V5), (0, import_NVMFile.nvmSection)("protocol")];
309
309
  let _classDescriptor;
310
310
  let _classExtraInitializers = [];
311
311
  let _classThis;
@@ -346,7 +346,7 @@ let LRNodeInfoFileV5 = (() => {
346
346
  this.nodeInfos.sort((a, b) => a.nodeId - b.nodeId);
347
347
  const minNodeId = this.nodeInfos[0].nodeId;
348
348
  this.fileId = nodeIdToLRNodeInfoFileIDV5(minNodeId);
349
- this.payload = new import_safe2.Bytes(LR_NODEINFO_SIZE * LR_NODEINFOS_PER_FILE_V5).fill(EMPTY_NODEINFO_FILL);
349
+ this.payload = new import_shared.Bytes(LR_NODEINFO_SIZE * LR_NODEINFOS_PER_FILE_V5).fill(EMPTY_NODEINFO_FILL);
350
350
  const minFileNodeId = Math.floor((minNodeId - 256) / LR_NODEINFOS_PER_FILE_V5) * LR_NODEINFOS_PER_FILE_V5 + 256;
351
351
  for (const nodeInfo of this.nodeInfos) {
352
352
  const offset = (nodeInfo.nodeId - minFileNodeId) * LR_NODEINFO_SIZE;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/lib/nvm3/files/NodeInfoFiles.ts"],
4
- "sourcesContent": ["import {\n\ttype DataRate,\n\ttype FLiRS,\n\tMAX_NODES,\n\tMAX_NODES_LR,\n\tNUM_NODEMASK_BYTES,\n\ttype NodeProtocolInfo,\n\tNodeType,\n\tencodeBitMask,\n\tencodeNodeProtocolInfo,\n\tparseBitMask,\n\tparseNodeProtocolInfo,\n} from \"@zwave-js/core/safe\";\nimport { Bytes, pick } from \"@zwave-js/shared/safe\";\nimport type { NVM3Object } from \"../object.js\";\nimport {\n\tNVMFile,\n\ttype NVMFileCreationOptions,\n\ttype NVMFileDeserializationOptions,\n\tgotDeserializationOptions,\n\tnvmFileID,\n\tnvmSection,\n} from \"./NVMFile.js\";\n\nexport const NODEINFOS_PER_FILE_V1 = 4;\nexport const LR_NODEINFOS_PER_FILE_V5 = 50;\nconst NODEINFO_SIZE = 1 + 5 + NUM_NODEMASK_BYTES;\nconst LR_NODEINFO_SIZE = 3;\nconst EMPTY_NODEINFO_FILL = 0xff;\nconst emptyNodeInfo = new Uint8Array(NODEINFO_SIZE).fill(EMPTY_NODEINFO_FILL);\n\nexport interface NodeInfo\n\textends Omit<NodeProtocolInfo, \"hasSpecificDeviceClass\">\n{\n\tnodeId: number;\n\tgenericDeviceClass: number;\n\tspecificDeviceClass?: number | null;\n\tneighbors: number[];\n\tsucUpdateIndex: number;\n}\n\nfunction parseNodeInfo(\n\tnodeId: number,\n\tbuffer: Uint8Array,\n\toffset: number,\n): NodeInfo {\n\tconst { hasSpecificDeviceClass, ...protocolInfo } = parseNodeProtocolInfo(\n\t\tbuffer,\n\t\toffset,\n\t);\n\tconst genericDeviceClass = buffer[offset + 3];\n\tconst specificDeviceClass = hasSpecificDeviceClass\n\t\t? buffer[offset + 4]\n\t\t: null;\n\tconst neighbors = parseBitMask(\n\t\tbuffer.subarray(offset + 5, offset + 5 + NUM_NODEMASK_BYTES),\n\t);\n\tconst sucUpdateIndex = buffer[offset + 5 + NUM_NODEMASK_BYTES];\n\treturn {\n\t\tnodeId,\n\t\t...protocolInfo,\n\t\tgenericDeviceClass,\n\t\tspecificDeviceClass,\n\t\tneighbors,\n\t\tsucUpdateIndex,\n\t};\n}\n\nfunction encodeNodeInfo(nodeInfo: NodeInfo): Bytes {\n\tconst ret = new Bytes(NODEINFO_SIZE);\n\n\tconst hasSpecificDeviceClass = nodeInfo.specificDeviceClass != null;\n\tconst protocolInfo: NodeProtocolInfo = {\n\t\t...pick(nodeInfo, [\n\t\t\t\"isListening\",\n\t\t\t\"isFrequentListening\",\n\t\t\t\"isRouting\",\n\t\t\t\"supportedDataRates\",\n\t\t\t\"protocolVersion\",\n\t\t\t\"optionalFunctionality\",\n\t\t\t\"nodeType\",\n\t\t\t\"supportsSecurity\",\n\t\t\t\"supportsBeaming\",\n\t\t]),\n\t\thasSpecificDeviceClass,\n\t};\n\tret.set(encodeNodeProtocolInfo(protocolInfo), 0);\n\n\tret[3] = nodeInfo.genericDeviceClass;\n\tif (hasSpecificDeviceClass) ret[4] = nodeInfo.specificDeviceClass!;\n\tret.set(encodeBitMask(nodeInfo.neighbors, MAX_NODES), 5);\n\tret[5 + NUM_NODEMASK_BYTES] = nodeInfo.sucUpdateIndex;\n\n\treturn ret;\n}\n\nexport interface LRNodeInfo\n\textends Omit<NodeProtocolInfo, \"hasSpecificDeviceClass\">\n{\n\tnodeId: number;\n\tgenericDeviceClass: number;\n\tspecificDeviceClass?: number | null;\n}\n\nfunction parseLRNodeInfo(\n\tnodeId: number,\n\tbuffer: Uint8Array,\n\toffset: number,\n): LRNodeInfo {\n\t// The node info in LR NVM files is packed:\n\t// Byte 0 CAPABILITY:\n\t// Bit 0: Routing (?)\n\t// Bit 1: Listening\n\t// Bit 2: has specific device class (?)\n\t// Bit 3: Beam capability\n\t// Bit 4: Optional functionality\n\t// Bits 5-6: FLiRS\n\t// Bit 7: Unused (?)\n\t// Byte 1: Generic device class\n\t// Byte 2: Specific device class\n\n\t// Protocol version is always 3\n\t// Security is always true\n\t// Supported speed is always 100kbps (speed = 0, speed ext = 2)\n\t// Never: routing end node, controller\n\n\tconst capability = buffer[offset];\n\tconst isRouting = !!(capability & 0b0000_0001); // ZWLR Mesh??\n\tconst isListening = !!(capability & 0b0000_0010);\n\tconst hasSpecificDeviceClass = !!(capability & 0b0000_0100);\n\tconst supportsBeaming = !!(capability & 0b0000_1000);\n\tconst optionalFunctionality = !!(capability & 0b0001_0000);\n\tlet isFrequentListening: FLiRS;\n\tswitch (capability & 0b0110_0000) {\n\t\tcase 0b0100_0000:\n\t\t\tisFrequentListening = \"1000ms\";\n\t\t\tbreak;\n\t\tcase 0b0010_0000:\n\t\t\tisFrequentListening = \"250ms\";\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tisFrequentListening = false;\n\t}\n\tconst nodeType = NodeType[\"End Node\"];\n\tconst supportsSecurity = true;\n\tconst protocolVersion = 3;\n\tconst supportedDataRates: DataRate[] = [100000];\n\n\treturn {\n\t\tnodeId,\n\t\tisRouting,\n\t\tisListening,\n\t\tsupportsBeaming,\n\t\tisFrequentListening,\n\t\toptionalFunctionality,\n\t\tnodeType,\n\t\tsupportsSecurity,\n\t\tprotocolVersion,\n\t\tsupportedDataRates,\n\t\tgenericDeviceClass: buffer[offset + 1],\n\t\tspecificDeviceClass: hasSpecificDeviceClass ? buffer[offset + 2] : null,\n\t};\n}\n\nfunction encodeLRNodeInfo(nodeInfo: LRNodeInfo): Uint8Array {\n\tconst ret = new Bytes(LR_NODEINFO_SIZE);\n\n\tlet capability = 0;\n\tif (nodeInfo.isRouting) capability |= 0b0000_0001;\n\tif (nodeInfo.isListening) capability |= 0b0000_0010;\n\tif (nodeInfo.specificDeviceClass != null) capability |= 0b0000_0100;\n\tif (nodeInfo.supportsBeaming) capability |= 0b0000_1000;\n\tif (nodeInfo.optionalFunctionality) capability |= 0b0001_0000;\n\tif (nodeInfo.isFrequentListening === \"1000ms\") {\n\t\tcapability |= 0b0100_0000;\n\t} else if (nodeInfo.isFrequentListening === \"250ms\") {\n\t\tcapability |= 0b0010_0000;\n\t}\n\n\tret[0] = capability;\n\tret[1] = nodeInfo.genericDeviceClass;\n\tret[2] = nodeInfo.specificDeviceClass ?? 0;\n\n\treturn ret;\n}\n\nexport interface NodeInfoFileV0Options extends NVMFileCreationOptions {\n\tnodeInfo: NodeInfo;\n}\n\nexport const NodeInfoFileV0IDBase = 0x50100;\nexport function nodeIdToNodeInfoFileIDV0(nodeId: number): number {\n\treturn NodeInfoFileV0IDBase + nodeId - 1;\n}\n\n@nvmFileID(\n\t(id) => id >= NodeInfoFileV0IDBase && id < NodeInfoFileV0IDBase + MAX_NODES,\n)\n@nvmSection(\"protocol\")\nexport class NodeInfoFileV0 extends NVMFile {\n\tpublic constructor(\n\t\toptions: NVMFileDeserializationOptions | NodeInfoFileV0Options,\n\t) {\n\t\tsuper(options);\n\t\tif (gotDeserializationOptions(options)) {\n\t\t\tthis.nodeInfo = parseNodeInfo(\n\t\t\t\tthis.fileId - NodeInfoFileV0IDBase + 1,\n\t\t\t\tthis.payload,\n\t\t\t\t0,\n\t\t\t);\n\t\t} else {\n\t\t\tthis.nodeInfo = options.nodeInfo;\n\t\t}\n\t}\n\n\tpublic nodeInfo: NodeInfo;\n\n\tpublic serialize(): NVM3Object & { data: Bytes } {\n\t\tthis.fileId = nodeIdToNodeInfoFileIDV0(this.nodeInfo.nodeId);\n\t\tthis.payload = encodeNodeInfo(this.nodeInfo);\n\t\treturn super.serialize();\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic toJSON() {\n\t\treturn {\n\t\t\t...super.toJSON(),\n\t\t\tnodeInfo: this.nodeInfo,\n\t\t};\n\t}\n}\n\nexport interface NodeInfoFileV1Options extends NVMFileCreationOptions {\n\tnodeInfos: NodeInfo[];\n}\n\nexport const NodeInfoFileV1IDBase = 0x50200;\nexport function nodeIdToNodeInfoFileIDV1(nodeId: number): number {\n\treturn (\n\t\tNodeInfoFileV1IDBase + Math.floor((nodeId - 1) / NODEINFOS_PER_FILE_V1)\n\t);\n}\n\n@nvmFileID(\n\t(id) =>\n\t\tid >= NodeInfoFileV1IDBase\n\t\t&& id < NodeInfoFileV1IDBase + MAX_NODES / NODEINFOS_PER_FILE_V1,\n)\n@nvmSection(\"protocol\")\nexport class NodeInfoFileV1 extends NVMFile {\n\tpublic constructor(\n\t\toptions: NVMFileDeserializationOptions | NodeInfoFileV1Options,\n\t) {\n\t\tsuper(options);\n\t\tif (gotDeserializationOptions(options)) {\n\t\t\tthis.nodeInfos = [];\n\t\t\tfor (let i = 0; i < NODEINFOS_PER_FILE_V1; i++) {\n\t\t\t\tconst nodeId = (this.fileId - NodeInfoFileV1IDBase)\n\t\t\t\t\t\t* NODEINFOS_PER_FILE_V1\n\t\t\t\t\t+ 1\n\t\t\t\t\t+ i;\n\t\t\t\tconst offset = i * NODEINFO_SIZE;\n\t\t\t\tconst entry = this.payload.subarray(\n\t\t\t\t\toffset,\n\t\t\t\t\toffset + NODEINFO_SIZE,\n\t\t\t\t);\n\t\t\t\tif (entry.equals(emptyNodeInfo)) continue;\n\n\t\t\t\tconst nodeInfo = parseNodeInfo(\n\t\t\t\t\tnodeId,\n\t\t\t\t\tentry,\n\t\t\t\t\t0,\n\t\t\t\t);\n\t\t\t\tthis.nodeInfos.push(nodeInfo);\n\t\t\t}\n\t\t} else {\n\t\t\tthis.nodeInfos = options.nodeInfos;\n\t\t}\n\t}\n\n\tpublic nodeInfos: NodeInfo[];\n\n\tpublic serialize(): NVM3Object & { data: Bytes } {\n\t\t// The infos must be sorted by node ID\n\t\tthis.nodeInfos.sort((a, b) => a.nodeId - b.nodeId);\n\t\tconst minNodeId = this.nodeInfos[0].nodeId;\n\t\tthis.fileId = nodeIdToNodeInfoFileIDV1(minNodeId);\n\n\t\tthis.payload = new Bytes(NODEINFO_SIZE * NODEINFOS_PER_FILE_V1).fill(\n\t\t\tEMPTY_NODEINFO_FILL,\n\t\t);\n\n\t\tconst minFileNodeId =\n\t\t\tMath.floor((minNodeId - 1) / NODEINFOS_PER_FILE_V1)\n\t\t\t\t* NODEINFOS_PER_FILE_V1\n\t\t\t+ 1;\n\n\t\tfor (const nodeInfo of this.nodeInfos) {\n\t\t\tconst offset = (nodeInfo.nodeId - minFileNodeId) * NODEINFO_SIZE;\n\t\t\tthis.payload.set(encodeNodeInfo(nodeInfo), offset);\n\t\t}\n\n\t\treturn super.serialize();\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic toJSON() {\n\t\treturn {\n\t\t\t...super.toJSON(),\n\t\t\t\"node infos\": this.nodeInfos,\n\t\t};\n\t}\n}\n\nexport interface LRNodeInfoFileV5Options extends NVMFileCreationOptions {\n\tnodeInfos: LRNodeInfo[];\n}\n\nexport const LRNodeInfoFileV5IDBase = 0x50800;\nexport function nodeIdToLRNodeInfoFileIDV5(nodeId: number): number {\n\treturn (\n\t\tLRNodeInfoFileV5IDBase\n\t\t+ Math.floor((nodeId - 256) / LR_NODEINFOS_PER_FILE_V5)\n\t);\n}\n\n// Counting starts with 5, because we only implemented this after reaching protocol file format 5\n@nvmFileID(\n\t(id) =>\n\t\tid >= LRNodeInfoFileV5IDBase\n\t\t&& id\n\t\t\t< LRNodeInfoFileV5IDBase + MAX_NODES_LR / LR_NODEINFOS_PER_FILE_V5,\n)\n@nvmSection(\"protocol\")\nexport class LRNodeInfoFileV5 extends NVMFile {\n\tpublic constructor(\n\t\toptions: NVMFileDeserializationOptions | LRNodeInfoFileV5Options,\n\t) {\n\t\tsuper(options);\n\t\tif (gotDeserializationOptions(options)) {\n\t\t\tthis.nodeInfos = [];\n\t\t\tfor (let i = 0; i < LR_NODEINFOS_PER_FILE_V5; i++) {\n\t\t\t\tconst nodeId = (this.fileId - LRNodeInfoFileV5IDBase)\n\t\t\t\t\t\t* LR_NODEINFOS_PER_FILE_V5\n\t\t\t\t\t+ 256\n\t\t\t\t\t+ i;\n\t\t\t\tconst offset = i * LR_NODEINFO_SIZE;\n\t\t\t\tconst entry = this.payload.subarray(\n\t\t\t\t\toffset,\n\t\t\t\t\toffset + LR_NODEINFO_SIZE,\n\t\t\t\t);\n\t\t\t\tif (entry.equals(emptyNodeInfo)) continue;\n\n\t\t\t\tconst nodeInfo = parseLRNodeInfo(\n\t\t\t\t\tnodeId,\n\t\t\t\t\tentry,\n\t\t\t\t\t0,\n\t\t\t\t);\n\t\t\t\tthis.nodeInfos.push(nodeInfo);\n\t\t\t}\n\t\t} else {\n\t\t\tthis.nodeInfos = options.nodeInfos;\n\t\t}\n\t}\n\n\tpublic nodeInfos: LRNodeInfo[];\n\n\tpublic serialize(): NVM3Object & { data: Bytes } {\n\t\t// The infos must be sorted by node ID\n\t\tthis.nodeInfos.sort((a, b) => a.nodeId - b.nodeId);\n\t\tconst minNodeId = this.nodeInfos[0].nodeId;\n\t\tthis.fileId = nodeIdToLRNodeInfoFileIDV5(minNodeId);\n\n\t\tthis.payload = new Bytes(LR_NODEINFO_SIZE * LR_NODEINFOS_PER_FILE_V5)\n\t\t\t.fill(EMPTY_NODEINFO_FILL);\n\n\t\tconst minFileNodeId =\n\t\t\tMath.floor((minNodeId - 256) / LR_NODEINFOS_PER_FILE_V5)\n\t\t\t\t* LR_NODEINFOS_PER_FILE_V5\n\t\t\t+ 256;\n\n\t\tfor (const nodeInfo of this.nodeInfos) {\n\t\t\tconst offset = (nodeInfo.nodeId - minFileNodeId) * LR_NODEINFO_SIZE;\n\t\t\tthis.payload.set(encodeLRNodeInfo(nodeInfo), offset);\n\t\t}\n\n\t\treturn super.serialize();\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic toJSON() {\n\t\treturn {\n\t\t\t...super.toJSON(),\n\t\t\t\"node infos\": this.nodeInfos,\n\t\t};\n\t}\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kBAYO;AACP,IAAAA,eAA4B;AAE5B,qBAOO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAM,wBAAwB;AAC9B,MAAM,2BAA2B;AACxC,MAAM,gBAAgB,IAAI,IAAI;AAC9B,MAAM,mBAAmB;AACzB,MAAM,sBAAsB;AAC5B,MAAM,gBAAgB,IAAI,WAAW,aAAa,EAAE,KAAK,mBAAmB;AAY5E,SAAS,cACR,QACA,QACA,QAAc;AAEd,QAAM,EAAE,wBAAwB,GAAG,aAAY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AM,EAAE,SAAS,EAAE,MAAM;AACjD,YAAM,YAAY,KAAK,UAAU,CAAC,EAAE;AACpC,WAAK,SAAS,2BAA2B,SAAS;AAElD,WAAK,UAAU,IAAI,mBAAM,mBAAmB,wBAAwB,EAClE,KAAK,mBAAmB;AAE1B,YAAM,gBACL,KAAK,OAAO,YAAY,OAAO,wBAAwB,IACpD,2BACD;AAEH,iBAAW,YAAY,KAAK,WAAW;AACtC,cAAM,UAAU,SAAS,SAAS,iBAAiB;AACnD,aAAK,QAAQ,IAAI,iBAAiB,QAAQ,GAAG,MAAM;MACpD;AAEA,aAAO,MAAM,UAAS;IACvB;;IAGO,SAAM;AACZ,aAAO;QACN,GAAG,MAAM,OAAM;QACf,cAAc,KAAK;;IAErB;;;;",
6
- "names": ["import_safe"]
4
+ "sourcesContent": ["import {\n\ttype DataRate,\n\ttype FLiRS,\n\tMAX_NODES,\n\tMAX_NODES_LR,\n\tNUM_NODEMASK_BYTES,\n\ttype NodeProtocolInfo,\n\tNodeType,\n\tencodeBitMask,\n\tencodeNodeProtocolInfo,\n\tparseBitMask,\n\tparseNodeProtocolInfo,\n} from \"@zwave-js/core\";\nimport { Bytes, pick } from \"@zwave-js/shared\";\nimport type { NVM3Object } from \"../object.js\";\nimport {\n\tNVMFile,\n\ttype NVMFileCreationOptions,\n\ttype NVMFileDeserializationOptions,\n\tgotDeserializationOptions,\n\tnvmFileID,\n\tnvmSection,\n} from \"./NVMFile.js\";\n\nexport const NODEINFOS_PER_FILE_V1 = 4;\nexport const LR_NODEINFOS_PER_FILE_V5 = 50;\nconst NODEINFO_SIZE = 1 + 5 + NUM_NODEMASK_BYTES;\nconst LR_NODEINFO_SIZE = 3;\nconst EMPTY_NODEINFO_FILL = 0xff;\nconst emptyNodeInfo = new Uint8Array(NODEINFO_SIZE).fill(EMPTY_NODEINFO_FILL);\n\nexport interface NodeInfo\n\textends Omit<NodeProtocolInfo, \"hasSpecificDeviceClass\">\n{\n\tnodeId: number;\n\tgenericDeviceClass: number;\n\tspecificDeviceClass?: number | null;\n\tneighbors: number[];\n\tsucUpdateIndex: number;\n}\n\nfunction parseNodeInfo(\n\tnodeId: number,\n\tbuffer: Uint8Array,\n\toffset: number,\n): NodeInfo {\n\tconst { hasSpecificDeviceClass, ...protocolInfo } = parseNodeProtocolInfo(\n\t\tbuffer,\n\t\toffset,\n\t);\n\tconst genericDeviceClass = buffer[offset + 3];\n\tconst specificDeviceClass = hasSpecificDeviceClass\n\t\t? buffer[offset + 4]\n\t\t: null;\n\tconst neighbors = parseBitMask(\n\t\tbuffer.subarray(offset + 5, offset + 5 + NUM_NODEMASK_BYTES),\n\t);\n\tconst sucUpdateIndex = buffer[offset + 5 + NUM_NODEMASK_BYTES];\n\treturn {\n\t\tnodeId,\n\t\t...protocolInfo,\n\t\tgenericDeviceClass,\n\t\tspecificDeviceClass,\n\t\tneighbors,\n\t\tsucUpdateIndex,\n\t};\n}\n\nfunction encodeNodeInfo(nodeInfo: NodeInfo): Bytes {\n\tconst ret = new Bytes(NODEINFO_SIZE);\n\n\tconst hasSpecificDeviceClass = nodeInfo.specificDeviceClass != null;\n\tconst protocolInfo: NodeProtocolInfo = {\n\t\t...pick(nodeInfo, [\n\t\t\t\"isListening\",\n\t\t\t\"isFrequentListening\",\n\t\t\t\"isRouting\",\n\t\t\t\"supportedDataRates\",\n\t\t\t\"protocolVersion\",\n\t\t\t\"optionalFunctionality\",\n\t\t\t\"nodeType\",\n\t\t\t\"supportsSecurity\",\n\t\t\t\"supportsBeaming\",\n\t\t]),\n\t\thasSpecificDeviceClass,\n\t};\n\tret.set(encodeNodeProtocolInfo(protocolInfo), 0);\n\n\tret[3] = nodeInfo.genericDeviceClass;\n\tif (hasSpecificDeviceClass) ret[4] = nodeInfo.specificDeviceClass!;\n\tret.set(encodeBitMask(nodeInfo.neighbors, MAX_NODES), 5);\n\tret[5 + NUM_NODEMASK_BYTES] = nodeInfo.sucUpdateIndex;\n\n\treturn ret;\n}\n\nexport interface LRNodeInfo\n\textends Omit<NodeProtocolInfo, \"hasSpecificDeviceClass\">\n{\n\tnodeId: number;\n\tgenericDeviceClass: number;\n\tspecificDeviceClass?: number | null;\n}\n\nfunction parseLRNodeInfo(\n\tnodeId: number,\n\tbuffer: Uint8Array,\n\toffset: number,\n): LRNodeInfo {\n\t// The node info in LR NVM files is packed:\n\t// Byte 0 CAPABILITY:\n\t// Bit 0: Routing (?)\n\t// Bit 1: Listening\n\t// Bit 2: has specific device class (?)\n\t// Bit 3: Beam capability\n\t// Bit 4: Optional functionality\n\t// Bits 5-6: FLiRS\n\t// Bit 7: Unused (?)\n\t// Byte 1: Generic device class\n\t// Byte 2: Specific device class\n\n\t// Protocol version is always 3\n\t// Security is always true\n\t// Supported speed is always 100kbps (speed = 0, speed ext = 2)\n\t// Never: routing end node, controller\n\n\tconst capability = buffer[offset];\n\tconst isRouting = !!(capability & 0b0000_0001); // ZWLR Mesh??\n\tconst isListening = !!(capability & 0b0000_0010);\n\tconst hasSpecificDeviceClass = !!(capability & 0b0000_0100);\n\tconst supportsBeaming = !!(capability & 0b0000_1000);\n\tconst optionalFunctionality = !!(capability & 0b0001_0000);\n\tlet isFrequentListening: FLiRS;\n\tswitch (capability & 0b0110_0000) {\n\t\tcase 0b0100_0000:\n\t\t\tisFrequentListening = \"1000ms\";\n\t\t\tbreak;\n\t\tcase 0b0010_0000:\n\t\t\tisFrequentListening = \"250ms\";\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tisFrequentListening = false;\n\t}\n\tconst nodeType = NodeType[\"End Node\"];\n\tconst supportsSecurity = true;\n\tconst protocolVersion = 3;\n\tconst supportedDataRates: DataRate[] = [100000];\n\n\treturn {\n\t\tnodeId,\n\t\tisRouting,\n\t\tisListening,\n\t\tsupportsBeaming,\n\t\tisFrequentListening,\n\t\toptionalFunctionality,\n\t\tnodeType,\n\t\tsupportsSecurity,\n\t\tprotocolVersion,\n\t\tsupportedDataRates,\n\t\tgenericDeviceClass: buffer[offset + 1],\n\t\tspecificDeviceClass: hasSpecificDeviceClass ? buffer[offset + 2] : null,\n\t};\n}\n\nfunction encodeLRNodeInfo(nodeInfo: LRNodeInfo): Uint8Array {\n\tconst ret = new Bytes(LR_NODEINFO_SIZE);\n\n\tlet capability = 0;\n\tif (nodeInfo.isRouting) capability |= 0b0000_0001;\n\tif (nodeInfo.isListening) capability |= 0b0000_0010;\n\tif (nodeInfo.specificDeviceClass != null) capability |= 0b0000_0100;\n\tif (nodeInfo.supportsBeaming) capability |= 0b0000_1000;\n\tif (nodeInfo.optionalFunctionality) capability |= 0b0001_0000;\n\tif (nodeInfo.isFrequentListening === \"1000ms\") {\n\t\tcapability |= 0b0100_0000;\n\t} else if (nodeInfo.isFrequentListening === \"250ms\") {\n\t\tcapability |= 0b0010_0000;\n\t}\n\n\tret[0] = capability;\n\tret[1] = nodeInfo.genericDeviceClass;\n\tret[2] = nodeInfo.specificDeviceClass ?? 0;\n\n\treturn ret;\n}\n\nexport interface NodeInfoFileV0Options extends NVMFileCreationOptions {\n\tnodeInfo: NodeInfo;\n}\n\nexport const NodeInfoFileV0IDBase = 0x50100;\nexport function nodeIdToNodeInfoFileIDV0(nodeId: number): number {\n\treturn NodeInfoFileV0IDBase + nodeId - 1;\n}\n\n@nvmFileID(\n\t(id) => id >= NodeInfoFileV0IDBase && id < NodeInfoFileV0IDBase + MAX_NODES,\n)\n@nvmSection(\"protocol\")\nexport class NodeInfoFileV0 extends NVMFile {\n\tpublic constructor(\n\t\toptions: NVMFileDeserializationOptions | NodeInfoFileV0Options,\n\t) {\n\t\tsuper(options);\n\t\tif (gotDeserializationOptions(options)) {\n\t\t\tthis.nodeInfo = parseNodeInfo(\n\t\t\t\tthis.fileId - NodeInfoFileV0IDBase + 1,\n\t\t\t\tthis.payload,\n\t\t\t\t0,\n\t\t\t);\n\t\t} else {\n\t\t\tthis.nodeInfo = options.nodeInfo;\n\t\t}\n\t}\n\n\tpublic nodeInfo: NodeInfo;\n\n\tpublic serialize(): NVM3Object & { data: Bytes } {\n\t\tthis.fileId = nodeIdToNodeInfoFileIDV0(this.nodeInfo.nodeId);\n\t\tthis.payload = encodeNodeInfo(this.nodeInfo);\n\t\treturn super.serialize();\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic toJSON() {\n\t\treturn {\n\t\t\t...super.toJSON(),\n\t\t\tnodeInfo: this.nodeInfo,\n\t\t};\n\t}\n}\n\nexport interface NodeInfoFileV1Options extends NVMFileCreationOptions {\n\tnodeInfos: NodeInfo[];\n}\n\nexport const NodeInfoFileV1IDBase = 0x50200;\nexport function nodeIdToNodeInfoFileIDV1(nodeId: number): number {\n\treturn (\n\t\tNodeInfoFileV1IDBase + Math.floor((nodeId - 1) / NODEINFOS_PER_FILE_V1)\n\t);\n}\n\n@nvmFileID(\n\t(id) =>\n\t\tid >= NodeInfoFileV1IDBase\n\t\t&& id < NodeInfoFileV1IDBase + MAX_NODES / NODEINFOS_PER_FILE_V1,\n)\n@nvmSection(\"protocol\")\nexport class NodeInfoFileV1 extends NVMFile {\n\tpublic constructor(\n\t\toptions: NVMFileDeserializationOptions | NodeInfoFileV1Options,\n\t) {\n\t\tsuper(options);\n\t\tif (gotDeserializationOptions(options)) {\n\t\t\tthis.nodeInfos = [];\n\t\t\tfor (let i = 0; i < NODEINFOS_PER_FILE_V1; i++) {\n\t\t\t\tconst nodeId = (this.fileId - NodeInfoFileV1IDBase)\n\t\t\t\t\t\t* NODEINFOS_PER_FILE_V1\n\t\t\t\t\t+ 1\n\t\t\t\t\t+ i;\n\t\t\t\tconst offset = i * NODEINFO_SIZE;\n\t\t\t\tconst entry = this.payload.subarray(\n\t\t\t\t\toffset,\n\t\t\t\t\toffset + NODEINFO_SIZE,\n\t\t\t\t);\n\t\t\t\tif (entry.equals(emptyNodeInfo)) continue;\n\n\t\t\t\tconst nodeInfo = parseNodeInfo(\n\t\t\t\t\tnodeId,\n\t\t\t\t\tentry,\n\t\t\t\t\t0,\n\t\t\t\t);\n\t\t\t\tthis.nodeInfos.push(nodeInfo);\n\t\t\t}\n\t\t} else {\n\t\t\tthis.nodeInfos = options.nodeInfos;\n\t\t}\n\t}\n\n\tpublic nodeInfos: NodeInfo[];\n\n\tpublic serialize(): NVM3Object & { data: Bytes } {\n\t\t// The infos must be sorted by node ID\n\t\tthis.nodeInfos.sort((a, b) => a.nodeId - b.nodeId);\n\t\tconst minNodeId = this.nodeInfos[0].nodeId;\n\t\tthis.fileId = nodeIdToNodeInfoFileIDV1(minNodeId);\n\n\t\tthis.payload = new Bytes(NODEINFO_SIZE * NODEINFOS_PER_FILE_V1).fill(\n\t\t\tEMPTY_NODEINFO_FILL,\n\t\t);\n\n\t\tconst minFileNodeId =\n\t\t\tMath.floor((minNodeId - 1) / NODEINFOS_PER_FILE_V1)\n\t\t\t\t* NODEINFOS_PER_FILE_V1\n\t\t\t+ 1;\n\n\t\tfor (const nodeInfo of this.nodeInfos) {\n\t\t\tconst offset = (nodeInfo.nodeId - minFileNodeId) * NODEINFO_SIZE;\n\t\t\tthis.payload.set(encodeNodeInfo(nodeInfo), offset);\n\t\t}\n\n\t\treturn super.serialize();\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic toJSON() {\n\t\treturn {\n\t\t\t...super.toJSON(),\n\t\t\t\"node infos\": this.nodeInfos,\n\t\t};\n\t}\n}\n\nexport interface LRNodeInfoFileV5Options extends NVMFileCreationOptions {\n\tnodeInfos: LRNodeInfo[];\n}\n\nexport const LRNodeInfoFileV5IDBase = 0x50800;\nexport function nodeIdToLRNodeInfoFileIDV5(nodeId: number): number {\n\treturn (\n\t\tLRNodeInfoFileV5IDBase\n\t\t+ Math.floor((nodeId - 256) / LR_NODEINFOS_PER_FILE_V5)\n\t);\n}\n\n// Counting starts with 5, because we only implemented this after reaching protocol file format 5\n@nvmFileID(\n\t(id) =>\n\t\tid >= LRNodeInfoFileV5IDBase\n\t\t&& id\n\t\t\t< LRNodeInfoFileV5IDBase + MAX_NODES_LR / LR_NODEINFOS_PER_FILE_V5,\n)\n@nvmSection(\"protocol\")\nexport class LRNodeInfoFileV5 extends NVMFile {\n\tpublic constructor(\n\t\toptions: NVMFileDeserializationOptions | LRNodeInfoFileV5Options,\n\t) {\n\t\tsuper(options);\n\t\tif (gotDeserializationOptions(options)) {\n\t\t\tthis.nodeInfos = [];\n\t\t\tfor (let i = 0; i < LR_NODEINFOS_PER_FILE_V5; i++) {\n\t\t\t\tconst nodeId = (this.fileId - LRNodeInfoFileV5IDBase)\n\t\t\t\t\t\t* LR_NODEINFOS_PER_FILE_V5\n\t\t\t\t\t+ 256\n\t\t\t\t\t+ i;\n\t\t\t\tconst offset = i * LR_NODEINFO_SIZE;\n\t\t\t\tconst entry = this.payload.subarray(\n\t\t\t\t\toffset,\n\t\t\t\t\toffset + LR_NODEINFO_SIZE,\n\t\t\t\t);\n\t\t\t\tif (entry.equals(emptyNodeInfo)) continue;\n\n\t\t\t\tconst nodeInfo = parseLRNodeInfo(\n\t\t\t\t\tnodeId,\n\t\t\t\t\tentry,\n\t\t\t\t\t0,\n\t\t\t\t);\n\t\t\t\tthis.nodeInfos.push(nodeInfo);\n\t\t\t}\n\t\t} else {\n\t\t\tthis.nodeInfos = options.nodeInfos;\n\t\t}\n\t}\n\n\tpublic nodeInfos: LRNodeInfo[];\n\n\tpublic serialize(): NVM3Object & { data: Bytes } {\n\t\t// The infos must be sorted by node ID\n\t\tthis.nodeInfos.sort((a, b) => a.nodeId - b.nodeId);\n\t\tconst minNodeId = this.nodeInfos[0].nodeId;\n\t\tthis.fileId = nodeIdToLRNodeInfoFileIDV5(minNodeId);\n\n\t\tthis.payload = new Bytes(LR_NODEINFO_SIZE * LR_NODEINFOS_PER_FILE_V5)\n\t\t\t.fill(EMPTY_NODEINFO_FILL);\n\n\t\tconst minFileNodeId =\n\t\t\tMath.floor((minNodeId - 256) / LR_NODEINFOS_PER_FILE_V5)\n\t\t\t\t* LR_NODEINFOS_PER_FILE_V5\n\t\t\t+ 256;\n\n\t\tfor (const nodeInfo of this.nodeInfos) {\n\t\t\tconst offset = (nodeInfo.nodeId - minFileNodeId) * LR_NODEINFO_SIZE;\n\t\t\tthis.payload.set(encodeLRNodeInfo(nodeInfo), offset);\n\t\t}\n\n\t\treturn super.serialize();\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic toJSON() {\n\t\treturn {\n\t\t\t...super.toJSON(),\n\t\t\t\"node infos\": this.nodeInfos,\n\t\t};\n\t}\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kBAYO;AACP,oBAA4B;AAE5B,qBAOO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAM,wBAAwB;AAC9B,MAAM,2BAA2B;AACxC,MAAM,gBAAgB,IAAI,IAAI;AAC9B,MAAM,mBAAmB;AACzB,MAAM,sBAAsB;AAC5B,MAAM,gBAAgB,IAAI,WAAW,aAAa,EAAE,KAAK,mBAAmB;AAY5E,SAAS,cACR,QACA,QACA,QAAc;AAEd,QAAM,EAAE,wBAAwB,GAAG,aAAY,QAAK,mCACnD,QACA,MAAM;AAEP,QAAM,qBAAqB,OAAO,SAAS,CAAC;AAC5C,QAAM,sBAAsB,yBACzB,OAAO,SAAS,CAAC,IACjB;AACH,QAAM,gBAAY,0BACjB,OAAO,SAAS,SAAS,GAAG,SAAS,IAAI,8BAAkB,CAAC;AAE7D,QAAM,iBAAiB,OAAO,SAAS,IAAI,8BAAkB;AAC7D,SAAO;IACN;IACA,GAAG;IACH;IACA;IACA;IACA;;AAEF;AAzBS;AA2BT,SAAS,eAAe,UAAkB;AACzC,QAAM,MAAM,IAAI,oBAAM,aAAa;AAEnC,QAAM,yBAAyB,SAAS,uBAAuB;AAC/D,QAAM,eAAiC;IACtC,OAAG,oBAAK,UAAU;MACjB;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;KACA;IACD;;AAED,MAAI,QAAI,oCAAuB,Y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-js/shared/safe";
1
+ import type { Bytes } from "@zwave-js/shared";
2
2
  import type { NVM3Object } from "../object.js";
3
3
  import { NVMFile, type NVMFileCreationOptions, type NVMFileDeserializationOptions } from "./NVMFile.js";
4
4
  export interface ProtocolNodeMaskFileOptions extends NVMFileCreationOptions {
@@ -40,7 +40,7 @@ __export(ProtocolNodeMaskFiles_exports, {
40
40
  ProtocolVirtualNodeMaskFileID: () => ProtocolVirtualNodeMaskFileID
41
41
  });
42
42
  module.exports = __toCommonJS(ProtocolNodeMaskFiles_exports);
43
- var import_safe = require("@zwave-js/core/safe");
43
+ var import_core = require("@zwave-js/core");
44
44
  var import_NVMFile = require("./NVMFile.js");
45
45
  var __esDecorate = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
46
46
  function accept(f) {
@@ -89,7 +89,7 @@ class ProtocolNodeMaskFile extends import_NVMFile.NVMFile {
89
89
  constructor(options) {
90
90
  super(options);
91
91
  if ((0, import_NVMFile.gotDeserializationOptions)(options)) {
92
- this.nodeIdSet = new Set((0, import_safe.parseBitMask)(this.payload));
92
+ this.nodeIdSet = new Set((0, import_core.parseBitMask)(this.payload));
93
93
  } else {
94
94
  this.nodeIdSet = new Set(options.nodeIds);
95
95
  }
@@ -102,7 +102,7 @@ class ProtocolNodeMaskFile extends import_NVMFile.NVMFile {
102
102
  this.nodeIdSet = new Set(value);
103
103
  }
104
104
  serialize() {
105
- this.payload = (0, import_safe.encodeBitMask)([...this.nodeIdSet], import_safe.NODE_ID_MAX);
105
+ this.payload = (0, import_core.encodeBitMask)([...this.nodeIdSet], import_core.NODE_ID_MAX);
106
106
  return super.serialize();
107
107
  }
108
108
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
@@ -329,7 +329,7 @@ let ProtocolLRNodeListFile = (() => {
329
329
  constructor(options) {
330
330
  super(options);
331
331
  if ((0, import_NVMFile.gotDeserializationOptions)(options)) {
332
- this.nodeIdSet = new Set((0, import_safe.parseBitMask)(this.payload, 256));
332
+ this.nodeIdSet = new Set((0, import_core.parseBitMask)(this.payload, 256));
333
333
  } else {
334
334
  this.nodeIdSet = new Set(options.nodeIds);
335
335
  }
@@ -342,7 +342,7 @@ let ProtocolLRNodeListFile = (() => {
342
342
  this.nodeIdSet = new Set(value);
343
343
  }
344
344
  serialize() {
345
- this.payload = (0, import_safe.encodeBitMask)([...this.nodeIdSet], 1279, 256);
345
+ this.payload = (0, import_core.encodeBitMask)([...this.nodeIdSet], 1279, 256);
346
346
  return super.serialize();
347
347
  }
348
348
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/lib/nvm3/files/ProtocolNodeMaskFiles.ts"],
4
- "sourcesContent": ["import { NODE_ID_MAX, encodeBitMask, parseBitMask } from \"@zwave-js/core/safe\";\nimport { type Bytes } from \"@zwave-js/shared/safe\";\nimport type { NVM3Object } from \"../object.js\";\nimport {\n\tNVMFile,\n\ttype NVMFileCreationOptions,\n\ttype NVMFileDeserializationOptions,\n\tgotDeserializationOptions,\n\tnvmFileID,\n\tnvmSection,\n} from \"./NVMFile.js\";\n\nexport interface ProtocolNodeMaskFileOptions extends NVMFileCreationOptions {\n\tnodeIds: number[];\n}\n\nexport class ProtocolNodeMaskFile extends NVMFile {\n\tpublic constructor(\n\t\toptions: NVMFileDeserializationOptions | ProtocolNodeMaskFileOptions,\n\t) {\n\t\tsuper(options);\n\t\tif (gotDeserializationOptions(options)) {\n\t\t\tthis.nodeIdSet = new Set(parseBitMask(this.payload));\n\t\t} else {\n\t\t\tthis.nodeIdSet = new Set(options.nodeIds);\n\t\t}\n\t}\n\n\tpublic nodeIdSet: Set<number>;\n\tpublic get nodeIds(): number[] {\n\t\treturn [...this.nodeIdSet];\n\t}\n\tpublic set nodeIds(value: number[]) {\n\t\tthis.nodeIdSet = new Set(value);\n\t}\n\n\tpublic serialize(): NVM3Object & { data: Bytes } {\n\t\tthis.payload = encodeBitMask([...this.nodeIdSet], NODE_ID_MAX);\n\t\treturn super.serialize();\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic toJSON() {\n\t\treturn {\n\t\t\t...super.toJSON(),\n\t\t\t\"node IDs\": [...this.nodeIdSet].join(\", \"),\n\t\t};\n\t}\n}\n\nexport const ProtocolPreferredRepeatersFileID = 0x50002;\n\n@nvmFileID(ProtocolPreferredRepeatersFileID)\n@nvmSection(\"protocol\")\nexport class ProtocolPreferredRepeatersFile extends ProtocolNodeMaskFile {}\n\nexport const ProtocolNodeListFileID = 0x50005;\n\n@nvmFileID(ProtocolNodeListFileID)\n@nvmSection(\"protocol\")\nexport class ProtocolNodeListFile extends ProtocolNodeMaskFile {}\n\nexport const ProtocolAppRouteLockNodeMaskFileID = 0x50006;\n\n@nvmFileID(ProtocolAppRouteLockNodeMaskFileID)\n@nvmSection(\"protocol\")\nexport class ProtocolAppRouteLockNodeMaskFile extends ProtocolNodeMaskFile {}\n\nexport const ProtocolRouteSlaveSUCNodeMaskFileID = 0x50007;\n\n@nvmFileID(ProtocolRouteSlaveSUCNodeMaskFileID)\n@nvmSection(\"protocol\")\nexport class ProtocolRouteSlaveSUCNodeMaskFile extends ProtocolNodeMaskFile {}\n\nexport const ProtocolSUCPendingUpdateNodeMaskFileID = 0x50008;\n\n@nvmFileID(ProtocolSUCPendingUpdateNodeMaskFileID)\n@nvmSection(\"protocol\")\nexport class ProtocolSUCPendingUpdateNodeMaskFile\n\textends ProtocolNodeMaskFile\n{}\n\nexport const ProtocolVirtualNodeMaskFileID = 0x50009;\n\n@nvmFileID(ProtocolVirtualNodeMaskFileID)\n@nvmSection(\"protocol\")\nexport class ProtocolVirtualNodeMaskFile extends ProtocolNodeMaskFile {}\n\nexport const ProtocolPendingDiscoveryNodeMaskFileID = 0x5000a;\n\n@nvmFileID(ProtocolPendingDiscoveryNodeMaskFileID)\n@nvmSection(\"protocol\")\nexport class ProtocolPendingDiscoveryNodeMaskFile\n\textends ProtocolNodeMaskFile\n{}\n\nexport const ProtocolRouteCacheExistsNodeMaskFileID = 0x5000b;\n\n@nvmFileID(ProtocolRouteCacheExistsNodeMaskFileID)\n@nvmSection(\"protocol\")\nexport class ProtocolRouteCacheExistsNodeMaskFile\n\textends ProtocolNodeMaskFile\n{}\n\nexport const ProtocolLRNodeListFileID = 0x5000c;\n\n@nvmFileID(ProtocolLRNodeListFileID)\n@nvmSection(\"protocol\")\nexport class ProtocolLRNodeListFile extends NVMFile {\n\tpublic constructor(\n\t\toptions: NVMFileDeserializationOptions | ProtocolNodeMaskFileOptions,\n\t) {\n\t\tsuper(options);\n\t\tif (gotDeserializationOptions(options)) {\n\t\t\tthis.nodeIdSet = new Set(parseBitMask(this.payload, 256));\n\t\t} else {\n\t\t\tthis.nodeIdSet = new Set(options.nodeIds);\n\t\t}\n\t}\n\n\tpublic nodeIdSet: Set<number>;\n\tpublic get nodeIds(): number[] {\n\t\treturn [...this.nodeIdSet];\n\t}\n\tpublic set nodeIds(value: number[]) {\n\t\tthis.nodeIdSet = new Set(value);\n\t}\n\n\tpublic serialize(): NVM3Object & { data: Bytes } {\n\t\t// There are only 128 bytes for the bitmask, so the LR node IDs only go up to 1279\n\t\tthis.payload = encodeBitMask([...this.nodeIdSet], 1279, 256);\n\t\treturn super.serialize();\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic toJSON() {\n\t\treturn {\n\t\t\t...super.toJSON(),\n\t\t\t\"node IDs\": [...this.nodeIdSet].join(\", \"),\n\t\t};\n\t}\n}\n"],
4
+ "sourcesContent": ["import { NODE_ID_MAX, encodeBitMask, parseBitMask } from \"@zwave-js/core\";\nimport type { Bytes } from \"@zwave-js/shared\";\nimport type { NVM3Object } from \"../object.js\";\nimport {\n\tNVMFile,\n\ttype NVMFileCreationOptions,\n\ttype NVMFileDeserializationOptions,\n\tgotDeserializationOptions,\n\tnvmFileID,\n\tnvmSection,\n} from \"./NVMFile.js\";\n\nexport interface ProtocolNodeMaskFileOptions extends NVMFileCreationOptions {\n\tnodeIds: number[];\n}\n\nexport class ProtocolNodeMaskFile extends NVMFile {\n\tpublic constructor(\n\t\toptions: NVMFileDeserializationOptions | ProtocolNodeMaskFileOptions,\n\t) {\n\t\tsuper(options);\n\t\tif (gotDeserializationOptions(options)) {\n\t\t\tthis.nodeIdSet = new Set(parseBitMask(this.payload));\n\t\t} else {\n\t\t\tthis.nodeIdSet = new Set(options.nodeIds);\n\t\t}\n\t}\n\n\tpublic nodeIdSet: Set<number>;\n\tpublic get nodeIds(): number[] {\n\t\treturn [...this.nodeIdSet];\n\t}\n\tpublic set nodeIds(value: number[]) {\n\t\tthis.nodeIdSet = new Set(value);\n\t}\n\n\tpublic serialize(): NVM3Object & { data: Bytes } {\n\t\tthis.payload = encodeBitMask([...this.nodeIdSet], NODE_ID_MAX);\n\t\treturn super.serialize();\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic toJSON() {\n\t\treturn {\n\t\t\t...super.toJSON(),\n\t\t\t\"node IDs\": [...this.nodeIdSet].join(\", \"),\n\t\t};\n\t}\n}\n\nexport const ProtocolPreferredRepeatersFileID = 0x50002;\n\n@nvmFileID(ProtocolPreferredRepeatersFileID)\n@nvmSection(\"protocol\")\nexport class ProtocolPreferredRepeatersFile extends ProtocolNodeMaskFile {}\n\nexport const ProtocolNodeListFileID = 0x50005;\n\n@nvmFileID(ProtocolNodeListFileID)\n@nvmSection(\"protocol\")\nexport class ProtocolNodeListFile extends ProtocolNodeMaskFile {}\n\nexport const ProtocolAppRouteLockNodeMaskFileID = 0x50006;\n\n@nvmFileID(ProtocolAppRouteLockNodeMaskFileID)\n@nvmSection(\"protocol\")\nexport class ProtocolAppRouteLockNodeMaskFile extends ProtocolNodeMaskFile {}\n\nexport const ProtocolRouteSlaveSUCNodeMaskFileID = 0x50007;\n\n@nvmFileID(ProtocolRouteSlaveSUCNodeMaskFileID)\n@nvmSection(\"protocol\")\nexport class ProtocolRouteSlaveSUCNodeMaskFile extends ProtocolNodeMaskFile {}\n\nexport const ProtocolSUCPendingUpdateNodeMaskFileID = 0x50008;\n\n@nvmFileID(ProtocolSUCPendingUpdateNodeMaskFileID)\n@nvmSection(\"protocol\")\nexport class ProtocolSUCPendingUpdateNodeMaskFile\n\textends ProtocolNodeMaskFile\n{}\n\nexport const ProtocolVirtualNodeMaskFileID = 0x50009;\n\n@nvmFileID(ProtocolVirtualNodeMaskFileID)\n@nvmSection(\"protocol\")\nexport class ProtocolVirtualNodeMaskFile extends ProtocolNodeMaskFile {}\n\nexport const ProtocolPendingDiscoveryNodeMaskFileID = 0x5000a;\n\n@nvmFileID(ProtocolPendingDiscoveryNodeMaskFileID)\n@nvmSection(\"protocol\")\nexport class ProtocolPendingDiscoveryNodeMaskFile\n\textends ProtocolNodeMaskFile\n{}\n\nexport const ProtocolRouteCacheExistsNodeMaskFileID = 0x5000b;\n\n@nvmFileID(ProtocolRouteCacheExistsNodeMaskFileID)\n@nvmSection(\"protocol\")\nexport class ProtocolRouteCacheExistsNodeMaskFile\n\textends ProtocolNodeMaskFile\n{}\n\nexport const ProtocolLRNodeListFileID = 0x5000c;\n\n@nvmFileID(ProtocolLRNodeListFileID)\n@nvmSection(\"protocol\")\nexport class ProtocolLRNodeListFile extends NVMFile {\n\tpublic constructor(\n\t\toptions: NVMFileDeserializationOptions | ProtocolNodeMaskFileOptions,\n\t) {\n\t\tsuper(options);\n\t\tif (gotDeserializationOptions(options)) {\n\t\t\tthis.nodeIdSet = new Set(parseBitMask(this.payload, 256));\n\t\t} else {\n\t\t\tthis.nodeIdSet = new Set(options.nodeIds);\n\t\t}\n\t}\n\n\tpublic nodeIdSet: Set<number>;\n\tpublic get nodeIds(): number[] {\n\t\treturn [...this.nodeIdSet];\n\t}\n\tpublic set nodeIds(value: number[]) {\n\t\tthis.nodeIdSet = new Set(value);\n\t}\n\n\tpublic serialize(): NVM3Object & { data: Bytes } {\n\t\t// There are only 128 bytes for the bitmask, so the LR node IDs only go up to 1279\n\t\tthis.payload = encodeBitMask([...this.nodeIdSet], 1279, 256);\n\t\treturn super.serialize();\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic toJSON() {\n\t\treturn {\n\t\t\t...super.toJSON(),\n\t\t\t\"node IDs\": [...this.nodeIdSet].join(\", \"),\n\t\t};\n\t}\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kBAAyD;AAGzD,qBAOO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMD,MAAO,6BAA6B,uBAAO;SAAA;;;EAChD,YACC,SAAoE;AAEpE,UAAM,OAAO;AACb,YAAI,0CAA0B,OAAO,GAAG;AACvC,WAAK,YAAY,IAAI,QAAI,0BAAa,KAAK,OAAO,CAAC;IACpD,OAAO;AACN,WAAK,YAAY,IAAI,IAAI,QAAQ,OAAO;IACzC;EACD;EAEO;EACP,IAAW,UAAO;AACjB,WAAO,CAAC,GAAG,KAAK,SAAS;EAC1B;EACA,IAAW,QAAQ,OAAe;AACjC,SAAK,YAAY,IAAI,IAAI,KAAK;EAC/B;EAEO,YAAS;AACf,SAAK,cAAU,2BAAc,CAAC,GAAG,KAAK,SAAS,GAAG,uBAAW;AAC7D,WAAO,MAAM,UAAS;EACvB;;EAGO,SAAM;AACZ,WAAO;MACN,GAAG,MAAM,OAAM;MACf,YAAY,CAAC,GAAG,KAAK,SAAS,EAAE,KAAK,IAAI;;EAE3C;;AAGM,MAAM,mCAAmC;IAInC,kCAA8B,MAAA;8BAF1C,0BAAU,gCAAgC,OAC1C,2BAAW,UAAU,CAAC;;;;oBAC6B;sDAAA,YAAoB;WAAA;;;;;;;;AAAxE,mBAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,wBA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S,GAAG,CAAC;MACzD,OAAO;AACN,aAAK,YAAY,IAAI,IAAI,QAAQ,OAAO;MACzC;IACD;IAEO;IACP,IAAW,UAAO;AACjB,aAAO,CAAC,GAAG,KAAK,SAAS;IAC1B;IACA,IAAW,QAAQ,OAAe;AACjC,WAAK,YAAY,IAAI,IAAI,KAAK;IAC/B;IAEO,YAAS;AAEf,WAAK,cAAU,2BAAc,CAAC,GAAG,KAAK,SAAS,GAAG,MAAM,GAAG;AAC3D,aAAO,MAAM,UAAS;IACvB;;IAGO,SAAM;AACZ,aAAO;QACN,GAAG,MAAM,OAAM;QACf,YAAY,CAAC,GAAG,KAAK,SAAS,EAAE,KAAK,IAAI;;IAE3C;;;;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- import { Bytes } from "@zwave-js/shared/safe";
1
+ import { Bytes } from "@zwave-js/shared";
2
2
  import { type RouteCache } from "../../common/routeCache.js";
3
3
  import type { NVM3Object } from "../object.js";
4
4
  import { NVMFile, type NVMFileCreationOptions, type NVMFileDeserializationOptions } from "./NVMFile.js";
@@ -28,8 +28,8 @@ __export(RouteCacheFiles_exports, {
28
28
  nodeIdToRouteCacheFileIDV1: () => nodeIdToRouteCacheFileIDV1
29
29
  });
30
30
  module.exports = __toCommonJS(RouteCacheFiles_exports);
31
- var import_safe = require("@zwave-js/core/safe");
32
- var import_safe2 = require("@zwave-js/shared/safe");
31
+ var import_core = require("@zwave-js/core");
32
+ var import_shared = require("@zwave-js/shared");
33
33
  var import_routeCache = require("../../common/routeCache.js");
34
34
  var import_NVMFile = require("./NVMFile.js");
35
35
  var __esDecorate = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
@@ -79,7 +79,7 @@ function nodeIdToRouteCacheFileIDV0(nodeId) {
79
79
  }
80
80
  __name(nodeIdToRouteCacheFileIDV0, "nodeIdToRouteCacheFileIDV0");
81
81
  let RouteCacheFileV0 = (() => {
82
- let _classDecorators = [(0, import_NVMFile.nvmFileID)((id) => id >= RouteCacheFileV0IDBase && id < RouteCacheFileV0IDBase + import_safe.MAX_NODES), (0, import_NVMFile.nvmSection)("protocol")];
82
+ let _classDecorators = [(0, import_NVMFile.nvmFileID)((id) => id >= RouteCacheFileV0IDBase && id < RouteCacheFileV0IDBase + import_core.MAX_NODES), (0, import_NVMFile.nvmSection)("protocol")];
83
83
  let _classDescriptor;
84
84
  let _classExtraInitializers = [];
85
85
  let _classThis;
@@ -103,7 +103,7 @@ let RouteCacheFileV0 = (() => {
103
103
  if ((0, import_NVMFile.gotDeserializationOptions)(options)) {
104
104
  const nodeId = this.fileId - RouteCacheFileV0IDBase + 1;
105
105
  const lwr = (0, import_routeCache.parseRoute)(this.payload, 0);
106
- const nlwr = (0, import_routeCache.parseRoute)(this.payload, import_safe.MAX_REPEATERS + 1);
106
+ const nlwr = (0, import_routeCache.parseRoute)(this.payload, import_core.MAX_REPEATERS + 1);
107
107
  this.routeCache = { nodeId, lwr, nlwr };
108
108
  } else {
109
109
  this.routeCache = options.routeCache;
@@ -112,7 +112,7 @@ let RouteCacheFileV0 = (() => {
112
112
  routeCache;
113
113
  serialize() {
114
114
  this.fileId = nodeIdToRouteCacheFileIDV0(this.routeCache.nodeId);
115
- this.payload = import_safe2.Bytes.concat([
115
+ this.payload = import_shared.Bytes.concat([
116
116
  (0, import_routeCache.encodeRoute)(this.routeCache.lwr),
117
117
  (0, import_routeCache.encodeRoute)(this.routeCache.nlwr)
118
118
  ]);
@@ -134,7 +134,7 @@ function nodeIdToRouteCacheFileIDV1(nodeId) {
134
134
  }
135
135
  __name(nodeIdToRouteCacheFileIDV1, "nodeIdToRouteCacheFileIDV1");
136
136
  let RouteCacheFileV1 = (() => {
137
- let _classDecorators = [(0, import_NVMFile.nvmFileID)((id) => id >= RouteCacheFileV1IDBase && id < RouteCacheFileV1IDBase + import_safe.MAX_NODES / ROUTECACHES_PER_FILE_V1), (0, import_NVMFile.nvmSection)("protocol")];
137
+ let _classDecorators = [(0, import_NVMFile.nvmFileID)((id) => id >= RouteCacheFileV1IDBase && id < RouteCacheFileV1IDBase + import_core.MAX_NODES / ROUTECACHES_PER_FILE_V1), (0, import_NVMFile.nvmSection)("protocol")];
138
138
  let _classDescriptor;
139
139
  let _classExtraInitializers = [];
140
140
  let _classThis;
@@ -158,13 +158,13 @@ let RouteCacheFileV1 = (() => {
158
158
  if ((0, import_NVMFile.gotDeserializationOptions)(options)) {
159
159
  this.routeCaches = [];
160
160
  for (let i = 0; i < ROUTECACHES_PER_FILE_V1; i++) {
161
- const offset = i * 2 * (import_safe.MAX_REPEATERS + 1);
162
- const entry = this.payload.subarray(offset, offset + 2 * (import_safe.MAX_REPEATERS + 1));
161
+ const offset = i * 2 * (import_core.MAX_REPEATERS + 1);
162
+ const entry = this.payload.subarray(offset, offset + 2 * (import_core.MAX_REPEATERS + 1));
163
163
  if (entry.equals(import_routeCache.emptyRouteCache))
164
164
  continue;
165
165
  const nodeId = (this.fileId - RouteCacheFileV1IDBase) * ROUTECACHES_PER_FILE_V1 + 1 + i;
166
166
  const lwr = (0, import_routeCache.parseRoute)(this.payload, offset);
167
- const nlwr = (0, import_routeCache.parseRoute)(this.payload, offset + import_safe.MAX_REPEATERS + 1);
167
+ const nlwr = (0, import_routeCache.parseRoute)(this.payload, offset + import_core.MAX_REPEATERS + 1);
168
168
  this.routeCaches.push({ nodeId, lwr, nlwr });
169
169
  }
170
170
  } else {
@@ -176,11 +176,11 @@ let RouteCacheFileV1 = (() => {
176
176
  this.routeCaches.sort((a, b) => a.nodeId - b.nodeId);
177
177
  const minNodeId = this.routeCaches[0].nodeId;
178
178
  this.fileId = nodeIdToRouteCacheFileIDV1(minNodeId);
179
- this.payload = new import_safe2.Bytes(ROUTECACHES_PER_FILE_V1 * import_routeCache.ROUTECACHE_SIZE).fill(import_routeCache.EMPTY_ROUTECACHE_FILL);
179
+ this.payload = new import_shared.Bytes(ROUTECACHES_PER_FILE_V1 * import_routeCache.ROUTECACHE_SIZE).fill(import_routeCache.EMPTY_ROUTECACHE_FILL);
180
180
  const minFileNodeId = Math.floor((minNodeId - 1) / ROUTECACHES_PER_FILE_V1) * ROUTECACHES_PER_FILE_V1 + 1;
181
181
  for (const routeCache of this.routeCaches) {
182
182
  const offset = (routeCache.nodeId - minFileNodeId) * import_routeCache.ROUTECACHE_SIZE;
183
- const routes = import_safe2.Bytes.concat([
183
+ const routes = import_shared.Bytes.concat([
184
184
  (0, import_routeCache.encodeRoute)(routeCache.lwr),
185
185
  (0, import_routeCache.encodeRoute)(routeCache.nlwr)
186
186
  ]);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/lib/nvm3/files/RouteCacheFiles.ts"],
4
- "sourcesContent": ["import { MAX_NODES, MAX_REPEATERS } from \"@zwave-js/core/safe\";\nimport { Bytes } from \"@zwave-js/shared/safe\";\nimport {\n\tEMPTY_ROUTECACHE_FILL,\n\tROUTECACHE_SIZE,\n\ttype RouteCache,\n\temptyRouteCache,\n\tencodeRoute,\n\tparseRoute,\n} from \"../../common/routeCache.js\";\nimport type { NVM3Object } from \"../object.js\";\nimport {\n\tNVMFile,\n\ttype NVMFileCreationOptions,\n\ttype NVMFileDeserializationOptions,\n\tgotDeserializationOptions,\n\tnvmFileID,\n\tnvmSection,\n} from \"./NVMFile.js\";\n\nexport const ROUTECACHES_PER_FILE_V1 = 8;\n\nexport interface RouteCacheFileV0Options extends NVMFileCreationOptions {\n\trouteCache: RouteCache;\n}\n\nexport const RouteCacheFileV0IDBase = 0x50400;\nexport function nodeIdToRouteCacheFileIDV0(nodeId: number): number {\n\treturn RouteCacheFileV0IDBase + nodeId - 1;\n}\n\n@nvmFileID(\n\t(id) =>\n\t\tid >= RouteCacheFileV0IDBase && id < RouteCacheFileV0IDBase + MAX_NODES,\n)\n@nvmSection(\"protocol\")\nexport class RouteCacheFileV0 extends NVMFile {\n\tpublic constructor(\n\t\toptions: NVMFileDeserializationOptions | RouteCacheFileV0Options,\n\t) {\n\t\tsuper(options);\n\t\tif (gotDeserializationOptions(options)) {\n\t\t\tconst nodeId = this.fileId - RouteCacheFileV0IDBase + 1;\n\t\t\tconst lwr = parseRoute(this.payload, 0);\n\t\t\tconst nlwr = parseRoute(this.payload, MAX_REPEATERS + 1);\n\t\t\tthis.routeCache = { nodeId, lwr, nlwr };\n\t\t} else {\n\t\t\tthis.routeCache = options.routeCache;\n\t\t}\n\t}\n\n\tpublic routeCache: RouteCache;\n\n\tpublic serialize(): NVM3Object & { data: Bytes } {\n\t\tthis.fileId = nodeIdToRouteCacheFileIDV0(this.routeCache.nodeId);\n\t\tthis.payload = Bytes.concat([\n\t\t\tencodeRoute(this.routeCache.lwr),\n\t\t\tencodeRoute(this.routeCache.nlwr),\n\t\t]);\n\t\treturn super.serialize();\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic toJSON() {\n\t\treturn {\n\t\t\t...super.toJSON(),\n\t\t\trouteCache: this.routeCache,\n\t\t};\n\t}\n}\n\nexport interface RouteCacheFileV1Options extends NVMFileCreationOptions {\n\trouteCaches: RouteCache[];\n}\n\nexport const RouteCacheFileV1IDBase = 0x51400;\nexport function nodeIdToRouteCacheFileIDV1(nodeId: number): number {\n\treturn (\n\t\tRouteCacheFileV1IDBase\n\t\t+ Math.floor((nodeId - 1) / ROUTECACHES_PER_FILE_V1)\n\t);\n}\n\n@nvmFileID(\n\t(id) =>\n\t\tid >= RouteCacheFileV1IDBase\n\t\t&& id < RouteCacheFileV1IDBase + MAX_NODES / ROUTECACHES_PER_FILE_V1,\n)\n@nvmSection(\"protocol\")\nexport class RouteCacheFileV1 extends NVMFile {\n\tpublic constructor(\n\t\toptions: NVMFileDeserializationOptions | RouteCacheFileV1Options,\n\t) {\n\t\tsuper(options);\n\t\tif (gotDeserializationOptions(options)) {\n\t\t\tthis.routeCaches = [];\n\t\t\tfor (let i = 0; i < ROUTECACHES_PER_FILE_V1; i++) {\n\t\t\t\tconst offset = i * 2 * (MAX_REPEATERS + 1);\n\t\t\t\tconst entry = this.payload.subarray(\n\t\t\t\t\toffset,\n\t\t\t\t\toffset + 2 * (MAX_REPEATERS + 1),\n\t\t\t\t);\n\t\t\t\tif (entry.equals(emptyRouteCache)) continue;\n\n\t\t\t\tconst nodeId = (this.fileId - RouteCacheFileV1IDBase)\n\t\t\t\t\t\t* ROUTECACHES_PER_FILE_V1\n\t\t\t\t\t+ 1\n\t\t\t\t\t+ i;\n\t\t\t\tconst lwr = parseRoute(this.payload, offset);\n\t\t\t\tconst nlwr = parseRoute(\n\t\t\t\t\tthis.payload,\n\t\t\t\t\toffset + MAX_REPEATERS + 1,\n\t\t\t\t);\n\n\t\t\t\tthis.routeCaches.push({ nodeId, lwr, nlwr });\n\t\t\t}\n\t\t} else {\n\t\t\tthis.routeCaches = options.routeCaches;\n\t\t}\n\t}\n\n\tpublic routeCaches: RouteCache[];\n\n\tpublic serialize(): NVM3Object & { data: Bytes } {\n\t\t// The route infos must be sorted by node ID\n\t\tthis.routeCaches.sort((a, b) => a.nodeId - b.nodeId);\n\t\tconst minNodeId = this.routeCaches[0].nodeId;\n\t\tthis.fileId = nodeIdToRouteCacheFileIDV1(minNodeId);\n\n\t\tthis.payload = new Bytes(ROUTECACHES_PER_FILE_V1 * ROUTECACHE_SIZE)\n\t\t\t.fill(EMPTY_ROUTECACHE_FILL);\n\n\t\tconst minFileNodeId =\n\t\t\tMath.floor((minNodeId - 1) / ROUTECACHES_PER_FILE_V1)\n\t\t\t\t* ROUTECACHES_PER_FILE_V1\n\t\t\t+ 1;\n\n\t\tfor (const routeCache of this.routeCaches) {\n\t\t\tconst offset = (routeCache.nodeId - minFileNodeId)\n\t\t\t\t* ROUTECACHE_SIZE;\n\t\t\tconst routes = Bytes.concat([\n\t\t\t\tencodeRoute(routeCache.lwr),\n\t\t\t\tencodeRoute(routeCache.nlwr),\n\t\t\t]);\n\t\t\tthis.payload.set(routes, offset);\n\t\t}\n\n\t\treturn super.serialize();\n\t}\n\n\t// eslint-disable-next-line @typesc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AAK,OAAO,YAAY,KAAK,uBAAuB,IACjD,0BACD;AAEH,iBAAW,cAAc,KAAK,aAAa;AAC1C,cAAM,UAAU,WAAW,SAAS,iBACjC;AACH,cAAM,SAAS,mBAAM,OAAO;cAC3B,+BAAY,WAAW,GAAG;cAC1B,+BAAY,WAAW,IAAI;SAC3B;AACD,aAAK,QAAQ,IAAI,QAAQ,MAAM;MAChC;AAEA,aAAO,MAAM,UAAS;IACvB;;IAGO,SAAM;AACZ,aAAO;QACN,GAAG,MAAM,OAAM;QACf,gBAAgB,KAAK;;IAEvB;;;;",
6
- "names": ["import_safe"]
4
+ "sourcesContent": ["import { MAX_NODES, MAX_REPEATERS } from \"@zwave-js/core\";\nimport { Bytes } from \"@zwave-js/shared\";\nimport {\n\tEMPTY_ROUTECACHE_FILL,\n\tROUTECACHE_SIZE,\n\ttype RouteCache,\n\temptyRouteCache,\n\tencodeRoute,\n\tparseRoute,\n} from \"../../common/routeCache.js\";\nimport type { NVM3Object } from \"../object.js\";\nimport {\n\tNVMFile,\n\ttype NVMFileCreationOptions,\n\ttype NVMFileDeserializationOptions,\n\tgotDeserializationOptions,\n\tnvmFileID,\n\tnvmSection,\n} from \"./NVMFile.js\";\n\nexport const ROUTECACHES_PER_FILE_V1 = 8;\n\nexport interface RouteCacheFileV0Options extends NVMFileCreationOptions {\n\trouteCache: RouteCache;\n}\n\nexport const RouteCacheFileV0IDBase = 0x50400;\nexport function nodeIdToRouteCacheFileIDV0(nodeId: number): number {\n\treturn RouteCacheFileV0IDBase + nodeId - 1;\n}\n\n@nvmFileID(\n\t(id) =>\n\t\tid >= RouteCacheFileV0IDBase && id < RouteCacheFileV0IDBase + MAX_NODES,\n)\n@nvmSection(\"protocol\")\nexport class RouteCacheFileV0 extends NVMFile {\n\tpublic constructor(\n\t\toptions: NVMFileDeserializationOptions | RouteCacheFileV0Options,\n\t) {\n\t\tsuper(options);\n\t\tif (gotDeserializationOptions(options)) {\n\t\t\tconst nodeId = this.fileId - RouteCacheFileV0IDBase + 1;\n\t\t\tconst lwr = parseRoute(this.payload, 0);\n\t\t\tconst nlwr = parseRoute(this.payload, MAX_REPEATERS + 1);\n\t\t\tthis.routeCache = { nodeId, lwr, nlwr };\n\t\t} else {\n\t\t\tthis.routeCache = options.routeCache;\n\t\t}\n\t}\n\n\tpublic routeCache: RouteCache;\n\n\tpublic serialize(): NVM3Object & { data: Bytes } {\n\t\tthis.fileId = nodeIdToRouteCacheFileIDV0(this.routeCache.nodeId);\n\t\tthis.payload = Bytes.concat([\n\t\t\tencodeRoute(this.routeCache.lwr),\n\t\t\tencodeRoute(this.routeCache.nlwr),\n\t\t]);\n\t\treturn super.serialize();\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic toJSON() {\n\t\treturn {\n\t\t\t...super.toJSON(),\n\t\t\trouteCache: this.routeCache,\n\t\t};\n\t}\n}\n\nexport interface RouteCacheFileV1Options extends NVMFileCreationOptions {\n\trouteCaches: RouteCache[];\n}\n\nexport const RouteCacheFileV1IDBase = 0x51400;\nexport function nodeIdToRouteCacheFileIDV1(nodeId: number): number {\n\treturn (\n\t\tRouteCacheFileV1IDBase\n\t\t+ Math.floor((nodeId - 1) / ROUTECACHES_PER_FILE_V1)\n\t);\n}\n\n@nvmFileID(\n\t(id) =>\n\t\tid >= RouteCacheFileV1IDBase\n\t\t&& id < RouteCacheFileV1IDBase + MAX_NODES / ROUTECACHES_PER_FILE_V1,\n)\n@nvmSection(\"protocol\")\nexport class RouteCacheFileV1 extends NVMFile {\n\tpublic constructor(\n\t\toptions: NVMFileDeserializationOptions | RouteCacheFileV1Options,\n\t) {\n\t\tsuper(options);\n\t\tif (gotDeserializationOptions(options)) {\n\t\t\tthis.routeCaches = [];\n\t\t\tfor (let i = 0; i < ROUTECACHES_PER_FILE_V1; i++) {\n\t\t\t\tconst offset = i * 2 * (MAX_REPEATERS + 1);\n\t\t\t\tconst entry = this.payload.subarray(\n\t\t\t\t\toffset,\n\t\t\t\t\toffset + 2 * (MAX_REPEATERS + 1),\n\t\t\t\t);\n\t\t\t\tif (entry.equals(emptyRouteCache)) continue;\n\n\t\t\t\tconst nodeId = (this.fileId - RouteCacheFileV1IDBase)\n\t\t\t\t\t\t* ROUTECACHES_PER_FILE_V1\n\t\t\t\t\t+ 1\n\t\t\t\t\t+ i;\n\t\t\t\tconst lwr = parseRoute(this.payload, offset);\n\t\t\t\tconst nlwr = parseRoute(\n\t\t\t\t\tthis.payload,\n\t\t\t\t\toffset + MAX_REPEATERS + 1,\n\t\t\t\t);\n\n\t\t\t\tthis.routeCaches.push({ nodeId, lwr, nlwr });\n\t\t\t}\n\t\t} else {\n\t\t\tthis.routeCaches = options.routeCaches;\n\t\t}\n\t}\n\n\tpublic routeCaches: RouteCache[];\n\n\tpublic serialize(): NVM3Object & { data: Bytes } {\n\t\t// The route infos must be sorted by node ID\n\t\tthis.routeCaches.sort((a, b) => a.nodeId - b.nodeId);\n\t\tconst minNodeId = this.routeCaches[0].nodeId;\n\t\tthis.fileId = nodeIdToRouteCacheFileIDV1(minNodeId);\n\n\t\tthis.payload = new Bytes(ROUTECACHES_PER_FILE_V1 * ROUTECACHE_SIZE)\n\t\t\t.fill(EMPTY_ROUTECACHE_FILL);\n\n\t\tconst minFileNodeId =\n\t\t\tMath.floor((minNodeId - 1) / ROUTECACHES_PER_FILE_V1)\n\t\t\t\t* ROUTECACHES_PER_FILE_V1\n\t\t\t+ 1;\n\n\t\tfor (const routeCache of this.routeCaches) {\n\t\t\tconst offset = (routeCache.nodeId - minFileNodeId)\n\t\t\t\t* ROUTECACHE_SIZE;\n\t\t\tconst routes = Bytes.concat([\n\t\t\t\tencodeRoute(routeCache.lwr),\n\t\t\t\tencodeRoute(routeCache.nlwr),\n\t\t\t]);\n\t\t\tthis.payload.set(routes, offset);\n\t\t}\n\n\t\treturn super.serialize();\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic toJSON() {\n\t\treturn {\n\t\t\t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,KAAK,aAAa;AAC1C,cAAM,UAAU,WAAW,SAAS,iBACjC;AACH,cAAM,SAAS,oBAAM,OAAO;cAC3B,+BAAY,WAAW,GAAG;cAC1B,+BAAY,WAAW,IAAI;SAC3B;AACD,aAAK,QAAQ,IAAI,QAAQ,MAAM;MAChC;AAEA,aAAO,MAAM,UAAS;IACvB;;IAGO,SAAM;AACZ,aAAO;QACN,GAAG,MAAM,OAAM;QACf,gBAAgB,KAAK;;IAEvB;;;;",
6
+ "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- import { Bytes } from "@zwave-js/shared/safe";
1
+ import { Bytes } from "@zwave-js/shared";
2
2
  import { type SUCUpdateEntry } from "../../common/sucUpdateEntry.js";
3
3
  import type { NVM3Object } from "../object.js";
4
4
  import { NVMFile, type NVMFileCreationOptions, type NVMFileDeserializationOptions } from "./NVMFile.js";
@@ -28,7 +28,7 @@ __export(SUCUpdateEntriesFile_exports, {
28
28
  sucUpdateIndexToSUCUpdateEntriesFileIDV5: () => sucUpdateIndexToSUCUpdateEntriesFileIDV5
29
29
  });
30
30
  module.exports = __toCommonJS(SUCUpdateEntriesFile_exports);
31
- var import_safe = require("@zwave-js/shared/safe");
31
+ var import_shared = require("@zwave-js/shared");
32
32
  var import_consts = require("../../../consts.js");
33
33
  var import_sucUpdateEntry = require("../../common/sucUpdateEntry.js");
34
34
  var import_NVMFile = require("./NVMFile.js");
@@ -110,7 +110,7 @@ let SUCUpdateEntriesFileV0 = (() => {
110
110
  }
111
111
  updateEntries;
112
112
  serialize() {
113
- this.payload = new import_safe.Bytes(import_consts.SUC_MAX_UPDATES * import_consts.SUC_UPDATE_ENTRY_SIZE).fill(0);
113
+ this.payload = new import_shared.Bytes(import_consts.SUC_MAX_UPDATES * import_consts.SUC_UPDATE_ENTRY_SIZE).fill(0);
114
114
  for (let i = 0; i < this.updateEntries.length; i++) {
115
115
  const offset = i * import_consts.SUC_UPDATE_ENTRY_SIZE;
116
116
  const entry = this.updateEntries[i];
@@ -170,7 +170,7 @@ let SUCUpdateEntriesFileV5 = (() => {
170
170
  }
171
171
  updateEntries;
172
172
  serialize() {
173
- this.payload = new import_safe.Bytes(SUC_UPDATES_PER_FILE_V5 * import_consts.SUC_UPDATE_ENTRY_SIZE).fill(255);
173
+ this.payload = new import_shared.Bytes(SUC_UPDATES_PER_FILE_V5 * import_consts.SUC_UPDATE_ENTRY_SIZE).fill(255);
174
174
  for (let i = 0; i < this.updateEntries.length; i++) {
175
175
  const offset = i * import_consts.SUC_UPDATE_ENTRY_SIZE;
176
176
  const entry = this.updateEntries[i];