matterbridge 3.4.7-dev-20260113-0917d83 → 3.4.7

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 (438) hide show
  1. package/dist/broadcastServer.d.ts +115 -0
  2. package/dist/broadcastServer.d.ts.map +1 -0
  3. package/dist/broadcastServer.js +117 -0
  4. package/dist/broadcastServer.js.map +1 -0
  5. package/dist/broadcastServerTypes.d.ts +43 -0
  6. package/dist/broadcastServerTypes.d.ts.map +1 -0
  7. package/dist/broadcastServerTypes.js +24 -0
  8. package/dist/broadcastServerTypes.js.map +1 -0
  9. package/dist/cli.d.ts +24 -0
  10. package/dist/cli.d.ts.map +1 -0
  11. package/dist/cli.js +97 -1
  12. package/dist/cli.js.map +1 -0
  13. package/dist/cliEmitter.d.ts +36 -0
  14. package/dist/cliEmitter.d.ts.map +1 -0
  15. package/dist/cliEmitter.js +37 -0
  16. package/dist/cliEmitter.js.map +1 -0
  17. package/dist/cliHistory.d.ts +42 -0
  18. package/dist/cliHistory.d.ts.map +1 -0
  19. package/dist/cliHistory.js +38 -0
  20. package/dist/cliHistory.js.map +1 -0
  21. package/dist/clusters/export.d.ts +1 -0
  22. package/dist/clusters/export.d.ts.map +1 -0
  23. package/dist/clusters/export.js +2 -0
  24. package/dist/clusters/export.js.map +1 -0
  25. package/dist/deviceManager.d.ts +108 -0
  26. package/dist/deviceManager.d.ts.map +1 -0
  27. package/dist/deviceManager.js +113 -1
  28. package/dist/deviceManager.js.map +1 -0
  29. package/dist/devices/airConditioner.d.ts +75 -0
  30. package/dist/devices/airConditioner.d.ts.map +1 -0
  31. package/dist/devices/airConditioner.js +57 -0
  32. package/dist/devices/airConditioner.js.map +1 -0
  33. package/dist/devices/batteryStorage.d.ts +43 -0
  34. package/dist/devices/batteryStorage.d.ts.map +1 -0
  35. package/dist/devices/batteryStorage.js +48 -1
  36. package/dist/devices/batteryStorage.js.map +1 -0
  37. package/dist/devices/cooktop.d.ts +55 -0
  38. package/dist/devices/cooktop.d.ts.map +1 -0
  39. package/dist/devices/cooktop.js +56 -0
  40. package/dist/devices/cooktop.js.map +1 -0
  41. package/dist/devices/dishwasher.d.ts +55 -0
  42. package/dist/devices/dishwasher.d.ts.map +1 -0
  43. package/dist/devices/dishwasher.js +57 -0
  44. package/dist/devices/dishwasher.js.map +1 -0
  45. package/dist/devices/evse.d.ts +57 -0
  46. package/dist/devices/evse.d.ts.map +1 -0
  47. package/dist/devices/evse.js +74 -10
  48. package/dist/devices/evse.js.map +1 -0
  49. package/dist/devices/export.d.ts +1 -0
  50. package/dist/devices/export.d.ts.map +1 -0
  51. package/dist/devices/export.js +5 -0
  52. package/dist/devices/export.js.map +1 -0
  53. package/dist/devices/extractorHood.d.ts +41 -0
  54. package/dist/devices/extractorHood.d.ts.map +1 -0
  55. package/dist/devices/extractorHood.js +43 -0
  56. package/dist/devices/extractorHood.js.map +1 -0
  57. package/dist/devices/heatPump.d.ts +43 -0
  58. package/dist/devices/heatPump.d.ts.map +1 -0
  59. package/dist/devices/heatPump.js +50 -2
  60. package/dist/devices/heatPump.js.map +1 -0
  61. package/dist/devices/laundryDryer.d.ts +58 -0
  62. package/dist/devices/laundryDryer.d.ts.map +1 -0
  63. package/dist/devices/laundryDryer.js +62 -3
  64. package/dist/devices/laundryDryer.js.map +1 -0
  65. package/dist/devices/laundryWasher.d.ts +64 -0
  66. package/dist/devices/laundryWasher.d.ts.map +1 -0
  67. package/dist/devices/laundryWasher.js +70 -4
  68. package/dist/devices/laundryWasher.js.map +1 -0
  69. package/dist/devices/microwaveOven.d.ts +77 -1
  70. package/dist/devices/microwaveOven.d.ts.map +1 -0
  71. package/dist/devices/microwaveOven.js +88 -5
  72. package/dist/devices/microwaveOven.js.map +1 -0
  73. package/dist/devices/oven.d.ts +82 -0
  74. package/dist/devices/oven.d.ts.map +1 -0
  75. package/dist/devices/oven.js +85 -0
  76. package/dist/devices/oven.js.map +1 -0
  77. package/dist/devices/refrigerator.d.ts +100 -0
  78. package/dist/devices/refrigerator.d.ts.map +1 -0
  79. package/dist/devices/refrigerator.js +102 -0
  80. package/dist/devices/refrigerator.js.map +1 -0
  81. package/dist/devices/roboticVacuumCleaner.d.ts +83 -0
  82. package/dist/devices/roboticVacuumCleaner.d.ts.map +1 -0
  83. package/dist/devices/roboticVacuumCleaner.js +100 -9
  84. package/dist/devices/roboticVacuumCleaner.js.map +1 -0
  85. package/dist/devices/solarPower.d.ts +36 -0
  86. package/dist/devices/solarPower.d.ts.map +1 -0
  87. package/dist/devices/solarPower.js +38 -0
  88. package/dist/devices/solarPower.js.map +1 -0
  89. package/dist/devices/speaker.d.ts +79 -0
  90. package/dist/devices/speaker.d.ts.map +1 -0
  91. package/dist/devices/speaker.js +84 -0
  92. package/dist/devices/speaker.js.map +1 -0
  93. package/dist/devices/temperatureControl.d.ts +21 -0
  94. package/dist/devices/temperatureControl.d.ts.map +1 -0
  95. package/dist/devices/temperatureControl.js +24 -3
  96. package/dist/devices/temperatureControl.js.map +1 -0
  97. package/dist/devices/waterHeater.d.ts +74 -0
  98. package/dist/devices/waterHeater.d.ts.map +1 -0
  99. package/dist/devices/waterHeater.js +82 -2
  100. package/dist/devices/waterHeater.js.map +1 -0
  101. package/dist/dgram/coap.d.ts +171 -0
  102. package/dist/dgram/coap.d.ts.map +1 -0
  103. package/dist/dgram/coap.js +126 -13
  104. package/dist/dgram/coap.js.map +1 -0
  105. package/dist/dgram/dgram.d.ts +99 -0
  106. package/dist/dgram/dgram.d.ts.map +1 -0
  107. package/dist/dgram/dgram.js +114 -2
  108. package/dist/dgram/dgram.js.map +1 -0
  109. package/dist/dgram/mb_coap.d.ts +23 -0
  110. package/dist/dgram/mb_coap.d.ts.map +1 -0
  111. package/dist/dgram/mb_coap.js +41 -3
  112. package/dist/dgram/mb_coap.js.map +1 -0
  113. package/dist/dgram/mb_mdns.d.ts +23 -0
  114. package/dist/dgram/mb_mdns.d.ts.map +1 -0
  115. package/dist/dgram/mb_mdns.js +80 -24
  116. package/dist/dgram/mb_mdns.js.map +1 -0
  117. package/dist/dgram/mdns.d.ts +187 -4
  118. package/dist/dgram/mdns.d.ts.map +1 -0
  119. package/dist/dgram/mdns.js +371 -139
  120. package/dist/dgram/mdns.js.map +1 -0
  121. package/dist/dgram/multicast.d.ts +49 -0
  122. package/dist/dgram/multicast.d.ts.map +1 -0
  123. package/dist/dgram/multicast.js +62 -1
  124. package/dist/dgram/multicast.js.map +1 -0
  125. package/dist/dgram/unicast.d.ts +53 -0
  126. package/dist/dgram/unicast.d.ts.map +1 -0
  127. package/dist/dgram/unicast.js +60 -0
  128. package/dist/dgram/unicast.js.map +1 -0
  129. package/dist/frontend.d.ts +187 -0
  130. package/dist/frontend.d.ts.map +1 -0
  131. package/dist/frontend.js +485 -38
  132. package/dist/frontend.js.map +1 -0
  133. package/dist/frontendTypes.d.ts +57 -0
  134. package/dist/frontendTypes.d.ts.map +1 -0
  135. package/dist/frontendTypes.js +45 -0
  136. package/dist/frontendTypes.js.map +1 -0
  137. package/dist/helpers.d.ts +43 -0
  138. package/dist/helpers.d.ts.map +1 -0
  139. package/dist/helpers.js +53 -0
  140. package/dist/helpers.js.map +1 -0
  141. package/dist/index.d.ts +23 -0
  142. package/dist/index.d.ts.map +1 -0
  143. package/dist/index.js +25 -0
  144. package/dist/index.js.map +1 -0
  145. package/dist/jestutils/export.d.ts +1 -0
  146. package/dist/jestutils/export.d.ts.map +1 -0
  147. package/dist/jestutils/export.js +1 -0
  148. package/dist/jestutils/export.js.map +1 -0
  149. package/dist/jestutils/jestHelpers.d.ts +255 -0
  150. package/dist/jestutils/jestHelpers.d.ts.map +1 -0
  151. package/dist/jestutils/jestHelpers.js +371 -14
  152. package/dist/jestutils/jestHelpers.js.map +1 -0
  153. package/dist/logger/export.d.ts +1 -0
  154. package/dist/logger/export.d.ts.map +1 -0
  155. package/dist/logger/export.js +1 -0
  156. package/dist/logger/export.js.map +1 -0
  157. package/dist/matter/behaviors.d.ts +1 -0
  158. package/dist/matter/behaviors.d.ts.map +1 -0
  159. package/dist/matter/behaviors.js +2 -0
  160. package/dist/matter/behaviors.js.map +1 -0
  161. package/dist/matter/clusters.d.ts +1 -0
  162. package/dist/matter/clusters.d.ts.map +1 -0
  163. package/dist/matter/clusters.js +2 -0
  164. package/dist/matter/clusters.js.map +1 -0
  165. package/dist/matter/devices.d.ts +1 -0
  166. package/dist/matter/devices.d.ts.map +1 -0
  167. package/dist/matter/devices.js +2 -0
  168. package/dist/matter/devices.js.map +1 -0
  169. package/dist/matter/endpoints.d.ts +1 -0
  170. package/dist/matter/endpoints.d.ts.map +1 -0
  171. package/dist/matter/endpoints.js +2 -0
  172. package/dist/matter/endpoints.js.map +1 -0
  173. package/dist/matter/export.d.ts +1 -0
  174. package/dist/matter/export.d.ts.map +1 -0
  175. package/dist/matter/export.js +3 -0
  176. package/dist/matter/export.js.map +1 -0
  177. package/dist/matter/types.d.ts +1 -0
  178. package/dist/matter/types.d.ts.map +1 -0
  179. package/dist/matter/types.js +3 -0
  180. package/dist/matter/types.js.map +1 -0
  181. package/dist/matterNode.d.ts +258 -0
  182. package/dist/matterNode.d.ts.map +1 -0
  183. package/dist/matterNode.js +369 -8
  184. package/dist/matterNode.js.map +1 -0
  185. package/dist/matterbridge.d.ts +353 -0
  186. package/dist/matterbridge.d.ts.map +1 -0
  187. package/dist/matterbridge.js +824 -46
  188. package/dist/matterbridge.js.map +1 -0
  189. package/dist/matterbridgeAccessoryPlatform.d.ts +36 -0
  190. package/dist/matterbridgeAccessoryPlatform.d.ts.map +1 -0
  191. package/dist/matterbridgeAccessoryPlatform.js +38 -0
  192. package/dist/matterbridgeAccessoryPlatform.js.map +1 -0
  193. package/dist/matterbridgeBehaviors.d.ts +24 -0
  194. package/dist/matterbridgeBehaviors.d.ts.map +1 -0
  195. package/dist/matterbridgeBehaviors.js +68 -5
  196. package/dist/matterbridgeBehaviors.js.map +1 -0
  197. package/dist/matterbridgeDeviceTypes.d.ts +603 -0
  198. package/dist/matterbridgeDeviceTypes.d.ts.map +1 -0
  199. package/dist/matterbridgeDeviceTypes.js +635 -14
  200. package/dist/matterbridgeDeviceTypes.js.map +1 -0
  201. package/dist/matterbridgeDynamicPlatform.d.ts +36 -0
  202. package/dist/matterbridgeDynamicPlatform.d.ts.map +1 -0
  203. package/dist/matterbridgeDynamicPlatform.js +38 -0
  204. package/dist/matterbridgeDynamicPlatform.js.map +1 -0
  205. package/dist/matterbridgeEndpoint.d.ts +1332 -0
  206. package/dist/matterbridgeEndpoint.d.ts.map +1 -0
  207. package/dist/matterbridgeEndpoint.js +1457 -53
  208. package/dist/matterbridgeEndpoint.js.map +1 -0
  209. package/dist/matterbridgeEndpointHelpers.d.ts +425 -0
  210. package/dist/matterbridgeEndpointHelpers.d.ts.map +1 -0
  211. package/dist/matterbridgeEndpointHelpers.js +483 -20
  212. package/dist/matterbridgeEndpointHelpers.js.map +1 -0
  213. package/dist/matterbridgeEndpointTypes.d.ts +70 -0
  214. package/dist/matterbridgeEndpointTypes.d.ts.map +1 -0
  215. package/dist/matterbridgeEndpointTypes.js +25 -0
  216. package/dist/matterbridgeEndpointTypes.js.map +1 -0
  217. package/dist/matterbridgePlatform.d.ts +425 -0
  218. package/dist/matterbridgePlatform.d.ts.map +1 -0
  219. package/dist/matterbridgePlatform.js +451 -1
  220. package/dist/matterbridgePlatform.js.map +1 -0
  221. package/dist/matterbridgeTypes.d.ts +46 -0
  222. package/dist/matterbridgeTypes.d.ts.map +1 -0
  223. package/dist/matterbridgeTypes.js +26 -0
  224. package/dist/matterbridgeTypes.js.map +1 -0
  225. package/dist/pluginManager.d.ts +305 -0
  226. package/dist/pluginManager.d.ts.map +1 -0
  227. package/dist/pluginManager.js +341 -5
  228. package/dist/pluginManager.js.map +1 -0
  229. package/dist/shelly.d.ts +157 -0
  230. package/dist/shelly.d.ts.map +1 -0
  231. package/dist/shelly.js +178 -7
  232. package/dist/shelly.js.map +1 -0
  233. package/dist/storage/export.d.ts +1 -0
  234. package/dist/storage/export.d.ts.map +1 -0
  235. package/dist/storage/export.js +1 -0
  236. package/dist/storage/export.js.map +1 -0
  237. package/dist/update.d.ts +75 -0
  238. package/dist/update.d.ts.map +1 -0
  239. package/dist/update.js +93 -1
  240. package/dist/update.js.map +1 -0
  241. package/dist/utils/colorUtils.d.ts +77 -0
  242. package/dist/utils/colorUtils.d.ts.map +1 -0
  243. package/dist/utils/colorUtils.js +97 -2
  244. package/dist/utils/colorUtils.js.map +1 -0
  245. package/dist/utils/commandLine.d.ts +60 -0
  246. package/dist/utils/commandLine.d.ts.map +1 -0
  247. package/dist/utils/commandLine.js +60 -0
  248. package/dist/utils/commandLine.js.map +1 -0
  249. package/dist/utils/copyDirectory.d.ts +33 -0
  250. package/dist/utils/copyDirectory.d.ts.map +1 -0
  251. package/dist/utils/copyDirectory.js +37 -0
  252. package/dist/utils/copyDirectory.js.map +1 -0
  253. package/dist/utils/createDirectory.d.ts +32 -0
  254. package/dist/utils/createDirectory.d.ts.map +1 -0
  255. package/dist/utils/createDirectory.js +33 -0
  256. package/dist/utils/createDirectory.js.map +1 -0
  257. package/dist/utils/createZip.d.ts +38 -0
  258. package/dist/utils/createZip.d.ts.map +1 -0
  259. package/dist/utils/createZip.js +47 -2
  260. package/dist/utils/createZip.js.map +1 -0
  261. package/dist/utils/deepCopy.d.ts +31 -0
  262. package/dist/utils/deepCopy.d.ts.map +1 -0
  263. package/dist/utils/deepCopy.js +39 -0
  264. package/dist/utils/deepCopy.js.map +1 -0
  265. package/dist/utils/deepEqual.d.ts +53 -0
  266. package/dist/utils/deepEqual.d.ts.map +1 -0
  267. package/dist/utils/deepEqual.js +72 -1
  268. package/dist/utils/deepEqual.js.map +1 -0
  269. package/dist/utils/error.d.ts +42 -0
  270. package/dist/utils/error.d.ts.map +1 -0
  271. package/dist/utils/error.js +42 -0
  272. package/dist/utils/error.js.map +1 -0
  273. package/dist/utils/export.d.ts +1 -0
  274. package/dist/utils/export.d.ts.map +1 -0
  275. package/dist/utils/export.js +1 -0
  276. package/dist/utils/export.js.map +1 -0
  277. package/dist/utils/format.d.ts +49 -0
  278. package/dist/utils/format.d.ts.map +1 -0
  279. package/dist/utils/format.js +49 -0
  280. package/dist/utils/format.js.map +1 -0
  281. package/dist/utils/hex.d.ts +85 -0
  282. package/dist/utils/hex.d.ts.map +1 -0
  283. package/dist/utils/hex.js +124 -0
  284. package/dist/utils/hex.js.map +1 -0
  285. package/dist/utils/inspector.d.ts +63 -0
  286. package/dist/utils/inspector.d.ts.map +1 -0
  287. package/dist/utils/inspector.js +69 -1
  288. package/dist/utils/inspector.js.map +1 -0
  289. package/dist/utils/isValid.d.ts +93 -0
  290. package/dist/utils/isValid.d.ts.map +1 -0
  291. package/dist/utils/isValid.js +93 -0
  292. package/dist/utils/isValid.js.map +1 -0
  293. package/dist/utils/network.d.ts +116 -0
  294. package/dist/utils/network.d.ts.map +1 -0
  295. package/dist/utils/network.js +126 -5
  296. package/dist/utils/network.js.map +1 -0
  297. package/dist/utils/spawn.d.ts +32 -0
  298. package/dist/utils/spawn.d.ts.map +1 -0
  299. package/dist/utils/spawn.js +71 -1
  300. package/dist/utils/spawn.js.map +1 -0
  301. package/dist/utils/tracker.d.ts +56 -0
  302. package/dist/utils/tracker.d.ts.map +1 -0
  303. package/dist/utils/tracker.js +64 -1
  304. package/dist/utils/tracker.js.map +1 -0
  305. package/dist/utils/wait.d.ts +51 -0
  306. package/dist/utils/wait.d.ts.map +1 -0
  307. package/dist/utils/wait.js +60 -8
  308. package/dist/utils/wait.js.map +1 -0
  309. package/dist/workerGlobalPrefix.d.ts +24 -0
  310. package/dist/workerGlobalPrefix.d.ts.map +1 -0
  311. package/dist/workerGlobalPrefix.js +37 -5
  312. package/dist/workerGlobalPrefix.js.map +1 -0
  313. package/dist/workerTypes.d.ts +25 -0
  314. package/dist/workerTypes.d.ts.map +1 -0
  315. package/dist/workerTypes.js +24 -0
  316. package/dist/workerTypes.js.map +1 -0
  317. package/dist/workers.d.ts +61 -0
  318. package/dist/workers.d.ts.map +1 -0
  319. package/dist/workers.js +68 -4
  320. package/dist/workers.js.map +1 -0
  321. package/npm-shrinkwrap.json +2 -2
  322. package/package.json +2 -1
  323. package/packages/dgram/dist/coap.d.ts +171 -0
  324. package/packages/dgram/dist/coap.d.ts.map +1 -0
  325. package/packages/dgram/dist/coap.js +126 -13
  326. package/packages/dgram/dist/coap.js.map +1 -0
  327. package/packages/dgram/dist/dgram.d.ts +99 -0
  328. package/packages/dgram/dist/dgram.d.ts.map +1 -0
  329. package/packages/dgram/dist/dgram.js +115 -3
  330. package/packages/dgram/dist/dgram.js.map +1 -0
  331. package/packages/dgram/dist/export.d.ts +1 -0
  332. package/packages/dgram/dist/export.d.ts.map +1 -0
  333. package/packages/dgram/dist/export.js +1 -0
  334. package/packages/dgram/dist/export.js.map +1 -0
  335. package/packages/dgram/dist/mdns.d.ts +187 -4
  336. package/packages/dgram/dist/mdns.d.ts.map +1 -0
  337. package/packages/dgram/dist/mdns.js +371 -139
  338. package/packages/dgram/dist/mdns.js.map +1 -0
  339. package/packages/dgram/dist/multicast.d.ts +49 -0
  340. package/packages/dgram/dist/multicast.d.ts.map +1 -0
  341. package/packages/dgram/dist/multicast.js +62 -1
  342. package/packages/dgram/dist/multicast.js.map +1 -0
  343. package/packages/dgram/dist/unicast.d.ts +53 -0
  344. package/packages/dgram/dist/unicast.d.ts.map +1 -0
  345. package/packages/dgram/dist/unicast.js +60 -0
  346. package/packages/dgram/dist/unicast.js.map +1 -0
  347. package/packages/jest-utils/dist/export.d.ts +1 -0
  348. package/packages/jest-utils/dist/export.d.ts.map +1 -0
  349. package/packages/jest-utils/dist/export.js +1 -0
  350. package/packages/jest-utils/dist/export.js.map +1 -0
  351. package/packages/jest-utils/dist/jestHelpers.d.ts +56 -0
  352. package/packages/jest-utils/dist/jestHelpers.d.ts.map +1 -0
  353. package/packages/jest-utils/dist/jestHelpers.js +62 -1
  354. package/packages/jest-utils/dist/jestHelpers.js.map +1 -0
  355. package/packages/utils/dist/colorUtils.d.ts +77 -0
  356. package/packages/utils/dist/colorUtils.d.ts.map +1 -0
  357. package/packages/utils/dist/colorUtils.js +97 -2
  358. package/packages/utils/dist/colorUtils.js.map +1 -0
  359. package/packages/utils/dist/commandLine.d.ts +60 -0
  360. package/packages/utils/dist/commandLine.d.ts.map +1 -0
  361. package/packages/utils/dist/commandLine.js +60 -0
  362. package/packages/utils/dist/commandLine.js.map +1 -0
  363. package/packages/utils/dist/copyDirectory.d.ts +33 -0
  364. package/packages/utils/dist/copyDirectory.d.ts.map +1 -0
  365. package/packages/utils/dist/copyDirectory.js +37 -0
  366. package/packages/utils/dist/copyDirectory.js.map +1 -0
  367. package/packages/utils/dist/createDirectory.d.ts +32 -0
  368. package/packages/utils/dist/createDirectory.d.ts.map +1 -0
  369. package/packages/utils/dist/createDirectory.js +33 -0
  370. package/packages/utils/dist/createDirectory.js.map +1 -0
  371. package/packages/utils/dist/createZip.d.ts +38 -0
  372. package/packages/utils/dist/createZip.d.ts.map +1 -0
  373. package/packages/utils/dist/createZip.js +47 -2
  374. package/packages/utils/dist/createZip.js.map +1 -0
  375. package/packages/utils/dist/deepCopy.d.ts +31 -0
  376. package/packages/utils/dist/deepCopy.d.ts.map +1 -0
  377. package/packages/utils/dist/deepCopy.js +39 -0
  378. package/packages/utils/dist/deepCopy.js.map +1 -0
  379. package/packages/utils/dist/deepEqual.d.ts +53 -0
  380. package/packages/utils/dist/deepEqual.d.ts.map +1 -0
  381. package/packages/utils/dist/deepEqual.js +73 -1
  382. package/packages/utils/dist/deepEqual.js.map +1 -0
  383. package/packages/utils/dist/error.d.ts +42 -0
  384. package/packages/utils/dist/error.d.ts.map +1 -0
  385. package/packages/utils/dist/error.js +42 -0
  386. package/packages/utils/dist/error.js.map +1 -0
  387. package/packages/utils/dist/export.d.ts +1 -0
  388. package/packages/utils/dist/export.d.ts.map +1 -0
  389. package/packages/utils/dist/export.js +1 -0
  390. package/packages/utils/dist/export.js.map +1 -0
  391. package/packages/utils/dist/format.d.ts +49 -0
  392. package/packages/utils/dist/format.d.ts.map +1 -0
  393. package/packages/utils/dist/format.js +49 -0
  394. package/packages/utils/dist/format.js.map +1 -0
  395. package/packages/utils/dist/githubVersion.d.ts +32 -0
  396. package/packages/utils/dist/githubVersion.d.ts.map +1 -0
  397. package/packages/utils/dist/githubVersion.js +34 -1
  398. package/packages/utils/dist/githubVersion.js.map +1 -0
  399. package/packages/utils/dist/hex.d.ts +85 -0
  400. package/packages/utils/dist/hex.d.ts.map +1 -0
  401. package/packages/utils/dist/hex.js +124 -0
  402. package/packages/utils/dist/hex.js.map +1 -0
  403. package/packages/utils/dist/inspector.d.ts +63 -0
  404. package/packages/utils/dist/inspector.d.ts.map +1 -0
  405. package/packages/utils/dist/inspector.js +69 -1
  406. package/packages/utils/dist/inspector.js.map +1 -0
  407. package/packages/utils/dist/isValid.d.ts +93 -0
  408. package/packages/utils/dist/isValid.d.ts.map +1 -0
  409. package/packages/utils/dist/isValid.js +93 -0
  410. package/packages/utils/dist/isValid.js.map +1 -0
  411. package/packages/utils/dist/network.d.ts +93 -0
  412. package/packages/utils/dist/network.d.ts.map +1 -0
  413. package/packages/utils/dist/network.js +99 -3
  414. package/packages/utils/dist/network.js.map +1 -0
  415. package/packages/utils/dist/npmRoot.d.ts +28 -0
  416. package/packages/utils/dist/npmRoot.d.ts.map +1 -0
  417. package/packages/utils/dist/npmRoot.js +28 -0
  418. package/packages/utils/dist/npmRoot.js.map +1 -0
  419. package/packages/utils/dist/npmVersion.d.ts +32 -0
  420. package/packages/utils/dist/npmVersion.d.ts.map +1 -0
  421. package/packages/utils/dist/npmVersion.js +34 -1
  422. package/packages/utils/dist/npmVersion.js.map +1 -0
  423. package/packages/utils/dist/tracker.d.ts +56 -0
  424. package/packages/utils/dist/tracker.d.ts.map +1 -0
  425. package/packages/utils/dist/tracker.js +64 -1
  426. package/packages/utils/dist/tracker.js.map +1 -0
  427. package/packages/utils/dist/wait.d.ts +51 -0
  428. package/packages/utils/dist/wait.d.ts.map +1 -0
  429. package/packages/utils/dist/wait.js +60 -8
  430. package/packages/utils/dist/wait.js.map +1 -0
  431. package/packages/vitest-utils/dist/export.d.ts +1 -0
  432. package/packages/vitest-utils/dist/export.d.ts.map +1 -0
  433. package/packages/vitest-utils/dist/export.js +1 -0
  434. package/packages/vitest-utils/dist/export.js.map +1 -0
  435. package/packages/vitest-utils/dist/vitestHelpers.d.ts +37 -0
  436. package/packages/vitest-utils/dist/vitestHelpers.d.ts.map +1 -0
  437. package/packages/vitest-utils/dist/vitestHelpers.js +43 -1
  438. package/packages/vitest-utils/dist/vitestHelpers.js.map +1 -0
