matterbridge 2.2.6-dev.5 → 2.2.6

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 (147) hide show
  1. package/CHANGELOG.md +2 -1
  2. package/dist/cli.d.ts +29 -0
  3. package/dist/cli.d.ts.map +1 -0
  4. package/dist/cli.js +37 -2
  5. package/dist/cli.js.map +1 -0
  6. package/dist/cluster/export.d.ts +2 -0
  7. package/dist/cluster/export.d.ts.map +1 -0
  8. package/dist/cluster/export.js +2 -0
  9. package/dist/cluster/export.js.map +1 -0
  10. package/dist/defaultConfigSchema.d.ts +27 -0
  11. package/dist/defaultConfigSchema.d.ts.map +1 -0
  12. package/dist/defaultConfigSchema.js +23 -2
  13. package/dist/defaultConfigSchema.js.map +1 -0
  14. package/dist/deviceManager.d.ts +114 -0
  15. package/dist/deviceManager.d.ts.map +1 -0
  16. package/dist/deviceManager.js +94 -1
  17. package/dist/deviceManager.js.map +1 -0
  18. package/dist/frontend.d.ts +221 -0
  19. package/dist/frontend.d.ts.map +1 -0
  20. package/dist/frontend.js +325 -19
  21. package/dist/frontend.js.map +1 -0
  22. package/dist/index.d.ts +35 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +28 -1
  25. package/dist/index.js.map +1 -0
  26. package/dist/logger/export.d.ts +2 -0
  27. package/dist/logger/export.d.ts.map +1 -0
  28. package/dist/logger/export.js +1 -0
  29. package/dist/logger/export.js.map +1 -0
  30. package/dist/matter/behaviors.d.ts +2 -0
  31. package/dist/matter/behaviors.d.ts.map +1 -0
  32. package/dist/matter/behaviors.js +2 -0
  33. package/dist/matter/behaviors.js.map +1 -0
  34. package/dist/matter/clusters.d.ts +2 -0
  35. package/dist/matter/clusters.d.ts.map +1 -0
  36. package/dist/matter/clusters.js +2 -0
  37. package/dist/matter/clusters.js.map +1 -0
  38. package/dist/matter/devices.d.ts +2 -0
  39. package/dist/matter/devices.d.ts.map +1 -0
  40. package/dist/matter/devices.js +2 -0
  41. package/dist/matter/devices.js.map +1 -0
  42. package/dist/matter/endpoints.d.ts +2 -0
  43. package/dist/matter/endpoints.d.ts.map +1 -0
  44. package/dist/matter/endpoints.js +2 -0
  45. package/dist/matter/endpoints.js.map +1 -0
  46. package/dist/matter/export.d.ts +5 -0
  47. package/dist/matter/export.d.ts.map +1 -0
  48. package/dist/matter/export.js +2 -0
  49. package/dist/matter/export.js.map +1 -0
  50. package/dist/matter/types.d.ts +3 -0
  51. package/dist/matter/types.d.ts.map +1 -0
  52. package/dist/matter/types.js +2 -0
  53. package/dist/matter/types.js.map +1 -0
  54. package/dist/matterbridge.d.ts +425 -0
  55. package/dist/matterbridge.d.ts.map +1 -0
  56. package/dist/matterbridge.js +753 -47
  57. package/dist/matterbridge.js.map +1 -0
  58. package/dist/matterbridgeAccessoryPlatform.d.ts +39 -0
  59. package/dist/matterbridgeAccessoryPlatform.d.ts.map +1 -0
  60. package/dist/matterbridgeAccessoryPlatform.js +33 -0
  61. package/dist/matterbridgeAccessoryPlatform.js.map +1 -0
  62. package/dist/matterbridgeBehaviors.d.ts +1056 -0
  63. package/dist/matterbridgeBehaviors.d.ts.map +1 -0
  64. package/dist/matterbridgeBehaviors.js +32 -1
  65. package/dist/matterbridgeBehaviors.js.map +1 -0
  66. package/dist/matterbridgeDeviceTypes.d.ts +177 -0
  67. package/dist/matterbridgeDeviceTypes.d.ts.map +1 -0
  68. package/dist/matterbridgeDeviceTypes.js +112 -11
  69. package/dist/matterbridgeDeviceTypes.js.map +1 -0
  70. package/dist/matterbridgeDynamicPlatform.d.ts +39 -0
  71. package/dist/matterbridgeDynamicPlatform.d.ts.map +1 -0
  72. package/dist/matterbridgeDynamicPlatform.js +33 -0
  73. package/dist/matterbridgeDynamicPlatform.js.map +1 -0
  74. package/dist/matterbridgeEndpoint.d.ts +835 -0
  75. package/dist/matterbridgeEndpoint.d.ts.map +1 -0
  76. package/dist/matterbridgeEndpoint.js +690 -6
  77. package/dist/matterbridgeEndpoint.js.map +1 -0
  78. package/dist/matterbridgeEndpointHelpers.d.ts +2275 -0
  79. package/dist/matterbridgeEndpointHelpers.d.ts.map +1 -0
  80. package/dist/matterbridgeEndpointHelpers.js +118 -9
  81. package/dist/matterbridgeEndpointHelpers.js.map +1 -0
  82. package/dist/matterbridgePlatform.d.ts +285 -0
  83. package/dist/matterbridgePlatform.d.ts.map +1 -0
  84. package/dist/matterbridgePlatform.js +216 -7
  85. package/dist/matterbridgePlatform.js.map +1 -0
  86. package/dist/matterbridgeTypes.d.ts +179 -0
  87. package/dist/matterbridgeTypes.d.ts.map +1 -0
  88. package/dist/matterbridgeTypes.js +24 -0
  89. package/dist/matterbridgeTypes.js.map +1 -0
  90. package/dist/pluginManager.d.ts +236 -0
  91. package/dist/pluginManager.d.ts.map +1 -0
  92. package/dist/pluginManager.js +229 -3
  93. package/dist/pluginManager.js.map +1 -0
  94. package/dist/shelly.d.ts +92 -0
  95. package/dist/shelly.d.ts.map +1 -0
  96. package/dist/shelly.js +146 -6
  97. package/dist/shelly.js.map +1 -0
  98. package/dist/storage/export.d.ts +2 -0
  99. package/dist/storage/export.d.ts.map +1 -0
  100. package/dist/storage/export.js +1 -0
  101. package/dist/storage/export.js.map +1 -0
  102. package/dist/update.d.ts +32 -0
  103. package/dist/update.d.ts.map +1 -0
  104. package/dist/update.js +45 -0
  105. package/dist/update.js.map +1 -0
  106. package/dist/utils/colorUtils.d.ts +61 -0
  107. package/dist/utils/colorUtils.d.ts.map +1 -0
  108. package/dist/utils/colorUtils.js +205 -2
  109. package/dist/utils/colorUtils.js.map +1 -0
  110. package/dist/utils/copyDirectory.d.ts +32 -0
  111. package/dist/utils/copyDirectory.d.ts.map +1 -0
  112. package/dist/utils/copyDirectory.js +37 -1
  113. package/dist/utils/copyDirectory.js.map +1 -0
  114. package/dist/utils/createZip.d.ts +38 -0
  115. package/dist/utils/createZip.d.ts.map +1 -0
  116. package/dist/utils/createZip.js +42 -2
  117. package/dist/utils/createZip.js.map +1 -0
  118. package/dist/utils/deepCopy.d.ts +31 -0
  119. package/dist/utils/deepCopy.d.ts.map +1 -0
  120. package/dist/utils/deepCopy.js +40 -0
  121. package/dist/utils/deepCopy.js.map +1 -0
  122. package/dist/utils/deepEqual.d.ts +53 -0
  123. package/dist/utils/deepEqual.d.ts.map +1 -0
  124. package/dist/utils/deepEqual.js +65 -1
  125. package/dist/utils/deepEqual.js.map +1 -0
  126. package/dist/utils/export.d.ts +10 -0
  127. package/dist/utils/export.d.ts.map +1 -0
  128. package/dist/utils/export.js +1 -0
  129. package/dist/utils/export.js.map +1 -0
  130. package/dist/utils/isvalid.d.ts +87 -0
  131. package/dist/utils/isvalid.d.ts.map +1 -0
  132. package/dist/utils/isvalid.js +86 -0
  133. package/dist/utils/isvalid.js.map +1 -0
  134. package/dist/utils/network.d.ts +69 -0
  135. package/dist/utils/network.d.ts.map +1 -0
  136. package/dist/utils/network.js +77 -8
  137. package/dist/utils/network.js.map +1 -0
  138. package/dist/utils/parameter.d.ts +44 -0
  139. package/dist/utils/parameter.d.ts.map +1 -0
  140. package/dist/utils/parameter.js +41 -0
  141. package/dist/utils/parameter.js.map +1 -0
  142. package/dist/utils/wait.d.ts +43 -0
  143. package/dist/utils/wait.d.ts.map +1 -0
  144. package/dist/utils/wait.js +48 -5
  145. package/dist/utils/wait.js.map +1 -0
  146. package/npm-shrinkwrap.json +2 -2
  147. package/package.json +2 -1
