matterbridge 3.3.7 → 3.3.8-dev-20251115-920acfc

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 (308) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README-SERVICE-OPT.md +4 -4
  3. package/README.md +4 -0
  4. package/dist/broadcastServer.js +1 -93
  5. package/dist/broadcastServerTypes.js +0 -24
  6. package/dist/cli.js +1 -97
  7. package/dist/cliEmitter.js +0 -37
  8. package/dist/cliHistory.js +0 -38
  9. package/dist/clusters/export.js +0 -2
  10. package/dist/defaultConfigSchema.js +0 -24
  11. package/dist/deviceManager.js +1 -105
  12. package/dist/devices/airConditioner.js +1 -58
  13. package/dist/devices/batteryStorage.js +2 -49
  14. package/dist/devices/cooktop.js +1 -56
  15. package/dist/devices/dishwasher.js +1 -58
  16. package/dist/devices/evse.js +11 -75
  17. package/dist/devices/export.js +0 -5
  18. package/dist/devices/extractorHood.js +1 -43
  19. package/dist/devices/heatPump.js +3 -51
  20. package/dist/devices/laundryDryer.js +4 -63
  21. package/dist/devices/laundryWasher.js +5 -71
  22. package/dist/devices/microwaveOven.js +6 -89
  23. package/dist/devices/oven.js +1 -86
  24. package/dist/devices/refrigerator.js +2 -104
  25. package/dist/devices/roboticVacuumCleaner.js +10 -101
  26. package/dist/devices/solarPower.js +1 -39
  27. package/dist/devices/speaker.js +1 -85
  28. package/dist/devices/temperatureControl.js +3 -24
  29. package/dist/devices/waterHeater.js +3 -83
  30. package/dist/dgram/coap.js +13 -126
  31. package/dist/dgram/dgram.js +2 -114
  32. package/dist/dgram/mb_coap.js +3 -41
  33. package/dist/dgram/mb_mdns.js +15 -80
  34. package/dist/dgram/mdns.js +137 -299
  35. package/dist/dgram/multicast.js +1 -62
  36. package/dist/dgram/unicast.js +0 -54
  37. package/dist/frontend.js +40 -452
  38. package/dist/frontendTypes.js +0 -45
  39. package/dist/helpers.js +0 -53
  40. package/dist/index.js +1 -25
  41. package/dist/jestutils/export.js +1 -0
  42. package/dist/{utils → jestutils}/jestHelpers.js +167 -175
  43. package/dist/logger/export.js +0 -1
  44. package/dist/matter/behaviors.js +0 -2
  45. package/dist/matter/clusters.js +0 -2
  46. package/dist/matter/devices.js +0 -2
  47. package/dist/matter/endpoints.js +0 -2
  48. package/dist/matter/export.js +0 -3
  49. package/dist/matter/types.js +0 -3
  50. package/dist/matterbridge.js +50 -838
  51. package/dist/matterbridgeAccessoryPlatform.js +0 -37
  52. package/dist/matterbridgeBehaviors.js +5 -68
  53. package/dist/matterbridgeDeviceTypes.js +27 -653
  54. package/dist/matterbridgeDynamicPlatform.js +0 -37
  55. package/dist/matterbridgeEndpoint.js +74 -1429
  56. package/dist/matterbridgeEndpointHelpers.js +42 -475
  57. package/dist/matterbridgeEndpointTypes.js +3 -0
  58. package/dist/matterbridgePlatform.js +18 -341
  59. package/dist/matterbridgeTypes.js +0 -26
  60. package/dist/pluginManager.js +5 -340
  61. package/dist/shelly.js +7 -168
  62. package/dist/storage/export.js +0 -1
  63. package/dist/update.js +0 -69
  64. package/dist/utils/colorUtils.js +2 -97
  65. package/dist/utils/commandLine.js +0 -60
  66. package/dist/utils/copyDirectory.js +1 -38
  67. package/dist/utils/createDirectory.js +0 -33
  68. package/dist/utils/createZip.js +2 -47
  69. package/dist/utils/deepCopy.js +0 -39
  70. package/dist/utils/deepEqual.js +1 -72
  71. package/dist/utils/error.js +2 -43
  72. package/dist/utils/export.js +0 -1
  73. package/dist/utils/format.js +0 -49
  74. package/dist/utils/hex.js +0 -124
  75. package/dist/utils/inspector.js +1 -69
  76. package/dist/utils/isvalid.js +0 -101
  77. package/dist/utils/network.js +5 -96
  78. package/dist/utils/spawn.js +0 -71
  79. package/dist/utils/tracker.js +1 -64
  80. package/dist/utils/wait.js +8 -60
  81. package/npm-shrinkwrap.json +8 -8
  82. package/package.json +5 -2
  83. package/scripts/fetch-chip.mjs +100 -0
  84. package/dist/broadcastServer.d.ts +0 -115
  85. package/dist/broadcastServer.d.ts.map +0 -1
  86. package/dist/broadcastServer.js.map +0 -1
  87. package/dist/broadcastServerTypes.d.ts +0 -806
  88. package/dist/broadcastServerTypes.d.ts.map +0 -1
  89. package/dist/broadcastServerTypes.js.map +0 -1
  90. package/dist/cli.d.ts +0 -30
  91. package/dist/cli.d.ts.map +0 -1
  92. package/dist/cli.js.map +0 -1
  93. package/dist/cliEmitter.d.ts +0 -50
  94. package/dist/cliEmitter.d.ts.map +0 -1
  95. package/dist/cliEmitter.js.map +0 -1
  96. package/dist/cliHistory.d.ts +0 -48
  97. package/dist/cliHistory.d.ts.map +0 -1
  98. package/dist/cliHistory.js.map +0 -1
  99. package/dist/clusters/export.d.ts +0 -2
  100. package/dist/clusters/export.d.ts.map +0 -1
  101. package/dist/clusters/export.js.map +0 -1
  102. package/dist/defaultConfigSchema.d.ts +0 -28
  103. package/dist/defaultConfigSchema.d.ts.map +0 -1
  104. package/dist/defaultConfigSchema.js.map +0 -1
  105. package/dist/deviceManager.d.ts +0 -128
  106. package/dist/deviceManager.d.ts.map +0 -1
  107. package/dist/deviceManager.js.map +0 -1
  108. package/dist/devices/airConditioner.d.ts +0 -98
  109. package/dist/devices/airConditioner.d.ts.map +0 -1
  110. package/dist/devices/airConditioner.js.map +0 -1
  111. package/dist/devices/batteryStorage.d.ts +0 -48
  112. package/dist/devices/batteryStorage.d.ts.map +0 -1
  113. package/dist/devices/batteryStorage.js.map +0 -1
  114. package/dist/devices/cooktop.d.ts +0 -60
  115. package/dist/devices/cooktop.d.ts.map +0 -1
  116. package/dist/devices/cooktop.js.map +0 -1
  117. package/dist/devices/dishwasher.d.ts +0 -71
  118. package/dist/devices/dishwasher.d.ts.map +0 -1
  119. package/dist/devices/dishwasher.js.map +0 -1
  120. package/dist/devices/evse.d.ts +0 -76
  121. package/dist/devices/evse.d.ts.map +0 -1
  122. package/dist/devices/evse.js.map +0 -1
  123. package/dist/devices/export.d.ts +0 -17
  124. package/dist/devices/export.d.ts.map +0 -1
  125. package/dist/devices/export.js.map +0 -1
  126. package/dist/devices/extractorHood.d.ts +0 -46
  127. package/dist/devices/extractorHood.d.ts.map +0 -1
  128. package/dist/devices/extractorHood.js.map +0 -1
  129. package/dist/devices/heatPump.d.ts +0 -47
  130. package/dist/devices/heatPump.d.ts.map +0 -1
  131. package/dist/devices/heatPump.js.map +0 -1
  132. package/dist/devices/laundryDryer.d.ts +0 -67
  133. package/dist/devices/laundryDryer.d.ts.map +0 -1
  134. package/dist/devices/laundryDryer.js.map +0 -1
  135. package/dist/devices/laundryWasher.d.ts +0 -81
  136. package/dist/devices/laundryWasher.d.ts.map +0 -1
  137. package/dist/devices/laundryWasher.js.map +0 -1
  138. package/dist/devices/microwaveOven.d.ts +0 -168
  139. package/dist/devices/microwaveOven.d.ts.map +0 -1
  140. package/dist/devices/microwaveOven.js.map +0 -1
  141. package/dist/devices/oven.d.ts +0 -105
  142. package/dist/devices/oven.d.ts.map +0 -1
  143. package/dist/devices/oven.js.map +0 -1
  144. package/dist/devices/refrigerator.d.ts +0 -118
  145. package/dist/devices/refrigerator.d.ts.map +0 -1
  146. package/dist/devices/refrigerator.js.map +0 -1
  147. package/dist/devices/roboticVacuumCleaner.d.ts +0 -112
  148. package/dist/devices/roboticVacuumCleaner.d.ts.map +0 -1
  149. package/dist/devices/roboticVacuumCleaner.js.map +0 -1
  150. package/dist/devices/solarPower.d.ts +0 -40
  151. package/dist/devices/solarPower.d.ts.map +0 -1
  152. package/dist/devices/solarPower.js.map +0 -1
  153. package/dist/devices/speaker.d.ts +0 -87
  154. package/dist/devices/speaker.d.ts.map +0 -1
  155. package/dist/devices/speaker.js.map +0 -1
  156. package/dist/devices/temperatureControl.d.ts +0 -166
  157. package/dist/devices/temperatureControl.d.ts.map +0 -1
  158. package/dist/devices/temperatureControl.js.map +0 -1
  159. package/dist/devices/waterHeater.d.ts +0 -111
  160. package/dist/devices/waterHeater.d.ts.map +0 -1
  161. package/dist/devices/waterHeater.js.map +0 -1
  162. package/dist/dgram/coap.d.ts +0 -205
  163. package/dist/dgram/coap.d.ts.map +0 -1
  164. package/dist/dgram/coap.js.map +0 -1
  165. package/dist/dgram/dgram.d.ts +0 -141
  166. package/dist/dgram/dgram.d.ts.map +0 -1
  167. package/dist/dgram/dgram.js.map +0 -1
  168. package/dist/dgram/mb_coap.d.ts +0 -24
  169. package/dist/dgram/mb_coap.d.ts.map +0 -1
  170. package/dist/dgram/mb_coap.js.map +0 -1
  171. package/dist/dgram/mb_mdns.d.ts +0 -24
  172. package/dist/dgram/mb_mdns.d.ts.map +0 -1
  173. package/dist/dgram/mb_mdns.js.map +0 -1
  174. package/dist/dgram/mdns.d.ts +0 -290
  175. package/dist/dgram/mdns.d.ts.map +0 -1
  176. package/dist/dgram/mdns.js.map +0 -1
  177. package/dist/dgram/multicast.d.ts +0 -67
  178. package/dist/dgram/multicast.d.ts.map +0 -1
  179. package/dist/dgram/multicast.js.map +0 -1
  180. package/dist/dgram/unicast.d.ts +0 -56
  181. package/dist/dgram/unicast.d.ts.map +0 -1
  182. package/dist/dgram/unicast.js.map +0 -1
  183. package/dist/frontend.d.ts +0 -238
  184. package/dist/frontend.d.ts.map +0 -1
  185. package/dist/frontend.js.map +0 -1
  186. package/dist/frontendTypes.d.ts +0 -529
  187. package/dist/frontendTypes.d.ts.map +0 -1
  188. package/dist/frontendTypes.js.map +0 -1
  189. package/dist/helpers.d.ts +0 -48
  190. package/dist/helpers.d.ts.map +0 -1
  191. package/dist/helpers.js.map +0 -1
  192. package/dist/index.d.ts +0 -33
  193. package/dist/index.d.ts.map +0 -1
  194. package/dist/index.js.map +0 -1
  195. package/dist/logger/export.d.ts +0 -2
  196. package/dist/logger/export.d.ts.map +0 -1
  197. package/dist/logger/export.js.map +0 -1
  198. package/dist/matter/behaviors.d.ts +0 -2
  199. package/dist/matter/behaviors.d.ts.map +0 -1
  200. package/dist/matter/behaviors.js.map +0 -1
  201. package/dist/matter/clusters.d.ts +0 -2
  202. package/dist/matter/clusters.d.ts.map +0 -1
  203. package/dist/matter/clusters.js.map +0 -1
  204. package/dist/matter/devices.d.ts +0 -2
  205. package/dist/matter/devices.d.ts.map +0 -1
  206. package/dist/matter/devices.js.map +0 -1
  207. package/dist/matter/endpoints.d.ts +0 -2
  208. package/dist/matter/endpoints.d.ts.map +0 -1
  209. package/dist/matter/endpoints.js.map +0 -1
  210. package/dist/matter/export.d.ts +0 -5
  211. package/dist/matter/export.d.ts.map +0 -1
  212. package/dist/matter/export.js.map +0 -1
  213. package/dist/matter/types.d.ts +0 -3
  214. package/dist/matter/types.d.ts.map +0 -1
  215. package/dist/matter/types.js.map +0 -1
  216. package/dist/matterbridge.d.ts +0 -478
  217. package/dist/matterbridge.d.ts.map +0 -1
  218. package/dist/matterbridge.js.map +0 -1
  219. package/dist/matterbridgeAccessoryPlatform.d.ts +0 -42
  220. package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
  221. package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
  222. package/dist/matterbridgeBehaviors.d.ts +0 -2404
  223. package/dist/matterbridgeBehaviors.d.ts.map +0 -1
  224. package/dist/matterbridgeBehaviors.js.map +0 -1
  225. package/dist/matterbridgeDeviceTypes.d.ts +0 -770
  226. package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
  227. package/dist/matterbridgeDeviceTypes.js.map +0 -1
  228. package/dist/matterbridgeDynamicPlatform.d.ts +0 -42
  229. package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
  230. package/dist/matterbridgeDynamicPlatform.js.map +0 -1
  231. package/dist/matterbridgeEndpoint.d.ts +0 -1556
  232. package/dist/matterbridgeEndpoint.d.ts.map +0 -1
  233. package/dist/matterbridgeEndpoint.js.map +0 -1
  234. package/dist/matterbridgeEndpointHelpers.d.ts +0 -758
  235. package/dist/matterbridgeEndpointHelpers.d.ts.map +0 -1
  236. package/dist/matterbridgeEndpointHelpers.js.map +0 -1
  237. package/dist/matterbridgePlatform.d.ts +0 -402
  238. package/dist/matterbridgePlatform.d.ts.map +0 -1
  239. package/dist/matterbridgePlatform.js.map +0 -1
  240. package/dist/matterbridgeTypes.d.ts +0 -239
  241. package/dist/matterbridgeTypes.d.ts.map +0 -1
  242. package/dist/matterbridgeTypes.js.map +0 -1
  243. package/dist/pluginManager.d.ts +0 -371
  244. package/dist/pluginManager.d.ts.map +0 -1
  245. package/dist/pluginManager.js.map +0 -1
  246. package/dist/shelly.d.ts +0 -174
  247. package/dist/shelly.d.ts.map +0 -1
  248. package/dist/shelly.js.map +0 -1
  249. package/dist/storage/export.d.ts +0 -2
  250. package/dist/storage/export.d.ts.map +0 -1
  251. package/dist/storage/export.js.map +0 -1
  252. package/dist/update.d.ts +0 -75
  253. package/dist/update.d.ts.map +0 -1
  254. package/dist/update.js.map +0 -1
  255. package/dist/utils/colorUtils.d.ts +0 -101
  256. package/dist/utils/colorUtils.d.ts.map +0 -1
  257. package/dist/utils/colorUtils.js.map +0 -1
  258. package/dist/utils/commandLine.d.ts +0 -66
  259. package/dist/utils/commandLine.d.ts.map +0 -1
  260. package/dist/utils/commandLine.js.map +0 -1
  261. package/dist/utils/copyDirectory.d.ts +0 -33
  262. package/dist/utils/copyDirectory.d.ts.map +0 -1
  263. package/dist/utils/copyDirectory.js.map +0 -1
  264. package/dist/utils/createDirectory.d.ts +0 -34
  265. package/dist/utils/createDirectory.d.ts.map +0 -1
  266. package/dist/utils/createDirectory.js.map +0 -1
  267. package/dist/utils/createZip.d.ts +0 -39
  268. package/dist/utils/createZip.d.ts.map +0 -1
  269. package/dist/utils/createZip.js.map +0 -1
  270. package/dist/utils/deepCopy.d.ts +0 -32
  271. package/dist/utils/deepCopy.d.ts.map +0 -1
  272. package/dist/utils/deepCopy.js.map +0 -1
  273. package/dist/utils/deepEqual.d.ts +0 -54
  274. package/dist/utils/deepEqual.d.ts.map +0 -1
  275. package/dist/utils/deepEqual.js.map +0 -1
  276. package/dist/utils/error.d.ts +0 -44
  277. package/dist/utils/error.d.ts.map +0 -1
  278. package/dist/utils/error.js.map +0 -1
  279. package/dist/utils/export.d.ts +0 -13
  280. package/dist/utils/export.d.ts.map +0 -1
  281. package/dist/utils/export.js.map +0 -1
  282. package/dist/utils/format.d.ts +0 -53
  283. package/dist/utils/format.d.ts.map +0 -1
  284. package/dist/utils/format.js.map +0 -1
  285. package/dist/utils/hex.d.ts +0 -89
  286. package/dist/utils/hex.d.ts.map +0 -1
  287. package/dist/utils/hex.js.map +0 -1
  288. package/dist/utils/inspector.d.ts +0 -87
  289. package/dist/utils/inspector.d.ts.map +0 -1
  290. package/dist/utils/inspector.js.map +0 -1
  291. package/dist/utils/isvalid.d.ts +0 -103
  292. package/dist/utils/isvalid.d.ts.map +0 -1
  293. package/dist/utils/isvalid.js.map +0 -1
  294. package/dist/utils/jestHelpers.d.ts +0 -139
  295. package/dist/utils/jestHelpers.d.ts.map +0 -1
  296. package/dist/utils/jestHelpers.js.map +0 -1
  297. package/dist/utils/network.d.ts +0 -101
  298. package/dist/utils/network.d.ts.map +0 -1
  299. package/dist/utils/network.js.map +0 -1
  300. package/dist/utils/spawn.d.ts +0 -35
  301. package/dist/utils/spawn.d.ts.map +0 -1
  302. package/dist/utils/spawn.js.map +0 -1
  303. package/dist/utils/tracker.d.ts +0 -108
  304. package/dist/utils/tracker.d.ts.map +0 -1
  305. package/dist/utils/tracker.js.map +0 -1
  306. package/dist/utils/wait.d.ts +0 -54
  307. package/dist/utils/wait.d.ts.map +0 -1
  308. package/dist/utils/wait.js.map +0 -1
