@companion-surface/base 0.2.0 → 0.3.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/CHANGELOG.md +15 -0
- package/dist/surface-api/detection.d.ts +22 -0
- package/dist/surface-api/detection.d.ts.map +1 -0
- package/dist/surface-api/detection.js +2 -0
- package/dist/surface-api/detection.js.map +1 -0
- package/dist/surface-api/firmware.d.ts +14 -0
- package/dist/surface-api/firmware.d.ts.map +1 -0
- package/dist/surface-api/firmware.js +2 -0
- package/dist/surface-api/firmware.js.map +1 -0
- package/dist/surface-api/index.d.ts +4 -0
- package/dist/surface-api/index.d.ts.map +1 -1
- package/dist/surface-api/index.js +4 -0
- package/dist/surface-api/index.js.map +1 -1
- package/dist/surface-api/input.d.ts +156 -0
- package/dist/surface-api/input.d.ts.map +1 -0
- package/dist/surface-api/input.js +2 -0
- package/dist/surface-api/input.js.map +1 -0
- package/dist/surface-api/instance.d.ts +7 -0
- package/dist/surface-api/instance.d.ts.map +1 -1
- package/dist/surface-api/plugin.d.ts +16 -28
- package/dist/surface-api/plugin.d.ts.map +1 -1
- package/dist/surface-api/remote.d.ts +64 -0
- package/dist/surface-api/remote.d.ts.map +1 -0
- package/dist/surface-api/remote.js +2 -0
- package/dist/surface-api/remote.js.map +1 -0
- package/dist/surface-api/types.d.ts +9 -4
- package/dist/surface-api/types.d.ts.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.3.0](https://github.com/bitfocus/companion-surface-api/compare/companion-surface-base-v0.2.0...companion-surface-base-v0.3.0) (2025-10-28)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* firmware update check api ([080264a](https://github.com/bitfocus/companion-surface-api/commit/080264a4fd3f5f81a936810b030f5d42672f26de))
|
|
9
|
+
* implement firmware update check ([ffa137b](https://github.com/bitfocus/companion-surface-api/commit/ffa137bc65bc046bcbdc7f392746d8f0ce598e69))
|
|
10
|
+
* remote surfaces api ([3f6a4b5](https://github.com/bitfocus/companion-surface-api/commit/3f6a4b5009971f8f301bdacdf8d12f2b9dfdbd02))
|
|
11
|
+
* remote surfaces detection ([0a4b5eb](https://github.com/bitfocus/companion-surface-api/commit/0a4b5eb8deaa540ce40c2613ec4e4e37dcefde97))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* remote surfaces location ([0840197](https://github.com/bitfocus/companion-surface-api/commit/0840197468c2aadd32ab77277ac57332c5c9c28c))
|
|
17
|
+
|
|
3
18
|
## [0.2.0](https://github.com/bitfocus/companion-surface-api/compare/companion-surface-base-v0.1.5...companion-surface-base-v0.2.0) (2025-10-23)
|
|
4
19
|
|
|
5
20
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type EventEmitter from 'node:events';
|
|
2
|
+
import type { DiscoveredSurfaceInfo } from './plugin.js';
|
|
3
|
+
export interface SurfacePluginDetectionEvents<TInfo> {
|
|
4
|
+
surfacesAdded: [surfaceInfos: DiscoveredSurfaceInfo<TInfo>[]];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* For some plugins which only support using a builtin detection mechanism, this can be used to provide the detection info
|
|
8
|
+
*/
|
|
9
|
+
export interface SurfacePluginDetection<TInfo> extends EventEmitter<SurfacePluginDetectionEvents<TInfo>> {
|
|
10
|
+
/**
|
|
11
|
+
* Trigger this plugin to perform a scan for any connected surfaces.
|
|
12
|
+
* This is used when the user triggers a scan, so should refresh any caches when possible
|
|
13
|
+
*/
|
|
14
|
+
triggerScan(): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* When a surface is discovered, but the application has chosen not to open it, this function is called to inform the detection mechanism
|
|
17
|
+
* You can use this to cleanup any resources/handles for this surface, as it will not be used further
|
|
18
|
+
* @param surfaceInfo The info about the surface which was rejected
|
|
19
|
+
*/
|
|
20
|
+
rejectSurface(surfaceInfo: DiscoveredSurfaceInfo<TInfo>): void;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=detection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detection.d.ts","sourceRoot":"","sources":["../../src/surface-api/detection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,aAAa,CAAA;AAC3C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAExD,MAAM,WAAW,4BAA4B,CAAC,KAAK;IAClD,aAAa,EAAE,CAAC,YAAY,EAAE,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;CAE7D;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB,CAAC,KAAK,CAAE,SAAQ,YAAY,CAAC,4BAA4B,CAAC,KAAK,CAAC,CAAC;IACvG;;;OAGG;IACH,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IAE5B;;;;OAIG;IACH,aAAa,CAAC,WAAW,EAAE,qBAAqB,CAAC,KAAK,CAAC,GAAG,IAAI,CAAA;CAC9D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detection.js","sourceRoot":"","sources":["../../src/surface-api/detection.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface SurfaceFirmwareUpdateInfo {
|
|
2
|
+
/**
|
|
3
|
+
* URL to direct the user towards for performing the update
|
|
4
|
+
*/
|
|
5
|
+
updateUrl: string;
|
|
6
|
+
}
|
|
7
|
+
export interface SurfaceFirmwareUpdateCache {
|
|
8
|
+
/**
|
|
9
|
+
* Fetch a json resource from the given URL. Calls will be cached between different surfaces
|
|
10
|
+
* @param url
|
|
11
|
+
*/
|
|
12
|
+
fetchJson(url: string): Promise<any>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=firmware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firmware.d.ts","sourceRoot":"","sources":["../../src/surface-api/firmware.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,yBAAyB;IACzC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,0BAA0B;IAC1C;;;OAGG;IACH,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;CACpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firmware.js","sourceRoot":"","sources":["../../src/surface-api/firmware.ts"],"names":[],"mappings":""}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
export * from './cards.js';
|
|
2
2
|
export * from './context.js';
|
|
3
|
+
export * from './detection.js';
|
|
4
|
+
export * from './firmware.js';
|
|
5
|
+
export * from './input.js';
|
|
3
6
|
export * from './instance.js';
|
|
4
7
|
export * from './pincode.js';
|
|
5
8
|
export * from './plugin.js';
|
|
9
|
+
export * from './remote.js';
|
|
6
10
|
export * from './types.js';
|
|
7
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/surface-api/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/surface-api/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
export * from './cards.js';
|
|
2
2
|
export * from './context.js';
|
|
3
|
+
export * from './detection.js';
|
|
4
|
+
export * from './firmware.js';
|
|
5
|
+
export * from './input.js';
|
|
3
6
|
export * from './instance.js';
|
|
4
7
|
export * from './pincode.js';
|
|
5
8
|
export * from './plugin.js';
|
|
9
|
+
export * from './remote.js';
|
|
6
10
|
export * from './types.js';
|
|
7
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/surface-api/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/surface-api/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
export type InputValue = number | string | boolean;
|
|
2
|
+
export type OptionsObject = {
|
|
3
|
+
[key: string]: InputValue | undefined;
|
|
4
|
+
};
|
|
5
|
+
export type SomeCompanionInputField = CompanionInputFieldStaticText | CompanionInputFieldTextInput | CompanionInputFieldDropdown | CompanionInputFieldNumber | CompanionInputFieldCheckbox;
|
|
6
|
+
/**
|
|
7
|
+
* The common properties for an input field
|
|
8
|
+
*/
|
|
9
|
+
export interface CompanionInputFieldBase {
|
|
10
|
+
/** The unique id of this input field within the input group */
|
|
11
|
+
id: string;
|
|
12
|
+
/** The type of this input field */
|
|
13
|
+
type: 'static-text' | 'textinput' | 'dropdown' | 'number' | 'checkbox';
|
|
14
|
+
/** The label of the field */
|
|
15
|
+
label: string;
|
|
16
|
+
/** A hover tooltip for this field */
|
|
17
|
+
tooltip?: string;
|
|
18
|
+
/** A longer description/summary/notes for this field */
|
|
19
|
+
description?: string;
|
|
20
|
+
/**
|
|
21
|
+
* A companion expression to check whether this input should be visible, based on the current options selections within the input group
|
|
22
|
+
*
|
|
23
|
+
* This is the same syntax as other expressions written inside of Comapnion.
|
|
24
|
+
* You can access a value of the current options using `$(options:some_field_id)`.
|
|
25
|
+
* This does not support the `isVisibleData` property, let us know if you need this.
|
|
26
|
+
*/
|
|
27
|
+
isVisibleExpression?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A static un-editable line of text
|
|
31
|
+
*
|
|
32
|
+
* ### Example
|
|
33
|
+
* ```js
|
|
34
|
+
* {
|
|
35
|
+
* id: 'important-line',
|
|
36
|
+
* type: 'static-text',
|
|
37
|
+
* label: 'Important info',
|
|
38
|
+
* value: 'Some message here'
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export interface CompanionInputFieldStaticText extends CompanionInputFieldBase {
|
|
43
|
+
type: 'static-text';
|
|
44
|
+
/** The text to show */
|
|
45
|
+
value: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A basic text input field
|
|
49
|
+
*
|
|
50
|
+
* ### Example
|
|
51
|
+
* ```js
|
|
52
|
+
* {
|
|
53
|
+
* id: 'val',
|
|
54
|
+
* type: 'textinput',
|
|
55
|
+
* label: 'Provide name',
|
|
56
|
+
* 'default': 'Bob'
|
|
57
|
+
* }
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export interface CompanionInputFieldTextInput extends CompanionInputFieldBase {
|
|
61
|
+
type: 'textinput';
|
|
62
|
+
/**
|
|
63
|
+
* The default text value
|
|
64
|
+
*/
|
|
65
|
+
default?: string;
|
|
66
|
+
/**
|
|
67
|
+
* A regex to use to inform the user if the current input is valid.
|
|
68
|
+
* Note: values may not conform to this, it is a visual hint only
|
|
69
|
+
*/
|
|
70
|
+
regex?: string;
|
|
71
|
+
}
|
|
72
|
+
export type DropdownChoiceId = string | number;
|
|
73
|
+
/**
|
|
74
|
+
* An option for a dropdown input
|
|
75
|
+
*
|
|
76
|
+
* Available for actions/feedbacks/config
|
|
77
|
+
*/
|
|
78
|
+
export interface DropdownChoice {
|
|
79
|
+
/** Value of the option */
|
|
80
|
+
id: DropdownChoiceId;
|
|
81
|
+
/** Label to show to users */
|
|
82
|
+
label: string;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* A dropdown input field
|
|
86
|
+
*
|
|
87
|
+
* ### Example
|
|
88
|
+
* ```js
|
|
89
|
+
* {
|
|
90
|
+
* id: 'val',
|
|
91
|
+
* type: 'dropdown',
|
|
92
|
+
* label: 'Select name',
|
|
93
|
+
* choices: [
|
|
94
|
+
* { id: 'bob', label: 'Bob' },
|
|
95
|
+
* { id: 'sally', label: 'Sally' },
|
|
96
|
+
* ],
|
|
97
|
+
* default: 'bob'
|
|
98
|
+
* }
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
export interface CompanionInputFieldDropdown extends CompanionInputFieldBase {
|
|
102
|
+
type: 'dropdown';
|
|
103
|
+
/** The possible choices */
|
|
104
|
+
choices: DropdownChoice[];
|
|
105
|
+
/** The default selected value */
|
|
106
|
+
default: DropdownChoiceId;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* A checkbox input field
|
|
110
|
+
*
|
|
111
|
+
* ### Example
|
|
112
|
+
* ```js
|
|
113
|
+
* {
|
|
114
|
+
* id: 'doit',
|
|
115
|
+
* type: 'checkbox',
|
|
116
|
+
* label: 'Do the thing',
|
|
117
|
+
* default: true
|
|
118
|
+
* }
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
export interface CompanionInputFieldCheckbox extends CompanionInputFieldBase {
|
|
122
|
+
type: 'checkbox';
|
|
123
|
+
/** The default value */
|
|
124
|
+
default: boolean;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* A number input field
|
|
128
|
+
*
|
|
129
|
+
* ### Example
|
|
130
|
+
* ```js
|
|
131
|
+
* {
|
|
132
|
+
* id: 'size',
|
|
133
|
+
* type: 'number',
|
|
134
|
+
* label: 'Target size',
|
|
135
|
+
* default: 50,
|
|
136
|
+
* min: 0,
|
|
137
|
+
* max: 100
|
|
138
|
+
* }
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
export interface CompanionInputFieldNumber extends CompanionInputFieldBase {
|
|
142
|
+
type: 'number';
|
|
143
|
+
/** The default value */
|
|
144
|
+
default: number;
|
|
145
|
+
/**
|
|
146
|
+
* The minimum value to allow
|
|
147
|
+
* Note: values may not conform to this, it is a visual hint only
|
|
148
|
+
*/
|
|
149
|
+
min: number;
|
|
150
|
+
/**
|
|
151
|
+
* The maximum value to allow
|
|
152
|
+
* Note: values may not conform to this, it is a visual hint only
|
|
153
|
+
*/
|
|
154
|
+
max: number;
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/surface-api/input.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;AAElD,MAAM,MAAM,aAAa,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAAA;CAAE,CAAA;AAErE,MAAM,MAAM,uBAAuB,GAChC,6BAA6B,GAC7B,4BAA4B,GAC5B,2BAA2B,GAC3B,yBAAyB,GACzB,2BAA2B,CAA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A;IAChB,wBAAwB;IACxB,OAAO,EAAE,OAAO,CAAA;CAChB;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,yBAA0B,SAAQ,uBAAuB;IACzE,IAAI,EAAE,QAAQ,CAAA;IAEd,wBAAwB;IACxB,OAAO,EAAE,MAAM,CAAA;IAEf;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAA;CACX"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../src/surface-api/input.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CardGenerator } from './cards.js';
|
|
2
|
+
import type { SurfaceFirmwareUpdateCache, SurfaceFirmwareUpdateInfo } from './firmware.js';
|
|
2
3
|
import type { SurfaceDrawProps, SurfaceId } from './types.js';
|
|
3
4
|
export interface SurfaceInstance {
|
|
4
5
|
/**
|
|
@@ -48,5 +49,11 @@ export interface SurfaceInstance {
|
|
|
48
49
|
* @param cardGenerator Card generator to create the status image(s)
|
|
49
50
|
*/
|
|
50
51
|
showStatus(signal: AbortSignal, cardGenerator: CardGenerator, statusMessage: string): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Check for firmware updates for this surface
|
|
54
|
+
* @param versionsCache Cache object to assist with caching any api calls needed to determine latest versions
|
|
55
|
+
* @returns Firmware update info, or null if no update is available
|
|
56
|
+
*/
|
|
57
|
+
checkForFirmwareUpdates?(versionsCache: SurfaceFirmwareUpdateCache): Promise<SurfaceFirmwareUpdateInfo | null>;
|
|
51
58
|
}
|
|
52
59
|
//# sourceMappingURL=instance.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instance.d.ts","sourceRoot":"","sources":["../../src/surface-api/instance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,KAAK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
-
surfacesAdded: [surfaceInfos: DiscoveredSurfaceInfo<TInfo>[]];
|
|
11
|
-
surfacesRemoved: [surfaceIds: SurfaceId[]];
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* For some plugins which only support using a builtin detection mechanism, this can be used to provide the detection info
|
|
15
|
-
*/
|
|
16
|
-
export interface SurfacePluginDetection<TInfo> extends EventEmitter<SurfacePluginDetectionEvents<TInfo>> {
|
|
17
|
-
/**
|
|
18
|
-
* Trigger this plugin to perform a scan for any connected surfaces.
|
|
19
|
-
* This is used when the user triggers a scan, so should refresh any caches when possible
|
|
20
|
-
*/
|
|
21
|
-
triggerScan(): Promise<void>;
|
|
22
|
-
/**
|
|
23
|
-
* When a surface is discovered, but the application has chosen not to open it, this function is called to inform the detection mechanism
|
|
24
|
-
* You can use this to cleanup any resources/handles for this surface, as it will not be used further
|
|
25
|
-
* @param surfaceInfo The info about the surface which was rejected
|
|
26
|
-
*/
|
|
27
|
-
rejectSurface(surfaceInfo: DiscoveredSurfaceInfo<TInfo>): void;
|
|
28
|
-
}
|
|
1
|
+
import type { HIDDevice, OpenSurfaceResult } from './types.js';
|
|
2
|
+
import type { SurfaceContext } from './context.js';
|
|
3
|
+
import type { SurfacePluginDetection } from './detection.js';
|
|
4
|
+
import { SurfacePluginRemote } from './remote.js';
|
|
29
5
|
/**
|
|
30
6
|
* The base SurfacePlugin interface, for all surface plugins
|
|
31
7
|
*/
|
|
@@ -38,6 +14,13 @@ export interface SurfacePlugin<TInfo> {
|
|
|
38
14
|
* Note: it is important that no events are emitted from this until after init() has been invoked, or they will be lost
|
|
39
15
|
*/
|
|
40
16
|
readonly detection?: SurfacePluginDetection<TInfo>;
|
|
17
|
+
/**
|
|
18
|
+
* Some plugins can make connections to IP/cloud based surfaces
|
|
19
|
+
* In this case, this property should be set to an instance of SurfacePluginRemote
|
|
20
|
+
*
|
|
21
|
+
* Note: it is important that no events are emitted from this until after init() has been invoked, or they will be lost
|
|
22
|
+
*/
|
|
23
|
+
readonly remote?: SurfacePluginRemote<TInfo>;
|
|
41
24
|
/**
|
|
42
25
|
* Initialize the plugin
|
|
43
26
|
*
|
|
@@ -72,4 +55,9 @@ export interface SurfacePlugin<TInfo> {
|
|
|
72
55
|
*/
|
|
73
56
|
openSurface: (surfaceId: string, pluginInfo: TInfo, context: SurfaceContext) => Promise<OpenSurfaceResult>;
|
|
74
57
|
}
|
|
58
|
+
export interface DiscoveredSurfaceInfo<TInfo> {
|
|
59
|
+
surfaceId: string;
|
|
60
|
+
description: string;
|
|
61
|
+
pluginInfo: TInfo;
|
|
62
|
+
}
|
|
75
63
|
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/surface-api/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/surface-api/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAEjD;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,KAAK;IACnC;;;;;;OAMG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,sBAAsB,CAAC,KAAK,CAAC,CAAA;IAElD;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,mBAAmB,CAAC,KAAK,CAAC,CAAA;IAE5C;;;;OAIG;IACH,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IAErB;;;;OAIG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IAExB;;;;;OAKG;IACH,sBAAsB,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,qBAAqB,CAAC,KAAK,CAAC,GAAG,IAAI,CAAA;IAEnF;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,OAAO,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IAE/D;;;;;;;OAOG;IACH,WAAW,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAA;CAC1G;AAED,MAAM,WAAW,qBAAqB,CAAC,KAAK;IAC3C,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,KAAK,CAAA;CACjB"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type EventEmitter from 'node:events';
|
|
2
|
+
import type { OptionsObject, SomeCompanionInputField } from './input.js';
|
|
3
|
+
import type { RemoteSurfaceConnectionInfo } from './types.js';
|
|
4
|
+
import type { DiscoveredSurfaceInfo } from './plugin.js';
|
|
5
|
+
export interface SurfacePluginRemoteEvents<TInfo> {
|
|
6
|
+
surfacesConnected: [surfaceInfos: DiscoveredSurfaceInfo<TInfo>[]];
|
|
7
|
+
/**
|
|
8
|
+
* Fired when surface discovery detects new surfaces
|
|
9
|
+
* This is used as suggestions in the ui of remote surfaces the user can setup
|
|
10
|
+
*/
|
|
11
|
+
connectionsFound: [connectionInfos: DiscoveredRemoteSurfaceInfo[]];
|
|
12
|
+
/**
|
|
13
|
+
* Fired when previously detected surfaces are forgotten
|
|
14
|
+
* This is the opposite of connectionsFound, to forget any connections which are no longer available
|
|
15
|
+
*/
|
|
16
|
+
connectionsForgotten: [connectionIds: string[]];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* For some plugins which only support using a builtin detection mechanism, this can be used to provide the detection info
|
|
20
|
+
*/
|
|
21
|
+
export interface SurfacePluginRemote<TInfo> extends EventEmitter<SurfacePluginRemoteEvents<TInfo>> {
|
|
22
|
+
/**
|
|
23
|
+
* Get any configuration fields needed for configuring a remote connection
|
|
24
|
+
*
|
|
25
|
+
* Note: This gets called once during plugin initialisation. Changes made after this will not be detected
|
|
26
|
+
*/
|
|
27
|
+
readonly configFields: SomeCompanionInputField[];
|
|
28
|
+
/**
|
|
29
|
+
* Setup one or more connections to remote surfaces
|
|
30
|
+
* @param connectionInfos Info about the connections to add
|
|
31
|
+
*/
|
|
32
|
+
startConnections(connectionInfos: RemoteSurfaceConnectionInfo[]): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Stop one or more connections to remote surfaces
|
|
35
|
+
* @param connectionIds Ids of the connections to remove
|
|
36
|
+
*/
|
|
37
|
+
stopConnections(connectionIds: string[]): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* When a surface is discovered, but the application has chosen not to open it, this function is called to inform the detection mechanism
|
|
40
|
+
* You can use this to cleanup any resources/handles for this surface, as it will not be used further
|
|
41
|
+
* @param surfaceInfo The info about the surface which was rejected
|
|
42
|
+
*/
|
|
43
|
+
rejectSurface(surfaceInfo: DiscoveredSurfaceInfo<TInfo>): void;
|
|
44
|
+
}
|
|
45
|
+
export interface DiscoveredRemoteSurfaceInfo {
|
|
46
|
+
/**
|
|
47
|
+
* A unique id. This is used to identify the connection for updates and being forgotten
|
|
48
|
+
*/
|
|
49
|
+
id: string;
|
|
50
|
+
/**
|
|
51
|
+
* A user friendly name for the connection. Such as the hostname or user chosen name
|
|
52
|
+
*/
|
|
53
|
+
displayName: string;
|
|
54
|
+
/**
|
|
55
|
+
* A secondary description for the connection. Such as the model or device type
|
|
56
|
+
*/
|
|
57
|
+
description: string;
|
|
58
|
+
/**
|
|
59
|
+
* The configuration object to use for connecting to this remote surface.
|
|
60
|
+
* This should match the schema defined with `configFields`, as once added it will be user editable with those fields
|
|
61
|
+
*/
|
|
62
|
+
config: OptionsObject;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=remote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,CAAA;IAKnB;;;OAGG;IACH,MAAM,EAAE,aAAa,CAAA;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote.js","sourceRoot":"","sources":["../../src/surface-api/remote.ts"],"names":[],"mappings":""}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { SurfacePincodeMap } from './pincode.js';
|
|
2
2
|
import type { SurfaceInstance } from './instance.js';
|
|
3
3
|
import type { SurfaceSchemaLayoutDefinition } from '../../generated/surface-layout.d.ts';
|
|
4
|
+
import type { OptionsObject } from './input.js';
|
|
4
5
|
/**
|
|
5
6
|
* A representation of a HID device
|
|
6
7
|
* A simplified form of the HIDDevice from node-hid
|
|
@@ -52,10 +53,10 @@ export interface SurfaceRegisterProps {
|
|
|
52
53
|
* If the surface supports pincode entry, this is the desired arrangement of the pin entry buttons
|
|
53
54
|
*/
|
|
54
55
|
pincodeMap: SurfacePincodeMap | null;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
/**
|
|
57
|
+
* A user facing location string for the surface
|
|
58
|
+
*/
|
|
59
|
+
location: string | null;
|
|
59
60
|
}
|
|
60
61
|
export interface OpenSurfaceResult {
|
|
61
62
|
surface: SurfaceInstance;
|
|
@@ -82,4 +83,8 @@ export interface GridSize {
|
|
|
82
83
|
rows: number;
|
|
83
84
|
columns: number;
|
|
84
85
|
}
|
|
86
|
+
export interface RemoteSurfaceConnectionInfo {
|
|
87
|
+
connectionId: string;
|
|
88
|
+
config: OptionsObject;
|
|
89
|
+
}
|
|
85
90
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/surface-api/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,K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AAA;IACnB;;OAEG;IACH,aAAa,EAAE,6BAA6B,CAAA;IAC5C;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,KAAK,CAAC,oBAAoB,GAAG,qBAAqB,CAAC,CAAA;IACvE;;OAEG;IACH,UAAU,EAAE,iBAAiB,GAAG,IAAI,CAAA;IAEpC;;OAEG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CACvB;AAED,MAAM,WAAW,iBAAiB;IACjC,OAAO,EAAE,eAAe,CAAA;IACxB,aAAa,EAAE,oBAAoB,CAAA;CACnC;AAED,MAAM,WAAW,gBAAgB;IAChC,SAAS,EAAE,MAAM,CAAA;IAEjB;;OAEG;IACH,KAAK,CAAC,EAAE,UAAU,CAAA;IAElB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,QAAQ;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,2BAA2B;IAC3C,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,aAAa,CAAA;CACrB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@companion-surface/base",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/bitfocus/companion-surface-api",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"docs:html": "typedoc --tsconfig tsconfig.build.json --entryPoints src/main.ts --excludePrivate --theme default --out docs"
|
|
19
19
|
},
|
|
20
20
|
"engines": {
|
|
21
|
-
"node": "^22.
|
|
21
|
+
"node": "^22.21"
|
|
22
22
|
},
|
|
23
23
|
"files": [
|
|
24
24
|
"README.md",
|