@@ -1 +1,25 @@
1
+ /**
2
+ * This file contains the workerGlobalPrefix functions.
3
+ *
4
+ * @file workerGlobalPrefix.ts
5
+ * @author Luca Liguori
6
+ * @created 2025-11-25
7
+ * @version 1.0.0
8
+ * @license Apache-2.0
9
+ *
10
+ * Copyright 2025, 2026, 2027 Luca Liguori.
11
+ *
12
+ * Licensed under the Apache License, Version 2.0 (the "License");
13
+ * you may not use this file except in compliance with the License.
14
+ * You may obtain a copy of the License at
15
+ *
16
+ * http://www.apache.org/licenses/LICENSE-2.0
17
+ *
18
+ * Unless required by applicable law or agreed to in writing, software
19
+ * distributed under the License is distributed on an "AS IS" BASIS,
20
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+ * See the License for the specific language governing permissions and
22
+ * limitations under the License.
23
+ */
1
24
  export {};
25
+ //# sourceMappingURL=workerGlobalPrefix.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workerGlobalPrefix.d.ts","sourceRoot":"","sources":["../src/workerGlobalPrefix.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG"}
@@ -1,3 +1,26 @@
1
+ /**
2
+ * This file contains the workerGlobalPrefix functions.
3
+ *
4
+ * @file workerGlobalPrefix.ts
5
+ * @author Luca Liguori
6
+ * @created 2025-11-25
7
+ * @version 1.0.0
8
+ * @license Apache-2.0
9
+ *
10
+ * Copyright 2025, 2026, 2027 Luca Liguori.
11
+ *
12
+ * Licensed under the Apache License, Version 2.0 (the "License");
13
+ * you may not use this file except in compliance with the License.
14
+ * You may obtain a copy of the License at
15
+ *
16
+ * http://www.apache.org/licenses/LICENSE-2.0
17
+ *
18
+ * Unless required by applicable law or agreed to in writing, software
19
+ * distributed under the License is distributed on an "AS IS" BASIS,
20
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+ * See the License for the specific language governing permissions and
22
+ * limitations under the License.
23
+ */
1
24
  import { threadId, isMainThread, parentPort, workerData } from 'node:worker_threads';