@@ -1,3 +1,26 @@
1
+ /**
2
+ * This file contains the Plugins class.
3
+ *
4
+ * @file plugins.ts
5
+ * @author Luca Liguori
6
+ * @date 2024-07-14
7
+ * @version 1.1.1
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
+ // AnsiLogger module
1
24
  import { AnsiLogger, UNDERLINE, UNDERLINEOFF, BLUE, db, er, nf, nt, rs, wr } from './logger/export.js';
2
25
  import { plg, typ } from './matterbridgeTypes.js';
3
26
  export class PluginManager {
@@ -7,8 +30,9 @@ export class PluginManager {
7
30
  log;
8
31
  constructor(matterbridge) {
9
32
  this.matterbridge = matterbridge;
33
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
34
  this.nodeContext = matterbridge.nodeContext;
11
- this.log = new AnsiLogger({ logName: 'PluginManager', logTimestampFormat: 4, logLevel: matterbridge.log.logLevel });
35
+ this.log = new AnsiLogger({ logName: 'PluginManager', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: matterbridge.log.logLevel });
12
36
  this.log.debug('Matterbridge plugin manager starting...');
13
37
  }
14
38
  get length() {
@@ -45,6 +69,7 @@ export class PluginManager {
45
69
  }
46
70
  catch (error) {
47
71
  this.log.error(`Error processing forEach plugin ${plg}${plugin.name}${er}:`, error);
72
+ // throw error;
48
73
  }
49
74
  });
50
75
  await Promise.all(tasks);
@@ -52,13 +77,31 @@ export class PluginManager {
52
77
  set logLevel(logLevel) {
53
78
  this.log.logLevel = logLevel;
54
79
  }
80
+ /**
81
+ * Loads registered plugins from storage.
82
+ *
83
+ * This method retrieves an array of registered plugins from the storage and converts it
84
+ * into a map where the plugin names are the keys and the plugin objects are the values.
85
+ *
86
+ * @returns {Promise<RegisteredPlugin[]>} A promise that resolves to an array of registered plugins.
87
+ */
55
88
  async loadFromStorage() {
89
+ // Load the array from storage and convert it to a map
56
90
  const pluginsArray = await this.nodeContext.get('plugins', []);
57
91
  for (const plugin of pluginsArray)
58
92
  this._plugins.set(plugin.name, plugin);
59
93
  return pluginsArray;
60
94
  }