@@ -1,34 +1,5 @@
1
- /**
2
- * @description This file contains the network functions.
3
- * @file network.ts
4
- * @author Luca Liguori
5
- * @created 2024-02-17
6
- * @version 1.0.1
7
- * @license Apache-2.0
8
- *
9
- * Copyright 2024, 2025, 2026 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
- */
23
- // Node.js modules
24
1
  import os from 'node:os';
25
- // AnsiLogger module
26
2
  import { AnsiLogger, BLUE, CYAN, nf } from 'node-ansi-logger';
27
- /**
28
- * Retrieves the first non-internal network interface details.
29
- *
30
- * @returns {os.NetworkInterfaceInfo | undefined} The details of the selected network interface, or undefined if not found.
31
- */
32
3
  export function getInterfaceDetails() {
33
4
  const result = { interfaceName: '', ipv4Address: undefined, ipv6Address: undefined, macAddress: undefined };
34
5
  for (const [interfaceName, interfaceDetails] of Object.entries(os.networkInterfaces())) {
@@ -50,11 +21,6 @@ export function getInterfaceDetails() {
50
21
  if (result.interfaceName)
51
22
  return result;
52
23
  }
53
- /**
54
- * Retrieves the first non-internal network interface name.
55
- *
56
- * @returns {string | undefined} The name of the selected network interface, or undefined if not found.
57
- */
58
24
  export function getInterfaceName() {
59
25
  for (const [interfaceName, interfaceDetails] of Object.entries(os.networkInterfaces())) {
60
26
  if (!interfaceName || !interfaceDetails || interfaceDetails.length === 0)
@@ -65,11 +31,6 @@ export function getInterfaceName() {
65
31
  }
66
32
  }
67
33
  }
68
- /**
69
- * Retrieves the IPv4 address of the first non-internal network interface.
70
- *
71
- * @returns {string | undefined} The IPv4 address of the selected network interface, or undefined if not found.
72
- */
73
34
  export function getIpv4InterfaceAddress() {
74
35
  for (const [interfaceName, interfaceDetails] of Object.entries(os.networkInterfaces())) {
75
36
  if (!interfaceName || !interfaceDetails || interfaceDetails.length === 0)
@@ -80,11 +41,6 @@ export function getIpv4InterfaceAddress() {
80
41
  }
81
42
  }
82
43
  }
83
- /**
84
- * Retrieves the IPv6 address of the first non-internal network interface.
85
- *
86
- * @returns {string | undefined} The IPv4 address of the selected network interface, or undefined if not found.
87
- */
88
44
  export function getIpv6InterfaceAddress() {
89
45
  for (const [interfaceName, interfaceDetails] of Object.entries(os.networkInterfaces())) {
90
46
  if (!interfaceName || !interfaceDetails || interfaceDetails.length === 0)
@@ -95,11 +51,6 @@ export function getIpv6InterfaceAddress() {
95
51
  }
96
52
  }
97
53
  }
98
- /**
99
- * Retrieves the mac address of the first non-internal network interface.
100
- *
101
- * @returns {string | undefined} The mac address, or undefined if not found.
102
- */
103
54
  export function getMacAddress() {
104
55
  for (const [interfaceName, interfaceDetails] of Object.entries(os.networkInterfaces())) {
105
56
  if (!interfaceName || !interfaceDetails || interfaceDetails.length === 0)
@@ -110,14 +61,9 @@ export function getMacAddress() {
110
61
  }
111
62
  }
112
63
  }
113
- /**
114
- * Logs the available network interfaces and their details.
115
- *
116
- * @returns {void}
117
- */
118
64
  export function logInterfaces() {
119
- const log = new AnsiLogger({ logName: 'MatterbridgeUtils', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: "info" /* LogLevel.INFO */ });
120
- log.logLevel = "info" /* LogLevel.INFO */;
65
+ const log = new AnsiLogger({ logName: 'MatterbridgeUtils', logTimestampFormat: 4, logLevel: "info" });
66
+ log.logLevel = "info";
121
67
  log.logName = 'LogInterfaces';
122
68
  log.info('Available Network Interfaces:');
123
69
  const availableAddresses = Object.entries(os.networkInterfaces());
@@ -131,36 +77,16 @@ export function logInterfaces() {
131
77
  }
132
78
  }
133
79
  }
134
- /**
135
- * Resolves the given hostname to an IP address.
136
- *
137
- * @param {string} hostname - The hostname to resolve.
138
- * @param {0 | 4 | 6} [family] - The address family to use (0 for any, 4 for IPv4, 6 for IPv6). Default is 4.
139
- * @returns {Promise<string | null>} - A promise that resolves to the IP address or null if not found.
140
- *
141
- * @remarks
142
- * This function uses DNS lookup to resolve the hostname, which can take some time to complete.
143
- */
144
80
  export async function resolveHostname(hostname, family = 4) {
145
81
  const dns = await import('node:dns');
146
82
  try {
147
- const addresses = await dns.promises.lookup(hostname.toLowerCase() /* + '.local'*/, { family });
83
+ const addresses = await dns.promises.lookup(hostname.toLowerCase(), { family });
148
84
  return addresses.address;
149
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
150
85
  }
151
86
  catch (error) {
152
87
  return null;
153
88
  }
154
89
  }
155
- /**
156
- * Retrieves the version of an npm package from the npm registry.
157
- *
158
- * @param {string} packageName - The name of the npm package.
159
- * @param {string} [tag] - The tag of the package version to retrieve (default is 'latest').
160
- * @param {number} [timeout] - The timeout duration in milliseconds (default is 10000ms).
161
- * @returns {Promise<string>} A promise that resolves to the version string of the package.
162
- * @throws {Error} If the request fails or the tag is not found.
163
- */
164
90
  export async function getNpmPackageVersion(packageName, tag = 'latest', timeout = 10000) {
165
91
  const https = await import('node:https');
166
92
  return new Promise((resolve, reject) => {
@@ -174,7 +100,7 @@ export async function getNpmPackageVersion(packageName, tag = 'latest', timeout
174
100
  let data = '';
175
101
  if (res.statusCode !== 200) {
176
102
  clearTimeout(timeoutId);
177
- res.resume(); // Discard response data to close the socket properly
103
+ res.resume();
178
104
  reject(new Error(`Failed to fetch data. Status code: ${res.statusCode}`));
179
105
  return;
180
106
  }
@@ -185,7 +111,6 @@ export async function getNpmPackageVersion(packageName, tag = 'latest', timeout
185
111
  clearTimeout(timeoutId);
186
112
  try {
187
113
  const jsonData = JSON.parse(data);
188
- // console.log(`Package ${packageName} tag ${tag}`, jsonData);
189
114
  const version = jsonData['dist-tags']?.[tag];
190
115
  if (version) {
191
116
  resolve(version);
@@ -205,15 +130,6 @@ export async function getNpmPackageVersion(packageName, tag = 'latest', timeout
205
130
  });
206
131
  });
207
132
  }
208
- /**
209
- * Retrieves a file from the public directory of the Matterbridge GitHub repository.
210
- *
211
- * @param {string} branch - The branch from which to fetch the file.
212
- * @param {string} file - The file path to fetch.
213
- * @param {number} [timeout] - The timeout duration in milliseconds (default is 10000ms).
214
- * @returns {Promise<Record<string, boolean | string | number>>} A promise that resolves to the parsed JSON object from the file.
215
- * @throws {Error} If the request fails or the JSON parsing fails.
216
- */
217
133
  export async function getGitHubUpdate(branch, file, timeout = 10000) {
218
134
  const https = await import('node:https');
219
135
  return new Promise((resolve, reject) => {
@@ -227,7 +143,7 @@ export async function getGitHubUpdate(branch, file, timeout = 10000) {
227
143
  let data = '';
228
144
  if (res.statusCode !== 200) {
229
145
  clearTimeout(timeoutId);
230
- res.resume(); // Discard response data to close the socket properly
146
+ res.resume();
231
147
  reject(new Error(`Failed to fetch data. Status code: ${res.statusCode}`));
232
148
  return;
233
149
  }
@@ -245,18 +161,12 @@ export async function getGitHubUpdate(branch, file, timeout = 10000) {
245
161
  }
246
162
  });
247
163
  });
248
- // istanbul ignore next
249
164
  req.on('error', (error) => {
250
165
  clearTimeout(timeoutId);
251
166
  reject(new Error(`Request failed: ${error instanceof Error ? error.message : error}`));
252
167
  });
253
168
  });
254
169
  }
255
- /**
256
- * Retrieves the path to the global Node.js modules directory.
257
- *
258
- * @returns {Promise<string>} A promise that resolves to the path of the global Node.js modules directory.
259
- */
260
170
  export async function getGlobalNodeModules() {
261
171
  const { exec } = await import('node:child_process');
262
172
  return new Promise((resolve, reject) => {
@@ -270,4 +180,3 @@ export async function getGlobalNodeModules() {
270
180
  });
271
181
  });
272
182
  }
