@matterbridge/core 3.7.4-dev-20260414-33cae46 → 3.7.4-dev-20260416-fabcd3f
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/dist/jestutils/jestBroadcastServerSpy.d.ts +12 -0
- package/dist/jestutils/jestBroadcastServerSpy.js +14 -0
- package/dist/jestutils/jestDeviceManagerSpy.d.ts +13 -0
- package/dist/jestutils/jestDeviceManagerSpy.js +15 -0
- package/dist/jestutils/jestFrontendSpy.d.ts +9 -0
- package/dist/jestutils/jestFrontendSpy.js +8 -0
- package/dist/jestutils/jestHelpers.d.ts +7 -39
- package/dist/jestutils/jestHelpers.js +11 -71
- package/dist/jestutils/jestMatterbridgeEndpointSpy.d.ts +6 -0
- package/dist/jestutils/jestMatterbridgeEndpointSpy.js +4 -0
- package/dist/jestutils/jestMatterbridgePlatformSpy.d.ts +60 -0
- package/dist/jestutils/jestMatterbridgePlatformSpy.js +44 -0
- package/dist/jestutils/jestMatterbridgeSpy.d.ts +4 -0
- package/dist/jestutils/jestMatterbridgeSpy.js +6 -0
- package/dist/jestutils/jestPluginManagerSpy.d.ts +47 -0
- package/dist/jestutils/jestPluginManagerSpy.js +41 -0
- package/dist/matterbridge.js +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const closeBroadcastServerSpy: import("jest-mock").SpiedFunction<() => void>;
|
|
2
|
+
export declare const getUniqueIdBroadcastServerSpy: import("jest-mock").SpiedFunction<() => number>;
|
|
3
|
+
export declare const isWorkerRequestBroadcastServerSpy: import("jest-mock").SpiedFunction<(value: unknown) => value is import("@matterbridge/types").WorkerMessageRequest>;
|
|
4
|
+
export declare const isWorkerRequestOfTypeBroadcastServerSpy: import("jest-mock").SpiedFunction<(<K extends keyof import("@matterbridge/types").WorkerMessageTypes>(value: unknown, type: K) => value is import("@matterbridge/types").WorkerMessageRequest<K>)>;
|
|
5
|
+
export declare const isWorkerResponseBroadcastServerSpy: import("jest-mock").SpiedFunction<(value: unknown) => value is import("@matterbridge/types").WorkerMessageResponse>;
|
|
6
|
+
export declare const isWorkerResponseOfTypeBroadcastServerSpy: import("jest-mock").SpiedFunction<(<K extends keyof import("@matterbridge/types").WorkerMessageTypes>(value: unknown, type: K) => value is import("@matterbridge/types").WorkerMessageResponse<K>)>;
|
|
7
|
+
export declare const broadcastBroadcastServerSpy: import("jest-mock").SpiedFunction<(message: import("@matterbridge/types").WorkerMessage) => void>;
|
|
8
|
+
export declare const requestBroadcastServerSpy: import("jest-mock").SpiedFunction<(<K extends keyof import("@matterbridge/types").WorkerMessageTypes>(message: import("@matterbridge/types").WorkerMessageRequest<K>) => void)>;
|
|
9
|
+
export declare const respondBroadcastServerSpy: import("jest-mock").SpiedFunction<(<K extends keyof import("@matterbridge/types").WorkerMessageTypes>(message: import("@matterbridge/types").WorkerMessageResponse<K>) => void)>;
|
|
10
|
+
export declare const fetchBroadcastServerSpy: import("jest-mock").SpiedFunction<(<T extends import("@matterbridge/types").WorkerMessageRequestAny, K extends Extract<keyof import("@matterbridge/types").WorkerMessageTypes, T["type"]>>(message: T, timeout?: number) => Promise<import("@matterbridge/types").WorkerMessageResponseSuccess<K>>)>;
|
|
11
|
+
export declare const broadcastMessageHandlerBroadcastServerSpy: import("jest-mock").SpiedSetter<import("@matterbridge/types").WorkerSrcType> | import("jest-mock").SpiedGetter<import("@matterbridge/types").WorkerSrcType>;
|
|
12
|
+
export declare const broadcastMessageErrorHandlerBroadcastServerSpy: import("jest-mock").SpiedSetter<import("@matterbridge/types").WorkerSrcType> | import("jest-mock").SpiedGetter<import("@matterbridge/types").WorkerSrcType>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jest } from '@jest/globals';
|
|
2
|
+
import { BroadcastServer } from '@matterbridge/thread/server';
|
|
3
|
+
export const closeBroadcastServerSpy = jest.spyOn(BroadcastServer.prototype, 'close');
|
|
4
|
+
export const getUniqueIdBroadcastServerSpy = jest.spyOn(BroadcastServer.prototype, 'getUniqueId');
|
|
5
|
+
export const isWorkerRequestBroadcastServerSpy = jest.spyOn(BroadcastServer.prototype, 'isWorkerRequest');
|
|
6
|
+
export const isWorkerRequestOfTypeBroadcastServerSpy = jest.spyOn(BroadcastServer.prototype, 'isWorkerRequestOfType');
|
|
7
|
+
export const isWorkerResponseBroadcastServerSpy = jest.spyOn(BroadcastServer.prototype, 'isWorkerResponse');
|
|
8
|
+
export const isWorkerResponseOfTypeBroadcastServerSpy = jest.spyOn(BroadcastServer.prototype, 'isWorkerResponseOfType');
|
|
9
|
+
export const broadcastBroadcastServerSpy = jest.spyOn(BroadcastServer.prototype, 'broadcast');
|
|
10
|
+
export const requestBroadcastServerSpy = jest.spyOn(BroadcastServer.prototype, 'request');
|
|
11
|
+
export const respondBroadcastServerSpy = jest.spyOn(BroadcastServer.prototype, 'respond');
|
|
12
|
+
export const fetchBroadcastServerSpy = jest.spyOn(BroadcastServer.prototype, 'fetch');
|
|
13
|
+
export const broadcastMessageHandlerBroadcastServerSpy = jest.spyOn(BroadcastServer.prototype, 'broadcastMessageHandler');
|
|
14
|
+
export const broadcastMessageErrorHandlerBroadcastServerSpy = jest.spyOn(BroadcastServer.prototype, 'broadcastMessageErrorHandler');
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const destroyDeviceManagerSpy: import("jest-mock").SpiedFunction<() => void>;
|
|
2
|
+
export declare const lengthDeviceManagerSpy: import("jest-mock").SpiedGetter<number>;
|
|
3
|
+
export declare const sizeDeviceManagerSpy: import("jest-mock").SpiedGetter<number>;
|
|
4
|
+
export declare const hasDeviceManagerSpy: import("jest-mock").SpiedFunction<(uniqueId: string) => boolean>;
|
|
5
|
+
export declare const getDeviceManagerSpy: import("jest-mock").SpiedFunction<(uniqueId: string) => import("../matterbridgeEndpoint.js").MatterbridgeEndpoint | undefined>;
|
|
6
|
+
export declare const setDeviceManagerSpy: import("jest-mock").SpiedFunction<(device: import("../matterbridgeEndpoint.js").MatterbridgeEndpoint) => import("../matterbridgeEndpoint.js").MatterbridgeEndpoint>;
|
|
7
|
+
export declare const removeDeviceManagerSpy: import("jest-mock").SpiedFunction<(device: import("../matterbridgeEndpoint.js").MatterbridgeEndpoint) => boolean>;
|
|
8
|
+
export declare const clearDeviceManagerSpy: import("jest-mock").SpiedFunction<() => void>;
|
|
9
|
+
export declare const arrayDeviceManagerSpy: import("jest-mock").SpiedFunction<() => import("../matterbridgeEndpoint.js").MatterbridgeEndpoint[]>;
|
|
10
|
+
export declare const baseArrayDeviceManagerSpy: import("jest-mock").SpiedFunction<(pluginName?: string) => import("@matterbridge/types").BaseDevice[]>;
|
|
11
|
+
export declare const iteratorDeviceManagerSpy: import("jest-mock").SpiedFunction<() => MapIterator<import("../matterbridgeEndpoint.js").MatterbridgeEndpoint>>;
|
|
12
|
+
export declare const forEachDeviceManagerSpy: import("jest-mock").SpiedFunction<(callback: (device: import("../matterbridgeEndpoint.js").MatterbridgeEndpoint) => Promise<void>) => Promise<void>>;
|
|
13
|
+
export declare const logLevelDeviceManagerSpy: import("jest-mock").SpiedSetter<import("node-ansi-logger").LogLevel>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jest } from '@jest/globals';
|
|
2
|
+
import { DeviceManager } from '../deviceManager.js';
|
|
3
|
+
export const destroyDeviceManagerSpy = jest.spyOn(DeviceManager.prototype, 'destroy');
|
|
4
|
+
export const lengthDeviceManagerSpy = jest.spyOn(DeviceManager.prototype, 'length', 'get');
|
|
5
|
+
export const sizeDeviceManagerSpy = jest.spyOn(DeviceManager.prototype, 'size', 'get');
|
|
6
|
+
export const hasDeviceManagerSpy = jest.spyOn(DeviceManager.prototype, 'has');
|
|
7
|
+
export const getDeviceManagerSpy = jest.spyOn(DeviceManager.prototype, 'get');
|
|
8
|
+
export const setDeviceManagerSpy = jest.spyOn(DeviceManager.prototype, 'set');
|
|
9
|
+
export const removeDeviceManagerSpy = jest.spyOn(DeviceManager.prototype, 'remove');
|
|
10
|
+
export const clearDeviceManagerSpy = jest.spyOn(DeviceManager.prototype, 'clear');
|
|
11
|
+
export const arrayDeviceManagerSpy = jest.spyOn(DeviceManager.prototype, 'array');
|
|
12
|
+
export const baseArrayDeviceManagerSpy = jest.spyOn(DeviceManager.prototype, 'baseArray');
|
|
13
|
+
export const iteratorDeviceManagerSpy = jest.spyOn(DeviceManager.prototype, Symbol.iterator);
|
|
14
|
+
export const forEachDeviceManagerSpy = jest.spyOn(DeviceManager.prototype, 'forEach');
|
|
15
|
+
export const logLevelDeviceManagerSpy = jest.spyOn(DeviceManager.prototype, 'logLevel', 'set');
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const wssSendSnackbarMessageFrontendSpy: import("jest-mock").SpiedFunction<(message: string, timeout?: number, severity?: "info" | "warning" | "error" | "success") => void>;
|
|
2
|
+
export declare const wssSendCloseSnackbarMessageFrontendSpy: import("jest-mock").SpiedFunction<(message: string) => void>;
|
|
3
|
+
export declare const wssSendUpdateRequiredFrontendSpy: import("jest-mock").SpiedFunction<(devVersion?: boolean) => void>;
|
|
4
|
+
export declare const wssSendRefreshRequiredFrontendSpy: import("jest-mock").SpiedFunction<(changed: import("@matterbridge/types").RefreshRequiredChanged, params?: {
|
|
5
|
+
matter?: import("@matterbridge/types").ApiMatter;
|
|
6
|
+
lock?: string;
|
|
7
|
+
}) => void>;
|
|
8
|
+
export declare const wssSendRestartRequiredFrontendSpy: import("jest-mock").SpiedFunction<(snackbar?: boolean, fixed?: boolean) => void>;
|
|
9
|
+
export declare const wssSendRestartNotRequiredFrontendSpy: import("jest-mock").SpiedFunction<(snackbar?: boolean) => void>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jest } from '@jest/globals';
|
|
2
|
+
import { Frontend } from '../frontend.js';
|
|
3
|
+
export const wssSendSnackbarMessageFrontendSpy = jest.spyOn(Frontend.prototype, 'wssSendSnackbarMessage');
|
|
4
|
+
export const wssSendCloseSnackbarMessageFrontendSpy = jest.spyOn(Frontend.prototype, 'wssSendCloseSnackbarMessage');
|
|
5
|
+
export const wssSendUpdateRequiredFrontendSpy = jest.spyOn(Frontend.prototype, 'wssSendUpdateRequired');
|
|
6
|
+
export const wssSendRefreshRequiredFrontendSpy = jest.spyOn(Frontend.prototype, 'wssSendRefreshRequired');
|
|
7
|
+
export const wssSendRestartRequiredFrontendSpy = jest.spyOn(Frontend.prototype, 'wssSendRestartRequired');
|
|
8
|
+
export const wssSendRestartNotRequiredFrontendSpy = jest.spyOn(Frontend.prototype, 'wssSendRestartNotRequired');
|
|
@@ -5,14 +5,12 @@ import { AggregatorEndpoint } from '@matter/node/endpoints';
|
|
|
5
5
|
import { ColorControl } from '@matter/types/clusters/color-control';
|
|
6
6
|
import { LevelControl } from '@matter/types/clusters/level-control';
|
|
7
7
|
import { DeviceTypeId } from '@matter/types/datatype';
|
|
8
|
-
import { BroadcastServer } from '@matterbridge/thread/server';
|
|
9
8
|
import { AnsiLogger } from 'node-ansi-logger';
|
|
10
|
-
import { DeviceManager } from '../deviceManager.js';
|
|
11
|
-
import { Frontend } from '../frontend.js';
|
|
9
|
+
import type { DeviceManager } from '../deviceManager.js';
|
|
10
|
+
import type { Frontend } from '../frontend.js';
|
|
12
11
|
import { Matterbridge } from '../matterbridge.js';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { PluginManager } from '../pluginManager.js';
|
|
12
|
+
import type { MatterbridgePlatform } from '../matterbridgePlatform.js';
|
|
13
|
+
import type { PluginManager } from '../pluginManager.js';
|
|
16
14
|
export declare const originalProcessArgv: readonly string[];
|
|
17
15
|
export declare const originalProcessEnv: Readonly<Record<string, string | undefined>>;
|
|
18
16
|
export declare let loggerLogSpy: jest.SpiedFunction<typeof AnsiLogger.prototype.log>;
|
|
@@ -27,37 +25,6 @@ export declare let consoleDebugSpy: jest.SpiedFunction<typeof console.debug>;
|
|
|
27
25
|
export declare let consoleInfoSpy: jest.SpiedFunction<typeof console.info>;
|
|
28
26
|
export declare let consoleWarnSpy: jest.SpiedFunction<typeof console.warn>;
|
|
29
27
|
export declare let consoleErrorSpy: jest.SpiedFunction<typeof console.error>;
|
|
30
|
-
export declare let addBridgedEndpointSpy: jest.SpiedFunction<typeof Matterbridge.prototype.addBridgedEndpoint>;
|
|
31
|
-
export declare let removeBridgedEndpointSpy: jest.SpiedFunction<typeof Matterbridge.prototype.removeBridgedEndpoint>;
|
|
32
|
-
export declare let removeAllBridgedEndpointsSpy: jest.SpiedFunction<typeof Matterbridge.prototype.removeAllBridgedEndpoints>;
|
|
33
|
-
export declare let addVirtualEndpointSpy: jest.SpiedFunction<typeof Matterbridge.prototype.addVirtualEndpoint>;
|
|
34
|
-
export declare let setAttributeSpy: jest.SpiedFunction<typeof MatterbridgeEndpoint.prototype.setAttribute>;
|
|
35
|
-
export declare let updateAttributeSpy: jest.SpiedFunction<typeof MatterbridgeEndpoint.prototype.updateAttribute>;
|
|
36
|
-
export declare let triggerEventSpy: jest.SpiedFunction<typeof MatterbridgeEndpoint.prototype.triggerEvent>;
|
|
37
|
-
export declare let triggerSwitchEventSpy: jest.SpiedFunction<typeof MatterbridgeEndpoint.prototype.triggerSwitchEvent>;
|
|
38
|
-
export declare let installPluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.install>;
|
|
39
|
-
export declare let uninstallPluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.uninstall>;
|
|
40
|
-
export declare let addPluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.add>;
|
|
41
|
-
export declare let loadPluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.load>;
|
|
42
|
-
export declare let startPluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.start>;
|
|
43
|
-
export declare let configurePluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.configure>;
|
|
44
|
-
export declare let shutdownPluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.shutdown>;
|
|
45
|
-
export declare let removePluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.remove>;
|
|
46
|
-
export declare let enablePluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.enable>;
|
|
47
|
-
export declare let disablePluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.disable>;
|
|
48
|
-
export declare let wssSendSnackbarMessageSpy: jest.SpiedFunction<typeof Frontend.prototype.wssSendSnackbarMessage>;
|
|
49
|
-
export declare let wssSendCloseSnackbarMessageSpy: jest.SpiedFunction<typeof Frontend.prototype.wssSendCloseSnackbarMessage>;
|
|
50
|
-
export declare let wssSendUpdateRequiredSpy: jest.SpiedFunction<typeof Frontend.prototype.wssSendUpdateRequired>;
|
|
51
|
-
export declare let wssSendRefreshRequiredSpy: jest.SpiedFunction<typeof Frontend.prototype.wssSendRefreshRequired>;
|
|
52
|
-
export declare let wssSendRestartRequiredSpy: jest.SpiedFunction<typeof Frontend.prototype.wssSendRestartRequired>;
|
|
53
|
-
export declare let wssSendRestartNotRequiredSpy: jest.SpiedFunction<typeof Frontend.prototype.wssSendRestartNotRequired>;
|
|
54
|
-
export declare let broadcastServerIsWorkerRequestSpy: jest.SpiedFunction<typeof BroadcastServer.prototype.isWorkerRequest>;
|
|
55
|
-
export declare let broadcastServerIsWorkerResponseSpy: jest.SpiedFunction<typeof BroadcastServer.prototype.isWorkerResponse>;
|
|
56
|
-
export declare let broadcastServerBroadcastSpy: jest.SpiedFunction<typeof BroadcastServer.prototype.broadcast>;
|
|
57
|
-
export declare let broadcastServerRequestSpy: jest.SpiedFunction<typeof BroadcastServer.prototype.request>;
|
|
58
|
-
export declare let broadcastServerRespondSpy: jest.SpiedFunction<typeof BroadcastServer.prototype.respond>;
|
|
59
|
-
export declare let broadcastServerFetchSpy: jest.SpiedFunction<typeof BroadcastServer.prototype.fetch>;
|
|
60
|
-
export declare let broadcastMessageHandlerSpy: jest.SpiedFunction<(this: BroadcastServer, event: MessageEvent) => void>;
|
|
61
28
|
export declare let NAME: string;
|
|
62
29
|
export declare let HOMEDIR: string;
|
|
63
30
|
export declare let matterbridge: Matterbridge;
|
|
@@ -86,8 +53,9 @@ export declare function logKeepAlives(log?: AnsiLogger): number;
|
|
|
86
53
|
export declare function flushAllEndpointNumberPersistence(targetServer: ServerNode, rounds?: number, pause?: number): Promise<void>;
|
|
87
54
|
export declare function assertAllEndpointNumbersPersisted(targetServer: ServerNode): Promise<number>;
|
|
88
55
|
export declare function closeServerNodeStores(targetServer?: ServerNode): Promise<void>;
|
|
89
|
-
export declare function
|
|
90
|
-
export declare function
|
|
56
|
+
export declare function createServerNode(name: string, port: number, deviceType?: DeviceTypeId, ticks?: number, microTurns?: number, pause?: number): Promise<[ServerNode<ServerNode.RootEndpoint>, Endpoint<AggregatorEndpoint>]>;
|
|
57
|
+
export declare function startServerNode(name: string, port: number, deviceType?: DeviceTypeId, createOnly?: boolean, ticks?: number, microTurns?: number, pause?: number): Promise<[ServerNode<ServerNode.RootEndpoint>, Endpoint<AggregatorEndpoint>]>;
|
|
58
|
+
export declare function stopServerNode(server: ServerNode<ServerNode.RootEndpoint>, createOnly?: boolean, ticks?: number, microTurns?: number, pause?: number): Promise<void>;
|
|
91
59
|
export declare function addDevice(owner: ServerNode<ServerNode.RootEndpoint> | Endpoint<AggregatorEndpoint>, device: Endpoint, pause?: number): Promise<boolean>;
|
|
92
60
|
export declare function deleteDevice(owner: ServerNode<ServerNode.RootEndpoint> | Endpoint<AggregatorEndpoint>, device: Endpoint, pause?: number): Promise<boolean>;
|
|
93
61
|
export declare function getMoveToLevelRequest(level: number, transitionTime: number, executeIfOff: boolean): LevelControl.MoveToLevelRequest;
|
|
@@ -7,15 +7,11 @@ import { AggregatorEndpoint } from '@matter/node/endpoints';
|
|
|
7
7
|
import { MdnsService } from '@matter/protocol';
|
|
8
8
|
import { ColorControl } from '@matter/types/clusters/color-control';
|
|
9
9
|
import { DeviceTypeId, VendorId } from '@matter/types/datatype';
|
|
10
|
-
import { BroadcastServer } from '@matterbridge/thread/server';
|
|
11
10
|
import { MATTER_STORAGE_DIR, NODE_STORAGE_DIR } from '@matterbridge/types';
|
|
12
11
|
import { AnsiLogger, er, rs, UNDERLINE, UNDERLINEOFF } from 'node-ansi-logger';
|
|
13
12
|
import { NodeStorageManager } from 'node-persist-manager';
|
|
14
|
-
import { Frontend } from '../frontend.js';
|
|
15
13
|
import { Matterbridge } from '../matterbridge.js';
|
|
16
14
|
import { bridge } from '../matterbridgeDeviceTypes.js';
|
|
17
|
-
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
18
|
-
import { PluginManager } from '../pluginManager.js';
|
|
19
15
|
export const originalProcessArgv = Object.freeze([...process.argv]);
|
|
20
16
|
export const originalProcessEnv = Object.freeze({ ...process.env });
|
|
21
17
|
export let loggerLogSpy;
|
|
@@ -30,37 +26,6 @@ export let consoleDebugSpy;
|
|
|
30
26
|
export let consoleInfoSpy;
|
|
31
27
|
export let consoleWarnSpy;
|
|
32
28
|
export let consoleErrorSpy;
|
|
33
|
-
export let addBridgedEndpointSpy;
|
|
34
|
-
export let removeBridgedEndpointSpy;
|
|
35
|
-
export let removeAllBridgedEndpointsSpy;
|
|
36
|
-
export let addVirtualEndpointSpy;
|
|
37
|
-
export let setAttributeSpy;
|
|
38
|
-
export let updateAttributeSpy;
|
|
39
|
-
export let triggerEventSpy;
|
|
40
|
-
export let triggerSwitchEventSpy;
|
|
41
|
-
export let installPluginSpy;
|
|
42
|
-
export let uninstallPluginSpy;
|
|
43
|
-
export let addPluginSpy;
|
|
44
|
-
export let loadPluginSpy;
|
|
45
|
-
export let startPluginSpy;
|
|
46
|
-
export let configurePluginSpy;
|
|
47
|
-
export let shutdownPluginSpy;
|
|
48
|
-
export let removePluginSpy;
|
|
49
|
-
export let enablePluginSpy;
|
|
50
|
-
export let disablePluginSpy;
|
|
51
|
-
export let wssSendSnackbarMessageSpy;
|
|
52
|
-
export let wssSendCloseSnackbarMessageSpy;
|
|
53
|
-
export let wssSendUpdateRequiredSpy;
|
|
54
|
-
export let wssSendRefreshRequiredSpy;
|
|
55
|
-
export let wssSendRestartRequiredSpy;
|
|
56
|
-
export let wssSendRestartNotRequiredSpy;
|
|
57
|
-
export let broadcastServerIsWorkerRequestSpy;
|
|
58
|
-
export let broadcastServerIsWorkerResponseSpy;
|
|
59
|
-
export let broadcastServerBroadcastSpy;
|
|
60
|
-
export let broadcastServerRequestSpy;
|
|
61
|
-
export let broadcastServerRespondSpy;
|
|
62
|
-
export let broadcastServerFetchSpy;
|
|
63
|
-
export let broadcastMessageHandlerSpy;
|
|
64
29
|
export let NAME;
|
|
65
30
|
export let HOMEDIR;
|
|
66
31
|
export let matterbridge;
|
|
@@ -101,37 +66,6 @@ export async function setupTest(name, debug = false) {
|
|
|
101
66
|
consoleWarnSpy = jest.spyOn(console, 'warn').mockImplementation(() => { });
|
|
102
67
|
consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(() => { });
|
|
103
68
|
}
|
|
104
|
-
addBridgedEndpointSpy = jest.spyOn(Matterbridge.prototype, 'addBridgedEndpoint');
|
|
105
|
-
removeBridgedEndpointSpy = jest.spyOn(Matterbridge.prototype, 'removeBridgedEndpoint');
|
|
106
|
-
removeAllBridgedEndpointsSpy = jest.spyOn(Matterbridge.prototype, 'removeAllBridgedEndpoints');
|
|
107
|
-
addVirtualEndpointSpy = jest.spyOn(Matterbridge.prototype, 'addVirtualEndpoint');
|
|
108
|
-
setAttributeSpy = jest.spyOn(MatterbridgeEndpoint.prototype, 'setAttribute');
|
|
109
|
-
updateAttributeSpy = jest.spyOn(MatterbridgeEndpoint.prototype, 'updateAttribute');
|
|
110
|
-
triggerEventSpy = jest.spyOn(MatterbridgeEndpoint.prototype, 'triggerEvent');
|
|
111
|
-
triggerSwitchEventSpy = jest.spyOn(MatterbridgeEndpoint.prototype, 'triggerSwitchEvent');
|
|
112
|
-
installPluginSpy = jest.spyOn(PluginManager.prototype, 'install');
|
|
113
|
-
uninstallPluginSpy = jest.spyOn(PluginManager.prototype, 'uninstall');
|
|
114
|
-
addPluginSpy = jest.spyOn(PluginManager.prototype, 'add');
|
|
115
|
-
loadPluginSpy = jest.spyOn(PluginManager.prototype, 'load');
|
|
116
|
-
startPluginSpy = jest.spyOn(PluginManager.prototype, 'start');
|
|
117
|
-
configurePluginSpy = jest.spyOn(PluginManager.prototype, 'configure');
|
|
118
|
-
shutdownPluginSpy = jest.spyOn(PluginManager.prototype, 'shutdown');
|
|
119
|
-
removePluginSpy = jest.spyOn(PluginManager.prototype, 'remove');
|
|
120
|
-
enablePluginSpy = jest.spyOn(PluginManager.prototype, 'enable');
|
|
121
|
-
disablePluginSpy = jest.spyOn(PluginManager.prototype, 'disable');
|
|
122
|
-
wssSendSnackbarMessageSpy = jest.spyOn(Frontend.prototype, 'wssSendSnackbarMessage');
|
|
123
|
-
wssSendCloseSnackbarMessageSpy = jest.spyOn(Frontend.prototype, 'wssSendCloseSnackbarMessage');
|
|
124
|
-
wssSendUpdateRequiredSpy = jest.spyOn(Frontend.prototype, 'wssSendUpdateRequired');
|
|
125
|
-
wssSendRefreshRequiredSpy = jest.spyOn(Frontend.prototype, 'wssSendRefreshRequired');
|
|
126
|
-
wssSendRestartRequiredSpy = jest.spyOn(Frontend.prototype, 'wssSendRestartRequired');
|
|
127
|
-
wssSendRestartNotRequiredSpy = jest.spyOn(Frontend.prototype, 'wssSendRestartNotRequired');
|
|
128
|
-
broadcastServerIsWorkerRequestSpy = jest.spyOn(BroadcastServer.prototype, 'isWorkerRequest');
|
|
129
|
-
broadcastServerIsWorkerResponseSpy = jest.spyOn(BroadcastServer.prototype, 'isWorkerResponse');
|
|
130
|
-
broadcastServerBroadcastSpy = jest.spyOn(BroadcastServer.prototype, 'broadcast');
|
|
131
|
-
broadcastServerRequestSpy = jest.spyOn(BroadcastServer.prototype, 'request');
|
|
132
|
-
broadcastServerRespondSpy = jest.spyOn(BroadcastServer.prototype, 'respond');
|
|
133
|
-
broadcastServerFetchSpy = jest.spyOn(BroadcastServer.prototype, 'fetch');
|
|
134
|
-
broadcastMessageHandlerSpy = jest.spyOn(BroadcastServer.prototype, 'broadcastMessageHandler');
|
|
135
69
|
}
|
|
136
70
|
export async function setDebug(debug) {
|
|
137
71
|
const { jest } = await import('@jest/globals');
|
|
@@ -489,7 +423,7 @@ export async function closeServerNodeStores(targetServer) {
|
|
|
489
423
|
targetServer = server;
|
|
490
424
|
await targetServer?.env.get(ServerNodeStore)?.endpointStores.close();
|
|
491
425
|
}
|
|
492
|
-
export async function
|
|
426
|
+
export async function createServerNode(name, port, deviceType = bridge.code, ticks = 3, microTurns = 10, pause = 100) {
|
|
493
427
|
const { randomBytes } = await import('node:crypto');
|
|
494
428
|
const random = randomBytes(8).toString('hex');
|
|
495
429
|
server = await ServerNode.create({
|
|
@@ -533,8 +467,14 @@ export async function startServerNode(name, port, deviceType = bridge.code, crea
|
|
|
533
467
|
expect(server.parts.has(aggregator)).toBeTruthy();
|
|
534
468
|
expect(aggregator.lifecycle.isReady).toBeTruthy();
|
|
535
469
|
expect(server.lifecycle.isOnline).toBeFalsy();
|
|
470
|
+
await flushAsync(ticks, microTurns, pause);
|
|
471
|
+
return [server, aggregator];
|
|
472
|
+
}
|
|
473
|
+
export async function startServerNode(name, port, deviceType = bridge.code, createOnly = false, ticks = 3, microTurns = 10, pause = 100) {
|
|
474
|
+
if (!server || !aggregator) {
|
|
475
|
+
await createServerNode(name, port, deviceType);
|
|
476
|
+
}
|
|
536
477
|
if (createOnly) {
|
|
537
|
-
await flushAsync(3, 3, 100);
|
|
538
478
|
return [server, aggregator];
|
|
539
479
|
}
|
|
540
480
|
await new Promise((resolve) => {
|
|
@@ -554,10 +494,10 @@ export async function startServerNode(name, port, deviceType = bridge.code, crea
|
|
|
554
494
|
expect(aggregator.lifecycle.isPartsReady).toBeTruthy();
|
|
555
495
|
expect(aggregator.lifecycle.hasId).toBeTruthy();
|
|
556
496
|
expect(aggregator.lifecycle.hasNumber).toBeTruthy();
|
|
557
|
-
await flushAsync(
|
|
497
|
+
await flushAsync(ticks, microTurns, pause);
|
|
558
498
|
return [server, aggregator];
|
|
559
499
|
}
|
|
560
|
-
export async function stopServerNode(server, createOnly = false) {
|
|
500
|
+
export async function stopServerNode(server, createOnly = false, ticks = 3, microTurns = 10, pause = 100) {
|
|
561
501
|
await flushAllEndpointNumberPersistence(server);
|
|
562
502
|
await assertAllEndpointNumbersPersisted(server);
|
|
563
503
|
expect(server).toBeDefined();
|
|
@@ -568,7 +508,7 @@ export async function stopServerNode(server, createOnly = false) {
|
|
|
568
508
|
await server.close();
|
|
569
509
|
expect(server.lifecycle.isReady).toBeFalsy();
|
|
570
510
|
expect(server.lifecycle.isOnline).toBeFalsy();
|
|
571
|
-
await flushAsync(
|
|
511
|
+
await flushAsync(ticks, microTurns, pause);
|
|
572
512
|
}
|
|
573
513
|
export async function addDevice(owner, device, pause = 10) {
|
|
574
514
|
expect(owner).toBeDefined();
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jest } from '@jest/globals';
|
|
2
|
+
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
3
|
+
export declare let setAttributeMatterbridgeEndpointSpy: jest.SpiedFunction<typeof MatterbridgeEndpoint.prototype.setAttribute>;
|
|
4
|
+
export declare let updateAttributeMatterbridgeEndpointSpy: jest.SpiedFunction<typeof MatterbridgeEndpoint.prototype.updateAttribute>;
|
|
5
|
+
export declare let triggerEventMatterbridgeEndpointSpy: jest.SpiedFunction<typeof MatterbridgeEndpoint.prototype.triggerEvent>;
|
|
6
|
+
export declare let triggerSwitchEventMatterbridgeEndpointSpy: jest.SpiedFunction<typeof MatterbridgeEndpoint.prototype.triggerSwitchEvent>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export declare const destroyMatterbridgePlatformSpy: import("jest-mock").SpiedSetter<string | boolean | import("node-ansi-logger").AnsiLogger | Promise<void> | import("../matterbridgePlatform.js").PlatformConfig | import("../matterbridgePlatform.js").PlatformMatterbridge | import("node-persist-manager").NodeStorage> | import("jest-mock").SpiedGetter<string | boolean | import("node-ansi-logger").AnsiLogger | Promise<void> | import("../matterbridgePlatform.js").PlatformConfig | import("../matterbridgePlatform.js").PlatformMatterbridge | import("node-persist-manager").NodeStorage>;
|
|
2
|
+
export declare const onStartMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(reason?: string) => Promise<void>>;
|
|
3
|
+
export declare const onConfigureMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<() => Promise<void>>;
|
|
4
|
+
export declare const onShutdownMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(reason?: string) => Promise<void>>;
|
|
5
|
+
export declare const onChangeLoggerLevelMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(logLevel: import("node-ansi-logger").LogLevel) => Promise<void>>;
|
|
6
|
+
export declare const onActionMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(action: string, value?: string, id?: string, formData?: import("../matterbridgePlatform.js").PlatformConfig) => Promise<void>>;
|
|
7
|
+
export declare const onConfigChangedMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(config: import("../matterbridgePlatform.js").PlatformConfig) => Promise<void>>;
|
|
8
|
+
export declare const saveConfigMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(config: import("../matterbridgePlatform.js").PlatformConfig) => void>;
|
|
9
|
+
export declare const getSchemaMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<() => Promise<import("../matterbridgePlatform.js").PlatformSchema | undefined>>;
|
|
10
|
+
export declare const setSchemaMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(schema: import("../matterbridgePlatform.js").PlatformSchema) => void>;
|
|
11
|
+
export declare const wssSendRestartRequiredMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(snackbar?: boolean, fixed?: boolean) => void>;
|
|
12
|
+
export declare const wssSendSnackbarMessageMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(message: string, timeout?: number, severity?: "error" | "success" | "info" | "warning") => void>;
|
|
13
|
+
export declare const sizeMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<() => number>;
|
|
14
|
+
export declare const getDevicesMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<() => import("../matterbridgeEndpoint.js").MatterbridgeEndpoint[]>;
|
|
15
|
+
export declare const getDeviceByNameMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(deviceName: string) => import("../matterbridgeEndpoint.js").MatterbridgeEndpoint | undefined>;
|
|
16
|
+
export declare const getDeviceByUniqueIdMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(uniqueId: string) => import("../matterbridgeEndpoint.js").MatterbridgeEndpoint | undefined>;
|
|
17
|
+
export declare const getDeviceBySerialNumberMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(serialNumber: string) => import("../matterbridgeEndpoint.js").MatterbridgeEndpoint | undefined>;
|
|
18
|
+
export declare const getDeviceByIdMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(id: string) => import("../matterbridgeEndpoint.js").MatterbridgeEndpoint | undefined>;
|
|
19
|
+
export declare const getDeviceByOriginalIdMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(originalId: string) => import("../matterbridgeEndpoint.js").MatterbridgeEndpoint | undefined>;
|
|
20
|
+
export declare const getDeviceByNumberMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(number: import("@matter/types").EndpointNumber | number) => import("../matterbridgeEndpoint.js").MatterbridgeEndpoint | undefined>;
|
|
21
|
+
export declare const hasDeviceNameMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(deviceName: string) => boolean>;
|
|
22
|
+
export declare const hasDeviceUniqueIdMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(deviceUniqueId: string) => boolean>;
|
|
23
|
+
export declare const registerVirtualDeviceMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(name: string, type: "light" | "outlet" | "switch" | "mounted_switch", callback: () => Promise<void>) => Promise<boolean>>;
|
|
24
|
+
export declare const registerDeviceMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(device: import("../matterbridgeEndpoint.js").MatterbridgeEndpoint) => Promise<void>>;
|
|
25
|
+
export declare const unregisterDeviceMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(device: import("../matterbridgeEndpoint.js").MatterbridgeEndpoint) => Promise<void>>;
|
|
26
|
+
export declare const unregisterAllDevicesMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(delay?: number) => Promise<void>>;
|
|
27
|
+
export declare const saveSelectsMatterbridgePlatformSpy: import("jest-mock").SpiedSetter<string | boolean | import("node-ansi-logger").AnsiLogger | Promise<void> | import("../matterbridgePlatform.js").PlatformConfig | import("../matterbridgePlatform.js").PlatformMatterbridge | import("node-persist-manager").NodeStorage> | import("jest-mock").SpiedGetter<string | boolean | import("node-ansi-logger").AnsiLogger | Promise<void> | import("../matterbridgePlatform.js").PlatformConfig | import("../matterbridgePlatform.js").PlatformMatterbridge | import("node-persist-manager").NodeStorage>;
|
|
28
|
+
export declare const clearSelectMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<() => Promise<void>>;
|
|
29
|
+
export declare const clearDeviceSelectMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(serial: string) => Promise<void>>;
|
|
30
|
+
export declare const clearEntitySelectMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(name: string) => Promise<void>>;
|
|
31
|
+
export declare const setSelectDeviceMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(serial: string, name: string, configUrl?: string, icon?: string, entities?: {
|
|
32
|
+
name: string;
|
|
33
|
+
description: string;
|
|
34
|
+
icon?: string;
|
|
35
|
+
}[]) => void>;
|
|
36
|
+
export declare const getSelectDeviceMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(serial: string) => {
|
|
37
|
+
serial: string;
|
|
38
|
+
name: string;
|
|
39
|
+
configUrl?: string;
|
|
40
|
+
icon?: string;
|
|
41
|
+
entities?: {
|
|
42
|
+
name: string;
|
|
43
|
+
description: string;
|
|
44
|
+
icon?: string;
|
|
45
|
+
}[];
|
|
46
|
+
} | undefined>;
|
|
47
|
+
export declare const setSelectDeviceEntityMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(serial: string, entityName: string, entityDescription: string, entityIcon?: string) => void>;
|
|
48
|
+
export declare const getSelectDevicesMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<() => import("@matterbridge/types").ApiSelectDevice[]>;
|
|
49
|
+
export declare const setSelectEntityMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(name: string, description: string, icon?: string) => void>;
|
|
50
|
+
export declare const getSelectEntityMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(name: string) => {
|
|
51
|
+
name: string;
|
|
52
|
+
description: string;
|
|
53
|
+
icon?: string | undefined;
|
|
54
|
+
} | undefined>;
|
|
55
|
+
export declare const getSelectEntitiesMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<() => import("@matterbridge/types").ApiSelectEntity[]>;
|
|
56
|
+
export declare const verifyMatterbridgeVersionMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(requiredVersion: string, destroy?: boolean) => boolean>;
|
|
57
|
+
export declare const validateDeviceMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(device: string | string[], log?: boolean) => boolean>;
|
|
58
|
+
export declare const validateEntityMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(device: string, entity: string, log?: boolean) => boolean>;
|
|
59
|
+
export declare const clearEndpointNumbersMatterbridgePlatformSpy: import("jest-mock").SpiedSetter<string | boolean | import("node-ansi-logger").AnsiLogger | Promise<void> | import("../matterbridgePlatform.js").PlatformConfig | import("../matterbridgePlatform.js").PlatformMatterbridge | import("node-persist-manager").NodeStorage> | import("jest-mock").SpiedGetter<string | boolean | import("node-ansi-logger").AnsiLogger | Promise<void> | import("../matterbridgePlatform.js").PlatformConfig | import("../matterbridgePlatform.js").PlatformMatterbridge | import("node-persist-manager").NodeStorage>;
|
|
60
|
+
export declare const checkEndpointNumbersMatterbridgePlatformSpy: import("jest-mock").SpiedSetter<string | boolean | import("node-ansi-logger").AnsiLogger | Promise<void> | import("../matterbridgePlatform.js").PlatformConfig | import("../matterbridgePlatform.js").PlatformMatterbridge | import("node-persist-manager").NodeStorage> | import("jest-mock").SpiedGetter<string | boolean | import("node-ansi-logger").AnsiLogger | Promise<void> | import("../matterbridgePlatform.js").PlatformConfig | import("../matterbridgePlatform.js").PlatformMatterbridge | import("node-persist-manager").NodeStorage>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jest } from '@jest/globals';
|
|
2
|
+
import { MatterbridgePlatform } from '../matterbridgePlatform.js';
|
|
3
|
+
export const destroyMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'destroy');
|
|
4
|
+
export const onStartMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'onStart');
|
|
5
|
+
export const onConfigureMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'onConfigure');
|
|
6
|
+
export const onShutdownMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'onShutdown');
|
|
7
|
+
export const onChangeLoggerLevelMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'onChangeLoggerLevel');
|
|
8
|
+
export const onActionMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'onAction');
|
|
9
|
+
export const onConfigChangedMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'onConfigChanged');
|
|
10
|
+
export const saveConfigMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'saveConfig');
|
|
11
|
+
export const getSchemaMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'getSchema');
|
|
12
|
+
export const setSchemaMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'setSchema');
|
|
13
|
+
export const wssSendRestartRequiredMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'wssSendRestartRequired');
|
|
14
|
+
export const wssSendSnackbarMessageMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'wssSendSnackbarMessage');
|
|
15
|
+
export const sizeMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'size');
|
|
16
|
+
export const getDevicesMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'getDevices');
|
|
17
|
+
export const getDeviceByNameMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'getDeviceByName');
|
|
18
|
+
export const getDeviceByUniqueIdMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'getDeviceByUniqueId');
|
|
19
|
+
export const getDeviceBySerialNumberMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'getDeviceBySerialNumber');
|
|
20
|
+
export const getDeviceByIdMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'getDeviceById');
|
|
21
|
+
export const getDeviceByOriginalIdMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'getDeviceByOriginalId');
|
|
22
|
+
export const getDeviceByNumberMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'getDeviceByNumber');
|
|
23
|
+
export const hasDeviceNameMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'hasDeviceName');
|
|
24
|
+
export const hasDeviceUniqueIdMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'hasDeviceUniqueId');
|
|
25
|
+
export const registerVirtualDeviceMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'registerVirtualDevice');
|
|
26
|
+
export const registerDeviceMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'registerDevice');
|
|
27
|
+
export const unregisterDeviceMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'unregisterDevice');
|
|
28
|
+
export const unregisterAllDevicesMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'unregisterAllDevices');
|
|
29
|
+
export const saveSelectsMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'saveSelects');
|
|
30
|
+
export const clearSelectMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'clearSelect');
|
|
31
|
+
export const clearDeviceSelectMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'clearDeviceSelect');
|
|
32
|
+
export const clearEntitySelectMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'clearEntitySelect');
|
|
33
|
+
export const setSelectDeviceMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'setSelectDevice');
|
|
34
|
+
export const getSelectDeviceMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'getSelectDevice');
|
|
35
|
+
export const setSelectDeviceEntityMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'setSelectDeviceEntity');
|
|
36
|
+
export const getSelectDevicesMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'getSelectDevices');
|
|
37
|
+
export const setSelectEntityMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'setSelectEntity');
|
|
38
|
+
export const getSelectEntityMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'getSelectEntity');
|
|
39
|
+
export const getSelectEntitiesMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'getSelectEntities');
|
|
40
|
+
export const verifyMatterbridgeVersionMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'verifyMatterbridgeVersion');
|
|
41
|
+
export const validateDeviceMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'validateDevice');
|
|
42
|
+
export const validateEntityMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'validateEntity');
|
|
43
|
+
export const clearEndpointNumbersMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'clearEndpointNumbers');
|
|
44
|
+
export const checkEndpointNumbersMatterbridgePlatformSpy = jest.spyOn(MatterbridgePlatform.prototype, 'checkEndpointNumbers');
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const addBridgedEndpointMatterbridgeSpy: import("jest-mock").SpiedFunction<(pluginName: string, device: import("../matterbridgeEndpoint.js").MatterbridgeEndpoint) => Promise<void>>;
|
|
2
|
+
export declare const removeBridgedEndpointMatterbridgeSpy: import("jest-mock").SpiedFunction<(pluginName: string, device: import("../matterbridgeEndpoint.js").MatterbridgeEndpoint) => Promise<void>>;
|
|
3
|
+
export declare const removeAllBridgedEndpointsMatterbridgeSpy: import("jest-mock").SpiedFunction<(pluginName: string, delay?: number) => Promise<void>>;
|
|
4
|
+
export declare const addVirtualEndpointMatterbridgeSpy: import("jest-mock").SpiedFunction<(pluginName: string, name: string, type: "light" | "outlet" | "switch" | "mounted_switch", callback: () => Promise<void>) => Promise<boolean>>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jest } from '@jest/globals';
|
|
2
|
+
import { Matterbridge } from '../matterbridge.js';
|
|
3
|
+
export const addBridgedEndpointMatterbridgeSpy = jest.spyOn(Matterbridge.prototype, 'addBridgedEndpoint');
|
|
4
|
+
export const removeBridgedEndpointMatterbridgeSpy = jest.spyOn(Matterbridge.prototype, 'removeBridgedEndpoint');
|
|
5
|
+
export const removeAllBridgedEndpointsMatterbridgeSpy = jest.spyOn(Matterbridge.prototype, 'removeAllBridgedEndpoints');
|
|
6
|
+
export const addVirtualEndpointMatterbridgeSpy = jest.spyOn(Matterbridge.prototype, 'addVirtualEndpoint');
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export declare const destroyPluginSpy: import("jest-mock").SpiedFunction<() => void>;
|
|
2
|
+
export declare const checkDependenciesPluginSpy: import("jest-mock").SpiedFunction<(packageJson: Record<string, unknown> & {
|
|
3
|
+
name?: string;
|
|
4
|
+
dependencies?: string[] | Record<string, string>;
|
|
5
|
+
devDependencies?: string[] | Record<string, string>;
|
|
6
|
+
peerDependencies?: string[] | Record<string, string>;
|
|
7
|
+
optionalDependencies?: string[] | Record<string, string>;
|
|
8
|
+
bundledDependencies?: string[] | Record<string, string>;
|
|
9
|
+
bundleDependencies?: string[] | Record<string, string>;
|
|
10
|
+
}) => boolean>;
|
|
11
|
+
export declare const lengthPluginSpy: import("jest-mock").SpiedGetter<number>;
|
|
12
|
+
export declare const sizePluginSpy: import("jest-mock").SpiedGetter<number>;
|
|
13
|
+
export declare const hasPluginSpy: import("jest-mock").SpiedFunction<(name: string) => boolean>;
|
|
14
|
+
export declare const getPluginSpy: import("jest-mock").SpiedFunction<(name: string) => import("../pluginManager.js").Plugin | undefined>;
|
|
15
|
+
export declare const setPluginSpy: import("jest-mock").SpiedFunction<(plugin: import("../pluginManager.js").Plugin) => import("../pluginManager.js").Plugin>;
|
|
16
|
+
export declare const clearPluginSpy: import("jest-mock").SpiedFunction<() => void>;
|
|
17
|
+
export declare const arrayPluginSpy: import("jest-mock").SpiedFunction<() => import("../pluginManager.js").Plugin[]>;
|
|
18
|
+
export declare const storagePluginArraySpy: import("jest-mock").SpiedFunction<() => import("@matterbridge/types").StoragePlugin[]>;
|
|
19
|
+
export declare const apiPluginArraySpy: import("jest-mock").SpiedFunction<() => import("@matterbridge/types").ApiPlugin[]>;
|
|
20
|
+
export declare const iteratorPluginSpy: import("jest-mock").SpiedFunction<() => MapIterator<import("../pluginManager.js").Plugin>>;
|
|
21
|
+
export declare const forEachPluginSpy: import("jest-mock").SpiedFunction<(callback: (plugin: import("../pluginManager.js").Plugin) => Promise<void>) => Promise<void>>;
|
|
22
|
+
export declare const logLevelPluginSpy: import("jest-mock").SpiedSetter<import("node-ansi-logger").LogLevel>;
|
|
23
|
+
export declare const loadFromStoragePluginSpy: import("jest-mock").SpiedFunction<() => Promise<import("@matterbridge/types").StoragePlugin[]>>;
|
|
24
|
+
export declare const saveToStoragePluginSpy: import("jest-mock").SpiedFunction<() => Promise<number>>;
|
|
25
|
+
export declare const resolvePluginSpy: import("jest-mock").SpiedFunction<(nameOrPath: string) => Promise<string | null>>;
|
|
26
|
+
export declare const installPluginSpy: import("jest-mock").SpiedFunction<(packageName: string) => void>;
|
|
27
|
+
export declare const uninstallPluginSpy: import("jest-mock").SpiedFunction<(packageName: string) => void>;
|
|
28
|
+
export declare const getAuthorPluginSpy: import("jest-mock").SpiedFunction<(packageJson: Record<string, string | number | Record<string, string | number | object>>) => string>;
|
|
29
|
+
export declare const getDescriptionPluginSpy: import("jest-mock").SpiedFunction<(packageJson: Record<string, string | number | Record<string, string | number | object>>) => string>;
|
|
30
|
+
export declare const getHomepagePluginSpy: import("jest-mock").SpiedFunction<(packageJson: Record<string, string | number | Record<string, string | number | object>>) => string | undefined>;
|
|
31
|
+
export declare const getHelpPluginSpy: import("jest-mock").SpiedFunction<(packageJson: Record<string, string | number | Record<string, string | number | object>>) => string | undefined>;
|
|
32
|
+
export declare const getChangelogPluginSpy: import("jest-mock").SpiedFunction<(packageJson: Record<string, string | number | Record<string, string | number | object>>) => string | undefined>;
|
|
33
|
+
export declare const getFundingPluginSpy: import("jest-mock").SpiedFunction<(packageJson: Record<string, any>) => string | undefined>;
|
|
34
|
+
export declare const parsePluginSpy: import("jest-mock").SpiedFunction<(plugin: import("../pluginManager.js").Plugin | import("@matterbridge/types").PluginName) => Promise<Record<string, string | number | object> | null>>;
|
|
35
|
+
export declare const addPluginSpy: import("jest-mock").SpiedFunction<(nameOrPath: string) => Promise<import("../pluginManager.js").Plugin | null>>;
|
|
36
|
+
export declare const enablePluginSpy: import("jest-mock").SpiedFunction<(nameOrPath: string) => Promise<import("../pluginManager.js").Plugin | null>>;
|
|
37
|
+
export declare const disablePluginSpy: import("jest-mock").SpiedFunction<(nameOrPath: string) => Promise<import("../pluginManager.js").Plugin | null>>;
|
|
38
|
+
export declare const removePluginSpy: import("jest-mock").SpiedFunction<(nameOrPath: string) => Promise<import("../pluginManager.js").Plugin | null>>;
|
|
39
|
+
export declare const loadPluginSpy: import("jest-mock").SpiedFunction<(plugin: import("../pluginManager.js").Plugin | import("@matterbridge/types").PluginName, start?: boolean, message?: string, configure?: boolean) => Promise<import("../matterbridgePlatform.js").MatterbridgePlatform | undefined>>;
|
|
40
|
+
export declare const startPluginSpy: import("jest-mock").SpiedFunction<(plugin: import("../pluginManager.js").Plugin | import("@matterbridge/types").PluginName, message?: string, configure?: boolean) => Promise<import("../pluginManager.js").Plugin | undefined>>;
|
|
41
|
+
export declare const configurePluginSpy: import("jest-mock").SpiedFunction<(plugin: import("../pluginManager.js").Plugin | import("@matterbridge/types").PluginName) => Promise<import("../pluginManager.js").Plugin | undefined>>;
|
|
42
|
+
export declare const shutdownPluginSpy: import("jest-mock").SpiedFunction<(plugin: import("../pluginManager.js").Plugin | import("@matterbridge/types").PluginName, reason?: string, removeAllDevices?: boolean, force?: boolean) => Promise<import("../pluginManager.js").Plugin | undefined>>;
|
|
43
|
+
export declare const loadConfigPluginSpy: import("jest-mock").SpiedFunction<(plugin: import("../pluginManager.js").Plugin) => Promise<import("@matterbridge/types").PlatformConfig>>;
|
|
44
|
+
export declare const saveConfigFromPluginPluginSpy: import("jest-mock").SpiedFunction<(plugin: import("../pluginManager.js").Plugin, restartRequired?: boolean) => Promise<void>>;
|
|
45
|
+
export declare const saveConfigFromJsonPluginSpy: import("jest-mock").SpiedFunction<(plugin: import("../pluginManager.js").Plugin, config: import("@matterbridge/types").PlatformConfig, restartRequired?: boolean) => Promise<void>>;
|
|
46
|
+
export declare const loadSchemaPluginSpy: import("jest-mock").SpiedFunction<(plugin: import("../pluginManager.js").Plugin) => Promise<import("@matterbridge/types").PlatformSchema>>;
|
|
47
|
+
export declare const getDefaultSchemaPluginSpy: import("jest-mock").SpiedFunction<(plugin: import("../pluginManager.js").Plugin) => import("@matterbridge/types").PlatformSchema>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jest } from '@jest/globals';
|
|
2
|
+
import { PluginManager } from '../pluginManager.js';
|
|
3
|
+
export const destroyPluginSpy = jest.spyOn(PluginManager.prototype, 'destroy');
|
|
4
|
+
export const checkDependenciesPluginSpy = jest.spyOn(PluginManager.prototype, 'checkDependencies');
|
|
5
|
+
export const lengthPluginSpy = jest.spyOn(PluginManager.prototype, 'length', 'get');
|
|
6
|
+
export const sizePluginSpy = jest.spyOn(PluginManager.prototype, 'size', 'get');
|
|
7
|
+
export const hasPluginSpy = jest.spyOn(PluginManager.prototype, 'has');
|
|
8
|
+
export const getPluginSpy = jest.spyOn(PluginManager.prototype, 'get');
|
|
9
|
+
export const setPluginSpy = jest.spyOn(PluginManager.prototype, 'set');
|
|
10
|
+
export const clearPluginSpy = jest.spyOn(PluginManager.prototype, 'clear');
|
|
11
|
+
export const arrayPluginSpy = jest.spyOn(PluginManager.prototype, 'array');
|
|
12
|
+
export const storagePluginArraySpy = jest.spyOn(PluginManager.prototype, 'storagePluginArray');
|
|
13
|
+
export const apiPluginArraySpy = jest.spyOn(PluginManager.prototype, 'apiPluginArray');
|
|
14
|
+
export const iteratorPluginSpy = jest.spyOn(PluginManager.prototype, Symbol.iterator);
|
|
15
|
+
export const forEachPluginSpy = jest.spyOn(PluginManager.prototype, 'forEach');
|
|
16
|
+
export const logLevelPluginSpy = jest.spyOn(PluginManager.prototype, 'logLevel', 'set');
|
|
17
|
+
export const loadFromStoragePluginSpy = jest.spyOn(PluginManager.prototype, 'loadFromStorage');
|
|
18
|
+
export const saveToStoragePluginSpy = jest.spyOn(PluginManager.prototype, 'saveToStorage');
|
|
19
|
+
export const resolvePluginSpy = jest.spyOn(PluginManager.prototype, 'resolve');
|
|
20
|
+
export const installPluginSpy = jest.spyOn(PluginManager.prototype, 'install');
|
|
21
|
+
export const uninstallPluginSpy = jest.spyOn(PluginManager.prototype, 'uninstall');
|
|
22
|
+
export const getAuthorPluginSpy = jest.spyOn(PluginManager.prototype, 'getAuthor');
|
|
23
|
+
export const getDescriptionPluginSpy = jest.spyOn(PluginManager.prototype, 'getDescription');
|
|
24
|
+
export const getHomepagePluginSpy = jest.spyOn(PluginManager.prototype, 'getHomepage');
|
|
25
|
+
export const getHelpPluginSpy = jest.spyOn(PluginManager.prototype, 'getHelp');
|
|
26
|
+
export const getChangelogPluginSpy = jest.spyOn(PluginManager.prototype, 'getChangelog');
|
|
27
|
+
export const getFundingPluginSpy = jest.spyOn(PluginManager.prototype, 'getFunding');
|
|
28
|
+
export const parsePluginSpy = jest.spyOn(PluginManager.prototype, 'parse');
|
|
29
|
+
export const addPluginSpy = jest.spyOn(PluginManager.prototype, 'add');
|
|
30
|
+
export const enablePluginSpy = jest.spyOn(PluginManager.prototype, 'enable');
|
|
31
|
+
export const disablePluginSpy = jest.spyOn(PluginManager.prototype, 'disable');
|
|
32
|
+
export const removePluginSpy = jest.spyOn(PluginManager.prototype, 'remove');
|
|
33
|
+
export const loadPluginSpy = jest.spyOn(PluginManager.prototype, 'load');
|
|
34
|
+
export const startPluginSpy = jest.spyOn(PluginManager.prototype, 'start');
|
|
35
|
+
export const configurePluginSpy = jest.spyOn(PluginManager.prototype, 'configure');
|
|
36
|
+
export const shutdownPluginSpy = jest.spyOn(PluginManager.prototype, 'shutdown');
|
|
37
|
+
export const loadConfigPluginSpy = jest.spyOn(PluginManager.prototype, 'loadConfig');
|
|
38
|
+
export const saveConfigFromPluginPluginSpy = jest.spyOn(PluginManager.prototype, 'saveConfigFromPlugin');
|
|
39
|
+
export const saveConfigFromJsonPluginSpy = jest.spyOn(PluginManager.prototype, 'saveConfigFromJson');
|
|
40
|
+
export const loadSchemaPluginSpy = jest.spyOn(PluginManager.prototype, 'loadSchema');
|
|
41
|
+
export const getDefaultSchemaPluginSpy = jest.spyOn(PluginManager.prototype, 'getDefaultSchema');
|
package/dist/matterbridge.js
CHANGED
|
@@ -13,6 +13,7 @@ import { BasicInformationClient, BasicInformationServer } from '@matter/node/beh
|
|
|
13
13
|
import { AggregatorEndpoint } from '@matter/node/endpoints/aggregator';
|
|
14
14
|
import { PaseClient, Read, Subscribe } from '@matter/protocol';
|
|
15
15
|
import { DeviceTypeId, VendorId } from '@matter/types/datatype';
|
|
16
|
+
import { ManualPairingCodeCodec } from '@matter/types/schema';
|
|
16
17
|
import { BroadcastServer } from '@matterbridge/thread/server';
|
|
17
18
|
import { dev, MATTER_LOGGER_FILE, MATTER_STORAGE_DIR, MATTERBRIDGE_LOGGER_FILE, NODE_STORAGE_DIR, plg, typ } from '@matterbridge/types';
|
|
18
19
|
import { wait } from '@matterbridge/utils';
|
|
@@ -27,7 +28,6 @@ import { NodeStorageManager } from 'node-persist-manager';
|
|
|
27
28
|
import { DeviceManager } from './deviceManager.js';
|
|
28
29
|
import { Frontend } from './frontend.js';
|
|
29
30
|
import { addVirtualDevice, addVirtualDevices } from './helpers.js';
|
|
30
|
-
import { ManualPairingCodeCodec } from './matter/types.js';
|
|
31
31
|
import { bridge } from './matterbridgeDeviceTypes.js';
|
|
32
32
|
import { MatterbridgeEndpoint } from './matterbridgeEndpoint.js';
|
|
33
33
|
import { PluginManager } from './pluginManager.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@matterbridge/core",
|
|
3
|
-
"version": "3.7.4-dev-
|
|
3
|
+
"version": "3.7.4-dev-20260416-fabcd3f",
|
|
4
4
|
"description": "Matterbridge core library",
|
|
5
5
|
"author": "https://github.com/Luligu",
|
|
6
6
|
"homepage": "https://matterbridge.io/",
|
|
@@ -130,10 +130,10 @@
|
|
|
130
130
|
],
|
|
131
131
|
"dependencies": {
|
|
132
132
|
"@matter/main": "0.16.11",
|
|
133
|
-
"@matterbridge/dgram": "3.7.4-dev-
|
|
134
|
-
"@matterbridge/thread": "3.7.4-dev-
|
|
135
|
-
"@matterbridge/types": "3.7.4-dev-
|
|
136
|
-
"@matterbridge/utils": "3.7.4-dev-
|
|
133
|
+
"@matterbridge/dgram": "3.7.4-dev-20260416-fabcd3f",
|
|
134
|
+
"@matterbridge/thread": "3.7.4-dev-20260416-fabcd3f",
|
|
135
|
+
"@matterbridge/types": "3.7.4-dev-20260416-fabcd3f",
|
|
136
|
+
"@matterbridge/utils": "3.7.4-dev-20260416-fabcd3f",
|
|
137
137
|
"escape-html": "1.0.3",
|
|
138
138
|
"express": "5.2.1",
|
|
139
139
|
"express-rate-limit": "8.3.2",
|