95
+ /**
96
+ * Loads registered plugins from storage.
97
+ *
98
+ * This method retrieves an array of registered plugins from the storage and converts it
99
+ * into a map where the plugin names are the keys and the plugin objects are the values.
100
+ *
101
+ * @returns {Promise<RegisteredPlugin[]>} A promise that resolves to an array of registered plugins.
102
+ */
61
103
  async saveToStorage() {
104
+ // Convert the map to an array
62
105
  const plugins = [];
63
106
  const pluginArrayFromMap = Array.from(this._plugins.values());
64
107
  for (const plugin of pluginArrayFromMap) {
@@ -78,13 +121,20 @@ export class PluginManager {
78
121
  this.log.debug(`Saved ${BLUE}${plugins.length}${db} plugins to storage`);
79
122
  return plugins.length;
80
123
  }
124
+ /**
125
+ * Resolves the name of a plugin by loading and parsing its package.json file.
126
+ * @param pluginPath - The path to the plugin or the path to the plugin's package.json file.
127
+ * @returns The path to the resolved package.json file, or null if the package.json file is not found or does not contain a name.
128
+ */
81
129
  async resolve(pluginPath) {
82
130
  const { default: path } = await import('node:path');
83
131
  const { promises } = await import('node:fs');
84
132
  if (!pluginPath.endsWith('package.json'))
85
133
  pluginPath = path.join(pluginPath, 'package.json');
134
+ // Resolve the package.json of the plugin
86
135
  let packageJsonPath = path.resolve(pluginPath);
87
136
  this.log.debug(`Resolving plugin path ${plg}${packageJsonPath}${db}`);
137
+ // Check if the package.json file exists
88
138
  try {
89
139
  await promises.access(packageJsonPath);
90
140
  }
@@ -94,11 +144,13 @@ export class PluginManager {
94
144
  this.log.debug(`Trying at ${plg}${packageJsonPath}${db}`);
95
145
  }
96
146
  try {
147
+ // Load the package.json of the plugin
97
148
  const packageJson = JSON.parse(await promises.readFile(packageJsonPath, 'utf8'));
98
149
  if (!packageJson.name) {
99
150
  this.log.error(`Package.json name not found at ${packageJsonPath}`);
100
151
  return null;
101
152
  }
153
+ // Check for main issues
102
154
  if (!packageJson.type || packageJson.type !== 'module') {
103
155
  this.log.error(`Plugin at ${packageJsonPath} is not a module`);
104
156
  return null;
@@ -107,6 +159,7 @@ export class PluginManager {
107
159
  this.log.error(`Plugin at ${packageJsonPath} has no main entrypoint in package.json`);
108
160
  return null;
109
161
  }
162
+ // Check for @project-chip and @matter packages in dependencies and devDependencies
110
163
  const checkForProjectChipPackages = (dependencies) => {
111
164
  return Object.keys(dependencies).filter((pkg) => pkg.startsWith('@project-chip') || pkg.startsWith('@matter'));
112
165
  };
@@ -128,6 +181,7 @@ export class PluginManager {
128
181
  this.log.error(`Please open an issue on the plugin repository to remove them.`);
129
182
  return null;
130
183
  }
184
+ // Check for matterbridge package in dependencies and devDependencies
131
185
  const checkForMatterbridgePackage = (dependencies) => {
132
186
  return Object.keys(dependencies).filter((pkg) => pkg === 'matterbridge');
133
187
  };
@@ -157,6 +211,11 @@ export class PluginManager {
157
211
  return null;
158
212
  }
159
213
  }
214
+ /**
215
+ * Loads and parse the plugin package.json and returns it.
216
+ * @param plugin - The plugin to load the package from.
217
+ * @returns A Promise that resolves to the package.json object or undefined if the package.json could not be loaded.
218
+ */
160
219
  async parse(plugin) {
161
220
  const { promises } = await import('node:fs');
162
221
  try {
@@ -182,6 +241,7 @@ export class PluginManager {
182
241
  this.log.warn(`Plugin ${plg}${plugin.name}${wr} has no path`);
183
242
  if (!plugin.type)
184
243
  this.log.warn(`Plugin ${plg}${plugin.name}${wr} has no type`);
244
+ // Check for @project-chip and @matter packages in dependencies and devDependencies
185
245
  const checkForProjectChipPackages = (dependencies) => {
186
246
  return Object.keys(dependencies).filter((pkg) => pkg.startsWith('@project-chip') || pkg.startsWith('@matter'));
187
247
  };
@@ -203,6 +263,7 @@ export class PluginManager {
203
263
  this.log.error(`Please open an issue on the plugin repository to remove them.`);
204
264
  return null;
205
265
  }
266
+ // Check for matterbridge package in dependencies and devDependencies
206
267
  const checkForMatterbridgePackage = (dependencies) => {
207
268
  return Object.keys(dependencies).filter((pkg) => pkg === 'matterbridge');
208
269
  };
@@ -224,6 +285,7 @@ export class PluginManager {
224
285
  this.log.error(`Please open an issue on the plugin repository to remove them.`);
225
286
  return null;
226
287
  }
288
+ // await this.saveToStorage(); // No need to save the plugin to storage
227
289
  return packageJson;
228
290
  }
229
291
  catch (err) {
@@ -232,6 +294,16 @@ export class PluginManager {
232
294
  return null;
233
295
  }
234
296
  }
297
+ /**
298
+ * Enables a plugin by its name or path.
299
+ *
300
+ * This method enables a plugin by setting its `enabled` property to `true` and saving the updated
301
+ * plugin information to storage. It first checks if the plugin is already registered in the `_plugins` map.
302
+ * If not, it attempts to resolve the plugin's `package.json` file to retrieve its name and enable it.
303
+ *
304
+ * @param {string} nameOrPath - The name or path of the plugin to enable.
305
+ * @returns {Promise<RegisteredPlugin | null>} A promise that resolves to the enabled plugin object, or null if the plugin could not be enabled.
306
+ */
235
307
  async enable(nameOrPath) {
236
308
  const { promises } = await import('node:fs');
237
309
  if (!nameOrPath || nameOrPath === '')
@@ -265,6 +337,16 @@ export class PluginManager {
265
337
  return null;
266
338
  }
267
339
  }
340
+ /**
341
+ * Enables a plugin by its name or path.
342
+ *
343
+ * This method enables a plugin by setting its `enabled` property to `true` and saving the updated
344
+ * plugin information to storage. It first checks if the plugin is already registered in the `_plugins` map.
345
+ * If not, it attempts to resolve the plugin's `package.json` file to retrieve its name and enable it.
346
+ *
347
+ * @param {string} nameOrPath - The name or path of the plugin to enable.
348
+ * @returns {Promise<RegisteredPlugin | null>} A promise that resolves to the enabled plugin object, or null if the plugin could not be enabled.
349
+ */
268
350
  async disable(nameOrPath) {
269
351
  const { promises } = await import('node:fs');
270
352
  if (!nameOrPath || nameOrPath === '')
@@ -298,6 +380,16 @@ export class PluginManager {
298
380
  return null;
299
381
  }
300
382
  }
383
+ /**
384
+ * Removes a plugin by its name or path.
385
+ *
386
+ * This method removes a plugin from the `_plugins` map and saves the updated plugin information to storage.
387
+ * It first checks if the plugin is already registered in the `_plugins` map. If not, it attempts to resolve
388
+ * the plugin's `package.json` file to retrieve its name and remove it.
389
+ *
390
+ * @param {string} nameOrPath - The name or path of the plugin to remove.
391
+ * @returns {Promise<RegisteredPlugin | null>} A promise that resolves to the removed plugin object, or null if the plugin could not be removed.
392
+ */
301
393
  async remove(nameOrPath) {
302
394
  const { promises } = await import('node:fs');
303
395
  if (!nameOrPath || nameOrPath === '')
@@ -331,6 +423,17 @@ export class PluginManager {
331
423
  return null;
332
424
  }
333
425
  }
426
+ /**
427
+ * Adds a plugin by its name or path.
428
+ *
429
+ * This method adds a plugin to the `_plugins` map and saves the updated plugin information to storage.
430
+ * It first resolves the plugin's `package.json` file to retrieve its details. If the plugin is already
431
+ * registered, it logs an info message and returns null. Otherwise, it registers the plugin, enables it,
432
+ * and saves the updated plugin information to storage.
433
+ *
434
+ * @param {string} nameOrPath - The name or path of the plugin to add.
435
+ * @returns {Promise<RegisteredPlugin | null>} A promise that resolves to the added plugin object, or null if the plugin could not be added.
436
+ */
334
437
  async add(nameOrPath) {
335
438
  const { promises } = await import('node:fs');
336
439
  if (!nameOrPath || nameOrPath === '')
@@ -357,6 +460,15 @@ export class PluginManager {
357
460
  return null;
358
461
  }
359
462
  }
463
+ /**
464
+ * Installs a plugin by its name.
465
+ *
466
+ * This method first uninstalls any existing version of the plugin, then installs the plugin globally using npm.
467
+ * It logs the installation process and retrieves the installed version of the plugin.
468
+ *
469
+ * @param {string} name - The name of the plugin to install.
470
+ * @returns {Promise<string | undefined>} A promise that resolves to the installed version of the plugin, or undefined if the installation failed.
471
+ */
360
472
  async install(name) {
361
473
  const { exec } = await import('node:child_process');
362
474
  await this.uninstall(name);
@@ -371,11 +483,14 @@ export class PluginManager {
371
483
  else {
372
484
  this.log.info(`Installed plugin ${plg}${name}${nf}`);
373
485
  this.log.debug(`Installed plugin ${plg}${name}${db}: ${stdout}`);
486
+ // Get the installed version
487
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
374
488
  exec(`npm list -g ${name} --depth=0`, (listError, listStdout, listStderr) => {
375
489
  if (listError) {
376
490
  this.log.error(`List error: ${listError}`);
377
491
  resolve(undefined);
378
492
  }
493
+ // Clean the output to get only the package name and version
379
494
  const lines = listStdout.split('\n');
380
495
  const versionLine = lines.find((line) => line.includes(`${name}@`));
381
496
  if (versionLine) {
@@ -391,6 +506,15 @@ export class PluginManager {
391
506
  });
392
507
  });
393
508
  }
509
+ /**
510
+ * Uninstalls a plugin by its name.
511
+ *
512
+ * This method uninstalls a globally installed plugin using npm. It logs the uninstallation process
513
+ * and returns the name of the uninstalled plugin if successful, or undefined if the uninstallation failed.
514
+ *
515
+ * @param {string} name - The name of the plugin to uninstall.
516
+ * @returns {Promise<string | undefined>} A promise that resolves to the name of the uninstalled plugin, or undefined if the uninstallation failed.
517
+ */
394
518
  async uninstall(name) {
395
519
  const { exec } = await import('node:child_process');
396
520
  this.log.info(`Uninstalling plugin ${plg}${name}${nf}`);
@@ -409,6 +533,14 @@ export class PluginManager {
409
533
  });
410
534
  });
411
535
  }
536
+ /**
537
+ * Loads a plugin and returns the corresponding MatterbridgePlatform instance.
538
+ * @param plugin - The plugin to load.
539
+ * @param start - Optional flag indicating whether to start the plugin after loading. Default is false.
540
+ * @param message - Optional message to pass to the plugin when starting.
541
+ * @returns A Promise that resolves to the loaded MatterbridgePlatform instance.
542
+ * @throws An error if the plugin is not enabled, already loaded, or fails to load.
543
+ */
412
544
  async load(plugin, start = false, message = '', configure = false) {
413
545
  const { promises } = await import('node:fs');
414
546
  const { default: path } = await import('node:path');
@@ -422,15 +554,20 @@ export class PluginManager {
422
554
  }
423
555
  this.log.info(`Loading plugin ${plg}${plugin.name}${nf} type ${typ}${plugin.type}${nf}`);
424
556
  try {
557
+ // Load the package.json of the plugin
425
558
  const packageJson = JSON.parse(await promises.readFile(plugin.path, 'utf8'));
559
+ // Resolve the main module path relative to package.json
426
560
  const pluginEntry = path.resolve(path.dirname(plugin.path), packageJson.main);
561
+ // Dynamically import the plugin
427
562
  const { pathToFileURL } = await import('node:url');
428
563
  const pluginUrl = pathToFileURL(pluginEntry);
429
564
  this.log.debug(`Importing plugin ${plg}${plugin.name}${db} from ${pluginUrl.href}`);
430
565
  const pluginInstance = await import(pluginUrl.href);
431
566
  this.log.debug(`Imported plugin ${plg}${plugin.name}${db} from ${pluginUrl.href}`);
567
+ // Call the default export function of the plugin, passing this MatterBridge instance, the log and the config
432
568
  if (pluginInstance.default) {
433
569
  const config = await this.loadConfig(plugin);
570
+ // Preset the plugin properties here in case the plugin throws an error during loading. In this case the user can change the config and restart the plugin.
434
571
  plugin.name = packageJson.name;
435
572
  plugin.description = packageJson.description ?? 'No description';
436
573
  plugin.version = packageJson.version;
@@ -439,7 +576,7 @@ export class PluginManager {
439
576
  plugin.schemaJson = await this.loadSchema(plugin);
440
577
  config.name = plugin.name;
441
578
  config.version = packageJson.version;
442
- const log = new AnsiLogger({ logName: plugin.description ?? 'No description', logTimestampFormat: 4, logLevel: config.debug ? "debug" : this.matterbridge.log.logLevel });
579
+ const log = new AnsiLogger({ logName: plugin.description ?? 'No description', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: config.debug ? "debug" /* LogLevel.DEBUG */ : this.matterbridge.log.logLevel });
443
580
  const platform = pluginInstance.default(this.matterbridge, log, config);
444
581
  config.type = platform.type;
445
582
  platform.name = packageJson.name;
@@ -454,7 +591,9 @@ export class PluginManager {
454
591
  plugin.loaded = true;
455
592
  plugin.registeredDevices = 0;
456
593
  plugin.addedDevices = 0;
457
- await this.saveToStorage();
594
+ // plugin.configJson = config;
595
+ // plugin.schemaJson = await this.loadSchema(plugin);
596
+ await this.saveToStorage(); // Save the plugin to storage
458
597
  this.log.notice(`Loaded plugin ${plg}${plugin.name}${nt} type ${typ}${platform.type}${nt} (entrypoint ${UNDERLINE}${pluginEntry}${UNDERLINEOFF})`);
459
598
  if (start)
460
599
  await this.start(plugin, message, false);
@@ -473,6 +612,14 @@ export class PluginManager {
473
612
  }
474
613
  return undefined;
475
614
  }
615
+ /**
616
+ * Starts a plugin.
617
+ *
618
+ * @param {RegisteredPlugin} plugin - The plugin to start.
619
+ * @param {string} [message] - Optional message to pass to the plugin's onStart method.
620
+ * @param {boolean} [configure] - Indicates whether to configure the plugin after starting (default false).
621
+ * @returns {Promise<RegisteredPlugin | undefined>} A promise that resolves when the plugin is started successfully, or rejects with an error if starting the plugin fails.
622
+ */
476
623
  async start(plugin, message, configure = false) {
477
624
  if (!plugin.loaded) {
478
625
  this.log.error(`Plugin ${plg}${plugin.name}${er} not loaded`);
@@ -502,6 +649,12 @@ export class PluginManager {
502
649
  }
503
650
  return undefined;
504
651
  }
652
+ /**
653
+ * Configures a plugin.
654
+ *
655
+ * @param {RegisteredPlugin} plugin - The plugin to configure.
656
+ * @returns {Promise<void>} A promise that resolves when the plugin is configured successfully, or rejects with an error if configuration fails.
657
+ */
505
658
  async configure(plugin) {
506
659
  if (!plugin.loaded) {
507
660
  this.log.error(`Plugin ${plg}${plugin.name}${er} not loaded`);
@@ -532,6 +685,18 @@ export class PluginManager {
532
685
  }
533
686
  return undefined;
534
687
  }
688
+ /**
689
+ * Shuts down a plugin.
690
+ *
691
+ * This method shuts down a plugin by calling its `onShutdown` method and resetting its state.
692
+ * It logs the shutdown process and optionally removes all devices associated with the plugin.
693
+ *
694
+ * @param {RegisteredPlugin} plugin - The plugin to shut down.
695
+ * @param {string} [reason] - The reason for shutting down the plugin.
696
+ * @param {boolean} [removeAllDevices=false] - Whether to remove all devices associated with the plugin.
697
+ * @param {boolean} [force=false] - Whether to force the shutdown even if the plugin is not loaded or started.
698
+ * @returns {Promise<RegisteredPlugin | undefined>} A promise that resolves to the shut down plugin object, or undefined if the shutdown failed.
699
+ */
535
700
  async shutdown(plugin, reason, removeAllDevices = false, force = false) {
536
701
  this.log.debug(`Shutting down plugin ${plg}${plugin.name}${db}`);
537
702
  if (!plugin.loaded) {
@@ -574,6 +739,15 @@ export class PluginManager {
574
739
  }
575
740
  return undefined;
576
741
  }
742
+ /**
743
+ * Loads the configuration for a plugin.
744
+ * If the configuration file exists, it reads the file and returns the parsed JSON data.
745
+ * If the configuration file does not exist, it creates a new file with default configuration and returns it.
746
+ * If any error occurs during file access or creation, it logs an error and return un empty config.
747
+ *
748
+ * @param plugin - The plugin for which to load the configuration.
749
+ * @returns A promise that resolves to the loaded or created configuration.
750
+ */
577
751
  async loadConfig(plugin) {
578
752
  const { default: path } = await import('node:path');
579
753
  const { promises } = await import('node:fs');
@@ -584,6 +758,8 @@ export class PluginManager {
584
758
  const data = await promises.readFile(configFile, 'utf8');
585
759
  const config = JSON.parse(data);
586
760
  this.log.debug(`Loaded config file ${configFile} for plugin ${plg}${plugin.name}${db}.`);
761
+ // this.log.debug(`Loaded config file ${configFile} for plugin ${plg}${plugin.name}${db}.\nConfig:${rs}\n`, config);
762
+ // The first time a plugin is added to the system, the config file is created with the plugin name and type "AnyPlatform".
587
763
  config.name = plugin.name;
588
764
  config.type = plugin.type;
589
765
  if (config.debug === undefined)
@@ -607,6 +783,7 @@ export class PluginManager {
607
783
  try {
608
784
  await promises.writeFile(configFile, JSON.stringify(config, null, 2), 'utf8');
609
785
  this.log.debug(`Created config file ${configFile} for plugin ${plg}${plugin.name}${db}.`);
786
+ // this.log.debug(`Created config file ${configFile} for plugin ${plg}${plugin.name}${db}.\nConfig:${rs}\n`, config);
610
787
  return config;
611
788
  }
612
789
  catch (err) {
@@ -620,6 +797,18 @@ export class PluginManager {
620
797
  }
621
798
  }
622
799
  }
800
+ /**
801
+ * Saves the configuration of a plugin to a file.
802
+ *
803
+ * This method saves the configuration of the specified plugin to a JSON file in the matterbridge directory.
804
+ * If the plugin's configuration is not found, it logs an error and rejects the promise. If the configuration
805
+ * is successfully saved, it logs a debug message. If an error occurs during the file write operation, it logs
806
+ * the error and rejects the promise.
807
+ *
808
+ * @param {RegisteredPlugin} plugin - The plugin whose configuration is to be saved.
809
+ * @returns {Promise<void>} A promise that resolves when the configuration is successfully saved, or rejects if an error occurs.
810
+ * @throws {Error} If the plugin's configuration is not found.
811
+ */
623
812
  async saveConfigFromPlugin(plugin) {
624
813
  const { default: path } = await import('node:path');
625
814
  const { promises } = await import('node:fs');
@@ -632,6 +821,7 @@ export class PluginManager {
632
821
  await promises.writeFile(configFile, JSON.stringify(plugin.platform.config, null, 2), 'utf8');
633
822
  plugin.configJson = plugin.platform.config;
634
823
  this.log.debug(`Saved config file ${configFile} for plugin ${plg}${plugin.name}${db}`);
824
+ // this.log.debug(`Saved config file ${configFile} for plugin ${plg}${plugin.name}${db}.\nConfig:${rs}\n`, plugin.platform.config);
635
825
  return Promise.resolve();
636
826
  }
637
827
  catch (err) {
@@ -639,6 +829,19 @@ export class PluginManager {
639
829
  return Promise.reject(err);
640
830
  }
641
831
  }
832
+ /**
833
+ * Saves the configuration of a plugin from a JSON object to a file.
834
+ *
835
+ * This method saves the provided configuration of the specified plugin to a JSON file in the matterbridge directory.
836
+ * It first checks if the configuration data is valid by ensuring it contains the correct name and type, and matches
837
+ * the plugin's name. If the configuration data is invalid, it logs an error and returns. If the configuration is
838
+ * successfully saved, it updates the plugin's `configJson` property and logs a debug message. If an error occurs
839
+ * during the file write operation, it logs the error and returns.
840
+ *
841
+ * @param {RegisteredPlugin} plugin - The plugin whose configuration is to be saved.
842
+ * @param {PlatformConfig} config - The configuration data to be saved.
843
+ * @returns {Promise<void>} A promise that resolves when the configuration is successfully saved, or returns if an error occurs.
844
+ */
642
845
  async saveConfigFromJson(plugin, config) {
643
846
  const { default: path } = await import('node:path');
644
847
  const { promises } = await import('node:fs');
@@ -656,12 +859,23 @@ export class PluginManager {
656
859
  plugin.platform.onConfigChanged(config).catch((err) => this.log.error(`Error calling onConfigChanged for plugin ${plg}${plugin.name}${er}: ${err}`));
657
860
  }
658
861
  this.log.debug(`Saved config file ${configFile} for plugin ${plg}${plugin.name}${db}`);
862
+ // this.log.debug(`Saved config file ${configFile} for plugin ${plg}${plugin.name}${db}.\nConfig:${rs}\n`, config);
659
863
  }
660
864
  catch (err) {
661
865
  this.log.error(`Error saving config file ${configFile} for plugin ${plg}${plugin.name}${er}: ${err}`);
662
866
  return;
663
867
  }
664
868
  }
869
+ /**
870
+ * Loads the schema for a plugin.
871
+ *
872
+ * This method attempts to load the schema file for the specified plugin. If the schema file is found,
873
+ * it reads and parses the file, updates the schema's title and description, and logs the process.
874
+ * If the schema file is not found, it logs the event and loads a default schema for the plugin.
875
+ *
876
+ * @param {RegisteredPlugin} plugin - The plugin whose schema is to be loaded.
877
+ * @returns {Promise<PlatformSchema>} A promise that resolves to the loaded schema object, or the default schema if the schema file is not found.
878
+ */
665
879
  async loadSchema(plugin) {
666
880
  const { promises } = await import('node:fs');
667
881
  const schemaFile = plugin.path.replace('package.json', `${plugin.name}.schema.json`);
@@ -672,6 +886,7 @@ export class PluginManager {
672
886
  schema.title = plugin.description;
673
887
  schema.description = plugin.name + ' v. ' + plugin.version + ' by ' + plugin.author;
674
888
  this.log.debug(`Loaded schema file ${schemaFile} for plugin ${plg}${plugin.name}${db}.`);
889
+ // this.log.debug(`Loaded schema file ${schemaFile} for plugin ${plg}${plugin.name}${db}.\nSchema:${rs}\n`, schema);
675
890
  return schema;
676
891
  }
677
892
  catch (error) {
@@ -679,6 +894,16 @@ export class PluginManager {
679
894
  return this.getDefaultSchema(plugin);
680
895
  }
681
896
  }
897
+ /**
898
+ * Returns the default schema for a plugin.
899
+ *
900
+ * This method generates a default schema object for the specified plugin. The schema includes
901
+ * metadata such as the plugin's title, description, version, and author. It also defines the
902
+ * properties of the schema, including the plugin's name, type, debug flag, and unregisterOnShutdown flag.
903
+ *
904
+ * @param {RegisteredPlugin} plugin - The plugin for which the default schema is to be generated.
905
+ * @returns {PlatformSchema} The default schema object for the plugin.
906
+ */
682
907
  getDefaultSchema(plugin) {
683
908
  return {
684
909
  title: plugin.description,
@@ -709,3 +934,4 @@ export class PluginManager {
709
934
  };
710
935
  }
711
936
  }
937
+ //# sourceMappingURL=pluginManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluginManager.js","sourceRoot":"","sources":["../src/pluginManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,oBAAoB;AACpB,OAAO,EAAE,UAAU,EAA6B,SAAS,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,EA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