@matterbridge/types 3.6.1-dev-20260310-6341dee → 3.6.1-dev-20260311-7da5ff8

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.
@@ -3,6 +3,7 @@ import { LogLevel } from 'node-ansi-logger';
3
3
  import type { RefreshRequiredChanged, WsMessageBroadcast } from './frontendTypes.js';
4
4
  import type { PlatformConfig, PlatformMatterbridge, PlatformSchema } from './matterbridgePlatformTypes.js';
5
5
  import type { ApiMatter, ApiPlugin, BaseDevice, SharedMatterbridge, StoragePlugin } from './matterbridgeTypes.js';
6
+ import { ThreadNames, WorkerData } from './workerTypes.js';
6
7
  export type WorkerSrcType = 'manager' | 'matterbridge' | 'plugins' | 'devices' | 'frontend' | 'matter' | 'platform' | 'spawn' | 'updates';
7
8
  export type WorkerDstType = 'manager' | 'matterbridge' | 'plugins' | 'devices' | 'frontend' | 'matter' | 'platform' | 'spawn' | 'updates' | 'all';
8
9
  type NormalizeRequest<T> = T extends {
@@ -117,8 +118,8 @@ export type WorkerMessageTypes = {
117
118
  manager_run: {
118
119
  request: {
119
120
  params: {
120
- name: string;
121
- workerData?: Record<string, boolean | number | string | object>;
121
+ name: ThreadNames;
122
+ workerData?: WorkerData;
122
123
  argv?: string[];
123
124
  env?: NodeJS.ProcessEnv;
124
125
  execArgv?: string[];
@@ -131,6 +132,20 @@ export type WorkerMessageTypes = {
131
132
  };
132
133
  };
133
134
  };
135
+ manager_spawn_response: {
136
+ request: {
137
+ params: undefined;
138
+ };
139
+ response: {
140
+ result: {
141
+ command: string;
142
+ args: string[];
143
+ packageCommand: 'install' | 'uninstall';
144
+ packageName: string;
145
+ success: boolean;
146
+ };
147
+ };
148
+ };
134
149
  matterbridge_initialize: {
135
150
  request: {
136
151
  params: undefined;
@@ -508,7 +523,6 @@ export type WorkerMessageTypes = {
508
523
  response: {
509
524
  result: {
510
525
  packageName: string;
511
- success: boolean;
512
526
  };
513
527
  };
514
528
  };
@@ -521,7 +535,6 @@ export type WorkerMessageTypes = {
521
535
  response: {
522
536
  result: {
523
537
  packageName: string;
524
- success: boolean;
525
538
  };
526
539
  };
527
540
  };
@@ -1,28 +1,51 @@
1
1
  import type { LogLevel } from 'node-ansi-logger';
2
2
  export type ThreadNames = 'SystemCheck' | 'GlobalPrefix' | 'CheckUpdates' | 'SpawnCommand';
3
+ export type BaseWorkerData = {
4
+ threadName: ThreadNames;
5
+ logLevel: LogLevel;
6
+ debug: boolean;
7
+ verbose: boolean;
8
+ tracker: boolean;
9
+ };
10
+ export type SpawnWorkerData = {
11
+ threadName: ThreadNames;
12
+ logLevel?: LogLevel;
13
+ debug?: boolean;
14
+ verbose?: boolean;
15
+ tracker?: boolean;
16
+ command: string;
17
+ args: string[];
18
+ packageCommand: 'install' | 'uninstall';
19
+ packageName: string;
20
+ };
21
+ export type WorkerData = BaseWorkerData | SpawnWorkerData;
22
+ export declare function isWorkerData(data: unknown): data is WorkerData;
23
+ export declare function isSpawnWorkerData(data: unknown): data is SpawnWorkerData;
3
24
  export type ParentPortMessage = {
4
25
  type: 'init';
5
- threadName: string | null;
26
+ threadName: ThreadNames;
6
27
  threadId: number;
28
+ memoryUsage: NodeJS.MemoryUsage;
7
29
  success: boolean;
8
30
  } | {
9
31
  type: 'ping';
10
- threadName: string | null;
32
+ threadName: ThreadNames;
11
33
  threadId: number;
12
34
  } | {
13
35
  type: 'pong';
14
- threadName: string | null;
36
+ threadName: ThreadNames;
15
37
  threadId: number;
16
38
  } | {
17
39
  type: 'log';
18
- threadName: string | null;
40
+ threadName: ThreadNames;
19
41
  threadId: number;
20
42
  logName: string | undefined;
21
43
  logLevel: LogLevel;
22
44
  message: string;
23
45
  } | {
24
46
  type: 'exit';
25
- threadName: string | null;
47
+ threadName: ThreadNames;
26
48
  threadId: number;
49
+ memoryUsage: NodeJS.MemoryUsage;
27
50
  success: boolean;
28
51
  };
@@ -1 +1,27 @@
1
- export {};
1
+ export function isWorkerData(data) {
2
+ return (typeof data === 'object' &&
3
+ data !== null &&
4
+ 'threadName' in data &&
5
+ typeof data.threadName === 'string' &&
6
+ 'logLevel' in data &&
7
+ typeof data.logLevel === 'string' &&
8
+ 'debug' in data &&
9
+ typeof data.debug === 'boolean' &&
10
+ 'verbose' in data &&
11
+ typeof data.verbose === 'boolean' &&
12
+ 'tracker' in data &&
13
+ typeof data.tracker === 'boolean');
14
+ }
15
+ export function isSpawnWorkerData(data) {
16
+ return (isWorkerData(data) &&
17
+ typeof data === 'object' &&
18
+ data !== null &&
19
+ 'command' in data &&
20
+ typeof data.command === 'string' &&
21
+ 'args' in data &&
22
+ Array.isArray(data.args) &&
23
+ 'packageCommand' in data &&
24
+ (data.packageCommand === 'install' || data.packageCommand === 'uninstall') &&
25
+ 'packageName' in data &&
26
+ typeof data.packageName === 'string');
27
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@matterbridge/types",
3
- "version": "3.6.1-dev-20260310-6341dee",
3
+ "version": "3.6.1-dev-20260311-7da5ff8",
4
4
  "description": "Matterbridge types library",
5
5
  "author": "https://github.com/Luligu",
6
6
  "homepage": "https://matterbridge.io/",