2
25
  import { AnsiLogger } from 'node-ansi-logger';
3
26
  import { getGlobalNodeModules } from './utils/network.js';
@@ -7,13 +30,17 @@ import { logWorkerInfo, parentLog, parentPost } from './workers.js';
7
30
  import { hasParameter } from './utils/commandLine.js';
8
31
  const debug = hasParameter('debug') || hasParameter('verbose');
9
32
  const verbose = hasParameter('verbose');
33
+ // Send init message
34
+ // istanbul ignore next cause it's available only in worker threads
10
35
  if (!isMainThread && parentPort) {
11
36
  parentPost({ type: 'init', threadId, threadName: workerData.threadName, success: true });
12
37
  if (debug)
13
- parentLog('MatterbridgePrefix', "info", `Worker ${workerData.threadName}:${threadId} initialized.`);
38
+ parentLog('MatterbridgePrefix', "info" /* LogLevel.INFO */, `Worker ${workerData.threadName}:${threadId} initialized.`);
14
39
  }
15
- const log = new AnsiLogger({ logName: 'MatterbridgePrefix', logTimestampFormat: 4, logLevel: debug ? "debug" : "info" });
40
+ // Broadcast server
41
+ const log = new AnsiLogger({ logName: 'MatterbridgePrefix', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: debug ? "debug" /* LogLevel.DEBUG */ : "info" /* LogLevel.INFO */ });
16
42
  const server = new BroadcastServer('matterbridge', log);
