matterbridge 3.2.4-dev-20250828-cf98212 → 3.2.4

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 (267) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/dist/cli.d.ts +26 -0
  3. package/dist/cli.d.ts.map +1 -0
  4. package/dist/cli.js +91 -2
  5. package/dist/cli.js.map +1 -0
  6. package/dist/cliEmitter.d.ts +34 -0
  7. package/dist/cliEmitter.d.ts.map +1 -0
  8. package/dist/cliEmitter.js +30 -0
  9. package/dist/cliEmitter.js.map +1 -0
  10. package/dist/clusters/export.d.ts +2 -0
  11. package/dist/clusters/export.d.ts.map +1 -0
  12. package/dist/clusters/export.js +2 -0
  13. package/dist/clusters/export.js.map +1 -0
  14. package/dist/defaultConfigSchema.d.ts +28 -0
  15. package/dist/defaultConfigSchema.d.ts.map +1 -0
  16. package/dist/defaultConfigSchema.js +24 -0
  17. package/dist/defaultConfigSchema.js.map +1 -0
  18. package/dist/deviceManager.d.ts +112 -0
  19. package/dist/deviceManager.d.ts.map +1 -0
  20. package/dist/deviceManager.js +94 -1
  21. package/dist/deviceManager.js.map +1 -0
  22. package/dist/devices/batteryStorage.d.ts +48 -0
  23. package/dist/devices/batteryStorage.d.ts.map +1 -0
  24. package/dist/devices/batteryStorage.js +48 -1
  25. package/dist/devices/batteryStorage.js.map +1 -0
  26. package/dist/devices/cooktop.d.ts +60 -0
  27. package/dist/devices/cooktop.d.ts.map +1 -0
  28. package/dist/devices/cooktop.js +55 -0
  29. package/dist/devices/cooktop.js.map +1 -0
  30. package/dist/devices/dishwasher.d.ts +71 -0
  31. package/dist/devices/dishwasher.d.ts.map +1 -0
  32. package/dist/devices/dishwasher.js +57 -0
  33. package/dist/devices/dishwasher.js.map +1 -0
  34. package/dist/devices/evse.d.ts +75 -0
  35. package/dist/devices/evse.d.ts.map +1 -0
  36. package/dist/devices/evse.js +74 -10
  37. package/dist/devices/evse.js.map +1 -0
  38. package/dist/devices/export.d.ts +15 -0
  39. package/dist/devices/export.d.ts.map +1 -0
  40. package/dist/devices/export.js +4 -0
  41. package/dist/devices/export.js.map +1 -0
  42. package/dist/devices/extractorHood.d.ts +46 -0
  43. package/dist/devices/extractorHood.d.ts.map +1 -0
  44. package/dist/devices/extractorHood.js +42 -0
  45. package/dist/devices/extractorHood.js.map +1 -0
  46. package/dist/devices/heatPump.d.ts +47 -0
  47. package/dist/devices/heatPump.d.ts.map +1 -0
  48. package/dist/devices/heatPump.js +50 -2
  49. package/dist/devices/heatPump.js.map +1 -0
  50. package/dist/devices/laundryDryer.d.ts +67 -0
  51. package/dist/devices/laundryDryer.d.ts.map +1 -0
  52. package/dist/devices/laundryDryer.js +62 -3
  53. package/dist/devices/laundryDryer.js.map +1 -0
  54. package/dist/devices/laundryWasher.d.ts +81 -0
  55. package/dist/devices/laundryWasher.d.ts.map +1 -0
  56. package/dist/devices/laundryWasher.js +70 -4
  57. package/dist/devices/laundryWasher.js.map +1 -0
  58. package/dist/devices/microwaveOven.d.ts +168 -0
  59. package/dist/devices/microwaveOven.d.ts.map +1 -0
  60. package/dist/devices/microwaveOven.js +88 -5
  61. package/dist/devices/microwaveOven.js.map +1 -0
  62. package/dist/devices/oven.d.ts +105 -0
  63. package/dist/devices/oven.d.ts.map +1 -0
  64. package/dist/devices/oven.js +85 -0
  65. package/dist/devices/oven.js.map +1 -0
  66. package/dist/devices/refrigerator.d.ts +93 -0
  67. package/dist/devices/refrigerator.d.ts.map +1 -0
  68. package/dist/devices/refrigerator.js +80 -0
  69. package/dist/devices/refrigerator.js.map +1 -0
  70. package/dist/devices/roboticVacuumCleaner.d.ts +112 -0
  71. package/dist/devices/roboticVacuumCleaner.d.ts.map +1 -0
  72. package/dist/devices/roboticVacuumCleaner.js +93 -7
  73. package/dist/devices/roboticVacuumCleaner.js.map +1 -0
  74. package/dist/devices/solarPower.d.ts +40 -0
  75. package/dist/devices/solarPower.d.ts.map +1 -0
  76. package/dist/devices/solarPower.js +38 -0
  77. package/dist/devices/solarPower.js.map +1 -0
  78. package/dist/devices/temperatureControl.d.ts +166 -0
  79. package/dist/devices/temperatureControl.d.ts.map +1 -0
  80. package/dist/devices/temperatureControl.js +25 -3
  81. package/dist/devices/temperatureControl.js.map +1 -0
  82. package/dist/devices/waterHeater.d.ts +111 -0
  83. package/dist/devices/waterHeater.d.ts.map +1 -0
  84. package/dist/devices/waterHeater.js +82 -2
  85. package/dist/devices/waterHeater.js.map +1 -0
  86. package/dist/dgram/coap.d.ts +205 -0
  87. package/dist/dgram/coap.d.ts.map +1 -0
  88. package/dist/dgram/coap.js +126 -13
  89. package/dist/dgram/coap.js.map +1 -0
  90. package/dist/dgram/dgram.d.ts +140 -0
  91. package/dist/dgram/dgram.d.ts.map +1 -0
  92. package/dist/dgram/dgram.js +113 -2
  93. package/dist/dgram/dgram.js.map +1 -0
  94. package/dist/dgram/mb_coap.d.ts +24 -0
  95. package/dist/dgram/mb_coap.d.ts.map +1 -0
  96. package/dist/dgram/mb_coap.js +41 -3
  97. package/dist/dgram/mb_coap.js.map +1 -0
  98. package/dist/dgram/mb_mdns.d.ts +24 -0
  99. package/dist/dgram/mb_mdns.d.ts.map +1 -0
  100. package/dist/dgram/mb_mdns.js +51 -13
  101. package/dist/dgram/mb_mdns.js.map +1 -0
  102. package/dist/dgram/mdns.d.ts +288 -0
  103. package/dist/dgram/mdns.d.ts.map +1 -0
  104. package/dist/dgram/mdns.js +298 -137
  105. package/dist/dgram/mdns.js.map +1 -0
  106. package/dist/dgram/multicast.d.ts +65 -0
  107. package/dist/dgram/multicast.d.ts.map +1 -0
  108. package/dist/dgram/multicast.js +60 -1
  109. package/dist/dgram/multicast.js.map +1 -0
  110. package/dist/dgram/unicast.d.ts +56 -0
  111. package/dist/dgram/unicast.d.ts.map +1 -0
  112. package/dist/dgram/unicast.js +54 -0
  113. package/dist/dgram/unicast.js.map +1 -0
  114. package/dist/frontend.d.ts +313 -0
  115. package/dist/frontend.d.ts.map +1 -0
  116. package/dist/frontend.js +451 -24
  117. package/dist/frontend.js.map +1 -0
  118. package/dist/globalMatterbridge.d.ts +59 -0
  119. package/dist/globalMatterbridge.d.ts.map +1 -0
  120. package/dist/globalMatterbridge.js +47 -0
  121. package/dist/globalMatterbridge.js.map +1 -0
  122. package/dist/helpers.d.ts +48 -0
  123. package/dist/helpers.d.ts.map +1 -0
  124. package/dist/helpers.js +53 -0
  125. package/dist/helpers.js.map +1 -0
  126. package/dist/index.d.ts +33 -0
  127. package/dist/index.d.ts.map +1 -0
  128. package/dist/index.js +30 -1
  129. package/dist/index.js.map +1 -0
  130. package/dist/logger/export.d.ts +2 -0
  131. package/dist/logger/export.d.ts.map +1 -0
  132. package/dist/logger/export.js +1 -0
  133. package/dist/logger/export.js.map +1 -0
  134. package/dist/matter/behaviors.d.ts +2 -0
  135. package/dist/matter/behaviors.d.ts.map +1 -0
  136. package/dist/matter/behaviors.js +2 -0
  137. package/dist/matter/behaviors.js.map +1 -0
  138. package/dist/matter/clusters.d.ts +2 -0
  139. package/dist/matter/clusters.d.ts.map +1 -0
  140. package/dist/matter/clusters.js +2 -0
  141. package/dist/matter/clusters.js.map +1 -0
  142. package/dist/matter/devices.d.ts +2 -0
  143. package/dist/matter/devices.d.ts.map +1 -0
  144. package/dist/matter/devices.js +2 -0
  145. package/dist/matter/devices.js.map +1 -0
  146. package/dist/matter/endpoints.d.ts +2 -0
  147. package/dist/matter/endpoints.d.ts.map +1 -0
  148. package/dist/matter/endpoints.js +2 -0
  149. package/dist/matter/endpoints.js.map +1 -0
  150. package/dist/matter/export.d.ts +5 -0
  151. package/dist/matter/export.d.ts.map +1 -0
  152. package/dist/matter/export.js +3 -0
  153. package/dist/matter/export.js.map +1 -0
  154. package/dist/matter/types.d.ts +3 -0
  155. package/dist/matter/types.d.ts.map +1 -0
  156. package/dist/matter/types.js +3 -0
  157. package/dist/matter/types.js.map +1 -0
  158. package/dist/matterbridge.d.ts +462 -0
  159. package/dist/matterbridge.d.ts.map +1 -0
  160. package/dist/matterbridge.js +789 -50
  161. package/dist/matterbridge.js.map +1 -0
  162. package/dist/matterbridgeAccessoryPlatform.d.ts +42 -0
  163. package/dist/matterbridgeAccessoryPlatform.d.ts.map +1 -0
  164. package/dist/matterbridgeAccessoryPlatform.js +36 -0
  165. package/dist/matterbridgeAccessoryPlatform.js.map +1 -0
  166. package/dist/matterbridgeBehaviors.d.ts +1351 -0
  167. package/dist/matterbridgeBehaviors.d.ts.map +1 -0
  168. package/dist/matterbridgeBehaviors.js +65 -5
  169. package/dist/matterbridgeBehaviors.js.map +1 -0
  170. package/dist/matterbridgeDeviceTypes.d.ts +709 -0
  171. package/dist/matterbridgeDeviceTypes.d.ts.map +1 -0
  172. package/dist/matterbridgeDeviceTypes.js +579 -15
  173. package/dist/matterbridgeDeviceTypes.js.map +1 -0
  174. package/dist/matterbridgeDynamicPlatform.d.ts +42 -0
  175. package/dist/matterbridgeDynamicPlatform.d.ts.map +1 -0
  176. package/dist/matterbridgeDynamicPlatform.js +36 -0
  177. package/dist/matterbridgeDynamicPlatform.js.map +1 -0
  178. package/dist/matterbridgeEndpoint.d.ts +1356 -0
  179. package/dist/matterbridgeEndpoint.d.ts.map +1 -0
  180. package/dist/matterbridgeEndpoint.js +1220 -54
  181. package/dist/matterbridgeEndpoint.js.map +1 -0
  182. package/dist/matterbridgeEndpointHelpers.d.ts +407 -0
  183. package/dist/matterbridgeEndpointHelpers.d.ts.map +1 -0
  184. package/dist/matterbridgeEndpointHelpers.js +345 -12
  185. package/dist/matterbridgeEndpointHelpers.js.map +1 -0
  186. package/dist/matterbridgePlatform.d.ts +331 -0
  187. package/dist/matterbridgePlatform.d.ts.map +1 -0
  188. package/dist/matterbridgePlatform.js +256 -0
  189. package/dist/matterbridgePlatform.js.map +1 -0
  190. package/dist/matterbridgeTypes.d.ts +198 -0
  191. package/dist/matterbridgeTypes.d.ts.map +1 -0
  192. package/dist/matterbridgeTypes.js +25 -0
  193. package/dist/matterbridgeTypes.js.map +1 -0
  194. package/dist/pluginManager.d.ts +270 -0
  195. package/dist/pluginManager.d.ts.map +1 -0
  196. package/dist/pluginManager.js +249 -3
  197. package/dist/pluginManager.js.map +1 -0
  198. package/dist/shelly.d.ts +174 -0
  199. package/dist/shelly.d.ts.map +1 -0
  200. package/dist/shelly.js +168 -7
  201. package/dist/shelly.js.map +1 -0
  202. package/dist/storage/export.d.ts +2 -0
  203. package/dist/storage/export.d.ts.map +1 -0
  204. package/dist/storage/export.js +1 -0
  205. package/dist/storage/export.js.map +1 -0
  206. package/dist/update.d.ts +75 -0
  207. package/dist/update.d.ts.map +1 -0
  208. package/dist/update.js +69 -0
  209. package/dist/update.js.map +1 -0
  210. package/dist/utils/colorUtils.d.ts +99 -0
  211. package/dist/utils/colorUtils.d.ts.map +1 -0
  212. package/dist/utils/colorUtils.js +97 -2
  213. package/dist/utils/colorUtils.js.map +1 -0
  214. package/dist/utils/commandLine.d.ts +59 -0
  215. package/dist/utils/commandLine.d.ts.map +1 -0
  216. package/dist/utils/commandLine.js +54 -0
  217. package/dist/utils/commandLine.js.map +1 -0
  218. package/dist/utils/copyDirectory.d.ts +33 -0
  219. package/dist/utils/copyDirectory.d.ts.map +1 -0
  220. package/dist/utils/copyDirectory.js +38 -1
  221. package/dist/utils/copyDirectory.js.map +1 -0
  222. package/dist/utils/createDirectory.d.ts +34 -0
  223. package/dist/utils/createDirectory.d.ts.map +1 -0
  224. package/dist/utils/createDirectory.js +33 -0
  225. package/dist/utils/createDirectory.js.map +1 -0
  226. package/dist/utils/createZip.d.ts +39 -0
  227. package/dist/utils/createZip.d.ts.map +1 -0
  228. package/dist/utils/createZip.js +47 -2
  229. package/dist/utils/createZip.js.map +1 -0
  230. package/dist/utils/deepCopy.d.ts +32 -0
  231. package/dist/utils/deepCopy.d.ts.map +1 -0
  232. package/dist/utils/deepCopy.js +39 -0
  233. package/dist/utils/deepCopy.js.map +1 -0
  234. package/dist/utils/deepEqual.d.ts +54 -0
  235. package/dist/utils/deepEqual.d.ts.map +1 -0
  236. package/dist/utils/deepEqual.js +72 -1
  237. package/dist/utils/deepEqual.js.map +1 -0
  238. package/dist/utils/error.d.ts +44 -0
  239. package/dist/utils/error.d.ts.map +1 -0
  240. package/dist/utils/error.js +41 -0
  241. package/dist/utils/error.js.map +1 -0
  242. package/dist/utils/export.d.ts +12 -0
  243. package/dist/utils/export.d.ts.map +1 -0
  244. package/dist/utils/export.js +1 -0
  245. package/dist/utils/export.js.map +1 -0
  246. package/dist/utils/hex.d.ts +89 -0
  247. package/dist/utils/hex.d.ts.map +1 -0
  248. package/dist/utils/hex.js +124 -0
  249. package/dist/utils/hex.js.map +1 -0
  250. package/dist/utils/isvalid.d.ts +103 -0
  251. package/dist/utils/isvalid.d.ts.map +1 -0
  252. package/dist/utils/isvalid.js +101 -0
  253. package/dist/utils/isvalid.js.map +1 -0
  254. package/dist/utils/network.d.ts +84 -0
  255. package/dist/utils/network.d.ts.map +1 -0
  256. package/dist/utils/network.js +91 -5
  257. package/dist/utils/network.js.map +1 -0
  258. package/dist/utils/spawn.d.ts +33 -0
  259. package/dist/utils/spawn.d.ts.map +1 -0
  260. package/dist/utils/spawn.js +40 -0
  261. package/dist/utils/spawn.js.map +1 -0
  262. package/dist/utils/wait.d.ts +54 -0
  263. package/dist/utils/wait.d.ts.map +1 -0
  264. package/dist/utils/wait.js +60 -8
  265. package/dist/utils/wait.js.map +1 -0
  266. package/npm-shrinkwrap.json +2 -2
  267. package/package.json +2 -1
