@companion-module/host 0.1.0-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -0
- package/dist/__tests__/ipc-wrapper.spec.d.ts +2 -0
- package/dist/__tests__/ipc-wrapper.spec.d.ts.map +1 -0
- package/dist/__tests__/ipc-wrapper.spec.js +272 -0
- package/dist/__tests__/ipc-wrapper.spec.js.map +1 -0
- package/dist/api.d.ts +360 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +8 -0
- package/dist/api.js.map +1 -0
- package/dist/context.d.ts +125 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +2 -0
- package/dist/context.js.map +1 -0
- package/dist/instance.d.ts +51 -0
- package/dist/instance.d.ts.map +1 -0
- package/dist/instance.js +317 -0
- package/dist/instance.js.map +1 -0
- package/dist/internal/__tests__/feedback.spec.d.ts +2 -0
- package/dist/internal/__tests__/feedback.spec.d.ts.map +1 -0
- package/dist/internal/__tests__/feedback.spec.js +686 -0
- package/dist/internal/__tests__/feedback.spec.js.map +1 -0
- package/dist/internal/__tests__/serializeIsVisibleFn.spec.d.ts +2 -0
- package/dist/internal/__tests__/serializeIsVisibleFn.spec.d.ts.map +1 -0
- package/dist/internal/__tests__/serializeIsVisibleFn.spec.js +119 -0
- package/dist/internal/__tests__/serializeIsVisibleFn.spec.js.map +1 -0
- package/dist/internal/__tests__/upgrade.spec.d.ts +2 -0
- package/dist/internal/__tests__/upgrade.spec.d.ts.map +1 -0
- package/dist/internal/__tests__/upgrade.spec.js +280 -0
- package/dist/internal/__tests__/upgrade.spec.js.map +1 -0
- package/dist/internal/actions.d.ts +16 -0
- package/dist/internal/actions.d.ts.map +1 -0
- package/dist/internal/actions.js +212 -0
- package/dist/internal/actions.js.map +1 -0
- package/dist/internal/base.d.ts +4 -0
- package/dist/internal/base.d.ts.map +1 -0
- package/dist/internal/base.js +31 -0
- package/dist/internal/base.js.map +1 -0
- package/dist/internal/feedback.d.ts +19 -0
- package/dist/internal/feedback.d.ts.map +1 -0
- package/dist/internal/feedback.js +296 -0
- package/dist/internal/feedback.js.map +1 -0
- package/dist/internal/upgrade.d.ts +15 -0
- package/dist/internal/upgrade.d.ts.map +1 -0
- package/dist/internal/upgrade.js +168 -0
- package/dist/internal/upgrade.js.map +1 -0
- package/dist/ipc-wrapper.d.ts +37 -0
- package/dist/ipc-wrapper.d.ts.map +1 -0
- package/dist/ipc-wrapper.js +123 -0
- package/dist/ipc-wrapper.js.map +1 -0
- package/dist/logging.d.ts +3 -0
- package/dist/logging.d.ts.map +1 -0
- package/dist/logging.js +4 -0
- package/dist/logging.js.map +1 -0
- package/dist/main.d.ts +5 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +5 -0
- package/dist/main.js.map +1 -0
- package/dist/plugin.d.ts +25 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +301 -0
- package/dist/plugin.js.map +1 -0
- package/dist/versions.d.ts +10 -0
- package/dist/versions.d.ts.map +1 -0
- package/dist/versions.js +2 -0
- package/dist/versions.js.map +1 -0
- package/package.json +31 -0
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# @companion-module/host
|
|
2
|
+
|
|
3
|
+
Host-side wrapper library for Companion Module(Connection) plugins.
|
|
4
|
+
|
|
5
|
+
This package provides the host-side API that wraps the modules written with the `@companion-module/base` API with additional logic that runs in-process. It is designed to support multiple versions of the base API and provide a uniform interface back to the host application.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @companion-module/host
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
For example usage, check [Companion](https://github.com/bitfocus/companion/) for an example implementation
|
|
16
|
+
|
|
17
|
+
## Development
|
|
18
|
+
|
|
19
|
+
This package is part of a monorepo. See the root README for development instructions.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ipc-wrapper.spec.d.ts","sourceRoot":"","sources":["../../src/__tests__/ipc-wrapper.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { describe, test, expect, beforeEach, vi, beforeAll } from 'vitest';
|
|
2
|
+
import { IpcWrapper } from '../ipc-wrapper.js';
|
|
3
|
+
function stringifyError(err) {
|
|
4
|
+
return JSON.stringify(err, Object.getOwnPropertyNames(err));
|
|
5
|
+
}
|
|
6
|
+
describe('IpcWrapper', () => {
|
|
7
|
+
const sendMessageFn = vi.fn();
|
|
8
|
+
const testRecv1Fn = vi.fn();
|
|
9
|
+
const testRecv2Fn = vi.fn();
|
|
10
|
+
let ipc;
|
|
11
|
+
beforeAll(() => {
|
|
12
|
+
vi.useFakeTimers();
|
|
13
|
+
});
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
sendMessageFn.mockClear();
|
|
16
|
+
testRecv1Fn.mockClear();
|
|
17
|
+
testRecv2Fn.mockClear();
|
|
18
|
+
ipc = new IpcWrapper({
|
|
19
|
+
recvTest1: testRecv1Fn,
|
|
20
|
+
recvTest2: testRecv2Fn,
|
|
21
|
+
}, sendMessageFn, 100);
|
|
22
|
+
});
|
|
23
|
+
test('send without callback', () => {
|
|
24
|
+
ipc.sendWithNoCb('sendTest2', 1);
|
|
25
|
+
expect(sendMessageFn).toHaveBeenCalledTimes(1);
|
|
26
|
+
expect(sendMessageFn).toHaveBeenCalledWith({
|
|
27
|
+
direction: 'call',
|
|
28
|
+
name: 'sendTest2',
|
|
29
|
+
payload: '1',
|
|
30
|
+
callbackId: undefined,
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
describe('send with callback', () => {
|
|
34
|
+
test('timeout', async () => {
|
|
35
|
+
const result = ipc.sendWithCb('sendTest1', 23);
|
|
36
|
+
result.catch(() => null); // suppress unhandled promise rejection warning
|
|
37
|
+
expect(result).toBeTruthy(); // should be a promise
|
|
38
|
+
expect(sendMessageFn).toHaveBeenCalledTimes(1);
|
|
39
|
+
expect(sendMessageFn).toHaveBeenCalledWith({
|
|
40
|
+
direction: 'call',
|
|
41
|
+
name: 'sendTest1',
|
|
42
|
+
payload: '23',
|
|
43
|
+
callbackId: 1,
|
|
44
|
+
});
|
|
45
|
+
vi.advanceTimersByTime(101);
|
|
46
|
+
await expect(result).rejects.toThrow('Call timed out');
|
|
47
|
+
});
|
|
48
|
+
test('returns success', async () => {
|
|
49
|
+
const result = ipc.sendWithCb('sendTest1', 23);
|
|
50
|
+
result.catch(() => null); // suppress unhandled promise rejection warning
|
|
51
|
+
expect(result).toBeTruthy(); // should be a promise
|
|
52
|
+
expect(sendMessageFn).toHaveBeenCalledTimes(1);
|
|
53
|
+
expect(sendMessageFn).toHaveBeenCalledWith({
|
|
54
|
+
direction: 'call',
|
|
55
|
+
name: 'sendTest1',
|
|
56
|
+
payload: '23',
|
|
57
|
+
callbackId: 1,
|
|
58
|
+
});
|
|
59
|
+
ipc.receivedMessage({
|
|
60
|
+
direction: 'response',
|
|
61
|
+
callbackId: 1,
|
|
62
|
+
success: true,
|
|
63
|
+
payload: '42',
|
|
64
|
+
});
|
|
65
|
+
await expect(result).resolves.toEqual(42);
|
|
66
|
+
});
|
|
67
|
+
test('returns object', async () => {
|
|
68
|
+
const result = ipc.sendWithCb('sendTest1', 23);
|
|
69
|
+
result.catch(() => null); // suppress unhandled promise rejection warning
|
|
70
|
+
expect(result).toBeTruthy(); // should be a promise
|
|
71
|
+
expect(sendMessageFn).toHaveBeenCalledTimes(1);
|
|
72
|
+
expect(sendMessageFn).toHaveBeenCalledWith({
|
|
73
|
+
direction: 'call',
|
|
74
|
+
name: 'sendTest1',
|
|
75
|
+
payload: '23',
|
|
76
|
+
callbackId: 1,
|
|
77
|
+
});
|
|
78
|
+
ipc.receivedMessage({
|
|
79
|
+
direction: 'response',
|
|
80
|
+
callbackId: 1,
|
|
81
|
+
success: true,
|
|
82
|
+
payload: JSON.stringify({ value: 42 }),
|
|
83
|
+
});
|
|
84
|
+
await expect(result).resolves.toEqual({ value: 42 });
|
|
85
|
+
});
|
|
86
|
+
test('throw error', async () => {
|
|
87
|
+
const result = ipc.sendWithCb('sendTest1', 23);
|
|
88
|
+
result.catch(() => null); // suppress unhandled promise rejection warning
|
|
89
|
+
expect(result).toBeTruthy(); // should be a promise
|
|
90
|
+
expect(sendMessageFn).toHaveBeenCalledTimes(1);
|
|
91
|
+
expect(sendMessageFn).toHaveBeenCalledWith({
|
|
92
|
+
direction: 'call',
|
|
93
|
+
name: 'sendTest1',
|
|
94
|
+
payload: '23',
|
|
95
|
+
callbackId: 1,
|
|
96
|
+
});
|
|
97
|
+
ipc.receivedMessage({
|
|
98
|
+
direction: 'response',
|
|
99
|
+
callbackId: 1,
|
|
100
|
+
success: false,
|
|
101
|
+
payload: stringifyError(new Error('my error')),
|
|
102
|
+
});
|
|
103
|
+
await expect(result).rejects.toThrow(`my error`);
|
|
104
|
+
});
|
|
105
|
+
test('throw error as string', async () => {
|
|
106
|
+
const result = ipc.sendWithCb('sendTest1', 23);
|
|
107
|
+
result.catch(() => null); // suppress unhandled promise rejection warning
|
|
108
|
+
expect(result).toBeTruthy(); // should be a promise
|
|
109
|
+
expect(sendMessageFn).toHaveBeenCalledTimes(1);
|
|
110
|
+
expect(sendMessageFn).toHaveBeenCalledWith({
|
|
111
|
+
direction: 'call',
|
|
112
|
+
name: 'sendTest1',
|
|
113
|
+
payload: '23',
|
|
114
|
+
callbackId: 1,
|
|
115
|
+
});
|
|
116
|
+
ipc.receivedMessage({
|
|
117
|
+
direction: 'response',
|
|
118
|
+
callbackId: 1,
|
|
119
|
+
success: false,
|
|
120
|
+
payload: '"error as string"',
|
|
121
|
+
});
|
|
122
|
+
await expect(result).rejects.toEqual('error as string');
|
|
123
|
+
});
|
|
124
|
+
test('throw null', async () => {
|
|
125
|
+
const result = ipc.sendWithCb('sendTest1', 23);
|
|
126
|
+
result.catch(() => null); // suppress unhandled promise rejection warning
|
|
127
|
+
expect(result).toBeTruthy(); // should be a promise
|
|
128
|
+
expect(sendMessageFn).toHaveBeenCalledTimes(1);
|
|
129
|
+
expect(sendMessageFn).toHaveBeenCalledWith({
|
|
130
|
+
direction: 'call',
|
|
131
|
+
name: 'sendTest1',
|
|
132
|
+
payload: '23',
|
|
133
|
+
callbackId: 1,
|
|
134
|
+
});
|
|
135
|
+
ipc.receivedMessage({
|
|
136
|
+
direction: 'response',
|
|
137
|
+
callbackId: 1,
|
|
138
|
+
success: false,
|
|
139
|
+
payload: JSON.stringify(null),
|
|
140
|
+
});
|
|
141
|
+
await expect(result).rejects.toEqual(null);
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
test('receive without callback', () => {
|
|
145
|
+
testRecv1Fn.mockImplementation(async () => {
|
|
146
|
+
return 67;
|
|
147
|
+
});
|
|
148
|
+
ipc.receivedMessage({
|
|
149
|
+
direction: 'call',
|
|
150
|
+
name: 'recvTest1',
|
|
151
|
+
payload: '42',
|
|
152
|
+
callbackId: undefined,
|
|
153
|
+
});
|
|
154
|
+
expect(testRecv1Fn).toHaveBeenCalledTimes(1);
|
|
155
|
+
expect(testRecv1Fn).toHaveBeenCalledWith(42);
|
|
156
|
+
vi.advanceTimersByTime(101);
|
|
157
|
+
expect(sendMessageFn).toHaveBeenCalledTimes(0);
|
|
158
|
+
});
|
|
159
|
+
describe('receive with callback', () => {
|
|
160
|
+
test('returns success', async () => {
|
|
161
|
+
testRecv2Fn.mockImplementation(async () => {
|
|
162
|
+
return 67;
|
|
163
|
+
});
|
|
164
|
+
ipc.receivedMessage({
|
|
165
|
+
direction: 'call',
|
|
166
|
+
name: 'recvTest2',
|
|
167
|
+
payload: '42',
|
|
168
|
+
callbackId: 456,
|
|
169
|
+
});
|
|
170
|
+
expect(testRecv2Fn).toHaveBeenCalledTimes(1);
|
|
171
|
+
expect(testRecv2Fn).toHaveBeenCalledWith(42);
|
|
172
|
+
await vi.advanceTimersByTimeAsync(201);
|
|
173
|
+
expect(sendMessageFn).toHaveBeenCalledTimes(1);
|
|
174
|
+
expect(sendMessageFn).toHaveBeenCalledWith({
|
|
175
|
+
direction: 'response',
|
|
176
|
+
success: true,
|
|
177
|
+
payload: '67',
|
|
178
|
+
callbackId: 456,
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
test('returns object', async () => {
|
|
182
|
+
testRecv2Fn.mockImplementation(async () => {
|
|
183
|
+
return { value: 88 };
|
|
184
|
+
});
|
|
185
|
+
ipc.receivedMessage({
|
|
186
|
+
direction: 'call',
|
|
187
|
+
name: 'recvTest2',
|
|
188
|
+
payload: '42',
|
|
189
|
+
callbackId: 456,
|
|
190
|
+
});
|
|
191
|
+
expect(testRecv2Fn).toHaveBeenCalledTimes(1);
|
|
192
|
+
expect(testRecv2Fn).toHaveBeenCalledWith(42);
|
|
193
|
+
await vi.advanceTimersByTimeAsync(201);
|
|
194
|
+
expect(sendMessageFn).toHaveBeenCalledTimes(1);
|
|
195
|
+
expect(sendMessageFn).toHaveBeenCalledWith({
|
|
196
|
+
direction: 'response',
|
|
197
|
+
success: true,
|
|
198
|
+
payload: JSON.stringify({ value: 88 }),
|
|
199
|
+
callbackId: 456,
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
test('throw error', async () => {
|
|
203
|
+
let error;
|
|
204
|
+
testRecv2Fn.mockImplementation(async () => {
|
|
205
|
+
error = new Error('my error');
|
|
206
|
+
throw error;
|
|
207
|
+
});
|
|
208
|
+
ipc.receivedMessage({
|
|
209
|
+
direction: 'call',
|
|
210
|
+
name: 'recvTest2',
|
|
211
|
+
payload: '42',
|
|
212
|
+
callbackId: 456,
|
|
213
|
+
});
|
|
214
|
+
expect(testRecv2Fn).toHaveBeenCalledTimes(1);
|
|
215
|
+
expect(testRecv2Fn).toHaveBeenCalledWith(42);
|
|
216
|
+
expect(error).toBeTruthy();
|
|
217
|
+
await vi.advanceTimersByTimeAsync(201);
|
|
218
|
+
expect(sendMessageFn).toHaveBeenCalledTimes(1);
|
|
219
|
+
expect(sendMessageFn).toHaveBeenCalledWith({
|
|
220
|
+
direction: 'response',
|
|
221
|
+
success: false,
|
|
222
|
+
payload: stringifyError(error),
|
|
223
|
+
callbackId: 456,
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
test('throw error as string', async () => {
|
|
227
|
+
testRecv2Fn.mockImplementation(async () => {
|
|
228
|
+
// eslint-disable-next-line @typescript-eslint/only-throw-error
|
|
229
|
+
throw 'my error message';
|
|
230
|
+
});
|
|
231
|
+
ipc.receivedMessage({
|
|
232
|
+
direction: 'call',
|
|
233
|
+
name: 'recvTest2',
|
|
234
|
+
payload: '42',
|
|
235
|
+
callbackId: 456,
|
|
236
|
+
});
|
|
237
|
+
expect(testRecv2Fn).toHaveBeenCalledTimes(1);
|
|
238
|
+
expect(testRecv2Fn).toHaveBeenCalledWith(42);
|
|
239
|
+
await vi.advanceTimersByTimeAsync(201);
|
|
240
|
+
expect(sendMessageFn).toHaveBeenCalledTimes(1);
|
|
241
|
+
expect(sendMessageFn).toHaveBeenCalledWith({
|
|
242
|
+
direction: 'response',
|
|
243
|
+
success: false,
|
|
244
|
+
payload: '"my error message"',
|
|
245
|
+
callbackId: 456,
|
|
246
|
+
});
|
|
247
|
+
});
|
|
248
|
+
test('throw null', async () => {
|
|
249
|
+
testRecv2Fn.mockImplementation(async () => {
|
|
250
|
+
// eslint-disable-next-line @typescript-eslint/only-throw-error
|
|
251
|
+
throw null;
|
|
252
|
+
});
|
|
253
|
+
ipc.receivedMessage({
|
|
254
|
+
direction: 'call',
|
|
255
|
+
name: 'recvTest2',
|
|
256
|
+
payload: '42',
|
|
257
|
+
callbackId: 456,
|
|
258
|
+
});
|
|
259
|
+
expect(testRecv2Fn).toHaveBeenCalledTimes(1);
|
|
260
|
+
expect(testRecv2Fn).toHaveBeenCalledWith(42);
|
|
261
|
+
await vi.advanceTimersByTimeAsync(201);
|
|
262
|
+
expect(sendMessageFn).toHaveBeenCalledTimes(1);
|
|
263
|
+
expect(sendMessageFn).toHaveBeenCalledWith({
|
|
264
|
+
direction: 'response',
|
|
265
|
+
success: false,
|
|
266
|
+
payload: 'null',
|
|
267
|
+
callbackId: 456,
|
|
268
|
+
});
|
|
269
|
+
});
|
|
270
|
+
});
|
|
271
|
+
});
|
|
272
|
+
//# sourceMappingURL=ipc-wrapper.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ipc-wrapper.spec.js","sourceRoot":"","sources":["../../src/__tests__/ipc-wrapper.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAW9C,SAAS,cAAc,CAAC,GAAU;IACjC,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAA;AAC5D,CAAC;AAED,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC3B,MAAM,aAAa,GAAG,EAAE,CAAC,EAAE,EAAE,CAAA;IAE7B,MAAM,WAAW,GAAG,EAAE,CAAC,EAAE,EAAuB,CAAA;IAChD,MAAM,WAAW,GAAG,EAAE,CAAC,EAAE,EAAuB,CAAA;IAChD,IAAI,GAA4C,CAAA;IAEhD,SAAS,CAAC,GAAG,EAAE;QACd,EAAE,CAAC,aAAa,EAAE,CAAA;IACnB,CAAC,CAAC,CAAA;IAEF,UAAU,CAAC,GAAG,EAAE;QACf,aAAa,CAAC,SAAS,EAAE,CAAA;QACzB,WAAW,CAAC,SAAS,EAAE,CAAA;QACvB,WAAW,CAAC,SAAS,EAAE,CAAA;QAEvB,GAAG,GAAG,IAAI,UAAU,CACnB;YACC,SAAS,EAAE,WAAW;YACtB,SAAS,EAAE,WAAW;SACtB,EACD,aAAa,EACb,GAAG,CACH,CAAA;IACF,CAAC,CAAC,CAA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ist/api.d.ts
ADDED
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Warning: these types are intentionally semi-isolated from the module-api folder.
|
|
3
|
+
* While it causes a lot of duplicate typings and requires us to do translation of types,
|
|
4
|
+
* it allows for us to be selective as to whether a change impacts the module api or the host api.
|
|
5
|
+
* This will allow for cleaner and more stable apis which can both evolve at different rates
|
|
6
|
+
*/
|
|
7
|
+
import type { CompanionFeedbackButtonStyleResult, OSCSomeArguments, SomeCompanionConfigField, SomeCompanionFeedbackInputField, InstanceStatus, LogLevel, CompanionOptionValues, CompanionInputFieldBase, CompanionButtonPresetDefinition, CompanionTextPresetDefinition, CompanionHTTPRequest, CompanionHTTPResponse, SomeCompanionActionInputField, CompanionVariableValue, OptionsObject, JsonValue } from '@companion-module/base';
|
|
8
|
+
import type { SharedUdpSocketMessage, SharedUdpSocketMessageJoin, SharedUdpSocketMessageLeave, SharedUdpSocketMessageSend } from '@companion-module/base/dist/host-api/context.js';
|
|
9
|
+
export interface ModuleToHostEventsV0 extends ModuleToHostEventsV0SharedSocket {
|
|
10
|
+
/** The connection has a message for the Companion log */
|
|
11
|
+
'log-message': (msg: LogMessageMessage) => never;
|
|
12
|
+
/** The connection status has changed */
|
|
13
|
+
'set-status': (msg: SetStatusMessage) => never;
|
|
14
|
+
/** The actions available in the connection have changed */
|
|
15
|
+
setActionDefinitions: (msg: SetActionDefinitionsMessage) => never;
|
|
16
|
+
/** The feedbacks available in the connection have changed */
|
|
17
|
+
setFeedbackDefinitions: (msg: SetFeedbackDefinitionsMessage) => never;
|
|
18
|
+
/** The varaibles available in the connection have changed */
|
|
19
|
+
setVariableDefinitions: (msg: SetVariableDefinitionsMessage) => never;
|
|
20
|
+
/** The presets provided by the connection have changed */
|
|
21
|
+
setPresetDefinitions: (msg: SetPresetDefinitionsMessage) => never;
|
|
22
|
+
/** The connection has some new values for variables */
|
|
23
|
+
setVariableValues: (msg: SetVariableValuesMessage) => never;
|
|
24
|
+
/** The connection has some new values for feedbacks it is running */
|
|
25
|
+
updateFeedbackValues: (msg: UpdateFeedbackValuesMessage) => never;
|
|
26
|
+
/** The connection has updated its config, which should be persisted */
|
|
27
|
+
saveConfig: (msg: SaveConfigMessage) => never;
|
|
28
|
+
/** Send an OSC message from the default osc listener in companion */
|
|
29
|
+
'send-osc': (msg: SendOscMessage) => never;
|
|
30
|
+
/**
|
|
31
|
+
* Parse the variables in a string of text.
|
|
32
|
+
* This has been semi depricated in favor of the companion parsing the options before the module.
|
|
33
|
+
*/
|
|
34
|
+
parseVariablesInString: (msg: ParseVariablesInStringMessage) => ParseVariablesInStringResponseMessage;
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated Replaced with explicit upgrade call in 1.13.0
|
|
37
|
+
* The connection has upgraded some actions/feedbacks it has been informed about to a new version of its definitions
|
|
38
|
+
*/
|
|
39
|
+
upgradedItems: (msg: UpgradedDataResponseMessage) => void;
|
|
40
|
+
/** When the action-recorder is running, the module has recorded an action to add to the recorded stack */
|
|
41
|
+
recordAction: (msg: RecordActionMessage) => never;
|
|
42
|
+
/**
|
|
43
|
+
* The connection has a new value for a custom variable
|
|
44
|
+
* Note: This should only be used by a few internal modules, it is not intended for general use
|
|
45
|
+
*/
|
|
46
|
+
setCustomVariable: (msg: SetCustomVariableMessage) => never;
|
|
47
|
+
}
|
|
48
|
+
export interface ModuleToHostEventsV0SharedSocket {
|
|
49
|
+
sharedUdpSocketJoin: (msg: SharedUdpSocketMessageJoin) => string;
|
|
50
|
+
sharedUdpSocketLeave: (msg: SharedUdpSocketMessageLeave) => void;
|
|
51
|
+
sharedUdpSocketSend: (msg: SharedUdpSocketMessageSend) => void;
|
|
52
|
+
}
|
|
53
|
+
export interface HostToModuleEventsV0 extends HostToModuleEventsV0SharedSocket {
|
|
54
|
+
/** Initialise the connection with the given config and label */
|
|
55
|
+
init: (msg: InitMessage) => InitResponseMessage;
|
|
56
|
+
/** Cleanup the connection in preparation for the thread/process to be terminated */
|
|
57
|
+
destroy: (msg: Record<string, never>) => void;
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated Replaced with updateConfigAndLabel in 1.2.0
|
|
60
|
+
* This is the same as `updateConfigAndLabel` but without the label
|
|
61
|
+
*/
|
|
62
|
+
updateConfig: (config: unknown) => void;
|
|
63
|
+
/** The connection config or label has been updated by the user */
|
|
64
|
+
updateConfigAndLabel: (msg: UpdateConfigAndLabelMessage) => void;
|
|
65
|
+
/**
|
|
66
|
+
* Some feedbacks for this connection have been created/updated/removed. This will start them being executed, watching for state changes in the connection and any referenced variables
|
|
67
|
+
* Since 1.13.0, the options will have variables pre-parsed. Subscribe/unsubscribe would be called as needed, and the feedbacks would start to be executed
|
|
68
|
+
* Prior to 1.13.0, this would also run upgrade scripts on the feedbacks
|
|
69
|
+
*/
|
|
70
|
+
updateFeedbacks: (msg: UpdateFeedbackInstancesMessage) => void;
|
|
71
|
+
/**
|
|
72
|
+
* Some actions for this connection have been created/updated/removed
|
|
73
|
+
* Since 1.13.0, the options will have variables pre-parsed. Subscribe/unsubscribe would be called as needed
|
|
74
|
+
* Prior to 1.13.0, this would also run upgrade scripts on the actions
|
|
75
|
+
*/
|
|
76
|
+
updateActions: (msg: UpdateActionInstancesMessage) => void;
|
|
77
|
+
/**
|
|
78
|
+
* Run the upgrade scripts for the provided actions and feedbacks
|
|
79
|
+
* Available since 1.13.0. Prior to this, the upgrade scripts would be run as part of the `updateActions` and `updateFeedbacks` calls
|
|
80
|
+
* The options objects provided here are in their 'raw' form, and can contain expressions
|
|
81
|
+
*/
|
|
82
|
+
upgradeActionsAndFeedbacks: (msg: UpgradeActionAndFeedbackInstancesMessage) => UpgradeActionAndFeedbackInstancesResponse;
|
|
83
|
+
/** Execute an action */
|
|
84
|
+
executeAction: (msg: ExecuteActionMessage) => ExecuteActionResponseMessage | undefined;
|
|
85
|
+
/** Get the config fields for this connection */
|
|
86
|
+
getConfigFields: (msg: GetConfigFieldsMessage) => GetConfigFieldsResponseMessage;
|
|
87
|
+
/** Handle an incoming HTTP request */
|
|
88
|
+
handleHttpRequest: (msg: HandleHttpRequestMessage) => HandleHttpRequestResponseMessage;
|
|
89
|
+
/**
|
|
90
|
+
* Learn the options for an action
|
|
91
|
+
* This allows the module to update the options for an action based on the current state of the device
|
|
92
|
+
*/
|
|
93
|
+
learnAction: (msg: LearnActionMessage) => LearnActionResponseMessage;
|
|
94
|
+
/**
|
|
95
|
+
* Learn the options for an feedback
|
|
96
|
+
* This allows the module to update the options for an feedback based on the current state of the device
|
|
97
|
+
*/
|
|
98
|
+
learnFeedback: (msg: LearnFeedbackMessage) => LearnFeedbackResponseMessage;
|
|
99
|
+
/**
|
|
100
|
+
* Start or stop the action-recorder.
|
|
101
|
+
* When running, this lets the connection emit `recordAction` events when the state of the device changes.
|
|
102
|
+
* This allows users to record macros of actions for their device by changing properties on the device itself.
|
|
103
|
+
*/
|
|
104
|
+
startStopRecordActions: (msg: StartStopRecordActionsMessage) => void;
|
|
105
|
+
/**
|
|
106
|
+
* @deprecated Replaced by companion parsing the options before the module in 1.13.0
|
|
107
|
+
* Prior to 1.13.0, this would notify the module that a variable it had parsed during a feedback had changed and let it re-run the feedback
|
|
108
|
+
*/
|
|
109
|
+
variablesChanged: (msg: VariablesChangedMessage) => never;
|
|
110
|
+
}
|
|
111
|
+
export interface HostToModuleEventsV0SharedSocket {
|
|
112
|
+
sharedUdpSocketMessage: (msg: SharedUdpSocketMessage) => never;
|
|
113
|
+
sharedUdpSocketError: (msg: SharedUdpSocketError) => never;
|
|
114
|
+
}
|
|
115
|
+
export type EncodeIsVisible<T extends CompanionInputFieldBase> = Omit<T, 'isVisible' | 'isVisibleExpression'> & {
|
|
116
|
+
isVisibleFn?: string;
|
|
117
|
+
isVisibleFnType?: 'function' | 'expression';
|
|
118
|
+
};
|
|
119
|
+
export interface InitMessage {
|
|
120
|
+
label: string;
|
|
121
|
+
isFirstInit: boolean;
|
|
122
|
+
config: unknown;
|
|
123
|
+
secrets: unknown;
|
|
124
|
+
lastUpgradeIndex: number;
|
|
125
|
+
/** @deprecated not populated/used since 1.13.0 */
|
|
126
|
+
feedbacks: {
|
|
127
|
+
[id: string]: FeedbackInstance | undefined;
|
|
128
|
+
};
|
|
129
|
+
/** @deprecated not populated/used since 1.13.0 */
|
|
130
|
+
actions: {
|
|
131
|
+
[id: string]: ActionInstance | undefined;
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
export interface InitResponseMessage {
|
|
135
|
+
hasHttpHandler: boolean;
|
|
136
|
+
hasRecordActionsHandler: boolean;
|
|
137
|
+
newUpgradeIndex: number;
|
|
138
|
+
disableNewConfigLayout: boolean;
|
|
139
|
+
updatedConfig: unknown | undefined;
|
|
140
|
+
updatedSecrets: unknown | undefined;
|
|
141
|
+
}
|
|
142
|
+
export interface UpgradedDataResponseMessage {
|
|
143
|
+
updatedFeedbacks: {
|
|
144
|
+
[id: string]: (FeedbackInstanceBase & {
|
|
145
|
+
controlId: string;
|
|
146
|
+
style?: Partial<CompanionFeedbackButtonStyleResult>;
|
|
147
|
+
isInverted: boolean;
|
|
148
|
+
}) | undefined;
|
|
149
|
+
};
|
|
150
|
+
updatedActions: {
|
|
151
|
+
[id: string]: (ActionInstanceBase & {
|
|
152
|
+
controlId: string;
|
|
153
|
+
}) | undefined;
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
export type GetConfigFieldsMessage = Record<string, never>;
|
|
157
|
+
export type SomeEncodedCompanionConfigField = EncodeIsVisible<SomeCompanionConfigField>;
|
|
158
|
+
export interface GetConfigFieldsResponseMessage {
|
|
159
|
+
fields: SomeEncodedCompanionConfigField[];
|
|
160
|
+
}
|
|
161
|
+
export interface LogMessageMessage {
|
|
162
|
+
level: LogLevel;
|
|
163
|
+
message: string;
|
|
164
|
+
}
|
|
165
|
+
export interface SetStatusMessage {
|
|
166
|
+
status: InstanceStatus;
|
|
167
|
+
message: string | null;
|
|
168
|
+
}
|
|
169
|
+
export interface SetActionDefinitionsMessage {
|
|
170
|
+
actions: Array<{
|
|
171
|
+
id: string;
|
|
172
|
+
name: string;
|
|
173
|
+
description: string | undefined;
|
|
174
|
+
options: EncodeIsVisible<SomeCompanionActionInputField>[];
|
|
175
|
+
optionsToIgnoreForSubscribe: string[] | undefined;
|
|
176
|
+
hasLearn: boolean;
|
|
177
|
+
learnTimeout: number | undefined;
|
|
178
|
+
hasLifecycleFunctions: boolean;
|
|
179
|
+
}>;
|
|
180
|
+
}
|
|
181
|
+
export interface SetFeedbackDefinitionsMessage {
|
|
182
|
+
feedbacks: Array<{
|
|
183
|
+
id: string;
|
|
184
|
+
name: string;
|
|
185
|
+
description: string | undefined;
|
|
186
|
+
options: EncodeIsVisible<SomeCompanionFeedbackInputField>[];
|
|
187
|
+
type: 'boolean' | 'value' | 'advanced';
|
|
188
|
+
defaultStyle?: CompanionFeedbackButtonStyleResult;
|
|
189
|
+
hasLearn: boolean;
|
|
190
|
+
showInvert: boolean | undefined;
|
|
191
|
+
learnTimeout: number | undefined;
|
|
192
|
+
}>;
|
|
193
|
+
}
|
|
194
|
+
export interface SetVariableDefinitionsMessage {
|
|
195
|
+
variables: Array<{
|
|
196
|
+
id: string;
|
|
197
|
+
name: string;
|
|
198
|
+
}>;
|
|
199
|
+
/** New in v1.7, optionally set values for variables at the same tiem */
|
|
200
|
+
newValues?: Array<{
|
|
201
|
+
id: string;
|
|
202
|
+
value: string | number | boolean | undefined;
|
|
203
|
+
}>;
|
|
204
|
+
}
|
|
205
|
+
export interface SetPresetDefinitionsMessage {
|
|
206
|
+
presets: Array<(CompanionButtonPresetDefinition | CompanionTextPresetDefinition) & {
|
|
207
|
+
id: string;
|
|
208
|
+
}>;
|
|
209
|
+
}
|
|
210
|
+
export interface SetVariableValuesMessage {
|
|
211
|
+
newValues: Array<{
|
|
212
|
+
id: string;
|
|
213
|
+
value: string | number | boolean | undefined;
|
|
214
|
+
}>;
|
|
215
|
+
}
|
|
216
|
+
export interface ExecuteActionMessage {
|
|
217
|
+
action: ActionInstance;
|
|
218
|
+
/** Identifier of the surface which triggered this action */
|
|
219
|
+
surfaceId: string | undefined;
|
|
220
|
+
}
|
|
221
|
+
export interface ExecuteActionResponseMessage {
|
|
222
|
+
success: boolean;
|
|
223
|
+
/** If success=false, a reason for the failure */
|
|
224
|
+
errorMessage: string | undefined;
|
|
225
|
+
}
|
|
226
|
+
export interface UpdateFeedbackValuesMessage {
|
|
227
|
+
values: Array<{
|
|
228
|
+
id: string;
|
|
229
|
+
controlId: string;
|
|
230
|
+
value: JsonValue | Partial<CompanionFeedbackButtonStyleResult> | undefined;
|
|
231
|
+
}>;
|
|
232
|
+
}
|
|
233
|
+
export interface FeedbackInstanceBase {
|
|
234
|
+
id: string;
|
|
235
|
+
upgradeIndex: number | null;
|
|
236
|
+
disabled: boolean;
|
|
237
|
+
feedbackId: string;
|
|
238
|
+
options: OptionsObject;
|
|
239
|
+
}
|
|
240
|
+
export interface FeedbackInstance extends FeedbackInstanceBase {
|
|
241
|
+
controlId: string;
|
|
242
|
+
isInverted: boolean;
|
|
243
|
+
/** If control supports an imageBuffer, the dimensions the buffer must be */
|
|
244
|
+
image?: {
|
|
245
|
+
width: number;
|
|
246
|
+
height: number;
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
export interface UpdateConfigAndLabelMessage {
|
|
250
|
+
label: string;
|
|
251
|
+
config: unknown | undefined;
|
|
252
|
+
secrets: unknown | undefined;
|
|
253
|
+
}
|
|
254
|
+
export interface UpdateFeedbackInstancesMessage {
|
|
255
|
+
feedbacks: {
|
|
256
|
+
[id: string]: FeedbackInstance | null | undefined;
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
export interface ActionInstanceBase {
|
|
260
|
+
id: string;
|
|
261
|
+
upgradeIndex: number | null;
|
|
262
|
+
disabled: boolean;
|
|
263
|
+
actionId: string;
|
|
264
|
+
options: OptionsObject;
|
|
265
|
+
}
|
|
266
|
+
export interface ActionInstance extends ActionInstanceBase {
|
|
267
|
+
controlId: string;
|
|
268
|
+
}
|
|
269
|
+
export interface UpdateActionInstancesMessage {
|
|
270
|
+
actions: {
|
|
271
|
+
[id: string]: ActionInstance | null | undefined;
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
export interface UpgradeActionInstance extends Omit<ActionInstanceBase, 'options'> {
|
|
275
|
+
options: OptionsObject;
|
|
276
|
+
controlId: string;
|
|
277
|
+
}
|
|
278
|
+
export interface UpgradeFeedbackInstance extends Omit<FeedbackInstanceBase, 'options'> {
|
|
279
|
+
options: OptionsObject;
|
|
280
|
+
isInverted: boolean;
|
|
281
|
+
/**
|
|
282
|
+
* Only used as an output from the module, when the feedback is being converted to a boolean feedback
|
|
283
|
+
*/
|
|
284
|
+
style?: Partial<CompanionFeedbackButtonStyleResult>;
|
|
285
|
+
controlId: string;
|
|
286
|
+
}
|
|
287
|
+
export interface UpgradeActionAndFeedbackInstancesMessage {
|
|
288
|
+
actions: UpgradeActionInstance[];
|
|
289
|
+
feedbacks: UpgradeFeedbackInstance[];
|
|
290
|
+
defaultUpgradeIndex: number | null;
|
|
291
|
+
}
|
|
292
|
+
export interface UpgradeActionAndFeedbackInstancesResponse {
|
|
293
|
+
updatedConfig: unknown;
|
|
294
|
+
updatedSecrets: unknown;
|
|
295
|
+
updatedActions: UpgradeActionInstance[];
|
|
296
|
+
updatedFeedbacks: UpgradeFeedbackInstance[];
|
|
297
|
+
latestUpgradeIndex: number;
|
|
298
|
+
}
|
|
299
|
+
export interface SaveConfigMessage {
|
|
300
|
+
config: unknown | undefined;
|
|
301
|
+
secrets: unknown | undefined;
|
|
302
|
+
}
|
|
303
|
+
export interface SendOscMessage {
|
|
304
|
+
host: string;
|
|
305
|
+
port: number;
|
|
306
|
+
path: string;
|
|
307
|
+
args: OSCSomeArguments;
|
|
308
|
+
}
|
|
309
|
+
export interface ParseVariablesInStringMessage {
|
|
310
|
+
text: string;
|
|
311
|
+
controlId: string | undefined;
|
|
312
|
+
feedbackInstanceId: string | undefined;
|
|
313
|
+
actionInstanceId: string | undefined;
|
|
314
|
+
}
|
|
315
|
+
export interface ParseVariablesInStringResponseMessage {
|
|
316
|
+
text: string;
|
|
317
|
+
variableIds: string[] | undefined;
|
|
318
|
+
}
|
|
319
|
+
export interface HandleHttpRequestMessage {
|
|
320
|
+
request: CompanionHTTPRequest;
|
|
321
|
+
}
|
|
322
|
+
export interface HandleHttpRequestResponseMessage {
|
|
323
|
+
response: CompanionHTTPResponse;
|
|
324
|
+
}
|
|
325
|
+
export interface LearnActionMessage {
|
|
326
|
+
action: ActionInstance;
|
|
327
|
+
}
|
|
328
|
+
export interface LearnActionResponseMessage {
|
|
329
|
+
options: CompanionOptionValues | undefined;
|
|
330
|
+
}
|
|
331
|
+
export interface LearnFeedbackMessage {
|
|
332
|
+
feedback: FeedbackInstance;
|
|
333
|
+
}
|
|
334
|
+
export interface LearnFeedbackResponseMessage {
|
|
335
|
+
options: CompanionOptionValues | undefined;
|
|
336
|
+
}
|
|
337
|
+
export interface StartStopRecordActionsMessage {
|
|
338
|
+
recording: boolean;
|
|
339
|
+
}
|
|
340
|
+
export interface RecordActionMessage {
|
|
341
|
+
uniquenessId: string | null;
|
|
342
|
+
actionId: string;
|
|
343
|
+
options: CompanionOptionValues;
|
|
344
|
+
delay: number | undefined;
|
|
345
|
+
}
|
|
346
|
+
export interface SetCustomVariableMessage {
|
|
347
|
+
customVariableId: string;
|
|
348
|
+
value: CompanionVariableValue;
|
|
349
|
+
/** Control the variable was set from. This should always be defined, but did not exist in older versions */
|
|
350
|
+
controlId: string | undefined;
|
|
351
|
+
}
|
|
352
|
+
export interface VariablesChangedMessage {
|
|
353
|
+
variablesIds: string[];
|
|
354
|
+
}
|
|
355
|
+
export interface SharedUdpSocketError {
|
|
356
|
+
handleId: string;
|
|
357
|
+
portNumber: number;
|
|
358
|
+
error: Error;
|
|
359
|
+
}
|
|
360
|
+
//# sourceMappingURL=api.d.ts.map
|