matterbridge-webhooks 1.1.4-dev-20260523-9f12c99 → 1.2.0
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.
- package/CHANGELOG.md +38 -15
- package/dist/fetch.js +3 -2
- package/dist/module.js +8 -8
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -28,26 +28,49 @@ If you like this project and find it useful, please consider giving it a star on
|
|
|
28
28
|
|
|
29
29
|
<a href="https://www.buymeacoffee.com/luligugithub"><img src="https://matterbridge.io/assets/bmc-button.svg" alt="Buy me a coffee" width="120"></a>
|
|
30
30
|
|
|
31
|
-
## [1.
|
|
31
|
+
## [1.2.0] - 2026-06-06
|
|
32
|
+
|
|
33
|
+
### Breaking changes
|
|
34
|
+
|
|
35
|
+
- [matterbridge]: Require matterbridge v.3.8.0 with matter v.1.5.1 and matter.js v.0.17.1.
|
|
36
|
+
|
|
37
|
+
### Added
|
|
38
|
+
|
|
39
|
+
- [codecov]: Add merge of Jest and Vitest coverage reports. This allows to run both Jest and Vitest tests in the same package and have a unified coverage report in Codecov.
|
|
32
40
|
|
|
33
41
|
### Changed
|
|
34
42
|
|
|
35
43
|
- [package]: Update dependencies.
|
|
36
|
-
- [package]: Bump package to `automator` v.3.1.
|
|
37
|
-
|
|
38
|
-
- [package]: Bump `@
|
|
39
|
-
- [package]: Bump `ts-jest` to v.29.4.11.
|
|
40
|
-
- [package]: Bump `typescript-eslint` to v.8.59.4.
|
|
41
|
-
- [package]: Bump `vitest` to v.4.1.7.
|
|
42
|
-
- [package]: Bump `@vitest/coverage-v8` to v.4.1.7.
|
|
43
|
-
- [package]: Bump `eslint-plugin-jsdoc` to v.63.0.0.
|
|
44
|
+
- [package]: Bump package to `automator` v.3.1.11.
|
|
45
|
+
|
|
46
|
+
- [package]: Bump `@eslint/json` to v.2.0.0.
|
|
44
47
|
- [package]: Bump `@eslint/markdown` to v.8.0.2.
|
|
45
|
-
- [package]: Bump `
|
|
46
|
-
- [package]:
|
|
47
|
-
- [package]:
|
|
48
|
-
- [package]:
|
|
49
|
-
- [package]:
|
|
50
|
-
- [
|
|
48
|
+
- [package]: Bump `@types/node` to v.25.9.2.
|
|
49
|
+
- [package]: Bump `@vitest/coverage-istanbul` to v.4.1.8.
|
|
50
|
+
- [package]: Bump `@vitest/eslint-plugin` to v.1.6.19.
|
|
51
|
+
- [package]: Bump `eslint` to v.10.4.1.
|
|
52
|
+
- [package]: Bump `eslint-plugin-jsdoc` to v.63.0.2.
|
|
53
|
+
- [package]: Bump `eslint-plugin-prettier` to v.5.5.6.
|
|
54
|
+
- [package]: Bump `npm-check-updates` to v.22.2.3.
|
|
55
|
+
- [package]: Bump `ts-jest` to v.29.4.11.
|
|
56
|
+
- [package]: Bump `typescript-eslint` to v.8.60.1.
|
|
57
|
+
- [package]: Bump `vitest` to v.4.1.8.
|
|
58
|
+
|
|
59
|
+
- [oxlint]: Bump `oxlint` config to v.1.0.2.
|
|
60
|
+
- [oxfmt]: Bump `oxfmt` config to v.1.0.2.
|
|
61
|
+
- [jest]: Bump `jest` config to v.2.0.2.
|
|
62
|
+
- [vitest]: Bump `vitest` config to v.2.0.5.
|
|
63
|
+
- [eslint]: Bump `eslint` config to v.2.0.6.
|
|
64
|
+
- [prettier]: Bump `.prettierignore` config to v.1.0.1.
|
|
65
|
+
- [package]: Bump `.devcontainer/devcontainer.json` config to v.1.0.2.
|
|
66
|
+
- [package]: Bump `.vscode/settings.json` config to v.1.0.2.
|
|
67
|
+
- [package]: Bump `.vscode/extensions.json` config to v.1.0.1.
|
|
68
|
+
- [workflow]: Bump `.github\workflows\build.yml` config to v.2.0.4.
|
|
69
|
+
- [workflow]: Bump `.github\workflows\codecov.yml` config to v.2.0.5.
|
|
70
|
+
- [workflow]: Bump `.github\workflows\publish.yml` config to v.2.0.4.
|
|
71
|
+
|
|
72
|
+
- [claude]: Move CLAUDE.md in the repo root.
|
|
73
|
+
- [claude]: Add .claude/settings.json with permissions configuration.
|
|
51
74
|
|
|
52
75
|
<a href="https://www.buymeacoffee.com/luligugithub"><img src="https://matterbridge.io/assets/bmc-button.svg" alt="Buy me a coffee" width="80"></a>
|
|
53
76
|
|
package/dist/fetch.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import http from 'node:http';
|
|
2
2
|
import https from 'node:https';
|
|
3
|
+
import { getErrorMessage } from 'matterbridge/utils';
|
|
3
4
|
export async function fetch(url, method = 'GET', data = {}, timeout = 5000) {
|
|
4
5
|
return new Promise((resolve, reject) => {
|
|
5
6
|
const controller = new AbortController();
|
|
@@ -56,13 +57,13 @@ export async function fetch(url, method = 'GET', data = {}, timeout = 5000) {
|
|
|
56
57
|
resolve(jsonResponse);
|
|
57
58
|
}
|
|
58
59
|
catch (err) {
|
|
59
|
-
reject(new Error(`Failed to parse response JSON: ${err
|
|
60
|
+
reject(new Error(`Failed to parse response JSON: ${getErrorMessage(err)}`));
|
|
60
61
|
}
|
|
61
62
|
});
|
|
62
63
|
});
|
|
63
64
|
req.on('error', (error) => {
|
|
64
65
|
clearTimeout(timeoutId);
|
|
65
|
-
reject(new Error(`Request failed: ${error
|
|
66
|
+
reject(new Error(`Request failed: ${getErrorMessage(error)}`));
|
|
66
67
|
});
|
|
67
68
|
if (method === 'POST' || method === 'PUT') {
|
|
68
69
|
req.write(jsonData);
|
package/dist/module.js
CHANGED
|
@@ -10,8 +10,8 @@ export class WebhooksPlatform extends MatterbridgeDynamicPlatform {
|
|
|
10
10
|
constructor(matterbridge, log, config) {
|
|
11
11
|
super(matterbridge, log, config);
|
|
12
12
|
this.config = config;
|
|
13
|
-
if (typeof this.verifyMatterbridgeVersion !== 'function' || !this.verifyMatterbridgeVersion('3.
|
|
14
|
-
throw new Error(`This plugin requires Matterbridge version >= "3.
|
|
13
|
+
if (typeof this.verifyMatterbridgeVersion !== 'function' || !this.verifyMatterbridgeVersion('3.8.0')) {
|
|
14
|
+
throw new Error(`This plugin requires Matterbridge version >= "3.8.0". Please update Matterbridge to the latest version in the frontend.`);
|
|
15
15
|
}
|
|
16
16
|
this.log.info('Initializing platform:', this.config.name);
|
|
17
17
|
this.log.info('Finished initializing platform:', this.config.name);
|
|
@@ -30,8 +30,8 @@ export class WebhooksPlatform extends MatterbridgeDynamicPlatform {
|
|
|
30
30
|
this.log.info(`Registering device: ${webhookName} with method ${webhook.method} and url ${webhook.httpUrl}`);
|
|
31
31
|
const device = new MatterbridgeEndpoint([this.config.deviceType === 'Outlet' ? onOffOutlet : this.config.deviceType === 'Light' ? onOffLight : onOffSwitch, bridgedNode], { id: webhookName }, this.config.debug)
|
|
32
32
|
.createDefaultBridgedDeviceBasicInformationClusterServer(webhookName, 'webhook' + i++, this.matterbridge.aggregatorVendorId, 'Matterbridge', 'Matterbridge Webhook', 0, this.config.version)
|
|
33
|
-
.
|
|
34
|
-
.
|
|
33
|
+
.createDefaultOnOffClusterServer(false)
|
|
34
|
+
.addRequiredClusters()
|
|
35
35
|
.addCommandHandler('on', async () => {
|
|
36
36
|
this.log.info(`Webhook ${webhookName} triggered`);
|
|
37
37
|
await device.setAttribute('onOff', 'onOff', false, device.log);
|
|
@@ -54,8 +54,8 @@ export class WebhooksPlatform extends MatterbridgeDynamicPlatform {
|
|
|
54
54
|
this.log.info(`Registering outlet: ${outletName}...`);
|
|
55
55
|
const device = new MatterbridgeEndpoint([onOffOutlet, bridgedNode], { id: outletName }, this.config.debug)
|
|
56
56
|
.createDefaultBridgedDeviceBasicInformationClusterServer(outletName, 'outlet' + i++, this.matterbridge.aggregatorVendorId, 'Matterbridge', 'Matterbridge Webhook Outlet', 0, this.config.version)
|
|
57
|
-
.
|
|
58
|
-
.
|
|
57
|
+
.createDefaultOnOffClusterServer(false)
|
|
58
|
+
.addRequiredClusters()
|
|
59
59
|
.addCommandHandler('on', async (data) => {
|
|
60
60
|
await this.parseUrl('outlet', outletName, 'on', webhook.onUrl, data);
|
|
61
61
|
})
|
|
@@ -81,10 +81,10 @@ export class WebhooksPlatform extends MatterbridgeDynamicPlatform {
|
|
|
81
81
|
deviceType = extendedColorLight;
|
|
82
82
|
const device = new MatterbridgeEndpoint([deviceType, bridgedNode], { id: lightName }, this.config.debug)
|
|
83
83
|
.createDefaultBridgedDeviceBasicInformationClusterServer(lightName, 'light' + i++, this.matterbridge.aggregatorVendorId, 'Matterbridge', 'Matterbridge Webhook Light', 0, this.config.version)
|
|
84
|
-
.
|
|
84
|
+
.createDefaultOnOffClusterServer(false)
|
|
85
85
|
.createDefaultColorControlClusterServer(undefined, undefined, undefined, undefined, 250, webhook.minMireds, webhook.maxMireds)
|
|
86
86
|
.createDefaultLevelControlClusterServer()
|
|
87
|
-
.
|
|
87
|
+
.addRequiredClusters()
|
|
88
88
|
.addCommandHandler('on', async (data) => {
|
|
89
89
|
await this.parseUrl('light', lightName, 'on', webhook.onUrl, data);
|
|
90
90
|
})
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "matterbridge-webhooks",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "matterbridge-webhooks",
|
|
9
|
-
"version": "1.
|
|
9
|
+
"version": "1.2.0",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"node-ansi-logger": "3.2.1",
|