@@ -0,0 +1,198 @@
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 { NodeStorage } from 'node-persist-manager';
25
+ import { LogLevel } from 'node-ansi-logger';
26
+ import { FabricIndex, VendorId, StorageContext, ServerNode, EndpointNumber, Endpoint as EndpointNode } from '@matter/main';
27
+ import { AggregatorEndpoint } from '@matter/main/endpoints/aggregator';
28
+ import { MatterbridgePlatform, PlatformConfig, PlatformSchema } from './matterbridgePlatform.js';
29
+ import { MatterbridgeEndpoint } from './matterbridgeEndpoint.js';
30
+ export declare const plg = "\u001B[38;5;33m";
31
+ export declare const dev = "\u001B[38;5;79m";
32
+ export declare const typ = "\u001B[38;5;207m";
33
+ export interface RegisteredPlugin extends BaseRegisteredPlugin {
34
+ nodeContext?: NodeStorage;
35
+ storageContext?: StorageContext;
36
+ serverNode?: ServerNode<ServerNode.RootEndpoint>;
37
+ aggregatorNode?: EndpointNode<AggregatorEndpoint>;
38
+ device?: MatterbridgeEndpoint;
39
+ platform?: MatterbridgePlatform;
40
+ reachabilityTimeout?: NodeJS.Timeout;
41
+ }
42
+ export interface BaseRegisteredPlugin {
43
+ name: string;
44
+ version: string;
45
+ description: string;
46
+ author: string;
47
+ path: string;
48
+ type: string;
49
+ latestVersion?: string;
50
+ devVersion?: string;
51
+ serialNumber?: string;
52
+ homepage?: string;
53
+ help?: string;
54
+ changelog?: string;
55
+ funding?: string;
56
+ locked?: boolean;
57
+ error?: boolean;
58
+ enabled?: boolean;
59
+ loaded?: boolean;
60
+ started?: boolean;
61
+ configured?: boolean;
62
+ restartRequired?: boolean;
63
+ registeredDevices?: number;
64
+ addedDevices?: number;
65
+ configJson?: PlatformConfig;
66
+ schemaJson?: PlatformSchema;
67
+ hasWhiteList?: boolean;
68
+ hasBlackList?: boolean;
69
+ }
70
+ export interface FrontendRegisteredPlugin extends BaseRegisteredPlugin {
71
+ paired?: boolean;
72
+ qrPairingCode?: string;
73
+ manualPairingCode?: string;
74
+ fabricInformations?: SanitizedExposedFabricInformation[];
75
+ sessionInformations?: SanitizedSession[];
76
+ }
77
+ export interface SystemInformation {
78
+ interfaceName: string;
79
+ macAddress: string;
80
+ ipv4Address: string;
81
+ ipv6Address: string;
82
+ nodeVersion: string;
83
+ hostname: string;
84
+ user: string;
85
+ osType: string;
86
+ osRelease: string;
87
+ osPlatform: string;
88
+ osArch: string;
89
+ totalMemory: string;
90
+ freeMemory: string;
91
+ systemUptime: string;
92
+ processUptime: string;
93
+ cpuUsage: string;
94
+ rss: string;
95
+ heapTotal: string;
96
+ heapUsed: string;
97
+ }
98
+ export interface MatterbridgeInformation {
99
+ homeDirectory: string;
100
+ rootDirectory: string;
101
+ matterbridgeDirectory: string;
102
+ matterbridgePluginDirectory: string;
103
+ matterbridgeCertDirectory: string;
104
+ globalModulesDirectory: string;
105
+ matterbridgeVersion: string;
106
+ matterbridgeLatestVersion: string;
107
+ matterbridgeDevVersion: string;
108
+ matterbridgeSerialNumber: string;
109
+ matterbridgeAdvertise: boolean | undefined;
110
+ matterbridgeEndAdvertise: boolean;
111
+ matterbridgePaired: boolean | undefined;
112
+ matterbridgeQrPairingCode: string | undefined;
113
+ matterbridgeManualPairingCode: string | undefined;
114
+ matterbridgeFabricInformations: SanitizedExposedFabricInformation[] | undefined;
115
+ matterbridgeSessionInformations: SanitizedSession[] | undefined;
116
+ frontendVersion?: string;
117
+ bridgeMode: string;
118
+ restartMode: string;
119
+ virtualMode: 'disabled' | 'outlet' | 'light' | 'switch' | 'mounted_switch';
120
+ readOnly: boolean;
121
+ shellyBoard: boolean;
122
+ shellySysUpdate: boolean;
123
+ shellyMainUpdate: boolean;
124
+ profile?: string;
125
+ loggerLevel: LogLevel;
126
+ fileLogger: boolean;
127
+ matterLoggerLevel: number;
128
+ matterFileLogger: boolean;
129
+ mattermdnsinterface: string | undefined;
130
+ matteripv4address: string | undefined;
131
+ matteripv6address: string | undefined;
132
+ matterPort: number;
133
+ matterDiscriminator: number | undefined;
134
+ matterPasscode: number | undefined;
135
+ restartRequired: boolean;
136
+ fixedRestartRequired: boolean;
137
+ updateRequired: boolean;
138
+ }
139
+ export interface SanitizedExposedFabricInformation {
140
+ fabricIndex: FabricIndex;
141
+ fabricId: string;
142
+ nodeId: string;
143
+ rootNodeId: string;
144
+ rootVendorId: VendorId;
145
+ rootVendorName: string;
146
+ label: string;
147
+ }
148
+ export interface SanitizedSession {
149
+ name: string;
150
+ nodeId: string;
151
+ peerNodeId: string;
152
+ fabric?: SanitizedExposedFabricInformation;
153
+ isPeerActive: boolean;
154
+ lastInteractionTimestamp: string;
155
+ lastActiveTimestamp: string;
156
+ numberOfActiveSubscriptions: number;
157
+ }
158
+ export interface ApiDevices {
159
+ pluginName: string;
160
+ type: string;
161
+ endpoint: EndpointNumber | undefined;
162
+ name: string;
163
+ serial: string;
164
+ productUrl: string;
165
+ configUrl?: string;
166
+ uniqueId: string;
167
+ reachable: boolean;
168
+ powerSource?: 'ac' | 'dc' | 'ok' | 'warning' | 'critical';
169
+ cluster: string;
170
+ matter?: ApiDevicesMatter;
171
+ }
172
+ export interface ApiDevicesMatter {
173
+ commissioned: boolean;
174
+ fabricInformations?: SanitizedExposedFabricInformation[];
175
+ sessionInformations?: SanitizedSession[];
176
+ qrPairingCode?: string;
177
+ manualPairingCode?: string;
178
+ }
179
+ export interface ApiClustersResponse {
180
+ plugin: string;
181
+ deviceName: string;
182
+ serialNumber: string;
183
+ endpoint: number;
184
+ deviceTypes: number[];
185
+ clusters: ApiClusters[];
186
+ }
187
+ export interface ApiClusters {
188
+ endpoint: string;
189
+ id: string;
190
+ deviceTypes: number[];
191
+ clusterName: string;
192
+ clusterId: string;
193
+ attributeName: string;
194
+ attributeId: string;
195
+ attributeValue: string;
196
+ attributeLocalValue: unknown;
197
+ }
198
+ //# sourceMappingURL=matterbridgeTypes.d.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
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
+ // Default colors
1
25
  export const plg = '\u001B[38;5;33m';