43
+ // Log worker info
17
44
  if (verbose)
18
45
  logWorkerInfo(log, verbose);
19
46
  let prefix;
@@ -24,16 +51,21 @@ try {
24
51
  server.request({ type: 'matterbridge_global_prefix', src: `matterbridge`, dst: 'matterbridge', params: { prefix } });
25
52
  success = true;
26
53
  if (!isMainThread && parentPort)
27
- parentLog('MatterbridgePrefix', "debug", `Global node_modules Directory: ${prefix}`);
54
+ parentLog('MatterbridgePrefix', "debug" /* LogLevel.DEBUG */, `Global node_modules Directory: ${prefix}`);
28
55
  }
29
56
  catch (error) {
57
+ // istanbul ignore next cause it's just an error log
30
58
  const errorMessage = inspectError(log, `Failed to get global node modules`, error);
59
+ // istanbul ignore next cause it's just an error log
31
60
  if (!isMainThread && parentPort)
32
- parentLog('MatterbridgePrefix', "error", errorMessage);
61
+ parentLog('MatterbridgePrefix', "error" /* LogLevel.ERROR */, errorMessage);
33
62
  }
34
63
  server.close();
64
+ // Send exit message
65
+ // istanbul ignore next cause it's available only in worker threads
35
66
  if (!isMainThread && parentPort) {
36
67
  parentPost({ type: 'exit', threadId, threadName: workerData.threadName, success });
37
68
  if (debug)
38
- parentLog('MatterbridgePrefix', "info", `Worker ${workerData.threadName}:${threadId} exiting with success: ${success}.`);
69
+ parentLog('MatterbridgePrefix', "info" /* LogLevel.INFO */, `Worker ${workerData.threadName}:${threadId} exiting with success: ${success}.`);
39
70
  }