273
- //# sourceMappingURL=network.js.map
@@ -1,52 +1,12 @@
1
- /**
2
- * @description This file contains the spawn functions.
3
- * @file spawn.ts
4
- * @author Luca Liguori
5
- * @created 2025-02-16
6
- * @version 1.1.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
- */
23
1
  import { hasParameter } from './commandLine.js';
24
- /**
25
- * Spawns a child process with the given command and arguments.
26
- *
27
- * @param {Matterbridge} matterbridge - The Matterbridge instance to use for logging and sending messages.
28
- * @param {string} command - The command to execute.
29
- * @param {string[]} args - The arguments to pass to the command (default: []).
30
- * @param {'install' | 'uninstall'} packageCommand - The package command being executed (e.g., 'install', 'uninstall').
31
- * @param {string} [packageName] - The name of the package being installed (optional).
32
- * @returns {Promise<boolean>} A promise that resolves when the child process exits successfully, or rejects if there is an error.
33
- */
34
2
  export async function spawnCommand(matterbridge, command, args, packageCommand, packageName) {
35
3
  const { spawn } = await import('node:child_process');
36
- /*
37
- * npm > npm.cmd on windows
38
- * cmd.exe ['dir'] on windows
39
- */
40
4
  const cmdLine = command + ' ' + args.join(' ');
41
5
  if (process.platform === 'win32' && command === 'npm') {
42
- // Must be spawn('cmd.exe', ['/c', 'npm -g install <package>']);
43
6
  const argstring = 'npm ' + args.join(' ');
44
7
  args.splice(0, args.length, '/c', argstring);
45
8
  command = 'cmd.exe';
46
9
  }
47
- // Decide when using sudo on linux and macOS
48
- // When you need sudo: Spawn stderr: npm error Error: EACCES: permission denied
49
- // When you don't need sudo: Failed to start child process "npm install -g matterbridge-eve-door": spawn sudo ENOENT
50
10
  if (hasParameter('sudo') || (process.platform !== 'win32' && command === 'npm' && !hasParameter('docker') && !hasParameter('nosudo'))) {
51
11
  args.unshift(command);
52
12
  command = 'sudo';
@@ -66,7 +26,6 @@ export async function spawnCommand(matterbridge, command, args, packageCommand,
66
26
  reject(err);
67
27
  });
68
28
  childProcess.on('close', (code, signal) => {
69
- // matterbridge.frontend.wssSendLogMessage('spawn', matterbridge.log.now(), 'Matterbridge:spawn', `child process closed with code ${code} and signal ${signal}`);
70
29
  if (code === 0) {
71
30
  matterbridge.log.debug(`Child process "${cmdLine}" closed with code ${code} and signal ${signal}`);
72
31
  matterbridge.frontend.wssSendLogMessage('spawn', matterbridge.log.now(), 'Matterbridge:spawn-exit-success', 'Child process closed');
@@ -79,7 +38,6 @@ export async function spawnCommand(matterbridge, command, args, packageCommand,
79
38
  }
80
39
  });
81
40
  childProcess.on('exit', (code, signal) => {
82
- // matterbridge.frontend.wssSendLogMessage('spawn', matterbridge.log.now(), 'Matterbridge:spawn', `child process exited with code ${code} and signal ${signal}`);
83
41
  if (code === 0) {
84
42
  matterbridge.log.debug(`Child process "${cmdLine}" exited with code ${code} and signal ${signal}`);
85
43
  matterbridge.frontend.wssSendLogMessage('spawn', matterbridge.log.now(), 'Matterbridge:spawn-exit-success', 'Child process exited');
@@ -104,20 +62,6 @@ export async function spawnCommand(matterbridge, command, args, packageCommand,
104
62
  matterbridge.frontend.wssSendLogMessage('spawn', matterbridge.log.now(), 'Matterbridge:spawn', line);
105
63
  }
106
64
  });
107
- /*
108
- childProcess.stdout.on('close', () => {
109
- matterbridge.log.debug(`Spawn output (stdout): closed`);
110
- resolve(true);
111
- });
112
- childProcess.stdout.on('end', () => {
113
- matterbridge.log.debug(`Spawn output (stdout): ended`);
114
- resolve(true);
115
- });
116
- childProcess.stdout.on('error', () => {
117
- matterbridge.log.debug(`Spawn output (stdout): error`);
118
- resolve(true);
119
- });
120
- */
121
65
  }
122
66
  if (childProcess.stderr) {
123
67
  childProcess.stderr.on('data', (data) => {
@@ -128,21 +72,6 @@ export async function spawnCommand(matterbridge, command, args, packageCommand,
128
72
  matterbridge.frontend.wssSendLogMessage('spawn', matterbridge.log.now(), 'Matterbridge:spawn', line);
129
73
  }
130
74
  });
131
- /*
132
- childProcess.stderr.on('close', () => {
133
- matterbridge.log.debug(`Spawn verbose (stderr): closed`);
134
- resolve(true);
135
- });
136
- childProcess.stderr.on('end', () => {
137
- matterbridge.log.debug(`Spawn verbose (stderr): ended`);
138
- resolve(true);
139
- });
140
- childProcess.stderr.on('error', () => {
141
- matterbridge.log.debug(`Spawn verbose (stderr): error`);
142
- resolve(true);
143
- });
144
- */
145
75
  }
146
76
  });