2
26
  export const dev = '\u001B[38;5;79m';
3
27
  export const typ = '\u001B[38;5;207m';
28
+ //# sourceMappingURL=matterbridgeTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matterbridgeTypes.js","sourceRoot":"","sources":["../src/matterbridgeTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAaH,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"}
@@ -0,0 +1,270 @@
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.2.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 { RegisteredPlugin } 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
+ export declare class PluginManager extends EventEmitter<PluginManagerEvents> {
42
+ private _plugins;
43
+ private matterbridge;
44
+ private log;
45
+ constructor(matterbridge: Matterbridge);
46
+ get length(): number;
47
+ get size(): number;
48
+ has(name: string): boolean;
49
+ get(name: string): RegisteredPlugin | undefined;
50
+ set(plugin: RegisteredPlugin): RegisteredPlugin;
51
+ clear(): void;
52
+ array(): RegisteredPlugin[];
53
+ [Symbol.iterator](): MapIterator<RegisteredPlugin>;
54
+ forEach(callback: (plugin: RegisteredPlugin) => Promise<void>): Promise<void>;
55
+ set logLevel(logLevel: LogLevel);
56
+ /**
57
+ * Loads registered plugins from storage.
58
+ *
59
+ * This method retrieves an array of registered plugins from the storage and converts it
60
+ * into a map where the plugin names are the keys and the plugin objects are the values.
61
+ *
62
+ * @returns {Promise<RegisteredPlugin[]>} A promise that resolves to an array of registered plugins.
63
+ */
64
+ loadFromStorage(): Promise<RegisteredPlugin[]>;
65
+ /**
66
+ * Loads registered plugins from storage.
67
+ *
68
+ * This method retrieves an array of registered plugins from the storage and converts it
69
+ * into a map where the plugin names are the keys and the plugin objects are the values.
70
+ *
71
+ * @returns {Promise<RegisteredPlugin[]>} A promise that resolves to an array of registered plugins.
72
+ */
73
+ saveToStorage(): Promise<number>;
74
+ /**
75
+ * Resolves the name of a plugin by loading and parsing its package.json file.
76
+ *
77
+ * @param {string} pluginPath - The path to the plugin or the path to the plugin's package.json file.
78
+ * @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.
79
+ */
80
+ resolve(pluginPath: string): Promise<string | null>;
81
+ /**
82
+ * Get the author of a plugin from its package.json.
83
+ *
84
+ * @param {Record<string, string | number | Record<string, string | number | object>>} packageJson - The package.json object of the plugin.
85
+ * @returns {string} The author of the plugin, or 'Unknown author' if not found.
86
+ */
87
+ getAuthor(packageJson: Record<string, string | number | Record<string, string | number | object>>): string;
88
+ /**
89
+ * Get the homepage of a plugin from its package.json.
90
+ *
91
+ * @param {Record<string, string | number | Record<string, string | number | object>>} packageJson - The package.json object of the plugin.
92
+ * @returns {string | undefined} The homepage of the plugin, or undefined if not found.
93
+ */
94
+ getHomepage(packageJson: Record<string, string | number | Record<string, string | number | object>>): string | undefined;
95
+ /**
96
+ * Get the help URL of a plugin from its package.json.
97
+ *
98
+ * @param {Record<string, string | number | Record<string, string | number | object>>} packageJson - The package.json object of the plugin.
99
+ * @returns {string | undefined} The URL to the help page or to the README file, or undefined if not found.
100
+ */
101
+ getHelp(packageJson: Record<string, string | number | Record<string, string | number | object>>): string | undefined;
102
+ /**
103
+ * Get the changelog URL of a plugin from its package.json.
104
+ *
105
+ * @param {Record<string, string | number | Record<string, string | number | object>>} packageJson - The package.json object of the plugin.
106
+ * @returns {string | undefined} The URL to the CHANGELOG file, or undefined if not found.
107
+ */
108
+ getChangelog(packageJson: Record<string, string | number | Record<string, string | number | object>>): string | undefined;
109
+ /**
110
+ * Get the first funding URL(s) of a plugin from its package.json.
111
+ *
112
+ * @param {Record<string, any>} packageJson - The package.json object of the plugin.
113
+ * @returns {string | undefined} The first funding URLs, or undefined if not found.
114
+ */
115
+ getFunding(packageJson: Record<string, any>): string | undefined;
116
+ /**
117
+ * Loads and parse the plugin package.json and returns it.
118
+ *
119
+ * @param {RegisteredPlugin} plugin - The plugin to load the package from.
120
+ * @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.
121
+ */
122
+ parse(plugin: RegisteredPlugin): Promise<Record<string, string | number | object> | null>;
123
+ /**
124
+ * Enables a plugin by its name or path.
125
+ *
126
+ * This method enables a plugin by setting its `enabled` property to `true` and saving the updated
127
+ * plugin information to storage. It first checks if the plugin is already registered in the `_plugins` map.
128
+ * If not, it attempts to resolve the plugin's `package.json` file to retrieve its name and enable it.
129
+ *
130
+ * @param {string} nameOrPath - The name or path of the plugin to enable.
131
+ * @returns {Promise<RegisteredPlugin | null>} A promise that resolves to the enabled plugin object, or null if the plugin could not be enabled.
132
+ */
133
+ enable(nameOrPath: string): Promise<RegisteredPlugin | null>;
134
+ /**
135
+ * Enables a plugin by its name or path.
136
+ *
137
+ * This method enables a plugin by setting its `enabled` property to `true` and saving the updated
138
+ * plugin information to storage. It first checks if the plugin is already registered in the `_plugins` map.
139
+ * If not, it attempts to resolve the plugin's `package.json` file to retrieve its name and enable it.
140
+ *
141
+ * @param {string} nameOrPath - The name or path of the plugin to enable.
142
+ * @returns {Promise<RegisteredPlugin | null>} A promise that resolves to the enabled plugin object, or null if the plugin could not be enabled.
143
+ */
144
+ disable(nameOrPath: string): Promise<RegisteredPlugin | null>;
145
+ /**
146
+ * Removes a plugin by its name or path.
147
+ *
148
+ * This method removes a plugin from the `_plugins` map and saves the updated plugin information to storage.
149
+ * It first checks if the plugin is already registered in the `_plugins` map. If not, it attempts to resolve
150
+ * the plugin's `package.json` file to retrieve its name and remove it.
151
+ *
152
+ * @param {string} nameOrPath - The name or path of the plugin to remove.
153
+ * @returns {Promise<RegisteredPlugin | null>} A promise that resolves to the removed plugin object, or null if the plugin could not be removed.
154
+ */
155
+ remove(nameOrPath: string): Promise<RegisteredPlugin | null>;
156
+ /**
157
+ * Adds a plugin by its name or path.
158
+ *
159
+ * This method adds a plugin to the plugins map and saves the updated plugin information to storage.
160
+ * It first resolves the plugin's `package.json` file to retrieve its details. If the plugin is already
161
+ * registered, it logs an info message and returns null. Otherwise, it registers the plugin, enables it,
162
+ * and saves the updated plugin information to storage.
163
+ *
164
+ * @param {string} nameOrPath - The name or path of the plugin to add.
165
+ * @returns {Promise<RegisteredPlugin | null>} A promise that resolves to the added plugin object, or null if the plugin could not be added.
166
+ */
167
+ add(nameOrPath: string): Promise<RegisteredPlugin | null>;
168
+ /**
169
+ * Loads a plugin and returns the corresponding MatterbridgePlatform instance.
170
+ *
171
+ * @param {RegisteredPlugin} plugin - The plugin to load.
172
+ * @param {boolean} start - Optional flag indicating whether to start the plugin after loading. Default is false.
173
+ * @param {string} message - Optional message to pass to the plugin when starting.
174
+ * @param {boolean} configure - Optional flag indicating whether to configure the plugin after loading. Default is false.
175
+ * @returns {Promise<MatterbridgePlatform | undefined>} A Promise that resolves to the loaded MatterbridgePlatform instance or undefined.
176
+ */
177
+ load(plugin: RegisteredPlugin, start?: boolean, message?: string, configure?: boolean): Promise<MatterbridgePlatform | undefined>;
178
+ /**
179
+ * Starts a plugin.
180
+ *
181
+ * @param {RegisteredPlugin} plugin - The plugin to start.
182
+ * @param {string} [message] - Optional message to pass to the plugin's onStart method.
183
+ * @param {boolean} [configure] - Indicates whether to configure the plugin after starting (default false).
184
+ * @returns {Promise<RegisteredPlugin | undefined>} A promise that resolves when the plugin is started successfully, or rejects with an error if starting the plugin fails.
185
+ */
186
+ start(plugin: RegisteredPlugin, message?: string, configure?: boolean): Promise<RegisteredPlugin | undefined>;
187
+ /**
188
+ * Configures a plugin.
189
+ *
190
+ * @param {RegisteredPlugin} plugin - The plugin to configure.
191
+ * @returns {Promise<RegisteredPlugin | undefined>} A promise that resolves when the plugin is configured successfully, or rejects with an error if configuration fails.
192
+ */
193
+ configure(plugin: RegisteredPlugin): Promise<RegisteredPlugin | undefined>;
194
+ /**
195
+ * Shuts down a plugin.
196
+ *
197
+ * This method shuts down a plugin by calling its `onShutdown` method and resetting its state.
198
+ * It logs the shutdown process and optionally removes all devices associated with the plugin.
199
+ *
200
+ * @param {RegisteredPlugin} plugin - The plugin to shut down.
201
+ * @param {string} [reason] - The reason for shutting down the plugin.
202
+ * @param {boolean} [removeAllDevices] - Whether to remove all devices associated with the plugin.
203
+ * @param {boolean} [force] - Whether to force the shutdown even if the plugin is not loaded or started.
204
+ * @returns {Promise<RegisteredPlugin | undefined>} A promise that resolves to the shut down plugin object, or undefined if the shutdown failed.
205
+ */
206
+ shutdown(plugin: RegisteredPlugin, reason?: string, removeAllDevices?: boolean, force?: boolean): Promise<RegisteredPlugin | undefined>;
207
+ /**
208
+ * Loads the configuration for a plugin.
209
+ * If the configuration file exists, it reads the file and returns the parsed JSON data.
210
+ * If the configuration file does not exist, it creates a new file with default configuration and returns it.
211
+ * If any error occurs during file access or creation, it logs an error and return un empty config.
212
+ *
213
+ * @param {RegisteredPlugin} plugin - The plugin for which to load the configuration.
214
+ * @returns {Promise<PlatformConfig>} A promise that resolves to the loaded or created configuration.
215
+ */
216
+ loadConfig(plugin: RegisteredPlugin): Promise<PlatformConfig>;
217
+ /**
218
+ * Saves the configuration of a plugin to a file.
219
+ *
220
+ * This method saves the configuration of the specified plugin to a JSON file in the matterbridge directory.
221
+ * If the plugin's configuration is not found, it logs an error and rejects the promise. If the configuration
222
+ * is successfully saved, it logs a debug message. If an error occurs during the file write operation, it logs
223
+ * the error and rejects the promise.
224
+ *
225
+ * @param {RegisteredPlugin} plugin - The plugin whose configuration is to be saved.
226
+ * @param {boolean} [restartRequired] - Indicates whether a restart is required after saving the configuration.
227
+ * @returns {Promise<void>} A promise that resolves when the configuration is successfully saved, or rejects if an error occurs.
228
+ * @throws {Error} If the plugin's configuration is not found.
229
+ */
230
+ saveConfigFromPlugin(plugin: RegisteredPlugin, restartRequired?: boolean): Promise<void>;
231
+ /**
232
+ * Saves the configuration of a plugin from a JSON object to a file.
233
+ *
234
+ * This method saves the provided configuration of the specified plugin to a JSON file in the matterbridge directory.
235
+ * It first checks if the configuration data is valid by ensuring it contains the correct name and type, and matches
236
+ * the plugin's name. If the configuration data is invalid, it logs an error and returns. If the configuration is
237
+ * successfully saved, it updates the plugin's `configJson` property and logs a debug message. If an error occurs
238
+ * during the file write operation, it logs the error and returns.
239
+ *
240
+ * @param {RegisteredPlugin} plugin - The plugin whose configuration is to be saved.
241
+ * @param {PlatformConfig} config - The configuration data to be saved.
242
+ * @param {boolean} [restartRequired] - Indicates whether a restart is required after saving the configuration.
243
+ * @returns {Promise<void>} A promise that resolves when the configuration is successfully saved, or returns if an error occurs.
244
+ */
245
+ saveConfigFromJson(plugin: RegisteredPlugin, config: PlatformConfig, restartRequired?: boolean): Promise<void>;
246
+ /**
247
+ * Loads the schema for a plugin.
248
+ *
249
+ * This method attempts to load the schema file for the specified plugin. If the schema file is found,
250
+ * it reads and parses the file, updates the schema's title and description, and logs the process.
251
+ * If the schema file is not found, it logs the event and loads a default schema for the plugin.
252
+ *
253
+ * @param {RegisteredPlugin} plugin - The plugin whose schema is to be loaded.
254
+ * @returns {Promise<PlatformSchema>} A promise that resolves to the loaded schema object, or the default schema if the schema file is not found.
255
+ */
256
+ loadSchema(plugin: RegisteredPlugin): Promise<PlatformSchema>;
257
+ /**
258
+ * Returns the default schema for a plugin.
259
+ *
260
+ * This method generates a default schema object for the specified plugin. The schema includes
261
+ * metadata such as the plugin's title, description, version, and author. It also defines the
262
+ * properties of the schema, including the plugin's name, type, debug flag, and unregisterOnShutdown flag.
263
+ *
264
+ * @param {RegisteredPlugin} plugin - The plugin for which the default schema is to be generated.
265
+ * @returns {PlatformSchema} The default schema object for the plugin.
266
+ */
267
+ getDefaultSchema(plugin: RegisteredPlugin): PlatformSchema;
268
+ }
269
+ export {};
270
+ //# sourceMappingURL=pluginManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluginManager.d.ts","sourceRoot":"","sources":["../src/pluginManager.ts"],"names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