71
+ //# sourceMappingURL=workerGlobalPrefix.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workerGlobalPrefix.js","sourceRoot":"","sources":["../src/workerGlobalPrefix.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAErF,OAAO,EAAE,UAAU,EAA6B,MAAM,kBAAkB,CAAC;AAEzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAA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,EAAE,EAAE,CAAC,CAAC;IACrH,OAAO,GAAG,IAAI,CAAC;IACf,IAAI,CAAC,YAAY,IAAI,UAAU;QAAE,SAAS,CAAC,oBAAoB,gCAAkB,kCAAkC,MAAM,EAAE,CAAC,CAAC;AAC/H,CAAC;AAAC,OAAO,KAAK,EAAE,CAAC;IACf,oDAAoD;IACpD,MAAM,YAAY,GAAG,YAAY,CAAC,GAAG,EAAE,mCAAmC,EAAE,KAAK,CAAC,CAAC;IACnF,oDAAoD;IACpD,IAAI,CAAC,YAAY,IAAI,UAAU;QAAE,SAAS,CAAC,oBAAoB,gCAAkB,YAAY,CAAC,CAAC;AACjG,CAAC;AACD,MAAM,CAAC,KAAK,EAAE,CAAC;AAEf,oBAAoB;AACpB,mEAAmE;AACnE,IAAI,CAAC,YAAY,IAAI,UAAU,EAAE,CAAC;IAChC,UAAU,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,CAAC,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC;IACnF,IAAI,KAAK;QAAE,SAAS,CAAC,oBAAoB,8BAAiB,UAAU,UAAU,CAAC,UAAU,IAAI,QAAQ,0BAA0B,OAAO,GAAG,CAAC,CAAC;AAC7I,CAAC"}
@@ -1,4 +1,28 @@
1
+ /**
2
+ * This file contains the worker types.
3
+ *
4
+ * @file workerTypes.ts
5
+ * @author Luca Liguori
6
+ * @created 2025-11-25
7
+ * @version 1.0.0
8
+ * @license Apache-2.0
9
+ *
10
+ * Copyright 2025, 2026, 2027 Luca Liguori.
11
+ *
12
+ * Licensed under the Apache License, Version 2.0 (the "License");
13
+ * you may not use this file except in compliance with the License.
14
+ * You may obtain a copy of the License at
15
+ *
16
+ * http://www.apache.org/licenses/LICENSE-2.0
17
+ *
18
+ * Unless required by applicable law or agreed to in writing, software
19
+ * distributed under the License is distributed on an "AS IS" BASIS,
20
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+ * See the License for the specific language governing permissions and
22
+ * limitations under the License.
23
+ */
1
24
  import { LogLevel } from 'node-ansi-logger';