147
77
  }
148
- //# sourceMappingURL=spawn.js.map
@@ -1,27 +1,3 @@
1
- /**
2
- * This file contains the Tracker class.
3
- *
4
- * @file tracker.ts
5
- * @author Luca Liguori
6
- * @created 2025-10-10
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
- */
24
- /* eslint-disable no-console */
25
1
  if (process.argv.includes('--loader') || process.argv.includes('-loader'))
26
2
  console.log('\u001B[32mTracker loaded.\u001B[40;0m');
27
3
  import os from 'node:os';
@@ -34,7 +10,6 @@ export class Tracker extends EventEmitter {
34
10
  verbose;
35
11
  trackerInterval;
36
12
  static historyIndex = 0;
37
- // History for 8h at 1 sample each 10 seconds = 2880 entries
38
13
  static historySize = 2880;
39
14
  static history = Array.from({ length: this.historySize }, () => ({
40
15
  timestamp: 0,
@@ -71,7 +46,7 @@ export class Tracker extends EventEmitter {
71
46
  if (process.argv.includes('--verbose') || process.argv.includes('-verbose')) {
72
47
  this.verbose = true;
73
48
  }
74
- this.log = new AnsiLogger({ logName: name, logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: this.debug ? "debug" /* LogLevel.DEBUG */ : "info" /* LogLevel.INFO */ });
49
+ this.log = new AnsiLogger({ logName: name, logTimestampFormat: 4, logLevel: this.debug ? "debug" : "info" });
75
50
  this.log.logNameColor = YELLOW;
76
51
  if (this.verbose) {
77
52
  this.log.debug(`os.cpus():\n${RESET}`, os.cpus());
@@ -91,11 +66,6 @@ export class Tracker extends EventEmitter {
91
66
  this.runGarbageCollector();
92
67
  });
93
68
  }
94
- /**
95
- * Start tracking cpu and memory usage with a given interval in ms
96
- *
97
- * @param {number} sampleIntervalMs Sample interval in milliseconds. Default is 10000 (10 seconds).
98
- */
99
69
  start(sampleIntervalMs = 10000) {
100
70
  if (this.trackerInterval)
101
71
  return;
@@ -104,21 +74,15 @@ export class Tracker extends EventEmitter {
104
74
  this.prevCpus = os.cpus();
105
75
  this.prevCpuUsage = process.cpuUsage();
106
76
  this.trackerInterval = setInterval(() => {
107
- // Increment tryGcCount and check if we can run garbage collector each hour cause memory might grow over time because of our even small allocations
108
77
  tryGcCount += sampleIntervalMs / 1000;
109
78
  if (tryGcCount > 60 * 60) {
110
79
  this.runGarbageCollector();
111
80
  tryGcCount = 0;
112
81
  }
113
- // Get current history entry in circular buffer
114
82
  const entry = Tracker.history[Tracker.historyIndex];
115
- // Get previous history entry in circular buffer
116
83
  const prevEntry = Tracker.history[(Tracker.historyIndex + Tracker.historySize - 1) % Tracker.historySize];
117
- // Set the timestamp
118
84
  entry.timestamp = Date.now();
119
- // Emit uptime event
120
85
  this.emit('uptime', os.uptime(), process.uptime());
121
- // Track CPU usage
122
86
  const currentCpus = os.cpus();
123
87
  const loads = currentCpus.map((cpu, idx) => {
124
88
  const prev = this.prevCpus[idx]?.times;
@@ -130,7 +94,6 @@ export class Tracker extends EventEmitter {
130
94
  const totalDelta = busyDelta + idleDelta;
131
95
  if (totalDelta <= 0)
132
96
  return 0;
133
- // istanbul ignore next cause is practically impossible to hit this branch
134
97
  return busyDelta / totalDelta;
135
98
  });
136
99
  this.prevCpus = currentCpus;
@@ -138,16 +101,13 @@ export class Tracker extends EventEmitter {
138
101
  const osCpu = Number((avgLoad * 100).toFixed(2));
139
102
  entry.osCpu = osCpu;
140
103
  entry.peakOsCpu = Math.max(prevEntry.peakOsCpu, osCpu);
141
- // Track process CPU usage
142
104
  const diff = process.cpuUsage(this.prevCpuUsage);
143
105
  this.prevCpuUsage = process.cpuUsage();
144
106
  const totalMs = (diff.user + diff.system) / 1000;
145
107
  const processCpu = Number((((totalMs / sampleIntervalMs) * 100) / currentCpus.length).toFixed(2));
146
108
  entry.processCpu = processCpu;
147
109
  entry.peakProcessCpu = Math.max(prevEntry.peakProcessCpu, processCpu);
148
- // Emit cpu event
149
110
  this.emit('cpu', entry.osCpu, entry.processCpu);
150
- // Track memory usage
151
111
  entry.freeMemory = os.freemem();
152
112
  entry.peakFreeMemory = Math.max(prevEntry.peakFreeMemory, entry.freeMemory);
153
113
  entry.totalMemory = os.totalmem();
@@ -164,9 +124,7 @@ export class Tracker extends EventEmitter {
164
124
  entry.arrayBuffers = mem.arrayBuffers;
165
125
  entry.peakArrayBuffers = Math.max(prevEntry.peakArrayBuffers, mem.arrayBuffers);
166
126
  this.emit('memory', entry.freeMemory, entry.totalMemory, entry.rss, entry.heapUsed, entry.heapTotal, entry.external, entry.arrayBuffers);
167
- // Emit tracker event with current snapshot
168
127
  this.emit('snapshot', entry);
169
- // Debug output
170
128
  if (this.debug) {
171
129
  this.log.debug(`Time: ${formatTimeStamp(entry.timestamp)} ` +
172
130
  `os ${CYAN}${BRIGHT}${formatPercent(entry.osCpu)}${RESET}${db} (${entry.peakOsCpu > prevEntry.peakOsCpu ? RED : ''}${formatPercent(entry.peakOsCpu)}${db}) ` +
@@ -177,14 +135,10 @@ export class Tracker extends EventEmitter {
177
135
  `external: ${CYAN}${BRIGHT}${formatBytes(entry.external)}${RESET}${db} (${entry.peakExternal > prevEntry.peakExternal ? RED : ''}${formatBytes(entry.peakExternal)}${db}) ` +
178
136
  `arrayBuffers: ${CYAN}${BRIGHT}${formatBytes(entry.arrayBuffers)}${RESET}${db} (${entry.peakArrayBuffers > prevEntry.peakArrayBuffers ? RED : ''}${formatBytes(entry.peakArrayBuffers)}${db})`);
179
137
  }
180
- // Move to next history index of circular buffer
181
138
  Tracker.historyIndex = (Tracker.historyIndex + 1) % Tracker.historySize;
182
139
  }, sampleIntervalMs);
183
140
  this.log.debug(`Tracker started`);
184
141
  }
185
- /**
186
- * Reset peak values to the currently stored values
187
- */
188
142
  resetPeaks() {
189
143
  const prevHistoryIndex = (Tracker.historyIndex + Tracker.historySize - 1) % Tracker.historySize;
190
144
  Tracker.history[prevHistoryIndex].peakOsCpu = 0;
@@ -198,17 +152,6 @@ export class Tracker extends EventEmitter {
198
152
  this.log.debug(`${CYAN}${BRIGHT}Peaks reset at ${new Date(Date.now()).toLocaleString()}.${RESET}${db}`);
199
153
  this.emit('reset_peaks_done');
200
154
  }
201
- /**
202
- * Manually trigger garbage collection to free memory (if exposed with --expose-gc)
203
- *
204
- * @param {'major' | 'minor'} type - The type of garbage collection to perform ('major' or 'minor'). Default is 'major'.
205
- * @param {'sync' | 'async'} execution - The execution mode of garbage collection ('sync' or 'async'). Default is 'async'.
206
- *
207
- * @remarks
208
- * - major collection refers to old-generation mark-sweep/mark-compact cycles.
209
- * - minor collection refers to young-generation collections (scavenges).
210
- * - sync execution blocks the main thread until GC is complete, which can cause pauses.
211
- */
212
155
  runGarbageCollector(type = 'major', execution = 'async') {
213
156
  if (global.gc && typeof global.gc === 'function') {
214
157
  try {
@@ -229,20 +172,15 @@ export class Tracker extends EventEmitter {
229
172
  this.log.debug(`${CYAN}${BRIGHT}Garbage collection not exposed. Start Node.js with --expose-gc to enable manual garbage collection.${RESET}${db}`);
230
173
  }
231
174
  }
232
- /**
233
- * Stop tracking, clear interval, log history
234
- */
235
175
  stop() {
236
176
  this.log.debug(`Tracker stopping...`);
237
177
  if (this.trackerInterval) {
238
178
  clearInterval(this.trackerInterval);
239
179
  this.trackerInterval = undefined;
240
180
  }
241
- // Log all history entries
242
181
  if (this.debug) {
243
182
  this.log.debug(`Tracker history for ${YELLOW}${BRIGHT}${this.name}:${RESET}`);
244
183
  this.log.debug('Timestamp Host cpu Process cpu Rss Heap Used Heap Total External ArrayBuffers');
245
- // 10/10/2025, 20:52:12 4.76 % ( 4.76 %) 0.16 % ( 0.16 %) 38.45 MB ( 38.45 MB) 3.75 MB ( 3.75 MB) 5.29 MB ( 5.29 MB) 1.66 MB ( 1.66 MB) 10.25 KB ( 10.25 KB)
246
184
  for (let i = 0; i < Tracker.historySize; i++) {
247
185
  const index = (Tracker.historyIndex + i) % Tracker.historySize;
248
186
  const entry = Tracker.history[index];
@@ -261,4 +199,3 @@ export class Tracker extends EventEmitter {
261
199
  this.log.debug(`Tracker stopped`);
262
200
  }
263
201
  }
264
- //# sourceMappingURL=tracker.js.map
@@ -1,41 +1,6 @@
1
- /**
2
- * This file contains the wait, waiter and withTimeout functions.
3
- *
4
- * @file wait.ts
5
- * @author Luca Liguori
6
- * @created 2025-02-16
7
- * @version 1.0.2
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
- */
24
- // AnsiLogger module
25
1
  import { AnsiLogger } from 'node-ansi-logger';
26
- /**
27
- * Asynchronous waiter function that resolves when the provided condition is met or rejects on timeout.
28
- *
29
- * @param {string} name - The name of the waiter.
30
- * @param {() => boolean} check - A function that checks the condition. Should return a boolean.
31
- * @param {boolean} [exitWithReject] - Optional. If true, the promise will be rejected on timeout. Default is false.
32
- * @param {number} [resolveTimeout] - Optional. The timeout duration in milliseconds. Default is 5000ms.
33
- * @param {number} [resolveInterval] - Optional. The interval duration in milliseconds between condition checks. Default is 500ms.
34
- * @param {boolean} [debug] - Optional. If true, debug messages will be logged to the console. Default is false.
35
- * @returns {Promise<boolean>} A promise that resolves to true when the condition is met, or false if the timeout occurs.
36
- */
37
2
  export async function waiter(name, check, exitWithReject = false, resolveTimeout = 5000, resolveInterval = 500, debug = false) {
38
- const log = new AnsiLogger({ logName: 'Waiter', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: "debug" /* LogLevel.DEBUG */ });
3
+ const log = new AnsiLogger({ logName: 'Waiter', logTimestampFormat: 4, logLevel: "debug" });
39
4
  if (check()) {
40
5
  if (debug)
41
6
  log.debug(`Waiter "${name}" already true`);
@@ -66,16 +31,8 @@ export async function waiter(name, check, exitWithReject = false, resolveTimeout
66
31
  }, resolveInterval).unref();
67
32
  });
68
33
  }
69
- /**
70
- * Asynchronously waits for a specified amount of time.
71
- *
72
- * @param {number} timeout - The duration to wait in milliseconds. Default is 1000ms.
73
- * @param {string} name - The name of the wait operation. Default is undefined.
74
- * @param {boolean} debug - Whether to enable debug logging. Default is false.
75
- * @returns {Promise<void>} A Promise that resolves after the specified timeout.
76
- */
77
34
  export async function wait(timeout = 1000, name, debug = false) {
78
- const log = new AnsiLogger({ logName: 'Wait', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: "debug" /* LogLevel.DEBUG */ });
35
+ const log = new AnsiLogger({ logName: 'Wait', logTimestampFormat: 4, logLevel: "debug" });
79
36
  if (debug)
80
37
  log.debug(`Wait "${name}" started...`);
81
38
  return new Promise((resolve) => {
@@ -87,14 +44,6 @@ export async function wait(timeout = 1000, name, debug = false) {
87
44
  }, timeout).unref();
88
45
  });
89
46
  }
90
- /**
91
- * Wraps a promise with a timeout. If the promise does not resolve or reject within the specified time, it will be rejected.
92
- *
93
- * @param {Promise<T>} promise - The promise to wrap.
94
- * @param {number} [timeoutMillisecs] - The timeout duration in milliseconds. Default is 10000ms.
95
- * @param {boolean} [reThrow] - Optional. If true, the promise will rethrow the original promise and will reject on timeout. Default is true.
96
- * @returns {Promise<T>} A new promise that resolves or rejects based on the original promise and the timeout.
97
- */
98
47
  export function withTimeout(promise, timeoutMillisecs = 10000, reThrow = true) {
99
48
  return new Promise((resolve, reject) => {
100
49
  const timer = setTimeout(() => {
@@ -102,24 +51,23 @@ export function withTimeout(promise, timeoutMillisecs = 10000, reThrow = true) {
102
51
  reject(new Error('Operation timed out'));
103
52
  }
104
53
  else {
105
- resolve(undefined); // Resolve with undefined if reThrow is false
54
+ resolve(undefined);
106
55
  }
107
- }, timeoutMillisecs).unref(); // Unref the timer to prevent it from keeping the event loop alive
56
+ }, timeoutMillisecs).unref();
108
57
  promise
109
58
  .then((result) => {
110
- clearTimeout(timer); // Ensure timeout does not fire if promise resolves first
59
+ clearTimeout(timer);
111
60
  resolve(result);
112
61
  return result;
113
62
  })
114
63
  .catch((error) => {
115
- clearTimeout(timer); // Ensure timeout does not fire if promise rejects first
64
+ clearTimeout(timer);
116
65
  if (reThrow) {
117
- reject(error); // Reject with the original error
66
+ reject(error);
118
67
  }
119
68
  else {
120
- resolve(undefined); // Resolve with undefined if reThrow is false
69
+ resolve(undefined);
121
70
  }
122
71
  });
123
72
  });
124
73
  }
125
- //# sourceMappingURL=wait.js.map
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "matterbridge",
3
- "version": "3.3.7",
3
+ "version": "3.3.8-dev-20251115-920acfc",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "matterbridge",
9
- "version": "3.3.7",
9
+ "version": "3.3.8-dev-20251115-920acfc",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@matter/main": "0.15.6",
@@ -367,9 +367,9 @@
367
367
  "license": "MIT"
368
368
  },
369
369
  "node_modules/bare-events": {
370
- "version": "2.8.1",
371
- "resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.8.1.tgz",
372
- "integrity": "sha512-oxSAxTS1hRfnyit2CL5QpAOS5ixfBjj6ex3yTNvXyY/kE719jQ/IjuESJBK2w5v4wwQRAHGseVJXx9QBYOtFGQ==",
370
+ "version": "2.8.2",
371
+ "resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.8.2.tgz",
372
+ "integrity": "sha512-riJjyv1/mHLIPX4RwiK+oW9/4c3TEUeORHKefKAKnZ5kyslbN+HXowtbaVEqt4IMUB7OXlfixcs6gsFeo/jhiQ==",
373
373
  "license": "Apache-2.0",
374
374
  "peerDependencies": {
375
375
  "bare-abort-controller": "*"
@@ -1507,9 +1507,9 @@
1507
1507
  }
1508
1508
  },
1509
1509
  "node_modules/path-scurry": {
1510
- "version": "2.0.0",
1511
- "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.0.tgz",
1512
- "integrity": "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==",
1510
+ "version": "2.0.1",
1511
+ "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.1.tgz",
1512
+ "integrity": "sha512-oWyT4gICAu+kaA7QWk/jvCHWarMKNs6pXOGWKDTr7cw4IGcUbW+PeTfbaQiLGheFRpjo6O9J0PmyMfQPjH71oA==",
1513
1513
  "license": "BlueOak-1.0.0",
1514
1514
  "dependencies": {
1515
1515
  "lru-cache": "^11.0.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "matterbridge",
3
- "version": "3.3.7",
3
+ "version": "3.3.8-dev-20251115-920acfc",
4
4
  "description": "Matterbridge plugin manager for Matter",
5
5
  "author": "https://github.com/Luligu",
6
6
  "license": "Apache-2.0",
@@ -40,7 +40,6 @@
40
40
  ],
41
41
  "type": "module",
42
42
  "main": "dist/index.js",
43
- "types": "dist/index.d.ts",
44
43
  "bin": {
45
44
  "matterbridge": "bin/matterbridge.js",
46
45
  "mb_mdns": "bin/mb_mdns.js",
@@ -66,6 +65,10 @@
66
65
  "import": "./dist/utils/export.js",
67
66
  "types": "./dist/utils/export.d.ts"
68
67
  },
68
+ "./jestutils": {
69
+ "import": "./dist/jestutils/export.js",
70
+ "types": "./dist/jestutils/export.d.ts"
71
+ },
69
72
  "./logger": {
70
73
  "import": "./dist/logger/export.js",
71
74
  "types": "./dist/logger/export.d.ts"