matterbridge 3.3.8 → 3.3.9-dev-20251118-930cfdb

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 (312) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README-DEV.md +20 -25
  3. package/dist/broadcastServer.js +1 -93
  4. package/dist/broadcastServerTypes.js +0 -24
  5. package/dist/cli.js +1 -97
  6. package/dist/cliEmitter.js +0 -37
  7. package/dist/cliHistory.js +0 -38
  8. package/dist/clusters/export.js +0 -2
  9. package/dist/defaultConfigSchema.js +0 -24
  10. package/dist/deviceManager.js +1 -105
  11. package/dist/devices/airConditioner.js +0 -57
  12. package/dist/devices/batteryStorage.js +1 -48
  13. package/dist/devices/cooktop.js +0 -55
  14. package/dist/devices/dishwasher.js +0 -57
  15. package/dist/devices/evse.js +10 -74
  16. package/dist/devices/export.js +0 -5
  17. package/dist/devices/extractorHood.js +0 -43
  18. package/dist/devices/heatPump.js +2 -50
  19. package/dist/devices/laundryDryer.js +3 -62
  20. package/dist/devices/laundryWasher.js +4 -70
  21. package/dist/devices/microwaveOven.js +5 -88
  22. package/dist/devices/oven.js +0 -85
  23. package/dist/devices/refrigerator.js +0 -102
  24. package/dist/devices/roboticVacuumCleaner.js +9 -100
  25. package/dist/devices/solarPower.js +0 -38
  26. package/dist/devices/speaker.js +0 -84
  27. package/dist/devices/temperatureControl.js +3 -24
  28. package/dist/devices/waterHeater.js +2 -82
  29. package/dist/dgram/coap.js +13 -126
  30. package/dist/dgram/dgram.js +2 -114
  31. package/dist/dgram/mb_coap.js +3 -41
  32. package/dist/dgram/mb_mdns.js +15 -80
  33. package/dist/dgram/mdns.js +137 -299
  34. package/dist/dgram/multicast.js +1 -62
  35. package/dist/dgram/unicast.js +0 -54
  36. package/dist/frontend.js +39 -454
  37. package/dist/frontendTypes.js +0 -45
  38. package/dist/helpers.js +0 -53
  39. package/dist/index.js +0 -25
  40. package/dist/jestutils/export.js +0 -1
  41. package/dist/jestutils/jestHelpers.js +104 -278
  42. package/dist/logger/export.js +0 -1
  43. package/dist/matter/behaviors.js +0 -2
  44. package/dist/matter/clusters.js +0 -2
  45. package/dist/matter/devices.js +0 -2
  46. package/dist/matter/endpoints.js +0 -2
  47. package/dist/matter/export.js +0 -3
  48. package/dist/matter/types.js +0 -3
  49. package/dist/matterbridge.js +51 -792
  50. package/dist/matterbridgeAccessoryPlatform.js +0 -38
  51. package/dist/matterbridgeBehaviors.js +5 -68
  52. package/dist/matterbridgeDeviceTypes.js +14 -635
  53. package/dist/matterbridgeDynamicPlatform.js +0 -38
  54. package/dist/matterbridgeEndpoint.js +82 -1445
  55. package/dist/matterbridgeEndpointHelpers.js +21 -483
  56. package/dist/matterbridgeEndpointTypes.js +0 -25
  57. package/dist/matterbridgePlatform.js +1 -354
  58. package/dist/matterbridgeTypes.js +0 -26
  59. package/dist/pluginManager.js +11 -346
  60. package/dist/shelly.js +7 -168
  61. package/dist/storage/export.js +0 -1
  62. package/dist/update.js +0 -69
  63. package/dist/utils/colorUtils.js +2 -97
  64. package/dist/utils/commandLine.js +0 -60
  65. package/dist/utils/copyDirectory.js +1 -38
  66. package/dist/utils/createDirectory.js +0 -33
  67. package/dist/utils/createZip.js +2 -47
  68. package/dist/utils/deepCopy.js +0 -39
  69. package/dist/utils/deepEqual.js +1 -72
  70. package/dist/utils/error.js +0 -41
  71. package/dist/utils/export.js +0 -1
  72. package/dist/utils/format.js +0 -49
  73. package/dist/utils/hex.js +0 -124
  74. package/dist/utils/inspector.js +1 -69
  75. package/dist/utils/isvalid.js +0 -101
  76. package/dist/utils/network.js +5 -96
  77. package/dist/utils/spawn.js +0 -71
  78. package/dist/utils/tracker.js +1 -64
  79. package/dist/utils/wait.js +8 -60
  80. package/npm-shrinkwrap.json +2 -2
  81. package/package.json +1 -2
  82. package/dist/broadcastServer.d.ts +0 -115
  83. package/dist/broadcastServer.d.ts.map +0 -1
  84. package/dist/broadcastServer.js.map +0 -1
  85. package/dist/broadcastServerTypes.d.ts +0 -806
  86. package/dist/broadcastServerTypes.d.ts.map +0 -1
  87. package/dist/broadcastServerTypes.js.map +0 -1
  88. package/dist/cli.d.ts +0 -30
  89. package/dist/cli.d.ts.map +0 -1
  90. package/dist/cli.js.map +0 -1
  91. package/dist/cliEmitter.d.ts +0 -50
  92. package/dist/cliEmitter.d.ts.map +0 -1
  93. package/dist/cliEmitter.js.map +0 -1
  94. package/dist/cliHistory.d.ts +0 -48
  95. package/dist/cliHistory.d.ts.map +0 -1
  96. package/dist/cliHistory.js.map +0 -1
  97. package/dist/clusters/export.d.ts +0 -2
  98. package/dist/clusters/export.d.ts.map +0 -1
  99. package/dist/clusters/export.js.map +0 -1
  100. package/dist/defaultConfigSchema.d.ts +0 -28
  101. package/dist/defaultConfigSchema.d.ts.map +0 -1
  102. package/dist/defaultConfigSchema.js.map +0 -1
  103. package/dist/deviceManager.d.ts +0 -128
  104. package/dist/deviceManager.d.ts.map +0 -1
  105. package/dist/deviceManager.js.map +0 -1
  106. package/dist/devices/airConditioner.d.ts +0 -98
  107. package/dist/devices/airConditioner.d.ts.map +0 -1
  108. package/dist/devices/airConditioner.js.map +0 -1
  109. package/dist/devices/batteryStorage.d.ts +0 -48
  110. package/dist/devices/batteryStorage.d.ts.map +0 -1
  111. package/dist/devices/batteryStorage.js.map +0 -1
  112. package/dist/devices/cooktop.d.ts +0 -60
  113. package/dist/devices/cooktop.d.ts.map +0 -1
  114. package/dist/devices/cooktop.js.map +0 -1
  115. package/dist/devices/dishwasher.d.ts +0 -71
  116. package/dist/devices/dishwasher.d.ts.map +0 -1
  117. package/dist/devices/dishwasher.js.map +0 -1
  118. package/dist/devices/evse.d.ts +0 -76
  119. package/dist/devices/evse.d.ts.map +0 -1
  120. package/dist/devices/evse.js.map +0 -1
  121. package/dist/devices/export.d.ts +0 -17
  122. package/dist/devices/export.d.ts.map +0 -1
  123. package/dist/devices/export.js.map +0 -1
  124. package/dist/devices/extractorHood.d.ts +0 -46
  125. package/dist/devices/extractorHood.d.ts.map +0 -1
  126. package/dist/devices/extractorHood.js.map +0 -1
  127. package/dist/devices/heatPump.d.ts +0 -47
  128. package/dist/devices/heatPump.d.ts.map +0 -1
  129. package/dist/devices/heatPump.js.map +0 -1
  130. package/dist/devices/laundryDryer.d.ts +0 -67
  131. package/dist/devices/laundryDryer.d.ts.map +0 -1
  132. package/dist/devices/laundryDryer.js.map +0 -1
  133. package/dist/devices/laundryWasher.d.ts +0 -81
  134. package/dist/devices/laundryWasher.d.ts.map +0 -1
  135. package/dist/devices/laundryWasher.js.map +0 -1
  136. package/dist/devices/microwaveOven.d.ts +0 -168
  137. package/dist/devices/microwaveOven.d.ts.map +0 -1
  138. package/dist/devices/microwaveOven.js.map +0 -1
  139. package/dist/devices/oven.d.ts +0 -105
  140. package/dist/devices/oven.d.ts.map +0 -1
  141. package/dist/devices/oven.js.map +0 -1
  142. package/dist/devices/refrigerator.d.ts +0 -118
  143. package/dist/devices/refrigerator.d.ts.map +0 -1
  144. package/dist/devices/refrigerator.js.map +0 -1
  145. package/dist/devices/roboticVacuumCleaner.d.ts +0 -112
  146. package/dist/devices/roboticVacuumCleaner.d.ts.map +0 -1
  147. package/dist/devices/roboticVacuumCleaner.js.map +0 -1
  148. package/dist/devices/solarPower.d.ts +0 -40
  149. package/dist/devices/solarPower.d.ts.map +0 -1
  150. package/dist/devices/solarPower.js.map +0 -1
  151. package/dist/devices/speaker.d.ts +0 -87
  152. package/dist/devices/speaker.d.ts.map +0 -1
  153. package/dist/devices/speaker.js.map +0 -1
  154. package/dist/devices/temperatureControl.d.ts +0 -166
  155. package/dist/devices/temperatureControl.d.ts.map +0 -1
  156. package/dist/devices/temperatureControl.js.map +0 -1
  157. package/dist/devices/waterHeater.d.ts +0 -111
  158. package/dist/devices/waterHeater.d.ts.map +0 -1
  159. package/dist/devices/waterHeater.js.map +0 -1
  160. package/dist/dgram/coap.d.ts +0 -205
  161. package/dist/dgram/coap.d.ts.map +0 -1
  162. package/dist/dgram/coap.js.map +0 -1
  163. package/dist/dgram/dgram.d.ts +0 -141
  164. package/dist/dgram/dgram.d.ts.map +0 -1
  165. package/dist/dgram/dgram.js.map +0 -1
  166. package/dist/dgram/mb_coap.d.ts +0 -24
  167. package/dist/dgram/mb_coap.d.ts.map +0 -1
  168. package/dist/dgram/mb_coap.js.map +0 -1
  169. package/dist/dgram/mb_mdns.d.ts +0 -24
  170. package/dist/dgram/mb_mdns.d.ts.map +0 -1
  171. package/dist/dgram/mb_mdns.js.map +0 -1
  172. package/dist/dgram/mdns.d.ts +0 -290
  173. package/dist/dgram/mdns.d.ts.map +0 -1
  174. package/dist/dgram/mdns.js.map +0 -1
  175. package/dist/dgram/multicast.d.ts +0 -67
  176. package/dist/dgram/multicast.d.ts.map +0 -1
  177. package/dist/dgram/multicast.js.map +0 -1
  178. package/dist/dgram/unicast.d.ts +0 -56
  179. package/dist/dgram/unicast.d.ts.map +0 -1
  180. package/dist/dgram/unicast.js.map +0 -1
  181. package/dist/frontend.d.ts +0 -238
  182. package/dist/frontend.d.ts.map +0 -1
  183. package/dist/frontend.js.map +0 -1
  184. package/dist/frontendTypes.d.ts +0 -529
  185. package/dist/frontendTypes.d.ts.map +0 -1
  186. package/dist/frontendTypes.js.map +0 -1
  187. package/dist/helpers.d.ts +0 -48
  188. package/dist/helpers.d.ts.map +0 -1
  189. package/dist/helpers.js.map +0 -1
  190. package/dist/index.d.ts +0 -34
  191. package/dist/index.d.ts.map +0 -1
  192. package/dist/index.js.map +0 -1
  193. package/dist/jestutils/export.d.ts +0 -2
  194. package/dist/jestutils/export.d.ts.map +0 -1
  195. package/dist/jestutils/export.js.map +0 -1
  196. package/dist/jestutils/jestHelpers.d.ts +0 -250
  197. package/dist/jestutils/jestHelpers.d.ts.map +0 -1
  198. package/dist/jestutils/jestHelpers.js.map +0 -1
  199. package/dist/logger/export.d.ts +0 -2
  200. package/dist/logger/export.d.ts.map +0 -1
  201. package/dist/logger/export.js.map +0 -1
  202. package/dist/matter/behaviors.d.ts +0 -2
  203. package/dist/matter/behaviors.d.ts.map +0 -1
  204. package/dist/matter/behaviors.js.map +0 -1
  205. package/dist/matter/clusters.d.ts +0 -2
  206. package/dist/matter/clusters.d.ts.map +0 -1
  207. package/dist/matter/clusters.js.map +0 -1
  208. package/dist/matter/devices.d.ts +0 -2
  209. package/dist/matter/devices.d.ts.map +0 -1
  210. package/dist/matter/devices.js.map +0 -1
  211. package/dist/matter/endpoints.d.ts +0 -2
  212. package/dist/matter/endpoints.d.ts.map +0 -1
  213. package/dist/matter/endpoints.js.map +0 -1
  214. package/dist/matter/export.d.ts +0 -5
  215. package/dist/matter/export.d.ts.map +0 -1
  216. package/dist/matter/export.js.map +0 -1
  217. package/dist/matter/types.d.ts +0 -3
  218. package/dist/matter/types.d.ts.map +0 -1
  219. package/dist/matter/types.js.map +0 -1
  220. package/dist/matterbridge.d.ts +0 -469
  221. package/dist/matterbridge.d.ts.map +0 -1
  222. package/dist/matterbridge.js.map +0 -1
  223. package/dist/matterbridgeAccessoryPlatform.d.ts +0 -41
  224. package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
  225. package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
  226. package/dist/matterbridgeBehaviors.d.ts +0 -2404
  227. package/dist/matterbridgeBehaviors.d.ts.map +0 -1
  228. package/dist/matterbridgeBehaviors.js.map +0 -1
  229. package/dist/matterbridgeDeviceTypes.d.ts +0 -698
  230. package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
  231. package/dist/matterbridgeDeviceTypes.js.map +0 -1
  232. package/dist/matterbridgeDynamicPlatform.d.ts +0 -41
  233. package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
  234. package/dist/matterbridgeDynamicPlatform.js.map +0 -1
  235. package/dist/matterbridgeEndpoint.d.ts +0 -1490
  236. package/dist/matterbridgeEndpoint.d.ts.map +0 -1
  237. package/dist/matterbridgeEndpoint.js.map +0 -1
  238. package/dist/matterbridgeEndpointHelpers.d.ts +0 -787
  239. package/dist/matterbridgeEndpointHelpers.d.ts.map +0 -1
  240. package/dist/matterbridgeEndpointHelpers.js.map +0 -1
  241. package/dist/matterbridgeEndpointTypes.d.ts +0 -197
  242. package/dist/matterbridgeEndpointTypes.d.ts.map +0 -1
  243. package/dist/matterbridgeEndpointTypes.js.map +0 -1
  244. package/dist/matterbridgePlatform.d.ts +0 -415
  245. package/dist/matterbridgePlatform.d.ts.map +0 -1
  246. package/dist/matterbridgePlatform.js.map +0 -1
  247. package/dist/matterbridgeTypes.d.ts +0 -239
  248. package/dist/matterbridgeTypes.d.ts.map +0 -1
  249. package/dist/matterbridgeTypes.js.map +0 -1
  250. package/dist/pluginManager.d.ts +0 -371
  251. package/dist/pluginManager.d.ts.map +0 -1
  252. package/dist/pluginManager.js.map +0 -1
  253. package/dist/shelly.d.ts +0 -174
  254. package/dist/shelly.d.ts.map +0 -1
  255. package/dist/shelly.js.map +0 -1
  256. package/dist/storage/export.d.ts +0 -2
  257. package/dist/storage/export.d.ts.map +0 -1
  258. package/dist/storage/export.js.map +0 -1
  259. package/dist/update.d.ts +0 -75
  260. package/dist/update.d.ts.map +0 -1
  261. package/dist/update.js.map +0 -1
  262. package/dist/utils/colorUtils.d.ts +0 -101
  263. package/dist/utils/colorUtils.d.ts.map +0 -1
  264. package/dist/utils/colorUtils.js.map +0 -1
  265. package/dist/utils/commandLine.d.ts +0 -66
  266. package/dist/utils/commandLine.d.ts.map +0 -1
  267. package/dist/utils/commandLine.js.map +0 -1
  268. package/dist/utils/copyDirectory.d.ts +0 -33
  269. package/dist/utils/copyDirectory.d.ts.map +0 -1
  270. package/dist/utils/copyDirectory.js.map +0 -1
  271. package/dist/utils/createDirectory.d.ts +0 -34
  272. package/dist/utils/createDirectory.d.ts.map +0 -1
  273. package/dist/utils/createDirectory.js.map +0 -1
  274. package/dist/utils/createZip.d.ts +0 -39
  275. package/dist/utils/createZip.d.ts.map +0 -1
  276. package/dist/utils/createZip.js.map +0 -1
  277. package/dist/utils/deepCopy.d.ts +0 -32
  278. package/dist/utils/deepCopy.d.ts.map +0 -1
  279. package/dist/utils/deepCopy.js.map +0 -1
  280. package/dist/utils/deepEqual.d.ts +0 -54
  281. package/dist/utils/deepEqual.d.ts.map +0 -1
  282. package/dist/utils/deepEqual.js.map +0 -1
  283. package/dist/utils/error.d.ts +0 -44
  284. package/dist/utils/error.d.ts.map +0 -1
  285. package/dist/utils/error.js.map +0 -1
  286. package/dist/utils/export.d.ts +0 -13
  287. package/dist/utils/export.d.ts.map +0 -1
  288. package/dist/utils/export.js.map +0 -1
  289. package/dist/utils/format.d.ts +0 -53
  290. package/dist/utils/format.d.ts.map +0 -1
  291. package/dist/utils/format.js.map +0 -1
  292. package/dist/utils/hex.d.ts +0 -89
  293. package/dist/utils/hex.d.ts.map +0 -1
  294. package/dist/utils/hex.js.map +0 -1
  295. package/dist/utils/inspector.d.ts +0 -87
  296. package/dist/utils/inspector.d.ts.map +0 -1
  297. package/dist/utils/inspector.js.map +0 -1
  298. package/dist/utils/isvalid.d.ts +0 -103
  299. package/dist/utils/isvalid.d.ts.map +0 -1
  300. package/dist/utils/isvalid.js.map +0 -1
  301. package/dist/utils/network.d.ts +0 -101
  302. package/dist/utils/network.d.ts.map +0 -1
  303. package/dist/utils/network.js.map +0 -1
  304. package/dist/utils/spawn.d.ts +0 -35
  305. package/dist/utils/spawn.d.ts.map +0 -1
  306. package/dist/utils/spawn.js.map +0 -1
  307. package/dist/utils/tracker.d.ts +0 -108
  308. package/dist/utils/tracker.d.ts.map +0 -1
  309. package/dist/utils/tracker.js.map +0 -1
  310. package/dist/utils/wait.d.ts +0 -54
  311. package/dist/utils/wait.d.ts.map +0 -1
  312. package/dist/utils/wait.js.map +0 -1