25
+ /** Control messages sent through parentPort manager <-> workers */
2
26
  export type ParentPortMessage = {
3
27
  type: 'init';
4
28
  threadName: string | null;
@@ -25,3 +49,4 @@ export type ParentPortMessage = {
25
49
  threadId: number;
26
50
  success: boolean;
27
51
  };
52
+ //# sourceMappingURL=workerTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workerTypes.d.ts","sourceRoot":"","sources":["../src/workerTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,mEAAmE;AACnE,MAAM,MAAM,iBAAiB,GACzB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GAC/E;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC7D;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC7D;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,QAAQ,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC9H;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC"}
@@ -1 +1,25 @@
1
+ /**
2
+ * This file contains the worker types.
3
+ *
4
+ * @file workerTypes.ts
5
+ * @author Luca Liguori
6
+ * @created 2025-11-25
7
+ * @version 1.0.0
8
+ * @license Apache-2.0
9
+ *
10
+ * Copyright 2025, 2026, 2027 Luca Liguori.
11
+ *
12
+ * Licensed under the Apache License, Version 2.0 (the "License");
13
+ * you may not use this file except in compliance with the License.
14
+ * You may obtain a copy of the License at
15
+ *
16
+ * http://www.apache.org/licenses/LICENSE-2.0
17
+ *
18
+ * Unless required by applicable law or agreed to in writing, software
19
+ * distributed under the License is distributed on an "AS IS" BASIS,
20
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+ * See the License for the specific language governing permissions and
22
+ * limitations under the License.
23
+ */
1
24
  export {};
25
+ //# sourceMappingURL=workerTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workerTypes.js","sourceRoot":"","sources":["../src/workerTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG"}
package/dist/workers.d.ts CHANGED
@@ -1,8 +1,69 @@
1
+ /**
2
+ * This file contains the worker functions.
3
+ *
4
+ * @file workers.ts
5
+ * @author Luca Liguori
6
+ * @created 2025-11-25
7
+ * @version 1.0.0
8
+ * @license Apache-2.0
9
+ *
10
+ * Copyright 2025, 2026, 2027 Luca Liguori.
11
+ *
12
+ * Licensed under the Apache License, Version 2.0 (the "License");
13
+ * you may not use this file except in compliance with the License.
14
+ * You may obtain a copy of the License at
15
+ *
16
+ * http://www.apache.org/licenses/LICENSE-2.0
17
+ *
18
+ * Unless required by applicable law or agreed to in writing, software
19
+ * distributed under the License is distributed on an "AS IS" BASIS,
20
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+ * See the License for the specific language governing permissions and
22
+ * limitations under the License.
23
+ */
1
24
  import { Worker } from 'node:worker_threads';
2
25
  import { AnsiLogger, LogLevel } from 'node-ansi-logger';
3
26
  import type { ParentPortMessage } from './workerTypes.js';
27
+ /**
28
+ * Sends a control message to the parent through parentPort
29
+ *
30
+ * @param {ControlMessage} message - The control message to send.
31
+ */
4
32
  export declare function parentPost(message: ParentPortMessage): void;
33
+ /**
34
+ * Sends a control message to the parent through parentPort to log a message.
35
+ *
36
+ * @param {string | undefined} logName - The name of the logger.
37
+ * @param {LogLevel} logLevel - The log level of the message.
38
+ * @param {string} message - The log message to send.
39
+ */
5
40
  export declare function parentLog(logName: string | undefined, logLevel: LogLevel, message: string): void;
41
+ /**
42
+ * Typed helper to create an ESM Worker.
43
+ *
44
+ * This function uses pathToFileURL to convert the relative path to a file URL,
45
+ * which is necessary for ESM modules. It also sets the worker type to 'module'.
46
+ *
47
+ * @param {string} name - name of the worker
48
+ * @param {string} relativePath - path to the worker file code: it must be an ESM module in javascript
49
+ * @param {Record<string, boolean | number | string | object>} [workerData] - optional data to pass to the worker
50
+ * @param {string[]} [argv] - optional command line arguments to pass to the worker. If not provided, inherits from the main thread.
51
+ * @param {NodeJS.ProcessEnv} [env] - optional environment variables to pass to the worker. If not provided, inherits from the main thread.
52
+ * @param {string[]} [execArgv] - optional execArgv to pass to the worker. If not provided no execArgv are passed.
53
+ * @returns {Worker} - the created Worker instance
54
+ *
55
+ * @example
56
+ * ```typescript
57
+ * createESMWorker('NpmCommand', './dist/npmCommand.js', { command: 'npm list --global --depth=0' });
58
+ * ```
59
+ */
6
60
  export declare function createESMWorker(name: string, relativePath: string, workerData?: Record<string, boolean | number | string | object>, argv?: string[], env?: NodeJS.ProcessEnv, execArgv?: string[]): Worker;
61
+ /**
62
+ * Log worker information.
63
+ *
64
+ * @param {AnsiLogger} log - The logger instance to use for logging.
65
+ * @param {boolean} [logEnv] - Whether to log environment variables. Defaults to false.
66
+ */
7
67
  export declare function logWorkerInfo(log: AnsiLogger, logEnv?: boolean): void;
8
68
  export { ParentPortMessage };
69
+ //# sourceMappingURL=workers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workers.d.ts","sourceRoot":"","sources":["../src/workers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAsC,MAAM,EAA6B,MAAM,qBAAqB,CAAC;AAK5G,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D;;;;GAIG;AAEH,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAG3D;AAED;;;;;;GAMG;AAEH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAIhG;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAW1M;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,UAAU,EAAE,MAAM,GAAE,OAAe,GAAG,IAAI,CAQ5E;AACD,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
package/dist/workers.js CHANGED
@@ -1,31 +1,94 @@
1
+ /**
2
+ * This file contains the worker functions.
3
+ *
4
+ * @file workers.ts
5
+ * @author Luca Liguori
6
+ * @created 2025-11-25
7
+ * @version 1.0.0
8
+ * @license Apache-2.0
9
+ *
10
+ * Copyright 2025, 2026, 2027 Luca Liguori.
11
+ *
12
+ * Licensed under the Apache License, Version 2.0 (the "License");
13
+ * you may not use this file except in compliance with the License.
14
+ * You may obtain a copy of the License at
15
+ *
16
+ * http://www.apache.org/licenses/LICENSE-2.0
17
+ *
18
+ * Unless required by applicable law or agreed to in writing, software
19
+ * distributed under the License is distributed on an "AS IS" BASIS,
20
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+ * See the License for the specific language governing permissions and
22
+ * limitations under the License.
23
+ */
1
24
  import { isMainThread, parentPort, threadId, Worker, workerData } from 'node:worker_threads';
2
25
  import { pathToFileURL } from 'node:url';
3
26
  import { resolve } from 'node:path';
4
27
  import { inspect } from 'node:util';
28
+ /**
29
+ * Sends a control message to the parent through parentPort
30
+ *
31
+ * @param {ControlMessage} message - The control message to send.
32
+ */
33
+ // istanbul ignore next cause it's available only in worker threads
5
34
  export function parentPost(message) {
6
35
  if (!parentPort)
7
36
  throw new Error(`WorkerServer ${workerData.threadName}: parentPort is not available.`);
8
37
  parentPort.postMessage(message);
9
38
  }
39
+ /**
40
+ * Sends a control message to the parent through parentPort to log a message.
41
+ *
42
+ * @param {string | undefined} logName - The name of the logger.
43
+ * @param {LogLevel} logLevel - The log level of the message.
44
+ * @param {string} message - The log message to send.
45
+ */
46
+ // istanbul ignore next cause it's available only in worker threads
10
47
  export function parentLog(logName, logLevel, message) {
11
48
  if (!parentPort)
12
49
  throw new Error(`WorkerServer ${workerData.threadName}: parentPort is not available.`);
13
50
  const logMessage = { type: 'log', threadId, threadName: workerData.threadName, logName, logLevel, message };
14
51
  parentPort.postMessage(logMessage);
15
52
  }
53
+ /**
54
+ * Typed helper to create an ESM Worker.
55
+ *
56
+ * This function uses pathToFileURL to convert the relative path to a file URL,
57
+ * which is necessary for ESM modules. It also sets the worker type to 'module'.
58
+ *
59
+ * @param {string} name - name of the worker
60
+ * @param {string} relativePath - path to the worker file code: it must be an ESM module in javascript
61
+ * @param {Record<string, boolean | number | string | object>} [workerData] - optional data to pass to the worker
62
+ * @param {string[]} [argv] - optional command line arguments to pass to the worker. If not provided, inherits from the main thread.
63
+ * @param {NodeJS.ProcessEnv} [env] - optional environment variables to pass to the worker. If not provided, inherits from the main thread.
64
+ * @param {string[]} [execArgv] - optional execArgv to pass to the worker. If not provided no execArgv are passed.
65
+ * @returns {Worker} - the created Worker instance
66
+ *
67
+ * @example
68
+ * ```typescript
69
+ * createESMWorker('NpmCommand', './dist/npmCommand.js', { command: 'npm list --global --depth=0' });
70
+ * ```
71
+ */
16
72
  export function createESMWorker(name, relativePath, workerData, argv, env, execArgv) {
17
73
  const fileURL = pathToFileURL(resolve(relativePath));
18
74
  const options = {
19
- workerData: { ...workerData, threadName: name },
75
+ workerData: { ...workerData, threadName: name }, // Pass threadName in workerData cause worker_threads don't have it natively in node 20
20
76
  type: 'module',
21
77
  name,
22
- argv: argv ?? process.argv.slice(2),
23
- env: env ?? process.env,
24
- execArgv,
78
+ argv: argv ?? process.argv.slice(2), // Pass command line arguments to worker
79
+ env: env ?? process.env, // Inherit environment variables
80
+ execArgv, // execArgv for node like --inspect
25
81
  };
26
82
  return new Worker(fileURL, options);
27
83
  }
84
+ /**
85
+ * Log worker information.
86
+ *
87
+ * @param {AnsiLogger} log - The logger instance to use for logging.
88
+ * @param {boolean} [logEnv] - Whether to log environment variables. Defaults to false.
89
+ */
28
90
  export function logWorkerInfo(log, logEnv = false) {
91
+ // Log worker info
29
92
  log.debug(`${isMainThread ? 'Main thread' : 'Worker thread'}: ${workerData?.threadName}:${threadId} Pid: ${process.pid}`);
30
93
  log.debug(`ParentPort: ${parentPort ? 'active' : 'not active'}`);
31
94
  log.debug(`WorkerData: ${workerData ? inspect(workerData, true, 10, true) : 'none'}`);
@@ -33,3 +96,4 @@ export function logWorkerInfo(log, logEnv = false) {
33
96
  log.debug(`Argv: ${argv.length ? argv.join(' ') : 'none'}`);
34
97
  log.debug(`Env: ${logEnv ? inspect(process.env, true, 10, true) : 'not logged'}`);
35
98
  }
99
+ //# sourceMappingURL=workers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workers.js","sour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C,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC;AACpF,CAAC"}
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "matterbridge",
3
- "version": "3.4.7-dev-20260113-0917d83",
3
+ "version": "3.4.7",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "matterbridge",
9
- "version": "3.4.7-dev-20260113-0917d83",
9
+ "version": "3.4.7",
10
10
  "license": "Apache-2.0",
11
11
  "workspaces": [
12
12
  "packages/jest-utils",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "matterbridge",
3
- "version": "3.4.7-dev-20260113-0917d83",
3
+ "version": "3.4.7",
4
4
  "description": "Matterbridge plugin manager for Matter",
5
5
  "author": "https://github.com/Luligu",
6
6
  "license": "Apache-2.0",
@@ -40,6 +40,7 @@
40
40
  ],
41
41
  "type": "module",
42
42
  "main": "dist/index.js",
43
+ "types": "dist/index.d.ts",
43
44
  "bin": {
44
45
  "matterbridge": "bin/matterbridge.js",
45
46
  "mb_mdns": "bin/mb_mdns.js",
@@ -1,13 +1,141 @@
1
+ /**
2
+ * @description This file contains the class Coap.
3
+ * @file src/dgram/coap.ts
4
+ * @author Luca Liguori
5
+ * @created 2025-03-22
6
+ * @version 1.0.0
7
+ * @license Apache-2.0
8
+ *
9
+ * Copyright 2025, 2026, 2027 Luca Liguori.
10
+ *
11
+ * Licensed under the Apache License, Version 2.0 (the "License");
12
+ * you may not use this file except in compliance with the License.
13
+ * You may obtain a copy of the License at
14
+ *
15
+ * http://www.apache.org/licenses/LICENSE-2.0
16
+ *
17
+ * Unless required by applicable law or agreed to in writing, software
18
+ * distributed under the License is distributed on an "AS IS" BASIS,
19
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
+ * See the License for the specific language governing permissions and
21
+ * limitations under the License.
22
+ */
1
23
  import dgram from 'node:dgram';
2
24
  import { Multicast } from './multicast.js';
25
+ /**
26
+ * Represents a CoAP message.
27
+ *
28
+ * A CoAP message is structured with a fixed header, an optional token, a series of options,
29
+ * and an optional payload. The header consists of version, type, token length, code, and message ID.
30
+ * The token is used to match responses with requests, options provide additional metadata, and
31
+ * the payload carries the message content.
32
+ */
3
33
  export interface CoapMessage {
34
+ /**
35
+ * The CoAP protocol version.
36
+ * Typically, this is 1.
37
+ * (Stored in the top 2 bits of the first header byte.)
38
+ */
4
39
  version: number;
40
+ /**
41
+ * The message type.
42
+ * It indicates whether the message is Confirmable, Non-confirmable, Acknowledgement, or Reset.
43
+ * (Stored in bits 5-4 of the first header byte.)
44
+ * 0: Confirmable (CON)
45
+ * 1: Non-confirmable (NON)
46
+ * 2: Acknowledgement (ACK)
47
+ * 3: Reset (RST)
48
+ */
5
49
  type: number;
50
+ /**
51
+ * The token length.
52
+ * This value (0-8) specifies the length of the token field.
53
+ * (Stored in the lower 4 bits of the first header byte.)
54
+ */
6
55
  tokenLength: number;
56
+ /**
57
+ * The message code.
58
+ * It indicates the method or response code, e.g., GET, POST, or a success/error response.
59
+ * (Stored in the second header byte.)
60
+ * CoAP uses an 8‑bit Code field divided into a 3‑bit class and a 5‑bit detail. The code can be represented as X.XX (e.g. 0.01) and is defined in RFC 7252. Here are the standard CoAP codes:
61
+ * Request Codes (Class 0)
62
+ * 0.01 – 1-GET
63
+ * Retrieve a resource.
64
+ * 0.02 – 2-POST
65
+ * Create a resource or trigger an action.
66
+ * 0.03 – 3-PUT
67
+ * Update or create a resource.
68
+ * 0.04 – 4-DELETE
69
+ * Remove a resource.
70
+ * Success Response Codes (Class 2)
71
+ * 2.00 – Empty / Success
72
+ * Indicates an empty message or a successful request with no payload.
73
+ * 2.01 – Created
74
+ * The request resulted in a new resource being created.
75
+ * 2.02 – Deleted
76
+ * The resource was successfully deleted.
77
+ * 2.03 – Valid
78
+ * The response indicates that the resource is still valid (used with caching).
79
+ * 2.04 – Changed
80
+ * The resource was successfully modified.
81
+ * 2.05 – Content
82
+ * The response contains the requested content.
83
+ * Client Error Response Codes (Class 4)
84
+ * 4.00 – Bad Request
85
+ * The request was malformed.
86
+ * 4.01 – Unauthorized
87
+ * The request requires authentication.
88
+ * 4.02 – Bad Option
89
+ * An option in the request was not understood or is unacceptable.
90
+ * 4.03 – Forbidden
91
+ * The server refuses to fulfill the request.
92
+ * 4.04 – Not Found
93
+ * The requested resource was not found.
94
+ * 4.05 – Method Not Allowed
95
+ * The request method is not supported for the target resource.
96
+ * 4.06 – Not Acceptable
97
+ * The server cannot generate a response matching the list of acceptable values.
98
+ * 4.12 – Precondition Failed
99
+ * A precondition given in the request evaluated to false.
100
+ * 4.13 – Request Entity Too Large
101
+ * The request payload is too large.
102
+ * 4.15 – Unsupported Content-Format
103
+ * The server does not support the content format of the request payload.
104
+ * Server Error Response Codes (Class 5)
105
+ * 5.00 – Internal Server Error
106
+ * The server encountered an unexpected condition.
107
+ * 5.01 – Not Implemented
108
+ * The server does not support the requested method.
109
+ * 5.02 – Bad Gateway
110
+ * The server, while acting as a gateway or proxy, received an invalid response.
111
+ * 5.03 – Service Unavailable
112
+ * The server is currently unable to handle the request.
113
+ * 5.04 – Gateway Timeout
114
+ * The server did not receive a timely response from an upstream server.
115
+ * 5.05 – Proxying Not Supported
116
+ * The server does not support proxying for the requested resource.
117
+ */
7
118
  code: number;
119
+ /**
120
+ * The message identifier.
121
+ * This 16-bit field is used to match messages of type Acknowledgement/Reset with their corresponding requests.
122
+ * (Stored in bytes 2-3 of the header.)
123
+ */
8
124
  messageId: number;
125
+ /**
126
+ * The token.
127
+ * A variable-length sequence (0-8 bytes) that helps match a request with its response.
128
+ */
9
129
  token: Buffer;
130
+ /**
131
+ * An array of options.
132
+ * Options carry additional information such as URI path, content format, etc., and are encoded using a delta mechanism.
133
+ */
10
134
  options: CoapOption[];
135
+ /**
136
+ * The payload.
137
+ * The actual content of the message, if present. It follows a payload marker (0xFF) if non-empty.
138
+ */
11
139
  payload?: Buffer;
12
140
  }
13
141
  interface CoapOption {
@@ -24,11 +152,54 @@ export declare class Coap extends Multicast {
24
152
  constructor(name: string, multicastAddress: string, multicastPort: number, socketType: 'udp4' | 'udp6', reuseAddr?: boolean | undefined, interfaceName?: string, interfaceAddress?: string);
25
153
  onCoapMessage(message: CoapMessage, rinfo: dgram.RemoteInfo): void;
26
154
  onMessage(msg: Buffer, rinfo: dgram.RemoteInfo): void;
155
+ /**
156
+ * Decodes a CoAP message from a Buffer.
157
+ *
158
+ * @param {Buffer} msg - The Buffer containing the raw CoAP message.
159
+ * @returns {CoapMessage} A parsed CoAP message object.
160
+ * @throws {Error} if the message is malformed.
161
+ */
27
162
  decodeCoapMessage(msg: Buffer): CoapMessage;
163
+ /**
164
+ * Encodes a CoAP message into a Buffer.
165
+ *
166
+ * @param {CoapMessage} msg - The CoAP message to encode.
167
+ * @returns {Buffer} A Buffer representing the encoded CoAP message.
168
+ * @throws {Error} if the message is malformed.
169
+ */
28
170
  encodeCoapMessage(msg: CoapMessage): Buffer;
171
+ /**
172
+ * Converts a CoAP message type numeric value to its string representation.
173
+ *
174
+ * CoAP message types are:
175
+ * - 0: Confirmable (CON)
176
+ * - 1: Non-confirmable (NON)
177
+ * - 2: Acknowledgement (ACK)
178
+ * - 3: Reset (RST)
179
+ *
180
+ * @param {number} type - The numeric CoAP message type.
181
+ * @returns {string} The string representation of the message type.
182
+ */
29
183
  coapTypeToString(type: number): string;
184
+ /**
185
+ * Converts a CoAP code numeric value to its string representation.
186
+ *
187
+ * The CoAP code is split into a 3-bit class and a 5-bit detail.
188
+ * For example:
189
+ * - 0.01: GET
190
+ * - 0.02: POST
191
+ * - 0.03: PUT
192
+ * - 0.04: DELETE
193
+ * - 2.05: Content (success response)
194
+ * - 4.04: Not Found (client error)
195
+ * - 5.00: Internal Server Error (server error)
196
+ *
197
+ * @param {number} code - The numeric CoAP code.
198
+ * @returns {string} The string representation of the code.
199
+ */
30
200
  coapCodeToString(code: number): string;
31
201
  sendRequest(messageId: number, options: CoapOption[], payload: Record<string, any> | undefined, token: string | undefined, address: string | undefined, port: number | undefined): void;
32
202
  logCoapMessage(msg: CoapMessage): void;
33
203
  }
34
204
  export {};
205
+ //# sourceMappingURL=coap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coap.d.ts","sourceRoot":"","sources":["../src/coap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,KAAK,MAAM,YAAY,CAAC;AAM/B,OAAO,EAAoD,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE7F;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;;;OAQG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6DG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,UAAU;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,kBAAkB,OAAO,CAAC;AACvC,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAC1C,eAAO,MAAM,mBAAmB,OAAO,CAAC;AACxC,eAAO,MAAM,uBAAuB,QAAQ,CAAC;AAC7C,eAAO,MAAM,4BAA4B,QAAQ,CAAC;AAElD,qBAAa,IAAK,SAAQ,SAAS;gBAE/B,IAAI,EAAE,MAAM,EACZ,gBAAgB,EAAE,MAAM,EACxB,aAAa,EAAE,MAAM,EAC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