@matterbridge/core 3.9.5-dev-20260715-33298cd → 3.10.0-dev-20260716-7f8762c
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/behaviors/colorControlServer.d.ts +0 -15
- package/dist/behaviors/colorControlServer.js +0 -2
- package/dist/behaviors/thermostatServer.d.ts +0 -14
- package/dist/behaviors/thermostatServer.js +0 -2
- package/dist/behaviors/windowCoveringServer.d.ts +0 -26
- package/dist/behaviors/windowCoveringServer.js +0 -4
- package/dist/deviceManager.js +3 -1
- package/dist/matter/export.d.ts +0 -11
- package/dist/matter/export.js +0 -11
- package/dist/matterNode.d.ts +1 -1
- package/dist/matterNode.js +36 -13
- package/dist/matterbridge.js +19 -11
- package/dist/matterbridgeDeviceTypes.d.ts +0 -14
- package/dist/matterbridgeDeviceTypes.js +0 -14
- package/dist/matterbridgeEndpoint.d.ts +5 -4
- package/dist/matterbridgeEndpoint.js +39 -14
- package/dist/matterbridgeEndpointCommandHandler.d.ts +0 -75
- package/dist/matterbridgeEndpointTypes.d.ts +7 -0
- package/dist/matterbridgePlatform.js +1 -1
- package/package.json +5 -9
- package/dist/jestutils/export.d.ts +0 -13
- package/dist/jestutils/export.js +0 -13
- package/dist/jestutils/flushAsync.d.ts +0 -1
- package/dist/jestutils/flushAsync.js +0 -8
- package/dist/jestutils/jestBroadcastServerSpy.d.ts +0 -13
- package/dist/jestutils/jestBroadcastServerSpy.js +0 -14
- package/dist/jestutils/jestDeviceManagerSpy.d.ts +0 -14
- package/dist/jestutils/jestDeviceManagerSpy.js +0 -15
- package/dist/jestutils/jestFrontendSpy.d.ts +0 -7
- package/dist/jestutils/jestFrontendSpy.js +0 -8
- package/dist/jestutils/jestMatterTest.d.ts +0 -21
- package/dist/jestutils/jestMatterTest.js +0 -281
- package/dist/jestutils/jestMatterbridgeEndpointSpy.d.ts +0 -7
- package/dist/jestutils/jestMatterbridgeEndpointSpy.js +0 -8
- package/dist/jestutils/jestMatterbridgePlatformSpy.d.ts +0 -43
- package/dist/jestutils/jestMatterbridgePlatformSpy.js +0 -44
- package/dist/jestutils/jestMatterbridgeSpy.d.ts +0 -5
- package/dist/jestutils/jestMatterbridgeSpy.js +0 -6
- package/dist/jestutils/jestMatterbridgeTest.d.ts +0 -21
- package/dist/jestutils/jestMatterbridgeTest.js +0 -252
- package/dist/jestutils/jestPluginManagerSpy.d.ts +0 -40
- package/dist/jestutils/jestPluginManagerSpy.js +0 -41
- package/dist/jestutils/jestSetupTest.d.ts +0 -20
- package/dist/jestutils/jestSetupTest.js +0 -79
- package/dist/jestutils/logKeepAlives.d.ts +0 -2
- package/dist/jestutils/logKeepAlives.js +0 -31
- package/dist/jestutils/matterRequest.d.ts +0 -10
- package/dist/jestutils/matterRequest.js +0 -78
|
@@ -1,252 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { Environment, RuntimeService } from '@matter/general';
|
|
3
|
-
import { MdnsService } from '@matter/protocol';
|
|
4
|
-
import { MATTER_STORAGE_DIR, NODE_STORAGE_DIR } from '@matterbridge/types';
|
|
5
|
-
import { rs, UNDERLINE, UNDERLINEOFF } from 'node-ansi-logger';
|
|
6
|
-
import { NodeStorageManager } from 'node-persist-manager';
|
|
7
|
-
import { Matterbridge } from '../matterbridge.js';
|
|
8
|
-
import { flushAsync } from './flushAsync.js';
|
|
9
|
-
import { assertAllEndpointNumbersPersisted, createTestEnvironment, flushAllEndpointNumberPersistence } from './jestMatterTest.js';
|
|
10
|
-
import { HOMEDIR, loggerLogSpy, originalProcessArgv } from './jestSetupTest.js';
|
|
11
|
-
let server;
|
|
12
|
-
let aggregator;
|
|
13
|
-
export let matterbridge;
|
|
14
|
-
export let frontend;
|
|
15
|
-
export let plugins;
|
|
16
|
-
export let devices;
|
|
17
|
-
export async function startMatterbridge(bridgeMode = 'bridge', frontendPort = 8283, matterPort = 5540, passcode = 20252026, discriminator = 3840, pluginSize = 0, devicesSize = 0) {
|
|
18
|
-
process.env['MATTERBRIDGE_START_MATTER_INTERVAL_MS'] = '100';
|
|
19
|
-
process.env['MATTERBRIDGE_PAUSE_MATTER_INTERVAL_MS'] = '100';
|
|
20
|
-
process.argv.length = 0;
|
|
21
|
-
process.argv.push(...originalProcessArgv, '--novirtual', '--debug', '--verbose', '--logger', 'debug', '--matterlogger', 'debug', bridgeMode === '' ? '--test' : '--' + bridgeMode, '--homedir', HOMEDIR, '--frontend', frontendPort.toString(), '--port', matterPort.toString(), '--passcode', passcode.toString(), '--discriminator', discriminator.toString());
|
|
22
|
-
expect(Matterbridge.instance).toBeUndefined();
|
|
23
|
-
matterbridge = await Matterbridge.loadInstance(true);
|
|
24
|
-
expect(matterbridge.environment).toBeDefined();
|
|
25
|
-
expect(matterbridge.systemCheckTimeout).toBeDefined();
|
|
26
|
-
expect(matterbridge.checkUpdateTimeout).toBeDefined();
|
|
27
|
-
expect(matterbridge.checkUpdateInterval).toBeDefined();
|
|
28
|
-
clearTimeout(matterbridge.systemCheckTimeout);
|
|
29
|
-
clearTimeout(matterbridge.checkUpdateTimeout);
|
|
30
|
-
clearInterval(matterbridge.checkUpdateInterval);
|
|
31
|
-
expect(matterbridge).toBeDefined();
|
|
32
|
-
expect(matterbridge.profile).toBeUndefined();
|
|
33
|
-
expect(matterbridge.bridgeMode).toBe(bridgeMode);
|
|
34
|
-
frontend = matterbridge.frontend;
|
|
35
|
-
plugins = matterbridge.plugins;
|
|
36
|
-
devices = matterbridge.devices;
|
|
37
|
-
expect(matterbridge.initialized).toBeTruthy();
|
|
38
|
-
expect(matterbridge.log).toBeDefined();
|
|
39
|
-
expect(matterbridge.rootDirectory).toBe(path.resolve('./'));
|
|
40
|
-
expect(matterbridge.homeDirectory).toBe(path.join(HOMEDIR));
|
|
41
|
-
expect(matterbridge.matterbridgeDirectory).toBe(path.join(HOMEDIR, '.matterbridge'));
|
|
42
|
-
expect(matterbridge.matterbridgePluginDirectory).toBe(path.join(HOMEDIR, 'Matterbridge'));
|
|
43
|
-
expect(matterbridge.matterbridgeCertDirectory).toBe(path.join(HOMEDIR, '.mattercert'));
|
|
44
|
-
expect(plugins).toBeDefined();
|
|
45
|
-
expect(plugins.size).toBe(pluginSize);
|
|
46
|
-
expect(devices).toBeDefined();
|
|
47
|
-
expect(devices.size).toBe(devicesSize);
|
|
48
|
-
expect(frontend).toBeDefined();
|
|
49
|
-
expect(frontend.listening).toBeTruthy();
|
|
50
|
-
expect(frontend.httpServer).toBeDefined();
|
|
51
|
-
expect(frontend.httpsServer).toBeUndefined();
|
|
52
|
-
expect(frontend.expressApp).toBeDefined();
|
|
53
|
-
expect(frontend.webSocketServer).toBeDefined();
|
|
54
|
-
expect(matterbridge.nodeStorage).toBeDefined();
|
|
55
|
-
expect(matterbridge.nodeContext).toBeDefined();
|
|
56
|
-
expect(Environment.default.vars.get('path.root')).toBe(path.join(matterbridge.matterbridgeDirectory, MATTER_STORAGE_DIR));
|
|
57
|
-
expect(matterbridge.matterStorageService).toBeDefined();
|
|
58
|
-
expect(matterbridge.matterStorageManager).toBeDefined();
|
|
59
|
-
expect(matterbridge.matterbridgeContext).toBeDefined();
|
|
60
|
-
expect(matterbridge.controllerContext).toBeUndefined();
|
|
61
|
-
if (bridgeMode === 'bridge') {
|
|
62
|
-
expect(matterbridge.serverNode).toBeDefined();
|
|
63
|
-
expect(matterbridge.aggregatorNode).toBeDefined();
|
|
64
|
-
}
|
|
65
|
-
expect(matterbridge.mdnsInterface).toBe(undefined);
|
|
66
|
-
expect(matterbridge.port).toBe(matterPort + (bridgeMode === 'bridge' ? 1 : 0));
|
|
67
|
-
expect(matterbridge.passcode).toBe(passcode + (bridgeMode === 'bridge' ? 1 : 0));
|
|
68
|
-
expect(matterbridge.discriminator).toBe(discriminator + (bridgeMode === 'bridge' ? 1 : 0));
|
|
69
|
-
if (bridgeMode === 'bridge') {
|
|
70
|
-
const started = new Promise((resolve) => {
|
|
71
|
-
matterbridge.once('bridge_started', () => {
|
|
72
|
-
resolve();
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
const online = new Promise((resolve) => {
|
|
76
|
-
matterbridge.once('online', (name) => {
|
|
77
|
-
if (name === 'Matterbridge')
|
|
78
|
-
resolve();
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
await Promise.all([started, online]);
|
|
82
|
-
}
|
|
83
|
-
else if (bridgeMode === 'childbridge') {
|
|
84
|
-
await new Promise((resolve) => {
|
|
85
|
-
matterbridge.once('childbridge_started', () => {
|
|
86
|
-
resolve();
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
expect(loggerLogSpy).toHaveBeenCalledWith("info", `The frontend http server is listening on ${UNDERLINE}http://${matterbridge.systemInformation.ipv4Address}:${frontendPort}${UNDERLINEOFF}${rs}`);
|
|
91
|
-
if (bridgeMode === 'bridge') {
|
|
92
|
-
expect(loggerLogSpy).toHaveBeenCalledWith("notice", `Starting Matterbridge server node`);
|
|
93
|
-
expect(loggerLogSpy).toHaveBeenCalledWith("notice", `Server node for Matterbridge is online`);
|
|
94
|
-
expect(loggerLogSpy).toHaveBeenCalledWith("debug", `Starting start matter interval in bridge mode...`);
|
|
95
|
-
expect(loggerLogSpy).toHaveBeenCalledWith("debug", `Cleared startMatterInterval interval in bridge mode`);
|
|
96
|
-
expect(loggerLogSpy).toHaveBeenCalledWith("notice", `Matterbridge bridge started successfully`);
|
|
97
|
-
}
|
|
98
|
-
else if (bridgeMode === 'childbridge') {
|
|
99
|
-
expect(loggerLogSpy).toHaveBeenCalledWith("debug", `Starting start matter interval in childbridge mode...`);
|
|
100
|
-
expect(loggerLogSpy).toHaveBeenCalledWith("debug", `Cleared startMatterInterval interval in childbridge mode`);
|
|
101
|
-
expect(loggerLogSpy).toHaveBeenCalledWith("notice", `Matterbridge childbridge started successfully`);
|
|
102
|
-
}
|
|
103
|
-
return matterbridge;
|
|
104
|
-
}
|
|
105
|
-
export async function stopMatterbridge(cleanupPause = 10, destroyPause = 250, closeMdns = false, closeRuntime = false) {
|
|
106
|
-
await destroyMatterbridgeEnvironment(cleanupPause, destroyPause, closeMdns, closeRuntime);
|
|
107
|
-
}
|
|
108
|
-
export async function createMatterbridgeEnvironment() {
|
|
109
|
-
matterbridge = await Matterbridge.loadInstance(false);
|
|
110
|
-
expect(matterbridge).toBeDefined();
|
|
111
|
-
expect(matterbridge).toBeInstanceOf(Matterbridge);
|
|
112
|
-
matterbridge.matterbridgeVersion = '3.9.5';
|
|
113
|
-
matterbridge.bridgeMode = 'bridge';
|
|
114
|
-
matterbridge.rootDirectory = path.join(HOMEDIR);
|
|
115
|
-
matterbridge.homeDirectory = path.join(HOMEDIR);
|
|
116
|
-
matterbridge.matterbridgeDirectory = path.join(HOMEDIR, '.matterbridge');
|
|
117
|
-
matterbridge.matterbridgePluginDirectory = path.join(HOMEDIR, 'Matterbridge');
|
|
118
|
-
matterbridge.matterbridgeCertDirectory = path.join(HOMEDIR, '.mattercert');
|
|
119
|
-
matterbridge.log.logLevel = "debug";
|
|
120
|
-
frontend = matterbridge.frontend;
|
|
121
|
-
plugins = matterbridge.plugins;
|
|
122
|
-
devices = matterbridge.devices;
|
|
123
|
-
const environment = await createTestEnvironment();
|
|
124
|
-
expect(environment).toBeDefined();
|
|
125
|
-
expect(environment).toBeInstanceOf(Environment);
|
|
126
|
-
matterbridge.environment = environment;
|
|
127
|
-
return matterbridge;
|
|
128
|
-
}
|
|
129
|
-
export async function startMatterbridgeEnvironment(port = 5540, createOnly = false) {
|
|
130
|
-
matterbridge.nodeStorage = new NodeStorageManager({
|
|
131
|
-
dir: path.join(matterbridge.matterbridgeDirectory, NODE_STORAGE_DIR),
|
|
132
|
-
writeQueue: false,
|
|
133
|
-
expiredInterval: undefined,
|
|
134
|
-
logging: false,
|
|
135
|
-
});
|
|
136
|
-
matterbridge.nodeContext = await matterbridge.nodeStorage.createStorage('matterbridge');
|
|
137
|
-
await matterbridge.startMatterStorage();
|
|
138
|
-
expect(matterbridge.matterStorageService).toBeDefined();
|
|
139
|
-
expect(matterbridge.matterStorageManager).toBeDefined();
|
|
140
|
-
expect(matterbridge.matterbridgeContext).toBeDefined();
|
|
141
|
-
server = await matterbridge.createServerNode(matterbridge.matterbridgeContext, port);
|
|
142
|
-
expect(server).toBeDefined();
|
|
143
|
-
expect(server).toBeDefined();
|
|
144
|
-
expect(server.lifecycle.isReady).toBeTruthy();
|
|
145
|
-
matterbridge.serverNode = server;
|
|
146
|
-
aggregator = await matterbridge.createAggregatorNode(matterbridge.matterbridgeContext);
|
|
147
|
-
expect(aggregator).toBeDefined();
|
|
148
|
-
matterbridge.aggregatorNode = aggregator;
|
|
149
|
-
expect(await server.add(aggregator)).toBeDefined();
|
|
150
|
-
expect(server.parts.has(aggregator.id)).toBeTruthy();
|
|
151
|
-
expect(server.parts.has(aggregator)).toBeTruthy();
|
|
152
|
-
expect(aggregator.lifecycle.isReady).toBeTruthy();
|
|
153
|
-
if (createOnly) {
|
|
154
|
-
await flushAsync();
|
|
155
|
-
return [server, aggregator];
|
|
156
|
-
}
|
|
157
|
-
expect(server.lifecycle.isOnline).toBeFalsy();
|
|
158
|
-
await new Promise((resolve, reject) => {
|
|
159
|
-
server.lifecycle.online.on(() => {
|
|
160
|
-
resolve();
|
|
161
|
-
});
|
|
162
|
-
server.start().catch((err) => reject(err));
|
|
163
|
-
});
|
|
164
|
-
expect(server.lifecycle.isReady).toBeTruthy();
|
|
165
|
-
expect(server.lifecycle.isOnline).toBeTruthy();
|
|
166
|
-
expect(server.lifecycle.isCommissioned).toBeFalsy();
|
|
167
|
-
expect(server.lifecycle.isPartsReady).toBeTruthy();
|
|
168
|
-
expect(server.lifecycle.hasId).toBeTruthy();
|
|
169
|
-
expect(server.lifecycle.hasNumber).toBeTruthy();
|
|
170
|
-
expect(aggregator.lifecycle.isReady).toBeTruthy();
|
|
171
|
-
expect(aggregator.lifecycle.isInstalled).toBeTruthy();
|
|
172
|
-
expect(aggregator.lifecycle.isPartsReady).toBeTruthy();
|
|
173
|
-
expect(aggregator.lifecycle.hasId).toBeTruthy();
|
|
174
|
-
expect(aggregator.lifecycle.hasNumber).toBeTruthy();
|
|
175
|
-
await flushAsync();
|
|
176
|
-
return [server, aggregator];
|
|
177
|
-
}
|
|
178
|
-
export function addMatterbridgePlatform(platform, name) {
|
|
179
|
-
expect(platform).toBeDefined();
|
|
180
|
-
platform.setMatterNode?.(matterbridge.addBridgedEndpoint.bind(matterbridge), matterbridge.removeBridgedEndpoint.bind(matterbridge), matterbridge.removeAllBridgedEndpoints.bind(matterbridge), matterbridge.addVirtualEndpoint.bind(matterbridge));
|
|
181
|
-
if (name)
|
|
182
|
-
platform.config.name = name;
|
|
183
|
-
expect(platform.config.name).toBeDefined();
|
|
184
|
-
expect(platform.config.type).toBeDefined();
|
|
185
|
-
expect(platform.type).toBeDefined();
|
|
186
|
-
expect(platform.config.version).toBeDefined();
|
|
187
|
-
expect(platform.version).toBeDefined();
|
|
188
|
-
expect(platform.config.debug).toBeDefined();
|
|
189
|
-
expect(platform.config.unregisterOnShutdown).toBeDefined();
|
|
190
|
-
matterbridge.plugins._plugins.set(platform.config.name, {
|
|
191
|
-
name: platform.config.name,
|
|
192
|
-
path: './',
|
|
193
|
-
type: platform.type,
|
|
194
|
-
version: platform.version,
|
|
195
|
-
description: 'Plugin ' + platform.config.name,
|
|
196
|
-
author: 'Unknown',
|
|
197
|
-
enabled: true,
|
|
198
|
-
registeredDevices: 0,
|
|
199
|
-
});
|
|
200
|
-
platform['name'] = platform.config.name;
|
|
201
|
-
}
|
|
202
|
-
export async function stopMatterbridgeEnvironment(createOnly = false) {
|
|
203
|
-
expect(matterbridge).toBeDefined();
|
|
204
|
-
expect(server).toBeDefined();
|
|
205
|
-
expect(aggregator).toBeDefined();
|
|
206
|
-
await flushAllEndpointNumberPersistence(server);
|
|
207
|
-
await assertAllEndpointNumbersPersisted(server);
|
|
208
|
-
expect(server.lifecycle.isReady).toBeTruthy();
|
|
209
|
-
if (!createOnly) {
|
|
210
|
-
expect(server.lifecycle.isOnline).toBeTruthy();
|
|
211
|
-
}
|
|
212
|
-
await server.close();
|
|
213
|
-
expect(server.lifecycle.isReady).toBeFalsy();
|
|
214
|
-
expect(server.lifecycle.isOnline).toBeFalsy();
|
|
215
|
-
await matterbridge.stopMatterStorage();
|
|
216
|
-
expect(matterbridge.matterStorageService).not.toBeDefined();
|
|
217
|
-
expect(matterbridge.matterStorageManager).not.toBeDefined();
|
|
218
|
-
expect(matterbridge.matterbridgeContext).not.toBeDefined();
|
|
219
|
-
await matterbridge.nodeContext?.close();
|
|
220
|
-
matterbridge.nodeContext = undefined;
|
|
221
|
-
await matterbridge.nodeStorage?.close();
|
|
222
|
-
matterbridge.nodeStorage = undefined;
|
|
223
|
-
await flushAsync();
|
|
224
|
-
}
|
|
225
|
-
export async function destroyMatterbridgeEnvironment(cleanupPause = 10, destroyPause = 100, closeMdns = false, closeRuntime = false) {
|
|
226
|
-
await destroyInstance(matterbridge, cleanupPause, destroyPause);
|
|
227
|
-
if (closeMdns) {
|
|
228
|
-
await closeMdnsInstance(matterbridge);
|
|
229
|
-
}
|
|
230
|
-
if (closeRuntime) {
|
|
231
|
-
await closeRuntimeInstance(matterbridge);
|
|
232
|
-
}
|
|
233
|
-
Matterbridge.instance = undefined;
|
|
234
|
-
}
|
|
235
|
-
export async function destroyInstance(matterbridge, cleanupPause = 10, destroyPause = 10) {
|
|
236
|
-
await matterbridge.cleanup('destroying instance...', false, cleanupPause);
|
|
237
|
-
if (destroyPause > 0)
|
|
238
|
-
await flushAsync(undefined, undefined, destroyPause);
|
|
239
|
-
}
|
|
240
|
-
export async function closeMdnsInstance(matterbridge) {
|
|
241
|
-
const environment = matterbridge.environment;
|
|
242
|
-
const mdns = environment.maybeGet(MdnsService);
|
|
243
|
-
if (!mdns)
|
|
244
|
-
return;
|
|
245
|
-
await mdns.close();
|
|
246
|
-
environment.delete(MdnsService, mdns);
|
|
247
|
-
}
|
|
248
|
-
export async function closeRuntimeInstance(matterbridge) {
|
|
249
|
-
const environment = matterbridge.environment;
|
|
250
|
-
const runtime = environment.maybeGet(RuntimeService);
|
|
251
|
-
await runtime?.close();
|
|
252
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { PluginManager } from '../pluginManager.js';
|
|
2
|
-
export declare const destroyPluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.destroy>;
|
|
3
|
-
export declare const checkDependenciesPluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.checkDependencies>;
|
|
4
|
-
export declare const lengthPluginSpy: jest.SpiedGetter<typeof PluginManager.prototype.length>;
|
|
5
|
-
export declare const sizePluginSpy: jest.SpiedGetter<typeof PluginManager.prototype.size>;
|
|
6
|
-
export declare const hasPluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.has>;
|
|
7
|
-
export declare const getPluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.get>;
|
|
8
|
-
export declare const setPluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.set>;
|
|
9
|
-
export declare const clearPluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.clear>;
|
|
10
|
-
export declare const arrayPluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.array>;
|
|
11
|
-
export declare const storagePluginArraySpy: jest.SpiedFunction<typeof PluginManager.prototype.storagePluginArray>;
|
|
12
|
-
export declare const apiPluginArraySpy: jest.SpiedFunction<typeof PluginManager.prototype.apiPluginArray>;
|
|
13
|
-
export declare const iteratorPluginSpy: jest.SpiedFunction<(typeof PluginManager.prototype)[typeof Symbol.iterator]>;
|
|
14
|
-
export declare const forEachPluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.forEach>;
|
|
15
|
-
export declare const logLevelPluginSpy: jest.SpiedSetter<typeof PluginManager.prototype.logLevel>;
|
|
16
|
-
export declare const loadFromStoragePluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.loadFromStorage>;
|
|
17
|
-
export declare const saveToStoragePluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.saveToStorage>;
|
|
18
|
-
export declare const resolvePluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.resolve>;
|
|
19
|
-
export declare const installPluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.install>;
|
|
20
|
-
export declare const uninstallPluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.uninstall>;
|
|
21
|
-
export declare const getAuthorPluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.getAuthor>;
|
|
22
|
-
export declare const getDescriptionPluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.getDescription>;
|
|
23
|
-
export declare const getHomepagePluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.getHomepage>;
|
|
24
|
-
export declare const getHelpPluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.getHelp>;
|
|
25
|
-
export declare const getChangelogPluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.getChangelog>;
|
|
26
|
-
export declare const getFundingPluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.getFunding>;
|
|
27
|
-
export declare const parsePluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.parse>;
|
|
28
|
-
export declare const addPluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.add>;
|
|
29
|
-
export declare const enablePluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.enable>;
|
|
30
|
-
export declare const disablePluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.disable>;
|
|
31
|
-
export declare const removePluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.remove>;
|
|
32
|
-
export declare const loadPluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.load>;
|
|
33
|
-
export declare const startPluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.start>;
|
|
34
|
-
export declare const configurePluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.configure>;
|
|
35
|
-
export declare const shutdownPluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.shutdown>;
|
|
36
|
-
export declare const loadConfigPluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.loadConfig>;
|
|
37
|
-
export declare const saveConfigFromPluginPluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.saveConfigFromPlugin>;
|
|
38
|
-
export declare const saveConfigFromJsonPluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.saveConfigFromJson>;
|
|
39
|
-
export declare const loadSchemaPluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.loadSchema>;
|
|
40
|
-
export declare const getDefaultSchemaPluginSpy: jest.SpiedFunction<typeof PluginManager.prototype.getDefaultSchema>;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { PluginManager } from '../pluginManager.js';
|
|
2
|
-
const { jest } = await import('@jest/globals');
|
|
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');
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { AnsiLogger } from 'node-ansi-logger';
|
|
2
|
-
export declare const originalProcessArgv: readonly string[];
|
|
3
|
-
export declare const originalProcessEnv: Readonly<Record<string, string | undefined>>;
|
|
4
|
-
export declare let loggerLogSpy: jest.SpiedFunction<typeof AnsiLogger.prototype.log>;
|
|
5
|
-
export declare let loggerDebugSpy: jest.SpiedFunction<typeof AnsiLogger.prototype.debug>;
|
|
6
|
-
export declare let loggerInfoSpy: jest.SpiedFunction<typeof AnsiLogger.prototype.info>;
|
|
7
|
-
export declare let loggerNoticeSpy: jest.SpiedFunction<typeof AnsiLogger.prototype.notice>;
|
|
8
|
-
export declare let loggerWarnSpy: jest.SpiedFunction<typeof AnsiLogger.prototype.warn>;
|
|
9
|
-
export declare let loggerErrorSpy: jest.SpiedFunction<typeof AnsiLogger.prototype.error>;
|
|
10
|
-
export declare let loggerFatalSpy: jest.SpiedFunction<typeof AnsiLogger.prototype.fatal>;
|
|
11
|
-
export declare let consoleLogSpy: jest.SpiedFunction<typeof console.log>;
|
|
12
|
-
export declare let consoleDebugSpy: jest.SpiedFunction<typeof console.debug>;
|
|
13
|
-
export declare let consoleInfoSpy: jest.SpiedFunction<typeof console.info>;
|
|
14
|
-
export declare let consoleWarnSpy: jest.SpiedFunction<typeof console.warn>;
|
|
15
|
-
export declare let consoleErrorSpy: jest.SpiedFunction<typeof console.error>;
|
|
16
|
-
export declare let NAME: string;
|
|
17
|
-
export declare let HOMEDIR: string;
|
|
18
|
-
export declare let log: AnsiLogger;
|
|
19
|
-
export declare function setupTest(name: string, debug?: boolean): Promise<void>;
|
|
20
|
-
export declare function setDebug(debug: boolean): Promise<void>;
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { mkdirSync, rmSync } from 'node:fs';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { AnsiLogger } from 'node-ansi-logger';
|
|
4
|
-
export const originalProcessArgv = Object.freeze([...process.argv]);
|
|
5
|
-
export const originalProcessEnv = Object.freeze({ ...process.env });
|
|
6
|
-
export let loggerLogSpy;
|
|
7
|
-
export let loggerDebugSpy;
|
|
8
|
-
export let loggerInfoSpy;
|
|
9
|
-
export let loggerNoticeSpy;
|
|
10
|
-
export let loggerWarnSpy;
|
|
11
|
-
export let loggerErrorSpy;
|
|
12
|
-
export let loggerFatalSpy;
|
|
13
|
-
export let consoleLogSpy;
|
|
14
|
-
export let consoleDebugSpy;
|
|
15
|
-
export let consoleInfoSpy;
|
|
16
|
-
export let consoleWarnSpy;
|
|
17
|
-
export let consoleErrorSpy;
|
|
18
|
-
const noop = () => undefined;
|
|
19
|
-
export let NAME;
|
|
20
|
-
export let HOMEDIR;
|
|
21
|
-
export let log;
|
|
22
|
-
export async function setupTest(name, debug = false) {
|
|
23
|
-
expect(name).toBeDefined();
|
|
24
|
-
expect(typeof name).toBe('string');
|
|
25
|
-
expect(name.length).toBeGreaterThanOrEqual(4);
|
|
26
|
-
NAME = name;
|
|
27
|
-
HOMEDIR = path.join('.cache', 'jest', name);
|
|
28
|
-
log = new AnsiLogger({ logName: name, logTimestampFormat: 4, logLevel: "debug" });
|
|
29
|
-
rmSync(HOMEDIR, { recursive: true, force: true });
|
|
30
|
-
mkdirSync(HOMEDIR, { recursive: true });
|
|
31
|
-
const { jest } = await import('@jest/globals');
|
|
32
|
-
loggerDebugSpy = jest.spyOn(AnsiLogger.prototype, 'debug');
|
|
33
|
-
loggerInfoSpy = jest.spyOn(AnsiLogger.prototype, 'info');
|
|
34
|
-
loggerNoticeSpy = jest.spyOn(AnsiLogger.prototype, 'notice');
|
|
35
|
-
loggerWarnSpy = jest.spyOn(AnsiLogger.prototype, 'warn');
|
|
36
|
-
loggerErrorSpy = jest.spyOn(AnsiLogger.prototype, 'error');
|
|
37
|
-
loggerFatalSpy = jest.spyOn(AnsiLogger.prototype, 'fatal');
|
|
38
|
-
if (debug) {
|
|
39
|
-
loggerLogSpy = jest.spyOn(AnsiLogger.prototype, 'log');
|
|
40
|
-
consoleLogSpy = jest.spyOn(console, 'log');
|
|
41
|
-
consoleDebugSpy = jest.spyOn(console, 'debug');
|
|
42
|
-
consoleInfoSpy = jest.spyOn(console, 'info');
|
|
43
|
-
consoleWarnSpy = jest.spyOn(console, 'warn');
|
|
44
|
-
consoleErrorSpy = jest.spyOn(console, 'error');
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
loggerLogSpy = jest.spyOn(AnsiLogger.prototype, 'log').mockImplementation(noop);
|
|
48
|
-
consoleLogSpy = jest.spyOn(console, 'log').mockImplementation(noop);
|
|
49
|
-
consoleDebugSpy = jest.spyOn(console, 'debug').mockImplementation(noop);
|
|
50
|
-
consoleInfoSpy = jest.spyOn(console, 'info').mockImplementation(noop);
|
|
51
|
-
consoleWarnSpy = jest.spyOn(console, 'warn').mockImplementation(noop);
|
|
52
|
-
consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(noop);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
export async function setDebug(debug) {
|
|
56
|
-
const { jest } = await import('@jest/globals');
|
|
57
|
-
if (debug) {
|
|
58
|
-
loggerLogSpy.mockRestore();
|
|
59
|
-
consoleLogSpy.mockRestore();
|
|
60
|
-
consoleDebugSpy.mockRestore();
|
|
61
|
-
consoleInfoSpy.mockRestore();
|
|
62
|
-
consoleWarnSpy.mockRestore();
|
|
63
|
-
consoleErrorSpy.mockRestore();
|
|
64
|
-
loggerLogSpy = jest.spyOn(AnsiLogger.prototype, 'log');
|
|
65
|
-
consoleLogSpy = jest.spyOn(console, 'log');
|
|
66
|
-
consoleDebugSpy = jest.spyOn(console, 'debug');
|
|
67
|
-
consoleInfoSpy = jest.spyOn(console, 'info');
|
|
68
|
-
consoleWarnSpy = jest.spyOn(console, 'warn');
|
|
69
|
-
consoleErrorSpy = jest.spyOn(console, 'error');
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
loggerLogSpy = jest.spyOn(AnsiLogger.prototype, 'log').mockImplementation(noop);
|
|
73
|
-
consoleLogSpy = jest.spyOn(console, 'log').mockImplementation(noop);
|
|
74
|
-
consoleDebugSpy = jest.spyOn(console, 'debug').mockImplementation(noop);
|
|
75
|
-
consoleInfoSpy = jest.spyOn(console, 'info').mockImplementation(noop);
|
|
76
|
-
consoleWarnSpy = jest.spyOn(console, 'warn').mockImplementation(noop);
|
|
77
|
-
consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(noop);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { inspect } from 'node:util';
|
|
2
|
-
import { rs } from 'node-ansi-logger';
|
|
3
|
-
export function logKeepAlives(log) {
|
|
4
|
-
const handles = process._getActiveHandles?.() ?? [];
|
|
5
|
-
const requests = process._getActiveRequests?.() ?? [];
|
|
6
|
-
const fmtHandle = (h, i) => {
|
|
7
|
-
const ctor = h?.constructor?.name ?? 'Unknown';
|
|
8
|
-
const hasRef = typeof h?.hasRef === 'function' ? h.hasRef() : undefined;
|
|
9
|
-
const isPort = h?.constructor?.name?.includes('MessagePort');
|
|
10
|
-
const fd = h?.fd ?? h?._handle?.fd;
|
|
11
|
-
return { i, type: ctor, hasRef, isPort, fd };
|
|
12
|
-
};
|
|
13
|
-
const fmtReq = (r, i) => {
|
|
14
|
-
const ctor = r?.constructor?.name ?? 'Unknown';
|
|
15
|
-
return { i, type: ctor };
|
|
16
|
-
};
|
|
17
|
-
const summary = {
|
|
18
|
-
handles: handles.map(fmtHandle),
|
|
19
|
-
requests: requests.map(fmtReq),
|
|
20
|
-
};
|
|
21
|
-
if (summary.handles.length === 0 && summary.requests.length === 0) {
|
|
22
|
-
log?.debug('KeepAlive: no active handles or requests.');
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
log?.debug(`KeepAlive:${rs}\n${inspect(summary, { depth: 5, colors: true })}`);
|
|
26
|
-
if (!log) {
|
|
27
|
-
process.stdout.write(`KeepAlive:\n${inspect(summary, { depth: 5, colors: true })}\n`);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return summary.handles.length + summary.requests.length;
|
|
31
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ColorControl } from '@matter/types/clusters/color-control';
|
|
2
|
-
import type { LevelControl } from '@matter/types/clusters/level-control';
|
|
3
|
-
export declare function getMoveToLevelRequest(level: number, transitionTime: number, executeIfOff: boolean): LevelControl.MoveToLevelRequest;
|
|
4
|
-
export declare function getMoveToColorTemperatureRequest(colorTemperatureMireds: number, transitionTime: number, executeIfOff: boolean): ColorControl.MoveToColorTemperatureRequest;
|
|
5
|
-
export declare function getMoveToHueRequest(hue: number, transitionTime: number, executeIfOff: boolean): ColorControl.MoveToHueRequest;
|
|
6
|
-
export declare function getEnhancedMoveToHueRequest(enhancedHue: number, transitionTime: number, executeIfOff: boolean): ColorControl.EnhancedMoveToHueRequest;
|
|
7
|
-
export declare function getMoveToSaturationRequest(saturation: number, transitionTime: number, executeIfOff: boolean): ColorControl.MoveToSaturationRequest;
|
|
8
|
-
export declare function getMoveToHueAndSaturationRequest(hue: number, saturation: number, transitionTime: number, executeIfOff: boolean): ColorControl.MoveToHueAndSaturationRequest;
|
|
9
|
-
export declare function getEnhancedMoveToHueAndSaturationRequest(enhancedHue: number, saturation: number, transitionTime: number, executeIfOff: boolean): ColorControl.EnhancedMoveToHueAndSaturationRequest;
|
|
10
|
-
export declare function getMoveToColorRequest(colorX: number, colorY: number, transitionTime: number, executeIfOff: boolean): ColorControl.MoveToColorRequest;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { ColorControl } from '@matter/types/clusters/color-control';
|
|
2
|
-
export function getMoveToLevelRequest(level, transitionTime, executeIfOff) {
|
|
3
|
-
const request = {
|
|
4
|
-
level,
|
|
5
|
-
transitionTime,
|
|
6
|
-
optionsMask: { executeIfOff, coupleColorTempToLevel: false },
|
|
7
|
-
optionsOverride: { executeIfOff, coupleColorTempToLevel: false },
|
|
8
|
-
};
|
|
9
|
-
return request;
|
|
10
|
-
}
|
|
11
|
-
export function getMoveToColorTemperatureRequest(colorTemperatureMireds, transitionTime, executeIfOff) {
|
|
12
|
-
const request = {
|
|
13
|
-
colorTemperatureMireds,
|
|
14
|
-
transitionTime,
|
|
15
|
-
optionsMask: { executeIfOff },
|
|
16
|
-
optionsOverride: { executeIfOff },
|
|
17
|
-
};
|
|
18
|
-
return request;
|
|
19
|
-
}
|
|
20
|
-
export function getMoveToHueRequest(hue, transitionTime, executeIfOff) {
|
|
21
|
-
const request = {
|
|
22
|
-
hue,
|
|
23
|
-
transitionTime,
|
|
24
|
-
direction: ColorControl.Direction.Shortest,
|
|
25
|
-
optionsMask: { executeIfOff },
|
|
26
|
-
optionsOverride: { executeIfOff },
|
|
27
|
-
};
|
|
28
|
-
return request;
|
|
29
|
-
}
|
|
30
|
-
export function getEnhancedMoveToHueRequest(enhancedHue, transitionTime, executeIfOff) {
|
|
31
|
-
const request = {
|
|
32
|
-
enhancedHue,
|
|
33
|
-
transitionTime,
|
|
34
|
-
direction: ColorControl.Direction.Shortest,
|
|
35
|
-
optionsMask: { executeIfOff },
|
|
36
|
-
optionsOverride: { executeIfOff },
|
|
37
|
-
};
|
|
38
|
-
return request;
|
|
39
|
-
}
|
|
40
|
-
export function getMoveToSaturationRequest(saturation, transitionTime, executeIfOff) {
|
|
41
|
-
const request = {
|
|
42
|
-
saturation,
|
|
43
|
-
transitionTime,
|
|
44
|
-
optionsMask: { executeIfOff },
|
|
45
|
-
optionsOverride: { executeIfOff },
|
|
46
|
-
};
|
|
47
|
-
return request;
|
|
48
|
-
}
|
|
49
|
-
export function getMoveToHueAndSaturationRequest(hue, saturation, transitionTime, executeIfOff) {
|
|
50
|
-
const request = {
|
|
51
|
-
hue,
|
|
52
|
-
saturation,
|
|
53
|
-
transitionTime,
|
|
54
|
-
optionsMask: { executeIfOff },
|
|
55
|
-
optionsOverride: { executeIfOff },
|
|
56
|
-
};
|
|
57
|
-
return request;
|
|
58
|
-
}
|
|
59
|
-
export function getEnhancedMoveToHueAndSaturationRequest(enhancedHue, saturation, transitionTime, executeIfOff) {
|
|
60
|
-
const request = {
|
|
61
|
-
enhancedHue,
|
|
62
|
-
saturation,
|
|
63
|
-
transitionTime,
|
|
64
|
-
optionsMask: { executeIfOff },
|
|
65
|
-
optionsOverride: { executeIfOff },
|
|
66
|
-
};
|
|
67
|
-
return request;
|
|
68
|
-
}
|
|
69
|
-
export function getMoveToColorRequest(colorX, colorY, transitionTime, executeIfOff) {
|
|
70
|
-
const request = {
|
|
71
|
-
colorX,
|
|
72
|
-
colorY,
|
|
73
|
-
transitionTime,
|
|
74
|
-
optionsMask: { executeIfOff },
|
|
75
|
-
optionsOverride: { executeIfOff },
|
|
76
|
-
};
|
|
77
|
-
return request;
|
|
78
|
-
}
|