@@ -1,239 +0,0 @@
1
- /**
2
- * This file contains the types for Matterbridge.
3
- *
4
- * @file matterbridgeTypes.ts
5
- * @author Luca Liguori
6
- * @created 2024-07-12
7
- * @version 1.0.2
8
- * @license Apache-2.0
9
- *
10
- * Copyright 2023, 2024, 2025 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
- import type { NodeStorage } from 'node-persist-manager';
25
- import type { LogLevel } from 'node-ansi-logger';
26
- import type { ServerNode, Endpoint as EndpointNode } from '@matter/node';
27
- import type { StorageContext } from '@matter/general';
28
- import type { FabricIndex, VendorId, EndpointNumber } from '@matter/types';
29
- import type { AggregatorEndpoint } from '@matter/node/endpoints/aggregator';
30
- import type { AdministratorCommissioning } from '@matter/types/clusters/administrator-commissioning';
31
- import type { Matterbridge } from './matterbridge.js';
32
- import type { MatterbridgePlatform, PlatformConfig, PlatformSchema } from './matterbridgePlatform.js';
33
- import type { MatterbridgeEndpoint } from './matterbridgeEndpoint.js';
34
- export declare const plg = "\u001B[38;5;33m";
35
- export declare const dev = "\u001B[38;5;79m";
36
- export declare const typ = "\u001B[38;5;207m";
37
- export declare const MATTERBRIDGE_LOGGER_FILE = "matterbridge.log";
38
- export declare const MATTER_LOGGER_FILE = "matter.log";
39
- export declare const NODE_STORAGE_DIR = "storage";
40
- export declare const MATTER_STORAGE_NAME = "matterstorage";
41
- export declare const MATTERBRIDGE_DIAGNOSTIC_FILE = "diagnostic.log";
42
- export declare const MATTERBRIDGE_HISTORY_FILE = "history.html";
43
- export type MaybePromise<T> = T | Promise<T>;
44
- /**
45
- * A type representing a read-only subset of the Matterbridge properties.
46
- */
47
- export type SharedMatterbridge = Readonly<Pick<Matterbridge, 'systemInformation' | 'rootDirectory' | 'homeDirectory' | 'matterbridgeDirectory' | 'matterbridgePluginDirectory' | 'matterbridgeCertDirectory' | 'globalModulesDirectory' | 'matterbridgeVersion' | 'matterbridgeLatestVersion' | 'matterbridgeDevVersion' | 'frontendVersion' | 'bridgeMode' | 'restartMode' | 'virtualMode' | 'profile' | 'fileLogger' | 'matterFileLogger' | 'mdnsInterface' | 'ipv4Address' | 'ipv6Address' | 'port' | 'discriminator' | 'passcode'>>;
48
- export type PluginName = string;
49
- /** Define an interface for matterbridge */
50
- export interface Plugin extends ApiPlugin {
51
- /** Node storage context created in the directory 'storage' in matterbridgeDirectory with the plugin name */
52
- nodeContext?: NodeStorage;
53
- storageContext?: StorageContext;
54
- serverNode?: ServerNode<ServerNode.RootEndpoint>;
55
- aggregatorNode?: EndpointNode<AggregatorEndpoint>;
56
- device?: MatterbridgeEndpoint;
57
- platform?: MatterbridgePlatform;
58
- reachabilityTimeout?: NodeJS.Timeout;
59
- }
60
- /** Define an interface for the frontend */
61
- export interface ApiPlugin extends StoragePlugin {
62
- latestVersion?: string;
63
- devVersion?: string;
64
- homepage?: string;
65
- help?: string;
66
- changelog?: string;
67
- funding?: string;
68
- locked?: boolean;
69
- error?: boolean;
70
- loaded?: boolean;
71
- started?: boolean;
72
- configured?: boolean;
73
- /** Signal that the config has changed and a restart is required */
74
- restartRequired?: boolean;
75
- registeredDevices?: number;
76
- configJson?: PlatformConfig;
77
- schemaJson?: PlatformSchema;
78
- hasWhiteList?: boolean;
79
- hasBlackList?: boolean;
80
- matter?: ApiMatter;
81
- }
82
- /** Define an interface for storing the plugin information */
83
- export interface StoragePlugin {
84
- name: string;
85
- path: string;
86
- type: 'DynamicPlatform' | 'AccessoryPlatform' | 'AnyPlatform';
87
- version: string;
88
- description: string;
89
- author: string;
90
- enabled: boolean;
91
- }
92
- /** Define an interface for the system information */
93
- export interface SystemInformation {
94
- interfaceName: string;
95
- macAddress: string;
96
- ipv4Address: string;
97
- ipv6Address: string;
98
- nodeVersion: string;
99
- hostname: string;
100
- user: string;
101
- osType: string;
102
- osRelease: string;
103
- osPlatform: string;
104
- osArch: string;
105
- totalMemory: string;
106
- freeMemory: string;
107
- systemUptime: string;
108
- processUptime: string;
109
- cpuUsage: string;
110
- processCpuUsage: string;
111
- rss: string;
112
- heapTotal: string;
113
- heapUsed: string;
114
- }
115
- /** Define an interface for the matterbridge information */
116
- export interface MatterbridgeInformation {
117
- rootDirectory: string;
118
- homeDirectory: string;
119
- matterbridgeDirectory: string;
120
- matterbridgePluginDirectory: string;
121
- matterbridgeCertDirectory: string;
122
- globalModulesDirectory: string;
123
- matterbridgeVersion: string;
124
- matterbridgeLatestVersion: string;
125
- matterbridgeDevVersion: string;
126
- frontendVersion: string;
127
- bridgeMode: string;
128
- restartMode: string;
129
- virtualMode: 'disabled' | 'outlet' | 'light' | 'switch' | 'mounted_switch';
130
- profile: string | undefined;
131
- readOnly: boolean;
132
- shellyBoard: boolean;
133
- shellySysUpdate: boolean;
134
- shellyMainUpdate: boolean;
135
- loggerLevel: LogLevel;
136
- fileLogger: boolean;
137
- matterLoggerLevel: number;
138
- matterFileLogger: boolean;
139
- matterMdnsInterface: string | undefined;
140
- matterIpv4Address: string | undefined;
141
- matterIpv6Address: string | undefined;
142
- matterPort: number;
143
- matterDiscriminator: number | undefined;
144
- matterPasscode: number | undefined;
145
- restartRequired: boolean;
146
- fixedRestartRequired: boolean;
147
- updateRequired: boolean;
148
- }
149
- /** Define an interface for sanitized exposed fabric information suitable for API responses */
150
- export interface SanitizedExposedFabricInformation {
151
- fabricIndex: FabricIndex;
152
- fabricId: string;
153
- nodeId: string;
154
- rootNodeId: string;
155
- rootVendorId: VendorId;
156
- rootVendorName: string;
157
- label: string;
158
- }
159
- /** Define an interface for sanitized session information suitable for API responses */
160
- export interface SanitizedSession {
161
- name: string;
162
- nodeId: string;
163
- peerNodeId: string;
164
- fabric?: SanitizedExposedFabricInformation;
165
- isPeerActive: boolean;
166
- lastInteractionTimestamp: string;
167
- lastActiveTimestamp: string;
168
- numberOfActiveSubscriptions: number;
169
- }
170
- /** Define an interface for API device information */
171
- export interface ApiDevice {
172
- pluginName: string;
173
- type: string;
174
- endpoint: EndpointNumber | undefined;
175
- name: string;
176
- serial: string;
177
- productUrl: string;
178
- configUrl?: string;
179
- uniqueId: string;
180
- reachable: boolean;
181
- powerSource?: 'ac' | 'dc' | 'ok' | 'warning' | 'critical';
182
- cluster: string;
183
- matter?: ApiMatter;
184
- }
185
- /** Define an interface for base device information */
186
- export interface BaseDevice {
187
- pluginName: string | undefined;
188
- deviceType: number | undefined;
189
- number: EndpointNumber | undefined;
190
- id: string | undefined;
191
- deviceName: string | undefined;
192
- serialNumber: string | undefined;
193
- uniqueId: string | undefined;
194
- productUrl: string;
195
- configUrl: string | undefined;
196
- }
197
- /** Define an interface for API matter information */
198
- export interface ApiMatter {
199
- id: string;
200
- online: boolean;
201
- commissioned: boolean;
202
- advertising: boolean;
203
- advertiseTime: number;
204
- windowStatus: AdministratorCommissioning.CommissioningWindowStatus;
205
- fabricInformations: SanitizedExposedFabricInformation[];
206
- sessionInformations: SanitizedSession[];
207
- qrPairingCode: string;
208
- manualPairingCode: string;
209
- serialNumber: string | undefined;
210
- }
211
- /** Define an interface for API clusters information */
212
- export interface ApiClusters {
213
- plugin: string;
214
- deviceName: string;
215
- serialNumber: string;
216
- /** Endpoint number */
217
- number: EndpointNumber;
218
- /** Endpoint id */
219
- id: string;
220
- deviceTypes: number[];
221
- clusters: Cluster[];
222
- }
223
- /** Define an interface for Cluster information in ApiClusters */
224
- export interface Cluster {
225
- /** Endpoint number > string */
226
- endpoint: string;
227
- /** Endpoint number */
228
- number: EndpointNumber;
229
- /** Endpoint id or main for the device root endpoint */
230
- id: string;
231
- deviceTypes: number[];
232
- clusterName: string;
233
- clusterId: string;
234
- attributeName: string;
235
- attributeId: string;
236
- attributeValue: string;
237
- attributeLocalValue: unknown;
238
- }
239
- //# sourceMappingURL=matterbridgeTypes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"matterbridgeTypes.d.ts","sourceRoot":"","sources":["../src/matterbridgeTypes.ts"],"names":[],"mappings":"AAAA;;;;;;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geTypes.js","sourceRoot":"","sources":["../src/matterbridgeTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAiBH,iBAAiB;AACjB,MAAM,CAAC,MAAM,GAAG,GAAG,iBAAiB,CAAC;AACrC,MAAM,CAAC,MAAM,GAAG,GAAG,iBAAiB,CAAC;AACrC,MAAM,CAAC,MAAM,GAAG,GAAG,kBAAkB,CAAC;AAEtC,gBAAgB;AAChB,MAAM,CAAC,MAAM,wBAAwB,GAAG,kBAAkB,CAAC;AAC3D,MAAM,CAAC,MAAM,kBAAkB,GAAG,YAAY,CAAC;AAC/C,MAAM,CAAC,MAAM,gBAAgB,GAAG,SAAS,CAAC;AAC1C,MAAM,CAAC,MAAM,mBAAmB,GAAG,eAAe,CAAC;AACnD,MAAM,CAAC,MAAM,4BAA4B,GAAG,gBAAgB,CAAC;AAC7D,MAAM,CAAC,MAAM,yBAAyB,GAAG,cAAc,CAAC"}
@@ -1,371 +0,0 @@
1
- /**
2
- * This file contains the Plugins class.
3
- *
4
- * @file plugins.ts
5
- * @author Luca Liguori
6
- * @created 2024-07-14
7
- * @version 1.3.0
8
- * @license Apache-2.0
9
- *
10
- * Copyright 2024, 2025, 2026 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
- import EventEmitter from 'node:events';
25
- import { LogLevel } from 'node-ansi-logger';
26
- import type { Matterbridge } from './matterbridge.js';
27
- import type { MatterbridgePlatform, PlatformConfig, PlatformSchema } from './matterbridgePlatform.js';
28
- import { ApiPlugin, Plugin, PluginName, StoragePlugin } from './matterbridgeTypes.js';
29
- interface PluginManagerEvents {
30
- added: [name: string];
31
- removed: [name: string];
32
- loaded: [name: string];
33
- enabled: [name: string];
34
- disabled: [name: string];
35
- installed: [name: string, version: string | undefined];
36
- uninstalled: [name: string];
37
- started: [name: string];
38
- configured: [name: string];
39
- shutdown: [name: string];
40
- }
41
- /**
42
- * Manages Matterbridge plugins.
43
- */
44
- export declare class PluginManager extends EventEmitter<PluginManagerEvents> {
45
- private readonly matterbridge;
46
- private readonly _plugins;
47
- private readonly log;
48
- private readonly server;
49
- private readonly debug;
50
- private readonly verbose;
51
- /**
52
- * Creates an instance of PluginManager.
53
- *
54
- * @param {Matterbridge} matterbridge - The Matterbridge instance.
55
- */
56
- constructor(matterbridge: Matterbridge);
57
- destroy(): void;
58
- private msgHandler;
59
- /**
60
- * Gets the number of plugins.
61
- *
62
- * @returns {number} The number of plugins.
63
- */
64
- get length(): number;
65
- /**
66
- * Gets the number of plugins.
67
- *
68
- * @returns {number} The number of plugins.
69
- */
70
- get size(): number;
71
- /**
72
- * Checks if a plugin with the specified name exists.
73
- *
74
- * @param {string} name - The name of the plugin.
75
- * @returns {boolean} True if the plugin exists, false otherwise.
76
- */
77
- has(name: string): boolean;
78
- /**
79
- * Gets a plugin by its name.
80
- *
81
- * @param {string} name - The name of the plugin.
82
- * @returns {Plugin | undefined} The plugin, or undefined if not found.
83
- */
84
- get(name: string): Plugin | undefined;
85
- /**
86
- * Adds a plugin to the manager.
87
- *
88
- * @param {Plugin} plugin - The plugin to add.
89
- * @returns {Plugin} The added plugin.
90
- */
91
- set(plugin: Plugin): Plugin;
92
- /**
93
- * Clears all plugins from the manager.
94
- */
95
- clear(): void;
96
- /**
97
- * Converts a plugin or API plugin to a storage plugin.
98
- *
99
- * @param {Plugin | ApiPlugin} plugin - The plugin or API plugin to convert.
100
- * @returns {StoragePlugin} The converted storage plugin.
101
- */
102
- private toStoragePlugin;
103
- /**
104
- * Converts a plugin to an API plugin.
105
- *
106
- * @param {Plugin} plugin - The plugin to convert.
107
- * @returns {ApiPlugin} The converted API plugin.
108
- */
109
- private toApiPlugin;
110
- /**
111
- * Gets an array of all plugins.
112
- *
113
- * @returns {Plugin[]} An array of all plugins.
114
- */
115
- array(): Plugin[];
116
- /**
117
- * Gets a StoragePlugin array of all plugins suitable for serialization.
118
- *
119
- * @returns {StoragePlugin[]} An array of all plugins.
120
- */
121
- storagePluginArray(): StoragePlugin[];
122
- /**
123
- * Gets an ApiPlugin array of all plugins suitable for serialization.
124
- *
125
- * @returns {ApiPlugin[]} An array of all plugins.
126
- */
127
- apiPluginArray(): ApiPlugin[];
128
- /**
129
- * Gets an iterator for the plugins.
130
- *
131
- * @returns {IterableIterator<Plugin>} An iterator for the plugins.
132
- */
133
- [Symbol.iterator](): MapIterator<Plugin>;
134
- /**
135
- * Executes a provided function once for each plugin.
136
- *
137
- * @param {Function} callback - The function to execute for each plugin.
138
- * @returns {Promise<void>}
139
- */
140
- forEach(callback: (plugin: Plugin) => Promise<void>): Promise<void>;
141
- /**
142
- * Sets the log level for the plugin manager.
143
- *
144
- * @param {LogLevel} logLevel - The log level to set.
145
- */
146
- set logLevel(logLevel: LogLevel);
147
- /**
148
- * Loads registered plugins from storage.
149
- *
150
- * @returns {Promise<StoragePlugin[]>} A promise that resolves to an array of registered plugins.
151
- */
152
- loadFromStorage(): Promise<StoragePlugin[]>;
153
- /**
154
- * Saves registered plugins to storage.
155
- *
156
- * @returns {Promise<number>} A promise that resolves to the number of registered plugins.
157
- */
158
- saveToStorage(): Promise<number>;
159
- /**
160
- * Resolves the name of a plugin by loading and parsing its package.json file.
161
- *
162
- * @param {string} pluginPath - The path to the plugin or the path to the plugin's package.json file.
163
- * @returns {Promise<string | null>} A promise that resolves to the path of the plugin's package.json file or null if it could not be resolved.
164
- */
165
- resolve(pluginPath: string): Promise<string | null>;
166
- /**
167
- * Installs a package globally using npm.
168
- *
169
- * @param {string} packageName - The name of the package to install.
170
- * @returns {Promise<boolean>} A promise that resolves to true if the installation was successful, false otherwise.
171
- */
172
- install(packageName: string): Promise<boolean>;
173
- /**
174
- * Uninstalls a package globally using npm.
175
- *
176
- * @param {string} packageName - The name of the package to uninstall.
177
- * @returns {Promise<boolean>} A promise that resolves to true if the uninstallation was successful, false otherwise.
178
- */
179
- uninstall(packageName: string): Promise<boolean>;
180
- /**
181
- * Get the author of a plugin from its package.json.
182
- *
183
- * @param {Record<string, string | number | Record<string, string | number | object>>} packageJson - The package.json object of the plugin.
184
- * @returns {string} The author of the plugin, or 'Unknown author' if not found.
185
- */
186
- getAuthor(packageJson: Record<string, string | number | Record<string, string | number | object>>): string;
187
- /**
188
- * Get the homepage of a plugin from its package.json.
189
- *
190
- * @param {Record<string, string | number | Record<string, string | number | object>>} packageJson - The package.json object of the plugin.
191
- * @returns {string | undefined} The homepage of the plugin, or undefined if not found.
192
- */
193
- getHomepage(packageJson: Record<string, string | number | Record<string, string | number | object>>): string | undefined;
194
- /**
195
- * Get the help URL of a plugin from its package.json.
196
- *
197
- * @param {Record<string, string | number | Record<string, string | number | object>>} packageJson - The package.json object of the plugin.
198
- * @returns {string | undefined} The URL to the help page or to the README file, or undefined if not found.
199
- */
200
- getHelp(packageJson: Record<string, string | number | Record<string, string | number | object>>): string | undefined;
201
- /**
202
- * Get the changelog URL of a plugin from its package.json.
203
- *
204
- * @param {Record<string, string | number | Record<string, string | number | object>>} packageJson - The package.json object of the plugin.
205
- * @returns {string | undefined} The URL to the CHANGELOG file, or undefined if not found.
206
- */
207
- getChangelog(packageJson: Record<string, string | number | Record<string, string | number | object>>): string | undefined;
208
- /**
209
- * Get the first funding URL(s) of a plugin from its package.json.
210
- *
211
- * @param {Record<string, any>} packageJson - The package.json object of the plugin.
212
- * @returns {string | undefined} The first funding URLs, or undefined if not found.
213
- */
214
- getFunding(packageJson: Record<string, any>): string | undefined;
215
- /**
216
- * Parses the plugin package.json and returns it.
217
- * It will also log warnings and errors for missing or invalid fields.
218
- * It will return null if critical errors are found.
219
- *
220
- * @param {Plugin | PluginName} plugin - The plugin to load the package from.
221
- * @returns {Promise<Record<string, string | number | object> | null>} A promise that resolves to the parsed package.json object or null if it could not be parsed.
222
- */
223
- parse(plugin: Plugin | PluginName): Promise<Record<string, string | number | object> | null>;
224
- /**
225
- * Enables a plugin by its name or path.
226
- *
227
- * This method enables a plugin by setting its `enabled` property to `true` and saving the updated
228
- * plugin information to storage. It first checks if the plugin is already registered in the `_plugins` map.
229
- * If not, it attempts to resolve the plugin's `package.json` file to retrieve its name and enable it.
230
- *
231
- * @param {string} nameOrPath - The name or path of the plugin to enable.
232
- * @returns {Promise<Plugin | null>} A promise that resolves to the enabled plugin object, or null if the plugin could not be enabled.
233
- */
234
- enable(nameOrPath: string): Promise<Plugin | null>;
235
- /**
236
- * Disables a plugin by its name or path.
237
- *
238
- * This method disables a plugin by setting its `enabled` property to `false` and saving the updated
239
- * plugin information to storage. It first checks if the plugin is already registered in the `_plugins` map.
240
- * If not, it attempts to resolve the plugin's `package.json` file to retrieve its name and disable it.
241
- *
242
- * @param {string} nameOrPath - The name or path of the plugin to enable.
243
- * @returns {Promise<Plugin | null>} A promise that resolves to the disabled plugin object, or null if the plugin could not be disabled.
244
- */
245
- disable(nameOrPath: string): Promise<Plugin | null>;
246
- /**
247
- * Removes a plugin by its name or path.
248
- *
249
- * This method removes a plugin from the `_plugins` map and saves the updated plugin information to storage.
250
- * It first checks if the plugin is already registered in the `_plugins` map. If not, it attempts to resolve
251
- * the plugin's `package.json` file to retrieve its name and remove it.
252
- *
253
- * @param {string} nameOrPath - The name or path of the plugin to remove.
254
- * @returns {Promise<Plugin | null>} A promise that resolves to the removed plugin object, or null if the plugin could not be removed.
255
- */
256
- remove(nameOrPath: string): Promise<Plugin | null>;
257
- /**
258
- * Adds a plugin by its name or path.
259
- *
260
- * This method adds a plugin to the plugins map and saves the updated plugin information to storage.
261
- * It first resolves the plugin's `package.json` file to retrieve its details. If the plugin is already
262
- * registered, it logs an info message and returns null. Otherwise, it registers the plugin, enables it,
263
- * and saves the updated plugin information to storage.
264
- *
265
- * @param {string} nameOrPath - The name or path of the plugin to add.
266
- * @returns {Promise<Plugin | null>} A promise that resolves to the added plugin object, or null if the plugin could not be added.
267
- */
268
- add(nameOrPath: string): Promise<Plugin | null>;
269
- /**
270
- * Loads a plugin and returns the corresponding MatterbridgePlatform instance.
271
- *
272
- * @param {Plugin | PluginName} plugin - The plugin to load.
273
- * @param {boolean} start - Optional flag indicating whether to start the plugin after loading. Default is false.
274
- * @param {string} message - Optional message to pass to the plugin when starting.
275
- * @param {boolean} configure - Optional flag indicating whether to configure the plugin after loading. Default is false.
276
- * @returns {Promise<MatterbridgePlatform | undefined>} A Promise that resolves to the loaded MatterbridgePlatform instance or undefined.
277
- */
278
- load(plugin: Plugin | PluginName, start?: boolean, message?: string, configure?: boolean): Promise<MatterbridgePlatform | undefined>;
279
- /**
280
- * Starts a plugin.
281
- *
282
- * @param {Plugin | PluginName} plugin - The plugin to start.
283
- * @param {string} [message] - Optional message to pass to the plugin's onStart method.
284
- * @param {boolean} [configure] - Indicates whether to configure the plugin after starting (default false).
285
- * @returns {Promise<Plugin | undefined>} A promise that resolves when the plugin is started successfully, or rejects with an error if starting the plugin fails.
286
- */
287
- start(plugin: Plugin | PluginName, message?: string, configure?: boolean): Promise<Plugin | undefined>;
288
- /**
289
- * Configures a plugin.
290
- *
291
- * @param {Plugin | PluginName} plugin - The plugin to configure.
292
- * @returns {Promise<Plugin | undefined>} A promise that resolves when the plugin is configured successfully, or rejects with an error if configuration fails.
293
- */
294
- configure(plugin: Plugin | PluginName): Promise<Plugin | undefined>;
295
- /**
296
- * Shuts down a plugin.
297
- *
298
- * This method shuts down a plugin by calling its `onShutdown` method and resetting its state.
299
- * It logs the shutdown process and optionally removes all devices associated with the plugin.
300
- *
301
- * @param {Plugin | PluginName} plugin - The plugin to shut down.
302
- * @param {string} [reason] - The reason for shutting down the plugin.
303
- * @param {boolean} [removeAllDevices] - Whether to remove all devices associated with the plugin.
304
- * @param {boolean} [force] - Whether to force the shutdown even if the plugin is not loaded or started.
305
- * @returns {Promise<Plugin | undefined>} A promise that resolves to the shut down plugin object, or undefined if the shutdown failed.
306
- */
307
- shutdown(plugin: Plugin | PluginName, reason?: string, removeAllDevices?: boolean, force?: boolean): Promise<Plugin | undefined>;
308
- /**
309
- * Loads the configuration for a plugin.
310
- * If the configuration file exists, it reads the file and returns the parsed JSON data.
311
- * If the configuration file does not exist, it creates a new file with default configuration and returns it.
312
- * If any error occurs during file access or creation, it logs an error and return un empty config.
313
- *
314
- * @param {Plugin} plugin - The plugin for which to load the configuration.
315
- * @returns {Promise<PlatformConfig>} A promise that resolves to the loaded or created configuration.
316
- */
317
- loadConfig(plugin: Plugin): Promise<PlatformConfig>;
318
- /**
319
- * Saves the configuration of a plugin to a file.
320
- *
321
- * This method saves the configuration of the specified plugin to a JSON file in the matterbridge directory.
322
- * If the plugin's configuration is not found, it logs an error and rejects the promise. If the configuration
323
- * is successfully saved, it logs a debug message. If an error occurs during the file write operation, it logs
324
- * the error and rejects the promise.
325
- *
326
- * @param {Plugin} plugin - The plugin whose configuration is to be saved.
327
- * @param {boolean} [restartRequired] - Indicates whether a restart is required after saving the configuration.
328
- * @returns {Promise<void>} A promise that resolves when the configuration is successfully saved, or rejects if an error occurs.
329
- * @throws {Error} If the plugin's configuration is not found.
330
- */
331
- saveConfigFromPlugin(plugin: Plugin, restartRequired?: boolean): Promise<void>;
332
- /**
333
- * Saves the configuration of a plugin from a JSON object to a file.
334
- *
335
- * This method saves the provided configuration of the specified plugin to a JSON file in the matterbridge directory.
336
- * It first checks if the configuration data is valid by ensuring it contains the correct name and type, and matches
337
- * the plugin's name. If the configuration data is invalid, it logs an error and returns. If the configuration is
338
- * successfully saved, it updates the plugin's `configJson` property and logs a debug message. If an error occurs
339
- * during the file write operation, it logs the error and returns.
340
- *
341
- * @param {Plugin} plugin - The plugin whose configuration is to be saved.
342
- * @param {PlatformConfig} config - The configuration data to be saved.
343
- * @param {boolean} [restartRequired] - Indicates whether a restart is required after saving the configuration.
344
- * @returns {Promise<void>} A promise that resolves when the configuration is successfully saved, or returns if an error occurs.
345
- */
346
- saveConfigFromJson(plugin: Plugin, config: PlatformConfig, restartRequired?: boolean): Promise<void>;
347
- /**
348
- * Loads the schema for a plugin.
349
- *
350
- * This method attempts to load the schema file for the specified plugin. If the schema file is found,
351
- * it reads and parses the file, updates the schema's title and description, and logs the process.
352
- * If the schema file is not found, it logs the event and loads a default schema for the plugin.
353
- *
354
- * @param {Plugin} plugin - The plugin whose schema is to be loaded.
355
- * @returns {Promise<PlatformSchema>} A promise that resolves to the loaded schema object, or the default schema if the schema file is not found.
356
- */
357
- loadSchema(plugin: Plugin): Promise<PlatformSchema>;
358
- /**
359
- * Returns the default schema for a plugin.
360
- *
361
- * This method generates a default schema object for the specified plugin. The schema includes
362
- * metadata such as the plugin's title, description, version, and author. It also defines the
363
- * properties of the schema, including the plugin's name, type, debug flag, and unregisterOnShutdown flag.
364
- *
365
- * @param {Plugin} plugin - The plugin for which the default schema is to be generated.
366
- * @returns {PlatformSchema} The default schema object for the plugin.
367
- */
368
- getDefaultSchema(plugin: Plugin): PlatformSchema;
369
- }
370
- export {};
371
- //# sourceMappingURL=pluginManager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pluginManager.d.ts","sourceRoot":"","sources":["../src/pluginManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,YAAY,MAAM,aAAa,CAAC;AAGvC,OAAO,EAAc,QAAQ,EAAgG,MAAM,kBAAkB,CAAC;AAGtJ,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACtG,OAAO,EAAE,SAAS,EAAO,MAAM,EAAE,UAAU,EAAE,aAAa,EAAO,MAAM,wBAAwB,CAAC;AAMhG,UAAU,mBAAmB;IAC3B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