matterbridge 3.5.0 → 3.5.1-dev-20260122-6461be3
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 +18 -0
- package/README-DOCKER.md +4 -2
- package/README.md +4 -1
- package/bin/mb_coap.js +1 -1
- package/bin/mb_mdns.js +1 -1
- package/dist/broadcastServer.d.ts +0 -115
- package/dist/broadcastServer.js +1 -119
- package/dist/broadcastServerTypes.d.ts +0 -43
- package/dist/broadcastServerTypes.js +0 -24
- package/dist/cli.d.ts +1 -26
- package/dist/cli.js +2 -102
- package/dist/cliEmitter.d.ts +0 -36
- package/dist/cliEmitter.js +0 -37
- package/dist/cliHistory.d.ts +0 -42
- package/dist/cliHistory.js +1 -39
- package/dist/clusters/export.d.ts +0 -1
- package/dist/clusters/export.js +0 -2
- package/dist/deviceManager.d.ts +0 -108
- package/dist/deviceManager.js +2 -114
- package/dist/devices/airConditioner.d.ts +0 -75
- package/dist/devices/airConditioner.js +0 -57
- package/dist/devices/batteryStorage.d.ts +0 -43
- package/dist/devices/batteryStorage.js +1 -48
- package/dist/devices/cooktop.d.ts +0 -55
- package/dist/devices/cooktop.js +0 -56
- package/dist/devices/dishwasher.d.ts +0 -55
- package/dist/devices/dishwasher.js +0 -57
- package/dist/devices/evse.d.ts +0 -57
- package/dist/devices/evse.js +10 -74
- package/dist/devices/export.d.ts +0 -1
- package/dist/devices/export.js +0 -5
- package/dist/devices/extractorHood.d.ts +0 -41
- package/dist/devices/extractorHood.js +0 -43
- package/dist/devices/heatPump.d.ts +0 -43
- package/dist/devices/heatPump.js +2 -50
- package/dist/devices/laundryDryer.d.ts +0 -58
- package/dist/devices/laundryDryer.js +3 -62
- package/dist/devices/laundryWasher.d.ts +0 -64
- package/dist/devices/laundryWasher.js +4 -70
- package/dist/devices/microwaveOven.d.ts +1 -77
- package/dist/devices/microwaveOven.js +5 -88
- package/dist/devices/oven.d.ts +0 -82
- package/dist/devices/oven.js +0 -85
- package/dist/devices/refrigerator.d.ts +0 -100
- package/dist/devices/refrigerator.js +0 -102
- package/dist/devices/roboticVacuumCleaner.d.ts +0 -83
- package/dist/devices/roboticVacuumCleaner.js +9 -100
- package/dist/devices/solarPower.d.ts +0 -36
- package/dist/devices/solarPower.js +0 -38
- package/dist/devices/speaker.d.ts +0 -79
- package/dist/devices/speaker.js +0 -84
- package/dist/devices/temperatureControl.d.ts +0 -21
- package/dist/devices/temperatureControl.js +3 -24
- package/dist/devices/waterHeater.d.ts +0 -74
- package/dist/devices/waterHeater.js +2 -82
- package/dist/frontend.d.ts +4 -187
- package/dist/frontend.js +89 -505
- package/dist/frontendTypes.d.ts +0 -57
- package/dist/frontendTypes.js +0 -45
- package/dist/helpers.d.ts +0 -43
- package/dist/helpers.js +1 -54
- package/dist/index.d.ts +0 -23
- package/dist/index.js +0 -25
- package/dist/jestutils/export.d.ts +0 -1
- package/dist/jestutils/export.js +0 -1
- package/dist/jestutils/jestHelpers.d.ts +0 -255
- package/dist/jestutils/jestHelpers.js +16 -379
- package/dist/logger/export.d.ts +0 -1
- package/dist/logger/export.js +0 -1
- package/dist/matter/behaviors.d.ts +0 -1
- package/dist/matter/behaviors.js +0 -2
- package/dist/matter/clusters.d.ts +0 -1
- package/dist/matter/clusters.js +0 -2
- package/dist/matter/devices.d.ts +0 -1
- package/dist/matter/devices.js +0 -2
- package/dist/matter/endpoints.d.ts +0 -1
- package/dist/matter/endpoints.js +0 -2
- package/dist/matter/export.d.ts +0 -1
- package/dist/matter/export.js +0 -2
- package/dist/matter/types.d.ts +0 -1
- package/dist/matter/types.js +0 -2
- package/dist/matterNode.d.ts +0 -258
- package/dist/matterNode.js +9 -364
- package/dist/matterbridge.d.ts +0 -362
- package/dist/matterbridge.js +75 -864
- package/dist/matterbridgeAccessoryPlatform.d.ts +0 -36
- package/dist/matterbridgeAccessoryPlatform.js +0 -38
- package/dist/matterbridgeBehaviors.d.ts +0 -24
- package/dist/matterbridgeBehaviors.js +5 -68
- package/dist/matterbridgeDeviceTypes.d.ts +0 -649
- package/dist/matterbridgeDeviceTypes.js +6 -673
- package/dist/matterbridgeDynamicPlatform.d.ts +0 -36
- package/dist/matterbridgeDynamicPlatform.js +0 -38
- package/dist/matterbridgeEndpoint.d.ts +2 -1332
- package/dist/matterbridgeEndpoint.js +94 -1459
- package/dist/matterbridgeEndpointHelpers.d.ts +0 -425
- package/dist/matterbridgeEndpointHelpers.js +22 -487
- package/dist/matterbridgeEndpointTypes.d.ts +0 -70
- package/dist/matterbridgeEndpointTypes.js +0 -25
- package/dist/matterbridgePlatform.d.ts +0 -425
- package/dist/matterbridgePlatform.js +2 -453
- package/dist/matterbridgeTypes.d.ts +0 -46
- package/dist/matterbridgeTypes.js +0 -26
- package/dist/mb_coap.d.ts +1 -0
- package/dist/{dgram/mb_coap.js → mb_coap.js} +3 -41
- package/dist/mb_mdns.d.ts +1 -0
- package/dist/{dgram/mb_mdns.js → mb_mdns.js} +47 -81
- package/dist/pluginManager.d.ts +0 -305
- package/dist/pluginManager.js +8 -345
- package/dist/shelly.d.ts +0 -157
- package/dist/shelly.js +7 -178
- package/dist/spawn.d.ts +1 -0
- package/dist/{utils/spawn.js → spawn.js} +3 -73
- package/dist/storage/export.d.ts +0 -1
- package/dist/storage/export.js +0 -1
- package/dist/update.d.ts +0 -75
- package/dist/update.js +7 -100
- package/dist/utils/export.d.ts +1 -13
- package/dist/utils/export.js +1 -13
- package/dist/workerGlobalPrefix.d.ts +0 -24
- package/dist/workerGlobalPrefix.js +6 -40
- package/dist/workerTypes.d.ts +0 -25
- package/dist/workerTypes.js +0 -24
- package/dist/workers.d.ts +0 -61
- package/dist/workers.js +4 -68
- package/npm-shrinkwrap.json +80 -50
- package/package.json +8 -8
- package/dist/broadcastServer.d.ts.map +0 -1
- package/dist/broadcastServer.js.map +0 -1
- package/dist/broadcastServerTypes.d.ts.map +0 -1
- package/dist/broadcastServerTypes.js.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/cliEmitter.d.ts.map +0 -1
- package/dist/cliEmitter.js.map +0 -1
- package/dist/cliHistory.d.ts.map +0 -1
- package/dist/cliHistory.js.map +0 -1
- package/dist/clusters/export.d.ts.map +0 -1
- package/dist/clusters/export.js.map +0 -1
- package/dist/deviceManager.d.ts.map +0 -1
- package/dist/deviceManager.js.map +0 -1
- package/dist/devices/airConditioner.d.ts.map +0 -1
- package/dist/devices/airConditioner.js.map +0 -1
- package/dist/devices/batteryStorage.d.ts.map +0 -1
- package/dist/devices/batteryStorage.js.map +0 -1
- package/dist/devices/cooktop.d.ts.map +0 -1
- package/dist/devices/cooktop.js.map +0 -1
- package/dist/devices/dishwasher.d.ts.map +0 -1
- package/dist/devices/dishwasher.js.map +0 -1
- package/dist/devices/evse.d.ts.map +0 -1
- package/dist/devices/evse.js.map +0 -1
- package/dist/devices/export.d.ts.map +0 -1
- package/dist/devices/export.js.map +0 -1
- package/dist/devices/extractorHood.d.ts.map +0 -1
- package/dist/devices/extractorHood.js.map +0 -1
- package/dist/devices/heatPump.d.ts.map +0 -1
- package/dist/devices/heatPump.js.map +0 -1
- package/dist/devices/laundryDryer.d.ts.map +0 -1
- package/dist/devices/laundryDryer.js.map +0 -1
- package/dist/devices/laundryWasher.d.ts.map +0 -1
- package/dist/devices/laundryWasher.js.map +0 -1
- package/dist/devices/microwaveOven.d.ts.map +0 -1
- package/dist/devices/microwaveOven.js.map +0 -1
- package/dist/devices/oven.d.ts.map +0 -1
- package/dist/devices/oven.js.map +0 -1
- package/dist/devices/refrigerator.d.ts.map +0 -1
- package/dist/devices/refrigerator.js.map +0 -1
- package/dist/devices/roboticVacuumCleaner.d.ts.map +0 -1
- package/dist/devices/roboticVacuumCleaner.js.map +0 -1
- package/dist/devices/solarPower.d.ts.map +0 -1
- package/dist/devices/solarPower.js.map +0 -1
- package/dist/devices/speaker.d.ts.map +0 -1
- package/dist/devices/speaker.js.map +0 -1
- package/dist/devices/temperatureControl.d.ts.map +0 -1
- package/dist/devices/temperatureControl.js.map +0 -1
- package/dist/devices/waterHeater.d.ts.map +0 -1
- package/dist/devices/waterHeater.js.map +0 -1
- package/dist/dgram/coap.d.ts +0 -205
- package/dist/dgram/coap.d.ts.map +0 -1
- package/dist/dgram/coap.js +0 -365
- package/dist/dgram/coap.js.map +0 -1
- package/dist/dgram/dgram.d.ts +0 -144
- package/dist/dgram/dgram.d.ts.map +0 -1
- package/dist/dgram/dgram.js +0 -363
- package/dist/dgram/dgram.js.map +0 -1
- package/dist/dgram/mb_coap.d.ts +0 -24
- package/dist/dgram/mb_coap.d.ts.map +0 -1
- package/dist/dgram/mb_coap.js.map +0 -1
- package/dist/dgram/mb_mdns.d.ts +0 -24
- package/dist/dgram/mb_mdns.d.ts.map +0 -1
- package/dist/dgram/mb_mdns.js.map +0 -1
- package/dist/dgram/mdns.d.ts +0 -371
- package/dist/dgram/mdns.d.ts.map +0 -1
- package/dist/dgram/mdns.js +0 -934
- package/dist/dgram/mdns.js.map +0 -1
- package/dist/dgram/multicast.d.ts +0 -67
- package/dist/dgram/multicast.d.ts.map +0 -1
- package/dist/dgram/multicast.js +0 -179
- package/dist/dgram/multicast.js.map +0 -1
- package/dist/dgram/unicast.d.ts +0 -64
- package/dist/dgram/unicast.d.ts.map +0 -1
- package/dist/dgram/unicast.js +0 -100
- package/dist/dgram/unicast.js.map +0 -1
- package/dist/frontend.d.ts.map +0 -1
- package/dist/frontend.js.map +0 -1
- package/dist/frontendTypes.d.ts.map +0 -1
- package/dist/frontendTypes.js.map +0 -1
- package/dist/helpers.d.ts.map +0 -1
- package/dist/helpers.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/jestutils/export.d.ts.map +0 -1
- package/dist/jestutils/export.js.map +0 -1
- package/dist/jestutils/jestHelpers.d.ts.map +0 -1
- package/dist/jestutils/jestHelpers.js.map +0 -1
- package/dist/logger/export.d.ts.map +0 -1
- package/dist/logger/export.js.map +0 -1
- package/dist/matter/behaviors.d.ts.map +0 -1
- package/dist/matter/behaviors.js.map +0 -1
- package/dist/matter/clusters.d.ts.map +0 -1
- package/dist/matter/clusters.js.map +0 -1
- package/dist/matter/devices.d.ts.map +0 -1
- package/dist/matter/devices.js.map +0 -1
- package/dist/matter/endpoints.d.ts.map +0 -1
- package/dist/matter/endpoints.js.map +0 -1
- package/dist/matter/export.d.ts.map +0 -1
- package/dist/matter/export.js.map +0 -1
- package/dist/matter/types.d.ts.map +0 -1
- package/dist/matter/types.js.map +0 -1
- package/dist/matterNode.d.ts.map +0 -1
- package/dist/matterNode.js.map +0 -1
- package/dist/matterbridge.d.ts.map +0 -1
- package/dist/matterbridge.js.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
- package/dist/matterbridgeBehaviors.d.ts.map +0 -1
- package/dist/matterbridgeBehaviors.js.map +0 -1
- package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
- package/dist/matterbridgeDeviceTypes.js.map +0 -1
- package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
- package/dist/matterbridgeDynamicPlatform.js.map +0 -1
- package/dist/matterbridgeEndpoint.d.ts.map +0 -1
- package/dist/matterbridgeEndpoint.js.map +0 -1
- package/dist/matterbridgeEndpointHelpers.d.ts.map +0 -1
- package/dist/matterbridgeEndpointHelpers.js.map +0 -1
- package/dist/matterbridgeEndpointTypes.d.ts.map +0 -1
- package/dist/matterbridgeEndpointTypes.js.map +0 -1
- package/dist/matterbridgePlatform.d.ts.map +0 -1
- package/dist/matterbridgePlatform.js.map +0 -1
- package/dist/matterbridgeTypes.d.ts.map +0 -1
- package/dist/matterbridgeTypes.js.map +0 -1
- package/dist/pluginManager.d.ts.map +0 -1
- package/dist/pluginManager.js.map +0 -1
- package/dist/shelly.d.ts.map +0 -1
- package/dist/shelly.js.map +0 -1
- package/dist/storage/export.d.ts.map +0 -1
- package/dist/storage/export.js.map +0 -1
- package/dist/update.d.ts.map +0 -1
- package/dist/update.js.map +0 -1
- package/dist/utils/colorUtils.d.ts +0 -101
- package/dist/utils/colorUtils.d.ts.map +0 -1
- package/dist/utils/colorUtils.js +0 -282
- package/dist/utils/colorUtils.js.map +0 -1
- package/dist/utils/commandLine.d.ts +0 -66
- package/dist/utils/commandLine.d.ts.map +0 -1
- package/dist/utils/commandLine.js +0 -123
- package/dist/utils/commandLine.js.map +0 -1
- package/dist/utils/copyDirectory.d.ts +0 -35
- package/dist/utils/copyDirectory.d.ts.map +0 -1
- package/dist/utils/copyDirectory.js +0 -76
- package/dist/utils/copyDirectory.js.map +0 -1
- package/dist/utils/createDirectory.d.ts +0 -34
- package/dist/utils/createDirectory.d.ts.map +0 -1
- package/dist/utils/createDirectory.js +0 -54
- package/dist/utils/createDirectory.js.map +0 -1
- package/dist/utils/createZip.d.ts +0 -39
- package/dist/utils/createZip.d.ts.map +0 -1
- package/dist/utils/createZip.js +0 -114
- package/dist/utils/createZip.js.map +0 -1
- package/dist/utils/deepCopy.d.ts +0 -32
- package/dist/utils/deepCopy.d.ts.map +0 -1
- package/dist/utils/deepCopy.js +0 -79
- package/dist/utils/deepCopy.js.map +0 -1
- package/dist/utils/deepEqual.d.ts +0 -54
- package/dist/utils/deepEqual.d.ts.map +0 -1
- package/dist/utils/deepEqual.js +0 -129
- package/dist/utils/deepEqual.js.map +0 -1
- package/dist/utils/error.d.ts +0 -45
- package/dist/utils/error.d.ts.map +0 -1
- package/dist/utils/error.js +0 -54
- package/dist/utils/error.js.map +0 -1
- package/dist/utils/export.d.ts.map +0 -1
- package/dist/utils/export.js.map +0 -1
- package/dist/utils/format.d.ts +0 -53
- package/dist/utils/format.d.ts.map +0 -1
- package/dist/utils/format.js +0 -78
- package/dist/utils/format.js.map +0 -1
- package/dist/utils/hex.d.ts +0 -89
- package/dist/utils/hex.d.ts.map +0 -1
- package/dist/utils/hex.js +0 -242
- package/dist/utils/hex.js.map +0 -1
- package/dist/utils/inspector.d.ts +0 -87
- package/dist/utils/inspector.d.ts.map +0 -1
- package/dist/utils/inspector.js +0 -268
- package/dist/utils/inspector.js.map +0 -1
- package/dist/utils/isValid.d.ts +0 -103
- package/dist/utils/isValid.d.ts.map +0 -1
- package/dist/utils/isValid.js +0 -162
- package/dist/utils/isValid.js.map +0 -1
- package/dist/utils/network.d.ts +0 -141
- package/dist/utils/network.d.ts.map +0 -1
- package/dist/utils/network.js +0 -314
- package/dist/utils/network.js.map +0 -1
- package/dist/utils/spawn.d.ts +0 -33
- package/dist/utils/spawn.d.ts.map +0 -1
- package/dist/utils/spawn.js.map +0 -1
- package/dist/utils/tracker.d.ts +0 -108
- package/dist/utils/tracker.d.ts.map +0 -1
- package/dist/utils/tracker.js +0 -264
- package/dist/utils/tracker.js.map +0 -1
- package/dist/utils/wait.d.ts +0 -54
- package/dist/utils/wait.d.ts.map +0 -1
- package/dist/utils/wait.js +0 -125
- package/dist/utils/wait.js.map +0 -1
- package/dist/workerGlobalPrefix.d.ts.map +0 -1
- package/dist/workerGlobalPrefix.js.map +0 -1
- package/dist/workerTypes.d.ts.map +0 -1
- package/dist/workerTypes.js.map +0 -1
- package/dist/workers.d.ts.map +0 -1
- package/dist/workers.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -28,6 +28,24 @@ Advantages:
|
|
|
28
28
|
- individual plugin isolation in childbridge mode;
|
|
29
29
|
- ability to update the plugin in childbridge mode without restarting matterbridge;
|
|
30
30
|
|
|
31
|
+
## [3.5.1] - Dev branch
|
|
32
|
+
|
|
33
|
+
### Added
|
|
34
|
+
|
|
35
|
+
- [mb_mdns]: Added additional mDNS service types for discovery.
|
|
36
|
+
- [workflows]: Added npm registry URL and caching to Node.js setup in workflow files.
|
|
37
|
+
- [workflows]: Added concurrency settings in build.yml to cancel previous runs in GitHub Actions.
|
|
38
|
+
- [preset]: Added Thermostat with preset feature. Thanks Ludovic BOUÉ (https://github.com/Luligu/matterbridge/pull/482).
|
|
39
|
+
- [matter.js]: Bump to matter.j v. 0.16.6.
|
|
40
|
+
- [mb_mdns]: Added --ip-filter params to filter incoming mDns messages by sender ip.
|
|
41
|
+
- [express]: Added a login check for internal express api. Now only /health and /memory are opened. Thanks Rogibaer (https://github.com/Luligu/matterbridge-hass/issues/149).
|
|
42
|
+
|
|
43
|
+
### Changed
|
|
44
|
+
|
|
45
|
+
- [package]: Updated dependencies.
|
|
46
|
+
|
|
47
|
+
<a href="https://www.buymeacoffee.com/luligugithub"><img src="https://matterbridge.io/assets/bmc-button.svg" alt="Buy me a coffee" width="80"></a>
|
|
48
|
+
|
|
31
49
|
## [3.5.0] - 2026-01-20
|
|
32
50
|
|
|
33
51
|
### Breaking Changes
|
package/README-DOCKER.md
CHANGED
|
@@ -18,12 +18,14 @@
|
|
|
18
18
|
|
|
19
19
|
## Run matterbridge with docker and docker compose
|
|
20
20
|
|
|
21
|
-
The Matterbridge Docker image, which includes a manifest list for the linux/amd64
|
|
21
|
+
The Matterbridge Docker image, which includes a manifest list for the linux/amd64 and linux/arm64 architectures, is published on [**Docker Hub**](https://hub.docker.com/r/luligu/matterbridge).
|
|
22
22
|
|
|
23
23
|
The image (tag **latest**) includes matterbridge and all official plugins with the latest release (as published on npm). You can just pull the new image and matterbridge with all plugins will be the latest release published on npm.
|
|
24
24
|
|
|
25
25
|
The image (tag **dev**) includes matterbridge and all plugins with the dev release (as pushed on GitHub). You can just pull the new image and matterbridge with all plugins will be the latest dev release pushed on GitHub. It is possible that the devs are outdated by published latests.
|
|
26
26
|
|
|
27
|
+
For development and testing see also the [Development Images](README-DOCKER.md#development-images).
|
|
28
|
+
|
|
27
29
|
You can directly select and add a plugin without installing it.
|
|
28
30
|
|
|
29
31
|
It is based on node:22-bookworm-slim and integrates the health check.
|
|
@@ -240,6 +242,6 @@ sudo systemctl restart docker
|
|
|
240
242
|
|
|
241
243
|
On [**Docker Hub**](https://hub.docker.com/r/luligu/matterbridge) are also published **for test and development** the Matterbridge ubuntu and alpine images, which include a manifest list for the linux/amd64, linux/arm64 architectures and are based on node 24.x.
|
|
242
244
|
|
|
243
|
-
The image (tag **ubuntu**) includes only matterbridge with the latest release (as published on npm). The plugins are not included in the image but they will be reinstalled on the first run.
|
|
245
|
+
The image (tag **ubuntu**) includes only matterbridge with the latest release (as published on npm). The plugins are not included in the image but they will be reinstalled on the first run. This image has preinstalled bluetooth essentials and python (it can be used with plugins that require bluetooth, build-essential and python).
|
|
244
246
|
|
|
245
247
|
The image (tag **alpine**) includes only matterbridge with the latest release (as published on npm). The plugins are not included in the image but they will be reinstalled on the first run.
|
package/README.md
CHANGED
|
@@ -72,11 +72,14 @@ https://blog.adafruit.com/2025/11/03/matterbridge-a-matter-plugin-manager/
|
|
|
72
72
|
To run Matterbridge, you need either a [Node.js](https://nodejs.org/en) environment or [Docker](https://docs.docker.com/get-started/get-docker/) installed on your system.
|
|
73
73
|
|
|
74
74
|
If you don't have Node.js already install, please use this method to install it on a debian device: https://github.com/nodesource/distributions.
|
|
75
|
-
The supported versions of node are 20 and
|
|
75
|
+
The supported versions of node are 20, 22 and 24. Please install Node.js 22 LTS. Don't use Node.js Current but always the Node.js LTS.
|
|
76
76
|
Node.js 23, like all odd-numbered versions, is not supported.
|
|
77
77
|
Nvm is not a good choice and should not be used for production.
|
|
78
78
|
|
|
79
79
|
If you don't have Docker already install, please use this method to install it on a debian device: https://docs.docker.com/engine/install.
|
|
80
|
+
|
|
81
|
+
If you don't have Docker already install, please use this method to install it on a Windows or macOS: https://docs.docker.com/get-started/introduction/get-docker-desktop/.
|
|
82
|
+
|
|
80
83
|
After follow the guidelines for the [Docker configurations](README-DOCKER.md).
|
|
81
84
|
|
|
82
85
|
I suggest using Docker for its simplicity.
|
package/bin/mb_coap.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import('../dist/
|
|
2
|
+
import('../dist/mb_coap.js');
|
package/bin/mb_mdns.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import('../dist/
|
|
2
|
+
import('../dist/mb_mdns.js');
|
|
@@ -1,35 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file contains the BroadcastServer class.
|
|
3
|
-
*
|
|
4
|
-
* @file broadcastServer.ts
|
|
5
|
-
* @author Luca Liguori
|
|
6
|
-
* @created 2025-10-05
|
|
7
|
-
* @version 2.0.1
|
|
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
1
|
import { EventEmitter } from 'node:events';
|
|
25
2
|
import { type AnsiLogger } from 'node-ansi-logger';
|
|
26
3
|
import type { WorkerMessage, WorkerMessageRequest, WorkerMessageRequestAny, WorkerMessageResponse, WorkerMessageResponseSuccess, WorkerMessageTypes, WorkerSrcType } from './broadcastServerTypes.js';
|
|
27
4
|
interface BroadcastServerEvents {
|
|
28
5
|
'broadcast_message': [msg: WorkerMessage];
|
|
29
6
|
}
|
|
30
|
-
/**
|
|
31
|
-
* BroadcastServer class to handle broadcast messages between workers with BroadcastChannel.
|
|
32
|
-
*/
|
|
33
7
|
export declare class BroadcastServer extends EventEmitter<BroadcastServerEvents> {
|
|
34
8
|
readonly name: WorkerSrcType;
|
|
35
9
|
private readonly log;
|
|
@@ -38,107 +12,18 @@ export declare class BroadcastServer extends EventEmitter<BroadcastServerEvents>
|
|
|
38
12
|
private closed;
|
|
39
13
|
private readonly debug;
|
|
40
14
|
private readonly verbose;
|
|
41
|
-
/**
|
|
42
|
-
* Creates an instance of BroadcastServer.
|
|
43
|
-
*
|
|
44
|
-
* @param {string} name - The name of the broadcast server.
|
|
45
|
-
* @param {AnsiLogger} log - The logger instance to use for logging.
|
|
46
|
-
* @param {string} channel - The channel name for the broadcast. Default is 'broadcast-channel'.
|
|
47
|
-
*/
|
|
48
15
|
constructor(name: WorkerSrcType, log: AnsiLogger, channel?: string);
|
|
49
|
-
/**
|
|
50
|
-
* Closes the broadcast channel.
|
|
51
|
-
*
|
|
52
|
-
* @returns {void}
|
|
53
|
-
*/
|
|
54
16
|
close(): void;
|
|
55
|
-
/**
|
|
56
|
-
* Handles incoming broadcast messages.
|
|
57
|
-
*
|
|
58
|
-
* @param {MessageEvent} event - The message event containing the broadcast message.
|
|
59
|
-
* @returns {void}
|
|
60
|
-
*/
|
|
61
17
|
private broadcastMessageHandler;
|
|
62
|
-
/**
|
|
63
|
-
* Handles incoming broadcast error messages.
|
|
64
|
-
*
|
|
65
|
-
* @param {MessageEvent} event - The message event containing the broadcast message.
|
|
66
|
-
* @returns {void}
|
|
67
|
-
*/
|
|
68
18
|
private broadcastMessageErrorHandler;
|
|
69
|
-
/**
|
|
70
|
-
* Generate a pseudo-random identifier between 100,000,000 and 999,999,999.
|
|
71
|
-
*
|
|
72
|
-
* @returns {number} A nine-digit identifier.
|
|
73
|
-
*/
|
|
74
19
|
getUniqueId(): number;
|
|
75
|
-
/**
|
|
76
|
-
* Type guard to verify a value matches the WorkerMessageRequest structure.
|
|
77
|
-
*
|
|
78
|
-
* @param {unknown} value Value to test.
|
|
79
|
-
* @returns {value is WorkerMessageRequest} True when the value looks like a request message.
|
|
80
|
-
*/
|
|
81
20
|
isWorkerRequest(value: unknown): value is WorkerMessageRequest;
|
|
82
|
-
/**
|
|
83
|
-
* Type guard to verify a value matches a specific WorkerMessageRequest structure.
|
|
84
|
-
*
|
|
85
|
-
* @param {unknown} value Value to test.
|
|
86
|
-
* @param {K} type Worker message type to match.
|
|
87
|
-
* @returns {value is WorkerMessageRequest<K>} True when the value looks like a request message of the requested type.
|
|
88
|
-
*/
|
|
89
21
|
isWorkerRequestOfType<K extends keyof WorkerMessageTypes>(value: unknown, type: K): value is WorkerMessageRequest<K>;
|
|
90
|
-
/**
|
|
91
|
-
* Type guard to verify a value matches the WorkerMessageResponse structure.
|
|
92
|
-
*
|
|
93
|
-
* @param {unknown} value Value to test.
|
|
94
|
-
* @returns {value is WorkerMessageResponse} True when the value looks like a response message.
|
|
95
|
-
*/
|
|
96
22
|
isWorkerResponse(value: unknown): value is WorkerMessageResponse;
|
|
97
|
-
/**
|
|
98
|
-
* Type guard to verify a value matches a specific WorkerMessageResponse structure.
|
|
99
|
-
*
|
|
100
|
-
* @param {unknown} value Value to test.
|
|
101
|
-
* @param {K} type Worker message type to match.
|
|
102
|
-
* @returns {value is WorkerMessageResponse<K>} True when the value looks like a response message of the requested type.
|
|
103
|
-
*/
|
|
104
23
|
isWorkerResponseOfType<K extends keyof WorkerMessageTypes>(value: unknown, type: K): value is WorkerMessageResponse<K>;
|
|
105
|
-
/**
|
|
106
|
-
* Broadcast a message to all workers.
|
|
107
|
-
*
|
|
108
|
-
* @param {WorkerMessage} message - The message to broadcast.
|
|
109
|
-
* @returns {void}
|
|
110
|
-
*
|
|
111
|
-
* @remarks No checks are performed on the message structure.
|
|
112
|
-
*/
|
|
113
24
|
broadcast(message: WorkerMessage): void;
|
|
114
|
-
/**
|
|
115
|
-
* Send a request message from the worker implementation.
|
|
116
|
-
*
|
|
117
|
-
* @template K
|
|
118
|
-
* @param {WorkerMessageRequest<K>} message The request message to send.
|
|
119
|
-
* @returns {void}
|
|
120
|
-
*/
|
|
121
25
|
request<K extends keyof WorkerMessageTypes>(message: WorkerMessageRequest<K>): void;
|
|
122
|
-
/**
|
|
123
|
-
* Send a response message from the worker implementation.
|
|
124
|
-
* It also calculates the elapsed time since the request was sent and swaps the source and destination fields.
|
|
125
|
-
*
|
|
126
|
-
* @template K
|
|
127
|
-
* @param {WorkerMessageResponse<K>} message The response message to send.
|
|
128
|
-
* @returns {void}
|
|
129
|
-
*/
|
|
130
26
|
respond<K extends keyof WorkerMessageTypes>(message: WorkerMessageResponse<K>): void;
|
|
131
|
-
/**
|
|
132
|
-
* Fetch data from a worker.
|
|
133
|
-
* It broadcasts a request message and waits for a valid response with the same id.
|
|
134
|
-
*
|
|
135
|
-
* @template K
|
|
136
|
-
* @param {WorkerMessageRequest<K>} message - The typed request message to fetch.
|
|
137
|
-
* @param {number} timeout - The timeout in milliseconds to wait for a response. Default is 250ms.
|
|
138
|
-
* @returns {Promise<WorkerMessageResponseSuccess<K>>} A promise that resolves with the successful response from the worker or rejects on timeout.
|
|
139
|
-
* @throws {Error} If the fetch operation times out after 250ms or if an error response is received or if the response is malformed.
|
|
140
|
-
*/
|
|
141
27
|
fetch<T extends WorkerMessageRequestAny, K extends Extract<keyof WorkerMessageTypes, T['type']>>(message: T, timeout?: number): Promise<WorkerMessageResponseSuccess<K>>;
|
|
142
28
|
}
|
|
143
29
|
export {};
|
|
144
|
-
//# sourceMappingURL=broadcastServer.d.ts.map
|
package/dist/broadcastServer.js
CHANGED
|
@@ -1,37 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file contains the BroadcastServer class.
|
|
3
|
-
*
|
|
4
|
-
* @file broadcastServer.ts
|
|
5
|
-
* @author Luca Liguori
|
|
6
|
-
* @created 2025-10-05
|
|
7
|
-
* @version 2.0.1
|
|
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
|
-
// eslint-disable-next-line no-console
|
|
25
1
|
if (process.argv.includes('--loader') || process.argv.includes('-loader'))
|
|
26
2
|
console.log('\u001B[32mBroadcastServer loaded.\u001B[40;0m');
|
|
27
3
|
import { EventEmitter } from 'node:events';
|
|
28
4
|
import { BroadcastChannel } from 'node:worker_threads';
|
|
29
5
|
import { CYAN, db, debugStringify, er } from 'node-ansi-logger';
|
|
30
|
-
import { hasParameter } from '
|
|
31
|
-
import { logError } from './utils/error.js';
|
|
32
|
-
/**
|
|
33
|
-
* BroadcastServer class to handle broadcast messages between workers with BroadcastChannel.
|
|
34
|
-
*/
|
|
6
|
+
import { hasParameter, logError } from '@matterbridge/utils';
|
|
35
7
|
export class BroadcastServer extends EventEmitter {
|
|
36
8
|
name;
|
|
37
9
|
log;
|
|
@@ -40,40 +12,21 @@ export class BroadcastServer extends EventEmitter {
|
|
|
40
12
|
closed = false;
|
|
41
13
|
debug = hasParameter('debug') || hasParameter('verbose');
|
|
42
14
|
verbose = hasParameter('verbose');
|
|
43
|
-
/**
|
|
44
|
-
* Creates an instance of BroadcastServer.
|
|
45
|
-
*
|
|
46
|
-
* @param {string} name - The name of the broadcast server.
|
|
47
|
-
* @param {AnsiLogger} log - The logger instance to use for logging.
|
|
48
|
-
* @param {string} channel - The channel name for the broadcast. Default is 'broadcast-channel'.
|
|
49
|
-
*/
|
|
50
15
|
constructor(name, log, channel = 'broadcast-channel') {
|
|
51
16
|
super();
|
|
52
17
|
this.name = name;
|
|
53
18
|
this.log = log;
|
|
54
19
|
this.channel = channel;
|
|
55
20
|
this.broadcastChannel = new BroadcastChannel(this.channel);
|
|
56
|
-
// this.broadcastChannel.unref();
|
|
57
21
|
this.broadcastChannel.onmessage = this.broadcastMessageHandler.bind(this);
|
|
58
22
|
this.broadcastChannel.onmessageerror = this.broadcastMessageErrorHandler.bind(this);
|
|
59
23
|
}
|
|
60
|
-
/**
|
|
61
|
-
* Closes the broadcast channel.
|
|
62
|
-
*
|
|
63
|
-
* @returns {void}
|
|
64
|
-
*/
|
|
65
24
|
close() {
|
|
66
25
|
this.broadcastChannel.onmessage = null;
|
|
67
26
|
this.broadcastChannel.onmessageerror = null;
|
|
68
27
|
this.broadcastChannel.close();
|
|
69
28
|
this.closed = true;
|
|
70
29
|
}
|
|
71
|
-
/**
|
|
72
|
-
* Handles incoming broadcast messages.
|
|
73
|
-
*
|
|
74
|
-
* @param {MessageEvent} event - The message event containing the broadcast message.
|
|
75
|
-
* @returns {void}
|
|
76
|
-
*/
|
|
77
30
|
broadcastMessageHandler(event) {
|
|
78
31
|
const msg = event.data;
|
|
79
32
|
if (msg.dst === this.name || msg.dst === 'all') {
|
|
@@ -86,30 +39,13 @@ export class BroadcastServer extends EventEmitter {
|
|
|
86
39
|
this.log.debug(`Server ${CYAN}${this.name}${db} received unrelated broadcast message: ${debugStringify(msg)}`);
|
|
87
40
|
}
|
|
88
41
|
}
|
|
89
|
-
/**
|
|
90
|
-
* Handles incoming broadcast error messages.
|
|
91
|
-
*
|
|
92
|
-
* @param {MessageEvent} event - The message event containing the broadcast message.
|
|
93
|
-
* @returns {void}
|
|
94
|
-
*/
|
|
95
42
|
broadcastMessageErrorHandler(event) {
|
|
96
43
|
const msg = event.data;
|
|
97
44
|
this.log.error(`Server ${CYAN}${this.name}${db} received message error: ${debugStringify(msg)}`);
|
|
98
45
|
}
|
|
99
|
-
/**
|
|
100
|
-
* Generate a pseudo-random identifier between 100,000,000 and 999,999,999.
|
|
101
|
-
*
|
|
102
|
-
* @returns {number} A nine-digit identifier.
|
|
103
|
-
*/
|
|
104
46
|
getUniqueId() {
|
|
105
47
|
return Math.floor(Math.random() * 900000000) + 100000000;
|
|
106
48
|
}
|
|
107
|
-
/**
|
|
108
|
-
* Type guard to verify a value matches the WorkerMessageRequest structure.
|
|
109
|
-
*
|
|
110
|
-
* @param {unknown} value Value to test.
|
|
111
|
-
* @returns {value is WorkerMessageRequest} True when the value looks like a request message.
|
|
112
|
-
*/
|
|
113
49
|
isWorkerRequest(value) {
|
|
114
50
|
if (typeof value !== 'object' || value === null) {
|
|
115
51
|
return false;
|
|
@@ -120,22 +56,9 @@ export class BroadcastServer extends EventEmitter {
|
|
|
120
56
|
}
|
|
121
57
|
return message.result === undefined && message.error === undefined;
|
|
122
58
|
}
|
|
123
|
-
/**
|
|
124
|
-
* Type guard to verify a value matches a specific WorkerMessageRequest structure.
|
|
125
|
-
*
|
|
126
|
-
* @param {unknown} value Value to test.
|
|
127
|
-
* @param {K} type Worker message type to match.
|
|
128
|
-
* @returns {value is WorkerMessageRequest<K>} True when the value looks like a request message of the requested type.
|
|
129
|
-
*/
|
|
130
59
|
isWorkerRequestOfType(value, type) {
|
|
131
60
|
return this.isWorkerRequest(value) && value.type === type;
|
|
132
61
|
}
|
|
133
|
-
/**
|
|
134
|
-
* Type guard to verify a value matches the WorkerMessageResponse structure.
|
|
135
|
-
*
|
|
136
|
-
* @param {unknown} value Value to test.
|
|
137
|
-
* @returns {value is WorkerMessageResponse} True when the value looks like a response message.
|
|
138
|
-
*/
|
|
139
62
|
isWorkerResponse(value) {
|
|
140
63
|
if (typeof value !== 'object' || value === null) {
|
|
141
64
|
return false;
|
|
@@ -148,24 +71,9 @@ export class BroadcastServer extends EventEmitter {
|
|
|
148
71
|
const hasResult = message.result !== undefined;
|
|
149
72
|
return hasError !== hasResult;
|
|
150
73
|
}
|
|
151
|
-
/**
|
|
152
|
-
* Type guard to verify a value matches a specific WorkerMessageResponse structure.
|
|
153
|
-
*
|
|
154
|
-
* @param {unknown} value Value to test.
|
|
155
|
-
* @param {K} type Worker message type to match.
|
|
156
|
-
* @returns {value is WorkerMessageResponse<K>} True when the value looks like a response message of the requested type.
|
|
157
|
-
*/
|
|
158
74
|
isWorkerResponseOfType(value, type) {
|
|
159
75
|
return this.isWorkerResponse(value) && value.type === type;
|
|
160
76
|
}
|
|
161
|
-
/**
|
|
162
|
-
* Broadcast a message to all workers.
|
|
163
|
-
*
|
|
164
|
-
* @param {WorkerMessage} message - The message to broadcast.
|
|
165
|
-
* @returns {void}
|
|
166
|
-
*
|
|
167
|
-
* @remarks No checks are performed on the message structure.
|
|
168
|
-
*/
|
|
169
77
|
broadcast(message) {
|
|
170
78
|
if (this.closed) {
|
|
171
79
|
this.log.error('Broadcast channel is closed');
|
|
@@ -187,13 +95,6 @@ export class BroadcastServer extends EventEmitter {
|
|
|
187
95
|
logError(this.log, `Failed to broadcast message ${debugStringify(message)}${er}`, error);
|
|
188
96
|
}
|
|
189
97
|
}
|
|
190
|
-
/**
|
|
191
|
-
* Send a request message from the worker implementation.
|
|
192
|
-
*
|
|
193
|
-
* @template K
|
|
194
|
-
* @param {WorkerMessageRequest<K>} message The request message to send.
|
|
195
|
-
* @returns {void}
|
|
196
|
-
*/
|
|
197
98
|
request(message) {
|
|
198
99
|
if (this.closed) {
|
|
199
100
|
this.log.error('Broadcast channel is closed');
|
|
@@ -219,14 +120,6 @@ export class BroadcastServer extends EventEmitter {
|
|
|
219
120
|
logError(this.log, `Failed to broadcast request message ${debugStringify(message)}${er}`, error);
|
|
220
121
|
}
|
|
221
122
|
}
|
|
222
|
-
/**
|
|
223
|
-
* Send a response message from the worker implementation.
|
|
224
|
-
* It also calculates the elapsed time since the request was sent and swaps the source and destination fields.
|
|
225
|
-
*
|
|
226
|
-
* @template K
|
|
227
|
-
* @param {WorkerMessageResponse<K>} message The response message to send.
|
|
228
|
-
* @returns {void}
|
|
229
|
-
*/
|
|
230
123
|
respond(message) {
|
|
231
124
|
if (this.closed) {
|
|
232
125
|
this.log.error('Broadcast channel is closed');
|
|
@@ -255,16 +148,6 @@ export class BroadcastServer extends EventEmitter {
|
|
|
255
148
|
logError(this.log, `Failed to broadcast response message ${debugStringify(message)}${er}`, error);
|
|
256
149
|
}
|
|
257
150
|
}
|
|
258
|
-
/**
|
|
259
|
-
* Fetch data from a worker.
|
|
260
|
-
* It broadcasts a request message and waits for a valid response with the same id.
|
|
261
|
-
*
|
|
262
|
-
* @template K
|
|
263
|
-
* @param {WorkerMessageRequest<K>} message - The typed request message to fetch.
|
|
264
|
-
* @param {number} timeout - The timeout in milliseconds to wait for a response. Default is 250ms.
|
|
265
|
-
* @returns {Promise<WorkerMessageResponseSuccess<K>>} A promise that resolves with the successful response from the worker or rejects on timeout.
|
|
266
|
-
* @throws {Error} If the fetch operation times out after 250ms or if an error response is received or if the response is malformed.
|
|
267
|
-
*/
|
|
268
151
|
async fetch(message, timeout = 250) {
|
|
269
152
|
if (this.closed) {
|
|
270
153
|
return Promise.reject(new Error('Broadcast channel is closed'));
|
|
@@ -305,4 +188,3 @@ export class BroadcastServer extends EventEmitter {
|
|
|
305
188
|
});
|
|
306
189
|
}
|
|
307
190
|
}
|
|
308
|
-
//# sourceMappingURL=broadcastServer.js.map
|
|
@@ -1,36 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file contains the BroadcastServer types.
|
|
3
|
-
*
|
|
4
|
-
* @file broadcastServerTypes.ts
|
|
5
|
-
* @author Luca Liguori
|
|
6
|
-
* @created 2025-10-05
|
|
7
|
-
* @version 2.0.0
|
|
8
|
-
* @license Apache-2.0
|
|
9
|
-
*
|
|
10
|
-
* Copyright 2025, 2026, 2027 Luca Liguori.
|
|
11
|
-
*
|
|
12
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
-
* you may not use this file except in compliance with the License.
|
|
14
|
-
* You may obtain a copy of the License at
|
|
15
|
-
*
|
|
16
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
*
|
|
18
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
-
* See the License for the specific language governing permissions and
|
|
22
|
-
* limitations under the License.
|
|
23
|
-
*/
|
|
24
1
|
import { LogLevel } from 'node-ansi-logger';
|
|
25
2
|
import { EndpointNumber } from '@matter/types/datatype';
|
|
26
3
|
import { RefreshRequiredChanged, WsMessageBroadcast } from './frontendTypes.js';
|
|
27
4
|
import type { PlatformConfig, PlatformSchema } from './matterbridgePlatform.js';
|
|
28
5
|
import type { ApiMatter, ApiPlugin, BaseDevice, Plugin, StoragePlugin } from './matterbridgeTypes.js';
|
|
29
|
-
/** Types of worker source */
|
|
30
6
|
export type WorkerSrcType = 'manager' | 'matterbridge' | 'plugins' | 'devices' | 'frontend' | 'matter' | 'platform' | 'spawn' | 'updates';
|
|
31
|
-
/** Types of worker destination */
|
|
32
7
|
export type WorkerDstType = 'manager' | 'matterbridge' | 'plugins' | 'devices' | 'frontend' | 'matter' | 'platform' | 'spawn' | 'updates' | 'all';
|
|
33
|
-
/** Normalized message request structure */
|
|
34
8
|
type NormalizeRequest<T> = T extends {
|
|
35
9
|
params: infer P;
|
|
36
10
|
} ? ([P] extends [undefined] ? {
|
|
@@ -38,7 +12,6 @@ type NormalizeRequest<T> = T extends {
|
|
|
38
12
|
} : {
|
|
39
13
|
params: P;
|
|
40
14
|
}) : Record<never, never>;
|
|
41
|
-
/** Message request structure with id, timestamp, src and dst */
|
|
42
15
|
type WorkerMessageRequestMap = {
|
|
43
16
|
[K in keyof WorkerMessageTypes]: {
|
|
44
17
|
type: K;
|
|
@@ -48,21 +21,16 @@ type WorkerMessageRequestMap = {
|
|
|
48
21
|
dst: WorkerDstType;
|
|
49
22
|
} & NormalizeRequest<WorkerMessageTypes[K]['request']>;
|
|
50
23
|
};
|
|
51
|
-
/** Message request structure with id, timestamp, src and dst */
|
|
52
24
|
export type WorkerMessageRequest<K extends keyof WorkerMessageTypes = keyof WorkerMessageTypes> = WorkerMessageRequestMap[K];
|
|
53
|
-
/** Normalized message response success structure that guarantees a successful result */
|
|
54
25
|
type NormalizeResponseSuccess<T> = T & {
|
|
55
26
|
error?: never;
|
|
56
27
|
};
|
|
57
|
-
/** Normalized message response error structure that guarantees an error-only payload */
|
|
58
28
|
type NormalizeResponseError<T> = {
|
|
59
29
|
error: string;
|
|
60
30
|
} & {
|
|
61
31
|
[K in keyof T]?: never;
|
|
62
32
|
};
|
|
63
|
-
/** Normalized message response structure */
|
|
64
33
|
type NormalizeResponse<T> = NormalizeResponseSuccess<T> | NormalizeResponseError<T>;
|
|
65
|
-
/** Message response structure with id, timestamp, elapsed, src and dst */
|
|
66
34
|
type WorkerMessageResponseMap = {
|
|
67
35
|
[K in keyof WorkerMessageTypes]: {
|
|
68
36
|
type: K;
|
|
@@ -73,9 +41,7 @@ type WorkerMessageResponseMap = {
|
|
|
73
41
|
dst: WorkerDstType;
|
|
74
42
|
} & NormalizeResponse<WorkerMessageTypes[K]['response']>;
|
|
75
43
|
};
|
|
76
|
-
/** Message response structure with id, timestamp, elapsed, src and dst */
|
|
77
44
|
export type WorkerMessageResponse<K extends keyof WorkerMessageTypes = keyof WorkerMessageTypes> = WorkerMessageResponseMap[K];
|
|
78
|
-
/** Message response success structure that guarantees a successful result */
|
|
79
45
|
type WorkerMessageResponseSuccessMap = {
|
|
80
46
|
[K in keyof WorkerMessageTypes]: {
|
|
81
47
|
type: K;
|
|
@@ -86,9 +52,7 @@ type WorkerMessageResponseSuccessMap = {
|
|
|
86
52
|
dst: WorkerDstType;
|
|
87
53
|
} & NormalizeResponseSuccess<WorkerMessageTypes[K]['response']>;
|
|
88
54
|
};
|
|
89
|
-
/** Message response success structure that guarantees a successful result */
|
|
90
55
|
export type WorkerMessageResponseSuccess<K extends keyof WorkerMessageTypes = keyof WorkerMessageTypes> = WorkerMessageResponseSuccessMap[K];
|
|
91
|
-
/** Message response error structure */
|
|
92
56
|
type WorkerMessageResponseErrorMap = {
|
|
93
57
|
[K in keyof WorkerMessageTypes]: {
|
|
94
58
|
type: K;
|
|
@@ -99,17 +63,11 @@ type WorkerMessageResponseErrorMap = {
|
|
|
99
63
|
dst: WorkerDstType;
|
|
100
64
|
} & NormalizeResponseError<WorkerMessageTypes[K]['response']>;
|
|
101
65
|
};
|
|
102
|
-
/** Message response error structure */
|
|
103
66
|
export type WorkerMessageResponseError<K extends keyof WorkerMessageTypes = keyof WorkerMessageTypes> = WorkerMessageResponseErrorMap[K];
|
|
104
|
-
/** Convenience alias for any worker request */
|
|
105
67
|
export type WorkerMessageRequestAny = WorkerMessageRequest<keyof WorkerMessageTypes>;
|
|
106
|
-
/** Resolve a successful response type based on the originating request */
|
|
107
68
|
export type WorkerMessageResponseSuccessForRequest<T extends WorkerMessageRequestAny> = WorkerMessageResponseSuccess<Extract<keyof WorkerMessageTypes, T['type']>>;
|
|
108
|
-
/** Resolve an error response type based on the originating request */
|
|
109
69
|
export type WorkerMessageResponseErrorForRequest<T extends WorkerMessageRequestAny> = WorkerMessageResponseError<Extract<keyof WorkerMessageTypes, T['type']>>;
|
|
110
|
-
/** Union type for WorkerMessageRequest and WorkerMessageResponse */
|
|
111
70
|
export type WorkerMessage<K extends keyof WorkerMessageTypes = keyof WorkerMessageTypes> = WorkerMessageRequest<K> | WorkerMessageResponse<K> | WorkerMessageResponseSuccess<K> | WorkerMessageResponseError<K>;
|
|
112
|
-
/** Map of all worker message types with their request and response structures */
|
|
113
71
|
export type WorkerMessageTypes = {
|
|
114
72
|
'jest': {
|
|
115
73
|
request: {
|
|
@@ -838,4 +796,3 @@ export type WorkerMessageTypes = {
|
|
|
838
796
|
};
|
|
839
797
|
};
|
|
840
798
|
export {};
|
|
841
|
-
//# sourceMappingURL=broadcastServerTypes.d.ts.map
|
|
@@ -1,25 +1 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file contains the BroadcastServer types.
|
|
3
|
-
*
|
|
4
|
-
* @file broadcastServerTypes.ts
|
|
5
|
-
* @author Luca Liguori
|
|
6
|
-
* @created 2025-10-05
|
|
7
|
-
* @version 2.0.0
|
|
8
|
-
* @license Apache-2.0
|
|
9
|
-
*
|
|
10
|
-
* Copyright 2025, 2026, 2027 Luca Liguori.
|
|
11
|
-
*
|
|
12
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
-
* you may not use this file except in compliance with the License.
|
|
14
|
-
* You may obtain a copy of the License at
|
|
15
|
-
*
|
|
16
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
*
|
|
18
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
-
* See the License for the specific language governing permissions and
|
|
22
|
-
* limitations under the License.
|
|
23
|
-
*/
|
|
24
1
|
export {};
|
|
25
|
-
//# sourceMappingURL=broadcastServerTypes.js.map
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,30 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
* This file contains the CLI entry point of Matterbridge.
|
|
3
|
-
*
|
|
4
|
-
* @file cli.ts
|
|
5
|
-
* @author Luca Liguori
|
|
6
|
-
* @created 2023-12-29
|
|
7
|
-
* @version 3.0.0
|
|
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
|
-
*/
|
|
1
|
+
import { Inspector, Tracker } from '@matterbridge/utils';
|
|
24
2
|
import type { Matterbridge } from './matterbridge.js';
|
|
25
|
-
import { Tracker } from './utils/tracker.js';
|
|
26
|
-
import { Inspector } from './utils/inspector.js';
|
|
27
3
|
export declare let instance: Matterbridge | undefined;
|
|
28
4
|
export declare const tracker: Tracker;
|
|
29
5
|
export declare const inspector: Inspector;
|
|
30
|
-
//# sourceMappingURL=cli.d.ts.map
|